MRTKLIB 0.7.14
Modernized GNSS Positioning Library
Loading...
Searching...
No Matches
mrtk_madoca_local_corr.c File Reference
#include "mrtklib/mrtk_madoca_local_corr.h"
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "mrtklib/mrtk_atmos.h"
#include "mrtklib/mrtk_coords.h"
#include "mrtklib/mrtk_mat.h"
#include "mrtklib/mrtk_trace.h"
Include dependency graph for mrtk_madoca_local_corr.c:

Go to the source code of this file.

Macros

#define PI   3.1415926535897932
#define D2R   (PI / 180.0)
#define R2D   (180.0 / PI)
#define PRN_ZTD   1E-4 /* process noise of ztd (m/sqrt(s)) */
#define PRN_GRAD   1E-5 /* process noise of gradient (m/sqrt(s)) */
#define STD_ZTD_DIST   1E-4 /* distance dependent factor ztd (m/km) */
#define STD_GRAD_DIST   1E-5 /* distance dependent factor gradient (m/km) */
#define STD_VTEC_DIST   1E-3 /* distance dependent factor vtec (m/km) */
#define SQR(x)
#define MAX(x, y)
#define GN(gp)

Functions

int satid2no (const char *id)
char * time_str (gtime_t t, int n)
int getstano (stat_t *stat, const char *pntname)
 Search for a point by name or add a new point if not found.
static int decode_stat (sstat_t *sstat, char *buff, int *nbyte)
int input_stat (sstat_t *sstat, const char data, char *buff, int *nbyte)
 Stack stat message and synchronize frame with stat preamble.
int input_statf (sstat_t *sstat, FILE *fp, char *buff, int *nbyte)
 Fetch next stat message and input a message from file.
double posdist (const double *ecef1, const double *ecef2)
 Calculate the Euclidean distance between two ECEF positions.
static int get_site (const stat_t *stat, const double *llh, int iontrp, int *siteno, double maxdist, double *dist, double gllh[][3])
int get_trop_sta (gtime_t time, const trp_t *trpd, double *trp, double *std)
 Get tropospheric correction for a point.
int get_iono_sta (gtime_t time, const ion_t *iond, double *ion, double *std, double *el)
 Get ionospheric correction for a point.
int corr_trop_distwgt (const stat_t *stat, gtime_t time, const double *llh, double maxdist, double *trp, double *std)
 Calculate tropospheric correction using weighted interpolation by distance.
int corr_iono_distwgt (const stat_t *stat, gtime_t time, const double *llh, const double *el, double maxdist, double *ion, double *std, double maxres, int *nrej, int *ncnt)
 Calculate ionospheric correction using weighted interpolation by distance.
int block2stat (rtcm_t *rtcm, stat_t *stat)
 Convert RTCM3 block data to station statistics.

Macro Definition Documentation

◆ D2R

#define D2R   (PI / 180.0)

Definition at line 30 of file mrtk_madoca_local_corr.c.

◆ GN

#define GN ( gp)
Value:
(gp == 1 ? 64 : 16)

Definition at line 42 of file mrtk_madoca_local_corr.c.

◆ MAX

#define MAX ( x,
y )
Value:
((x) > (y) ? (x) : (y))

Definition at line 41 of file mrtk_madoca_local_corr.c.

Referenced by get_site().

◆ PI

#define PI   3.1415926535897932

Definition at line 29 of file mrtk_madoca_local_corr.c.

◆ PRN_GRAD

#define PRN_GRAD   1E-5 /* process noise of gradient (m/sqrt(s)) */

Definition at line 35 of file mrtk_madoca_local_corr.c.

Referenced by get_trop_sta().

◆ PRN_ZTD

#define PRN_ZTD   1E-4 /* process noise of ztd (m/sqrt(s)) */

Definition at line 34 of file mrtk_madoca_local_corr.c.

Referenced by get_trop_sta().

◆ R2D

#define R2D   (180.0 / PI)

Definition at line 31 of file mrtk_madoca_local_corr.c.

◆ SQR

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

Definition at line 40 of file mrtk_madoca_local_corr.c.

Referenced by corr_iono_distwgt(), corr_trop_distwgt(), and get_trop_sta().

◆ STD_GRAD_DIST

#define STD_GRAD_DIST   1E-5 /* distance dependent factor gradient (m/km) */

