1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-01-15 19:55:47 +00:00

Make code more readable

This commit is contained in:
Carles Fernandez 2017-05-06 12:34:09 +02:00
parent 4f6ba053ef
commit f49e5ae3b0
2 changed files with 1221 additions and 1061 deletions

File diff suppressed because it is too large Load Diff

View File

@ -57,48 +57,28 @@
#include "rtklib.h"
#define SQR(x) ((x)*(x))
#define MIN(x,y) ((x)<=(y)?(x):(y))
#define ROUND(x) (int)floor((x)+0.5)
#define MIN_PPP(x,y) ((x)<=(y)?(x):(y))
#define ROUND_PPP(x) (int)floor((x)+0.5)
#define SWAP_I(x,y) do {int _z=x; x=y; y=_z;} while (0)
#define SWAP_D(x,y) do {double _z=x; x=y; y=_z;} while (0)
#define MIN_ARC_GAP 300.0 /* min arc gap (s) */
#define CONST_AMB 0.001 /* constraint to fixed ambiguity */
#define THRES_RES 0.3 /* threashold of residuals test (m) */
#define LOG_PI 1.14472988584940017 /* log(pi) */
#define SQRT2 1.41421356237309510 /* sqrt(2) */
const double MIN_ARC_GAP = 300.0; /* min arc gap (s) */
const double CONST_AMB = 0.001; /* constraint to fixed ambiguity */
const double THRES_RES = 0.3; /* threashold of residuals test (m) */
const double LOG_PI = 1.14472988584940017; /* log(pi) */
const double SQRT2 = 1.41421356237309510; /* sqrt(2) */
#define AS2R (D2R/3600.0) /* arc sec to radian */
//#define GME 3.986004415E+14 /* earth gravitational constant */
//const double GMS = 1.327124E+20; /* sun gravitational constant */
//#define GMM 4.902801E+12 /* moon gravitational constant */
/* initial variances */
#define VAR_POS SQR(100.0) /* receiver position (m^2) */
#define VAR_CLK SQR(100.0) /* receiver clock (m^2) */
#define VAR_ZTD SQR( 0.3) /* ztd (m^2) */
#define VAR_GRA SQR(0.001) /* gradient (m^2) */
#define VAR_BIAS SQR(100.0) /* phase-bias (m^2) */
#define VAR_IONO_OFF SQR(10.0) /* variance of iono-model-off */
#define ERR_SAAS 0.3 /* saastamoinen model error std (m) */
#define ERR_BRDCI 0.5 /* broadcast iono model error factor */
#define ERR_CBIAS 0.3 /* code bias error std (m) */
#define REL_HUMI 0.7 /* relative humidity for saastamoinen model */
#define NP(opt) ((opt)->dynamics?9:3) /* number of pos solution */
#define IC(s,opt) (NP(opt)+(s)) /* state index of clocks (s=0:gps,1:glo) */
#define IT(opt) (IC(0,opt)+NSYS) /* state index of tropos */
#define NR(opt) (IT(opt)+((opt)->tropopt<TROPOPT_EST?0:((opt)->tropopt==TROPOPT_EST?1:3)))
/* number of solutions */
#define IB(s,opt) (NR(opt)+(s)-1) /* state index of phase bias */
#define NX(opt) (IB(MAXSAT,opt)+1) /* number of estimated states */
const double VAR_POS_PPP = std::pow(100.0, 2.0); /* init variance receiver position (m^2) */
const double VAR_CLK = std::pow(100.0, 2.0); /* init variance receiver clock (m^2) */
const double VAR_ZTD = std::pow( 0.3, 2.0); /* init variance ztd (m^2) */
const double VAR_GRA_PPP = std::pow(0.001, 2.0); /* init variance gradient (m^2) */
const double VAR_BIAS = std::pow(100.0, 2.0); /* init variance phase-bias (m^2) */
const double VAR_IONO_OFF = std::pow(10.0, 2.0); /* variance of iono-model-off */
/* functions originally included in RTKLIB/src/ppp_ar.c v2.4.2*/
double lam_LC(int i, int j, int k);
double L_LC(int i, int j, int k, const double *L);
@ -115,8 +95,7 @@ double f_erfc(double x);
double conffunc(int N, double B, double sig);
void average_LC(rtk_t *rtk, const obsd_t *obs, int n, const nav_t *nav,
const double *azel);
void average_LC(rtk_t *rtk, const obsd_t *obs, int n, const nav_t *nav, const double *azel);
int fix_amb_WL(rtk_t *rtk, const nav_t *nav, int sat1, int sat2, int *NW);
@ -124,39 +103,33 @@ int is_depend(int sat1, int sat2, int *flgs, int *max_flg);
int sel_amb(int *sat1, int *sat2, double *N, double *var, int n);
int fix_sol(rtk_t *rtk, const int *sat1, const int *sat2,
const double *NC, int n);
int fix_sol(rtk_t *rtk, const int *sat1, const int *sat2, const double *NC, int n);
int fix_amb_ROUND(rtk_t *rtk, int *sat1, int *sat2, const int *NW, int n);
int fix_amb_ILS(rtk_t *rtk, int *sat1, int *sat2, int *NW, int n);
int pppamb(rtk_t *rtk, const obsd_t *obs, int n, const nav_t *nav,
const double *azel);
int pppamb(rtk_t *rtk, const obsd_t *obs, int n, const nav_t *nav, const double *azel);
/* functions originally included in RTKLIB/src/ppp.c v2.4.2 */
void pppoutsolstat(rtk_t *rtk, int level, FILE *fp);
void tide_pl(const double *eu, const double *rp, double GMp,
const double *pos, double *dr);
void tide_pl(const double *eu, const double *rp, double GMp, const double *pos, double *dr);
void tide_solid(const double *rsun, const double *rmoon,
const double *pos, const double *E, double gmst, int opt,
double *dr);
const double *pos, const double *E, double gmst, int opt,
double *dr);
void tide_oload(gtime_t tut, const double *odisp, double *denu);
void iers_mean_pole(gtime_t tut, double *xp_bar, double *yp_bar);
void tide_pole(gtime_t tut, const double *pos, const double *erpv,
double *denu);
void tide_pole(gtime_t tut, const double *pos, const double *erpv, double *denu);
void tidedisp(gtime_t tutc, const double *rr, int opt, const erp_t *erp,
const double *odisp, double *dr);
const double *odisp, double *dr);
void testeclipse(const obsd_t *obs, int n, const nav_t *nav, double *rs);
@ -165,19 +138,19 @@ double varerr(int sat, int sys, double el, int type, const prcopt_t *opt);
void initx(rtk_t *rtk, double xi, double var, int i);
int ifmeas(const obsd_t *obs, const nav_t *nav, const double *azel,
const prcopt_t *opt, const double *dantr, const double *dants,
double phw, double *meas, double *var);
const prcopt_t *opt, const double *dantr, const double *dants,
double phw, double *meas, double *var);
double gettgd_ppp(int sat, const nav_t *nav);
int corr_ion(gtime_t time, const nav_t *nav, int sat, const double *pos,
const double *azel, int ionoopt, double *ion, double *var,
int *brk);
const double *azel, int ionoopt, double *ion, double *var,
int *brk);
int corrmeas(const obsd_t *obs, const nav_t *nav, const double *pos,
const double *azel, const prcopt_t *opt,
const double *dantr, const double *dants, double phw,
double *meas, double *var, int *brk);
const double *azel, const prcopt_t *opt,
const double *dantr, const double *dants, double phw,
double *meas, double *var, int *brk);
double gfmeas(const obsd_t *obs, const nav_t *nav);
@ -195,17 +168,16 @@ void udbias_ppp(rtk_t *rtk, const obsd_t *obs, int n, const nav_t *nav);
void udstate_ppp(rtk_t *rtk, const obsd_t *obs, int n, const nav_t *nav);
void satantpcv(const double *rs, const double *rr, const pcv_t *pcv,
double *dant);
void satantpcv(const double *rs, const double *rr, const pcv_t *pcv, double *dant);
double prectrop(gtime_t time, const double *pos, const double *azel,
const prcopt_t *opt, const double *x, double *dtdx,
double *var);
const prcopt_t *opt, const double *x, double *dtdx,
double *var);
int res_ppp(int iter, const obsd_t *obs, int n, const double *rs,
const double *dts, const double *vare, const int *svh,
const nav_t *nav, const double *x, rtk_t *rtk, double *v,
double *H, double *R, double *azel);
const double *dts, const double *vare, const int *svh,
const nav_t *nav, const double *x, rtk_t *rtk, double *v,
double *H, double *R, double *azel);
int pppnx(const prcopt_t *opt);