MRTKLIB 0.7.14
Modernized GNSS Positioning Library
Loading...
Searching...
No Matches
mrtk_madoca_local_comb.h
Go to the documentation of this file.
1/*------------------------------------------------------------------------------
2 * mrtk_madoca_local_comb.h : MADOCA local correction data combination 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_madoca_local_comb.h
18 * @brief MRTKLIB MADOCA Local Combination Module — local correction data
19 * combination functions.
20 *
21 * This header provides functions for combining local tropospheric and
22 * ionospheric correction data (grid interpolation, station selection,
23 * and RTCM3 output), extracted from lclcmbcmn.c with zero algorithmic
24 * changes.
25 *
26 * @note Functions declared here are implemented in mrtk_madoca_local_comb.c.
27 */
28#ifndef MRTK_MADOCA_LOCAL_COMB_H
29#define MRTK_MADOCA_LOCAL_COMB_H
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
37#include "mrtklib/mrtk_nav.h"
38#include "mrtklib/mrtk_rtcm.h"
39#include "mrtklib/mrtk_stream.h"
40#include "mrtklib/mrtk_time.h"
41
42/*============================================================================
43 * Input Monitor Stream Type
44 *===========================================================================*/
45
46typedef struct { /* input monitor stream type */
47 char sta[32]; /* station */
48 int fmt; /* format */
49 int stat; /* input stream status */
50 int dis; /* disable flag */
51 int type_str; /* input stream type */
52 int type_log; /* log stream type */
53 char path_str[MAXSTRPATH]; /* input stream path */
54 char path_log[MAXSTRPATH]; /* log stream path */
55 stream_t str; /* input stream */
56 stream_t log; /* log stream */
57 gtime_t tcon; /* connect time */
58 gtime_t time; /* time tag of last stat data */
59 unsigned int cnt; /* input data count {stat} */
60 sstat_t sstat; /* stat correction */
61 uint8_t buff[4096]; /* stat message buffer */
62 int nbyte; /* number of stat message */
63 double rr[3]; /* position(ecef) */
64} instat_t;
65
66/*============================================================================
67 * Stream Local Combination Server Type
68 *===========================================================================*/
69
70typedef struct { /* stream local combination server */
71 gtime_t ts; /* update time */
72 int btype; /* block type */
73 int state; /* state (0:stop,1:run) */
74 int navsys; /* system nav data */
75 int ninp; /* number of input monitor streams */
76 unsigned int cnt; /* count {rtcm} */
77 instat_t ins[MAXSITES]; /* input stat streams */
78 stat_t stat; /* input of iono/trop corrections */
79 rtcm_t rtcm; /* output of iono/trop corrections */
80 stream_t ostr; /* output stream for combined data */
81 stream_t olog; /* log stream for combined data */
82 rtk_thread_t thread; /* server thread */
83 rtk_lock_t lock; /* mutex for lock */
85
86/*============================================================================
87 * Local Correction Data Combination Functions
88 *===========================================================================*/
89
90/**
91 * @brief Initialize grid/station settings from a specified file.
92 * @param[in] setfile Grid/station setting file path
93 * @param[in,out] lclblk Local block information struct
94 * @param[in] btype Block type (BTYPE_GRID or BTYPE_STA)
95 * @return Status (0: error, 1: success)
96 */
97int initgridsta(const char* setfile, lclblock_t* lclblk, int btype);
98
99/**
100 * @brief Interpolate tropospheric grid data.
101 * @param[in] gt Time
102 * @param[in] stat Station data
103 * @param[in,out] lclblk Local block information
104 */
105void grid_intp_trop(const gtime_t gt, const stat_t* stat, lclblock_t* lclblk);
106
107/**
108 * @brief Select and assign tropospheric data blocks based on station positions.
109 * @param[in] time Time
110 * @param[in] stat Station data
111 * @param[in,out] lslblk Local block information struct
112 */
113void sta_sel_trop(const gtime_t time, const stat_t* stat, lclblock_t* lslblk);
114
115/**
116 * @brief Interpolate ionospheric grid data.
117 * @param[in] gt Time
118 * @param[in] stat Station data
119 * @param[in,out] lclblk Local block information struct
120 * @param[in] maxres Maximum residual
121 * @param[out] nrej Number of rejections
122 * @param[out] ncnt Number of counts
123 */
124void grid_intp_iono(const gtime_t gt, const stat_t* stat, lclblock_t* lclblk, double maxres, int* nrej, int* ncnt);
125
126/**
127 * @brief Select and assign ionospheric data blocks based on station positions.
128 * @param[in] gt Time
129 * @param[in] stat Station data
130 * @param[in,out] lslblk Local block information struct
131 */
132void sta_sel_iono(const gtime_t gt, const stat_t* stat, lclblock_t* lslblk);
133
134/**
135 * @brief Generate and output RTCM3 local combination correction messages.
136 * @param[in,out] rtcm RTCM control struct
137 * @param[in] btype Block type (BTYPE_GRID or BTYPE_STA)
138 * @param[in] ostr Output stream
139 */
140void output_lclcmb(rtcm_t* rtcm, int btype, stream_t* ostr);
141
142#ifdef __cplusplus
143}
144#endif
145
146#endif /* MRTK_MADOCA_LOCAL_COMB_H */
MRTKLIB Foundation — Common types, standard includes, and system constants (MAXSAT,...
#define MAXSTRPATH
#define rtk_thread_t
#define MAXSITES
#define rtk_lock_t
void output_lclcmb(rtcm_t *rtcm, int btype, stream_t *ostr)
Generate and output RTCM3 local combination correction messages.
void grid_intp_trop(const gtime_t gt, const stat_t *stat, lclblock_t *lclblk)
Interpolate tropospheric grid data.
int initgridsta(const char *setfile, lclblock_t *lclblk, int btype)
Initialize grid/station settings from a specified file.
void sta_sel_trop(const gtime_t time, const stat_t *stat, lclblock_t *lslblk)
Select and assign tropospheric data blocks based on station positions.
void grid_intp_iono(const gtime_t gt, const stat_t *stat, lclblock_t *lclblk, double maxres, int *nrej, int *ncnt)
Interpolate ionospheric grid data.
void sta_sel_iono(const gtime_t gt, const stat_t *stat, lclblock_t *lslblk)
Select and assign ionospheric data blocks based on station positions.
MRTKLIB MADOCA Local Correction Module — local correction common functions and constants.
MRTKLIB Navigation Module — Navigation data types and satellite/nav utility functions.
static rtcm_t * rtcm
MRTKLIB RTCM Module — RTCM message types and functions.
MRTKLIB Stream Module — stream I/O abstraction layer.
struct stream_tag stream_t
MRTKLIB Time Module — GNSS time types and conversion functions.
GNSS time representation.
Definition mrtk_time.h:49
uint8_t buff[4096]
char path_log[MAXSTRPATH]
unsigned int cnt
char path_str[MAXSTRPATH]
instat_t ins[MAXSITES]
RTCM control struct type.
Definition mrtk_rtcm.h:50