Definition at line 37 of file mrtk_madoca_local_corr.c.

Referenced by corr_trop_distwgt().

◆ STD_VTEC_DIST

#define STD_VTEC_DIST   1E-3 /* distance dependent factor vtec (m/km) */

Definition at line 38 of file mrtk_madoca_local_corr.c.

Referenced by corr_iono_distwgt().

◆ STD_ZTD_DIST

#define STD_ZTD_DIST   1E-4 /* distance dependent factor ztd (m/km) */

Definition at line 36 of file mrtk_madoca_local_corr.c.

Referenced by corr_trop_distwgt().

Function Documentation

◆ block2stat()

int block2stat ( rtcm_t * rtcm,
stat_t * stat )
extern

Convert RTCM3 block data to station statistics.

Parameters
[in,out]rtcmRTCM control struct
[in,out]statStation data struct
Returns
Status (0: error, 1: success)

Definition at line 413 of file mrtk_madoca_local_corr.c.

References BTYPE_GRID, spos_t::ecef, stat_t::nsi, stat_t::nst, posdist(), rtcm, stat_t::sion, siteion_t::site, sitetrp_t::site, stat_t::strp, and stat_t::time.

Referenced by update_lcl(), and update_rtcm().

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

◆ corr_iono_distwgt()

int corr_iono_distwgt ( const stat_t * stat,
gtime_t time,
const double * llh,
const double * el,
double maxdist,
double * ion,
double * std,
double maxres,
int * nrej,
int * ncnt )
extern

Calculate ionospheric correction using weighted interpolation by distance.

Parameters
[in]statLocal correction data
[in]timeTime (GPST)
[in]llhReceiver position {lat, lon, hgt} (rad, m)
[in]elReceiver to satellite elevation (rad)
[in]maxdistMax distance threshold (km)
[out]ionL1 slant ionospheric delay for each sat (MAXSAT x 1)
[out]stdStandard deviation (m)
[in]maxresMaximum residual threshold (m)
[out]nrejNumber of rejected stations
[out]ncntNumber of counted stations
Returns
Status (1:ok, 0:error)

Definition at line 342 of file mrtk_madoca_local_corr.c.

References get_iono_sta(), get_site(), siteion_t::iond, MAXSAT, MAXSITES, R2D, stat_t::sion, SQR, STD_VTEC_DIST, time_str(), trace(), and TYPE_ION.

Referenced by grid_intp_iono().

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

◆ corr_trop_distwgt()

int corr_trop_distwgt ( const stat_t * stat,
gtime_t time,
const double * llh,
double maxdist,
double * trp,
double * std )
extern

Calculate tropospheric correction using weighted interpolation by distance.

Parameters
[in]statCorrection data
[in]timeTime (GPST)
[in]llhReceiver position {lat, lon, hgt} (rad, m)
[in]maxdistMax distance threshold (km)
[out]trpTropospheric parameters {ztd, grade, gradn} (m)
[out]stdStandard deviation (m)
Returns
Status (1:ok, 0:error)

Definition at line 282 of file mrtk_madoca_local_corr.c.

References get_site(), get_trop_sta(), MAXSITES, PI, R2D, SQR, STD_GRAD_DIST, STD_ZTD_DIST, stat_t::strp, time_str(), trace(), tropmodel(), sitetrp_t::trpd, and TYPE_TRP.

Referenced by grid_intp_trop().

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

◆ decode_stat()

int decode_stat ( sstat_t * sstat,
char * buff,
int * nbyte )
static

Definition at line 79 of file mrtk_madoca_local_corr.c.

References ion_t::azel, D2R, spos_t::ecef, gpst2time(), ion_t::ion, siteion_t::iond, ion_t::qflag, trp_t::qflag, satid2no(), satno(), sstat_t::sion, siteion_t::site, sitetrp_t::site, ion_t::std, trp_t::std, sstat_t::strp, ion_t::time, sstat_t::time, trp_t::time, timediff(), trp_t::trp, and sitetrp_t::trpd.

Referenced by input_stat().

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

◆ get_iono_sta()

int get_iono_sta ( gtime_t time,
const ion_t * iond,
double * ion,
double * std,
double * el )
extern

Get ionospheric correction for a point.

