MRTKLIB 0.7.14
Modernized GNSS Positioning Library
Loading...
Searching...
No Matches
mrtk_spp.c File Reference
#include "mrtklib/mrtk_spp.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_eph.h"
#include "mrtklib/mrtk_mat.h"
#include "mrtklib/mrtk_trace.h"
Include dependency graph for mrtk_spp.c:

Go to the source code of this file.

Macros

#define SYS_NONE   0x00
#define SYS_GPS   0x01
#define SYS_SBS   0x02
#define SYS_GLO   0x04
#define SYS_GAL   0x08
#define SYS_QZS   0x10
#define SYS_CMP   0x20
#define SYS_IRN   0x40
#define SYS_BD2   0x100
#define SQR(x)
#define NT   7 /* # of estimated time system (gps,glo,gal,bds3,irn,qzs,bds2) */
#define NX   (3 + NT) /* # of estimated parameters */
#define MAXITR   10 /* max number of iteration for point pos */
#define ERR_CBIAS   0.3 /* code bias error Std (m) */
#define ERR_TDCP   0.03 /* #116 P4: TDCP phase-rate error Std (m/s) */
#define MIN_EL   (5.0 * D2R) /* min elevation for measurement error (rad) */

Functions

static double varerr (const prcopt_t *opt, double el, double snr, int sys)
static double gettgd (int sat, const nav_t *nav, int type)
static int iflc_freq2_idx (const obsd_t *obs, const nav_t *nav, const prcopt_t *opt)
static int snrmask (const obsd_t *obs, const double *azel, const prcopt_t *opt)
static double prange (const obsd_t *obs, const nav_t *nav, const prcopt_t *opt, double *var)
static int rescode (int iter, const obsd_t *obs, int n, const double *rs, const double *dts, const double *vare, const int *svh, const nav_t *nav, const double *x, const prcopt_t *opt, double *v, double *H, double *var, double *azel, int *vsat, double *resp, int *ns, const int *outp)
static int valsol (const double *azel, const int *vsat, int n, const prcopt_t *opt, const double *v, int nv, int nx, char *msg)
static void exclsat (const obsd_t *obs, const double *resp, const prcopt_t *opt, int n, const int *vsat, int *outp)
static double igg3_weight (double rt, double k0, double k1)
static int cmp_dbl (const void *a, const void *b)
static double median_abs (const double *x, int n, double *work)
static int estpos (const obsd_t *obs, int n, const double *rs, const double *dts, const double *vare, const int *svh, const nav_t *nav, const prcopt_t *opt, sol_t *sol, double *azel, int *vsat, double *resp, char *msg)
static int raim_fde (const obsd_t *obs, int n, const double *rs, const double *dts, const double *vare, const int *svh, const nav_t *nav, const prcopt_t *opt, sol_t *sol, double *azel, int *vsat, double *resp, char *msg)
static void spp_detslp (const obsd_t *obs, int n, const ssat_t *ssat, double thresdop, int *slip)
static int resdop (const obsd_t *obs, int n, const double *rs, const double *dts, const nav_t *nav, const double *rr, const double *x, const double *azel, const int *vsat, double err, const ssat_t *ssat, const int *slip, int tdcp, double *v, double *H)
static int estvel (const obsd_t *obs, int n, const double *rs, const double *dts, const nav_t *nav, const prcopt_t *opt, sol_t *sol, const double *azel, const int *vsat, const ssat_t *ssat, const int *slip)
int pntpos (mrtk_ctx_t *ctx, const obsd_t *obs, int n, const nav_t *nav, const prcopt_t *opt, sol_t *sol, double *azel, ssat_t *ssat, char *msg)
 Compute receiver position, velocity, clock bias by single-point positioning with pseudorange and doppler observables.

Variables

