MRTKLIB 0.7.14
Modernized GNSS Positioning Library
Loading...
Searching...
No Matches
mrtk_clas_osr.c File Reference

CLAS SSR-to-OSR (Observation Space Representation) conversion. More...

#include <math.h>
#include <stdlib.h>
#include <string.h>
#include "mrtklib/mrtk_antenna.h"
#include "mrtklib/mrtk_astro.h"
#include "mrtklib/mrtk_atmos.h"
#include "mrtklib/mrtk_clas.h"
#include "mrtklib/mrtk_const.h"
#include "mrtklib/mrtk_coords.h"
#include "mrtklib/mrtk_eph.h"
#include "mrtklib/mrtk_geoid.h"
#include "mrtklib/mrtk_mat.h"
#include "mrtklib/mrtk_nav.h"
#include "mrtklib/mrtk_obs.h"
#include "mrtklib/mrtk_opt.h"
#include "mrtklib/mrtk_ppp_rtk.h"
#include "mrtklib/mrtk_rtkpos.h"
#include "mrtklib/mrtk_sol.h"
#include "mrtklib/mrtk_tides.h"
#include "mrtklib/mrtk_time.h"
#include "mrtklib/mrtk_trace.h"
Include dependency graph for mrtk_clas_osr.c:

Go to the source code of this file.

Macros

#define SQR(x)
#define NF_RTK(opt)
#define NP_RTK(opt)
#define NI_RTK(opt)
#define NR_RTK(opt)
#define IB_RTK(s, f, opt)
#define GME   3.986004415E+14
#define POSL1   1 /* L1 single freq positioning */
#define POSL1L2   2 /* L1+L2 dual freq positioning */
#define POSL1L5   3 /* L1+L5 dual freq positioning */
#define POSL1L2L5   4 /* L1+L2+L5 triple freq positioning */
#define POSL1L5_L2   5 /* L1+L5(or L2) dual freq positioning */
#define MAXAGESSR_SIS   60.0 /* max age of ssr orbit/clock (s) */
#define MAXECORSSR_SIS   10.0 /* max orbit correction (m) */
#define MAXCCORSSR_SIS   (1E-6 * CLIGHT) /* max clock correction (m) */

Functions

static int NT_RTK (const prcopt_t *opt)
static int code_on_same_freq (int sys, uint8_t code1, uint8_t code2)
 Check if two obs codes are on the same frequency band.
static int pcv_slot_has_data (const pcv_t *pcv, int slot)
static int claslib_pcv_slot (const pcv_t *pcv, int f)
static double shapiro (const double *rsat, const double *rrcv)
 Compute Shapiro (relativistic) time delay correction.
static void windupcorr (gtime_t time, const double *rs, const double *rr, double *phw)
 Compute phase windup correction.
double sat2freq (int sat, uint8_t code, const nav_t *nav)
static void sat_wavelengths (int sat, const obsd_t *obs, const nav_t *nav, double *lam)
 Fill wavelength array for a satellite from observation codes.
static int count_nsig (const int smode[MAXCODE])
 Count non-zero entries in a signal mode array (equivalent to nsig).
void clas_osr_ctx_init (clas_osr_ctx_t *ctx)
 Initialize OSR conversion context (zero all persistent state).
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.
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.
static void ocean_tide_clasgrid (gtime_t tut, const clas_oload_t *oload, const int *index, int nn, const double *E, const double *Emat, const double *Gmat, const double *weight, double *dr)
 Compute ocean tide loading displacement using CLAS grid interpolation.
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)
 Update per-satellite SIS correction state for IODE adjustment.
static double clas_osr_adjust_cpc (gtime_t teph, int sat, const ssr_t *ssr, int sig, double cpc, double *sis, int *flag, int ch, clas_osr_ctx_t *ctx)
 Adjust carrier-phase correction for SIS discontinuity.
static double clas_osr_adjust_prc (gtime_t teph, int sat, const ssr_t *ssr, int sig, double prc, double *sis, int *flag, int ch, clas_osr_ctx_t *ctx)
 Adjust pseudorange correction for SIS discontinuity.
static void clas_osr_adjust_r_dts (double *retr, double *retdts, gtime_t teph, int sat, nav_t *nav, const double *rr, gtime_t dts_time, int ch, clas_osr_ctx_t *ctx)
 Recompute geometric range and clock on IODE change.
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_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.

Variables

static const unsigned char obsfreqs []

Detailed Description

CLAS SSR-to-OSR (Observation Space Representation) conversion.

