42extern int satsys(
int sat,
int* prn);
44extern void satno2id(
int sat,
char*
id);
48extern void ecef2pos(
const double* r,
double* pos);
49extern void covenu(
const double* pos,
const double* P,
double* Q);
50extern double sat2freq(
int sat, uint8_t code,
const nav_t* nav);
52#define IONO_REJ_STD 1.0
53#define IONO_COV_RATIO 1.0
54#define IONO_THRE_H 2.0
55#define IONO_THRE_V 3.0
57#define SQR(x) ((x) * (x))
58#define SQRT(x) ((x) <= 0.0 || (x) != (x) ? 0.0 : sqrt(x))
61#define NP(opt) ((opt)->dynamics ? 9 : 3)
62#define NC(opt) (NSYS + 1)
63#define NT(opt) ((opt)->tropopt < TROPOPT_EST ? 0 : ((opt)->tropopt == TROPOPT_EST ? 1 : 3))
64#define II(s, opt) (NP(opt) + NC(opt) + NT(opt) + (s) - 1)
75 return (pow(3.0, (ura >> 3) & 7) * (1.0 + (ura & 7) / 4.0) - 1.0) * 1E-3;
80 const double* c = a->
sat[sat - 1].
coef;
81 double freq, fact, stec, delay;
86 fact = 40.31E16 / freq / freq;
89 stec += c[1] * (ll[0] - a->
ref[0]) + c[2] * (ll[1] - a->
ref[1]);
92 stec += c[3] * (ll[0] - a->
ref[0]) * (ll[1] - a->
ref[1]);
95 stec += c[4] *
SQR(ll[0] - a->
ref[0]) + c[2] *
SQR(ll[1] - a->
ref[1]);
99 trace(NULL, 5,
"miono_delay: sat=%d,fact=%5.3f,stec=%8.3f,delay=%7.3f,coef=%7.2f,%7.2f,%7.2f,%7.2f,%8.3f,%8.3f\n",
100 sat, fact, stec, delay, c[0], c[1], c[2], c[3], c[4], c[5]);
107 int i, j, k, min_i = -1, min_j = 0;
108 double ref_ecef[3], ref_llh[3] = {0}, diff[3], dist, min_dist = 1E5;
110 trace(NULL, 2,
"miono_sel_area: lat=%.2f,lon=%.2f\n", ll[0], ll[1]);
113 re = &pppiono->
re[i];
117 trace(NULL, 5,
"miono_sel_area: region i=%d,ralert=%d\n", i, re->
ralert);
126 for (k = 0; k < 2; k++) {
130 for (k = 0; k < 3; k++) {
131 diff[k] = rr[k] - ref_ecef[k];
133 dist =
norm(diff, 3) / 1E3;
134 trace(NULL, 5,
"miono_sel_area: area i=%d,j=%d,sid=%d,ref=%6.2f,%7.2f,dist=%10.3f,min_dist=%10.3f\n", i, j,
136 if (dist > min_dist) {
152 trace(NULL, 2,
"miono_sel_area: closest RegionID=%d,AreaNo=%d,dist=%.3f\n", i, j, dist);
160 trace(NULL, 2,
"miono_sel_area: no corresponding area. lat=%.2f,lon=%.2f\n", ll[0], ll[1]);
163 pppiono->
rid = min_i;
164 pppiono->
anum = min_j;
165 return &pppiono->
re[min_i].
area[min_j];
177 double pos[3], latlon[2];
183 trace(NULL, 4,
"miono_get_corr: rr=%.3f,%.3f,%.3f\n", rr[0], rr[1], rr[2]);
185 if ((rr[0] == 0.0) && (rr[1] == 0.0) && (rr[2] == 0.0)) {
190 latlon[0] = pos[0] *
R2D;
191 latlon[1] = pos[1] *
R2D;
197 for (i = 0; i <
MAXSAT; i++) {
217 int week, stat, sat, ret = 0;
218 double tow, pos[3], std[3], azel[2], dly, dlystd;
219 char buff[1024], satid[64], *p;
226 while (fgets(buff,
sizeof(buff), fp)) {
227 for (p = buff; *p; p++) {
234 if (sscanf(buff,
"$POS%d%lf%d%lf%lf%lf%lf%lf%lf", &week, &tow, &stat, pos, pos + 1, pos + 2, std, std + 1,
243 if (sscanf(buff,
"$ION%d%lf%d%s%lf%lf%lf%lf", &week, &tow, &stat, satid, azel, azel + 1, &dly, &dlystd) >= 8) {
246 corr->
t0[sat - 1] = corr->
time = time;
247 corr->
dly[sat - 1] = dly;
248 corr->
std[sat - 1] = dlystd;
251 trace(NULL, 4,
"input_statcorr : %s,%s,az=%7.2f,el=%5.2f,dly=%8.4f,std=%8.4f\n",
time_str(time, 0), satid,
252 azel[0], azel[1], dly, dlystd);
260 const int* exc,
const double* rr,
const double* x,
double* v,
double* H,
double* var) {
263 int i, j, k, sat, nv = 0, s, ns;
264 double tt, std, sd[2], pos[3], P[9], Q[9];
266 double ave, bsys[
NSYS] = {0.0};
267 char *p, *tstr, satid[8];
274 if ((p = strstr(rtk->
opt.
pppopt,
"-IONOCORR_THRE_H="))) {
275 sscanf(p,
"-IONOCORR_THRE_H=%lf", &thre[0]);
277 if ((p = strstr(rtk->
opt.
pppopt,
"-IONOCORR_THRE_V="))) {
278 sscanf(p,
"-IONOCORR_THRE_V=%lf", &thre[1]);
280 if ((p = strstr(rtk->
opt.
pppopt,
"-IONOCORR_REJ_STD="))) {
281 sscanf(p,
"-IONOCORR_REJ_STD=%lf", &rejstd);
283 if ((p = strstr(rtk->
opt.
pppopt,
"-IONOCORR_COV_RATIO="))) {
284 sscanf(p,
"-IONOCORR_COV_RATIO=%lf", &covratio);
295 sd[0] =
SQRT(Q[0] + Q[4]);
298 trace(NULL, 3,
"const_iono_corr: sd=%6.2f,%6.2f,thre=%6.2f,%6.2f,rejstd=%.3f,covratio=%.3f\n", sd[0], sd[1],
299 thre[0], thre[1], rejstd, covratio);
301 if ((sd[0] != 0.0) && (sd[1] != 0.0) && (sd[0] < thre[0]) && (sd[1] < thre[1])) {
302 trace(NULL, 3,
"const_iono_corr: skipped to constraint. std H:%6.2f<%6.2f V:%6.2f<%6.2f\n", sd[0], thre[0],
310 for (s = 0; sys[s]; s++) {
313 for (i = 0; i < n; i++) {
315 if (
satsys(sat, NULL) != sys[s]) {
318 if (corr.
t0[sat - 1].
time == 0.0) {
331 if (corr.
std[sat - 1] > rejstd) {
335 j =
II(sat, &rtk->
opt);
336 ave += (corr.
dly[sat - 1] - x[j]);
340 bsys[s] = ave / (double)ns;
345 for (i = 0; i < n; i++) {
347 if (corr.
t0[sat - 1].
time == 0.0) {
355 switch (
satsys(sat, NULL)) {
378 if (corr.
std[sat - 1] > rejstd) {
382 std = corr.
std[sat - 1];
383 j =
II(sat, &rtk->
opt);
384 v[nv] = corr.
dly[sat - 1] - x[j] - bsys[s];
387 "const_iono_corr: %s,%s,tt=%11d,az=%5.1f,el=%4.1f,sdly=%8.4f,std=%8.4f,v=%8.4f,x=%8.4f,bsys=%8.4f\n",
388 satid, tstr, (
int)tt, (azel + i * 2)[0] *
R2D, (azel + i * 2)[1] *
R2D, corr.
dly[sat - 1],
389 corr.
std[sat - 1], v[nv], x[j], bsys[s]);
391 for (k = 0; k < rtk->
nx; k++) {
392 H[k + nv * rtk->
nx] = k == j ? 1.0 : 0.0;
394 var[nv++] =
SQR(std) * covratio;
MRTKLIB Constants — Physical, navigation, and system constants.
MRTKLIB Context — runtime context for processing, trace, and error handling.
void pos2ecef(const double *pos, double *r)
Transform geodetic position to ECEF position.
MRTKLIB Coordinates Module — Coordinate transformations and geometry.
double norm(const double *a, int n)
Euclidean norm of vector.
MRTKLIB Matrix Module — Matrix/vector operations and estimation.
MRTKLIB Navigation Module — Navigation data types and satellite/nav utility functions.
MRTKLIB Observation Module — Observation data types and utility functions.
MRTKLIB Options Module — Processing and solution option types.
void satno2id(int sat, char *id)
int satsys(int sat, int *prn)
static miono_area_t * miono_sel_area(pppiono_t *pppiono, const double *rr, const double *ll)
int input_statcorr(pppiono_corr_t *corr, FILE *fp)
int miono_get_corr(const double *rr, nav_t *nav)
int const_iono_corr(rtk_t *rtk, const obsd_t *obs, const nav_t *nav, const int n, const double *azel, const int *exc, const double *rr, const double *x, double *v, double *H, double *var)
static double miono_std_stecura(int ura)
gtime_t gpst2time(int week, double sec)
void covenu(const double *pos, const double *P, double *Q)
static double miono_delay(const nav_t *nav, const int sat, const miono_area_t *a, const double *ll)
double timediff(gtime_t t1, gtime_t t2)
int satid2no(const char *id)
char * time_str(gtime_t t, int n)
void ecef2pos(const double *r, double *pos)
double sat2freq(int sat, uint8_t code, const nav_t *nav)
MRTKLIB RTK Positioning Module — relative and precise positioning.
void trace(mrtk_ctx_t *ctx, int level, const char *format,...)
Output trace message.
MRTKLIB Trace Module — debug trace and logging functions.
GNSS time representation.
miono_area_t area[MIONO_MAX_ANUM]
miono_region_t re[MIONO_MAX_RID]