static const double CLIGHT = 299792458.0
static const double D2R = 3.1415926535897932 / 180.0
static const double R2D = 180.0 / 3.1415926535897932
static const double OMGE = 7.2921151467E-5
static const double FREQ1 = 1.57542E9
static const double FREQ2 = 1.22760E9
static const double FREQ5 = 1.17645E9
static const double FREQ7 = 1.20714E9
static const double FREQ9 = 2.492028E9
static const double FREQ1_GLO = 1.60200E9
static const double FREQ2_GLO = 1.24600E9
static const double FREQ1_CMP = 1.561098E9
static const double FREQ2_CMP = 1.20714E9
static const double EFACT_GPS = 1.0
static const double EFACT_GLO = 1.5
static const double EFACT_SBS = 3.0
const double chisqr [100]

Macro Definition Documentation

◆ ERR_CBIAS

#define ERR_CBIAS   0.3 /* code bias error Std (m) */

Definition at line 77 of file mrtk_spp.c.

Referenced by prange().

◆ ERR_TDCP

#define ERR_TDCP   0.03 /* #116 P4: TDCP phase-rate error Std (m/s) */

Definition at line 78 of file mrtk_spp.c.

Referenced by resdop().

◆ MAXITR

#define MAXITR   10 /* max number of iteration for point pos */

Definition at line 76 of file mrtk_spp.c.

Referenced by estpos(), and estvel().

◆ MIN_EL

#define MIN_EL   (5.0 * D2R) /* min elevation for measurement error (rad) */

Definition at line 79 of file mrtk_spp.c.

◆ NT

#define NT   7 /* # of estimated time system (gps,glo,gal,bds3,irn,qzs,bds2) */

Definition at line 74 of file mrtk_spp.c.

◆ NX

#define NX   (3 + NT) /* # of estimated parameters */

Definition at line 75 of file mrtk_spp.c.

◆ SQR

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

Definition at line 72 of file mrtk_spp.c.

Referenced by prange(), raim_fde(), rescode(), and varerr().

◆ SYS_BD2

#define SYS_BD2   0x100

Definition at line 57 of file mrtk_spp.c.

◆ SYS_CMP

#define SYS_CMP   0x20

Definition at line 55 of file mrtk_spp.c.

◆ SYS_GAL

#define SYS_GAL   0x08

Definition at line 53 of file mrtk_spp.c.

◆ SYS_GLO

#define SYS_GLO   0x04

Definition at line 52 of file mrtk_spp.c.

◆ SYS_GPS

#define SYS_GPS   0x01

Definition at line 50 of file mrtk_spp.c.

◆ SYS_IRN

#define SYS_IRN   0x40

Definition at line 56 of file mrtk_spp.c.

◆ SYS_NONE

#define SYS_NONE   0x00

Definition at line 49 of file mrtk_spp.c.

◆ SYS_QZS

#define SYS_QZS   0x10

Definition at line 54 of file mrtk_spp.c.

◆ SYS_SBS

#define SYS_SBS   0x02

Definition at line 51 of file mrtk_spp.c.

Function Documentation

◆ cmp_dbl()

int cmp_dbl ( const void * a,
const void * b )
static

Definition at line 469 of file mrtk_spp.c.

Referenced by median_abs().

Here is the caller graph for this function:

◆ estpos()

int estpos ( const obsd_t * obs,
int n,
const double * rs,
const double * dts,
const double * vare,
const int * svh,
const nav_t * nav,
const prcopt_t * opt,
sol_t * sol,
double * azel,
int * vsat,
double * resp,
char * msg )
static

Definition at line 486 of file mrtk_spp.c.

References sol_t::age, CLIGHT, sol_t::dtr, EPHOPT_SBAS, exclsat(), free, igg3_weight(), lsq(), mat(), MAXITR, MAXSAT, median_abs(), norm(), sol_t::ns, NT, NX, prcopt_t::posopt, sol_t::qr, sol_t::ratio, prcopt_t::rejeminsat, prcopt_t::rejethres, rescode(), prcopt_t::robust, prcopt_t::robustk, sol_t::rr, prcopt_t::sateph, SOLQ_SBAS, SOLQ_SINGLE, sol_t::stat, sol_t::time, timeadd(), trace(), sol_t::type, and valsol().