References: [1] claslib cssr2osr.c – upstream SSR->OSR implementation [2] IS-QZSS-L6-003 – CLAS Compact SSR Specification

Notes:

  • Ported from upstream claslib cssr2osr.c.
  • ENA_PPP_RTK path always enabled; CSSR2OSR_VRS path removed.
  • Converts SSR compact corrections (orbit, clock, bias, STEC, ZWD) into per-satellite observation-space residuals (clas_osrd_t).
  • Static variables from upstream moved to clas_osr_ctx_t for thread safety.
  • Uses nav->ssr_ch[0][sat-1] (channel 0 by default).
  • nav->lam[sat-1] replaced by local lam[] computed from sat2freq().
  • Several upstream functions stubbed (ISB, L2C, etc.).

Definition in file mrtk_clas_osr.c.

Macro Definition Documentation

◆ GME

#define GME   3.986004415E+14

Earth gravitational constant (m^3/s^2) – for Shapiro correction

Definition at line 76 of file mrtk_clas_osr.c.

Referenced by shapiro(), and tide_pl().

◆ IB_RTK

#define IB_RTK ( s,
f,
opt )
Value:
(NR_RTK(opt) + MAXSAT * (f) + (s) - 1)
#define NR_RTK(opt)
#define MAXSAT
Definition mrtk_coords.c:45

Definition at line 73 of file mrtk_clas_osr.c.

Referenced by clas_osr_zdres(), set_init_pb(), and udbias_ppp().

◆ MAXAGESSR_SIS

#define MAXAGESSR_SIS   60.0 /* max age of ssr orbit/clock (s) */

Definition at line 781 of file mrtk_clas_osr.c.

Referenced by clas_osr_satcorr_update().

◆ MAXCCORSSR_SIS

#define MAXCCORSSR_SIS   (1E-6 * CLIGHT) /* max clock correction (m) */

Definition at line 783 of file mrtk_clas_osr.c.

Referenced by clas_osr_satcorr_update().

◆ MAXECORSSR_SIS

#define MAXECORSSR_SIS   10.0 /* max orbit correction (m) */

Definition at line 782 of file mrtk_clas_osr.c.

Referenced by clas_osr_satcorr_update().

◆ NF_RTK

#define NF_RTK ( opt)
Value:
((opt)->nf)

Definition at line 64 of file mrtk_clas_osr.c.

◆ NI_RTK

#define NI_RTK ( opt)
Value:
(((opt)->ionoopt == IONOOPT_EST || (opt)->ionoopt == IONOOPT_EST_ADPT) ? MAXSAT : 0)
#define IONOOPT_EST
Definition mrtk_opt.h:96
#define IONOOPT_EST_ADPT
Definition mrtk_opt.h:100

Definition at line 66 of file mrtk_clas_osr.c.

◆ NP_RTK

#define NP_RTK ( opt)
Value:
((opt)->dynamics == 0 ? 3 : 9)

Definition at line 65 of file mrtk_clas_osr.c.

Referenced by residual_test().

◆ NR_RTK

#define NR_RTK ( opt)
Value:
(NP_RTK(opt) + NI_RTK(opt) + NT_RTK(opt))
#define NI_RTK(opt)
#define NP_RTK(opt)
#define NT_RTK(opt)

Definition at line 72 of file mrtk_clas_osr.c.

Referenced by ppp_rtk_pos().

◆ POSL1

#define POSL1   1 /* L1 single freq positioning */

Frequency pair selection modes (upstream claslib rtklib.h)

Definition at line 113 of file mrtk_clas_osr.c.

Referenced by clas_osr_selfreqpair(), and selfreqpair().

◆ POSL1L2

#define POSL1L2   2 /* L1+L2 dual freq positioning */

Definition at line 114 of file mrtk_clas_osr.c.

Referenced by clas_osr_selfreqpair().

◆ POSL1L2L5

#define POSL1L2L5   4 /* L1+L2+L5 triple freq positioning */

Definition at line 116 of file mrtk_clas_osr.c.

Referenced by clas_osr_selfreqpair(), and selfreqpair().

◆ POSL1L5

#define POSL1L5   3 /* L1+L5 dual freq positioning */

Definition at line 115 of file mrtk_clas_osr.c.

Referenced by clas_osr_selfreqpair(), and selfreqpair().

◆ POSL1L5_L2

#define POSL1L5_L2   5 /* L1+L5(or L2) dual freq positioning */

Definition at line 117 of file mrtk_clas_osr.c.

