[956] | 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
|
---|
[1842] | 8 | Version: $Id: clock_orbit_rtcm.h,v 1.11 2009/05/14 13:24:13 stoecker Exp $
|
---|
[956] | 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 };
|
---|
[1581] | 17 | enum ClockOrbitType {
|
---|
[1840] | 18 | COTYPE_GPSORBIT=1057, COTYPE_GPSCLOCK=1058,
|
---|
| 19 | COTYPE_GPSCOMBINED=1060, COTYPE_GPSURA=1061, COTYPE_GPSHR=1062,
|
---|
[1581] | 20 |
|
---|
[1840] | 21 | COTYPE_GLONASSORBIT=1063, COTYPE_GLONASSCLOCK=1064,
|
---|
| 22 | COTYPE_GLONASSCOMBINED=1066, COTYPE_GLONASSURA=1067, COTYPE_GLONASSHR=1068,
|
---|
[1581] | 23 |
|
---|
[956] | 24 | COTYPE_AUTO=0 };
|
---|
[1840] | 25 | enum BiasType { BTYPE_GPS=1059, BTYPE_GLONASS=1065, BTYPE_AUTO = 0 };
|
---|
[956] | 26 |
|
---|
| 27 | enum COR_CONSTANTS {
|
---|
| 28 | CLOCKORBIT_BUFFERSIZE=2048,
|
---|
| 29 | CLOCKORBIT_NUMGPS=32,
|
---|
| 30 | CLOCKORBIT_NUMGLONASS=24,
|
---|
| 31 | CLOCKORBIT_NUMBIAS=10
|
---|
| 32 | };
|
---|
| 33 |
|
---|
| 34 | enum 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.
|
---|
| 47 | So first GLONASS satellite is at xxx->Sat[CLOCKORBIT_NUMGPS], first
|
---|
| 48 | GPS satellite is xxx->Sat[0]. */
|
---|
| 49 |
|
---|
| 50 | struct 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 */
|
---|
[1581] | 57 | int HRDataSupplied; /* boolean */
|
---|
[956] | 58 | int OrbitDataSupplied; /* boolean */
|
---|
[1581] | 59 | int URADataSupplied; /* boolean */
|
---|
[1238] | 60 | int epochGPS[101]; /* Weber, for latency */
|
---|
| 61 | int epochSize; /* Weber, for latency */
|
---|
[1581] | 62 | int UpdateInterval;
|
---|
[956] | 63 | enum SatelliteReferencePoint SatRefPoint;
|
---|
| 64 | enum SatelliteReferenceDatum SatRefDatum;
|
---|
| 65 | struct SatData {
|
---|
| 66 | int ID; /* GPS or GLONASS */
|
---|
| 67 | int IOD; /* GPS or GLONASS */
|
---|
[1581] | 68 | int URA;
|
---|
| 69 | double hrclock;
|
---|
[956] | 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 |
|
---|
| 91 | struct 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 */
|
---|
[1581] | 97 | int UpdateInterval;
|
---|
[956] | 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 */
|
---|
| 111 | size_t MakeClockOrbit(const struct ClockOrbit *co, enum ClockOrbitType type,
|
---|
| 112 | int moremessagesfollow, char *buffer, size_t size);
|
---|
| 113 | size_t MakeBias(const struct Bias *b, enum BiasType type,
|
---|
| 114 | int moremessagesfollow, char *buffer, size_t size);
|
---|
| 115 |
|
---|
| 116 | enum 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,
|
---|
[1842] | 124 | GCOBR_SHORTMESSAGE = -4,
|
---|
[956] | 125 | /* failed to do the work */
|
---|
| 126 | GCOBR_NOCLOCKORBITPARAMETER = -10,
|
---|
| 127 | GCOBR_NOBIASPARAMETER = -11,
|
---|
| 128 | /* data mismatch - data in storage does not match new data */
|
---|
| 129 | GCOBR_TIMEMISMATCH = -20,
|
---|
| 130 | GCOBR_DATAMISMATCH = -21,
|
---|
| 131 | /* not enough data - can decode the block completely */
|
---|
| 132 | GCOBR_SHORTBUFFER = -30,
|
---|
[1842] | 133 | GCOBR_MESSAGEEXCEEDSBUFFER = -31};
|
---|
[956] | 134 |
|
---|
| 135 | /* 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
|
---|
| 136 | function to have a clean state. */
|
---|
| 137 |
|
---|
| 138 | /* buffer should point to a RTCM3 block */
|
---|
| 139 | enum GCOB_RETURN GetClockOrbitBias(struct ClockOrbit *co, struct Bias *b,
|
---|
| 140 | const char *buffer, size_t size, int *bytesused);
|
---|
| 141 |
|
---|
| 142 | #endif /* RTCM3_CLOCK_ORBIT_RTCM_H */
|
---|