MRTKLIB 0.7.14
Modernized GNSS Positioning Library
Loading...
Searching...
No Matches
mrtk_clas.h File Reference

CLAS (QZSS L6D) CSSR decoder and grid correction type definitions. More...

#include <stdio.h>
#include "mrtklib/mrtk_bits.h"
#include "mrtklib/mrtk_foundation.h"
#include "mrtklib/mrtk_l6.h"
#include "mrtklib/mrtk_nav.h"
#include "mrtklib/mrtk_rtkpos.h"
#include "mrtklib/mrtk_time.h"
Include dependency graph for mrtk_clas.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  stecd_t
struct  stec_t
struct  zwdd_t
struct  zwd_t
struct  clas_oload_t
struct  clas_gp_t
struct  cssropt_t
struct  ssrn_t
struct  cssr_t
struct  clas_corr_t
struct  clas_orbit_bank_t
struct  clas_clock_bank_t
struct  clas_bias_bank_t
struct  clas_trop_bank_t
struct  clas_latest_trop_t
struct  clas_bank_ctrl_t
struct  clas_grid_t
struct  clas_osrd_t
struct  clas_dec_ssr_t
struct  clas_l6buf_t
struct  clas_ctx_t
struct  clas_satcorr_t
struct  clas_osr_ctx_t

Macros

#define CLAS_VER   "0.1" /* CLAS module version */
#define CSSR_MAX_GNSS   16 /* max GNSS systems in CSSR */
#define CSSR_MAX_SV_GNSS   40 /* max satellites per GNSS system */
#define CSSR_MAX_SV   64 /* max satellites in CSSR message */
#define CSSR_MAX_SIG   16 /* max signals per satellite */
#define CSSR_MAX_CELLMASK   64 /* max cellmask entries */
#define CSSR_MAX_NET   32 /* max networks in CSSR message */
#define CSSR_MAX_LOCAL_SV   32 /* max local satellites per network */
#define CSSR_MAX_GP   128 /* max grid points in CSSR message */
#define CSSR_SYS_GPS   0
#define CSSR_SYS_GLO   1
#define CSSR_SYS_GAL   2
#define CSSR_SYS_BDS   3
#define CSSR_SYS_QZS   4
#define CSSR_SYS_SBS   5
#define CSSR_SYS_NONE   -1
#define CSSR_TYPE_NUM   14 /* total subtype count */
#define CSSR_TYPE_MASK   1 /* ST1: Satellite/signal mask */
#define CSSR_TYPE_OC   2 /* ST2: Orbit correction */
#define CSSR_TYPE_CC   3 /* ST3: Clock correction */
#define CSSR_TYPE_CB   4 /* ST4: Code bias */
#define CSSR_TYPE_PB   5 /* ST5: Phase bias */
#define CSSR_TYPE_BIAS   6 /* ST6: Combined bias */
#define CSSR_TYPE_URA   7 /* ST7: URA */
#define CSSR_TYPE_STEC   8 /* ST8: STEC correction (CLAS-only) */
#define CSSR_TYPE_GRID   9 /* ST9: Grid definition (CLAS-only) */
#define CSSR_TYPE_SI   10 /* ST10: Service information (CLAS-only) */
#define CSSR_TYPE_COMBO   11 /* ST11: Combined correction (CLAS-only) */
#define CSSR_TYPE_ATMOS   12 /* ST12: Atmospheric corr. (CLAS-only) */
#define CSSR_TYPE_INIT   254 /* initialization marker */
#define CSSR_TYPE_NULL   255 /* null/invalid marker */
#define P2_S16_MAX   32767
#define P2_S15_MAX   16383
#define P2_S14_MAX   8191
#define P2_S13_MAX   4095
#define P2_S12_MAX   2047
#define P2_S11_MAX   1023
#define P2_S10_MAX   511
#define P2_S9_MAX   255
#define P2_S8_MAX   127
#define P2_S7_MAX   63
#define P2_S6_MAX   31
#define CSSR_TROP_HS_REF   2.3 /* hydrostatic reference (m) */
#define CSSR_TROP_WET_REF   0.252 /* wet delay reference (m) */
#define CSSR_UPDATE_TROP   0
#define CSSR_UPDATE_STEC   1
#define CSSR_UPDATE_PBIAS   2
#define CSSR_TROPVALIDAGE   3600 /* max troposphere correction age */
#define CSSR_STECVALIDAGE   3600 /* max STEC correction age */
#define CSSR_INVALID_VALUE   -10000 /* invalid correction marker */
#define L6FRMPREAMB   L6_PREAMBLE /* L6 frame preamble (4 bytes) */
#define BLEN_MSG   L6_FRAME_LEN /* L6 subframe length (bytes) */
#define CLAS_CH_NUM   2 /* L6 channels */
#define CLAS_MAX_NETWORK   13 /* max networks (upstream uses 32, 13 covers networks 1-12) */
#define CLAS_BANK_NUM   32 /* bank depth (ring buffer entries) */
#define CLAS_MAX_GP   80 /* max grid points in bank storage */
#define CLAS_MAX_NGRID   4 /* grid points for interpolation */
#define CLAS_MAXPBCORSSR   20.0 /* max phase bias correction (m) */
#define CLAS_L6_RELOCK_TIMEOUT   10.0
#define CLAS_CSSRINVALID   (-10000)
#define CLAS_MAXAGESSR_BIAS   120.0
#define CLAS_MAXPBCORSSR   20.0

Typedefs

typedef clas_osrd_t osrd_t

Enumerations

enum  {
  CSSR_REF_MASK = 0 , CSSR_REF_ORBIT , CSSR_REF_CLOCK , CSSR_REF_CBIAS ,
  CSSR_REF_PBIAS , CSSR_REF_BIAS , CSSR_REF_URA , CSSR_REF_STEC ,
  CSSR_REF_GRID , CSSR_REF_COMBINED , CSSR_REF_ATMOSPHERIC , CSSR_REF_MAX
}

Functions

int clas_ctx_init (clas_ctx_t *ctx)
 Initialize CLAS context (allocate bank control on heap).
void clas_ctx_free (clas_ctx_t *ctx)
 Free CLAS context (release heap-allocated bank control).
int clas_input_cssr (clas_ctx_t *ctx, uint8_t data, int ch)
 Input CSSR byte stream (one byte at a time, real-time).
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.
int clas_decode_msg (clas_ctx_t *ctx, int ch)
 Decode the next pending CSSR message from the assembled bit buffer.
int clas_input_cssrf (clas_ctx_t *ctx, FILE *fp, int ch)
 Input CSSR from file (one message at a time, post-processing).
void clas_bank_init (clas_ctx_t *ctx, int ch)
 Initialize bank control for a channel.
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_backup_valid (const clas_ctx_t *ctx, gtime_t obstime, int l6mrg)
 Save/restore the latest usable CSSR snapshot for short correction gaps.
void clas_backup_current (clas_ctx_t *ctx, const clas_grid_t *grid, int l6mrg)
void clas_restore_backup (clas_ctx_t *ctx, gtime_t time, clas_grid_t *grid, int l6mrg)
void clas_clear_current (clas_ctx_t *ctx, int ch)
 Drop the current correction snapshot of one channel.
void clas_update_global (nav_t *nav, const clas_corr_t *corr, int ch)
 Apply global corrections (orbit/clock/bias) to nav_t.ssr[].
void clas_update_local (nav_t *nav, const clas_corr_t *corr, int ch)
 Apply local corrections (trop/STEC) to nav_t.
int clas_read_grid_def (clas_ctx_t *ctx, const char *file)
 Read CLAS grid definition file.
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.
void clas_check_grid_status_time (clas_ctx_t *ctx, gtime_t time, int ch)
int clas_get_correct_fac (int msgid)
 Get L6 facility ID from message ID byte.
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).
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 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.
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.
void clas_init_oload (clas_ctx_t *ctx)
 Initialize ocean loading data in context.