Referenced by clas_osr_selfreqpair(), and selfreqpair().

◆ SQR

#define SQR ( x)
Value:
((x) * (x))

Definition at line 61 of file mrtk_clas_osr.c.

Referenced by clas_osr_compensatedisp().

Function Documentation

◆ clas_osr_adjust_cpc()

double clas_osr_adjust_cpc ( gtime_t teph,
int sat,
const ssr_t * ssr,
int sig,
double cpc,
double * sis,
int * flag,
int ch,
clas_osr_ctx_t * ctx )
static

Adjust carrier-phase correction for SIS discontinuity.

When phase bias TOW differs from current SIS TOW by exactly 30s, subtracts the SIS discontinuity from CPC to maintain phase continuity.

Definition at line 928 of file mrtk_clas_osr.c.

References cpc, clas_satcorr_t::currsis, clas_satcorr_t::currtow, ssr_t::iode, clas_satcorr_t::previode, clas_satcorr_t::prevtow, clas_osr_ctx_t::satcorr, ssr_t::t0, time2gpst(), and trace().

Referenced by clas_osr_zdres().

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

◆ clas_osr_adjust_prc()

double clas_osr_adjust_prc ( gtime_t teph,
int sat,
const ssr_t * ssr,
int sig,
double prc,
double * sis,
int * flag,
int ch,
clas_osr_ctx_t * ctx )
static

Adjust pseudorange correction for SIS discontinuity.

Same logic as adjust_cpc but applied to PRC.

Definition at line 965 of file mrtk_clas_osr.c.

References clas_satcorr_t::currsis, clas_satcorr_t::currtow, ssr_t::iode, clas_satcorr_t::previode, clas_osr_ctx_t::satcorr, ssr_t::t0, time2gpst(), and trace().

Referenced by clas_osr_zdres().

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

◆ clas_osr_adjust_r_dts()

void clas_osr_adjust_r_dts ( double * retr,
double * retdts,
gtime_t teph,
int sat,
nav_t * nav,
const double * rr,
gtime_t dts_time,
int ch,
clas_osr_ctx_t * ctx )
static

Recompute geometric range and clock on IODE change.

When IODE changes at an SSR boundary, the broadcast ephemeris has changed. This recomputes the geometric range using the previous IODE's ephemeris to maintain consistency.

Definition at line 999 of file mrtk_clas_osr.c.

References CLIGHT, cross3(), ssr_t::dclk, ssr_t::deph, eph2clk(), ephpos(), geodist(), normv3(), clas_satcorr_t::previode, clas_osr_ctx_t::satcorr, satsys(), seleph(), nav_s::ssr_ch, SYS_CMP, SYS_GAL, SYS_GPS, SYS_QZS, time2gpst(), timeadd(), and trace().

Referenced by clas_osr_zdres().

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.

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.

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 (zero all persistent state).

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

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 )

Update per-satellite SIS correction state for IODE adjustment.

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.

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

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:

◆ claslib_pcv_slot()

int claslib_pcv_slot ( const pcv_t * pcv,
int f )
static

Definition at line 104 of file mrtk_clas_osr.c.

References pcv_slot_has_data().

Referenced by clas_osr_corrmeas().

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

◆ code_on_same_freq()

int code_on_same_freq ( int sys,
uint8_t code1,
uint8_t code2 )
static

Check if two obs codes are on the same frequency band.

CLAS corrections use combined tracking codes (e.g. L2X = L2C M+L), while receivers report specific codes (e.g. L2W, L2L). These are equivalent for bias correction purposes since CLAS biases are frequency-band level, not tracking-mode specific.

Parameters
[in]sysSatellite system (SYS_GPS, SYS_GAL, etc.)
[in]code1First obs code (CODE_L??)
[in]code2Second obs code (CODE_L??)
Returns
1 if codes are on the same frequency band, 0 otherwise

Definition at line 91 of file mrtk_clas_osr.c.

References code2freq_idx().

Referenced by clas_osr_corrmeas().

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

◆ count_nsig()

int count_nsig ( const int smode[MAXCODE])
static

Count non-zero entries in a signal mode array (equivalent to nsig).

Parameters
[in]smodeSignal mode array for one satellite
Returns
Number of valid signal modes

Definition at line 279 of file mrtk_clas_osr.c.

References MAXCODE.

Referenced by clas_osr_corrmeas().

Here is the caller graph for this function:

◆ NT_RTK()

int NT_RTK ( const prcopt_t * opt)
inlinestatic