Referenced by pntpos(), and raim_fde().

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

◆ estvel()

int estvel ( const obsd_t * obs,
int n,
const double * rs,
const double * dts,
const nav_t * nav,
const prcopt_t * opt,
sol_t * sol,
const double * azel,
const int * vsat,
const ssat_t * ssat,
const int * slip )
static

Definition at line 810 of file mrtk_spp.c.

References prcopt_t::err, free, lsq(), mat(), matcpy(), MAXITR, norm(), sol_t::qv, resdop(), sol_t::rr, prcopt_t::tdcp, and trace().

Referenced by pntpos().

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

◆ exclsat()

void exclsat ( const obsd_t * obs,
const double * resp,
const prcopt_t * opt,
int n,
const int * vsat,
int * outp )
static

Definition at line 430 of file mrtk_spp.c.

References MAXOBS, MAXSAT, prcopt_t::rejethres, obsd_t::sat, and trace().

Referenced by estpos().

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

◆ gettgd()

double gettgd ( int sat,
const nav_t * nav,
int type )
static

Definition at line 106 of file mrtk_spp.c.

References CLIGHT, geph_t::dtaun, nav_s::eph, nav_s::geph, nav_s::n, nav_s::ng, eph_t::sat, geph_t::sat, satsys(), SYS_GLO, and eph_t::tgd.

Referenced by prange().

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

◆ iflc_freq2_idx()

int iflc_freq2_idx ( const obsd_t * obs,
const nav_t * nav,
const prcopt_t * opt )
static

Definition at line 133 of file mrtk_spp.c.

References obsd_t::code, CORR_IGS, CORR_QZS_CLAS, prcopt_t::correction, prcopt_t::ionoopt, IONOOPT_IFLC, obsd_t::P, obsd_t::sat, sat2freq(), satsys(), SYS_GAL, and SYS_SBS.

Referenced by prange(), and snrmask().

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

◆ igg3_weight()

double igg3_weight ( double rt,
double k0,
double k1 )
static

Definition at line 457 of file mrtk_spp.c.

Referenced by estpos().

Here is the caller graph for this function:

◆ median_abs()

double median_abs ( const double * x,
int n,
double * work )
static

Definition at line 474 of file mrtk_spp.c.

References cmp_dbl().

Referenced by estpos().

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

◆ pntpos()

int pntpos ( mrtk_ctx_t * ctx,
const obsd_t * obs,
int n,
const nav_t * nav,
const prcopt_t * opt,
sol_t * sol,
double * azel,
ssat_t * ssat,
char * msg )

Compute receiver position, velocity, clock bias by single-point positioning with pseudorange and doppler observables.

Parameters
[in]ctxRuntime context (NULL = use global)
[in]obsObservation data
[in]nNumber of observation data
[in]navNavigation data
[in]optProcessing options
[in,out]solSolution
[in,out]azelAzimuth/elevation angle (rad) (NULL: no output)
[in,out]ssatSatellite status (NULL: no output)
[out]msgError message for error exit
Returns
Status (1:ok, 0:error)

Definition at line 865 of file mrtk_spp.c.

References ssat_t::azel, DTTOL, estpos(), estvel(), free, prcopt_t::ionoopt, IONOOPT_BRDC, IONOOPT_IFLC, obsd_t::L, mat(), matcpy(), MAXOBS, MAXSAT, prcopt_t::mode, prcopt_t::nf, norm(), PMODE_SINGLE, prcopt_t::posopt, raim_fde(), ssat_t::resc, ssat_t::resp, sol_t::rr, obsd_t::sat, prcopt_t::sateph, satposs(), obsd_t::SNR, ssat_t::snr, SOLQ_NONE, ssat_t::sph, spp_detslp(), ssat_t::spt, sol_t::stat, prcopt_t::tdcp, prcopt_t::tdcpjump, prcopt_t::thresdop, gtime_t::time, obsd_t::time, sol_t::time, time_str(), timediff(), trace(), prcopt_t::tropopt, TROPOPT_SAAS, ssat_t::vs, and zeros().