int readblqgrid (const char *file, clas_ctx_t *ctx)
 Read BLQ ocean tide loading parameters for CLAS grid points.
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).
int clas_osr_selfreqpair (int sat, const prcopt_t *opt, const obsd_t *obs)
 Select frequency pair for multi-frequency processing.
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.
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.
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.
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.
void clas_osr_ctx_init (clas_osr_ctx_t *ctx)
 Initialize OSR conversion context.
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.
int cssr_gnss2sys (int gnss, int *prn0)
 Convert CSSR GNSS ID to RTKLIB system bitmask.
int cssr_sys2gnss (int sys, int *prn0)
 Convert RTKLIB system bitmask to CSSR GNSS ID.
int readisb (const char *file, nav_t *nav)
 Read ISB correction table from file.
int readL2C (const char *file, nav_t *nav)
 Read L2C 1/4 cycle phase shift table from file.
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 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 isL2C (int code)
 Check if observation code is L2C.

Detailed Description

CLAS (QZSS L6D) CSSR decoder and grid correction type definitions.

References: [1] claslib (https://github.com/mf-arai/claslib) โ€” upstream implementation [2] IS-QZSS-L6-001 โ€” CLAS Interface Specification [3] IS-QZSS-L6-003 โ€” CLAS Compact SSR Specification

Notes:

  • Bank struct dimensions are reduced from upstream claslib defaults for memory efficiency. See "CLAS Storage Dimension" section below.
  • Global singletons in upstream (_cssr, cssrObject[], CurrentCSSR[], BackupCSSR[]) are replaced with clas_ctx_t context struct passed via function parameters for thread safety and multi-channel support.

Definition in file mrtk_clas.h.

Macro Definition Documentation

◆ BLEN_MSG

#define BLEN_MSG   L6_FRAME_LEN /* L6 subframe length (bytes) */

Definition at line 151 of file mrtk_clas.h.

Referenced by clas_input_cssr().

◆ CLAS_BANK_NUM

◆ CLAS_CH_NUM

◆ CLAS_CSSRINVALID

#define CLAS_CSSRINVALID   (-10000)

Invalid CSSR bias value sentinel

Definition at line 956 of file mrtk_clas.h.

Referenced by clas_osr_compensatedisp(), clas_osr_corrmeas(), and clas_osr_zdres().

◆ CLAS_L6_RELOCK_TIMEOUT

#define CLAS_L6_RELOCK_TIMEOUT   10.0

Seconds an L6 channel's active source PRN may be silent before the demux re-locks the channel to a newly arriving PRN/pattern (QZS handover).

Definition at line 808 of file mrtk_clas.h.

Referenced by clas_route_l6frame().

◆ CLAS_MAX_GP

#define CLAS_MAX_GP   80 /* max grid points in bank storage */

◆ CLAS_MAX_NETWORK

◆ CLAS_MAX_NGRID

#define CLAS_MAX_NGRID   4 /* grid points for interpolation */

Definition at line 194 of file mrtk_clas.h.

◆ CLAS_MAXAGESSR_BIAS

#define CLAS_MAXAGESSR_BIAS   120.0

Maximum age for SSR bias corrections (seconds)

Definition at line 959 of file mrtk_clas.h.

Referenced by clas_osr_corrmeas().

◆ CLAS_MAXPBCORSSR [1/2]

#define CLAS_MAXPBCORSSR   20.0

Maximum phase bias correction for SSR (meters)

Definition at line 195 of file mrtk_clas.h.

◆ CLAS_MAXPBCORSSR [2/2]

#define CLAS_MAXPBCORSSR   20.0 /* max phase bias correction (m) */

Maximum phase bias correction for SSR (meters)

Definition at line 195 of file mrtk_clas.h.

◆ CLAS_VER

#define CLAS_VER   "0.1" /* CLAS module version */

Definition at line 52 of file mrtk_clas.h.

◆ CSSR_INVALID_VALUE

◆ CSSR_MAX_CELLMASK

#define CSSR_MAX_CELLMASK   64 /* max cellmask entries */

Definition at line 65 of file mrtk_clas.h.

◆ CSSR_MAX_GNSS

#define CSSR_MAX_GNSS   16 /* max GNSS systems in CSSR */

Definition at line 61 of file mrtk_clas.h.

Referenced by decode_cssr_mask(), and svmask2sat().

◆ CSSR_MAX_GP

#define CSSR_MAX_GP   128 /* max grid points in CSSR message */

Definition at line 68 of file mrtk_clas.h.

Referenced by decode_cssr_atmos(), and decode_cssr_grid().

◆ CSSR_MAX_LOCAL_SV

#define CSSR_MAX_LOCAL_SV   32 /* max local satellites per network */

Definition at line 67 of file mrtk_clas.h.

◆ CSSR_MAX_NET

#define CSSR_MAX_NET   32 /* max networks in CSSR message */

Definition at line 66 of file mrtk_clas.h.

Referenced by decode_cssr_atmos(), decode_cssr_grid(), and decode_cssr_stec().

◆ CSSR_MAX_SIG

#define CSSR_MAX_SIG   16 /* max signals per satellite */

◆ CSSR_MAX_SV

◆ CSSR_MAX_SV_GNSS

#define CSSR_MAX_SV_GNSS   40 /* max satellites per GNSS system */

Definition at line 62 of file mrtk_clas.h.

Referenced by svmask2nsat(), svmask2nsatlist(), and svmask2sat().

◆ CSSR_STECVALIDAGE

#define CSSR_STECVALIDAGE   3600 /* max STEC correction age */

Definition at line 138 of file mrtk_clas.h.

Referenced by get_cssr_latest_iono().

◆ CSSR_SYS_BDS

#define CSSR_SYS_BDS   3

Definition at line 77 of file mrtk_clas.h.

Referenced by cssr_gnss2sys(), and cssr_sys2gnss().

◆ CSSR_SYS_GAL

#define CSSR_SYS_GAL   2

Definition at line 76 of file mrtk_clas.h.

Referenced by cssr_gnss2sys(), and cssr_sys2gnss().

◆ CSSR_SYS_GLO

#define CSSR_SYS_GLO   1

Definition at line 75 of file mrtk_clas.h.

Referenced by cssr_gnss2sys(), and cssr_sys2gnss().

◆ CSSR_SYS_GPS

#define CSSR_SYS_GPS   0

Definition at line 74 of file mrtk_clas.h.

Referenced by cssr_gnss2sys(), and cssr_sys2gnss().

◆ CSSR_SYS_NONE

#define CSSR_SYS_NONE   -1

Definition at line 80 of file mrtk_clas.h.

Referenced by cssr_sys2gnss().

◆ CSSR_SYS_QZS

#define CSSR_SYS_QZS   4

Definition at line 78 of file mrtk_clas.h.

Referenced by cssr_gnss2sys(), and cssr_sys2gnss().

◆ CSSR_SYS_SBS

#define CSSR_SYS_SBS   5

Definition at line 79 of file mrtk_clas.h.

Referenced by cssr_gnss2sys(), and cssr_sys2gnss().

◆ CSSR_TROP_HS_REF

#define CSSR_TROP_HS_REF   2.3 /* hydrostatic reference (m) */

Definition at line 122 of file mrtk_clas.h.

Referenced by decode_cssr_atmos(), and decode_cssr_grid().

◆ CSSR_TROP_WET_REF

#define CSSR_TROP_WET_REF   0.252 /* wet delay reference (m) */

Definition at line 123 of file mrtk_clas.h.

◆ CSSR_TROPVALIDAGE

#define CSSR_TROPVALIDAGE   3600 /* max troposphere correction age */

Definition at line 137 of file mrtk_clas.h.

Referenced by get_cssr_latest_trop().

◆ CSSR_TYPE_ATMOS

#define CSSR_TYPE_ATMOS   12 /* ST12: Atmospheric corr. (CLAS-only) */

Definition at line 98 of file mrtk_clas.h.

Referenced by decode_qzs_msg().

◆ CSSR_TYPE_BIAS

#define CSSR_TYPE_BIAS   6 /* ST6: Combined bias */

Definition at line 92 of file mrtk_clas.h.

Referenced by decode_qzs_msg().

◆ CSSR_TYPE_CB

#define CSSR_TYPE_CB   4 /* ST4: Code bias */

Definition at line 90 of file mrtk_clas.h.

Referenced by decode_qzs_msg().

◆ CSSR_TYPE_CC

#define CSSR_TYPE_CC   3 /* ST3: Clock correction */

Definition at line 89 of file mrtk_clas.h.

Referenced by decode_qzs_msg().

◆ CSSR_TYPE_COMBO

#define CSSR_TYPE_COMBO   11 /* ST11: Combined correction (CLAS-only) */

Definition at line 97 of file mrtk_clas.h.

Referenced by decode_qzs_msg().

◆ CSSR_TYPE_GRID

#define CSSR_TYPE_GRID   9 /* ST9: Grid definition (CLAS-only) */

Definition at line 95 of file mrtk_clas.h.

Referenced by decode_qzs_msg().

◆ CSSR_TYPE_INIT

#define CSSR_TYPE_INIT   254 /* initialization marker */

Definition at line 99 of file mrtk_clas.h.

◆ CSSR_TYPE_MASK

#define CSSR_TYPE_MASK   1 /* ST1: Satellite/signal mask */

Definition at line 87 of file mrtk_clas.h.

Referenced by decode_cssr_head(), decode_qzs_msg(), and update_clas().

◆ CSSR_TYPE_NULL

#define CSSR_TYPE_NULL   255 /* null/invalid marker */

Definition at line 100 of file mrtk_clas.h.

◆ CSSR_TYPE_NUM

#define CSSR_TYPE_NUM   14 /* total subtype count */

Definition at line 86 of file mrtk_clas.h.

◆ CSSR_TYPE_OC

#define CSSR_TYPE_OC   2 /* ST2: Orbit correction */

Definition at line 88 of file mrtk_clas.h.

Referenced by decode_qzs_msg().

◆ CSSR_TYPE_PB

#define CSSR_TYPE_PB   5 /* ST5: Phase bias */

Definition at line 91 of file mrtk_clas.h.

Referenced by decode_qzs_msg().

◆ CSSR_TYPE_SI

#define CSSR_TYPE_SI   10 /* ST10: Service information (CLAS-only) */

Definition at line 96 of file mrtk_clas.h.

Referenced by decode_qzs_msg().

◆ CSSR_TYPE_STEC

#define CSSR_TYPE_STEC   8 /* ST8: STEC correction (CLAS-only) */

Definition at line 94 of file mrtk_clas.h.

Referenced by decode_qzs_msg().

◆ CSSR_TYPE_URA

#define CSSR_TYPE_URA   7 /* ST7: URA */

Definition at line 93 of file mrtk_clas.h.

Referenced by decode_qzs_msg().

◆ CSSR_UPDATE_PBIAS

#define CSSR_UPDATE_PBIAS   2

Definition at line 131 of file mrtk_clas.h.

◆ CSSR_UPDATE_STEC

#define CSSR_UPDATE_STEC   1

Definition at line 130 of file mrtk_clas.h.

◆ CSSR_UPDATE_TROP

#define CSSR_UPDATE_TROP   0

Definition at line 129 of file mrtk_clas.h.

◆ L6FRMPREAMB

#define L6FRMPREAMB   L6_PREAMBLE /* L6 frame preamble (4 bytes) */

Definition at line 150 of file mrtk_clas.h.

Referenced by clas_input_cssr().

◆ P2_S10_MAX

#define P2_S10_MAX   511

Definition at line 112 of file mrtk_clas.h.

◆ P2_S11_MAX

#define P2_S11_MAX   1023

Definition at line 111 of file mrtk_clas.h.

◆ P2_S12_MAX

#define P2_S12_MAX   2047

Definition at line 110 of file mrtk_clas.h.

◆ P2_S13_MAX

#define P2_S13_MAX   4095

Definition at line 109 of file mrtk_clas.h.

◆ P2_S14_MAX

#define P2_S14_MAX   8191

Definition at line 108 of file mrtk_clas.h.

◆ P2_S15_MAX

#define P2_S15_MAX   16383

Definition at line 107 of file mrtk_clas.h.

◆ P2_S16_MAX

#define P2_S16_MAX   32767

Definition at line 106 of file mrtk_clas.h.

◆ P2_S6_MAX

#define P2_S6_MAX   31

Definition at line 116 of file mrtk_clas.h.

◆ P2_S7_MAX

#define P2_S7_MAX   63

Definition at line 115 of file mrtk_clas.h.

◆ P2_S8_MAX

#define P2_S8_MAX   127

Definition at line 114 of file mrtk_clas.h.

Referenced by decode_cssr_grid().

◆ P2_S9_MAX

#define P2_S9_MAX   255

Definition at line 113 of file mrtk_clas.h.

Referenced by decode_cssr_grid().

Typedef Documentation

◆ osrd_t

Definition at line 513 of file mrtk_clas.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
CSSR_REF_MASK 
CSSR_REF_ORBIT 
CSSR_REF_CLOCK 
CSSR_REF_CBIAS 
CSSR_REF_PBIAS 
CSSR_REF_BIAS 
CSSR_REF_URA 
CSSR_REF_STEC 
CSSR_REF_GRID 
CSSR_REF_COMBINED 
CSSR_REF_ATMOSPHERIC 
CSSR_REF_MAX 

Definition at line 157 of file mrtk_clas.h.

Function Documentation

◆ chk_isb()

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.

Parameters
[in]sysnoSatellite system code (SYS_GPS, etc.)
[in]optProcessing options
[in]staStation data with ISB values
[out]yISB corrections [NFREQ][2] (0:phase, 1:code) (m)

Definition at line 451 of file mrtk_clas_isb.c.

References prcopt_t::isb, sta_t::isb, ISBOPT_TABLE, and sys2isbidx().

Referenced by clas_osr_zdres().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clas_backup_current()

void clas_backup_current ( clas_ctx_t * ctx,
const clas_grid_t * grid,
int l6mrg )

Definition at line 1250 of file mrtk_clas.c.

References clas_ctx_t::backup, clas_ctx_t::backup_grid, CLAS_CH_NUM, clas_ctx_t::current, init_grid_index(), and SSR_CH_NUM.

Referenced by ppp_rtk_pos().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clas_backup_valid()

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.

Mirrors claslib's BackupCSSR/BackupGrid path. The backup is considered valid while its latest global correction time is within 180 s of the observation.

Definition at line 1233 of file mrtk_clas.c.

References clas_ctx_t::backup, backup_cssr_time(), CLAS_CH_NUM, SSR_CH_NUM, timediff(), and clas_corr_t::use.

Referenced by ppp_rtk_pos().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clas_bank_get_close()

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.

Parameters
[in]ctxCLAS context
[in]timeTarget time for matching
[in]networkNetwork id
[in]chChannel index
[out]corrOutput merged correction snapshot
Returns
0 on success, -1 if no valid corrections found

Definition at line 1121 of file mrtk_clas.c.

References add_data_stec(), add_data_trop(), clas_ctx_t::bank, clas_corr_t::bias_time, clas_clock_bank_t::c0, clas_corr_t::c0, clas_bias_bank_t::cbias, clas_corr_t::cbias, clas_corr_t::clock_time, corr_bias_slot(), CSSR_INVALID_VALUE, clas_corr_t::deph0, clas_orbit_bank_t::deph0, clas_corr_t::deph1, clas_orbit_bank_t::deph1, clas_corr_t::deph2, clas_orbit_bank_t::deph2, clas_bank_ctrl_t::Facility, clas_corr_t::facility, clas_corr_t::flag, clas_corr_t::gridnum, clas_trop_bank_t::gridnum, clas_trop_bank_t::gridpos, init_grid_index(), clas_bias_bank_t::iod, clas_clock_bank_t::iod, clas_corr_t::iod, clas_orbit_bank_t::iod, clas_corr_t::iode, clas_orbit_bank_t::iode, clas_trop_bank_t::iono, MAXCODE, MAXSAT, clas_corr_t::network, clas_corr_t::orbit_time, clas_bias_bank_t::pbias, clas_corr_t::pbias, clas_bias_bank_t::prn, clas_clock_bank_t::prn, clas_corr_t::prn, clas_orbit_bank_t::prn, clas_trop_bank_t::prn, clas_trop_bank_t::satnum, set_grid_data(), clas_bias_bank_t::sflag, clas_bias_bank_t::smode, clas_corr_t::smode, clas_corr_t::stec, sub_get_close_cssr(), clas_bias_bank_t::time, clas_clock_bank_t::time, clas_corr_t::time, clas_orbit_bank_t::time, clas_trop_bank_t::time, clas_trop_bank_t::total, clas_corr_t::trop_time, clas_bias_bank_t::udi, clas_clock_bank_t::udi, clas_corr_t::udi, clas_orbit_bank_t::udi, clas_corr_t::update_time, clas_bank_ctrl_t::use, clas_corr_t::use, clas_trop_bank_t::wet, and clas_corr_t::zwd.

Referenced by clas_ssr2osr(), decoderaw(), ppp_rtk_pos(), and update_clas().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clas_bank_init()

void clas_bank_init ( clas_ctx_t * ctx,
int ch )

Initialize bank control for a channel.

Parameters
[in,out]ctxCLAS context
[in]chChannel index

Definition at line 101 of file mrtk_clas.c.

References clas_ctx_t::bank, clas_bank_ctrl_t::BiasBank, CLAS_CH_NUM, CLAS_MAX_NETWORK, clas_bank_ctrl_t::ClockBank, clas_bank_ctrl_t::Facility, clas_bank_ctrl_t::fastfix, clas_bank_ctrl_t::LatestTrop, clas_bank_ctrl_t::NextBias, clas_bank_ctrl_t::NextClock, clas_bank_ctrl_t::NextOrbit, clas_bank_ctrl_t::NextTrop, clas_bank_ctrl_t::OrbitBank, clas_bank_ctrl_t::separation, clas_bank_ctrl_t::TropBank, and clas_bank_ctrl_t::use.

Referenced by clas_ctx_init().

Here is the caller graph for this function:

◆ clas_check_grid_status()

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.

Validates that orbit, trop, and STEC corrections exist for each grid point and sets grid_stat[ch][network][gp] accordingly. Must be called after clas_bank_get_close() to enable grid-based positioning.

Parameters
[in,out]ctxCLAS context (updates grid_stat)
[in]timeCurrent observation time
[in]chL6 channel index (0..CLAS_CH_NUM-1)

Definition at line 1320 of file mrtk_clas.c.

References clas_ctx_t::bank, CLAS_CH_NUM, CLAS_MAX_GP, CLAS_MAX_NETWORK, clas_bank_ctrl_t::fastfix, clas_ctx_t::grid_stat, clas_corr_t::gridnum, stec_t::n, clas_corr_t::network, clas_corr_t::orbit_time, clas_corr_t::stec, gtime_t::time, timediff(), trace(), clas_corr_t::trop_time, clas_corr_t::update_time, clas_corr_t::use, zwdd_t::valid, and clas_corr_t::zwddata.

Referenced by clas_ssr2osr(), decoderaw(), ppp_rtk_pos(), and update_clas().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clas_check_grid_status_time()

void clas_check_grid_status_time ( clas_ctx_t * ctx,
gtime_t time,
int ch )

Definition at line 1365 of file mrtk_clas.c.

References clas_ctx_t::bank, CLAS_CH_NUM, CLAS_MAX_GP, CLAS_MAX_NETWORK, CSSR_INVALID_VALUE, clas_bank_ctrl_t::fastfix, get_close_orbit(), get_close_trop(), clas_ctx_t::grid_stat, clas_trop_bank_t::gridnum, clas_trop_bank_t::iono, clas_orbit_bank_t::network, clas_trop_bank_t::satnum, clas_orbit_bank_t::time, clas_trop_bank_t::time, timediff(), clas_trop_bank_t::total, trace(), clas_bank_ctrl_t::use, and clas_trop_bank_t::wet.

Referenced by update_clas().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clas_clear_current()

void clas_clear_current ( clas_ctx_t * ctx,
int ch )

Drop the current correction snapshot of one channel.

Used when a channel supplies no corrections for the epoch, so that clas_update_global() clears nav_t.ssr_ch[ch] instead of re-applying the previous epoch's snapshot.

Parameters
[in,out]ctxCLAS context
[in]chChannel index

Definition at line 1266 of file mrtk_clas.c.

References CLAS_CH_NUM, clas_ctx_t::current, and init_grid_index().

Referenced by ppp_rtk_pos().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clas_ctx_free()

void clas_ctx_free ( clas_ctx_t * ctx)

Free CLAS context (release heap-allocated bank control).

Parameters
[in,out]ctxCLAS context to free

Definition at line 88 of file mrtk_clas.c.

References clas_ctx_t::bank, CLAS_CH_NUM, free, and clas_ctx_t::initialized.

Referenced by clas_ctx_init(), freepreceph(), and rtksvrfree().

Here is the caller graph for this function:

◆ clas_ctx_init()

int clas_ctx_init ( clas_ctx_t * ctx)

Initialize CLAS context (allocate bank control on heap).

Parameters
[out]ctxCLAS context to initialize
Returns
0 on success, -1 on allocation failure

Definition at line 54 of file mrtk_clas.c.

References clas_ctx_t::bank, calloc, clas_bank_init(), CLAS_CH_NUM, clas_ctx_free(), CSSR_REF_MAX, clas_ctx_t::initialized, clas_ctx_t::l6delivery, clas_ctx_t::l6facility, clas_ctx_t::l6lock_time, clas_ctx_t::l6pattern, gtime_t::sec, gtime_t::time, and clas_ctx_t::tow_ref.

Referenced by readpreceph(), and rtksvrstart().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clas_decode_msg()

int clas_decode_msg ( clas_ctx_t * ctx,
int ch )

Decode the next pending CSSR message from the assembled bit buffer.

Call this after clas_input_cssr() to trigger CSSR message decoding. clas_input_cssr() only assembles L6 frames; this function performs the actual CSSR decode step and returns a completion code.

Parameters
[in,out]ctxCLAS context
[in]chChannel index (0 = primary)
Returns
10 when a complete CSSR correction set is ready, 0 otherwise

Definition at line 3213 of file mrtk_clas.c.

References decode_qzs_msg().

Referenced by decoderaw().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clas_get_correct_fac()

int clas_get_correct_fac ( int msgid)

Get L6 facility ID from message ID byte.

Parameters
[in]msgidL6 message ID byte
Returns
Facility ID (0-3)

Definition at line 3037 of file mrtk_clas.c.

Referenced by clas_input_cssr().

Here is the caller graph for this function:

◆ clas_get_grid_index()

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.

Parameters
[in,out]ctxCLAS context (grid_pos, grid_stat)
[in]posReceiver position {lat,lon,hgt} (rad,m)
[out]gridInterpolation result (weights, indices, matrix)
[in]gridselGrid selection threshold (m), 0=always multi-grid
[in]obstimeObservation time (reserved)
Returns
Number of selected grids (0=error, 1/3/4=ok)

Definition at line 459 of file mrtk_clas_grid.c.

References calc_grid_weight(), CLAS_CH_NUM, clas_grid_t::Emat, find_grid_surround_pos(), free, clas_grid_t::Gmat, clas_grid_t::index, grid_info::index, is_exists_inside(), mat(), matcpy(), matinv(), MAX_GRID_CACHE, clas_grid_t::network, grid_info::network, clas_grid_t::num, output_selected_grid(), pickup_candidates_of_grid(), grid_info::pos, R2D, trace(), tracemat(), and clas_grid_t::weight.

Referenced by clas_ssr2osr(), and ppp_rtk_pos().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clas_init_oload()

void clas_init_oload ( clas_ctx_t * ctx)

Initialize ocean loading data in context.

Parameters
[in,out]ctxCLAS context

Definition at line 824 of file mrtk_clas_grid.c.

References CLAS_MAX_NETWORK, clas_oload_t::gridnum, and clas_ctx_t::oload.

◆ clas_input_cssr()

int clas_input_cssr ( clas_ctx_t * ctx,
uint8_t data,
int ch )

Input CSSR byte stream (one byte at a time, real-time).

Parameters
[in,out]ctxCLAS context
[in]dataInput byte
[in]chChannel index (0 or 1)
Returns
Status (-1:error, 0:no message, 10:SSR message decoded)

Definition at line 3127 of file mrtk_clas.c.

References l6_header_t::alert, BLEN_MSG, clas_l6buf_t::buff, clas_get_correct_fac(), clas_l6buf_t::decode_start, clas_l6buf_t::fbuff, clas_l6buf_t::frame, clas_l6buf_t::ftag, clas_l6buf_t::ftag_last, clas_l6buf_t::havebit, l6_parse_header(), l6_service_name(), L6_SVC_CLAS, L6_SVC_NULL, clas_ctx_t::l6buf, clas_ctx_t::l6delivery, clas_ctx_t::l6facility, L6FRMPREAMB, clas_l6buf_t::len, l6_header_t::msgid, clas_l6buf_t::nbit, clas_l6buf_t::nbyte, clas_l6buf_t::nframe, clas_l6buf_t::preamble, l6_header_t::prn, setbitu(), l6_header_t::sf_ind, l6_header_t::svc, and trace().

Referenced by clas_input_cssrf(), and decoderaw().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clas_input_cssrf()

int clas_input_cssrf ( clas_ctx_t * ctx,
FILE * fp,
int ch )

Input CSSR from file (one message at a time, post-processing).

Parameters
[in,out]ctxCLAS context
[in]fpFile pointer
[in]chChannel index
Returns
Status (-2:EOF, -1:error, 0:no message, 10:SSR message decoded)

Definition at line 3217 of file mrtk_clas.c.

References clas_input_cssr(), and decode_qzs_msg().

Referenced by update_clas().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clas_osr_compensatedisp()

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.

Parameters
[in]corrMerged correction snapshot
[in]indexGrid point indices
[in]obsObservation for this satellite
[in]satSatellite number
[in]ionoIonosphere delay (m)
[in]pbPhase biases per frequency
[out]compLCompensation output per frequency
[in,out]pbresetPhase bias reset flags
[in]optProcessing options
[in]ssatSatellite status
[in]chSSR channel
[in,out]osr_ctxOSR context for persistent state
[in]navNavigation data (for wavelengths)

Ported from upstream claslib compensatedisp(). All static variables replaced by clas_osr_ctx_t members (comp_*).

Parameters
[in]corrMerged correction snapshot
[in]indexGrid point indices
[in]obsObservation for this satellite
[in]satSatellite number
[in]ionoIonosphere delay (m)
[in]pbPhase biases per frequency
[out]compLCompensation output per frequency
[in,out]pbresetPhase bias reset flags
[in]optProcessing options
[in]ssatSatellite status
[in]chSSR channel (0 in MRTKLIB)
[in,out]osr_ctxOSR context for persistent state
[in]navNavigation data (for wavelengths)

Definition at line 430 of file mrtk_clas_osr.c.

References CLAS_CSSRINVALID, stec_t::data, FREQ1, FREQ2, obsd_t::L, MAXSAT, stec_t::n, prcopt_t::nf, obsfreqs, osr_ctx, prcopt_t::posopt, stecd_t::sat, sat_wavelengths(), ssat_t::slip, clas_corr_t::smode, SQR, clas_corr_t::stec, obsd_t::time, stecd_t::time, and timediff().

Referenced by clas_osr_corrmeas().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clas_osr_corrmeas()

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.

Parameters
[in]obsObservation for this satellite
[in,out]navNavigation data
[in]posReceiver position {lat,lon,hgt} (rad,m)
[in]azelAzimuth/elevation for this satellite
[in]optProcessing options
[in]gridGrid interpolation state
[in]corrMerged correction snapshot
[in]ssatSatellite status
[out]brkSlip break flag
[out]osrOSR output for this satellite
[in,out]pbresetPhase bias reset flags
[in]chSSR channel
[in,out]osr_ctxOSR context
Returns
1=ok, 0=error (stale bias, missing iono)

Ported from upstream claslib corrmeas(). Decodes phase and code biases from SSR corrections, applies STEC grid interpolation for ionosphere, performs consistency checks, and computes receiver antenna correction.

Parameters
[in]obsObservation for this satellite
[in,out]navNavigation data
[in]posReceiver position {lat,lon,hgt} (rad,m)
[in]azelAzimuth/elevation for this satellite
[in]optProcessing options
[in]gridGrid interpolation state
[in]corrMerged correction snapshot
[in]ssatSatellite status
[out]brkSlip break flag
[out]osrOSR output for this satellite
[in,out]pbresetPhase bias reset flags
[in]chSSR channel (0 in MRTKLIB)
[in,out]osr_ctxOSR context
Returns
1=ok, 0=error (stale bias, missing iono)

Definition at line 582 of file mrtk_clas_osr.c.

References prcopt_t::antdel, antmodel(), clas_osrd_t::antr, clas_osrd_t::cbias, ssr_t::cbias, CLAS_CSSRINVALID, CLAS_MAXAGESSR_BIAS, clas_osr_compensatedisp(), clas_stec_grid_data(), claslib_pcv_slot(), obsd_t::code, code_on_same_freq(), clas_osrd_t::compL, count_nsig(), stec_t::data, clas_grid_t::Emat, clas_grid_t::Gmat, clas_grid_t::index, clas_osrd_t::iono, MAXCODE, stec_t::n, prcopt_t::nf, NFREQPCV, clas_grid_t::num, osr_ctx, clas_osrd_t::pbias, ssr_t::pbias, prcopt_t::pcvr, ssat_t::phw, prcopt_t::posopt, obsd_t::sat, stecd_t::sat, sat_wavelengths(), satsys(), clas_corr_t::smode, nav_s::ssr_ch, clas_corr_t::stec, ssr_t::t0, obsd_t::time, stecd_t::time, time2gpst(), time_str(), timediff(), trace(), clas_grid_t::weight, and clas_osrd_t::wupL.

Referenced by clas_osr_zdres().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clas_osr_ctx_init()

void clas_osr_ctx_init ( clas_osr_ctx_t * ctx)

Initialize OSR conversion context.

Parameters
[out]ctxOSR context to initialize

Initialize OSR conversion context.

Parameters
[out]ctxOSR context to initialize

Definition at line 297 of file mrtk_clas_osr.c.

References CLAS_CH_NUM, clas_satcorr_t::currtow, clas_osr_ctx_t::initialized, MAXSAT, clas_satcorr_t::prev_orb_tow, clas_satcorr_t::previode, clas_satcorr_t::prevtow, and clas_osr_ctx_t::satcorr.

Referenced by clas_ssr2osr().

Here is the caller graph for this function:

◆ clas_osr_prectrop()

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).

