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.3 2008/11/16 00:05:32 weber Exp $
|
---|
9 | Authors: Dirk Stöcker
|
---|
10 | Description: state space approach for RTCM3
|
---|
11 | */
|
---|
12 |
|
---|
13 | #include <string.h>
|
---|
14 |
|
---|
15 | enum SatelliteReferenceDatum { DATUM_ITRF=0, DATUM_LOCAL=1 };
|
---|
16 | enum SatelliteReferencePoint { POINT_IONOFREE=0, POINT_CENTER=1 };
|
---|
17 | enum ClockOrbitType { COTYPE_GPSORBIT=4050, COTYPE_GPSCLOCK=4051,
|
---|
18 | COTYPE_GLONASSORBIT=4053, COTYPE_GLONASSCLOCK=4054,
|
---|
19 | COTYPE_GPSCOMBINED=4056, COTYPE_GLONASSCOMBINED=4057,
|
---|
20 | COTYPE_AUTO=0 };
|
---|
21 | enum BiasType { BTYPE_GPS=4052, BTYPE_GLONASS=4055, BTYPE_AUTO = 0 };
|
---|
22 |
|
---|
23 | enum COR_CONSTANTS {
|
---|
24 | CLOCKORBIT_BUFFERSIZE=2048,
|
---|
25 | CLOCKORBIT_NUMGPS=32,
|
---|
26 | CLOCKORBIT_NUMGLONASS=24,
|
---|
27 | CLOCKORBIT_NUMBIAS=10
|
---|
28 | };
|
---|
29 |
|
---|
30 | enum CodeType {
|
---|
31 | CODETYPEGPS_L1_CA = 0,
|
---|
32 | CODETYPEGPS_L1_P = 1,
|
---|
33 | CODETYPEGPS_L1_Z = 2,
|
---|
34 | /* ... */
|
---|
35 |
|
---|
36 | CODETYPEGLONASS_L1_CA = 0,
|
---|
37 | CODETYPEGLONASS_L1_P = 1,
|
---|
38 | CODETYPEGLONASS_L2_CA = 2,
|
---|
39 | CODETYPEGLONASS_L2_P = 3,
|
---|
40 | };
|
---|
41 |
|
---|
42 | /* GLONASS data is stored with offset CLOCKORBIT_NUMGPS in the data structures.
|
---|
43 | So first GLONASS satellite is at xxx->Sat[CLOCKORBIT_NUMGPS], first
|
---|
44 | GPS satellite is xxx->Sat[0]. */
|
---|
45 |
|
---|
46 | struct ClockOrbit
|
---|
47 | {
|
---|
48 | int GPSEpochTime; /* 0 .. 604799 s */
|
---|
49 | int GLONASSEpochTime; /* 0 .. 86399 s (86400 for leap second) */
|
---|
50 | int NumberOfGPSSat; /* 0 .. 32 */
|
---|
51 | int NumberOfGLONASSSat; /* 0 .. 24 */
|
---|
52 | int ClockDataSupplied; /* boolean */
|
---|
53 | int OrbitDataSupplied; /* boolean */
|
---|
54 | int epochGPS[101]; /* Weber, for latency */
|
---|
55 | int epochSize; /* Weber, for latency */
|
---|
56 | enum SatelliteReferencePoint SatRefPoint;
|
---|
57 | enum SatelliteReferenceDatum SatRefDatum;
|
---|
58 | struct SatData {
|
---|
59 | int ID; /* GPS or GLONASS */
|
---|
60 | int IOD; /* GPS or GLONASS */
|
---|
61 | struct OrbitPart
|
---|
62 | {
|
---|
63 | double DeltaRadial; /* m */
|
---|
64 | double DeltaAlongTrack; /* m */
|
---|
65 | double DeltaCrossTrack; /* m */
|
---|
66 | double DotDeltaRadial; /* m/s */
|
---|
67 | double DotDeltaAlongTrack; /* m/s */
|
---|
68 | double DotDeltaCrossTrack; /* m/s */
|
---|
69 | double DotDotDeltaRadial; /* m/ss */
|
---|
70 | double DotDotDeltaAlongTrack; /* m/ss */
|
---|
71 | double DotDotDeltaCrossTrack; /* m/ss */
|
---|
72 | } Orbit;
|
---|
73 | struct ClockPart
|
---|
74 | {
|
---|
75 | double DeltaA0; /* m */
|
---|
76 | double DeltaA1; /* m/s */
|
---|
77 | double DeltaA2; /* m/ss */
|
---|
78 | } Clock;
|
---|
79 | } Sat[CLOCKORBIT_NUMGPS+CLOCKORBIT_NUMGLONASS];
|
---|
80 | };
|
---|
81 |
|
---|
82 | struct Bias
|
---|
83 | {
|
---|
84 | int GPSEpochTime; /* 0 .. 604799 s */
|
---|
85 | int GLONASSEpochTime; /* 0 .. 86399 s (86400 for leap second) */
|
---|
86 | int NumberOfGPSSat; /* 0 .. 32 */
|
---|
87 | int NumberOfGLONASSSat; /* 0 .. 24 */
|
---|
88 | struct BiasSat
|
---|
89 | {
|
---|
90 | int ID; /* GPS or GLONASS */
|
---|
91 | int NumberOfCodeBiases;
|
---|
92 | struct CodeBias
|
---|
93 | {
|
---|
94 | enum CodeType Type;
|
---|
95 | float Bias; /* m */
|
---|
96 | } Biases[CLOCKORBIT_NUMBIAS];
|
---|
97 | } Sat[CLOCKORBIT_NUMGPS+CLOCKORBIT_NUMGLONASS];
|
---|
98 | };
|
---|
99 |
|
---|
100 | /* return size of resulting data or 0 in case of an error */
|
---|
101 | size_t MakeClockOrbit(const struct ClockOrbit *co, enum ClockOrbitType type,
|
---|
102 | int moremessagesfollow, char *buffer, size_t size);
|
---|
103 | size_t MakeBias(const struct Bias *b, enum BiasType type,
|
---|
104 | int moremessagesfollow, char *buffer, size_t size);
|
---|
105 |
|
---|
106 | enum GCOB_RETURN {
|
---|
107 | /* all well */
|
---|
108 | GCOBR_MESSAGEFOLLOWS = 1,
|
---|
109 | GCOBR_OK = 0,
|
---|
110 | /* unknown data, a warning */
|
---|
111 | GCOBR_UNKNOWNTYPE = -1,
|
---|
112 | GCOBR_UNKNOWNDATA = -2,
|
---|
113 | GCOBR_CRCMISMATCH = -3,
|
---|
114 | /* failed to do the work */
|
---|
115 | GCOBR_NOCLOCKORBITPARAMETER = -10,
|
---|
116 | GCOBR_NOBIASPARAMETER = -11,
|
---|
117 | /* data mismatch - data in storage does not match new data */
|
---|
118 | GCOBR_TIMEMISMATCH = -20,
|
---|
119 | GCOBR_DATAMISMATCH = -21,
|
---|
120 | /* not enough data - can decode the block completely */
|
---|
121 | GCOBR_SHORTBUFFER = -30,
|
---|
122 | GCOBR_MISSINGBITS = -31,
|
---|
123 | GCOBR_MESSAGEEXCEEDSBUFFER = -32
|
---|
124 | };
|
---|
125 |
|
---|
126 | /* 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
|
---|
127 | function to have a clean state. */
|
---|
128 |
|
---|
129 | /* buffer should point to a RTCM3 block */
|
---|
130 | enum GCOB_RETURN GetClockOrbitBias(struct ClockOrbit *co, struct Bias *b,
|
---|
131 | const char *buffer, size_t size, int *bytesused);
|
---|
132 |
|
---|
133 | #endif /* RTCM3_CLOCK_ORBIT_RTCM_H */
|
---|