source: ntrip/trunk/BNC/RTCM3/clock_orbit_rtcm.h@ 2426

Last change on this file since 2426 was 2425, checked in by mervart, 15 years ago

* empty log message *

  • 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.14 2010/04/14 13:11:26 mervart 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 /* ... */
38 CODETYPEGPS_L2_P = 10,
39 CODETYPEGPS_L2_Z = 11,
40 /* ... */
41 CODETYPEGLONASS_L1_CA = 0,
42 CODETYPEGLONASS_L1_P = 1,
43 CODETYPEGLONASS_L2_CA = 2,
44 CODETYPEGLONASS_L2_P = 3,
45};
46
47#define SSR_MAXURA 5.5 /* > 5466.5mm in meter */
48
49/* GLONASS data is stored with offset CLOCKORBIT_NUMGPS in the data structures.
50So first GLONASS satellite is at xxx->Sat[CLOCKORBIT_NUMGPS], first
51GPS satellite is xxx->Sat[0]. */
52
53struct ClockOrbit
54{
55 enum ClockOrbitType messageType;
56 int GPSEpochTime; /* 0 .. 604799 s */
57 int GLONASSEpochTime; /* 0 .. 86399 s (86400 for leap second) */
58 int NumberOfGPSSat; /* 0 .. 32 */
59 int NumberOfGLONASSSat; /* 0 .. 24 */
60 int ClockDataSupplied; /* boolean */
61 int HRDataSupplied; /* boolean */
62 int OrbitDataSupplied; /* boolean */
63 int URADataSupplied; /* boolean */
64 int epochGPS[101]; /* Weber, for latency */
65 int epochSize; /* Weber, for latency */
66 int UpdateInterval;
67 enum SatelliteReferenceDatum SatRefDatum;
68 struct SatData {
69 int ID; /* GPS or GLONASS */
70 int IOD; /* GPS or GLONASS */
71 double UserRangeAccuracy; /* accuracy values in [m] */
72 double hrclock;
73 struct OrbitPart
74 {
75 double DeltaRadial; /* m */
76 double DeltaAlongTrack; /* m */
77 double DeltaCrossTrack; /* m */
78 double DotDeltaRadial; /* m/s */
79 double DotDeltaAlongTrack; /* m/s */
80 double DotDeltaCrossTrack; /* m/s */
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 enum BiasType messageType;
94 int GPSEpochTime; /* 0 .. 604799 s */
95 int GLONASSEpochTime; /* 0 .. 86399 s (86400 for leap second) */
96 int NumberOfGPSSat; /* 0 .. 32 */
97 int NumberOfGLONASSSat; /* 0 .. 24 */
98 int UpdateInterval;
99 struct BiasSat
100 {
101 int ID; /* GPS or GLONASS */
102 int NumberOfCodeBiases;
103 struct CodeBias
104 {
105 enum CodeType Type;
106 float Bias; /* m */
107 } Biases[CLOCKORBIT_NUMBIAS];
108 } Sat[CLOCKORBIT_NUMGPS+CLOCKORBIT_NUMGLONASS];
109};
110
111/* return size of resulting data or 0 in case of an error */
112size_t MakeClockOrbit(const struct ClockOrbit *co, enum ClockOrbitType type,
113 int moremessagesfollow, char *buffer, size_t size);
114size_t MakeBias(const struct Bias *b, enum BiasType type,
115 int moremessagesfollow, char *buffer, size_t size);
116
117enum GCOB_RETURN {
118 /* all well */
119 GCOBR_MESSAGEFOLLOWS = 1,
120 GCOBR_OK = 0,
121 /* unknown data, a warning */
122 GCOBR_UNKNOWNTYPE = -1,
123 GCOBR_UNKNOWNDATA = -2,
124 GCOBR_CRCMISMATCH = -3,
125 GCOBR_SHORTMESSAGE = -4,
126 /* failed to do the work */
127 GCOBR_NOCLOCKORBITPARAMETER = -10,
128 GCOBR_NOBIASPARAMETER = -11,
129 /* data mismatch - data in storage does not match new data */
130 GCOBR_TIMEMISMATCH = -20,
131 GCOBR_DATAMISMATCH = -21,
132 /* not enough data - can decode the block completely */
133 GCOBR_SHORTBUFFER = -30,
134 GCOBR_MESSAGEEXCEEDSBUFFER = -31};
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.