Parameters
[in]timeObservation time
[in]posReceiver position {lat,lon,hgt} (rad,m)
[in]azelAzimuth/elevation {az,el} (rad)
[in]zwdZenith wet delay from grid (m)
[in]ztdZenith total delay from grid (m)
Returns
Slant tropospheric delay (m), 0 on error

Computes slant tropospheric delay from zenith wet and total delays obtained from CLAS grid interpolation.

Parameters
[in]timeObservation time
[in]posReceiver position {lat,lon,hgt} (rad,m)
[in]azelAzimuth/elevation {az,el} (rad)
[in]zwdZenith wet delay from grid (m)
[in]ztdZenith total delay from grid (m)
Returns
Slant tropospheric delay (m), 0 on error

Definition at line 328 of file mrtk_clas_osr.c.

References geoidh(), get_stTv(), and tropmapf().

Referenced by clas_osr_zdres().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clas_osr_satcorr_update()

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.

Parameters
[in]obsObservation data for epoch
[in]nNumber of observations
[in]rsSatellite positions+velocities (6*n)
[in]dtsSatellite clock corrections (2*n)
[in]vareSatellite position variances (n)
[in]svhSatellite health flags (n)
[in,out]navNavigation data
[in,out]xState vector (position extracted from [0:2])
[out]yResiduals (n*nf*2)
[out]eLine-of-sight vectors (3*n)
[out]azelAzimuth/elevation (2*n)
[in]rtkRTK control struct
[in]osrlogEnable OSR logging
[in,out]osr_ctxOSR context for persistent state
[in]gridGrid interpolation state
[in]corrMerged correction snapshot
[in,out]ssatSatellite status array
[in]optProcessing options
[in,out]solSolution struct
[out]osrOSR output per satellite
[in]chSSR channel (0 or 1)
Returns
Number of valid measurements

