MRTKLIB 0.7.14
Modernized GNSS Positioning Library
Loading...
Searching...
No Matches
mrtk_bias_sinex.h
Go to the documentation of this file.
1/*------------------------------------------------------------------------------
2 * mrtk_bias_sinex.h : BIAS-SINEX type definitions and functions
3 *
4 * Copyright (C) 2026 H.SHIONO (MRTKLIB Project)
5 * Copyright (C) 2023-2025 Cabinet Office, Japan
6 * Copyright (C) 2024-2025 Lighthouse Technology & Consulting Co. Ltd.
7 * Copyright (C) 2023-2025 Japan Aerospace Exploration Agency
8 * Copyright (C) 2023-2025 TOSHIBA ELECTRONIC TECHNOLOGIES CORPORATION
9 * Copyright (C) 2015- Mitsubishi Electric Corp.
10 * Copyright (C) 2014 Geospatial Information Authority of Japan
11 * Copyright (C) 2014 T.SUZUKI
12 * Copyright (C) 2007-2023 T.TAKASU
13 *
14 * SPDX-License-Identifier: BSD-2-Clause
15 *----------------------------------------------------------------------------*/
16/**
17 * @file mrtk_bias_sinex.h
18 * @brief MRTKLIB Bias SINEX Module — BIAS-SINEX data types and I/O functions.
19 *
20 * This header provides the BIAS-SINEX data structures (bia_t, biasat_t,
21 * biasta_t, biass_t) and all related I/O and update functions, extracted
22 * from rtklib.h and biassnx.c with zero algorithmic changes.
23 *
24 * @note Functions declared here are implemented in mrtk_bias_sinex.c.
25 */
26#ifndef MRTK_BIAS_SINEX_H
27#define MRTK_BIAS_SINEX_H
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33#include <stdio.h>
34
36#include "mrtklib/mrtk_nav.h"
37#include "mrtklib/mrtk_time.h"
38
39/*============================================================================
40 * Bias Data Types
41 *===========================================================================*/
42
43typedef struct { /* BIAS data record type */
44 int type; /* bias type(0:DSB,1:ISB,2:OSB)*/
45 gtime_t t0, t1; /* start, end time */
46 int code[2]; /* signal CODE_xxx */
47 double val, valstd; /* estimated value, std */
48 double slp, slpstd; /* estimated slope, std */
49} bia_t;
50
51typedef struct { /* satellite BIAS data record type */
52 int ncb[MAXSAT], ncbmax[MAXSAT]; /* number of code biases */
53 int rcb[MAXSAT]; /* bookmark of code biases */
54 int npb[MAXSAT], npbmax[MAXSAT]; /* number of phase biases */
55 int rpb[MAXSAT]; /* bookmark of phase biases */
56 bia_t* cb[MAXSAT]; /* code biases data record */
57 bia_t* pb[MAXSAT]; /* phase biases data record */
58} biasat_t;
59
60typedef struct { /* station BIAS data record type */
61 char name[10]; /* station name */
62 int nsyscb[MAXBSNXSYS], nsyscbmax[MAXBSNXSYS]; /* number of system code biases */
63 int rsyscb[MAXBSNXSYS]; /* bookmark of system code biases */
64 int nsatcb[MAXSAT], nsatcbmax[MAXSAT]; /* number of satellite code biases */
65 int rsatcb[MAXSAT]; /* bookmark of satellite code biases */
66 bia_t* syscb[MAXBSNXSYS]; /* system code biases data record */
67 bia_t* satcb[MAXSAT]; /* satellite code biases data record */
68} biasta_t;
69
70typedef struct { /* BIAS-SINEX data type */
71 int nsta; /* number of stations */
72 biasat_t sat; /* satellite biases data record */
73 biasta_t sta[MAXSTA]; /* station biases data record */
74 int refcode[MAXBSNXSYS][2]; /* reference observables */
75} biass_t;
76
77/*============================================================================
78 * Bias SINEX Functions
79 *===========================================================================*/
80
81/**
82 * @brief Get system code number based on satellite number.
83 * @param[in] sat Satellite number
84 * @return System code number (0 or positive: valid, -1: error)
85 */
86int getsysno(int sat);
87
88/**
89 * @brief Get pointer to the bias structure.
90 * @return Pointer to bias structure
91 */
92biass_t* getbiass(void);
93
94/**
95 * @brief Add a bias entry to the bias array.
96 * @param[in] bia Bias entry to add
97 * @param[out] ary Pointer to bias array
98 * @param[out] n Current number of entries in array
99 * @param[out] nmax Current maximum number of entries in array
100 */
101void addbia(const bia_t* bia, bia_t** ary, int* n, int* nmax);
102
103/**
104 * @brief Read BIAS-SINEX file.
105 * @param[in] file SINEX file path
106 * @return Number of biases read (0: error)
107 */
108int readbsnx(const char* file);
109
110/**
111 * @brief Output BIAS-SINEX file header.
112 * @param[in] fp Output file pointer
113 * @param[in] ts Start time
114 * @param[in] te End time
115 * @param[in] agency Agency name
116 */
117void outbsnxh(FILE* fp, gtime_t ts, gtime_t te, const char* agency);
118
119/**
120 * @brief Output FILE/REFERENCE header.
121 * @param[in] fp Output file pointer
122 */
123void outbsnxrefh(FILE* fp);
124
125/**
126 * @brief Output FILE/REFERENCE body line.
127 * @param[in] fp Output file pointer
128 * @param[in] type Type of information
129 * @param[in] reftext Reference text to output
130 */
131void outbsnxrefb(FILE* fp, int type, char* reftext);
132
133/**
134 * @brief Output FILE/REFERENCE footer.
135 * @param[in] fp Output file pointer
136 */
137void outbsnxreff(FILE* fp);
138
139/**
140 * @brief Output FILE/COMMENT header.
141 * @param[in] fp Output file pointer
142 */
143void outbsnxcomh(FILE* fp);
144
145/**
146 * @brief Output FILE/COMMENT body line.
147 * @param[in] fp Output file pointer
148 * @param[in] comtext Comment text to output
149 */
150void outbsnxcomb(FILE* fp, char* comtext);
151
152/**
153 * @brief Output FILE/COMMENT footer.
154 * @param[in] fp Output file pointer
155 */
156void outbsnxcomf(FILE* fp);
157
158/**
159 * @brief Output BIAS/SOLUTION section.
160 * @param[in] fp Output file pointer
161 */
162void outbsnxsol(FILE* fp);
163
164/**
165 * @brief Update satellite OSB structure with current biases.
166 * @param[out] osb OSB structure to update
167 * @param[in] gt Current time
168 * @param[in] mode Mode (0: current, 1: all)
169 * @return Number of updated biases
170 */
171int udosb_sat(osb_t* osb, gtime_t gt, int mode);
172
173/**
174 * @brief Update station OSB structure with current biases.
175 * @param[out] osb OSB structure to update
176 * @param[in] gt Current time
177 * @param[in] mode Mode (0: current, 1: all)
178 * @param[in] name Station name
179 * @return Number of updated biases
180 */
181int udosb_station(osb_t* osb, gtime_t gt, int mode, char* name);
182
183#ifdef __cplusplus
184}
185#endif
186
187#endif /* MRTK_BIAS_SINEX_H */
void outbsnxrefb(FILE *fp, int type, char *reftext)
Output FILE/REFERENCE body line.
biass_t * getbiass(void)
Get pointer to the bias structure.
void outbsnxh(FILE *fp, gtime_t ts, gtime_t te, const char *agency)
Output BIAS-SINEX file header.
void outbsnxcomb(FILE *fp, char *comtext)
Output FILE/COMMENT body line.
void outbsnxreff(FILE *fp)
Output FILE/REFERENCE footer.
int udosb_station(osb_t *osb, gtime_t gt, int mode, char *name)
Update station OSB structure with current biases.
void outbsnxrefh(FILE *fp)
Output FILE/REFERENCE header.
int getsysno(int sat)
Get system code number based on satellite number.
void outbsnxcomf(FILE *fp)
Output FILE/COMMENT footer.
void outbsnxsol(FILE *fp)
Output BIAS/SOLUTION section.
int readbsnx(const char *file)
Read BIAS-SINEX file.
void outbsnxcomh(FILE *fp)
Output FILE/COMMENT header.
int udosb_sat(osb_t *osb, gtime_t gt, int mode)
Update satellite OSB structure with current biases.
void addbia(const bia_t *bia, bia_t **ary, int *n, int *nmax)
Add a bias entry to the bias array.
#define MAXSAT
Definition mrtk_coords.c:45
MRTKLIB Foundation — Common types, standard includes, and system constants (MAXSAT,...
#define MAXSTA
#define MAXBSNXSYS
MRTKLIB Navigation Module — Navigation data types and satellite/nav utility functions.
MRTKLIB Time Module — GNSS time types and conversion functions.
double slp
double val
gtime_t t0
int code[2]
double valstd
gtime_t t1
double slpstd
int rcb[MAXSAT]
int rpb[MAXSAT]
int npb[MAXSAT]
int ncbmax[MAXSAT]
int ncb[MAXSAT]
int npbmax[MAXSAT]
bia_t * pb[MAXSAT]
bia_t * cb[MAXSAT]
int refcode[MAXBSNXSYS][2]
biasta_t sta[MAXSTA]
biasat_t sat
int nsyscbmax[MAXBSNXSYS]
int nsyscb[MAXBSNXSYS]
int nsatcbmax[MAXSAT]
int nsatcb[MAXSAT]
bia_t * satcb[MAXSAT]
int rsyscb[MAXBSNXSYS]
int rsatcb[MAXSAT]
bia_t * syscb[MAXBSNXSYS]
char name[10]
GNSS time representation.
Definition mrtk_time.h:49