MRTKLIB 0.7.14
Modernized GNSS Positioning Library
Loading...
Searching...
No Matches
mrtk_clas.h
Go to the documentation of this file.
1/*------------------------------------------------------------------------------
2 * mrtk_clas.h : CLAS (QZSS L6D) type definitions and functions
3 *
4 * Copyright (C) 2026 H.SHIONO (MRTKLIB Project)
5 * Copyright (C) 2023-2025 Cabinet Office, Japan
6 * Copyright (C) 2024-2025 Lighthouse Technology & Consulting Co. Ltd.
7 * Copyright (C) 2023-2025 Japan Aerospace Exploration Agency
8 * Copyright (C) 2023-2025 TOSHIBA ELECTRONIC TECHNOLOGIES CORPORATION
9 * Copyright (C) 2015- Mitsubishi Electric Corp.
10 * Copyright (C) 2014 Geospatial Information Authority of Japan
11 * Copyright (C) 2014 T.SUZUKI
12 * Copyright (C) 2007-2023 T.TAKASU
13 *
14 * SPDX-License-Identifier: BSD-2-Clause
15 *----------------------------------------------------------------------------*/
16/**
17 * @file mrtk_clas.h
18 * @brief CLAS (QZSS L6D) CSSR decoder and grid correction type definitions.
19 *
20 * References:
21 * [1] claslib (https://github.com/mf-arai/claslib) — upstream implementation
22 * [2] IS-QZSS-L6-001 — CLAS Interface Specification
23 * [3] IS-QZSS-L6-003 — CLAS Compact SSR Specification
24 *
25 * Notes:
26 * - Bank struct dimensions are reduced from upstream claslib defaults for
27 * memory efficiency. See "CLAS Storage Dimension" section below.
28 * - Global singletons in upstream (_cssr, cssrObject[], CurrentCSSR[],
29 * BackupCSSR[]) are replaced with clas_ctx_t context struct passed via
30 * function parameters for thread safety and multi-channel support.
31 */
32#ifndef MRTK_CLAS_H
33#define MRTK_CLAS_H
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
39#include <stdio.h>
40
41#include "mrtklib/mrtk_bits.h"
43#include "mrtklib/mrtk_l6.h"
44#include "mrtklib/mrtk_nav.h"
45#include "mrtklib/mrtk_rtkpos.h" /* rtk_t, ssat_t, sol_t, prcopt_t (for OSR functions) */
46#include "mrtklib/mrtk_time.h"
47
48/*============================================================================
49 * CLAS Version
50 *===========================================================================*/
51
52#define CLAS_VER "0.1" /* CLAS module version */
53
54/*============================================================================
55 * CSSR Protocol Constants (from IS-QZSS-L6-003, claslib/cssr.h)
56 *
57 * These constants define the CSSR compact SSR message format limits.
58 * They match the upstream claslib values and should NOT be reduced.
59 *===========================================================================*/
60
61#define CSSR_MAX_GNSS 16 /* max GNSS systems in CSSR */
62#define CSSR_MAX_SV_GNSS 40 /* max satellites per GNSS system */
63#define CSSR_MAX_SV 64 /* max satellites in CSSR message */
64#define CSSR_MAX_SIG 16 /* max signals per satellite */
65#define CSSR_MAX_CELLMASK 64 /* max cellmask entries */
66#define CSSR_MAX_NET 32 /* max networks in CSSR message */
67#define CSSR_MAX_LOCAL_SV 32 /* max local satellites per network */
68#define CSSR_MAX_GP 128 /* max grid points in CSSR message */
69
70/*============================================================================
71 * CSSR System Identifiers
72 *===========================================================================*/
73
74#define CSSR_SYS_GPS 0
75#define CSSR_SYS_GLO 1
76#define CSSR_SYS_GAL 2
77#define CSSR_SYS_BDS 3
78#define CSSR_SYS_QZS 4
79#define CSSR_SYS_SBS 5
80#define CSSR_SYS_NONE -1
81
82/*============================================================================
83 * CSSR Message Subtype Constants
84 *===========================================================================*/
85
86#define CSSR_TYPE_NUM 14 /* total subtype count */
87#define CSSR_TYPE_MASK 1 /* ST1: Satellite/signal mask */
88#define CSSR_TYPE_OC 2 /* ST2: Orbit correction */
89#define CSSR_TYPE_CC 3 /* ST3: Clock correction */
90#define CSSR_TYPE_CB 4 /* ST4: Code bias */
91#define CSSR_TYPE_PB 5 /* ST5: Phase bias */
92#define CSSR_TYPE_BIAS 6 /* ST6: Combined bias */
93#define CSSR_TYPE_URA 7 /* ST7: URA */
94#define CSSR_TYPE_STEC 8 /* ST8: STEC correction (CLAS-only) */
95#define CSSR_TYPE_GRID 9 /* ST9: Grid definition (CLAS-only) */
96#define CSSR_TYPE_SI 10 /* ST10: Service information (CLAS-only) */
97#define CSSR_TYPE_COMBO 11 /* ST11: Combined correction (CLAS-only) */
98#define CSSR_TYPE_ATMOS 12 /* ST12: Atmospheric corr. (CLAS-only) */
99#define CSSR_TYPE_INIT 254 /* initialization marker */
100#define CSSR_TYPE_NULL 255 /* null/invalid marker */
101
102/*============================================================================
103 * CSSR Signed-Value Maximum Limits
104 *===========================================================================*/
105
106#define P2_S16_MAX 32767
107#define P2_S15_MAX 16383
108#define P2_S14_MAX 8191
109#define P2_S13_MAX 4095
110#define P2_S12_MAX 2047
111#define P2_S11_MAX 1023
112#define P2_S10_MAX 511
113#define P2_S9_MAX 255
114#define P2_S8_MAX 127
115#define P2_S7_MAX 63
116#define P2_S6_MAX 31
117
118/*============================================================================
119 * CSSR Troposphere Reference Values
120 *===========================================================================*/
121
122#define CSSR_TROP_HS_REF 2.3 /* hydrostatic reference (m) */
123#define CSSR_TROP_WET_REF 0.252 /* wet delay reference (m) */
124
125/*============================================================================
126 * CSSR Update Type Indices (for ssrn_t.update[])
127 *===========================================================================*/
128
129#define CSSR_UPDATE_TROP 0
130#define CSSR_UPDATE_STEC 1
131#define CSSR_UPDATE_PBIAS 2
132
133/*============================================================================
134 * CSSR Validity Ages (seconds)
135 *===========================================================================*/
136
137#define CSSR_TROPVALIDAGE 3600 /* max troposphere correction age */
138#define CSSR_STECVALIDAGE 3600 /* max STEC correction age */
139
140/*============================================================================
141 * Special Values
142 *===========================================================================*/
143
144#define CSSR_INVALID_VALUE -10000 /* invalid correction marker */
145
146/*============================================================================
147 * L6 Frame Constants
148 *===========================================================================*/
149
150#define L6FRMPREAMB L6_PREAMBLE /* L6 frame preamble (4 bytes) */
151#define BLEN_MSG L6_FRAME_LEN /* L6 subframe length (bytes) */
152
153/*============================================================================
154 * CSSR Week Reference Indices
155 *===========================================================================*/
156
157enum {
170};
171
172/*============================================================================
173 * CLAS Storage Dimensions (reduced from upstream for memory efficiency)
174 *
175 * Upstream claslib uses CSSR_MAX_NETWORK=32, *BANKNUM=128, RTCM_SSR_MAX_GP=128
176 * which results in ~6.6GB per cssr_bank_control instance.
177 *
178 * Design decisions (agreed in planning):
179 * - Bank depth: 128 -> 32 (30s UDI × 32 = 960s history, ample)
180 * - Network count: 32 -> 6 (Japan CLAS uses 1-2, margin for boundaries)
181 * - Grid points: 128 -> 80 (practical CLAS grid sizes are 20-70)
182 * - Channels: 2 (L6 CH1 + CH2, same as upstream)
183 *===========================================================================*/
184
185#define CLAS_CH_NUM 2 /* L6 channels */
186#define CLAS_MAX_NETWORK 13 /* max networks (upstream uses 32, 13 covers networks 1-12) */
187#define CLAS_BANK_NUM 32 /* bank depth (ring buffer entries) */
188#define CLAS_MAX_GP 80 /* max grid points in bank storage */
189
190/*============================================================================
191 * Grid Interpolation Constants
192 *===========================================================================*/
193
194#define CLAS_MAX_NGRID 4 /* grid points for interpolation */
195#define CLAS_MAXPBCORSSR 20.0 /* max phase bias correction (m) */
196
197/*============================================================================
198 * STEC Data Types (from claslib/rtklib.h)
199 *===========================================================================*/
200
201typedef struct { /* STEC data element type */
202 gtime_t time; /* time (GPST) */
203 unsigned char sat; /* satellite number */
204 unsigned char slip; /* slip flag */
205 float iono; /* L1 ionosphere delay (m) */
206 float rate; /* L1 ionosphere rate (m/s) */
207 float quality; /* ionosphere quality indicator */
208 float rms; /* rms value (m) */
209 int flag; /* status flag */
210} stecd_t;
211
212typedef struct { /* STEC grid type */
213 double pos[3]; /* latitude/longitude (deg) */
214 int n, nmax; /* number of data/allocated */
215 stecd_t* data; /* STEC data (dynamically allocated) */
216} stec_t;
217
218/*============================================================================
219 * ZWD (Zenith Wet Delay) Data Types (from claslib/rtklib.h)
220 *===========================================================================*/
221
222typedef struct { /* ZWD data element type */
223 gtime_t time; /* time (GPST) */
224 unsigned char valid; /* valid flag (0:invalid, 1:valid) */
225 float zwd; /* zenith wet delay (m) */
226 float ztd; /* zenith total delay (m) */
227 float rms; /* rms value (m) */
228 float quality; /* troposphere quality indicator */
229} zwdd_t;
230
231typedef struct { /* ZWD grid type */
232 float pos[3]; /* latitude/longitude (rad) */
233 int n, nmax; /* number of data/allocated */
234 zwdd_t* data; /* ZWD data (dynamically allocated) */
235} zwd_t;
236
237/*============================================================================
238 * Ocean Loading Type (from claslib/rtklib.h)
239 *===========================================================================*/
240
241typedef struct { /* ocean loading per network */
242 int gridnum; /* number of grid points */
243 double pos[CLAS_MAX_GP][2]; /* grid positions [deg] {lat,lon} */
244 double odisp[CLAS_MAX_GP][6 * 11]; /* ocean tide loading parameters */
246
247/*============================================================================
248 * SSR Ground Point Type (from claslib/rtklib.h)
249 *===========================================================================*/
250
251typedef struct { /* SSR ground point data */
252 int type; /* grid type */
253 double pos[3]; /* position {lat,lon,hgt} */
254 int network; /* network id */
255 int update; /* update flag */
256} clas_gp_t;
257
258/*============================================================================
259 * CSSR Decoder Types (from claslib/cssr.h)
260 *
261 * These represent the decoded CSSR message state.
262 * Dimensions use protocol constants (CSSR_MAX_*) since the decoder must
263 * handle full protocol capacity.
264 *===========================================================================*/
265
266typedef struct { /* CSSR decoder options */
267 int stec_type; /* STEC correction type */
268} cssropt_t;
269
270typedef struct { /* CSSR per-network correction data */
271 gtime_t t0[2]; /* epoch time {trop,stec} (GPST) */
272 double udi[2]; /* update interval {trop,stec} (s) */
273 int iod[2]; /* IOD {trop,stec} */
274 int ngp; /* number of grid points */
275 float quality_f[CSSR_MAX_LOCAL_SV]; /* STEC quality per satellite */
276 float trop_wet[CSSR_MAX_GP]; /* troposphere wet delay per GP (m) */
277 float trop_total[CSSR_MAX_GP]; /* troposphere total delay per GP (m) */
278 int nsat_f; /* number of STEC satellites */
279 int sat_f[CSSR_MAX_LOCAL_SV]; /* STEC satellite list */
280 float quality; /* troposphere quality indicator */
281 double a[CSSR_MAX_LOCAL_SV][4]; /* STEC polynomial coefficients */
282 int nsat[CSSR_MAX_GP]; /* number of satellites per GP */
283 int sat[CSSR_MAX_GP][CSSR_MAX_LOCAL_SV]; /* satellite list per GP */
284 float stec[CSSR_MAX_GP][CSSR_MAX_LOCAL_SV]; /* STEC values per GP */
285 float stec0[CSSR_MAX_GP][CSSR_MAX_LOCAL_SV]; /* STEC polynomial baseline */
286 double grid[CSSR_MAX_GP][3]; /* grid point coordinates {lat,lon,hgt} */
287 int update[3]; /* update flags {trop,stec,pbias} */
288} ssrn_t;
289
290typedef struct { /* CSSR main decoder state */
291 int ver; /* CSSR version */
292 cssropt_t opt; /* decoder options */
293 int iod; /* IOD SSR */
294 int iod_sv; /* IOD satellite mask */
295 int inet; /* current network index */
296 int week; /* GPS week number */
297 uint8_t cmi[CSSR_MAX_GNSS]; /* cellmask existence flag per GNSS */
298 uint64_t svmask[CSSR_MAX_GNSS]; /* satellite mask per GNSS */
299 uint16_t sigmask[CSSR_MAX_GNSS]; /* signal mask per GNSS */
300 uint16_t cellmask[CSSR_MAX_SV]; /* cellmask per satellite */
301 uint64_t net_svmask[CSSR_MAX_NET]; /* satellite mask per network */
302 int ngnss; /* number of GNSS systems */
303 int nsat; /* number of satellites */
304 int ncell; /* number of cellmask entries */
305 int sat[CSSR_MAX_SV]; /* satellite number list */
306 int nsat_n[CSSR_MAX_NET]; /* number of satellites per network */
307 int sat_n[CSSR_MAX_NET][CSSR_MAX_LOCAL_SV]; /* sat list per network */
308 int nsig[CSSR_MAX_SV]; /* number of signals per satellite */
309 int sigmask_s[CSSR_MAX_SV]; /* signal mask start index */
310 int amb_bias[MAXSAT][MAXCODE]; /* ambiguity bias flags */
311 uint8_t disc[MAXSAT][MAXCODE]; /* discontinuity indicators */
312 float quality_i; /* ionosphere quality */
313 int l6delivery; /* L6 delivery channel */
314 int l6facility; /* L6 facility */
315 ssrn_t ssrn[CSSR_MAX_NET]; /* per-network correction data */
316 int si_cnt; /* service information count */
317 int si_sz; /* service information size */
318 uint64_t si_data[4]; /* service information data */
319} cssr_t;
320
321/*============================================================================
322 * CLAS Correction Bank Types (from claslib/cssr.c)
323 *
324 * Ring buffer system for temporal storage of CSSR corrections.
325 * Dimensions use CLAS_MAX_* (reduced from upstream) for memory efficiency.
326 * All bank structures are heap-allocated via clas_ctx_init().
327 *===========================================================================*/
328
329/** Merged correction snapshot — combines orbit/clock/bias/trop for one epoch */
330typedef struct {
331 /* STEC data per grid point per satellite */
334
335 /* ZWD data per grid point */
338
339 /* signal biases per satellite */
340 double cbias[MAXSAT][MAXCODE]; /* code bias (m) */
341 double pbias[MAXSAT][MAXCODE]; /* phase bias (m) */
342 int smode[MAXSAT][MAXCODE]; /* signal tracking mode */
343
344 /* orbit corrections per satellite */
345 double deph0[MAXSAT]; /* radial (m) */
346 double deph1[MAXSAT]; /* along-track (m) */
347 double deph2[MAXSAT]; /* cross-track (m) */
348 int iode[MAXSAT]; /* issue of data ephemeris */
349
350 /* clock correction per satellite */
351 double c0[MAXSAT]; /* clock correction (m) */
352
353 /* metadata per satellite per correction type */
354 gtime_t time[MAXSAT][6]; /* epoch time */
355 double udi[MAXSAT][6]; /* update interval (s) */
356 int iod[MAXSAT][6]; /* IOD */
357 int prn[MAXSAT][6]; /* PRN flags */
358 int flag[MAXSAT]; /* satellite availability flag */
359
360 /* snapshot timestamps */
361 gtime_t update_time; /* last update time */
362 gtime_t orbit_time; /* orbit correction time */
363 gtime_t clock_time; /* clock correction time */
364 gtime_t bias_time; /* bias correction time */
365 gtime_t trop_time; /* trop correction time */
366
367 /* identification */
368 int facility; /* L6 facility id */
369 int gridnum; /* number of grid points */
370 int network; /* network id */
371 int use; /* in-use flag */
373
374/** Orbit correction ring buffer entry */
375typedef struct {
376 int use; /* in-use flag */
377 gtime_t time; /* epoch time */
378 int network; /* network id */
379 int prn[MAXSAT]; /* satellite availability */
380 double udi[MAXSAT]; /* update interval (s) */
381 int iod[MAXSAT]; /* IOD */
382 int iode[MAXSAT]; /* issue of data ephemeris */
383 double deph0[MAXSAT]; /* radial correction (m) */
384 double deph1[MAXSAT]; /* along-track correction (m) */
385 double deph2[MAXSAT]; /* cross-track correction (m) */
387
388/** Clock correction ring buffer entry */
389typedef struct {
390 int use; /* in-use flag */
391 gtime_t time; /* epoch time */
392 int network; /* network id */
393 int prn[MAXSAT]; /* satellite availability */
394 double udi[MAXSAT]; /* update interval (s) */
395 int iod[MAXSAT]; /* IOD */
396 double c0[MAXSAT]; /* clock correction (m) */
398
399/** Code/phase bias ring buffer entry */
400typedef struct {
401 int use; /* in-use flag */
402 gtime_t time; /* epoch time */
403 int network; /* network id */
404 int bflag; /* bias type flag */
405 int prn[MAXSAT]; /* satellite availability */
406 double udi[MAXSAT]; /* update interval (s) */
407 int iod[MAXSAT]; /* IOD */
408 int smode[MAXSAT][MAXCODE]; /* signal tracking mode */
409 int sflag[MAXSAT][MAXCODE]; /* signal validity flag */
410 double cbias[MAXSAT][MAXCODE]; /* code bias (m) */
411 double pbias[MAXSAT][MAXCODE]; /* phase bias (m) */
413
414/** Troposphere/ionosphere grid ring buffer entry */
415typedef struct {
416 int use; /* in-use flag */
417 gtime_t time; /* epoch time */
418 int gridnum[CLAS_MAX_NETWORK]; /* grid point count per network */
419 double gridpos[CLAS_MAX_NETWORK][CLAS_MAX_GP][3]; /* grid positions */
420 double total[CLAS_MAX_NETWORK][CLAS_MAX_GP]; /* trop total delay (m) */
421 double wet[CLAS_MAX_NETWORK][CLAS_MAX_GP]; /* trop wet delay (m) */
422 int satnum[CLAS_MAX_NETWORK][CLAS_MAX_GP]; /* sat count per GP */
423 int prn[CLAS_MAX_NETWORK][CLAS_MAX_GP][MAXSAT]; /* sat availability */
424 double iono[CLAS_MAX_NETWORK][CLAS_MAX_GP][MAXSAT]; /* STEC per GP (m) */
426
427/** Latest troposphere/STEC state (non-ring-buffer, single instance) */
428typedef struct {
429 int gridnum[CLAS_MAX_NETWORK]; /* grid point count per network */
430 double gridpos[CLAS_MAX_NETWORK][CLAS_MAX_GP][3]; /* grid positions */
432 double total[CLAS_MAX_NETWORK][CLAS_MAX_GP]; /* trop total delay */
433 double wet[CLAS_MAX_NETWORK][CLAS_MAX_GP]; /* trop wet delay */
435 int prn[CLAS_MAX_NETWORK][CLAS_MAX_GP][MAXSAT]; /* sat availability */
436 double stec0[CLAS_MAX_NETWORK][CLAS_MAX_GP][MAXSAT]; /* STEC0 (m) */
437 double stec[CLAS_MAX_NETWORK][CLAS_MAX_GP][MAXSAT]; /* STEC (m) */
439
440/** Bank control — manages all ring buffers for one L6 channel */
441typedef struct {
446 int fastfix[CLAS_MAX_NETWORK]; /* fast fix status per network */
447 clas_latest_trop_t LatestTrop; /* latest trop/STEC snapshot */
448 int Facility; /* L6 facility id */
449 int separation; /* correction separation flag */
450 int NextOrbit; /* next orbit bank write index */
451 int NextClock; /* next clock bank write index */
452 int NextBias; /* next bias bank write index */
453 int NextTrop; /* next trop bank write index */
454 int use; /* in-use flag */
456
457/*============================================================================
458 * Grid Interpolation Types (from claslib/cssr2osr.h)
459 *===========================================================================*/
460
461/** Grid interpolation result (weights and indices for surrounding GPs) */
462typedef struct {
463 double Gmat[CLAS_MAX_NGRID * CLAS_MAX_NGRID]; /* interpolation matrix */
464 double weight[CLAS_MAX_NGRID]; /* interpolation weights */
465 double Emat[CLAS_MAX_NGRID]; /* interpolation errors */
466 int index[CLAS_MAX_NGRID]; /* selected grid point indices */
467 int network; /* network id */
468 int num; /* number of selected grid points */
470
471/*============================================================================
472 * OSR (Observation Space Representation) Data Type (from claslib/rtklib.h)
473 *
474 * Used by the PPP-RTK positioning engine (Phase 4).
475 *===========================================================================*/
476
477typedef struct { /* observation space representation record */
478 gtime_t time; /* receiver sampling time (GPST) */
479 unsigned char sat; /* satellite number */
480 unsigned char refsat; /* reference satellite number */
481 int iode; /* IODE */
482 double clk; /* satellite clock correction by SSR (m) */
483 double orb; /* satellite orbit correction by SSR (m) */
484 double trop; /* troposphere delay correction (m) */
485 double iono; /* ionosphere correction by SSR (m) */
486 double age; /* SSR correction age (s) */
487 double cbias[NFREQ + NEXOBS]; /* code bias per signal (m) */
488 double pbias[NFREQ + NEXOBS]; /* phase bias per signal (m) */
489 double l0bias; /* L0 phase bias (m) */
490 double discontinuity[NFREQ + NEXOBS]; /* discontinuity indicator */
491 double rho; /* satellite-receiver distance (m) */
492 double dts; /* satellite clock from broadcast (s) */
493 double relatv; /* relativistic delay / Shapiro (m) */
494 double earthtide; /* solid earth tide correction (m) */
495 double antr[NFREQ + NEXOBS]; /* receiver antenna PCV (m) */
496 double wupL[NFREQ + NEXOBS]; /* phase windup correction (m) */
497 double compL[NFREQ + NEXOBS]; /* time variation compensation (m) */
498 double CPC[NFREQ + NEXOBS]; /* carrier-phase correction (m) */
499 double PRC[NFREQ + NEXOBS]; /* pseudorange correction (m) */
500 double dCPC[NFREQ + NEXOBS]; /* SD carrier-phase correction (m) */
501 double dPRC[NFREQ + NEXOBS]; /* SD pseudorange correction (m) */
502 double c[NFREQ + NEXOBS]; /* carrier-phase from model (m) */
503 double p[NFREQ + NEXOBS]; /* pseudorange from model (m) */
504 double resc[NFREQ + NEXOBS]; /* carrier-phase residual (m) */
505 double resp[NFREQ + NEXOBS]; /* pseudorange residual (m) */
506 double dresc[NFREQ + NEXOBS]; /* SD carrier-phase residual (m) */
507 double dresp[NFREQ + NEXOBS]; /* SD pseudorange residual (m) */
508 double ddisp; /* SD dispersive residual (m) */
509 double dL0; /* SD non-dispersive residual (m) */
510 double sis; /* signal-in-space error */
512
513typedef clas_osrd_t osrd_t; /* upstream compat alias */
514
515/*============================================================================
516 * CLAS Decoder Per-Satellite Buffer (replaces upstream rtcm->nav.ssr[])
517 *
518 * The CLAS decoder writes per-satellite corrections here instead of
519 * writing directly to nav_t.ssr[]. Bank management functions read
520 * from this buffer. Fields match upstream claslib ssr_t semantics.
521 *===========================================================================*/
522
523typedef struct {
524 gtime_t t0[6]; /* epoch time per corr type (GPST) */
525 double udi[6]; /* update interval (s) */
526 int iod[6]; /* IOD per correction type */
527 int iode; /* issue of data ephemeris */
528 int ura; /* URA class value */
529 double deph[3]; /* orbit {radial,along,cross} (m) */
530 double ddeph[3]; /* orbit rate (m/s) */
531 double dclk[3]; /* clock {c0,c1,c2} */
532 double cbias[MAXCODE]; /* code bias (m) — double for decode precision */
533 double pbias[MAXCODE]; /* phase bias (m) */
534 int discnt[MAXCODE]; /* discontinuity indicator */
535 int smode[MAXCODE]; /* signal tracking mode */
536 int nsig; /* number of signals */
537 uint8_t update; /* general update flag */
538 uint8_t update_oc; /* orbit correction updated */
539 uint8_t update_cc; /* clock correction updated */
540 uint8_t update_cb; /* code bias updated */
541 uint8_t update_pb; /* phase bias updated */
542 uint8_t update_ura; /* URA updated */
544
545/*============================================================================
546 * L6 Frame Buffer (one per channel)
547 *
548 * Manages L6 subframe synchronization, bit buffer accumulation, and
549 * decode state. Replaces the static variables in upstream input_cssr().
550 *===========================================================================*/
551
552typedef struct {
553 uint8_t buff[1200]; /* bit buffer for CSSR decoder */
554 uint8_t fbuff[BLEN_MSG]; /* subframe byte buffer */
555 int nbyte; /* bytes received in current subframe */
556 int len; /* expected subframe length */
557 int nbit; /* current decode bit position */
558 int havebit; /* total bits available in buff */
559 int nframe; /* subframe counter (0-4) */
560 int decode_start; /* decode started flag */
561 int tow; /* epoch time-of-week */
562 int tow0; /* base epoch (floor to hour of mask TOW) */
563 uint32_t preamble; /* preamble accumulator */
564 uint8_t frame; /* subframe receipt bitmap */
565 gtime_t time; /* current decode time */
566 int ctype; /* CSSR message type (4073) */
567 int subtype; /* CSSR subtype (1-12) */
568 double ftag; /* receiver time tag of the frame being received (s, 0: none) */
569 double ftag_last; /* receiver time tag of the last frame (s, 0: none) */
570 int tow_last; /* last decoded epoch time-of-week */
572
573/*============================================================================
574 * CLAS Context Type (NEW — replaces upstream global singletons)
575 *
576 * Aggregates all CLAS state for thread-safe, multi-channel operation.
577 * Must be allocated on heap via clas_ctx_init() and freed via clas_ctx_free().
578 *===========================================================================*/
579
580typedef struct {
581 /* CSSR decoder state per channel */
583
584 /* Bank management per channel (heap-allocated via clas_ctx_init) */
586
587 /* Current and backup correction snapshots per channel */
590
591 /* Grid interpolation state per channel */
594
595 /* Grid point coordinates [network][grid_point][lat,lon,hgt] */
597
598 /* Grid point status per channel [channel][network][grid_point] */
600
601 /* Ocean loading data per network */
603
604 /* Per-satellite decoder output (replaces upstream rtcm->nav.ssr[]) */
606
607 /* L6 frame buffer per channel */
609
610 /* Week references per subtype (for week rollover handling) */
612 gtime_t obs_ref[CSSR_REF_MAX]; /* observation ref time per subtype */
613 int tow_ref[CSSR_REF_MAX]; /* last TOW per subtype (-1=unset) */
614
615 /* L6 delivery/facility per channel */
618
619 /* CLAS Transmit Pattern ID locked to each channel (-1=unset).
620 * Used by the real-time demux to route L6D frames by augmentation
621 * pattern instead of broadcasting PRN, so a QZS handover (PRN change
622 * within the same pattern) keeps feeding the same channel. */
624
625 /* Obs time when each channel last accepted an L6 frame from its active
626 * source PRN (l6delivery[ch]). The demux drops frames from any other PRN
627 * to keep each channel's subframe assembly coherent, and re-locks the
628 * channel to a new PRN/pattern once the active source has been silent
629 * longer than CLAS_L6_RELOCK_TIMEOUT (QZS handover recovery). */
631
632 /* nav_t update flag (signals positioning engine to refresh) */
635
636 /* Current channel index for decoding */
637 int chidx;
638
639 /* Grid definition version */
641
642 /* Initialization flag */
644} clas_ctx_t;
645
646/*============================================================================
647 * Context Management Functions
648 *===========================================================================*/
649
650/**
651 * @brief Initialize CLAS context (allocate bank control on heap).
652 * @param[out] ctx CLAS context to initialize
653 * @return 0 on success, -1 on allocation failure
654 */
655int clas_ctx_init(clas_ctx_t* ctx);
656
657/**
658 * @brief Free CLAS context (release heap-allocated bank control).
659 * @param[in,out] ctx CLAS context to free
660 */
661void clas_ctx_free(clas_ctx_t* ctx);
662
663/*============================================================================
664 * CSSR Decoder Functions
665 *===========================================================================*/
666
667/**
668 * @brief Input CSSR byte stream (one byte at a time, real-time).
669 * @param[in,out] ctx CLAS context
670 * @param[in] data Input byte
671 * @param[in] ch Channel index (0 or 1)
672 * @return Status (-1:error, 0:no message, 10:SSR message decoded)
673 */
674int clas_input_cssr(clas_ctx_t* ctx, uint8_t data, int ch);
675
676/**
677 * @brief Set the receiver time tag of the L6 frame about to be input.
678 *
679 * L6 frames are broadcast once per second and the L6 header has no frame
680 * counter, so a lost frame can only be seen from the receiver time. Call this
681 * before inputting each frame when the receiver reports a per-frame time (SBF
682 * QZSRawL6 block TOW, UBX-RXM-QZSSL6 time tag). A subframe with a frame missing
683 * is then discarded instead of being decoded from shifted bits (#363). Inputs
684 * without a time tag (raw L6 byte streams and files) are not checked.
685 * @param[in,out] ctx CLAS context
686 * @param[in] ch Channel index (0 or 1)
687 * @param[in] tag Receiver time of the frame (s, any origin; 0: unknown)
688 */
689void clas_set_l6tag(clas_ctx_t* ctx, int ch, double tag);
690
691/**
692 * @brief Decode the next pending CSSR message from the assembled bit buffer.
693 *
694 * Call this after clas_input_cssr() to trigger CSSR message decoding.
695 * clas_input_cssr() only assembles L6 frames; this function performs the
696 * actual CSSR decode step and returns a completion code.
697 *
698 * @param[in,out] ctx CLAS context
699 * @param[in] ch Channel index (0 = primary)
700 * @return 10 when a complete CSSR correction set is ready, 0 otherwise
701 */
702int clas_decode_msg(clas_ctx_t* ctx, int ch);
703
704/**
705 * @brief Input CSSR from file (one message at a time, post-processing).
706 * @param[in,out] ctx CLAS context
707 * @param[in] fp File pointer
708 * @param[in] ch Channel index
709 * @return Status (-2:EOF, -1:error, 0:no message, 10:SSR message decoded)
710 */
711int clas_input_cssrf(clas_ctx_t* ctx, FILE* fp, int ch);
712
713/*============================================================================
714 * Bank Management Functions
715 *===========================================================================*/
716
717/**
718 * @brief Initialize bank control for a channel.
719 * @param[in,out] ctx CLAS context
720 * @param[in] ch Channel index
721 */
722void clas_bank_init(clas_ctx_t* ctx, int ch);
723
724/**
725 * @brief Merge closest corrections from all banks into a clas_corr_t snapshot.
726 * @param[in] ctx CLAS context
727 * @param[in] time Target time for matching
728 * @param[in] network Network id
729 * @param[in] ch Channel index
730 * @param[out] corr Output merged correction snapshot
731 * @return 0 on success, -1 if no valid corrections found
732 */
733int clas_bank_get_close(const clas_ctx_t* ctx, gtime_t time, int network, int ch, clas_corr_t* corr);
734
735/**
736 * @brief Save/restore the latest usable CSSR snapshot for short correction gaps.
737 *
738 * Mirrors claslib's BackupCSSR/BackupGrid path. The backup is considered valid
739 * while its latest global correction time is within 180 s of the observation.
740 */
741int clas_backup_valid(const clas_ctx_t* ctx, gtime_t obstime, int l6mrg);
742void clas_backup_current(clas_ctx_t* ctx, const clas_grid_t* grid, int l6mrg);
743void clas_restore_backup(clas_ctx_t* ctx, gtime_t time, clas_grid_t* grid, int l6mrg);
744
745/**
746 * @brief Drop the current correction snapshot of one channel.
747 *
748 * Used when a channel supplies no corrections for the epoch, so that
749 * clas_update_global() clears nav_t.ssr_ch[ch] instead of re-applying the
750 * previous epoch's snapshot.
751 *
752 * @param[in,out] ctx CLAS context
753 * @param[in] ch Channel index
754 */
755void clas_clear_current(clas_ctx_t* ctx, int ch);
756
757/**
758 * @brief Apply global corrections (orbit/clock/bias) to nav_t.ssr[].
759 * @param[in,out] nav Navigation data
760 * @param[in] corr Merged correction snapshot
761 * @param[in] ch Channel index
762 */
763void clas_update_global(nav_t* nav, const clas_corr_t* corr, int ch);
764
765/**
766 * @brief Apply local corrections (trop/STEC) to nav_t.
767 * @param[in,out] nav Navigation data
768 * @param[in] corr Merged correction snapshot
769 * @param[in] ch Channel index
770 */
771void clas_update_local(nav_t* nav, const clas_corr_t* corr, int ch);
772
773/*============================================================================
774 * Grid Definition I/O
775 *===========================================================================*/
776
777/**
778 * @brief Read CLAS grid definition file.
779 * @param[in,out] ctx CLAS context (stores grid positions)
780 * @param[in] file Grid definition file path
781 * @return 0 on success, -1 on error
782 */
783int clas_read_grid_def(clas_ctx_t* ctx, const char* file);
784
785/**
786 * @brief Check and update grid status flags based on correction availability.
787 *
788 * Validates that orbit, trop, and STEC corrections exist for each grid point
789 * and sets grid_stat[ch][network][gp] accordingly. Must be called after
790 * clas_bank_get_close() to enable grid-based positioning.
791 *
792 * @param[in,out] ctx CLAS context (updates grid_stat)
793 * @param[in] time Current observation time
794 * @param[in] ch L6 channel index (0..CLAS_CH_NUM-1)
795 */
796void clas_check_grid_status(clas_ctx_t* ctx, const clas_corr_t* corr, int ch);
797void clas_check_grid_status_time(clas_ctx_t* ctx, gtime_t time, int ch);
798
799/**
800 * @brief Get L6 facility ID from message ID byte.
801 * @param[in] msgid L6 message ID byte
802 * @return Facility ID (0-3)
803 */
804int clas_get_correct_fac(int msgid);
805
806/** Seconds an L6 channel's active source PRN may be silent before the demux
807 * re-locks the channel to a newly arriving PRN/pattern (QZS handover). */
808#define CLAS_L6_RELOCK_TIMEOUT 10.0
809
810/**
811 * @brief Route one interleaved L6D frame to a CLAS channel (or drop it).
812 *
813 * A single UBX/SBF stream from a multi-channel L6 receiver (e.g. u-blox D9C,
814 * and future receivers with more channels) carries L6D frames from several
815 * QZS PRNs interleaved. Each CLAS channel decodes one PRN's subframe sequence
816 * statefully, so frames from different PRNs must NOT be mixed into the same
817 * channel. This router keeps each channel locked to a single active source
818 * PRN and drops frames from any other PRN, re-locking only after the active
819 * source has been silent for CLAS_L6_RELOCK_TIMEOUT seconds.
820 *
821 * Channels are keyed by CLAS Transmit Pattern ID (IS-QZSS-L6 §4.1.1.2): there
822 * are only two patterns, so two channels suffice regardless of how many PRNs
823 * the receiver tracks. Single-channel CLAS (`l6mrg=0`) uses ch 0 only and
824 * collapses to whichever pattern is currently active; dual-channel CLAS
825 * (`l6mrg!=0`) maps each pattern to its own channel for merging.
826 *
827 * @param[in,out] ctx CLAS context (holds per-channel PRN/pattern/time lock)
828 * @param[in] prn Broadcasting QZS PRN (L6 frame byte `buff[4]`)
829 * @param[in] ptn CLAS Transmit Pattern ID, `(buff[5] & 0x06) >> 1`
830 * @param[in] l6mrg L6 merge mode (0:single channel, !=0:dual channel)
831 * @param[in] now Current observation time (GPST) used for the timeout
832 * @return Channel index (0..CLAS_CH_NUM-1) to feed, or -1 to drop the frame.
833 */
834int clas_route_l6frame(clas_ctx_t* ctx, int prn, int ptn, int l6mrg, gtime_t now);
835
836/*============================================================================
837 * Grid Interpolation (mrtk_clas_grid.c)
838 *===========================================================================*/
839
840/**
841 * @brief Select surrounding grid points and compute interpolation weights.
842 * @param[in,out] ctx CLAS context (grid_pos, grid_stat)
843 * @param[in] pos Receiver position {lat,lon,hgt} (rad,m)
844 * @param[out] grid Interpolation result (weights, indices, matrix)
845 * @param[in] gridsel Grid selection threshold (m), 0=always multi-grid
846 * @param[in] obstime Observation time (reserved)
847 * @return Number of selected grids (0=error, 1/3/4=ok)
848 */
849int clas_get_grid_index(clas_ctx_t* ctx, const double* pos, clas_grid_t* grid, int gridsel, gtime_t obstime);
850
851/**
852 * @brief Interpolate STEC (ionosphere delay) from grid points.
853 * @param[in] corr Merged correction snapshot
854 * @param[in] index Selected grid point indices
855 * @param[in] time Time (GPST)
856 * @param[in] sat Satellite number
857 * @param[in] n Number of grids (1-4)
858 * @param[in] weight Interpolation weights
859 * @param[in] Gmat Interpolation matrix (4x4, can be NULL)
860 * @param[in] Emat Basis vector (4x1, can be NULL)
861 * @param[out] iono Interpolated L1 ionosphere delay (m)
862 * @param[out] rate Interpolated ionosphere rate (m/s)
863 * @param[out] var Interpolated variance (m^2)
864 * @param[out] brk Slip break flag
865 * @return 1=ok, 0=error
866 */
867int clas_stec_grid_data(clas_corr_t* corr, const int* index, gtime_t time, int sat, int n, const double* weight,
868 const double* Gmat, const double* Emat, double* iono, double* rate, double* var, int* brk);
869
870/**
871 * @brief Interpolate troposphere delay from grid points.
872 * @param[in] corr Merged correction snapshot
873 * @param[in] index Selected grid point indices
874 * @param[in] time Time (GPST)
875 * @param[in] n Number of grids (1-4)
876 * @param[in] weight Interpolation weights
877 * @param[in] Gmat Interpolation matrix (4x4, can be NULL)
878 * @param[in] Emat Basis vector (4x1, can be NULL)
879 * @param[out] zwd Interpolated zenith wet delay
880 * @param[out] ztd Interpolated zenith total delay
881 * @param[out] tbrk Validity flag (0=all valid, 1=partial)
882 * @return 1=ok, 0=error
883 */
884int clas_trop_grid_data(clas_corr_t* corr, const int* index, gtime_t time, int n, const double* weight,
885 const double* Gmat, const double* Emat, double* zwd, double* ztd, int* tbrk);
886
887/**
888 * @brief Initialize ocean loading data in context.
889 * @param[in,out] ctx CLAS context
890 */
891void clas_init_oload(clas_ctx_t* ctx);
892
893/**
894 * @brief Read BLQ ocean tide loading parameters for CLAS grid points.
895 * @param[in] file BLQ grid file
896 * @param[in,out] ctx CLAS context (oload[] populated)
897 * @return 1:ok, 0:file open error
898 */
899int readblqgrid(const char* file, clas_ctx_t* ctx);
900
901/*============================================================================
902 * OSR (SSR→OSR) Conversion Context (mrtk_clas_osr.c)
903 *
904 * Replaces static variables from upstream cssr2osr.c with a context struct
905 * for thread safety and multi-instance support.
906 *===========================================================================*/
907
908/** Per-satellite SSR correction state for SIS/IODE adjustment */
909typedef struct {
910 double currtow; /* orbit TOW of last computed SIS discontinuity (s) */
911 double currsis; /* current SIS discontinuity (m) */
912 double prevtow; /* clock TOW when prevsis was saved (s) */
913 double prevsis; /* SIS value saved at 25s boundary */
914 int previode; /* IODE when prevsis was saved */
915 double prev_orb_tow; /* orbit epoch of previous call (for orbit-update detection) */
916 double tow; /* last computed TOW */
917 double orb; /* orbit correction along line-of-sight (m) */
918 double clk; /* clock correction (m) */
920
921/** SSR→OSR conversion persistent state */
922typedef struct {
923 /* zdres() persistent state (replaces statics in cssr2osr.c:zdres) */
924 double pbias_ofst[MAXSAT * (NFREQ + NEXOBS)]; /* phase bias offset history */
925 double cpctmp[MAXSAT * (NFREQ + NEXOBS)]; /* previous epoch CPC */
926 gtime_t pt0tmp[MAXSAT * (NFREQ + NEXOBS)]; /* previous epoch pbias time */
927
928 /* compensatedisp() persistent state */
929 gtime_t comp_t0[CLAS_CH_NUM][MAXSAT]; /* previous update time */
930 gtime_t comp_tm[CLAS_CH_NUM][MAXSAT]; /* prev-previous update time */
931 double comp_b0[CLAS_CH_NUM][MAXSAT * (NFREQ + NEXOBS)]; /* previous pbias */
932 double comp_bm[CLAS_CH_NUM][MAXSAT * (NFREQ + NEXOBS)]; /* prev-prev pbias */
933 double comp_iono0[CLAS_CH_NUM][MAXSAT]; /* previous iono */
934 double comp_ionom[CLAS_CH_NUM][MAXSAT]; /* prev-prev iono */
935 double comp_coef[CLAS_CH_NUM][MAXSAT * (NFREQ + NEXOBS)]; /* linear coeff */
936 int comp_slip[CLAS_CH_NUM][MAXSAT * NFREQ]; /* slip detection state */
937
938 /* SIS/IODE adjustment state (replaces static satcorr[] in upstream) */
940 double saved_rr[3]; /* saved receiver position for SIS computation */
941
942 /* δBIAS discontinuity compensation (IS-QZSS-L6-005 5.5.3.2).
943 * Tracks SSR range correction (-dclk + deph·LOS) per satellite to
944 * detect orbit correction transitions and compensate bias jumps. */
947
950
951/*============================================================================
952 * OSR Conversion Functions (mrtk_clas_osr.c)
953 *===========================================================================*/
954
955/** Invalid CSSR bias value sentinel */
956#define CLAS_CSSRINVALID (-10000)
957
958/** Maximum age for SSR bias corrections (seconds) */
959#define CLAS_MAXAGESSR_BIAS 120.0
960
961/** Maximum phase bias correction for SSR (meters) */
962#define CLAS_MAXPBCORSSR 20.0
963
964/**
965 * @brief Precise troposphere model for CLAS (MOPS standard + mapping function).
966 * @param[in] time Observation time
967 * @param[in] pos Receiver position {lat,lon,hgt} (rad,m)
968 * @param[in] azel Azimuth/elevation {az,el} (rad)
969 * @param[in] zwd Zenith wet delay from grid (m)
970 * @param[in] ztd Zenith total delay from grid (m)
971 * @return Slant tropospheric delay (m), 0 on error
972 */
973double clas_osr_prectrop(gtime_t time, const double* pos, const double* azel, double zwd, double ztd);
974
975/**
976 * @brief Select frequency pair for multi-frequency processing.
977 * @param[in] sat Satellite number
978 * @param[in] opt Processing options
979 * @param[in] obs Observation data
980 * @return Frequency pair bitmask (0=L1 only, 1=L2, 2=L5, 3=L2+L5)
981 */
982int clas_osr_selfreqpair(int sat, const prcopt_t* opt, const obsd_t* obs);
983
984/**
985 * @brief Compute zero-differenced phase/code residuals with CLAS corrections.
986 * @param[in] obs Observation data for epoch
987 * @param[in] n Number of observations
988 * @param[in] rs Satellite positions+velocities (6*n)
989 * @param[in] dts Satellite clock corrections (2*n)
990 * @param[in] vare Satellite position variances (n)
991 * @param[in] svh Satellite health flags (n)
992 * @param[in,out] nav Navigation data
993 * @param[in,out] x State vector (position extracted from [0:2])
994 * @param[out] y Residuals (n*nf*2)
995 * @param[out] e Line-of-sight vectors (3*n)
996 * @param[out] azel Azimuth/elevation (2*n)
997 * @param[in] rtk RTK control struct
998 * @param[in] osrlog Enable OSR logging
999 * @param[in,out] osr_ctx OSR context for persistent state
1000 * @param[in] grid Grid interpolation state
1001 * @param[in] corr Merged correction snapshot
1002 * @param[in,out] ssat Satellite status array
1003 * @param[in] opt Processing options
1004 * @param[in,out] sol Solution struct
1005 * @param[out] osr OSR output per satellite
1006 * @param[in] ch SSR channel (0 or 1)
1007 * @return Number of valid measurements
1008 */
1009/**
1010 * @brief Update per-satellite SIS correction state for IODE adjustment.
1011 * @param[in] time Observation time
1012 * @param[in] teph Time for ephemeris selection
1013 * @param[in] sat Satellite number
1014 * @param[in] opt Processing options
1015 * @param[in] nav Navigation data
1016 * @param[in] ch SSR channel index
1017 * @param[in,out] ctx OSR context (satcorr state updated)
1018 * @return 1:ok, 0:error
1019 */
1020int clas_osr_satcorr_update(gtime_t time, gtime_t teph, int sat, const prcopt_t* opt, const nav_t* nav, int ch,
1021 clas_osr_ctx_t* ctx);
1022
1023int clas_osr_zdres(const obsd_t* obs, int n, const double* rs, const double* dts, const double* vare, const int* svh,
1024 nav_t* nav, double* x, double* y, double* e, double* azel, rtk_t* rtk, int osrlog,
1025 clas_osr_ctx_t* osr_ctx, clas_grid_t* grid, clas_corr_t* corr, ssat_t* ssat, prcopt_t* opt,
1026 sol_t* sol, clas_osrd_t* osr, int ch);
1027
1028/**
1029 * @brief Compensate time variation of signal bias and ionosphere delay.
1030 * @param[in] corr Merged correction snapshot
1031 * @param[in] index Grid point indices
1032 * @param[in] obs Observation for this satellite
1033 * @param[in] sat Satellite number
1034 * @param[in] iono Ionosphere delay (m)
1035 * @param[in] pb Phase biases per frequency
1036 * @param[out] compL Compensation output per frequency
1037 * @param[in,out] pbreset Phase bias reset flags
1038 * @param[in] opt Processing options
1039 * @param[in] ssat Satellite status
1040 * @param[in] ch SSR channel
1041 * @param[in,out] osr_ctx OSR context for persistent state
1042 * @param[in] nav Navigation data (for wavelengths)
1043 */
1044void clas_osr_compensatedisp(clas_corr_t* corr, const int* index, const obsd_t* obs, int sat, double iono,
1045 const double* pb, double* compL, int* pbreset, const prcopt_t* opt, ssat_t ssat, int ch,
1046 clas_osr_ctx_t* osr_ctx, const nav_t* nav);
1047
1048/**
1049 * @brief Assemble per-satellite ionosphere/bias/antenna corrections.
1050 * @param[in] obs Observation for this satellite
1051 * @param[in,out] nav Navigation data
1052 * @param[in] pos Receiver position {lat,lon,hgt} (rad,m)
1053 * @param[in] azel Azimuth/elevation for this satellite
1054 * @param[in] opt Processing options
1055 * @param[in] grid Grid interpolation state
1056 * @param[in] corr Merged correction snapshot
1057 * @param[in] ssat Satellite status
1058 * @param[out] brk Slip break flag
1059 * @param[out] osr OSR output for this satellite
1060 * @param[in,out] pbreset Phase bias reset flags
1061 * @param[in] ch SSR channel
1062 * @param[in,out] osr_ctx OSR context
1063 * @return 1=ok, 0=error (stale bias, missing iono)
1064 */
1065int clas_osr_corrmeas(const obsd_t* obs, nav_t* nav, const double* pos, const double* azel, const prcopt_t* opt,
1066 clas_grid_t* grid, clas_corr_t* corr, ssat_t ssat, int* brk, clas_osrd_t* osr, int* pbreset,
1067 int ch, clas_osr_ctx_t* osr_ctx);
1068
1069/**
1070 * @brief Initialize OSR conversion context.
1071 * @param[out] ctx OSR context to initialize
1072 */
1074
1075/**
1076 * @brief Convert compact SSR corrections to observation-space representations.
1077 *
1078 * Top-level wrapper that sets up grid/CSSR corrections and calls clas_osr_zdres().
1079 * Verbatim port of upstream claslib ssr2osr() from cssr2osr.c.
1080 *
1081 * @param[in,out] rtk RTK control structure
1082 * @param[in,out] obs Observation data array
1083 * @param[in] n Number of observations
1084 * @param[in,out] nav Navigation data
1085 * @param[out] osr OSR output per satellite
1086 * @param[in] mode 0=normal (upstream compat)
1087 * @param[in] clas CLAS decoder context
1088 * @return Number of valid measurements, 0 on failure
1089 */
1090int clas_ssr2osr(rtk_t* rtk, obsd_t* obs, int n, nav_t* nav, clas_osrd_t* osr, int mode, clas_ctx_t* clas);
1091
1092/*============================================================================
1093 * CSSR Helper Functions
1094 *===========================================================================*/
1095
1096/**
1097 * @brief Convert CSSR GNSS ID to RTKLIB system bitmask.
1098 * @param[in] gnss CSSR GNSS ID (CSSR_SYS_GPS, etc.)
1099 * @param[out] prn0 Output base PRN offset (can be NULL)
1100 * @return RTKLIB system bitmask (SYS_GPS, etc.), 0 on error
1101 */
1102int cssr_gnss2sys(int gnss, int* prn0);
1103
1104/**
1105 * @brief Convert RTKLIB system bitmask to CSSR GNSS ID.
1106 * @param[in] sys RTKLIB system (SYS_GPS, etc.)
1107 * @param[out] prn0 Output base PRN offset (can be NULL)
1108 * @return CSSR GNSS ID, CSSR_SYS_NONE on error
1109 */
1110int cssr_sys2gnss(int sys, int* prn0);
1111
1112/*============================================================================
1113 * ISB Functions (types defined in mrtk_nav.h)
1114 *===========================================================================*/
1115
1116/**
1117 * @brief Read ISB correction table from file.
1118 * @param[in] file ISB table file path (wild-card * expanded)
1119 * @param[in,out] nav Navigation data (isb array populated)
1120 * @return Status (1:ok, 0:error)
1121 */
1122int readisb(const char* file, nav_t* nav);
1123
1124/**
1125 * @brief Read L2C 1/4 cycle phase shift table from file.
1126 * @param[in] file L2C phase shift table file path
1127 * @param[in,out] nav Navigation data (sfts populated)
1128 * @return Status (0:ok, -1:error)
1129 */
1130int readL2C(const char* file, nav_t* nav);
1131
1132/**
1133 * @brief Set ISB corrections for rover and reference stations.
1134 * @param[in] nav Navigation data (contains isb table)
1135 * @param[in] rectype0 Rover receiver type
1136 * @param[in] rectype1 Reference receiver type
1137 * @param[out] sta0 Rover station (isb field populated)
1138 * @param[out] sta1 Reference station (isb field populated, can be NULL)
1139 */
1140void setisb(const nav_t* nav, const char* rectype0, const char* rectype1, sta_t* sta0, sta_t* sta1);
1141
1142/**
1143 * @brief Get ISB correction values for a satellite system.
1144 * @param[in] sysno Satellite system code (SYS_GPS, etc.)
1145 * @param[in] opt Processing options
1146 * @param[in] sta Station data with ISB values
1147 * @param[out] y ISB corrections [NFREQ][2] (0:phase, 1:code) (m)
1148 */
1149void chk_isb(int sysno, const prcopt_t* opt, const sta_t* sta, double y[NFREQ][2]);
1150
1151/**
1152 * @brief Check if observation code is L2C.
1153 * @param[in] code Observation code (CODE_???)
1154 * @return 1 if L2C, 0 otherwise
1155 */
1156int isL2C(int code);
1157
1158#ifdef __cplusplus
1159}
1160#endif
1161
1162#endif /* MRTK_CLAS_H */
MRTKLIB Bits Module — Binary bit operations and CRC functions.
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.
Definition mrtk_clas.c:1320
int clas_osr_selfreqpair(int sat, const prcopt_t *opt, const obsd_t *obs)
Select frequency pair for multi-frequency processing.
#define CSSR_MAX_SV
Definition mrtk_clas.h:63
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).
Definition mrtk_clas.c:3070
int clas_trop_grid_data(clas_corr_t *corr, const int *index, gtime_t time, int n, const double *weight, const double *Gmat, const double *Emat, double *zwd, double *ztd, int *tbrk)
Interpolate troposphere delay from grid points.
int readL2C(const char *file, nav_t *nav)
Read L2C 1/4 cycle phase shift table from file.
int clas_osr_corrmeas(const obsd_t *obs, nav_t *nav, const double *pos, const double *azel, const prcopt_t *opt, clas_grid_t *grid, clas_corr_t *corr, ssat_t ssat, int *brk, clas_osrd_t *osr, int *pbreset, int ch, clas_osr_ctx_t *osr_ctx)
Assemble per-satellite ionosphere/bias/antenna corrections.
int clas_input_cssr(clas_ctx_t *ctx, uint8_t data, int ch)
Input CSSR byte stream (one byte at a time, real-time).
Definition mrtk_clas.c:3127
void clas_restore_backup(clas_ctx_t *ctx, gtime_t time, clas_grid_t *grid, int l6mrg)
Definition mrtk_clas.c:1274
int cssr_sys2gnss(int sys, int *prn0)
Convert RTKLIB system bitmask to CSSR GNSS ID.
Definition mrtk_clas.c:140
void clas_init_oload(clas_ctx_t *ctx)
Initialize ocean loading data in context.
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.
Definition mrtk_clas.c:3215
#define CLAS_CH_NUM
Definition mrtk_clas.h:185
#define CLAS_MAX_NETWORK
Definition mrtk_clas.h:186
@ CSSR_REF_PBIAS
Definition mrtk_clas.h:162
@ CSSR_REF_URA
Definition mrtk_clas.h:164
@ CSSR_REF_ORBIT
Definition mrtk_clas.h:159
@ CSSR_REF_CBIAS
Definition mrtk_clas.h:161
@ CSSR_REF_MAX
Definition mrtk_clas.h:169
@ CSSR_REF_MASK
Definition mrtk_clas.h:158
@ CSSR_REF_ATMOSPHERIC
Definition mrtk_clas.h:168
@ CSSR_REF_COMBINED
Definition mrtk_clas.h:167
@ CSSR_REF_CLOCK
Definition mrtk_clas.h:160
@ CSSR_REF_STEC
Definition mrtk_clas.h:165
@ CSSR_REF_GRID
Definition mrtk_clas.h:166
@ CSSR_REF_BIAS
Definition mrtk_clas.h:163
void clas_ctx_free(clas_ctx_t *ctx)
Free CLAS context (release heap-allocated bank control).
Definition mrtk_clas.c:88
#define CSSR_MAX_NET
Definition mrtk_clas.h:66
int cssr_gnss2sys(int gnss, int *prn0)
Convert CSSR GNSS ID to RTKLIB system bitmask.
Definition mrtk_clas.c:175
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.
Definition mrtk_clas.c:1121
int clas_osr_zdres(const obsd_t *obs, int n, const double *rs, const double *dts, const double *vare, const int *svh, nav_t *nav, double *x, double *y, double *e, double *azel, rtk_t *rtk, int osrlog, clas_osr_ctx_t *osr_ctx, clas_grid_t *grid, clas_corr_t *corr, ssat_t *ssat, prcopt_t *opt, sol_t *sol, clas_osrd_t *osr, int ch)
Compute zero-differenced phase/code residuals with CLAS corrections.
int clas_input_cssrf(clas_ctx_t *ctx, FILE *fp, int ch)
Input CSSR from file (one message at a time, post-processing).
Definition mrtk_clas.c:3217
int clas_read_grid_def(clas_ctx_t *ctx, const char *file)
Read CLAS grid definition file.
Definition mrtk_clas.c:3238
void chk_isb(int sysno, const prcopt_t *opt, const sta_t *sta, double y[5][2])
Get ISB correction values for a satellite system.
int clas_get_correct_fac(int msgid)
Get L6 facility ID from message ID byte.
Definition mrtk_clas.c:3037
#define CLAS_MAX_NGRID
Definition mrtk_clas.h:194
int clas_osr_satcorr_update(gtime_t time, gtime_t teph, int sat, const prcopt_t *opt, const nav_t *nav, int ch, clas_osr_ctx_t *ctx)
Compute zero-differenced phase/code residuals with CLAS corrections.
void clas_check_grid_status_time(clas_ctx_t *ctx, gtime_t time, int ch)
Definition mrtk_clas.c:1365
void clas_bank_init(clas_ctx_t *ctx, int ch)
Initialize bank control for a channel.
Definition mrtk_clas.c:101
int clas_ssr2osr(rtk_t *rtk, obsd_t *obs, int n, nav_t *nav, clas_osrd_t *osr, int mode, clas_ctx_t *clas)
Convert compact SSR corrections to observation-space representations.
#define CLAS_MAX_GP
Definition mrtk_clas.h:188
int clas_get_grid_index(clas_ctx_t *ctx, const double *pos, clas_grid_t *grid, int gridsel, gtime_t obstime)
Select surrounding grid points and compute interpolation weights.
int readblqgrid(const char *file, clas_ctx_t *ctx)
Read BLQ ocean tide loading parameters for CLAS grid points.
void clas_update_global(nav_t *nav, const clas_corr_t *corr, int ch)
Apply global corrections (orbit/clock/bias) to nav_t.ssr[].
Definition mrtk_clas.c:1430
int readisb(const char *file, nav_t *nav)
Read ISB correction table from file.
#define CSSR_MAX_LOCAL_SV
Definition mrtk_clas.h:67
#define CSSR_MAX_GNSS
Definition mrtk_clas.h:61
#define CSSR_MAX_GP
Definition mrtk_clas.h:68
int isL2C(int code)
Check if observation code is L2C.
int clas_ctx_init(clas_ctx_t *ctx)
Initialize CLAS context (allocate bank control on heap).
Definition mrtk_clas.c:54
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.
Definition mrtk_clas.c:1233
int clas_stec_grid_data(clas_corr_t *corr, const int *index, gtime_t time, int sat, int n, const double *weight, const double *Gmat, const double *Emat, double *iono, double *rate, double *var, int *brk)
Interpolate STEC (ionosphere delay) from grid points.
void setisb(const nav_t *nav, const char *rectype0, const char *rectype1, sta_t *sta0, sta_t *sta1)
Set ISB corrections for rover and reference stations.
void clas_osr_ctx_init(clas_osr_ctx_t *ctx)
Initialize OSR conversion context.
void clas_update_local(nav_t *nav, const clas_corr_t *corr, int ch)
Apply local corrections (trop/STEC) to nav_t.
Definition mrtk_clas.c:1493
clas_osrd_t osrd_t
Definition mrtk_clas.h:513
#define CLAS_BANK_NUM
Definition mrtk_clas.h:187
void clas_osr_compensatedisp(clas_corr_t *corr, const int *index, const obsd_t *obs, int sat, double iono, const double *pb, double *compL, int *pbreset, const prcopt_t *opt, ssat_t ssat, int ch, clas_osr_ctx_t *osr_ctx, const nav_t *nav)
Compensate time variation of signal bias and ionosphere delay.
void clas_backup_current(clas_ctx_t *ctx, const clas_grid_t *grid, int l6mrg)
Definition mrtk_clas.c:1250
void clas_clear_current(clas_ctx_t *ctx, int ch)
Drop the current correction snapshot of one channel.
Definition mrtk_clas.c:1266
int clas_decode_msg(clas_ctx_t *ctx, int ch)
Decode the next pending CSSR message from the assembled bit buffer.
Definition mrtk_clas.c:3213
#define BLEN_MSG
Definition mrtk_clas.h:151
double clas_osr_prectrop(gtime_t time, const double *pos, const double *azel, double zwd, double ztd)
Precise troposphere model for CLAS (MOPS standard + mapping function).
#define MAXSAT
Definition mrtk_coords.c:45
struct nav_s nav_t
Definition mrtk_eph.h:40
MRTKLIB Foundation — Common types, standard includes, and system constants (MAXSAT,...
#define MAXCODE
MRTKLIB L6 Module — QZSS L6 frame header parsing.
MRTKLIB Navigation Module — Navigation data types and satellite/nav utility functions.
clas_osr_ctx_t osr_ctx
MRTKLIB RTK Positioning Module — relative and precise positioning.
MRTKLIB Time Module — GNSS time types and conversion functions.
clas_clock_bank_t ClockBank[32]
Definition mrtk_clas.h:443
clas_bias_bank_t BiasBank[32]
Definition mrtk_clas.h:444
clas_trop_bank_t TropBank[32]
Definition mrtk_clas.h:445
clas_orbit_bank_t OrbitBank[32]
Definition mrtk_clas.h:442
clas_latest_trop_t LatestTrop
Definition mrtk_clas.h:447
double pbias[MAXSAT][MAXCODE]
Definition mrtk_clas.h:411
int sflag[MAXSAT][MAXCODE]
Definition mrtk_clas.h:409
int iod[MAXSAT]
Definition mrtk_clas.h:407
int smode[MAXSAT][MAXCODE]
Definition mrtk_clas.h:408
double udi[MAXSAT]
Definition mrtk_clas.h:406
int prn[MAXSAT]
Definition mrtk_clas.h:405
double cbias[MAXSAT][MAXCODE]
Definition mrtk_clas.h:410
double c0[MAXSAT]
Definition mrtk_clas.h:396
double udi[MAXSAT]
Definition mrtk_clas.h:394
int iod[MAXSAT]
Definition mrtk_clas.h:395
int prn[MAXSAT]
Definition mrtk_clas.h:393
gtime_t bias_time
Definition mrtk_clas.h:364
int flag[MAXSAT]
Definition mrtk_clas.h:358
double deph0[MAXSAT]
Definition mrtk_clas.h:345
double cbias[MAXSAT][MAXCODE]
Definition mrtk_clas.h:340
int prn[MAXSAT][6]
Definition mrtk_clas.h:357
zwdd_t zwddata[80]
Definition mrtk_clas.h:336
double udi[MAXSAT][6]
Definition mrtk_clas.h:355
double deph1[MAXSAT]
Definition mrtk_clas.h:346
double pbias[MAXSAT][MAXCODE]
Definition mrtk_clas.h:341
stec_t stec[80]
Definition mrtk_clas.h:333
gtime_t orbit_time
Definition mrtk_clas.h:362
int iode[MAXSAT]
Definition mrtk_clas.h:348
int iod[MAXSAT][6]
Definition mrtk_clas.h:356
gtime_t time[MAXSAT][6]
Definition mrtk_clas.h:354
stecd_t stecdata[80][MAXSAT]
Definition mrtk_clas.h:332
double c0[MAXSAT]
Definition mrtk_clas.h:351
gtime_t trop_time
Definition mrtk_clas.h:365
double deph2[MAXSAT]
Definition mrtk_clas.h:347
int smode[MAXSAT][MAXCODE]
Definition mrtk_clas.h:342
gtime_t update_time
Definition mrtk_clas.h:361
gtime_t clock_time
Definition mrtk_clas.h:363
zwd_t zwd[80]
Definition mrtk_clas.h:337
clas_grid_t grid[2]
Definition mrtk_clas.h:592
clas_corr_t current[2]
Definition mrtk_clas.h:588
int l6pattern[2]
Definition mrtk_clas.h:623
gtime_t obs_ref[CSSR_REF_MAX]
Definition mrtk_clas.h:612
clas_l6buf_t l6buf[2]
Definition mrtk_clas.h:608
int tow_ref[CSSR_REF_MAX]
Definition mrtk_clas.h:613
int l6delivery[2]
Definition mrtk_clas.h:616
double grid_pos[13][80][3]
Definition mrtk_clas.h:596
cssr_t cssr[2]
Definition mrtk_clas.h:582
gtime_t l6lock_time[2]
Definition mrtk_clas.h:630
int l6facility[2]
Definition mrtk_clas.h:617
int initialized
Definition mrtk_clas.h:643
clas_dec_ssr_t dec_ssr[MAXSAT]
Definition mrtk_clas.h:605
clas_oload_t oload[13]
Definition mrtk_clas.h:602
clas_grid_t backup_grid[2]
Definition mrtk_clas.h:593
clas_bank_ctrl_t * bank[2]
Definition mrtk_clas.h:585
int week_ref[CSSR_REF_MAX]
Definition mrtk_clas.h:611
int grid_stat[2][13][80]
Definition mrtk_clas.h:599
clas_corr_t backup[2]
Definition mrtk_clas.h:589
uint8_t update_oc
Definition mrtk_clas.h:538
uint8_t update_ura
Definition mrtk_clas.h:542
double ddeph[3]
Definition mrtk_clas.h:530
double deph[3]
Definition mrtk_clas.h:529
double pbias[MAXCODE]
Definition mrtk_clas.h:533
int smode[MAXCODE]
Definition mrtk_clas.h:535
double dclk[3]
Definition mrtk_clas.h:531
double udi[6]
Definition mrtk_clas.h:525
gtime_t t0[6]
Definition mrtk_clas.h:524
uint8_t update_cc
Definition mrtk_clas.h:539
double cbias[MAXCODE]
Definition mrtk_clas.h:532
uint8_t update_pb
Definition mrtk_clas.h:541
uint8_t update_cb
Definition mrtk_clas.h:540
int discnt[MAXCODE]
Definition mrtk_clas.h:534
uint8_t update
Definition mrtk_clas.h:537
int network
Definition mrtk_clas.h:254
double pos[3]
Definition mrtk_clas.h:253
double weight[4]
Definition mrtk_clas.h:464
double Gmat[4 *4]
Definition mrtk_clas.h:463
double Emat[4]
Definition mrtk_clas.h:465
int index[4]
Definition mrtk_clas.h:466
uint32_t preamble
Definition mrtk_clas.h:563
double ftag_last
Definition mrtk_clas.h:569
uint8_t buff[1200]
Definition mrtk_clas.h:553
uint8_t frame
Definition mrtk_clas.h:564
gtime_t time
Definition mrtk_clas.h:565
double ftag
Definition mrtk_clas.h:568
uint8_t fbuff[L6_FRAME_LEN]
Definition mrtk_clas.h:554
gtime_t troptime[13][80]
Definition mrtk_clas.h:431
double stec[13][80][MAXSAT]
Definition mrtk_clas.h:437
double stec0[13][80][MAXSAT]
Definition mrtk_clas.h:436
double total[13][80]
Definition mrtk_clas.h:432
double wet[13][80]
Definition mrtk_clas.h:433
gtime_t stectime[13][80][MAXSAT]
Definition mrtk_clas.h:434
double gridpos[13][80][3]
Definition mrtk_clas.h:430
int prn[13][80][MAXSAT]
Definition mrtk_clas.h:435
double odisp[80][6 *11]
Definition mrtk_clas.h:244
double pos[80][2]
Definition mrtk_clas.h:243
int prn[MAXSAT]
Definition mrtk_clas.h:379
double deph1[MAXSAT]
Definition mrtk_clas.h:384
double deph0[MAXSAT]
Definition mrtk_clas.h:383
int iode[MAXSAT]
Definition mrtk_clas.h:382
double deph2[MAXSAT]
Definition mrtk_clas.h:385
int iod[MAXSAT]
Definition mrtk_clas.h:381
double udi[MAXSAT]
Definition mrtk_clas.h:380
double comp_coef[2][MAXSAT *(5+5)]
Definition mrtk_clas.h:935
double pbias_ofst[MAXSAT *(5+5)]
Definition mrtk_clas.h:924
int comp_slip[2][MAXSAT *5]
Definition mrtk_clas.h:936
double prev_ssr_range[MAXSAT]
Definition mrtk_clas.h:945
clas_satcorr_t satcorr[2][MAXSAT]
Definition mrtk_clas.h:939
double comp_bm[2][MAXSAT *(5+5)]
Definition mrtk_clas.h:932
double comp_b0[2][MAXSAT *(5+5)]
Definition mrtk_clas.h:931
double comp_iono0[2][MAXSAT]
Definition mrtk_clas.h:933
double prev_ssr_orb_tow[MAXSAT]
Definition mrtk_clas.h:946
double saved_rr[3]
Definition mrtk_clas.h:940
double cpctmp[MAXSAT *(5+5)]
Definition mrtk_clas.h:925
gtime_t comp_tm[2][MAXSAT]
Definition mrtk_clas.h:930
gtime_t pt0tmp[MAXSAT *(5+5)]
Definition mrtk_clas.h:926
double comp_ionom[2][MAXSAT]
Definition mrtk_clas.h:934
gtime_t comp_t0[2][MAXSAT]
Definition mrtk_clas.h:929
double c[5+5]
Definition mrtk_clas.h:502
double dts
Definition mrtk_clas.h:492
double age
Definition mrtk_clas.h:486
double antr[5+5]
Definition mrtk_clas.h:495
double orb
Definition mrtk_clas.h:483
unsigned char refsat
Definition mrtk_clas.h:480
double compL[5+5]
Definition mrtk_clas.h:497
double wupL[5+5]
Definition mrtk_clas.h:496
double rho
Definition mrtk_clas.h:491
gtime_t time
Definition mrtk_clas.h:478
double CPC[5+5]
Definition mrtk_clas.h:498
unsigned char sat
Definition mrtk_clas.h:479
double pbias[5+5]
Definition mrtk_clas.h:488
double dPRC[5+5]
Definition mrtk_clas.h:501
double trop
Definition mrtk_clas.h:484
double resc[5+5]
Definition mrtk_clas.h:504
double p[5+5]
Definition mrtk_clas.h:503
double dresc[5+5]
Definition mrtk_clas.h:506
double ddisp
Definition mrtk_clas.h:508
double discontinuity[5+5]
Definition mrtk_clas.h:490
double relatv
Definition mrtk_clas.h:493
double sis
Definition mrtk_clas.h:510
double dL0
Definition mrtk_clas.h:509
double dCPC[5+5]
Definition mrtk_clas.h:500
double resp[5+5]
Definition mrtk_clas.h:505
double l0bias
Definition mrtk_clas.h:489
double earthtide
Definition mrtk_clas.h:494
double dresp[5+5]
Definition mrtk_clas.h:507
double PRC[5+5]
Definition mrtk_clas.h:499
double clk
Definition mrtk_clas.h:482
double cbias[5+5]
Definition mrtk_clas.h:487
double iono
Definition mrtk_clas.h:485
double prev_orb_tow
Definition mrtk_clas.h:915
double total[13][80]
Definition mrtk_clas.h:420
double gridpos[13][80][3]
Definition mrtk_clas.h:419
int prn[13][80][MAXSAT]
Definition mrtk_clas.h:423
double iono[13][80][MAXSAT]
Definition mrtk_clas.h:424
int satnum[13][80]
Definition mrtk_clas.h:422
double wet[13][80]
Definition mrtk_clas.h:421
uint16_t sigmask[16]
Definition mrtk_clas.h:299
int ver
Definition mrtk_clas.h:291
int nsig[64]
Definition mrtk_clas.h:308
int l6facility
Definition mrtk_clas.h:314
uint64_t net_svmask[32]
Definition mrtk_clas.h:301
ssrn_t ssrn[32]
Definition mrtk_clas.h:315
int nsat
Definition mrtk_clas.h:303
int week
Definition mrtk_clas.h:296
uint8_t cmi[16]
Definition mrtk_clas.h:297
int nsat_n[32]
Definition mrtk_clas.h:306
int sigmask_s[64]
Definition mrtk_clas.h:309
int iod_sv
Definition mrtk_clas.h:294
int amb_bias[MAXSAT][MAXCODE]
Definition mrtk_clas.h:310
int sat[64]
Definition mrtk_clas.h:305
uint16_t cellmask[64]
Definition mrtk_clas.h:300
uint64_t svmask[16]
Definition mrtk_clas.h:298
int l6delivery
Definition mrtk_clas.h:313
uint8_t disc[MAXSAT][MAXCODE]
Definition mrtk_clas.h:311
int inet
Definition mrtk_clas.h:295
int si_sz
Definition mrtk_clas.h:317
int iod
Definition mrtk_clas.h:293
int ngnss
Definition mrtk_clas.h:302
cssropt_t opt
Definition mrtk_clas.h:292
int si_cnt
Definition mrtk_clas.h:316
int ncell
Definition mrtk_clas.h:304
int sat_n[32][32]
Definition mrtk_clas.h:307
uint64_t si_data[4]
Definition mrtk_clas.h:318
float quality_i
Definition mrtk_clas.h:312
int stec_type
Definition mrtk_clas.h:267
GNSS time representation.
Definition mrtk_time.h:49
Observation data record.
Definition mrtk_obs.h:44
float trop_wet[128]
Definition mrtk_clas.h:276
gtime_t t0[2]
Definition mrtk_clas.h:271
float quality
Definition mrtk_clas.h:280
int update[3]
Definition mrtk_clas.h:287
double udi[2]
Definition mrtk_clas.h:272
int sat_f[32]
Definition mrtk_clas.h:279
int nsat[128]
Definition mrtk_clas.h:282
float trop_total[128]
Definition mrtk_clas.h:277
int iod[2]
Definition mrtk_clas.h:273
float stec0[128][32]
Definition mrtk_clas.h:285
float quality_f[32]
Definition mrtk_clas.h:275
double a[32][4]
Definition mrtk_clas.h:281
float stec[128][32]
Definition mrtk_clas.h:284
int nsat_f
Definition mrtk_clas.h:278
int sat[128][32]
Definition mrtk_clas.h:283
double grid[128][3]
Definition mrtk_clas.h:286
int ngp
Definition mrtk_clas.h:274
int nmax
Definition mrtk_clas.h:214
int n
Definition mrtk_clas.h:214
stecd_t * data
Definition mrtk_clas.h:215
double pos[3]
Definition mrtk_clas.h:213
float iono
Definition mrtk_clas.h:205
float rate
Definition mrtk_clas.h:206
float quality
Definition mrtk_clas.h:207
float rms
Definition mrtk_clas.h:208
unsigned char slip
Definition mrtk_clas.h:204
gtime_t time
Definition mrtk_clas.h:202
unsigned char sat
Definition mrtk_clas.h:203
int flag
Definition mrtk_clas.h:209
float pos[3]
Definition mrtk_clas.h:232
zwdd_t * data
Definition mrtk_clas.h:234
int n
Definition mrtk_clas.h:233
int nmax
Definition mrtk_clas.h:233
float quality
Definition mrtk_clas.h:228
gtime_t time
Definition mrtk_clas.h:223
unsigned char valid
Definition mrtk_clas.h:224
float ztd
Definition mrtk_clas.h:226
float rms
Definition mrtk_clas.h:227
float zwd
Definition mrtk_clas.h:225