Update per-satellite SIS correction state for IODE adjustment.

Parameters
[in]timeObservation time
[in]tephTime for ephemeris selection
[in]satSatellite number
[in]optProcessing options
[in]navNavigation data
[in]chSSR channel index
[in,out]ctxOSR context (satcorr state updated)
Returns
1:ok, 0:error

Compute zero-differenced phase/code residuals with CLAS corrections.

Tracks orbit/clock corrections and detects 5-second/25-second SSR boundary transitions. Computes currsis = SIS discontinuity for adjust_cpc/adjust_prc.

Ported from upstream satpos_ssr_sis() in ephemeris.c.

Definition at line 793 of file mrtk_clas_osr.c.

References clas_satcorr_t::clk, cross3(), clas_satcorr_t::currsis, clas_satcorr_t::currtow, ssr_t::dclk, ssr_t::ddeph, ssr_t::deph, dot(), ephpos(), ssr_t::hrclk, ssr_t::iod, ssr_t::iode, MAXAGESSR_SIS, MAXCCORSSR_SIS, MAXECORSSR_SIS, norm(), normv3(), clas_satcorr_t::orb, prcopt_t::posopt, clas_satcorr_t::prev_orb_tow, clas_satcorr_t::previode, clas_satcorr_t::prevsis, clas_satcorr_t::prevtow, clas_osr_ctx_t::satcorr, clas_osr_ctx_t::saved_rr, nav_s::ssr_ch, ssr_t::t0, gtime_t::time, time2gpst(), timediff(), clas_satcorr_t::tow, trace(), and ssr_t::udi.

