source: ntrip/trunk/clock_and_orbit/lib/clock_orbit_rtcm.h@ 3520

Last change on this file since 3520 was 3511, checked in by stoecker, 13 years ago

update to final standard

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 5.0 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 3511 2011-11-25 11:16:34Z stoecker $
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 SSRIOD;
75 int SSRProviderID;
76 int SSRSolutionID;
77 int UpdateInterval;
78 enum SatelliteReferenceDatum SatRefDatum;
79 struct SatData {
80 int ID; /* GPS or GLONASS */
81 int IOD; /* GPS or GLONASS */
82 double UserRangeAccuracy; /* accuracy values in [m] */
83 double hrclock;
84 struct OrbitPart
85 {
86 double DeltaRadial; /* m */
87 double DeltaAlongTrack; /* m */
88 double DeltaCrossTrack; /* m */
89 double DotDeltaRadial; /* m/s */
90 double DotDeltaAlongTrack; /* m/s */
91 double DotDeltaCrossTrack; /* m/s */
92 } Orbit;
93 struct ClockPart
94 {
95 double DeltaA0; /* m */
96 double DeltaA1; /* m/s */
97 double DeltaA2; /* m/ss */
98 } Clock;
99 } Sat[CLOCKORBIT_NUMGPS+CLOCKORBIT_NUMGLONASS];
100};
101
102struct Bias
103{
104 enum BiasType messageType;
105 int GPSEpochTime; /* 0 .. 604799 s */
106 int GLONASSEpochTime; /* 0 .. 86399 s (86400 for leap second) */
107 int NumberOfGPSSat; /* 0 .. 32 */
108 int NumberOfGLONASSSat; /* 0 .. 24 */
109 int UpdateInterval;
110 int SSRIOD;
111 int SSRProviderID;
112 int SSRSolutionID;
113 struct BiasSat
114 {
115 int ID; /* GPS or GLONASS */
116 int NumberOfCodeBiases;
117 struct CodeBias
118 {
119 enum CodeType Type;
120 float Bias; /* m */
121 } Biases[CLOCKORBIT_NUMBIAS];
122 } Sat[CLOCKORBIT_NUMGPS+CLOCKORBIT_NUMGLONASS];
123};
124
125/* return size of resulting data or 0 in case of an error */
126size_t MakeClockOrbit(const struct ClockOrbit *co, enum ClockOrbitType type,
127 int moremessagesfollow, char *buffer, size_t size);
128size_t MakeBias(const struct Bias *b, enum BiasType type,
129 int moremessagesfollow, char *buffer, size_t size);
130
131enum GCOB_RETURN {
132 /* all well */
133 GCOBR_MESSAGEFOLLOWS = 1,
134 GCOBR_OK = 0,
135 /* unknown data, a warning */
136 GCOBR_UNKNOWNTYPE = -1,
137 GCOBR_UNKNOWNDATA = -2,
138 GCOBR_CRCMISMATCH = -3,
139 GCOBR_SHORTMESSAGE = -4,
140 /* failed to do the work */
141 GCOBR_NOCLOCKORBITPARAMETER = -10,
142 GCOBR_NOBIASPARAMETER = -11,
143 /* data mismatch - data in storage does not match new data */
144 GCOBR_TIMEMISMATCH = -20,
145 GCOBR_DATAMISMATCH = -21,
146 /* not enough data - can decode the block completely */
147 GCOBR_SHORTBUFFER = -30,
148 GCOBR_MESSAGEEXCEEDSBUFFER = -31};
149
150/* 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
151function to have a clean state. */
152
153/* buffer should point to a RTCM3 block */
154enum GCOB_RETURN GetClockOrbitBias(struct ClockOrbit *co, struct Bias *b,
155 const char *buffer, size_t size, int *bytesused);
156
157#endif /* RTCM3_CLOCK_ORBIT_RTCM_H */
Note: See TracBrowser for help on using the repository browser.