|
MRTKLIB 0.7.14
Modernized GNSS Positioning Library
|
MRTKLIB Observation Module — Observation data types and utility functions. More...
Go to the source code of this file.
Classes | |
| struct | obsd_t |
| Observation data record. More... | |
| struct | obs_t |
| Observation data collection. More... | |
| struct | snrmask_t |
| SNR mask type. More... | |
| struct | mrtk_signal_t |
| Signal specification: physical band + optional preferred code. More... | |
| struct | mrtk_sigcfg_t |
| struct | mrtk_sig_priority_t |
| Signal priority entry: band + priority-ordered code list. More... | |
Macros | |
| #define | MRTK_MAXSIG_PER_SYS 7 /* max signals per constellation */ |
| Per-constellation signal configuration. | |
| #define | MRTK_NSYS 7 /* number of constellations */ |
| #define | MRTK_MAX_SIG_PRIORITY 15 |
| Maximum number of codes in a priority list. | |
| #define | MRTK_SIGCFG_NOOPINION (-2) |
| mrtk_sigcfg_freq_idx() sentinel: this constellation has no sigcfg entry, so the caller should fall back to its default (-R/-G/...) option logic. Distinct from -1 (drop) and from valid slot indices. | |
Functions | |
| uint8_t | obs2code (const char *obs) |
| Convert obs code type string to obs code. | |
| char * | code2obs (uint8_t code) |
| Convert obs code to obs code string. | |
| int | code2freq_num (uint8_t code) |
| Extract frequency number from obs code. | |
| int | code2freq_idx (int sys, uint8_t code) |
| Convert system and obs code to frequency index (obsdef-based). | |
| double | code2freq (int sys, uint8_t code, int fcn) |
| Convert system and obs code to carrier frequency. | |
| int | getcodepri (int sys, uint8_t code, const char *opt) |
| Get code priority for multiple codes in a frequency. | |
| int | sortobs (obs_t *obs) |
| Sort observation data by time, receiver, and satellite. | |
| void | signal_replace (obsd_t *obs, int idx, char f, char *c) |
| Replace signal type in observation data. | |
| int | screent (gtime_t time, gtime_t ts, gtime_t te, double tint) |
| Screen data by time range and interval. | |
| int | testsnr (int base, int idx, double el, double snr, const snrmask_t *mask) |
| Test SNR mask. | |
| int | testelmask (const double *azel, const int16_t *elmask) |
| Test elevation mask. | |
| void | freeobs (obs_t *obs) |
| Free observation data memory. | |
| mrtk_band_t | mrtk_rinex_freq_to_band (int sys, int rinex_freq_id) |
| Convert RINEX frequency digit to physical band for a given system. | |
| const uint8_t * | mrtk_get_signal_priority (int sys, mrtk_band_t band) |
| Get priority-ordered code list for a (system, band) pair. | |
| void | mrtk_use_claslib_qzs_l1_priority (int on) |
| Toggle the claslib-compatible QZSS L1 signal priority (C>S>L>X>Z). | |
| double | mrtk_band2freq_hz (mrtk_band_t band) |
| Convert physical band to base carrier frequency (Hz). | |
| int | mrtk_band_to_freq_num (int sys, mrtk_band_t band) |
| Convert physical band back to RINEX frequency number for a given system. | |
| int | mrtk_parse_signal_str (const char *str, int *sys, mrtk_band_t *band, uint8_t *code) |
| Parse a RINEX3-style signal string (e.g., "G1C") into components. | |
| int | mrtk_sigcfg_from_signals (const char **sigs, int nsig, mrtk_sigcfg_t *cfg, int *nf) |
| Build per-constellation signal config from a signal string array. | |
| int | mrtk_sigcfg_to_obsdef (const mrtk_sigcfg_t *cfg) |
| Apply signal config to obsdef tables (bridge to existing system). | |
| int | mrtk_sigcfg_freq_idx (int sys, uint8_t code, const mrtk_sigcfg_t *cfg, int nex) |
| Resolve the observation slot for a decoded (sys, code) from sigcfg. | |
MRTKLIB Observation Module — Observation data types and utility functions.
This header provides the fundamental GNSS observation data types (obsd_t, obs_t, snrmask_t) and observation utility functions extracted from rtklib.h/rtkcmn.c with zero algorithmic changes.
Definition in file mrtk_obs.h.
| #define MRTK_MAX_SIG_PRIORITY 15 |
Maximum number of codes in a priority list.
Definition at line 206 of file mrtk_obs.h.
Referenced by getcodepri().
| #define MRTK_MAXSIG_PER_SYS 7 /* max signals per constellation */ |
Per-constellation signal configuration.
Definition at line 193 of file mrtk_obs.h.
Referenced by mrtk_sigcfg_from_signals().
| #define MRTK_NSYS 7 /* number of constellations */ |
Definition at line 194 of file mrtk_obs.h.
Referenced by mrtk_sigcfg_from_signals(), and mrtk_sigcfg_to_obsdef().
| #define MRTK_SIGCFG_NOOPINION (-2) |
mrtk_sigcfg_freq_idx() sentinel: this constellation has no sigcfg entry, so the caller should fall back to its default (-R/-G/...) option logic. Distinct from -1 (drop) and from valid slot indices.
Definition at line 291 of file mrtk_obs.h.
Referenced by mrtk_sigcfg_freq_idx(), and sig2idx().
| double code2freq | ( | int | sys, |
| uint8_t | code, | ||
| int | fcn ) |
Convert system and obs code to carrier frequency.
| [in] | sys | Satellite system (SYS_???) |
| [in] | code | Obs code (CODE_???) |
| [in] | fcn | Frequency channel number for GLONASS |
Definition at line 236 of file mrtk_obs.c.
Referenced by sat2freq().
| int code2freq_idx | ( | int | sys, |
| uint8_t | code ) |
Convert system and obs code to frequency index (obsdef-based).
| [in] | sys | Satellite system (SYS_???) |
| [in] | code | Obs code (CODE_???) |
Definition at line 225 of file mrtk_obs.c.
References code2freq_num(), and freq_num2freq_idx().
Referenced by code_on_same_freq(), decode_bnx_7f_05_obs(), decode_track_stat(), mrtk_sigcfg_freq_idx(), save_msm_obs(), set_index(), setopt_obstype(), sig2idx(), sig2idx(), sig_idx(), and sort_obstype().
| int code2freq_num | ( | uint8_t | code | ) |
Extract frequency number from obs code.
| [in] | code | Obs code (CODE_???) |
Definition at line 201 of file mrtk_obs.c.
References code2obs().
Referenced by clas_osr_zdres(), code2freq(), code2freq_idx(), getcodepri(), and mrtk_sigcfg_freq_idx().
| char * code2obs | ( | uint8_t | code | ) |
Convert obs code to obs code string.
| [in] | code | Obs code (CODE_???) |
Definition at line 190 of file mrtk_obs.c.
Referenced by code2freq_num(), getcodepri(), and signal_replace().
| void freeobs | ( | obs_t * | obs | ) |
Free observation data memory.
| [in,out] | obs | Observation data |
Definition at line 433 of file mrtk_obs.c.
References obs_t::data, free, obs_t::n, and obs_t::nmax.
| int getcodepri | ( | int | sys, |
| uint8_t | code, | ||
| const char * | opt ) |
Get code priority for multiple codes in a frequency.
| [in] | sys | System (SYS_???) |
| [in] | code | Obs code (CODE_???) |
| [in] | opt | Code options (NULL:no option) |
Definition at line 276 of file mrtk_obs.c.
References code2freq_num(), code2obs(), MRTK_BAND_UNKNOWN, mrtk_get_signal_priority(), MRTK_MAX_SIG_PRIORITY, mrtk_rinex_freq_to_band(), SYS_BD2, SYS_CMP, SYS_GAL, SYS_GLO, SYS_GPS, SYS_IRN, SYS_QZS, and SYS_SBS.
Referenced by decode_bnx_7f_05_obs(), set_index(), sigindex(), and sort_obstype().
| double mrtk_band2freq_hz | ( | mrtk_band_t | band | ) |
Convert physical band to base carrier frequency (Hz).
| [in] | band | Physical frequency band |
Definition at line 766 of file mrtk_obs.c.
References FREQ1, FREQ1_CMP, FREQ1_GLO, FREQ2, FREQ2_CMP, FREQ2_GLO, FREQ3_CMP, FREQ3_GLO, FREQ5, FREQ6, FREQ7, FREQ8, FREQ9, MRTK_BAND_BDS_B1C, MRTK_BAND_BDS_B1I, MRTK_BAND_BDS_B2a, MRTK_BAND_BDS_B2ab, MRTK_BAND_BDS_B2b, MRTK_BAND_BDS_B3, MRTK_BAND_GAL_E1, MRTK_BAND_GAL_E5a, MRTK_BAND_GAL_E5ab, MRTK_BAND_GAL_E5b, MRTK_BAND_GAL_E6, MRTK_BAND_GLO_G1, MRTK_BAND_GLO_G2, MRTK_BAND_GLO_G3, MRTK_BAND_GPS_L1, MRTK_BAND_GPS_L2, MRTK_BAND_GPS_L5, MRTK_BAND_IRN_L5, MRTK_BAND_IRN_S, MRTK_BAND_QZS_L1, MRTK_BAND_QZS_L2, MRTK_BAND_QZS_L5, MRTK_BAND_QZS_L6, MRTK_BAND_SBS_L1, and MRTK_BAND_SBS_L5.
| int mrtk_band_to_freq_num | ( | int | sys, |
| mrtk_band_t | band ) |
Convert physical band back to RINEX frequency number for a given system.
| [in] | sys | Satellite system (SYS_???) |
| [in] | band | Physical frequency band |
Definition at line 938 of file mrtk_obs.c.
References MRTK_BAND_BDS_B1C, MRTK_BAND_BDS_B1I, MRTK_BAND_BDS_B2a, MRTK_BAND_BDS_B2ab, MRTK_BAND_BDS_B2b, MRTK_BAND_BDS_B3, MRTK_BAND_GAL_E1, MRTK_BAND_GAL_E5a, MRTK_BAND_GAL_E5ab, MRTK_BAND_GAL_E5b, MRTK_BAND_GAL_E6, MRTK_BAND_GLO_G1, MRTK_BAND_GLO_G2, MRTK_BAND_GLO_G3, MRTK_BAND_GPS_L1, MRTK_BAND_GPS_L2, MRTK_BAND_GPS_L5, MRTK_BAND_IRN_L5, MRTK_BAND_IRN_S, MRTK_BAND_QZS_L1, MRTK_BAND_QZS_L2, MRTK_BAND_QZS_L5, MRTK_BAND_QZS_L6, MRTK_BAND_SBS_L1, MRTK_BAND_SBS_L5, SYS_CMP, SYS_GAL, SYS_GLO, SYS_GPS, SYS_IRN, SYS_QZS, and SYS_SBS.
Referenced by mrtk_sigcfg_freq_idx(), and mrtk_sigcfg_to_obsdef().
| const uint8_t * mrtk_get_signal_priority | ( | int | sys, |
| mrtk_band_t | band ) |
Get priority-ordered code list for a (system, band) pair.
| [in] | sys | Satellite system (SYS_???) |
| [in] | band | Physical frequency band |
Definition at line 914 of file mrtk_obs.c.
References MRTK_BAND_MAX, MRTK_BAND_QZS_L1, MRTK_BAND_UNKNOWN, qzs_l1_claslib, QZS_L1_PRIORITY_CLASLIB, SIG_PRIORITY_TABLE, and SYS_QZS.
Referenced by getcodepri().
| int mrtk_parse_signal_str | ( | const char * | str, |
| int * | sys, | ||
| mrtk_band_t * | band, | ||
| uint8_t * | code ) |
Parse a RINEX3-style signal string (e.g., "G1C") into components.
| [in] | str | Signal string (3 chars: {sys}{freq}{attr}) |
| [out] | sys | Satellite system (SYS_???) |
| [out] | band | Physical frequency band |
| [out] | code | Observation code (CODE_???) |
Definition at line 1039 of file mrtk_obs.c.
References CODE_NONE, MRTK_BAND_UNKNOWN, mrtk_rinex_freq_to_band(), obs2code(), SYS_CMP, SYS_GAL, SYS_GLO, SYS_GPS, SYS_IRN, SYS_QZS, and SYS_SBS.
Referenced by mrtk_sigcfg_from_signals().
| mrtk_band_t mrtk_rinex_freq_to_band | ( | int | sys, |
| int | rinex_freq_id ) |
Convert RINEX frequency digit to physical band for a given system.
| [in] | sys | Satellite system (SYS_???) |
| [in] | rinex_freq_id | RINEX frequency digit (1,2,3,4,5,6,7,8,9) |
Definition at line 806 of file mrtk_obs.c.
References MRTK_BAND_BDS_B1C, MRTK_BAND_BDS_B1I, MRTK_BAND_BDS_B2a, MRTK_BAND_BDS_B2ab, MRTK_BAND_BDS_B2b, MRTK_BAND_BDS_B3, MRTK_BAND_GAL_E1, MRTK_BAND_GAL_E5a, MRTK_BAND_GAL_E5ab, MRTK_BAND_GAL_E5b, MRTK_BAND_GAL_E6, MRTK_BAND_GLO_G1, MRTK_BAND_GLO_G2, MRTK_BAND_GLO_G3, MRTK_BAND_GPS_L1, MRTK_BAND_GPS_L2, MRTK_BAND_GPS_L5, MRTK_BAND_IRN_L5, MRTK_BAND_IRN_S, MRTK_BAND_QZS_L1, MRTK_BAND_QZS_L2, MRTK_BAND_QZS_L5, MRTK_BAND_QZS_L6, MRTK_BAND_SBS_L1, MRTK_BAND_SBS_L5, MRTK_BAND_UNKNOWN, SYS_CMP, SYS_GAL, SYS_GLO, SYS_GPS, SYS_IRN, SYS_QZS, and SYS_SBS.
Referenced by getcodepri(), and mrtk_parse_signal_str().
| int mrtk_sigcfg_freq_idx | ( | int | sys, |
| uint8_t | code, | ||
| const mrtk_sigcfg_t * | cfg, | ||
| int | nex ) |
Resolve the observation slot for a decoded (sys, code) from sigcfg.
#189: lets [positioning].signals (sigcfg) drive raw-decoder code selection, so e.g. GLONASS L2C/A can be placed in the iono-free 2nd frequency without the legacy -RL2C receiver option. obsdef is band-level (cannot distinguish L2C from L2P); sigcfg carries the per-band preferred code, which this consults.
| [in] | sys | Satellite system (SYS_???) |
| [in] | code | Observation code (CODE_???) just decoded |
| [in] | cfg | Per-constellation signal config array [MRTK_NSYS] |
| [in] | nex | Number of extra observation slots available (NEXOBS) |
Definition at line 1224 of file mrtk_obs.c.
References mrtk_signal_t::band, code2freq_idx(), code2freq_num(), mrtk_band_to_freq_num(), MRTK_SIGCFG_NOOPINION, mrtk_sigcfg_t::nsig, mrtk_signal_t::preferred_code, mrtk_sigcfg_t::sig, and sys2sigcfg_idx().
Referenced by sig2idx().
| int mrtk_sigcfg_from_signals | ( | const char ** | sigs, |
| int | nsig, | ||
| mrtk_sigcfg_t * | cfg, | ||
| int * | nf ) |
Build per-constellation signal config from a signal string array.
| [in] | sigs | Array of signal strings (e.g., "G1C", "E5Q") |
| [in] | nsig | Number of signal strings |
| [out] | cfg | Per-constellation signal config array [MRTK_NSYS] |
| [out] | nf | Derived number of frequencies (max signals per constellation) |
Definition at line 1128 of file mrtk_obs.c.
References mrtk_signal_t::band, MRTK_MAXSIG_PER_SYS, MRTK_NSYS, mrtk_parse_signal_str(), mrtk_sigcfg_t::nsig, mrtk_signal_t::preferred_code, mrtk_sigcfg_t::sig, sys2sigcfg_idx(), and trace().
Referenced by buff2sysopts().
| int mrtk_sigcfg_to_obsdef | ( | const mrtk_sigcfg_t * | cfg | ) |
Apply signal config to obsdef tables (bridge to existing system).
| [in] | cfg | Per-constellation signal config array [MRTK_NSYS] |
Definition at line 1187 of file mrtk_obs.c.
References MAXFREQ, mrtk_band_to_freq_num(), MRTK_NSYS, mrtk_sigcfg_t::nsig, set_obsdef(), SYS_CMP, SYS_GAL, SYS_GLO, SYS_GPS, SYS_IRN, SYS_QZS, SYS_SBS, and trace().
Referenced by buff2sysopts().
| void mrtk_use_claslib_qzs_l1_priority | ( | int | on | ) |
Toggle the claslib-compatible QZSS L1 signal priority (C>S>L>X>Z).
Enable only for CLAS processing; upstream claslib and MADOCALIB disagree on the QZSS L1 order, so the claslib order must not affect other engines.
| [in] | on | 1: claslib order, 0: MRTK default order |
Definition at line 906 of file mrtk_obs.c.
References qzs_l1_claslib.
| uint8_t obs2code | ( | const char * | obs | ) |
Convert obs code type string to obs code.
| [in] | obs | Obs code string ("1C","1P","1Y",...) |
Definition at line 173 of file mrtk_obs.c.
Referenced by mrtk_parse_signal_str().
Screen data by time range and interval.
| [in] | time | Time to check (GPST) |
| [in] | ts | Start time (GPST) (ts.time==0: no start limit) |
| [in] | te | End time (GPST) (te.time==0: no end limit) |
| [in] | tint | Time interval (s) (0.0: no interval limit) |
Definition at line 424 of file mrtk_obs.c.
References DTTOL, gtime_t::time, time2gpst(), and timediff().
Referenced by avepos(), convnav(), convsbs(), inputsol(), outsolexs(), outsols(), readbnxfp(), readmsgs(), readrnxobs(), and readsolstatdata().
| void signal_replace | ( | obsd_t * | obs, |
| int | idx, | ||
| char | f, | ||
| char * | c ) |
Replace signal type in observation data.
| [in,out] | obs | Observation data record |
| [in] | idx | Frequency index |
| [in] | f | Frequency character |
| [in,out] | c | Signal code string |
Definition at line 388 of file mrtk_obs.c.
References obsd_t::code, code2obs(), obsd_t::D, obsd_t::L, obsd_t::LLI, obsd_t::P, and obsd_t::SNR.
| int sortobs | ( | obs_t * | obs | ) |
Sort observation data by time, receiver, and satellite.
| [in,out] | obs | Observation data to sort |
Definition at line 350 of file mrtk_obs.c.
References cmpobs(), obs_t::data, DTTOL, obs_t::n, obsd_t::rcv, obsd_t::sat, obsd_t::time, timediff(), and trace().
Referenced by readobsnav(), and update_obs().
| int testelmask | ( | const double * | azel, |
| const int16_t * | elmask ) |
Test elevation mask.
| [in] | azel | Azimuth/elevation angle {az,el} (rad) |
| [in] | elmask | Elevation mask vector (360 x 1) (0.1 deg) |
Definition at line 160 of file mrtk_obs.c.
References R2D.
Referenced by zdres().
| int testsnr | ( | int | base, |
| int | idx, | ||
| double | el, | ||
| double | snr, | ||
| const snrmask_t * | mask ) |
Test SNR mask.
| [in] | base | Rover or base-station (0:rover, 1:base station) |
| [in] | idx | Frequency index (0:L1, 1:L2, 2:L3,...) |
| [in] | el | Elevation angle (rad) |
| [in] | snr | C/N0 (dBHz) |
| [in] | mask | SNR mask |
Definition at line 132 of file mrtk_obs.c.
References snrmask_t::ena, snrmask_t::mask, and R2D.
Referenced by clas_osr_zdres(), snrmask(), zdres_sat(), and zdres_sat().