Referenced by ppp_rtk_pos().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clas_osr_selfreqpair()

int clas_osr_selfreqpair ( int sat,
const prcopt_t * opt,
const obsd_t * obs )

Select frequency pair for multi-frequency processing.

Parameters
[in]satSatellite number
[in]optProcessing options
[in]obsObservation data
Returns
Frequency pair bitmask (0=L1 only, 1=L2, 2=L5, 3=L2+L5)

Returns a bitmask indicating which secondary frequencies to use alongside L1. The selection depends on the satellite system and the processing options posopt[10] (GPS) and posopt[12] (QZS).

Note: MRTKLIB's prcopt_t.posopt[] is 6 elements (indices 0-5) while upstream claslib uses indices up to 12. For forward compatibility the indices 10/12 are checked against the array size; if out of range, default to L1+L2.

Parameters
[in]satSatellite number
[in]optProcessing options
[in]obsObservation data for this satellite
Returns
Frequency pair bitmask (0=L1 only, 1=L2, 2=L5, 3=L2+L5)

Definition at line 368 of file mrtk_clas_osr.c.

References obsd_t::L, obsd_t::P, POSL1, POSL1L2, POSL1L2L5, POSL1L5, POSL1L5_L2, prcopt_t::posopt, satsys(), SYS_GAL, SYS_GPS, and SYS_QZS.