Referenced by avepos(), rtkpos(), rtksvrthread(), and setopt_apppos().

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

◆ prange()

double prange ( const obsd_t * obs,
const nav_t * nav,
const prcopt_t * opt,
double * var )
static

Definition at line 162 of file mrtk_spp.c.

References nav_s::cbias, obsd_t::code, CODE_L1C, CODE_L1P, CODE_L2C, CODE_L2I, ERR_CBIAS, getseleph(), gettgd(), iflc_freq2_idx(), prcopt_t::ionoopt, IONOOPT_IFLC, obsd_t::P, obsd_t::sat, sat2freq(), satsys(), SQR, SYS_CMP, SYS_GAL, SYS_GLO, SYS_GPS, SYS_IRN, and SYS_QZS.

Referenced by rescode().

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

◆ raim_fde()

int raim_fde ( const obsd_t * obs,
int n,
const double * rs,
const double * dts,
const double * vare,
const int * svh,
const nav_t * nav,
const prcopt_t * opt,
sol_t * sol,
double * azel,
int * vsat,
double * resp,
char * msg )
static

Definition at line 608 of file mrtk_spp.c.

References estpos(), free, imat(), malloc, mat(), matcpy(), obsd_t::sat, satno2id(), SQR, time2str(), time_str(), trace(), and zeros().

Referenced by pntpos().

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

◆ rescode()

int rescode ( int iter,
const obsd_t * obs,
int n,
const double * rs,
const double * dts,
const double * vare,
const int * svh,
const nav_t * nav,
const double * x,
const prcopt_t * opt,
double * v,
double * H,
double * var,
double * azel,
int * vsat,
double * resp,
int * ns,
const int * outp )
static

Definition at line 256 of file mrtk_spp.c.

References CLIGHT, ecef2pos(), prcopt_t::elmin, FREQ1, geodist(), ionocorr(), prcopt_t::ionoopt, MAXOBS, MAXSAT, NT, NX, prange(), R2D, obsd_t::sat, sat2freq(), satazel(), satexclude(), satsys_bd2(), SNR_UNIT, snrmask(), SQR, SYS_BD2, SYS_CMP, SYS_GAL, SYS_GLO, SYS_IRN, SYS_QZS, obsd_t::time, time_str(), trace(), tropcorr(), prcopt_t::tropopt, and varerr().

Referenced by estpos().

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

◆ resdop()

int resdop ( const obsd_t * obs,
int n,
const double * rs,
const double * dts,
const nav_t * nav,
const double * rr,
const double * x,
const double * azel,
const int * vsat,
double err,
const ssat_t * ssat,
const int * slip,
int tdcp,
double * v,
double * H )
static

Definition at line 743 of file mrtk_spp.c.

References CLIGHT, obsd_t::D, dot(), DTTOL, ecef2pos(), ERR_TDCP, obsd_t::L, matmul(), MAXOBS, norm(), OMGE, obsd_t::sat, sat2freq(), ssat_t::sph, timediff(), trace(), and xyz2enu().

Referenced by estvel().

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

◆ snrmask()

int snrmask ( const obsd_t * obs,
const double * azel,
const prcopt_t * opt )
static

Definition at line 149 of file mrtk_spp.c.

References iflc_freq2_idx(), prcopt_t::ionoopt, IONOOPT_IFLC, obsd_t::SNR, SNR_UNIT, prcopt_t::snrmask, and testsnr().

Referenced by rescode().

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

◆ spp_detslp()

void spp_detslp ( const obsd_t * obs,
int n,
const ssat_t * ssat,
double thresdop,
int * slip )
static

Definition at line 706 of file mrtk_spp.c.

References obsd_t::D, DTTOL, obsd_t::L, obsd_t::LLI, MAXOBS, obsd_t::sat, ssat_t::sph, and timediff().

Referenced by pntpos().

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

◆ valsol()

int valsol ( const double * azel,
const int * vsat,
int n,
const prcopt_t * opt,
const double * v,
int nv,
int nx,
char * msg )
static

