44static const double ssrudint[16] = {1, 2, 5, 10, 15, 30, 60, 120, 240, 300, 600, 900, 1800, 3600, 7200, 10800};
46#define SQR(x) ((x) * (x))
47#define MAX(x, y) ((x) > (y) ? (x) : (y))
48#define MIN(x, y) ((x) < (y) ? (x) : (y))
107 bank = ctx->
bank[ch];
134static double decode_sval(
const uint8_t* buff,
int i,
int n,
double lsb) {
135 int slim = -((1 << (n - 1)) - 1) - 1, v;
223 if ((sigmask >> j) & 1) {
231 int j, nsat = 0, sys, prn_min;
235 sat[nsat++] =
satno(sys, prn_min + j);
242 int j, id, nsat = 0, sys, prn_min;
248 sat[nsat] =
satno(sys, prn_min + j);
258 if ((a == 0 && b == 0) || (a == 7 && b == 7)) {
259 return 9999.0f * 1000.0f;
261 return (
float)((1.0 + b * 0.25) * pow(3.0, a) - 1.0);
265 if ((a == 0 && b == 0) || (a == 7 && b == 7)) {
268 return (
float)((1.0 + b * 0.25) * pow(3.0, a) - 1.0);
275 trace(NULL, 2,
"check_week_ref(): adjust ref week, subtype=%2d, week=%d\n", i + 1, --ctx->
week_ref[i]);
280 if (l6->
tow0 != -1) {
281 if (ctx->
tow_ref[i] != -1 && ((tow - ctx->
tow_ref[i]) < (-86400 * 7 / 2))) {
289static int sigmask2sig_p(
int nsat,
int* sat, uint16_t* sigmask, uint16_t* cellmask,
int* nsig,
int* sig) {
290 int j, k, id, sys, sys_p = -1, nsig_s = 0, code[
CSSR_MAX_SIG];
292 for (j = 0; j < nsat; j++) {
293 sys =
satsys(sat[j], NULL);
303 for (k = 0, nsig[j] = 0; k < nsig_s; k++) {
304 if ((cellmask[j] >> (nsig_s - 1 - k)) & 1) {
316static int sigmask2sig(
int nsat,
int* sat, uint16_t* sigmask, uint16_t* cellmask,
int* nsig,
int* sig) {
317 int j, k, id, sys, sys_p = -1, nsig_s = 0, code[
CSSR_MAX_SIG], csize = 0;
330 for (j = 0; j < nsat; j++) {
331 sys =
satsys(sat[j], NULL);
336 codes = (
int*)codes_gps;
337 csize =
sizeof(codes_gps) /
sizeof(
int);
340 codes = (
int*)codes_glo;
341 csize =
sizeof(codes_glo) /
sizeof(
int);
344 codes = (
int*)codes_gal;
345 csize =
sizeof(codes_gal) /
sizeof(
int);
348 codes = (
int*)codes_bds;
349 csize =
sizeof(codes_bds) /
sizeof(
int);
352 codes = (
int*)codes_qzs;
353 csize =
sizeof(codes_qzs) /
sizeof(
int);
356 codes = (
int*)codes_sbs;
357 csize =
sizeof(codes_sbs) /
sizeof(
int);
364 for (k = 0, nsig_s = 0; k < csize && k <
CSSR_MAX_SIG; k++) {
366 code[nsig_s++] = codes[k];
371 for (k = 0, nsig[j] = 0; k < nsig_s; k++) {
372 if ((cellmask[j] >> (nsig_s - 1 - k)) & 1) {
444 int trysearch[2] = {sep, 0}, ntry = (sep != 0) ? 2 : 1, t;
446 for (t = 0; t < ntry; t++) {
447 int search = trysearch[t];
478 int trysearch[2] = {sep, 0}, ntry = (sep != 0) ? 2 : 1, t;
480 for (t = 0; t < ntry; t++) {
481 int search = trysearch[t];
525 return (pos != -1) ? &bank->
BiasBank[pos] : NULL;
548 return (pos != -1) ? &bank->
BiasBank[pos] : NULL;
553 if (network != 0 && !(cb =
get_close_cbias(bank, time, network, age))) {
563 if (network != 0 && !(pb =
get_close_pbias(bank, time, network, age))) {
595 return (pos != -1) ? &bank->
TropBank[pos] : NULL;
600 for (i = 0; i <
MAXCODE; i++) {
601 if (bias->
smode[prn - 1][i] == mode) {
605 for (i = 0; i <
MAXCODE; i++) {
606 if (bias->
smode[prn - 1][i] == 0) {
622 trace(NULL, 4,
"bank clear: facility changed %d->%d\n", bank->
Facility + 1, facility + 1);
648 memset(orbit->
prn, 0,
sizeof(orbit->
prn));
651 for (i = 0; i <
MAXSAT; i++) {
652 if (!orbit->
prn[i]) {
662 for (i = 0; i <
MAXSAT; i++) {
668 orbit->
prn[i] = i + 1;
669 orbit->
udi[i] = ssr->
udi[0];
670 orbit->
iod[i] = ssr->
iod[0];
695 memset(clk->
prn, 0,
sizeof(clk->
prn));
697 for (i = 0; i <
MAXSAT; i++) {
707 for (i = 0; i <
MAXSAT; i++) {
714 clk->
udi[i] = ssr->
udi[1];
715 clk->
iod[i] = ssr->
iod[1];
716 clk->
c0[i] = ssr->
dclk[0];
740 memset(bias->
prn, 0,
sizeof(bias->
prn));
743 if (bias->
bflag & 0x01) {
744 for (i = 0; i <
MAXSAT; i++) {
745 for (j = 0; j <
MAXCODE; j++) {
746 if (bias->
sflag[i][j] & 0x01) {
747 bias->
sflag[i][j] ^= 0x01;
748 bias->
cbias[i][j] = 0.0;
754 for (i = 0; i <
MAXSAT; i++) {
759 bias->
prn[i] = i + 1;
761 bias->
udi[i] = ssr->
udi[4];
762 bias->
iod[i] = ssr->
iod[4];
763 for (j = 0; j <
MAXCODE; j++) {
767 bias->
sflag[i][pos] |= 0x01;
790 memset(bias->
prn, 0,
sizeof(bias->
prn));
793 if (bias->
bflag & 0x02) {
794 for (i = 0; i <
MAXSAT; i++) {
795 for (j = 0; j <
MAXCODE; j++) {
796 if (bias->
sflag[i][j] & 0x02) {
797 bias->
sflag[i][j] ^= 0x02;
798 bias->
pbias[i][j] = 0.0;
804 for (i = 0; i <
MAXSAT; i++) {
809 bias->
prn[i] = i + 1;
811 bias->
udi[i] = ssr->
udi[5];
812 bias->
iod[i] = ssr->
iod[5];
813 for (j = 0; j <
MAXCODE; j++) {
817 bias->
sflag[i][pos] |= 0x02;
830 for (i = 0; i < ssrn->
ngp; i++) {
831 for (j = 0; j < ssrn->
nsat[i]; j++) {
833 sat = ssrn->
sat[i][j];
851 if (index < bank->LatestTrop.gridnum[network - 1] &&
863 if (index < bank->LatestTrop.gridnum[network - 1] && bank->
LatestTrop.
prn[network - 1][index][sat - 1] == sat &&
896 for (i = 0; i < ssrn->
ngp; i++) {
897 trop->
gridpos[network - 1][i][0] = ssrn->
grid[i][0];
898 trop->
gridpos[network - 1][i][1] = ssrn->
grid[i][1];
899 trop->
gridpos[network - 1][i][2] = ssrn->
grid[i][2];
907 for (j = 0; j < trop->
satnum[network - 1][i]; j++) {
913 trop->
prn[network - 1][i][j] = ssrn->
sat[i][j];
932 for (i = 0; i <
MAXSAT; i++) {
933 if (cbias.
prn[i] == 0 || temp->
prn[i] == 0) {
936 for (j = 0; j <
MAXCODE; j++) {
937 if (temp->
smode[i][j] == 0 || !(temp->
sflag[i][j] & 0x01)) {
947 cbias.
sflag[i][pos] |= 0x01;
964 for (i = 0; i <
MAXSAT; i++) {
965 if (pbias.
prn[i] == 0 || temp->
prn[i] == 0) {
968 for (j = 0; j <
MAXCODE; j++) {
969 if (temp->
smode[i][j] == 0 || !(temp->
sflag[i][j] & 0x02)) {
979 pbias.
sflag[i][pos] |= 0x02;
1005 corr->
stec[index].
pos[2] = pos[2];
1006 corr->
stec[index].
n = 0;
1007 corr->
zwd[index].
pos[0] = (float)(pos[0] *
R2D);
1008 corr->
zwd[index].
pos[1] = (float)(pos[1] *
R2D);
1009 corr->
zwd[index].
pos[2] = (float)pos[2];
1010 corr->
zwd[index].
n = 0;
1015 if (stec->
n >= stec->
nmax) {
1020 stec->
data[stec->
n].
sat = (
unsigned char)sat;
1021 stec->
data[stec->
n].
slip = (
unsigned char)slip;
1025 stec->
data[stec->
n++].
rms = (float)rms;
1030 if (z->
n >= z->
nmax) {
1061 if (
timediff((*trop)->time, (*pbias)->time) < 0.0 ||
timediff((*trop)->time, (*pbias)->time) >= 30.0) {
1063 trace(NULL, 2,
"sub_get_close_cssr(): pbias re-align failed, net=%d\n", network);
1073 if (!*cbias ||
timediff((*pbias)->time, (*cbias)->time) > 0.0) {
1080 trace(NULL, 2,
"sub_get_close_cssr(): cbias not found, net=%d\n", network);
1084 trace(NULL, 2,
"sub_get_close_cssr(): clock not found, net=%d\n", network);
1088 if (
timediff((*pbias)->time, (*cbias)->time) < -30.0 ||
timediff((*pbias)->time, (*cbias)->time) > 0.0) {
1091 if (
timediff((*trop)->time, (*orbit)->time) < -30.0 ||
timediff((*trop)->time, (*orbit)->time) >= 30.0) {
1094 if (
timediff((*trop)->time, (*pbias)->time) < 0.0 ||
timediff((*trop)->time, (*pbias)->time) >= 30.0) {
1100 *flag = (
timediff((*cbias)->time, (*pbias)->time) == 0.0) ? 1 : 0;
1108 for (i = 0; i <
MAXCODE; i++) {
1109 if (smode[i] == mode) {
1113 for (i = 0; i <
MAXCODE; i++) {
1114 if (smode[i] == 0) {
1133 if (!
sub_get_close_cssr(bank, time, network, &orbit, &clk, &cbias, &pbias, &trop, &sis)) {
1144 for (i = 0; i <
MAXSAT; i++) {
1145 if (pbias->
prn[i] != 0) {
1146 for (j = 0; j <
MAXCODE; j++) {
1147 if (pbias->
smode[i][j] != 0 && (pbias->
sflag[i][j] & 0x02) &&
1154 if (cbias->
prn[i] != 0) {
1155 for (j = 0; j <
MAXCODE; j++) {
1156 if (cbias->
smode[i][j] != 0 && (cbias->
sflag[i][j] & 0x01) &&
1164 corr->
prn[i][4] = cbias->
prn[i];
1165 corr->
udi[i][4] = cbias->
udi[i];
1166 corr->
iod[i][4] = cbias->
iod[i];
1168 corr->
prn[i][5] = pbias->
prn[i];
1169 corr->
udi[i][5] = pbias->
udi[i];
1170 corr->
iod[i][5] = pbias->
iod[i];
1171 corr->
flag[i] |= 0x04;
1174 for (i = 0; i <
MAXSAT; i++) {
1175 if (orbit->
prn[i] != 0) {
1177 corr->
prn[i][0] = orbit->
prn[i];
1178 corr->
udi[i][0] = orbit->
udi[i];
1179 corr->
iod[i][0] = orbit->
iod[i];
1184 corr->
flag[i] |= 0x01;
1189 for (i = 0; i < corr->
gridnum; i++) {
1191 for (j = 0; j < trop->
satnum[network - 1][i]; j++) {
1194 trop->
iono[network - 1][i][j], 0.0, 0.0, 0.0);
1200 for (i = 0; i <
MAXSAT; i++) {
1201 if (clk->
prn[i] != 0) {
1203 corr->
prn[i][1] = clk->
prn[i];
1204 corr->
udi[i][1] = clk->
udi[i];
1205 corr->
iod[i][1] = clk->
iod[i];
1206 corr->
c0[i] = clk->
c0[i];
1207 corr->
flag[i] |= 0x02;
1242 for (ch = 0; ch < nch; ch++) {
1253 if (!ctx || !grid) {
1259 for (ch = 0; ch < nch; ch++) {
1278 if (!ctx || !grid) {
1284 for (ch = 0; ch < nch; ch++) {
1299 for (i = 0; i <
MAXSAT; i++) {
1300 if (clock->
prn[i] != 0) {
1321 int i, valid, network, nvalid = 0;
1323 if (!ctx || ch < 0 || ch >=
CLAS_CH_NUM || !corr || !corr->
use) {
1351 valid = corr->
stec[i].
n;
1353 ctx->
grid_stat[ch][network][i] = (valid >= 8) ? 1 : 0;
1358 trace(NULL, 4,
"grid_status: ch=%d net=%d gridnum=%d nvalid=%d\n", ch, network, corr->
gridnum, nvalid);
1369 int i, j, k, valid, network, preliminary, nvalid;
1376 preliminary = i + 1;
1377 network = preliminary;
1381 for (j = 0; j < 2; j++) {
1382 orbit =
get_close_orbit(bank, time, (j == 0) ? preliminary : 0, 180.0);
1392 if (!orbit || !trop) {
1408 for (k = 0, valid = trop->
satnum[i][j]; k < trop->satnum[i][j]; k++) {
1413 ctx->
grid_stat[ch][network][j] = (valid >= 8) ? 1 : 0;
1421 trace(NULL, 4,
"grid_status_time: ch=%d net=%d fastfix=%d gridnum=%d nvalid=%d\n", ch, network,
1434 for (sat = 1; sat <=
MAXSAT; sat++) {
1435 ssr = &nav->
ssr_ch[ch][sat - 1];
1438 if (corr->
prn[sat - 1][4] != 0) {
1439 for (i = 0; i <
MAXCODE; i++) {
1441 ssr->
pbias[i] = 0.0;
1442 ssr->
cbias[i] = 0.0;
1444 for (i = 0; i <
MAXCODE; i++) {
1448 j = corr->
smode[sat - 1][i] - 1;
1449 ssr->
cbias[j] = (float)corr->
cbias[sat - 1][i];
1453 ssr->
udi[4] = corr->
udi[sat - 1][4];
1454 ssr->
udi[5] = corr->
udi[sat - 1][5];
1455 ssr->
iod[4] = corr->
iod[sat - 1][4];
1456 ssr->
iod[5] = corr->
iod[sat - 1][5];
1457 ssr->
t0[4] = corr->
time[sat - 1][4];
1458 ssr->
t0[5] = corr->
time[sat - 1][5];
1460 memset(&ssr->
t0[4], 0,
sizeof(ssr->
t0[4]));
1461 memset(&ssr->
t0[5], 0,
sizeof(ssr->
t0[5]));
1465 if (corr->
prn[sat - 1][0] != 0) {
1466 ssr->
t0[0] = corr->
time[sat - 1][0];
1467 ssr->
udi[0] = corr->
udi[sat - 1][0];
1468 ssr->
iod[0] = corr->
iod[sat - 1][0];
1475 memset(&ssr->
t0[0], 0,
sizeof(ssr->
t0[0]));
1479 if (corr->
prn[sat - 1][1] != 0) {
1480 ssr->
t0[1] = corr->
time[sat - 1][1];
1481 ssr->
udi[1] = corr->
udi[sat - 1][1];
1482 ssr->
iod[1] = corr->
iod[sat - 1][1];
1483 ssr->
dclk[0] = corr->
c0[sat - 1];
1487 memset(&ssr->
t0[1], 0,
sizeof(ssr->
t0[1]));
1507 double* udint,
int* ngnss,
int i0) {
1519 if (l6->
time.
time != 0 && *tow < l6->tow_last - 1800) {
1521 if (l6->
tow0 >= 604800) {
1525 trace(NULL, 2,
"decode_cssr_head(): hourly epoch wrapped without ST1, tow0=%d\n", l6->
tow0);
1550 int k, ngnss, cmi, nsat, nsig;
1564 for (k = 0; k < ngnss; k++) {
1571 svmask = (uint64_t)
getbitu(l6->
buff, i0 + 4, 8) << 32;
1572 svmask |= (uint64_t)
getbitu(l6->
buff, i0 + 12, 32);
1579 if (i0 + nsat * nsig > l6->
havebit) {
1595 for (k = 0; k < nsat; k++) {
1606 return (i0 + 21 + 15 * nsat <= l6->havebit);
1613 for (k = 0; k < nsat; k++) {
1614 nsig_total += nsig[k];
1616 return i0 + 21 + nsig_total * 11 <= l6->
havebit;
1623 for (k = 0; k < nsat; k++) {
1624 nsig_total += nsig[k];
1626 return i0 + 21 + nsig_total * 17 <= l6->
havebit;
1630 int j, k, nsat, slen = 0, cbflag, pbflag, netflag, netmask = 0;
1645 if (i0 + 5 + nsat > l6->
havebit) {
1658 for (k = 0; k < nsat; k++) {
1659 if (netflag && !((netmask >> (nsat - 1 - k)) & 1)) {
1662 for (j = 0; j < nsig[k]; j++) {
1663 if (i0 + slen > l6->
havebit) {
1674 return i0 + 21 + 6 * nsat <= l6->
havebit;
1678 int j, sat[
CSSR_MAX_SV], nsat, stec_type, nsat_local = 0;
1679 uint64_t net_svmask;
1680 static const int slen_t[4] = {20, 44, 54, 70};
1682 if (i0 + 28 + nsat > l6->
havebit) {
1691 for (j = 0; j < nsat; j++) {
1692 if ((net_svmask >> (nsat - 1 - j)) & 1) {
1696 return i0 + nsat_local * slen_t[stec_type] <= l6->
havebit;
1700 int k, nsat, trop_type, ngp, sz_trop, sz_idx, sz_stec, nsat_local = 0;
1701 uint64_t net_svmask;
1703 if (i0 + 41 + nsat > l6->
havebit) {
1717 sz_trop = (trop_type == 0) ? 0 : 17;
1718 sz_stec = (sz_idx == 0) ? 7 : 16;
1719 for (k = 0; k < nsat; k++) {
1720 if ((net_svmask >> (nsat - 1 - k)) & 1) {
1724 return i0 + ngp * (sz_trop + nsat_local * sz_stec) <= l6->
havebit;
1728 int sat[
CSSR_MAX_SV], nsat, j, flg_orbit, flg_clock, flg_net, sz;
1729 uint64_t net_svmask = 0;
1742 if (i0 + 5 + nsat > l6->
havebit) {
1749 for (j = 0; j < nsat; j++) {
1750 if (flg_net && !((net_svmask >> (nsat - 1 - j)) & 1)) {
1761 if ((i0 += 15) > l6->
havebit) {
1770 int trop_avail, stec_avail, trop_type, stec_type, ngp, sz_idx, sz, j, nsat;
1771 uint64_t net_svmask;
1772 static const int dstec_sz_t[4] = {4, 4, 5, 7};
1773 static const int trop_sz_t[3] = {9, 23, 30};
1774 static const int stec_sz_t[4] = {14, 38, 48, 64};
1787 if (trop_avail != 0) {
1793 if ((trop_avail & 0x01) == 0x01) {
1799 sz = trop_sz_t[trop_type];
1805 if ((trop_avail & 0x02) == 0x02) {
1812 sz = (sz_idx == 0) ? 6 : 8;
1813 if (i0 + sz * ngp > l6->
havebit) {
1818 if (stec_avail != 0) {
1819 if (i0 + nsat > l6->
havebit) {
1824 for (j = 0; j < nsat; j++) {
1825 if (!((net_svmask >> (nsat - 1 - j)) & 1)) {
1832 if ((stec_avail & 0x01) == 0x01) {
1838 sz = stec_sz_t[stec_type];
1844 if ((stec_avail & 0x02) == 0x02) {
1850 i0 += ngp * dstec_sz_t[sz_idx];
1868 return i0 + 40 * (data_sz + 1) <= l6->
havebit;
1877 int i, j, k, l, sync, tow, ngnss, iod, nsat_g, id, nsig, ncell = 0;
1881 i =
decode_cssr_head(ctx, l6, cssr, &sync, &tow, &iod, &udint, &ngnss, i0);
1882 l6->
tow0 = (int)(floor(tow / 3600.0) * 3600.0);
1895 trace(NULL, 2,
"decode_cssr_mask: facility=%d tow=%d iod=%d\n", ctx->
l6facility[ch] + 1, tow, cssr->
iod);
1897 for (k = 0; k < ngnss; k++) {
1912 if (cssr->
cmi[
id]) {
1913 for (j = 0; j < nsat_g; j++) {
1919 for (j = 0; j < nsat_g; j++) {
1920 for (l = 0; l < nsig; l++) {
1921 cssr->
cellmask[ncell] |= ((uint16_t)1 << (nsig - 1 - l));
1930 return sync ? 0 : 10;
1939 int i, j, k, iod, sync, tow, ngnss, sat[
CSSR_MAX_SV], nsat, sys, iode;
1943 i =
decode_cssr_head(ctx, l6, cssr, &sync, &tow, &iod, &udint, &ngnss, i0);
1948 trace(NULL, 2,
"decode_cssr_oc: facility=%d tow=%d iod=%d\n", ctx->
l6facility[ch] + 1, tow, iod);
1952 if (cssr->
iod != iod) {
1956 for (j = 0; j <
MAXSAT; j++) {
1958 ssr->
t0[0].
sec = 0.0;
1968 for (j = 0; j < nsat; j++) {
1969 ssr = &ctx->
dec_ssr[sat[j] - 1];
1970 sys =
satsys(sat[j], NULL);
1973 i += (sys ==
SYS_GAL) ? 10 : 8;
1984 ssr->
udi[0] = udint;
1990 for (k = 0; k < 3; k++) {
1991 ssr->
ddeph[k] = 0.0;
2000 return sync ? 0 : 10;
2009 int i, j, iod, sync, tow, ngnss, sat[
CSSR_MAX_SV], nsat;
2013 i =
decode_cssr_head(ctx, l6, cssr, &sync, &tow, &iod, &udint, &ngnss, i0);
2018 trace(NULL, 2,
"decode_cssr_cc: facility=%d tow=%d iod=%d\n", ctx->
l6facility[ch] + 1, tow, iod);
2022 if (cssr->
iod != iod) {
2026 for (j = 0; j <
MAXSAT; j++) {
2028 ssr->
t0[1].
sec = 0.0;
2037 for (j = 0; j < nsat; j++) {
2038 ssr = &ctx->
dec_ssr[sat[j] - 1];
2040 ssr->
udi[1] = udint;
2052 return sync ? 0 : 10;
2061 int i, j, k, iod, s, sync, tow, ngnss, sat[
CSSR_MAX_SV], nsat;
2066 i =
decode_cssr_head(ctx, l6, cssr, &sync, &tow, &iod, &udint, &ngnss, i0);
2072 trace(NULL, 2,
"decode_cssr_cb: facility=%d tow=%d iod=%d\n", ctx->
l6facility[ch] + 1, tow, iod);
2076 if (cssr->
iod != iod) {
2080 for (k = 0; k <
MAXSAT; k++) {
2082 ssr->
t0[4].
sec = 0.0;
2089 for (j = 0; j <
MAXCODE; j++) {
2090 ssr->
cbias[j] = 0.0;
2095 for (k = 0; k < nsat; k++) {
2096 ssr = &ctx->
dec_ssr[sat[k] - 1];
2098 ssr->
udi[4] = udint;
2102 for (j = 0; j < nsig[k]; j++) {
2108 ssr->
nsig = nsig[k];
2114 return sync ? 0 : 10;
2123 int i, j, k, iod, s, sync, tow, ngnss, sat[
CSSR_MAX_SV], nsat;
2128 i =
decode_cssr_head(ctx, l6, cssr, &sync, &tow, &iod, &udint, &ngnss, i0);
2134 trace(NULL, 2,
"decode_cssr_pb: facility=%d tow=%d iod=%d\n", ctx->
l6facility[ch] + 1, tow, iod);
2138 if (cssr->
iod != iod) {
2142 for (k = 0; k <
MAXSAT; k++) {
2144 ssr->
t0[5].
sec = 0.0;
2151 for (j = 0; j <
MAXCODE; j++) {
2152 ssr->
pbias[j] = 0.0;
2157 for (k = 0; k < nsat; k++) {
2158 ssr = &ctx->
dec_ssr[sat[k] - 1];
2160 ssr->
udi[5] = udint;
2164 for (j = 0; j < nsig[k]; j++) {
2172 ssr->
nsig = nsig[k];
2178 return sync ? 0 : 10;
2187 int i, j, k, iod, s, sync, tow, ngnss, sat[
CSSR_MAX_SV], nsat;
2189 int cbflag, pbflag, netflag, network, netmask;
2193 i =
decode_cssr_head(ctx, l6, cssr, &sync, &tow, &iod, &udint, &ngnss, i0);
2204 i += netflag ? 5 : 0;
2208 netmask =
getbitu(l6->
buff, i, netflag ? nsat : 0);
2209 i += netflag ? nsat : 0;
2211 trace(NULL, 2,
"decode_cssr_bias: facility=%d tow=%d iod=%d net=%d\n", ctx->
l6facility[ch] + 1, tow, iod, network);
2215 if (cssr->
iod != iod) {
2219 for (k = 0; k <
MAXSAT; k++) {
2222 ssr->
t0[4].
sec = 0.0;
2231 ssr->
t0[5].
sec = 0.0;
2239 for (j = 0; j <
MAXCODE; j++) {
2242 ssr->
cbias[j] = 0.0;
2246 ssr->
pbias[j] = 0.0;
2252 for (k = 0; k < nsat; k++) {
2253 if (netflag && !((netmask >> (nsat - 1 - k)) & 1)) {
2256 ssr = &ctx->
dec_ssr[sat[k] - 1];
2259 ssr->
udi[4] = udint;
2266 ssr->
udi[5] = udint;
2271 for (j = 0; j < nsig[k]; j++) {
2285 ssr->
nsig = nsig[k];
2297 return sync ? 0 : 10;
2306 int i, j, iod, sync, tow, ngnss, sat[
CSSR_MAX_SV], nsat;
2310 i =
decode_cssr_head(ctx, l6, cssr, &sync, &tow, &iod, &udint, &ngnss, i0);
2315 trace(NULL, 3,
"decode_cssr_ura: facility=%d tow=%d iod=%d\n", ctx->
l6facility[ch] + 1, tow, iod);
2319 if (cssr->
iod != iod) {
2323 for (j = 0; j < nsat; j++) {
2324 ssr = &ctx->
dec_ssr[sat[j] - 1];
2326 ssr->
udi[3] = udint;
2335 return sync ? 0 : 10;
2344 int i, j, k, iod, s, sync, tow, ngnss, sat[
CSSR_MAX_SV], nsat, inet, a, b;
2348 i =
decode_cssr_head(ctx, l6, cssr, &sync, &tow, &iod, &udint, &ngnss, i0);
2357 trace(NULL, 2,
"decode_cssr_stec: facility=%d tow=%d iod=%d net=%d type=%d\n", ctx->
l6facility[ch] + 1, tow, iod,
2362 if (cssr->
iod != iod) {
2369 ssrn = &cssr->
ssrn[inet];
2374 ssrn->
udi[1] = udint;
2377 for (j = 0, s = 0; j < nsat; j++) {
2378 if ((cssr->
net_svmask[inet] >> (nsat - 1 - j)) & 1) {
2379 ssrn->
sat_f[s] = sat[j];
2385 for (k = 0; k < 4; k++) {
2386 ssrn->
a[s][k] = 0.0;
2408 return sync ? 0 : 10;
2417 int i, j, k, s, ii, sync, iod, tow, ngnss, sat[
CSSR_MAX_SV], nsat, sz;
2418 int trop_type, sz_idx, inet, a, b, hs, wet, valid;
2419 double udint, stec0, dlat, dlon, dstec;
2422 i =
decode_cssr_head(ctx, l6, cssr, &sync, &tow, &iod, &udint, &ngnss, i0);
2437 ssrn = &cssr->
ssrn[inet];
2450 trace(NULL, 2,
"decode_cssr_grid: facility=%d tow=%d iod=%d net=%d trop=%d ngp=%d\n", ctx->
l6facility[ch] + 1, tow,
2451 iod, inet, trop_type, ssrn->
ngp);
2455 if (cssr->
iod != iod) {
2460 ssrn->
grid[j][0] = ssrn->
grid[j][1] = ssrn->
grid[j][2] = 0.0;
2469 sz = sz_idx ? 16 : 7;
2473 switch (trop_type) {
2488 ssrn->
trop_wet[j] = wet * 0.004 + 0.252;
2497 dlat = (ssrn->
grid[j][0] - ssrn->
grid[0][0]) *
R2D;
2498 dlon = (ssrn->
grid[j][1] - ssrn->
grid[0][1]) *
R2D;
2500 for (k = 0, s = 0, ii = 0; k < nsat; k++) {
2501 if ((cssr->
net_svmask[inet] >> (nsat - 1 - k)) & 1) {
2504 stec0 = ssrn->
a[ii][0] + ssrn->
a[ii][1] * dlat + ssrn->
a[ii][2] * dlon + ssrn->
a[ii][3] * dlat * dlon;
2508 ssrn->
stec[j][s] = dstec + stec0;
2510 ssrn->
stec0[j][s] = stec0;
2511 ssrn->
sat[j][s] = sat[k];
2527 return sync ? 0 : 10;
2546 for (j = 0; j < cssr->
si_sz; j++) {
2553 return sync ? 0 : 10;
2562 int i, j, k, sync, iod, tow, ngnss, sat[
CSSR_MAX_SV], nsat, iode;
2563 int flg_orbit, flg_clock, flg_net, net_svmask, netid;
2567 i =
decode_cssr_head(ctx, l6, cssr, &sync, &tow, &iod, &udint, &ngnss, i0);
2579 i += flg_net ? 5 : 0;
2580 net_svmask =
getbitu(l6->
buff, i, flg_net ? nsat : 0);
2581 i += flg_net ? nsat : 0;
2583 trace(NULL, 2,
"decode_cssr_combo: facility=%d tow=%d iod=%d net=%d flag=%d %d %d\n", ctx->
l6facility[ch] + 1, tow,
2584 iod, netid, flg_orbit, flg_clock, flg_net);
2588 if (cssr->
iod != iod) {
2592 for (j = 0; j <
MAXSAT; j++) {
2595 ssr->
t0[0].
sec = 0.0;
2605 ssr->
t0[1].
sec = 0.0;
2615 for (j = 0; j < nsat; j++) {
2616 if (flg_net && !((net_svmask >> (nsat - 1 - j)) & 1)) {
2619 ssr = &ctx->
dec_ssr[sat[j] - 1];
2633 ssr->
udi[0] = udint;
2635 for (k = 0; k < 3; k++) {
2636 ssr->
ddeph[k] = 0.0;
2650 ssr->
udi[1] = udint;
2669 return sync ? 0 : 10;
2678 int i, j, k, s, sync, tow, iod, ngnss, sat[
CSSR_MAX_SV], nsat;
2679 int trop_avail, stec_avail, trop_type = -1, stec_type = -1;
2680 int inet, a = 0, b = 0, sz_idx, sz;
2681 double udint, stec0, ct[6] = {0}, ci[6] = {0};
2682 double trop_ofst = 0.0, trop_residual, dlat, dlon, dstec;
2684 static const double dstec_lsb_t[4] = {0.04, 0.12, 0.16, 0.24};
2685 static const int dstec_sz_t[4] = {4, 4, 5, 7};
2687 i =
decode_cssr_head(ctx, l6, cssr, &sync, &tow, &iod, &udint, &ngnss, i0);
2699 trace(NULL, 2,
"decode_cssr_atmos: facility=%d tow=%d iod=%d net=%d\n", ctx->
l6facility[ch] + 1, tow, iod, inet);
2703 if (cssr->
iod != iod) {
2710 ssrn = &cssr->
ssrn[inet];
2718 ssrn->
grid[j][0] = ssrn->
grid[j][1] = ssrn->
grid[j][2] = 0.0;
2722 if (trop_avail != 0) {
2730 if ((trop_avail & 0x01) == 0x01) {
2733 for (k = 0; k < 4; k++) {
2738 if (trop_type > 0) {
2744 if (trop_type > 1) {
2755 dlat = (ssrn->
grid[j][0] - ssrn->
grid[0][0]) *
R2D;
2756 dlon = (ssrn->
grid[j][1] - ssrn->
grid[0][1]) *
R2D;
2759 if (trop_type > 0) {
2760 ssrn->
trop_total[j] += ct[1] * dlat + ct[2] * dlon;
2762 if (trop_type > 1) {
2767 if ((trop_avail & 0x02) == 0x02) {
2772 sz = (sz_idx_t == 0) ? 6 : 8;
2778 ssrn->
trop_wet[j] = trop_residual + trop_ofst;
2786 if (stec_avail != 0) {
2790 for (j = s = 0; j < nsat; j++) {
2791 if (stec_avail != 0) {
2792 if (!((cssr->
net_svmask[inet] >> (nsat - 1 - j)) & 1)) {
2801 for (k = 0; k < 6; k++) {
2804 if ((stec_avail & 0x01) == 0x01) {
2809 if (stec_type > 0) {
2815 if (stec_type > 1) {
2819 if (stec_type > 2) {
2826 if (stec_avail != 0) {
2827 if ((stec_avail & 0x02) == 0x02) {
2835 dlat = (ssrn->
grid[k][0] - ssrn->
grid[0][0]) *
R2D;
2836 dlon = (ssrn->
grid[k][1] - ssrn->
grid[0][1]) *
R2D;
2839 if ((stec_avail & 0x02) == 0x02) {
2840 dstec =
decode_sval(l6->
buff, i, dstec_sz_t[sz_idx], dstec_lsb_t[sz_idx]);
2841 i += dstec_sz_t[sz_idx];
2845 if (stec_type > 0) {
2846 stec0 += ci[1] * dlat + ci[2] * dlon;
2848 if (stec_type > 1) {
2849 stec0 += ci[3] * dlat * dlon;
2851 if (stec_type > 2) {
2852 stec0 += ci[4] * dlat * dlat + ci[5] * dlon * dlon;
2858 ssrn->
stec[k][s] = stec0 + dstec;
2860 ssrn->
stec0[k][s] = stec0;
2861 ssrn->
sat[k][s] = sat[j];
2876 return sync ? 0 : 10;
2886 int startbit, i, ret = 0;
2888 if (l6->
frame == 0x00 || l6->
nbit == -1) {
2892 i = startbit = l6->
nbit;
2899 if (l6->
ctype != 4073) {
2982 trace(NULL, 1,
"start CSSR decoding: ch=%d\n", ch);
3038 int fac = (msgid & 0x18) >> 3;
3039 int ptn = (msgid & 0x06) >> 1;
3071 int ch, target, locked_prn, stale;
3075 for (ch = 0; ch < nch; ch++) {
3089 for (ch = 0; ch < nch; ch++) {
3096 for (ch = 0; ch < nch; ch++) {
3114 if (locked_prn < 0 || stale) {
3115 if (locked_prn != prn || ctx->
l6pattern[target] != ptn) {
3116 trace(NULL, 2,
"L6 lock: ch=%d prn=%d pattern=%d (was prn=%d pattern=%d)\n", target, prn, ptn, locked_prn,
3131 trace(NULL, 5,
"clas_input_cssr: data=%02x ch=%d\n", data, ch);
3134 if (l6->
nbyte == 0) {
3161 trace(NULL, hdr.
svc ==
L6_SVC_NULL ? 2 : 3,
"clas_input_cssr: skip %s frame prn=%d ch=%d\n",
3165 if (hdr.
alert != 0) {
3166 trace(NULL, 1,
"CSSR frame alert!: ch=%d\n", ch);
3177 if (dt <= 0.0 || dt > 1.5) {
3178 trace(NULL, 2,
"clas_input_cssr: frame gap dt=%.3f s, subframe discarded ch=%d nframe=%d\n", dt, ch,
3194 }
else if (l6->
nframe >= 5) {
3199 int ii = 1695 * l6->
nframe, jj;
3202 for (jj = 0; jj < 211; jj++) {
3220 for (i = 0; i < 4096; i++) {
3224 if ((data = fgetc(fp)) == EOF) {
3239 int no, lath, latm, lonh, lonm;
3240 double lat, lon, alt;
3241 char buff[1024], *temp, *p;
3245 memset(grid, 0,
sizeof(grid));
3253 trace(NULL, 2,
"clas_read_grid_def: gridfile=%s\n", gridfile);
3254 fp = fopen(gridfile,
"r");
3259 while (fgets(buff,
sizeof(buff), fp)) {
3260 if (strstr(buff,
"<CSSR Grid Definition>")) {
3261 while (fgets(buff,
sizeof(buff), fp)) {
3262 if ((temp = strstr(buff,
"<Version>"))) {
3264 if ((temp = strstr(buff,
"</Version>"))) {
3272 }
else if (strstr(buff,
"Compact Network ID GRID No.")) {
3283 fp = fopen(gridfile,
"r");
3289 while (fgets(buff,
sizeof(buff), fp)) {
3290 if (sscanf(buff,
"<Network%d>", &inet)) {
3291 while (fscanf(fp,
"%d\t%d\t%d\t%lf\t%d\t%d\t%lf\t%lf", &no, &lath, &latm, &lat, &lonh, &lonm, &lon,
3294 ctx->
grid_pos[inet][grid[inet]][0] = (double)lath + (
double)latm / 60.0 + lat / 3600.0;
3295 ctx->
grid_pos[inet][grid[inet]][1] = (double)lonh + (
double)lonm / 60.0 + lon / 3600.0;
3296 ctx->
grid_pos[inet][grid[inet]][2] = alt;
3299 ctx->
grid_pos[inet][grid[inet]][0] = -1.0;
3300 ctx->
grid_pos[inet][grid[inet]][1] = -1.0;
3301 ctx->
grid_pos[inet][grid[inet]][2] = -1.0;
3308 if (!fgets(buff,
sizeof(buff), fp)) {
3312 while ((ret = fscanf(fp,
"%d %d %lf %lf %lf", &inet, &no, &lat, &lon, &alt)) != EOF) {
3314 ctx->
grid_pos[inet][grid[inet]][0] = lat;
3315 ctx->
grid_pos[inet][grid[inet]][1] = lon;
3316 ctx->
grid_pos[inet][grid[inet]][2] = alt;
3319 ctx->
grid_pos[inet][grid[inet]][0] = -1.0;
3320 ctx->
grid_pos[inet][grid[inet]][1] = -1.0;
3321 ctx->
grid_pos[inet][grid[inet]][2] = -1.0;
void setbitu(uint8_t *buff, int pos, int len, uint32_t data)
Set unsigned bits in byte data.
uint32_t getbitu(const uint8_t *buff, int pos, int len)
Extract unsigned bits from byte data.
int32_t getbits(const uint8_t *buff, int pos, int len)
Extract signed bits from byte data.
static void set_cssr_bank_pbias(clas_ctx_t *ctx, int ch, gtime_t time, int network, int iod)
static void set_grid_data(clas_corr_t *corr, double *pos, int index)
static int decode_cssr_si(clas_ctx_t *ctx, int ch, clas_l6buf_t *l6, int i0)
static void init_grid_index(clas_corr_t *corr)
static int decode_cssr_mask(clas_ctx_t *ctx, int ch, clas_l6buf_t *l6, int i0)
static clas_trop_bank_t * get_same_trop(clas_bank_ctrl_t *bank, gtime_t time)
static int sigmask2sig(int nsat, int *sat, uint16_t *sigmask, uint16_t *cellmask, int *nsig, int *sig)
static int add_data_trop(zwd_t *z, gtime_t time, double zwd, double ztd, double quality, double rms, int valid)
static int decode_cssr_cc(clas_ctx_t *ctx, int ch, clas_l6buf_t *l6, int i0)
static int svmask2sat(uint64_t *svmask, int *sat)
static int decode_cssr_atmos(clas_ctx_t *ctx, int ch, clas_l6buf_t *l6, int i0)
void clas_check_grid_status(clas_ctx_t *ctx, const clas_corr_t *corr, int ch)
Check and update grid status flags based on correction availability.
static int decode_cssr_cb(clas_ctx_t *ctx, int ch, clas_l6buf_t *l6, int i0)
static int svmask2nsatlist(uint64_t svmask, int id, int *sat)
static int check_bit_width_stec(clas_l6buf_t *l6, cssr_t *cssr, int i0)
int clas_route_l6frame(clas_ctx_t *ctx, int prn, int ptn, int l6mrg, gtime_t now)
Route one interleaved L6D frame to a CLAS channel (or drop it).
static clas_clock_bank_t * get_same_clock(clas_bank_ctrl_t *bank, gtime_t time, int network)
static int decode_cssr_head(clas_ctx_t *ctx, clas_l6buf_t *l6, cssr_t *cssr, int *sync, int *tow, int *iod, double *udint, int *ngnss, int i0)
static int check_bit_width_pb(clas_l6buf_t *l6, cssr_t *cssr, int i0)
static clas_bias_bank_t * get_close_net_pbias(clas_bank_ctrl_t *bank, gtime_t time, int network, double age)
int clas_input_cssr(clas_ctx_t *ctx, uint8_t data, int ch)
Input CSSR byte stream (one byte at a time, real-time).
static void set_cssr_bank_trop(clas_ctx_t *ctx, int ch, gtime_t time, ssrn_t *ssrn, int network)
static clas_bias_bank_t * add_base_value_to_cbias(clas_bank_ctrl_t *bank, clas_bias_bank_t *srcbias, int network)
static clas_orbit_bank_t * get_same_orbit(clas_bank_ctrl_t *bank, gtime_t time, int network)
void clas_restore_backup(clas_ctx_t *ctx, gtime_t time, clas_grid_t *grid, int l6mrg)
static int get_bias_save_point(clas_bias_bank_t *bias, int prn, int mode)
static clas_trop_bank_t * get_close_trop(clas_bank_ctrl_t *bank, gtime_t obstime, gtime_t time, int network, double age, int tropless)
static double decode_sval(const uint8_t *buff, int i, int n, double lsb)
int cssr_sys2gnss(int sys, int *prn0)
Convert RTKLIB system bitmask to CSSR GNSS ID.
static clas_clock_bank_t * get_close_clock(clas_bank_ctrl_t *bank, gtime_t obstime, gtime_t time, int network, double age)
static void set_cssr_bank_clock(clas_ctx_t *ctx, int ch, gtime_t time, int network)
void clas_set_l6tag(clas_ctx_t *ctx, int ch, double tag)
Set the receiver time tag of the L6 frame about to be input.
static void set_cssr_latest_trop(clas_bank_ctrl_t *bank, gtime_t time, ssrn_t *ssrn, int network)
static gtime_t backup_cssr_time(const clas_corr_t *corr)
static int get_cssr_latest_trop(clas_bank_ctrl_t *bank, double *total, double *wet, gtime_t time, int network, int index)
static int sigmask2sig_p(int nsat, int *sat, uint16_t *sigmask, uint16_t *cellmask, int *nsig, int *sig)
static int decode_cssr_pb(clas_ctx_t *ctx, int ch, clas_l6buf_t *l6, int i0)
static int get_cssr_latest_iono(clas_bank_ctrl_t *bank, double *iono, gtime_t time, int network, int index, int sat)
static float decode_cssr_quality_stec(int a, int b)
void clas_ctx_free(clas_ctx_t *ctx)
Free CLAS context (release heap-allocated bank control).
static int decode_cssr_oc(clas_ctx_t *ctx, int ch, clas_l6buf_t *l6, int i0)
static int svmask2nsat(uint64_t svmask)
static int decode_cssr_ura(clas_ctx_t *ctx, int ch, clas_l6buf_t *l6, int i0)
static void check_week_ref(clas_ctx_t *ctx, clas_l6buf_t *l6, int tow, int i)
static int sigmask2nsig(uint16_t sigmask)
int cssr_gnss2sys(int gnss, int *prn0)
Convert CSSR GNSS ID to RTKLIB system bitmask.
int clas_bank_get_close(const clas_ctx_t *ctx, gtime_t time, int network, int ch, clas_corr_t *corr)
Merge closest corrections from all banks into a clas_corr_t snapshot.
int clas_input_cssrf(clas_ctx_t *ctx, FILE *fp, int ch)
Input CSSR from file (one message at a time, post-processing).
static int check_bit_width_oc(clas_l6buf_t *l6, cssr_t *cssr, int i0)
static void set_cssr_bank_orbit(clas_ctx_t *ctx, int ch, gtime_t time, int network)
int clas_get_correct_fac(int msgid)
Get L6 facility ID from message ID byte.
static clas_bias_bank_t * get_close_pbias(clas_bank_ctrl_t *bank, gtime_t time, int network, double age)
static clas_bias_bank_t * get_close_net_cbias(clas_bank_ctrl_t *bank, gtime_t time, int network, double age)
static clas_bias_bank_t * get_close_cbias(clas_bank_ctrl_t *bank, gtime_t time, int network, double age)
int clas_read_grid_def(clas_ctx_t *ctx, const char *gridfile)
Read CLAS grid definition file.
static int decode_cssr_grid(clas_ctx_t *ctx, int ch, clas_l6buf_t *l6, int i0)
static clas_bias_bank_t * add_base_value_to_pbias(clas_bank_ctrl_t *bank, clas_bias_bank_t *srcbias, int network)
void clas_check_grid_status_time(clas_ctx_t *ctx, gtime_t time, int ch)
static const double ssrudint[16]
static int check_bit_width_bias(clas_l6buf_t *l6, cssr_t *cssr, int i0)
static int check_bit_width_combo(clas_l6buf_t *l6, cssr_t *cssr, int i0)
void clas_bank_init(clas_ctx_t *ctx, int ch)
Initialize bank control for a channel.
static clas_orbit_bank_t * get_close_orbit(clas_bank_ctrl_t *bank, gtime_t time, int network, double age)
void clas_update_global(nav_t *nav, const clas_corr_t *corr, int ch)
Apply global corrections (orbit/clock/bias) to nav_t.ssr[].
static int check_bit_width_si(clas_l6buf_t *l6, cssr_t *cssr, int i0)
static clas_bias_bank_t * get_same_bias(clas_bank_ctrl_t *bank, gtime_t time, int network)
static int corr_bias_slot(const int smode[70], int mode)
static int check_bit_width_cc(clas_l6buf_t *l6, cssr_t *cssr, int i0)
static float decode_cssr_quality_trop(int a, int b)
int clas_ctx_init(clas_ctx_t *ctx)
Initialize CLAS context (allocate bank control on heap).
static int add_data_stec(stec_t *stec, gtime_t time, int sat, int slip, double iono, double rate, double rms, double quality)
static void set_cssr_bank_cbias(clas_ctx_t *ctx, int ch, gtime_t time, int network, int iod)
static void check_cssr_changed_facility(clas_ctx_t *ctx, int ch, int facility)
int clas_backup_valid(const clas_ctx_t *ctx, gtime_t obstime, int l6mrg)
Save/restore the latest usable CSSR snapshot for short correction gaps.
static int decode_cssr_bias(clas_ctx_t *ctx, int ch, clas_l6buf_t *l6, int i0)
static int sub_get_close_cssr(clas_bank_ctrl_t *bank, gtime_t time, int network, clas_orbit_bank_t **orbit, clas_clock_bank_t **clock, clas_bias_bank_t **cbias, clas_bias_bank_t **pbias, clas_trop_bank_t **trop, int *flag)
static int decode_cssr_stec(clas_ctx_t *ctx, int ch, clas_l6buf_t *l6, int i0)
void clas_update_local(nav_t *nav, const clas_corr_t *corr, int ch)
Apply local corrections (trop/STEC) to nav_t.
static int check_bit_width_atmos(clas_l6buf_t *l6, cssr_t *cssr, int i0)
static int check_bit_width_cb(clas_l6buf_t *l6, cssr_t *cssr, int i0)
static int check_bit_width_ura(clas_l6buf_t *l6, cssr_t *cssr, int i0)
static int decode_qzs_msg(clas_ctx_t *ctx, int ch)
static int decode_cssr_combo(clas_ctx_t *ctx, int ch, clas_l6buf_t *l6, int i0)
static int check_bit_width_grid(clas_l6buf_t *l6, cssr_t *cssr, int i0)
void clas_backup_current(clas_ctx_t *ctx, const clas_grid_t *grid, int l6mrg)
void clas_clear_current(clas_ctx_t *ctx, int ch)
Drop the current correction snapshot of one channel.
int clas_decode_msg(clas_ctx_t *ctx, int ch)
Decode the next pending CSSR message from the assembled bit buffer.
static int check_bit_width_mask(clas_l6buf_t *l6, cssr_t *cssr, int i0)
CLAS (QZSS L6D) CSSR decoder and grid correction type definitions.
#define CLAS_L6_RELOCK_TIMEOUT
#define CSSR_INVALID_VALUE
#define CSSR_TROPVALIDAGE
#define CSSR_STECVALIDAGE
MRTKLIB Constants — Physical, navigation, and system constants.
int satsys(int sat, int *prn)
int l6_parse_header(const uint8_t *frame, l6_header_t *h)
Parse the header of one L6 frame and classify its service.
const char * l6_service_name(l6_service_t svc)
Short name of an L6 service, for logs.
static int search(int n, int m, const double *L, const double *D, const double *zs, double *zn, double *s)
int satno(int sys, int prn)
Convert satellite system+prn/slot number to satellite number.
gtime_t gpst2time(int week, double sec)
Convert GPS week/tow to gtime_t.
double timediff(gtime_t t1, gtime_t t2)
Compute time difference (t1 - t2).
double time2gpst(gtime_t t, int *week)
Convert gtime_t to GPS week/tow.
gtime_t timeadd(gtime_t t, double sec)
Add seconds to gtime_t.
void trace(mrtk_ctx_t *ctx, int level, const char *format,...)
Output trace message.
MRTKLIB Trace Module — debug trace and logging functions.
clas_clock_bank_t ClockBank[32]
clas_bias_bank_t BiasBank[32]
clas_trop_bank_t TropBank[32]
clas_orbit_bank_t OrbitBank[32]
clas_latest_trop_t LatestTrop
double pbias[MAXSAT][MAXCODE]
int sflag[MAXSAT][MAXCODE]
int smode[MAXSAT][MAXCODE]
double cbias[MAXSAT][MAXCODE]
double cbias[MAXSAT][MAXCODE]
double pbias[MAXSAT][MAXCODE]
stecd_t stecdata[80][MAXSAT]
int smode[MAXSAT][MAXCODE]
gtime_t obs_ref[CSSR_REF_MAX]
int tow_ref[CSSR_REF_MAX]
double grid_pos[13][80][3]
clas_dec_ssr_t dec_ssr[MAXSAT]
clas_grid_t backup_grid[2]
clas_bank_ctrl_t * bank[2]
int week_ref[CSSR_REF_MAX]
uint8_t fbuff[L6_FRAME_LEN]
double stec[13][80][MAXSAT]
double stec0[13][80][MAXSAT]
gtime_t stectime[13][80][MAXSAT]
double gridpos[13][80][3]
double iono[13][80][MAXSAT]
GNSS time representation.
ssr_t ssr_ch[SSR_CH_NUM][MAXSAT]