Referenced by clas_osr_zdres(), and udion().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clas_osr_zdres()

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.

Ported from upstream claslib zdres(). This is the ENA_PPP_RTK path (always enabled). CSSR2OSR_VRS path is removed.

Key differences from upstream:

  • obs is const; a local copy is allocated.
  • cpc/pt0 come from osr_ctx->cpctmp/pt0tmp.
  • pbias_ofst comes from osr_ctx->pbias_ofst.
  • Uses nav->ssr_ch[0][sat-1] (channel 0 by default).
  • nav->lam[sat-1] -> local lam[] via sat_wavelengths().
  • Stubbed functions: ISB, L2C.
Parameters
[in]obsObservation data for epoch
[in]nNumber of observations
[in]rsSatellite positions+velocities (6*n)
[in]dtsSatellite clock corrections (2*n)
[in]vareSatellite position variances (n)
[in]svhSatellite health flags (n)
[in,out]navNavigation data
[in,out]xState vector (position extracted from [0:2])
[out]yResiduals (n*nf*2), can be NULL
[out]eLine-of-sight vectors (3*n)
[out]azelAzimuth/elevation (2*n)
[in]rtkRTK control struct
[in]osrlogEnable OSR logging
[in,out]osr_ctxOSR context for persistent state
[in]gridGrid interpolation state
[in]corrMerged correction snapshot
[in,out]ssatSatellite status array
[in]optProcessing options
[in,out]solSolution struct
[out]osrOSR output per satellite
[in]chSSR channel (0 in MRTKLIB)
Returns
Number of valid residual measurements

Definition at line 1080 of file mrtk_clas_osr.c.

