source: ntrip/trunk/BNS/RTCM/clock_orbit_rtcm.h@ 2452

Last change on this file since 2452 was 2433, checked in by mervart, 15 years ago

* empty log message *

  • Property svn:executable set to *
File size: 4.9 KB
Line 
1#ifndef RTCM3_CLOCK_ORBIT_RTCM_H
2#define RTCM3_CLOCK_ORBIT_RTCM_H
3
4/* Programheader
5
6 Name: clock_orbit_rtcm.h
7 Project: RTCM3
8 Version: $Id: clock_orbit_rtcm.h,v 1.9 2010/04/16 06:14:00 stoecker Exp $
9 Authors: Dirk Stöcker
10 Description: state space approach for RTCM3
11*/
12
13#include <string.h>
14
15enum SatelliteReferenceDatum { DATUM_ITRF=0, DATUM_LOCAL=1 };
16enum ClockOrbitType {
17 COTYPE_GPSORBIT=1057, COTYPE_GPSCLOCK=1058,
18 COTYPE_GPSCOMBINED=1060, COTYPE_GPSURA=1061, COTYPE_GPSHR=1062,
19
20 COTYPE_GLONASSORBIT=1063, COTYPE_GLONASSCLOCK=1064,
21 COTYPE_GLONASSCOMBINED=1066, COTYPE_GLONASSURA=1067, COTYPE_GLONASSHR=1068,
22
23 COTYPE_AUTO=0 };
24enum BiasType { BTYPE_GPS=1059, BTYPE_GLONASS=1065, BTYPE_AUTO = 0 };
25
26enum COR_CONSTANTS {
27 CLOCKORBIT_BUFFERSIZE=2048,
28 CLOCKORBIT_NUMGPS=32,
29 CLOCKORBIT_NUMGLONASS=24,
30 CLOCKORBIT_NUMBIAS=10
31};
32
33enum CodeType {
34 CODETYPEGPS_L1_CA = 0,
35 CODETYPEGPS_L1_P = 1,
36 CODETYPEGPS_L1_Z = 2,
37 CODETYPEGPS_SEMI_CODELESS = 6,
38 CODETYPEGPS_L2_CM = 7,
39 CODETYPEGPS_L2_CL = 8,
40 CODETYPEGPS_L2_CML = 9,
41 CODETYPEGPS_L2_P = 10,
42 CODETYPEGPS_L2_Z = 11,
43 CODETYPEGPS_L2_Y = 12,
44 CODETYPEGPS_L2_M = 13,
45 CODETYPEGPS_L2_I = 14,
46 CODETYPEGPS_L2_Q = 15,
47 CODETYPEGPS_L2_IQ = 16,
48
49 CODETYPEGLONASS_L1_CA = 0,
50 CODETYPEGLONASS_L1_P = 1,
51 CODETYPEGLONASS_L2_CA = 2,
52 CODETYPEGLONASS_L2_P = 3,
53};
54
55#define SSR_MAXURA 5.5 /* > 5466.5mm in meter */
56
57/* GLONASS data is stored with offset CLOCKORBIT_NUMGPS in the data structures.
58So first GLONASS satellite is at xxx->Sat[CLOCKORBIT_NUMGPS], first
59GPS satellite is xxx->Sat[0]. */
60
61struct ClockOrbit
62{
63 enum ClockOrbitType messageType;
64 int GPSEpochTime; /* 0 .. 604799 s */
65 int GLONASSEpochTime; /* 0 .. 86399 s (86400 for leap second) */
66 int NumberOfGPSSat; /* 0 .. 32 */
67 int NumberOfGLONASSSat; /* 0 .. 24 */
68 int ClockDataSupplied; /* boolean */
69 int HRDataSupplied; /* boolean */
70 int OrbitDataSupplied; /* boolean */
71 int URADataSupplied; /* boolean */
72 int epochGPS[101]; /* Weber, for latency */
73 int epochSize; /* Weber, for latency */
74 int UpdateInterval;
75 enum SatelliteReferenceDatum SatRefDatum;
76 struct SatData {
77 int ID; /* GPS or GLONASS */
78 int IOD; /* GPS or GLONASS */
79 double UserRangeAccuracy; /* accuracy values in [m] */
80 double hrclock;
81 struct OrbitPart
82 {
83 double DeltaRadial; /* m */
84 double DeltaAlongTrack; /* m */
85 double DeltaCrossTrack; /* m */
86 double DotDeltaRadial; /* m/s */
87 double DotDeltaAlongTrack; /* m/s */
88 double DotDeltaCrossTrack; /* m/s */
89 } Orbit;
90 struct ClockPart
91 {
92 double DeltaA0; /* m */
93 double DeltaA1; /* m/s */
94 double DeltaA2; /* m/ss */
95 } Clock;
96 } Sat[CLOCKORBIT_NUMGPS+CLOCKORBIT_NUMGLONASS];
97};
98
99struct Bias
100{
101 enum BiasType messageType;
102 int GPSEpochTime; /* 0 .. 604799 s */
103 int GLONASSEpochTime; /* 0 .. 86399 s (86400 for leap second) */
104 int NumberOfGPSSat; /* 0 .. 32 */
105 int NumberOfGLONASSSat; /* 0 .. 24 */
106 int UpdateInterval;
107 struct BiasSat
108 {
109 int ID; /* GPS or GLONASS */
110 int NumberOfCodeBiases;
111 struct CodeBias
112 {
113 enum CodeType Type;
114 float Bias; /* m */
115 } Biases[CLOCKORBIT_NUMBIAS];
116 } Sat[CLOCKORBIT_NUMGPS+CLOCKORBIT_NUMGLONASS];
117};
118
119/* return size of resulting data or 0 in case of an error */
120size_t MakeClockOrbit(const struct ClockOrbit *co, enum ClockOrbitType type,
121 int moremessagesfollow, char *buffer, size_t size);
122size_t MakeBias(const struct Bias *b, enum BiasType type,
123 int moremessagesfollow, char *buffer, size_t size);
124
125enum GCOB_RETURN {
126 /* all well */
127 GCOBR_MESSAGEFOLLOWS = 1,
128 GCOBR_OK = 0,
129 /* unknown data, a warning */
130 GCOBR_UNKNOWNTYPE = -1,
131 GCOBR_UNKNOWNDATA = -2,
132 GCOBR_CRCMISMATCH = -3,
133 GCOBR_SHORTMESSAGE = -4,
134 /* failed to do the work */
135 GCOBR_NOCLOCKORBITPARAMETER = -10,
136 GCOBR_NOBIASPARAMETER = -11,
137 /* data mismatch - data in storage does not match new data */
138 GCOBR_TIMEMISMATCH = -20,
139 GCOBR_DATAMISMATCH = -21,
140 /* not enough data - can decode the block completely */
141 GCOBR_SHORTBUFFER = -30,
142 GCOBR_MESSAGEEXCEEDSBUFFER = -31};
143
144/* NOTE: When an error message has been emitted, the output structures may have been modified. Make a copy of the previous variant before calling the
145function to have a clean state. */
146
147/* buffer should point to a RTCM3 block */
148enum GCOB_RETURN GetClockOrbitBias(struct ClockOrbit *co, struct Bias *b,
149 const char *buffer, size_t size, int *bytesused);
150
151#endif /* RTCM3_CLOCK_ORBIT_RTCM_H */
Note: See TracBrowser for help on using the repository browser.