source: ntrip/trunk/BNC/src/RTCM3/ephEncoder.cpp@ 9313

Last change on this file since 9313 was 9002, checked in by stuerze, 4 years ago

minor changes

File size: 17.1 KB
RevLine 
[5852]1
2#include "ephEncoder.h"
[6139]3
[5852]4using namespace std;
5
6
7// build up RTCM3 for GPS
8////////////////////////////////////////////////////////////////////////////
9int t_ephEncoder::RTCM3(const t_ephGPS& eph, unsigned char *buffer) {
10
11 unsigned char *startbuffer = buffer;
12 buffer= buffer+3;
13 int size = 0;
14 int numbits = 0;
15 unsigned long long bitbuffer = 0;
[6819]16 int ura = indexFromAccuracy(eph._ura, eph.type());
[8853]17 int L5Flag, SFlag, fitIntervalFlag;
[8812]18
[6814]19 if (eph.type() == t_eph::QZSS) {
20 GPSADDBITS(12, 1044)
[8812]21 GPSADDBITS(4, eph._prn.number())
[6819]22 GPSADDBITS(16, static_cast<int>(eph._TOC.gpssec())>>4)
[8812]23 GPSADDBITSFLOAT(8, eph._clock_driftrate, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<25))
24 GPSADDBITSFLOAT(16, eph._clock_drift, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<13))
25 GPSADDBITSFLOAT(22, eph._clock_bias, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<1))
[6819]26 GPSADDBITS(8, eph._IODE)
27 GPSADDBITSFLOAT(16, eph._Crs, 1.0/static_cast<double>(1<<5))
[8812]28 GPSADDBITSFLOAT(16, eph._Delta_n, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<13))
[6819]29 GPSADDBITSFLOAT(32, eph._M0, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<1))
30 GPSADDBITSFLOAT(16, eph._Cuc, 1.0/static_cast<double>(1<<29))
31 GPSADDBITSFLOAT(32, eph._e, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<3))
32 GPSADDBITSFLOAT(16, eph._Cus, 1.0/static_cast<double>(1<<29))
33 GPSADDBITSFLOAT(32, eph._sqrt_A, 1.0/static_cast<double>(1<<19))
34 GPSADDBITS(16, static_cast<int>(eph._TOEsec)>>4)
35 GPSADDBITSFLOAT(16, eph._Cic, 1.0/static_cast<double>(1<<29))
[8812]36 GPSADDBITSFLOAT(32, eph._OMEGA0, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<1))
[6819]37 GPSADDBITSFLOAT(16, eph._Cis, 1.0/static_cast<double>(1<<29))
38 GPSADDBITSFLOAT(32, eph._i0, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<1))
39 GPSADDBITSFLOAT(16, eph._Crc, 1.0/static_cast<double>(1<<5))
[8812]40 GPSADDBITSFLOAT(32, eph._omega, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<1))
41 GPSADDBITSFLOAT(24, eph._OMEGADOT, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<13))
42 GPSADDBITSFLOAT(14, eph._IDOT, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<13))
[6819]43 GPSADDBITS(2,eph._L2Codes)
44 GPSADDBITS(10, eph._TOC.gpsw())
45 GPSADDBITS(4, ura)
46 GPSADDBITS(6, eph._health)
47 GPSADDBITSFLOAT(8, eph._TGD, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<1))
[8853]48 GPSADDBITS(10, eph._IODC)
[8852]49 (eph._fitInterval == 2.0) ? fitIntervalFlag = 0 : fitIntervalFlag = 1;
50 GPSADDBITS(1, fitIntervalFlag)
[6819]51 GPSADDBITS(3, 0) /* padding */
[8812]52 } else if (eph.type() == t_eph::IRNSS) {
[9002]53 GPSADDBITS(12, 1041)
[8812]54 GPSADDBITS(6, eph._prn.number())
55 GPSADDBITS(10, eph._TOC.gpsw())
56 GPSADDBITSFLOAT(22, eph._clock_bias, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<1))
57 GPSADDBITSFLOAT(16, eph._clock_drift, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<13))
58 GPSADDBITSFLOAT(8, eph._clock_driftrate, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<25))
59 GPSADDBITS(4, ura)
60 GPSADDBITS(16, static_cast<int>(eph._TOC.gpssec())>>4)
61 GPSADDBITSFLOAT(8, eph._TGD, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<1))
62 GPSADDBITSFLOAT(22, eph._Delta_n, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<11))
63 GPSADDBITS(8, eph._IODE) // Issue Of Data Ephemeris and Clock
64 GPSADDBITS(10, 0) /* padding */
65 if (eph._health == 0.0) {
66 L5Flag = 0;
67 SFlag = 0;
68 } else if (eph._health == 1.0) {
69 L5Flag = 0;
70 SFlag = 1;
71 } else if (eph._health == 2.0) {
72 L5Flag = 1;
73 SFlag = 0;
74 } else if (eph._health == 3.0) {
75 L5Flag = 1;
76 SFlag = 1;
77 }
78 GPSADDBITS(1, L5Flag)
79 GPSADDBITS(1, SFlag)
80 GPSADDBITSFLOAT(15, eph._Cuc, 1.0/static_cast<double>(1<<28))
81 GPSADDBITSFLOAT(15, eph._Cus, 1.0/static_cast<double>(1<<28))
82 GPSADDBITSFLOAT(15, eph._Cic, 1.0/static_cast<double>(1<<28))
83 GPSADDBITSFLOAT(15, eph._Cis, 1.0/static_cast<double>(1<<28))
84 GPSADDBITSFLOAT(15, eph._Crc, 1.0/static_cast<double>(1<< 4))
85 GPSADDBITSFLOAT(15, eph._Crs, 1.0/static_cast<double>(1<< 4))
86 GPSADDBITSFLOAT(14, eph._IDOT, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<13))
87 GPSADDBITSFLOAT(32, eph._M0, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<1))
88 GPSADDBITS(16, static_cast<int>(eph._TOEsec)>>4)
89 GPSADDBITSFLOAT(32, eph._e, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<3))
90 GPSADDBITSFLOAT(32, eph._sqrt_A, 1.0/static_cast<double>(1<<19))
91 GPSADDBITSFLOAT(32, eph._OMEGA0, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<1))
92 GPSADDBITSFLOAT(32, eph._omega, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<1))
93 GPSADDBITSFLOAT(22, eph._OMEGADOT, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<11))
94 GPSADDBITSFLOAT(32, eph._i0, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<1))
95 GPSADDBITS(2, 0) /* padding */
96 GPSADDBITS(2, 0) /* padding */
97 } else {
[6814]98 GPSADDBITS(12, 1019)
[6819]99 GPSADDBITS(6,eph._prn.number())
100 GPSADDBITS(10, eph._TOC.gpsw())
101 GPSADDBITS(4, ura)
102 GPSADDBITS(2,eph._L2Codes)
[8812]103 GPSADDBITSFLOAT(14, eph._IDOT, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<13))
[6819]104 GPSADDBITS(8, eph._IODE)
105 GPSADDBITS(16, static_cast<int>(eph._TOC.gpssec())>>4)
[8812]106 GPSADDBITSFLOAT(8, eph._clock_driftrate, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<25))
107 GPSADDBITSFLOAT(16, eph._clock_drift, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<13))
108 GPSADDBITSFLOAT(22, eph._clock_bias, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<1))
[6819]109 GPSADDBITS(10, eph._IODC)
110 GPSADDBITSFLOAT(16, eph._Crs, 1.0/static_cast<double>(1<<5))
[8812]111 GPSADDBITSFLOAT(16, eph._Delta_n, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<13))
[6819]112 GPSADDBITSFLOAT(32, eph._M0, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<1))
113 GPSADDBITSFLOAT(16, eph._Cuc, 1.0/static_cast<double>(1<<29))
114 GPSADDBITSFLOAT(32, eph._e, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<3))
115 GPSADDBITSFLOAT(16, eph._Cus, 1.0/static_cast<double>(1<<29))
116 GPSADDBITSFLOAT(32, eph._sqrt_A, 1.0/static_cast<double>(1<<19))
117 GPSADDBITS(16, static_cast<int>(eph._TOEsec)>>4)
118 GPSADDBITSFLOAT(16, eph._Cic, 1.0/static_cast<double>(1<<29))
[8812]119 GPSADDBITSFLOAT(32, eph._OMEGA0, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<1))
[6819]120 GPSADDBITSFLOAT(16, eph._Cis, 1.0/static_cast<double>(1<<29))
121 GPSADDBITSFLOAT(32, eph._i0, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<1))
122 GPSADDBITSFLOAT(16, eph._Crc, 1.0/static_cast<double>(1<<5))
[8812]123 GPSADDBITSFLOAT(32, eph._omega, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<1))
124 GPSADDBITSFLOAT(24, eph._OMEGADOT, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<13))
[6819]125 GPSADDBITSFLOAT(8, eph._TGD, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<1))
[7844]126 GPSADDBITS(6, eph._health)
[6819]127 GPSADDBITS(1, eph._L2PFlag)
[8852]128 (eph._fitInterval == 4.0) ? fitIntervalFlag = 0 : fitIntervalFlag = 1;
129 GPSADDBITS(1, fitIntervalFlag)
[6814]130 }
[5852]131
132 startbuffer[0]=0xD3;
133 startbuffer[1]=(size >> 8);
134 startbuffer[2]=size;
135 unsigned long i = CRC24(size+3, startbuffer);
136 buffer[size++] = i >> 16;
137 buffer[size++] = i >> 8;
138 buffer[size++] = i;
139 size += 3;
140 return size;
141}
142
143// build up RTCM3 for GLONASS
144////////////////////////////////////////////////////////////////////////////
145int t_ephEncoder::RTCM3(const t_ephGlo& eph, unsigned char *buffer)
146{
147
148 int size = 0;
149 int numbits = 0;
150 long long bitbuffer = 0;
151 unsigned char *startbuffer = buffer;
152 buffer= buffer+3;
153
154 GLONASSADDBITS(12, 1020)
[5853]155 GLONASSADDBITS(6, eph._prn.number())
156 GLONASSADDBITS(5, 7+eph._frequency_number)
[8182]157 GLONASSADDBITS(1, eph._almanac_health)
158 GLONASSADDBITS(1, eph._almanac_health_availablility_indicator)
159 GLONASSADDBITS(2, eph._P1)
[7844]160 int tki = static_cast<int>(eph._tki)+3*60*60;
161 if (tki > 86400) {tki -= 86400;}
[7849]162 GLONASSADDBITS(5, static_cast<int>(tki)/(60*60))
163 GLONASSADDBITS(6, (static_cast<int>(tki)/60)%60)
164 GLONASSADDBITS(1, (static_cast<int>(tki)/30)%30)
[7844]165 GLONASSADDBITS(1, eph._health)
[8182]166 GLONASSADDBITS(1, eph._P2)
[5853]167 unsigned long long timeofday = (static_cast<int>(eph._tt.gpssec()+3*60*60-eph._gps_utc)%86400);
[5852]168 GLONASSADDBITS(7, timeofday/60/15)
[5853]169 GLONASSADDBITSFLOATM(24, eph._x_velocity*1000, 1000.0/static_cast<double>(1<<20))
170 GLONASSADDBITSFLOATM(27, eph._x_pos*1000, 1000.0/static_cast<double>(1<<11))
171 GLONASSADDBITSFLOATM(5, eph._x_acceleration*1000, 1000.0/static_cast<double>(1<<30))
172 GLONASSADDBITSFLOATM(24, eph._y_velocity*1000, 1000.0/static_cast<double>(1<<20))
173 GLONASSADDBITSFLOATM(27, eph._y_pos*1000, 1000.0/static_cast<double>(1<<11))
174 GLONASSADDBITSFLOATM(5, eph._y_acceleration*1000, 1000.0/static_cast<double>(1<<30))
175 GLONASSADDBITSFLOATM(24, eph._z_velocity*1000, 1000.0/static_cast<double>(1<<20))
176 GLONASSADDBITSFLOATM(27,eph._z_pos*1000, 1000.0/static_cast<double>(1<<11))
177 GLONASSADDBITSFLOATM(5, eph._z_acceleration*1000, 1000.0/static_cast<double>(1<<30))
[8182]178 GLONASSADDBITS(1, eph._P3)
179 GLONASSADDBITSFLOATM(11, eph._gamma, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<10))
180 GLONASSADDBITS(2, eph._M_P) /* GLONASS-M P */
181 GLONASSADDBITS(1, eph._M_l3) /* GLONASS-M ln(3) */
[5853]182 GLONASSADDBITSFLOATM(22, eph._tau, 1.0/static_cast<double>(1<<30))
[8182]183 GLONASSADDBITSFLOATM(5, eph._M_delta_tau, 1.0/static_cast<double>(1<<30)) /* GLONASS-M delta tau */
[5853]184 GLONASSADDBITS(5, eph._E)
[8182]185 GLONASSADDBITS(1, eph._M_P4) /* GLONASS-M P4 */
186 GLONASSADDBITS(4, eph._M_FT) /* GLONASS-M FT */
187 GLONASSADDBITS(11, eph._M_NT) /* GLONASS-M NT */
188 GLONASSADDBITS(2, eph._M_M) /* GLONASS-M active? */
189 GLONASSADDBITS(1, eph._additional_data_availability) /* GLONASS additional data */
190 GLONASSADDBITS(11, eph._NA) /* GLONASS NA */
191 GLONASSADDBITSFLOATM(32, eph._tauC, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<1)) /* GLONASS tau C */
192 GLONASSADDBITS(5, eph._M_N4) /* GLONASS-M N4 */
193 GLONASSADDBITSFLOATM(22, eph._M_tau_GPS, 1.0/static_cast<double>(1<<30)) /* GLONASS-M tau GPS */
194 GLONASSADDBITS(1, eph._M_l5) /* GLONASS-M ln(5) */
[5852]195 GLONASSADDBITS(7, 0) /* Reserved */
196
197 startbuffer[0]=0xD3;
198 startbuffer[1]=(size >> 8);
199 startbuffer[2]=size;
200 unsigned long i = CRC24(size+3, startbuffer);
201 buffer[size++] = i >> 16;
202 buffer[size++] = i >> 8;
203 buffer[size++] = i;
204 size += 3;
205 return size;
206}
207
208// build up RTCM3 for Galileo
209////////////////////////////////////////////////////////////////////////////
210int t_ephEncoder::RTCM3(const t_ephGal& eph, unsigned char *buffer) {
211 int size = 0;
212 int numbits = 0;
213 long long bitbuffer = 0;
214 unsigned char *startbuffer = buffer;
215 buffer= buffer+3;
216
[6819]217 int SISA = indexFromAccuracy(eph._SISA, eph.type());
[6799]218
[6812]219 GALILEOADDBITS(12, eph._inav ? 1046 : 1045)
[5853]220 GALILEOADDBITS(6, eph._prn.number())
[6869]221 GALILEOADDBITS(12, eph._TOC.galw())
[5853]222 GALILEOADDBITS(10, eph._IODnav)
[6819]223 GALILEOADDBITS(8, SISA)
[8812]224 GALILEOADDBITSFLOAT(14, eph._IDOT, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<13))
[5853]225 GALILEOADDBITS(14, eph._TOC.gpssec()/60)
[8812]226 GALILEOADDBITSFLOAT(6, eph._clock_driftrate, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<29))
227 GALILEOADDBITSFLOAT(21, eph._clock_drift, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<16))
228 GALILEOADDBITSFLOAT(31, eph._clock_bias, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<4))
[5853]229 GALILEOADDBITSFLOAT(16, eph._Crs, 1.0/static_cast<double>(1<<5))
[8812]230 GALILEOADDBITSFLOAT(16, eph._Delta_n, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<13))
[5853]231 GALILEOADDBITSFLOAT(32, eph._M0, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<1))
232 GALILEOADDBITSFLOAT(16, eph._Cuc, 1.0/static_cast<double>(1<<29))
233 GALILEOADDBITSFLOAT(32, eph._e, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<3))
234 GALILEOADDBITSFLOAT(16, eph._Cus, 1.0/static_cast<double>(1<<29))
235 GALILEOADDBITSFLOAT(32, eph._sqrt_A, 1.0/static_cast<double>(1<<19))
236 GALILEOADDBITS(14, eph._TOEsec/60)
237 GALILEOADDBITSFLOAT(16, eph._Cic, 1.0/static_cast<double>(1<<29))
[8812]238 GALILEOADDBITSFLOAT(32, eph._OMEGA0, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<1))
[5853]239 GALILEOADDBITSFLOAT(16, eph._Cis, 1.0/static_cast<double>(1<<29))
240 GALILEOADDBITSFLOAT(32, eph._i0, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<1))
241 GALILEOADDBITSFLOAT(16, eph._Crc, 1.0/static_cast<double>(1<<5))
[8812]242 GALILEOADDBITSFLOAT(32, eph._omega, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<1))
243 GALILEOADDBITSFLOAT(24, eph._OMEGADOT, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<13))
244 GALILEOADDBITSFLOAT(10, eph._BGD_1_5A, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<2))
[8813]245 if(eph._inav) {
[8812]246 GALILEOADDBITSFLOAT(10, eph._BGD_1_5B, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<2))
[5853]247 GALILEOADDBITS(2, static_cast<int>(eph._E5bHS))
[6812]248 GALILEOADDBITS(1, eph._e5bDataInValid ? 1 : 0)
[6818]249 GALILEOADDBITS(2, static_cast<int>(eph._E1_bHS))
250 GALILEOADDBITS(1, eph._e1DataInValid ? 1 : 0)
[8812]251 } else {
[5853]252 GALILEOADDBITS(2, static_cast<int>(eph._E5aHS))
[6812]253 GALILEOADDBITS(1, eph._e5aDataInValid ? 1 : 0)
[5852]254 }
255
[6818]256 GALILEOADDBITS((eph._inav ? 2 : 7), 0)
[5852]257
258 startbuffer[0]=0xD3;
259 startbuffer[1]=(size >> 8);
260 startbuffer[2]=size;
261 unsigned long i = CRC24(size+3, startbuffer);
262 buffer[size++] = i >> 16;
263 buffer[size++] = i >> 8;
264 buffer[size++] = i;
265 size += 3;
266 return size;
267}
268
[6615]269// build up RTCM3 for SBAS
270////////////////////////////////////////////////////////////////////////////
[6631]271int t_ephEncoder::RTCM3(const t_ephSBAS& eph, unsigned char* buffer) {
272 int size = 0;
273 int numbits = 0;
274 long long bitbuffer = 0;
275 unsigned char *startbuffer = buffer;
276 buffer= buffer+3;
277
[6819]278 int ura = indexFromAccuracy(eph._ura, eph.type());
[6631]279 SBASADDBITS(12, 1043)
280 SBASADDBITS(6, eph._prn.number()-20)
281 SBASADDBITS(8, eph._IODN)
282 SBASADDBITS(13, static_cast<int>(eph._TOC.daysec())>>4)
[6819]283 SBASADDBITS(4, ura)
[6631]284 SBASADDBITSFLOAT(30, eph._x_pos, 0.08)
285 SBASADDBITSFLOAT(30, eph._y_pos, 0.08)
286 SBASADDBITSFLOAT(25, eph._z_pos, 0.4)
287 SBASADDBITSFLOAT(17, eph._x_velocity, 0.000625)
288 SBASADDBITSFLOAT(17, eph._y_velocity, 0.000625)
289 SBASADDBITSFLOAT(18, eph._z_velocity, 0.004)
290 SBASADDBITSFLOAT(10, eph._x_acceleration, 0.0000125)
291 SBASADDBITSFLOAT(10, eph._y_acceleration, 0.0000125)
292 SBASADDBITSFLOAT(10, eph._z_acceleration, 0.0000625)
293 SBASADDBITSFLOAT(12, eph._agf0, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<1))
294 SBASADDBITSFLOAT(8, eph._agf1, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<10))
[6635]295 SBASADDBITS(2,0);
[6631]296
297 startbuffer[0]=0xD3;
298 startbuffer[1]=(size >> 8);
299 startbuffer[2]=size;
300 unsigned long i = CRC24(size+3, startbuffer);
301 buffer[size++] = i >> 16;
302 buffer[size++] = i >> 8;
303 buffer[size++] = i;
304 size += 3;
305 return size;
[6403]306}
307
[6615]308// build up RTCM3 for BDS
309////////////////////////////////////////////////////////////////////////////
310int t_ephEncoder::RTCM3(const t_ephBDS& eph, unsigned char* buffer) {
311 int size = 0;
312 int numbits = 0;
313 long long bitbuffer = 0;
314 unsigned char *startbuffer = buffer;
315 buffer= buffer+3;
316
[6819]317 int URA = indexFromAccuracy(eph._URA, eph.type());
[9000]318 BDSADDBITS(12, 1042)
[6615]319 BDSADDBITS(6, eph._prn.number())
[8208]320 BDSADDBITS(13, eph._TOC.bdsw())
[6819]321 BDSADDBITS(4, URA);
[6615]322 BDSADDBITSFLOAT(14, eph._IDOT, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<13))
323 BDSADDBITS(5, eph._AODE)
[6812]324 BDSADDBITS(17, static_cast<int>(eph._TOC.bdssec())>>3)
[8812]325 BDSADDBITSFLOAT(11, eph._clock_driftrate, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<30)/static_cast<double>(1<<6))
[6615]326 BDSADDBITSFLOAT(22, eph._clock_drift, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<20))
327 BDSADDBITSFLOAT(24, eph._clock_bias, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<3))
328 BDSADDBITS(5, eph._AODC)
329 BDSADDBITSFLOAT(18, eph._Crs, 1.0/static_cast<double>(1<<6))
330 BDSADDBITSFLOAT(16, eph._Delta_n, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<13))
331 BDSADDBITSFLOAT(32, eph._M0, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<1))
332 BDSADDBITSFLOAT(18, eph._Cuc, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<1))
333 BDSADDBITSFLOAT(32, eph._e, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<3))
334 BDSADDBITSFLOAT(18, eph._Cus, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<1))
335 BDSADDBITSFLOAT(32, eph._sqrt_A, 1.0/static_cast<double>(1<<19))
[6812]336 BDSADDBITS(17, static_cast<int>(eph._TOE.bdssec())>>3)
[6615]337 BDSADDBITSFLOAT(18, eph._Cic, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<1))
338 BDSADDBITSFLOAT(32, eph._OMEGA0, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<1))
339 BDSADDBITSFLOAT(18, eph._Cis, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<1))
340 BDSADDBITSFLOAT(32, eph._i0, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<1))
[6619]341 BDSADDBITSFLOAT(18, eph._Crc, 1.0/static_cast<double>(1<<6))
[6615]342 BDSADDBITSFLOAT(32, eph._omega, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<1))
343 BDSADDBITSFLOAT(24, eph._OMEGADOT, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<13))
344 BDSADDBITSFLOAT(10, eph._TGD1, 0.0000000001)
345 BDSADDBITSFLOAT(10, eph._TGD2, 0.0000000001)
346 BDSADDBITS(1, eph._SatH1)
[6627]347 BDSADDBITS(1, 0) /* reserved bit, fill up 8 bits */
[6615]348
349 startbuffer[0]=0xD3;
350 startbuffer[1]=(size >> 8);
351 startbuffer[2]=size;
352 unsigned long i = CRC24(size+3, startbuffer);
353 buffer[size++] = i >> 16;
354 buffer[size++] = i >> 8;
355 buffer[size++] = i;
356 size += 3;
357 return size;
[6403]358}
[7053]359
Note: See TracBrowser for help on using the repository browser.