Parameters
[in]timeTime (GPST)
[in]iondIonospheric correction data (MAXSAT elements)
[out]ionIonospheric delay for each satellite (m)
[out]stdStandard deviation (m)
[out]elElevation angle (rad)
Returns
Number of valid corrections

Definition at line 252 of file mrtk_madoca_local_corr.c.

References ion_t::azel, ion_t::ion, MAXSAT, ion_t::std, time_str(), timediff(), and trace().

Referenced by corr_iono_distwgt(), and corr_iono_plane().

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

◆ get_site()

int get_site ( const stat_t * stat,
const double * llh,
int iontrp,
int * siteno,
double maxdist,
double * dist,
double gllh[][3] )
static

Definition at line 200 of file mrtk_madoca_local_corr.c.

References spos_t::ecef, ecef2pos(), MAX, stat_t::nsi, stat_t::nst, pos2ecef(), posdist(), R2D, stat_t::sion, siteion_t::site, sitetrp_t::site, stat_t::strp, trace(), TYPE_ION, and TYPE_TRP.

Referenced by corr_iono_distwgt(), and corr_trop_distwgt().

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

◆ get_trop_sta()

int get_trop_sta ( gtime_t time,
const trp_t * trpd,
double * trp,
double * std )
extern

Get tropospheric correction for a point.

Parameters
[in]timeTime (GPST)
[in]trpdTropospheric correction data
[out]trpTropospheric parameters {ztd, grade, gradn} (m)
[out]stdStandard deviation (m)
Returns
Status (1:ok, 0:error)

Definition at line 235 of file mrtk_madoca_local_corr.c.

References PRN_GRAD, PRN_ZTD, SQR, trp_t::std, trp_t::time, time_str(), timediff(), trace(), and trp_t::trp.

Referenced by corr_trop_distwgt(), and corr_trop_plane().

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

◆ getstano()

int getstano ( stat_t * stat,
const char * pntname )
extern

Search for a point by name or add a new point if not found.

Parameters
[in,out]statLocal correction data
[in]pntnamePoint name
Returns
Point index (>=0: found or added, 0: error)

Definition at line 55 of file mrtk_madoca_local_corr.c.

References MAXSITES, spos_t::name, stat_t::nsi, stat_t::nst, stat_t::sion, siteion_t::site, sitetrp_t::site, and stat_t::strp.

Referenced by update_stat(), and update_stat().

Here is the caller graph for this function:

◆ input_stat()

int input_stat ( sstat_t * sstat,
const char data,
char * buff,
int * nbyte )
extern

Stack stat message and synchronize frame with stat preamble.

Parameters
[in,out]sstatLocal correction data
[in]dataStat 1-byte data
[out]buffBuffer for message
[in,out]nbyteNumber of bytes
Returns
Status (-1: error, 0: no message, 11: input stat messages)

Definition at line 141 of file mrtk_madoca_local_corr.c.

References decode_stat(), and trace().

Referenced by decoderaw(), and input_statf().

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

◆ input_statf()

int input_statf ( sstat_t * sstat,
FILE * fp,
char * buff,
int * nbyte )
extern

Fetch next stat message and input a message from file.

Parameters
[in,out]sstatLocal correction data
[in]fpFile pointer
[out]buffBuffer for message
[in,out]nbyteNumber of bytes
Returns
Status (-2: end of file, -1...11: same as input_stat())

Definition at line 170 of file mrtk_madoca_local_corr.c.

References input_stat(), and trace().

Referenced by update_stat().

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

◆ posdist()

double posdist ( const double * ecef1,
const double * ecef2 )
extern

Calculate the Euclidean distance between two ECEF positions.

Parameters
[in]ecef1Position 1 (ECEF coordinates)
[in]ecef2Position 2 (ECEF coordinates)
Returns
Distance between the two positions (m)

Definition at line 191 of file mrtk_madoca_local_corr.c.

References norm().

Referenced by block2stat(), get_site(), and selpersta().

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

◆ satid2no()

int satid2no ( const char * id)
extern

Definition at line 753 of file mrtk_nav.c.

Referenced by decode_stat().

Here is the caller graph for this function:

◆ time_str()

char * time_str ( gtime_t t,
int n )
extern

Definition at line 530 of file mrtk_time.c.

Referenced by corr_iono_distwgt(), corr_trop_distwgt(), get_iono_sta(), and get_trop_sta().

Here is the caller graph for this function: