source: ntrip/trunk/clock_and_orbit/clock_orbit_rtcm.h@ 1747

Last change on this file since 1747 was 1581, checked in by stoecker, 16 years ago

updated to new version december 2008

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