Definition at line 67 of file mrtk_clas_osr.c.

References prcopt_t::tropopt, TROPOPT_EST, and TROPOPT_ESTG.

◆ ocean_tide_clasgrid()

void ocean_tide_clasgrid ( gtime_t tut,
const clas_oload_t * oload,
const int * index,
int nn,
const double * E,
const double * Emat,
const double * Gmat,
const double * weight,
double * dr )
static

Compute ocean tide loading displacement using CLAS grid interpolation.

Evaluates tide_oload() at each surrounding grid point, then interpolates using bilinear (Gmat/Emat) or weighted average. Ported from upstream claslib ppp.c:ocean_tide_clasgrid().

Parameters
[in]tutTime in UT
[in]oloadOcean loading data for the selected network
[in]indexGrid point indices (from clas_grid_t)
[in]nnNumber of grid points (1-4)
[in]EENU rotation matrix (3x3)
[in]EmatInterpolation basis vector (4x1, can be NULL)
[in]GmatInterpolation matrix (4x4, can be NULL)
[in]weightInterpolation weights (4x1)
[out]drDisplacement (ECEF, m) — accumulated

Definition at line 736 of file mrtk_clas_osr.c.

References dot(), matmul(), clas_oload_t::odisp, tide_oload(), and trace().

Referenced by clas_osr_zdres().

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

◆ pcv_slot_has_data()

int pcv_slot_has_data ( const pcv_t * pcv,
int slot )
static

Definition at line 100 of file mrtk_clas_osr.c.

References NFREQPCV, norm(), pcv_t::off, and pcv_t::var.

Referenced by claslib_pcv_slot().

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

◆ sat2freq()

double sat2freq ( int sat,
uint8_t code,
const nav_t * nav )
extern

Definition at line 244 of file mrtk_obs.c.

References code2freq(), geph_t::frq, nav_s::geph, nav_s::glo_fcn, nav_s::ng, geph_t::sat, satsys_bd2(), and SYS_GLO.

Referenced by decode_cresgloraw(), decode_rangeb(), decode_rangecmpb(), gfobs(), iflc_freq2_idx(), prange(), rescode(), resdop(), sat_lambda(), sat_wavelengths(), satantoff(), udbias(), and zdres_sat().

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

◆ sat_wavelengths()

void sat_wavelengths ( int sat,
const obsd_t * obs,
const nav_t * nav,
double * lam )
static

Fill wavelength array for a satellite from observation codes.

Parameters
[in]satSatellite number
[in]obsObservation data for this satellite
[in]navNavigation data (for GLONASS FCN)
[out]lamWavelength array [NFREQ+NEXOBS]

Definition at line 261 of file mrtk_clas_osr.c.

References CLIGHT, obsd_t::code, and sat2freq().

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

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

◆ shapiro()

double shapiro ( const double * rsat,
const double * rrcv )
static

Compute Shapiro (relativistic) time delay correction.

Parameters
[in]rsatSatellite position (ECEF) (m)
[in]rrcvReceiver position (ECEF) (m)
Returns
Shapiro correction (m)

Definition at line 142 of file mrtk_clas_osr.c.

References CLIGHT, GME, and norm().

Referenced by clas_osr_zdres().

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

◆ windupcorr()

void windupcorr ( gtime_t time,
const double * rs,
const double * rr,
double * phw )
static

Compute phase windup correction.

Parameters
[in]timeTime (GPST)
[in]rsSatellite position + velocity (ECEF, 6 elements)
[in]rrReceiver position (ECEF, 3 elements)
[in,out]phwPhase windup correction (cycle), previous value as input

Definition at line 169 of file mrtk_clas_osr.c.

References cross3(), dot(), ecef2pos(), gpst2utc(), norm(), normv3(), OMGE, PI, satpos(), sunmoonpos(), and xyz2enu().

Referenced by clas_osr_zdres().

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

Variable Documentation

◆ obsfreqs

const unsigned char obsfreqs[]
static
Initial value:
= {
0, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 3, 3, 3, 5, 5, 5,
4, 4, 4, 4, 4, 4, 4, 6, 6, 6,
2, 2, 4, 4, 3, 3, 3, 1, 1, 0
}

CSSR signal mode to frequency band mapping table. Index = signal tracking mode code, value = 1:L1,2:L2,3:L5,4:L6,5:L7,6:L8

Definition at line 122 of file mrtk_clas_osr.c.

Referenced by clas_osr_compensatedisp().