int pntpos (const obsd_t *obs, int n, const nav_t *nav, const prcopt_t *opt, sol_t *sol,
double *azel, ssat_t *ssat, char *msg)
所在文件:pntpos.c
功能说明:依靠多普勒频移测量值和伪距来进行单点定位,给出接收机的位置、速度和钟差
参数说明:
函数参数,8个: obsd_t *obs I observation data int n I number of observation data nav_t *nav I navigation data prcopt_t *opt I processing options sol_t *sol IO solution double *azel IO azimuth/elevation angle (rad) (NULL: no output) ssat_t *ssat IO satellite status (NULL: no output) char *msg O error message for error exit 返回类型: int O (1:ok,0:error)
void satposs(gtime_t teph, const obsd_t *obs, int n, const nav_t *nav,
int ephopt, double *rs, double *dts, double *var, int *svh)
所在文件:ephemeris.c
功能说明:按照所观测到的卫星顺序计算出每颗卫星的位置、速度、{钟差、频漂}
参数说明:
函数参数,9个: gtime_t teph I time to select ephemeris (gpst) obsd_t *obs I observation data int n I number of observation data nav_t *nav I navigation data int ephopt I ephemeris option (EPHOPT_???) double *rs O satellite positions and velocities,长度为6*n,{x,y,z,vx,vy,vz}(ecef)(m,m/s) double *dts O satellite clocks,长度为2*n, {bias,drift} (s|s/s) double *var O sat position and clock error variances (m^2) int *svh O sat health flag (-1:correction not available) 返回类型: none
参数说明:
函数参数,13个: obsd_t *obs I observation data int n I number of observation data double *rs I satellite positions and velocities,长度为6*n,{x,y,z,vx,vy,vz}(ecef)(m,m/s) double *dts I satellite clocks,长度为2*n, {bias,drift} (s|s/s) double *vare I sat position and clock error variances (m^2) int *svh I sat health flag (-1:correction not available) nav_t *nav I navigation data prcopt_t *opt I processing options sol_t *sol IO solution double *azel IO azimuth/elevation angle (rad) int *vsat IO 表征卫星在定位时是否有效 double *resp IO 定位后伪距残差 (P-(r+c*dtr-c*dts+I+T)) char *msg O error message for error exit 返回类型: int O (1:ok,0:error)
参数说明:
函数参数,13个: obsd_t *obs I observation data int n I number of observation data double *rs I satellite positions and velocities,长度为6*n,{x,y,z,vx,vy,vz}(ecef)(m,m/s) double *dts I satellite clocks,长度为2*n, {bias,drift} (s|s/s) double *vare I sat position and clock error variances (m^2) int *svh I sat health flag (-1:correction not available) nav_t *nav I navigation data prcopt_t *opt I processing options sol_t *sol IO solution double *azel IO azimuth/elevation angle (rad) int *vsat IO 表征卫星在定位时是否有效 double *resp IO 定位后伪距残差 (P-(r+c*dtr-c*dts+I+T)) char *msg O error message for error exit 返回类型: int O (1:ok,0:error)
调用关系:
```flow
st=>start: raim_fde
estpos_=>operation: estpos
e=>end: end
源码中有很多关于 i、j、k的循环。其中,i表示最外面的大循环,每次将将第 i颗卫星舍弃不用,这是通过 if (j==i) continue实现的;j表示剩余使用的卫星的循环,每次进行相应数据的赋值;k表示参与定位的卫星的循环,与 j一起使用。
我的疑惑:
这里执行 RAIM至少要有 6颗可用卫星,可是我感觉 5颗就够了呀!
estvel
代码语言:javascript
复制
void estvel(const obsd_t *obs, int n, const double *rs, const double *dts,
const nav_t *nav, const prcopt_t *opt, sol_t *sol,
const double *azel, const int *vsat)
所在文件:pntpos.c
功能说明:依靠多普勒频移测量值计算接收机的速度。
参数说明:
函数参数,9个: obsd_t *obs I observation data int n I number of observation data double *rs I satellite positions and velocities,长度为6*n,{x,y,z,vx,vy,vz}(ecef)(m,m/s) double *dts I satellite clocks,长度为2*n, {bias,drift} (s|s/s) nav_t *nav I navigation data prcopt_t *opt I processing options sol_t *sol IO solution double *azel IO azimuth/elevation angle (rad) int *vsat IO 表征卫星在定位时是否有效 返回类型: int O (1:ok,0:error)
调用关系:
```flow
st=>start: estvel
resdop_=>operation: resdop
lsq_=>operation: lsq
e=>end: end
int ephclk(gtime_t time, gtime_t teph, int sat, const nav_t *nav, double *dts)
所在文件:ephemeris.c
功能说明:通过广播星历来确定卫星钟偏
参数说明:
函数参数,5个: gtime_t time I transmission time by satellite clock gtime_t teph I time to select ephemeris (gpst) int sat I satellite number (1-MAXSAT) nav_t *nav I navigation data double *dts O satellite clocks,长度为2*n, {bias,drift} (s|s/s) 返回类型: int O (1:ok,0:error)
int satpos(gtime_t time, gtime_t teph, int sat, int ephopt, const nav_t *nav,
double *rs, double *dts, double *var, int *svh)
所在文件:ephemeris.c
功能说明:计算信号发射时刻卫星的 P(ecef,m)、V(ecef,m/s)、C((s|s/s))
参数说明:
函数参数,9个: gtime_t time I time (gpst) gtime_t teph I time to select ephemeris (gpst) int sat I satellite number nav_t *nav I navigation data int ephopt I ephemeris option (EPHOPT_???) double *rs O sat position and velocity {x,y,z,vx,vy,vz} (ecef)(m|m/s) double *dts O sat clock {bias,drift} (s|s/s) double *var O sat position and clock error variance (m^2) int *svh O sat health flag (-1:correction not available) 返回类型: int O (1:ok,0:error)
调用关系:
```flow
st=>start: satpos
ephpos_=>operation: ephpos
e=>end: end
参数说明:
函数参数,2个: int sat I satellite number (1-MAXSAT) int *prn IO satellite prn/slot number (NULL: no output) 返回类型: int satellite system (SYS_GPS,SYS_GLO,...)
参数说明:
函数参数,4个: gtime_t time I time to select ephemeris (gpst) int sat I satellite number (1-MAXSAT) int iode I 星历数据期号 nav_t *nav I navigation data 返回类型: eph_t * 星历数据
参数说明:
函数参数,2个 gtime_t time I time by satellite clock (gpst) eph_t *eph I broadcast ephemeris 返回类型: double satellite clock bias (s) without relativeity correction
处理过程:
计算与星历参考时间的偏差 dt = t-toc。
利用二项式校正计算出卫星钟差,从 dt中减去这部分,然后再进行一次上述操作,得到最终的 dt。
使用二项式校正得到最终的钟差。
我的疑惑:
看不懂上述处理过程,跟以往资料上都不一样。咋回事?
ephpos
代码语言:javascript
复制
int ephpos(gtime_t time, gtime_t teph, int sat, const nav_t *nav,
int iode, double *rs, double *dts, double *var, int *svh)
所在文件:ephemeris.c
功能说明:根据广播星历计算出算信号发射时刻卫星的 P、V、C
参数说明:
函数参数,9个 gtime_t time I transmission time by satellite clock gtime_t teph I time to select ephemeris (gpst) int sat I satellite number (1-MAXSAT) nav_t *nav I navigation data int iode I 星历数据期号 double *rs O satellite positions and velocities,长度为6*n,{x,y,z,vx,vy,vz}(ecef)(m,m/s) double *dts O satellite clocks,长度为2*n, {bias,drift} (s|s/s) double *var O sat position and clock error variances (m^2) int *svh O sat health flag (-1:correction not available) 返回类型: int O (1:ok,0:error)
参数说明:
函数参数,5个 gtime_t time I transmission time by satellite clock eph_t *eph I broadcast ephemeris double *rs O satellite positions and velocities,长度为6*n,{x,y,z,vx,vy,vz}(ecef)(m,m/s) double *dts O satellite clocks,长度为2*n, {bias,drift} (s|s/s) double *var O sat position and clock error variances (m^2) 返回类型: none
参数说明:
函数参数,17个 int iter I 迭代次数 obsd_t *obs I observation data int n I number of observation data double *rs I satellite positions and velocities,长度为6*n,{x,y,z,vx,vy,vz}(ecef)(m,m/s) double *dts I satellite clocks,长度为2*n, {bias,drift} (s|s/s) double *vare I sat position and clock error variances (m^2) int *svh I sat health flag (-1:correction not available) nav_t *nav I navigation data double *x I 本次迭代开始之前的定位值 prcopt_t *opt I processing options double *v O 定位方程的右端部分,伪距残余 double *H O 定位方程中的几何矩阵 double *var O 参与定位的伪距残余方差 double *azel O 对于当前定位值,每一颗观测卫星的 {方位角、高度角} int *vsat O 每一颗观测卫星在当前定位时是否有效 double *resp O 每一颗观测卫星的伪距残余, (P-(r+c*dtr-c*dts+I+T)) int *ns O 参与定位的卫星的个数 返回类型: int O 定位方程组的方程个数
关于 5中的去除重复数据的过程,有以下几个看法:
① 这样做的前提是相同卫星的重复数据必须相邻出现!
② 为什么在这里要进行重复数据检测,在构建 obsd_t结构体时就可以进行这项工作呀?
③ 5中当数据重复时,i++后继续下一次循环,这样的话会直接略去后面所重复的数据,这样做就会将两个相邻重复数据都忽略掉,就相当于重复数据都不使用。感觉可以用其中一个的啊!
参数说明:
函数参数,6个 double *A I transpose of (weighted) design matrix (n x m) double *y I (weighted) measurements (m x 1) int n,m I number of parameters and measurements (n<=m) double *x O estmated parameters (n x 1) double *Q O esimated parameters covariance matrix (n x n) 返回类型: int O (0:ok,0>:error)
调用关系:
```flow
st=>start: lsq
matmul_=>operation: matmul
matinv_=>operation: matinv
e=>end: end
参数说明:
函数参数,8个 double *azel I azimuth/elevation angle (rad) int *vsat I 表征卫星在定位时是否有效 int n I number of observation data prcopt_t *opt I processing options double *v I 定位后伪距残差 (P-(r+c*dtr-c*dts+I+T)) int nv I 定位方程的方程个数 int nx I 未知数的个数 char *msg O error message for error exit 返回类型: int O (1:ok,0:error)
调用关系:
```flow
st=>start: valsol
dops_=>operation: dops
e=>end: end
void matmul(const char *tr, int n, int k, int m, double alpha,
const double *A, const double *B, double beta, double *C)
所在文件:rtkcmn.c
功能说明:可进行如下矩阵运算 C = alphaAB + beta*C,并且能通过 tr标志来选择是否对 A、B进行转置
参数说明:
函数参数,6个 char *tr I transpose flags ("N":normal,"T":transpose) int n,k,m I size of (transposed) matrix A,B double alpha I alpha double *A,*B I (transposed) matrix A (n x m), B (m x k) double beta I beta double *C IO matrix C (n x k) 返回类型: none
处理过程:
根据 tr的值确定矩阵相乘标志,即
$$
\begin{matrix}
AB \rightarrow NN \rightarrow 1 \ AB^T \rightarrow NT \rightarrow 2 \
A^TB \rightarrow TN \rightarrow 3 \ A^TB^T \rightarrow TT \rightarrow 4
\end{matrix}
$$
参数说明:
函数参数,4个 int ns I number of satellites double *azel I satellite azimuth/elevation angle (rad) double elmin I elevation cutoff angle (rad) double *dop O DOPs {GDOP,PDOP,HDOP,VDOP} 返回类型: none
调用关系:
```flow
st=>start: dops
matmul_=>operation: matmul
matinv_=>operation: matinv
e=>end: end
参数说明:
函数参数,3个 double *pos I geodetic position {lat,lon} (rad) double *r I vector in ecef coordinate {x,y,z} double *e O vector in local tangental coordinate {e,n,u} 返回类型: none
调用关系:
```flow
st=>start: ecef2enu
xyz2enu_=>operation: xyz2enu
matmul_=>operation: matmul
e=>end: end
参数说明:
函数参数,3个 double *rs I satellilte position (ecef at transmission) (m) double *rr I receiver position (ecef at reception) (m) double *e O line-of-sight unit vector (ecef) 返回类型: double O geometric distance (m) (0>:error/no satellite position)
参数说明:
函数参数,6个 obsd_t *obs I observation data nav_t *nav I navigation data double *azel I 对于当前定位值,每一颗观测卫星的 {方位角、高度角} int iter I 迭代次数 prcopt_t *opt I processing options double *vare O 伪距测量的码偏移误差 返回类型: double O 最终能参与定位解算的伪距值
参数说明:
函数参数,3个 int sat I satellite number,从 1开始 int svh I sv health flag(0:ok) prcopt_t *opt I processing options (NULL: not used) 返回类型: int O 1:excluded,0:not excluded
int ionocorr(gtime_t time, const nav_t *nav, int sat, const double *pos,
const double *azel, int ionoopt, double *ion, double *var)
所在文件:pntpos.c
功能说明:计算给定电离层选项时的电离层延时(m)。
参数说明:
函数参数,8个 gtime_t time I time nav_t *nav I navigation data int sat I satellite number double *pos I receiver position {lat,lon,h} (rad|m) double *azel I azimuth/elevation angle {az,el} (rad) int ionoopt I ionospheric correction option (IONOOPT_???) double *ion O ionospheric delay (L1) (m) double *var O ionospheric delay (L1) variance (m^2) 返回类型: int O (1:ok,0:error)
int int tropcorr(gtime_t time, const nav_t *nav, const double *pos,
const double *azel, int tropopt, double *trp, double *var)
所在文件:pntpos.c
功能说明:计算对流层延时(m)。
参数说明:
函数参数,7个 gtime_t time I time nav_t *nav I navigation data double *pos I receiver position {lat,lon,h} (rad|m) double *azel I azimuth/elevation angle {az,el} (rad) int tropopt I tropospheric correction option (TROPOPT_???) double *trp O tropospheric delay (m) double *var O tropospheric delay variance (m^2) 返回类型: int O (1:ok,0:error)
调用关系:
```flow
st=>start: tropcorr
tropmodel_=>operation: tropmodel
e=>end: end
int testsnr(int base, int freq, double el, double snr,
const snrmask_t *mask)
所在文件:rtkcmn.c
功能说明:检测接收机所属类型和频率信号的有效性
参数说明:
函数参数,5个 int base I rover or base-station (0:rover,1:base station) int freq I frequency (0:L1,1:L2,2:L3,...) double el I elevation angle (rad) double snr I C/N0 (dBHz) snrmask_t *mask I SNR mask 返回类型: int O (1:masked,0:unmasked)
调用关系:
```flow
st=>start: dops
matmul_=>operation: matmul
matinv_=>operation: matinv
e=>end: end
参数说明:
函数参数,4个 gtime_t t I time (gpst) double *ion I iono model parameters {a0,a1,a2,a3,b0,b1,b2,b3} double *pos I receiver position {lat,lon,h} (rad,m) double *azel I azimuth/elevation angle {az,el} (rad) 返回类型: double O ionospheric delay (L1) (m)
int iontec(gtime_t time, const nav_t *nav, const double *pos,
const double *azel, int opt, double *delay, double *var)
所在文件:ionex.c
功能说明:由所属时间段两端端点的 TEC网格数据插值计算出电离层延时 (L1) (m)
参数说明:
函数参数,3个 gtime_t time I time (gpst) nav_t *nav I navigation data double *pos I receiver position {lat,lon,h} (rad,m) double *azel I azimuth/elevation angle {az,el} (rad) int opt I model option bit0: 0:earth-fixed,1:sun-fixed bit1: 0:single-layer,1:modified single-layer double *delay O ionospheric delay (L1) (m) double *var O ionospheric dealy (L1) variance (m^2) 返回类型: int O (1:ok,0:error)
调用关系:
```flow
st=>start: iontec
iondelay_=>operation: iondelay
e=>end: end
int iondelay(gtime_t time, const tec_t *tec, const double *pos,
const double *azel, int opt, double *delay, double *var)
所在文件:ionex.c
功能说明:根据当前电离层网格模型,计算电离层延时 (L1) (m)。
参数说明:
函数参数,3个 gtime_t time I time (gpst) tec_t *tec I tec grid data double *pos I receiver position {lat,lon,h} (rad,m) double *azel I azimuth/elevation angle {az,el} (rad) int opt I model option bit0: 0:earth-fixed,1:sun-fixed bit1: 0:single-layer,1:modified single-layer double *delay O ionospheric delay (L1) (m) double *var O ionospheric dealy (L1) variance (m^2) 返回类型: int O (1:ok,0:error)
调用关系:
```flow
st=>start: iondelay
ionppp_=>operation: ionppp
interptec_=>operation: interptec
e=>end: end
参数说明:
函数参数,5个 double *pos I receiver position {lat,lon,h} (rad,m) double *azel I azimuth/elevation angle {az,el} (rad) double re I earth radius (km) double hion I altitude of ionosphere (km) double *posp O pierce point position {lat,lon,h} (rad,m) 返回类型: double O 倾斜率
int interptec(const tec_t *tec, int k, const double *posp, double *value,
double *rms)
所在文件:ionex.c
功能说明:通过在经纬度网格点上进行双线性插值,计算第 k个高度层时穿刺点处的电子数总量 TEC
参数说明:
函数参数,5个 tec_t *tec I tec grid data int k I 高度方向上的序号,可以理解为电离层序号 double *posp I pierce point position {lat,lon,h} (rad,m) double *value O 计算得到的刺穿点处的电子数总量(tecu) double *rms O 所计算的电子数总量的误差的标准差(tecu) 返回类型: int O (1:ok,0:error)
参数说明:
函数参数,4个 gtime_t time I time double *pos I receiver position {lat,lon,h} (rad,m) double *azel I azimuth/elevation angle {az,el} (rad) double humi I relative humidity 返回类型: double O tropospheric delay (m)
int resdop(const obsd_t *obs, int n, const double *rs, const double *dts,
const nav_t *nav, const double *rr, const double *x,
const double *azel, const int *vsat, double *v, double *H)
所在文件:pntpos.c
功能说明:计算定速方程组左边的几何矩阵和右端的速度残余,返回定速时所使用的卫星数目
参数说明:
函数参数,11个: obsd_t *obs I observation data int n I number of observation data double *rs I satellite positions and velocities,长度为6*n,{x,y,z,vx,vy,vz}(ecef)(m,m/s) double *dts I satellite clocks,长度为2*n, {bias,drift} (s|s/s) nav_t *nav I navigation data double *rr I receiver positions and velocities,长度为6,{x,y,z,vx,vy,vz}(ecef)(m,m/s) double *x I 本次迭代开始之前的定速值 double *azel I azimuth/elevation angle (rad) int *vsat I 表征卫星在定速时是否有效 double *v O 定速方程的右端部分,速度残余 double *H O 定速方程中的几何矩阵 返回类型: int O 定速时所使用的卫星数目