Definition at line 395 of file mrtk_spp.c.

References chisqr, dops(), dot(), prcopt_t::elmin, prcopt_t::ign_chierr, prcopt_t::maxgdop, MAXOBS, and trace().

Referenced by estpos().

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

◆ varerr()

double varerr ( const prcopt_t * opt,
double el,
double snr,
int sys )
static

Definition at line 82 of file mrtk_spp.c.

References EFACT_GLO, EFACT_GPS, EFACT_SBS, prcopt_t::err, prcopt_t::ionoopt, IONOOPT_IFLC, MIN_EL, SQR, SYS_GLO, and SYS_SBS.

Referenced by rescode().

Here is the caller graph for this function:

Variable Documentation

◆ chisqr

const double chisqr[100]
Initial value:
= {10.8, 13.8, 16.3, 18.5, 20.5, 22.5, 24.3, 26.1, 27.9, 29.6, 31.3, 32.9, 34.5, 36.1, 37.7,
39.3, 40.8, 42.3, 43.8, 45.3, 46.8, 48.3, 49.7, 51.2, 52.6, 54.1, 55.5, 56.9, 58.3, 59.7,
61.1, 62.5, 63.9, 65.2, 66.6, 68.0, 69.3, 70.7, 72.1, 73.4, 74.7, 76.0, 77.3, 78.6, 80.0,
81.3, 82.6, 84.0, 85.4, 86.7, 88.0, 89.3, 90.6, 91.9, 93.3, 94.7, 96.0, 97.4, 98.7, 100,
101, 102, 103, 104, 105, 107, 108, 109, 110, 112, 113, 114, 115, 116, 118,
119, 120, 122, 123, 125, 126, 127, 128, 129, 131, 132, 133, 134, 135, 137,
138, 139, 140, 142, 143, 144, 145, 147, 148, 149}

Definition at line 62 of file mrtk_spp.c.

◆ CLIGHT

const double CLIGHT = 299792458.0
static

Definition at line 30 of file mrtk_spp.c.

◆ D2R

const double D2R = 3.1415926535897932 / 180.0
static

Definition at line 31 of file mrtk_spp.c.

◆ EFACT_GLO

const double EFACT_GLO = 1.5
static

Definition at line 46 of file mrtk_spp.c.

◆ EFACT_GPS

const double EFACT_GPS = 1.0
static

Definition at line 45 of file mrtk_spp.c.

◆ EFACT_SBS

const double EFACT_SBS = 3.0
static

Definition at line 47 of file mrtk_spp.c.

◆ FREQ1

const double FREQ1 = 1.57542E9
static

Definition at line 35 of file mrtk_spp.c.

◆ FREQ1_CMP

const double FREQ1_CMP = 1.561098E9
static

Definition at line 42 of file mrtk_spp.c.

◆ FREQ1_GLO

const double FREQ1_GLO = 1.60200E9
static

Definition at line 40 of file mrtk_spp.c.

◆ FREQ2

const double FREQ2 = 1.22760E9
static

Definition at line 36 of file mrtk_spp.c.

◆ FREQ2_CMP

const double FREQ2_CMP = 1.20714E9
static

Definition at line 43 of file mrtk_spp.c.

◆ FREQ2_GLO

const double FREQ2_GLO = 1.24600E9
static

Definition at line 41 of file mrtk_spp.c.

◆ FREQ5

const double FREQ5 = 1.17645E9
static

Definition at line 37 of file mrtk_spp.c.

◆ FREQ7

const double FREQ7 = 1.20714E9
static

Definition at line 38 of file mrtk_spp.c.

◆ FREQ9

const double FREQ9 = 2.492028E9
static

Definition at line 39 of file mrtk_spp.c.

◆ OMGE

const double OMGE = 7.2921151467E-5
static

Definition at line 33 of file mrtk_spp.c.

◆ R2D

const double R2D = 180.0 / 3.1415926535897932
static

Definition at line 32 of file mrtk_spp.c.