References clas_osrd_t::antr, sft_t::bias, clas_osrd_t::c, clas_osrd_t::cbias, chk_isb(), CLAS_CSSRINVALID, nav_s::clas_ctx, clas_osr_adjust_cpc(), clas_osr_adjust_prc(), clas_osr_adjust_r_dts(), clas_osr_corrmeas(), clas_osr_prectrop(), clas_osr_selfreqpair(), clas_trop_grid_data(), CLIGHT, clas_osrd_t::clk, obsd_t::code, ssat_t::code, code2freq_num(), clas_osrd_t::compL, clas_osrd_t::CPC, ecef2pos(), prcopt_t::elmin, clas_grid_t::Emat, nav_s::erp, nav_s::filreset, free, FREQ1, FREQ2, geodist(), geterp(), clas_grid_t::Gmat, gpst2utc(), clas_oload_t::gridnum, IB_RTK, clas_grid_t::index, clas_osrd_t::iono, prcopt_t::isb, ISBOPT_TABLE, isL2C(), obsd_t::L, malloc, MAXOBS, MAXSAT, erp_t::n, sft_t::n, clas_grid_t::network, prcopt_t::nf, norm(), clas_grid_t::num, ocean_tide_clasgrid(), prcopt_t::odisp, clas_ctx_t::oload, clas_osrd_t::orb, osr_ctx, obsd_t::P, clas_osrd_t::p, clas_osrd_t::pbias, prcopt_t::phasshft, ssat_t::phw, prcopt_t::posopt, clas_osrd_t::PRC, R2D, sft_t::rectyp, prcopt_t::rectype, clas_osrd_t::relatv, clas_osrd_t::sat, obsd_t::sat, sat_wavelengths(), satazel(), satsys(), nav_s::sfts, shapiro(), clas_osrd_t::sis, clas_corr_t::smode, prcopt_t::snrmask, nav_s::ssr_ch, nav_s::stas, SYS_GAL, ssr_t::t0, testsnr(), prcopt_t::tidecorr, tidedisp(), obsd_t::time, sol_t::time, time2gpst(), time_str(), timeadd(), timediff(), trace(), clas_osrd_t::trop, utc2gpst(), clas_grid_t::weight, windupcorr(), clas_osrd_t::wupL, and xyz2enu().

Referenced by clas_ssr2osr(), and ppp_rtk_pos().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clas_read_grid_def()

int clas_read_grid_def ( clas_ctx_t * ctx,
const char * file )

Read CLAS grid definition file.

Parameters
[in,out]ctxCLAS context (stores grid positions)
[in]fileGrid definition file path
Returns
0 on success, -1 on error

Definition at line 3238 of file mrtk_clas.c.

References CLAS_MAX_GP, CLAS_MAX_NETWORK, clas_ctx_t::grid_pos, clas_ctx_t::gridsel, and trace().

Referenced by execses().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clas_restore_backup()

void clas_restore_backup ( clas_ctx_t * ctx,
gtime_t time,
clas_grid_t * grid,
int l6mrg )

Definition at line 1274 of file mrtk_clas.c.

References clas_ctx_t::backup, backup_cssr_time(), clas_ctx_t::backup_grid, clas_ctx_t::bank, clas_clock_bank_t::c0, clas_corr_t::c0, CLAS_CH_NUM, clas_corr_t::clock_time, clas_ctx_t::current, clas_corr_t::flag, get_close_clock(), init_grid_index(), clas_clock_bank_t::iod, clas_corr_t::iod, MAXSAT, clas_grid_t::network, clas_corr_t::orbit_time, clas_clock_bank_t::prn, clas_corr_t::prn, SSR_CH_NUM, clas_clock_bank_t::time, clas_corr_t::time, timediff(), clas_clock_bank_t::udi, clas_corr_t::udi, clas_bank_ctrl_t::use, and clas_corr_t::use.

Referenced by ppp_rtk_pos().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clas_route_l6frame()

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).

A single UBX/SBF stream from a multi-channel L6 receiver (e.g. u-blox D9C, and future receivers with more channels) carries L6D frames from several QZS PRNs interleaved. Each CLAS channel decodes one PRN's subframe sequence statefully, so frames from different PRNs must NOT be mixed into the same channel. This router keeps each channel locked to a single active source PRN and drops frames from any other PRN, re-locking only after the active source has been silent for CLAS_L6_RELOCK_TIMEOUT seconds.

Channels are keyed by CLAS Transmit Pattern ID (IS-QZSS-L6 ยง4.1.1.2): there are only two patterns, so two channels suffice regardless of how many PRNs the receiver tracks. Single-channel CLAS (l6mrg=0) uses ch 0 only and collapses to whichever pattern is currently active; dual-channel CLAS (l6mrg!=0) maps each pattern to its own channel for merging.

Parameters
[in,out]ctxCLAS context (holds per-channel PRN/pattern/time lock)
[in]prnBroadcasting QZS PRN (L6 frame byte buff[4])
[in]ptnCLAS Transmit Pattern ID, (buff[5] & 0x06) >> 1
[in]l6mrgL6 merge mode (0:single channel, !=0:dual channel)
[in]nowCurrent observation time (GPST) used for the timeout
Returns
Channel index (0..CLAS_CH_NUM-1) to feed, or -1 to drop the frame.

Definition at line 3070 of file mrtk_clas.c.

References CLAS_CH_NUM, CLAS_L6_RELOCK_TIMEOUT, clas_ctx_t::l6delivery, clas_ctx_t::l6lock_time, clas_ctx_t::l6pattern, gtime_t::time, timediff(), and trace().

Referenced by decoderaw().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clas_set_l6tag()

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.

L6 frames are broadcast once per second and the L6 header has no frame counter, so a lost frame can only be seen from the receiver time. Call this before inputting each frame when the receiver reports a per-frame time (SBF QZSRawL6 block TOW, UBX-RXM-QZSSL6 time tag). A subframe with a frame missing is then discarded instead of being decoded from shifted bits (#363). Inputs without a time tag (raw L6 byte streams and files) are not checked.

Parameters
[in,out]ctxCLAS context
[in]chChannel index (0 or 1)
[in]tagReceiver time of the frame (s, any origin; 0: unknown)

Definition at line 3215 of file mrtk_clas.c.

References clas_l6buf_t::ftag, and clas_ctx_t::l6buf.

Referenced by decoderaw().

Here is the caller graph for this function:

◆ clas_ssr2osr()

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.

Top-level wrapper that sets up grid/CSSR corrections and calls clas_osr_zdres(). Verbatim port of upstream claslib ssr2osr() from cssr2osr.c.

Parameters
[in,out]rtkRTK control structure
[in,out]obsObservation data array
[in]nNumber of observations
[in,out]navNavigation data
[out]osrOSR output per satellite
[in]mode0=normal (upstream compat)
[in]clasCLAS decoder context
Returns
Number of valid measurements, 0 on failure

This is the top-level wrapper that sets up satellite state, grid/CSSR corrections, then calls clas_osr_zdres() to compute per-satellite residuals.

Parameters
[in,out]rtkRTK control structure
[in,out]obsObservation data array (may be modified)
[in]nNumber of observations
[in,out]navNavigation data (SSR corrections applied here)
[out]osrOSR output per satellite
[in]mode0=normal, unused (upstream compat)
[in]clasCLAS decoder context (replaces upstream globals)
Returns
Number of valid measurements, 0 on failure

Definition at line 1493 of file mrtk_clas_osr.c.

References sol_t::age, clas_osrd_t::c, clas_bank_get_close(), clas_check_grid_status(), clas_get_grid_index(), clas_osr_ctx_init(), clas_osr_zdres(), clas_update_global(), clas_update_local(), obsd_t::code, clas_ctx_t::current, ecef2pos(), EPHOPT_SSRAPC, ssat_t::fix, free, clas_ctx_t::grid, obsd_t::L, clas_ctx_t::l6buf, obsd_t::LLI, mat(), MAXOBS, MAXSAT, prcopt_t::mode, clas_grid_t::network, prcopt_t::nf, norm(), rtk_t::opt, osr_ctx, obsd_t::P, clas_osrd_t::p, ssat_t::ph, PMODE_SSR2OSR_FIXED, prcopt_t::posopt, ssat_t::pt, obsd_t::rcv, sol_t::rr, prcopt_t::ru, clas_osrd_t::sat, obsd_t::sat, sat_wavelengths(), satposs(), satsys(), set_ssr_ch_idx(), ssat_t::slip, ssat_t::slipc, clas_corr_t::smode, obsd_t::SNR, ssat_t::snr, SNR_UNIT, rtk_t::sol, SOLQ_SINGLE, rtk_t::ssat, nav_s::ssr_ch, sol_t::stat, ssat_t::sys, ssr_t::t0, clas_l6buf_t::time, obsd_t::time, timediff(), trace(), ssat_t::vsat, rtk_t::x, and zeros().

Referenced by rtkpos().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clas_stec_grid_data()

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.

Parameters
[in]corrMerged correction snapshot
[in]indexSelected grid point indices
[in]timeTime (GPST)
[in]satSatellite number
[in]nNumber of grids (1-4)
[in]weightInterpolation weights
[in]GmatInterpolation matrix (4x4, can be NULL)
[in]EmatBasis vector (4x1, can be NULL)
[out]ionoInterpolated L1 ionosphere delay (m)
[out]rateInterpolated ionosphere rate (m/s)
[out]varInterpolated variance (m^2)
[out]brkSlip break flag
Returns
1=ok, 0=error

Definition at line 588 of file mrtk_clas_grid.c.

References dot(), free, mat(), matmul(), SQR, clas_corr_t::stec, and stec_data().

Referenced by clas_osr_corrmeas().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clas_trop_grid_data()

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.

Parameters
[in]corrMerged correction snapshot
[in]indexSelected grid point indices
[in]timeTime (GPST)
[in]nNumber of grids (1-4)
[in]weightInterpolation weights
[in]GmatInterpolation matrix (4x4, can be NULL)
[in]EmatBasis vector (4x1, can be NULL)
[out]zwdInterpolated zenith wet delay
[out]ztdInterpolated zenith total delay
[out]tbrkValidity flag (0=all valid, 1=partial)
Returns
1=ok, 0=error

Definition at line 749 of file mrtk_clas_grid.c.

References dot(), free, imat(), mat(), matmul(), trop_data(), and clas_corr_t::zwd.

Referenced by clas_osr_zdres().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clas_update_global()

void clas_update_global ( nav_t * nav,
const clas_corr_t * corr,
int ch )

Apply global corrections (orbit/clock/bias) to nav_t.ssr[].

Parameters
[in,out]navNavigation data
[in]corrMerged correction snapshot
[in]chChannel index

Definition at line 1430 of file mrtk_clas.c.

References clas_corr_t::c0, clas_corr_t::cbias, ssr_t::cbias, ssr_t::dclk, ssr_t::ddeph, ssr_t::deph, clas_corr_t::deph0, clas_corr_t::deph1, clas_corr_t::deph2, ssr_t::discnt, clas_corr_t::facility, nav_s::facility, clas_corr_t::iod, ssr_t::iod, clas_corr_t::iode, ssr_t::iode, MAXCODE, MAXSAT, clas_corr_t::pbias, ssr_t::pbias, clas_corr_t::prn, clas_corr_t::smode, nav_s::ssr_ch, ssr_t::t0, clas_corr_t::time, clas_corr_t::udi, ssr_t::udi, and ssr_t::update.

Referenced by clas_ssr2osr(), decoderaw(), ppp_rtk_pos(), and update_clas().

Here is the caller graph for this function:

◆ clas_update_local()

void clas_update_local ( nav_t * nav,
const clas_corr_t * corr,
int ch )

Apply local corrections (trop/STEC) to nav_t.

Parameters
[in,out]navNavigation data
[in]corrMerged correction snapshot
[in]chChannel index

Definition at line 1493 of file mrtk_clas.c.

Referenced by clas_ssr2osr(), and ppp_rtk_pos().

Here is the caller graph for this function:

◆ cssr_gnss2sys()

int cssr_gnss2sys ( int gnss,
int * prn0 )

Convert CSSR GNSS ID to RTKLIB system bitmask.

Parameters
[in]gnssCSSR GNSS ID (CSSR_SYS_GPS, etc.)
[out]prn0Output base PRN offset (can be NULL)
Returns
RTKLIB system bitmask (SYS_GPS, etc.), 0 on error

Definition at line 175 of file mrtk_clas.c.

References CSSR_SYS_BDS, CSSR_SYS_GAL, CSSR_SYS_GLO, CSSR_SYS_GPS, CSSR_SYS_QZS, CSSR_SYS_SBS, SYS_CMP, SYS_GAL, SYS_GLO, SYS_GPS, SYS_NONE, SYS_QZS, and SYS_SBS.

Referenced by svmask2nsatlist(), and svmask2sat().

Here is the caller graph for this function:

◆ cssr_sys2gnss()

int cssr_sys2gnss ( int sys,
int * prn0 )

Convert RTKLIB system bitmask to CSSR GNSS ID.

Parameters
[in]sysRTKLIB system (SYS_GPS, etc.)
[out]prn0Output base PRN offset (can be NULL)
Returns
CSSR GNSS ID, CSSR_SYS_NONE on error

Definition at line 140 of file mrtk_clas.c.

References CSSR_SYS_BDS, CSSR_SYS_GAL, CSSR_SYS_GLO, CSSR_SYS_GPS, CSSR_SYS_NONE, CSSR_SYS_QZS, CSSR_SYS_SBS, SYS_CMP, SYS_GAL, SYS_GLO, SYS_GPS, SYS_QZS, and SYS_SBS.

Referenced by sigmask2sig(), and sigmask2sig_p().

Here is the caller graph for this function:

◆ isL2C()

int isL2C ( int code)

Check if observation code is L2C.

Parameters
[in]codeObservation code (CODE_???)
Returns
1 if L2C, 0 otherwise

Definition at line 546 of file mrtk_clas_isb.c.

References CODE_L2L, CODE_L2S, and CODE_L2X.

Referenced by clas_osr_zdres(), and zdres().

Here is the caller graph for this function:

◆ readblqgrid()

int readblqgrid ( const char * file,
clas_ctx_t * ctx )

Read BLQ ocean tide loading parameters for CLAS grid points.

Parameters
[in]fileBLQ grid file
[in,out]ctxCLAS context (oload[] populated)
Returns
1:ok, 0:file open error

Definition at line 839 of file mrtk_clas_grid.c.

References CLAS_MAX_GP, CLAS_MAX_NETWORK, clas_oload_t::gridnum, clas_oload_t::odisp, clas_ctx_t::oload, clas_oload_t::pos, readblqrecord(), and trace().

Referenced by execses().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readisb()

int readisb ( const char * file,
nav_t * nav )

Read ISB correction table from file.

Parameters
[in]fileISB table file path (wild-card * expanded)
[in,out]navNavigation data (isb array populated)
Returns
Status (1:ok, 0:error)

Definition at line 308 of file mrtk_clas_isb.c.

References expath(), free, malloc, MAXEXFILE, nav_s::ni, nav_s::nimax, readisbf(), and trace().

Referenced by execses().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readL2C()

int readL2C ( const char * file,
nav_t * nav )

Read L2C 1/4 cycle phase shift table from file.

Parameters
[in]fileL2C phase shift table file path
[in,out]navNavigation data (sfts populated)
Returns
Status (0:ok, -1:error)

Definition at line 489 of file mrtk_clas_isb.c.

References sft_t::bias, MAXRECTYP, sft_t::n, PHASE_CYCLE, sft_t::rectyp, nav_s::sfts, str2num(), trace(), and trim_str().

Referenced by execses().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setisb()

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.

Parameters
[in]navNavigation data (contains isb table)
[in]rectype0Rover receiver type
[in]rectype1Reference receiver type
[out]sta0Rover station (isb field populated)
[out]sta1Reference station (isb field populated, can be NULL)

Definition at line 340 of file mrtk_clas_isb.c.

References isb_t::gsb, nav_s::isb, sta_t::isb, nav_s::ni, NSYS, isb_t::sta_name, isb_t::sta_name_base, and trace().

Referenced by execses().

Here is the call graph for this function:
Here is the caller graph for this function: