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

Last change on this file since 6912 was 6869, checked in by stoecker, 9 years ago

fix galileo week

File size: 17.5 KB
Line 
1
2#include "ephEncoder.h"
3
4using namespace std;
5
6// Returns CRC24
7////////////////////////////////////////////////////////////////////////////
8static unsigned long CRC24(long size, const unsigned char *buf) {
9 unsigned long crc = 0;
10 int ii;
11 while (size--) {
12 crc ^= (*buf++) << (16);
13 for(ii = 0; ii < 8; ii++) {
14 crc <<= 1;
15 if (crc & 0x1000000) {
16 crc ^= 0x01864cfb;
17 }
18 }
19 }
20 return crc;
21}
22
23// build up RTCM3 for GPS
24////////////////////////////////////////////////////////////////////////////
25#define GPSTOINT(type, value) static_cast<type>(round(value))
26
27#define GPSADDBITS(a, b) {bitbuffer = (bitbuffer<<(a)) \
28 |(GPSTOINT(long long,b)&((1ULL<<a)-1)); \
29 numbits += (a); \
30 while(numbits >= 8) { \
31 buffer[size++] = bitbuffer>>(numbits-8);numbits -= 8;}}
32
33#define GPSADDBITSFLOAT(a,b,c) {long long i = GPSTOINT(long long,(b)/(c)); \
34 GPSADDBITS(a,i)};
35
36int t_ephEncoder::RTCM3(const t_ephGPS& eph, unsigned char *buffer) {
37
38 unsigned char *startbuffer = buffer;
39 buffer= buffer+3;
40 int size = 0;
41 int numbits = 0;
42 unsigned long long bitbuffer = 0;
43 int ura = indexFromAccuracy(eph._ura, eph.type());
44 if (eph.type() == t_eph::QZSS) {
45 GPSADDBITS(12, 1044)
46 GPSADDBITS(4,eph._prn.number())
47 GPSADDBITS(16, static_cast<int>(eph._TOC.gpssec())>>4)
48 GPSADDBITSFLOAT(8, eph._clock_driftrate, 1.0/static_cast<double>(1<<30)
49 /static_cast<double>(1<<25))
50 GPSADDBITSFLOAT(16, eph._clock_drift, 1.0/static_cast<double>(1<<30)
51 /static_cast<double>(1<<13))
52 GPSADDBITSFLOAT(22, eph._clock_bias, 1.0/static_cast<double>(1<<30)
53 /static_cast<double>(1<<1))
54 GPSADDBITS(8, eph._IODE)
55 GPSADDBITSFLOAT(16, eph._Crs, 1.0/static_cast<double>(1<<5))
56 GPSADDBITSFLOAT(16, eph._Delta_n, M_PI/static_cast<double>(1<<30)
57 /static_cast<double>(1<<13))
58 GPSADDBITSFLOAT(32, eph._M0, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<1))
59 GPSADDBITSFLOAT(16, eph._Cuc, 1.0/static_cast<double>(1<<29))
60 GPSADDBITSFLOAT(32, eph._e, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<3))
61 GPSADDBITSFLOAT(16, eph._Cus, 1.0/static_cast<double>(1<<29))
62 GPSADDBITSFLOAT(32, eph._sqrt_A, 1.0/static_cast<double>(1<<19))
63 GPSADDBITS(16, static_cast<int>(eph._TOEsec)>>4)
64 GPSADDBITSFLOAT(16, eph._Cic, 1.0/static_cast<double>(1<<29))
65 GPSADDBITSFLOAT(32, eph._OMEGA0, M_PI/static_cast<double>(1<<30)
66 /static_cast<double>(1<<1))
67 GPSADDBITSFLOAT(16, eph._Cis, 1.0/static_cast<double>(1<<29))
68 GPSADDBITSFLOAT(32, eph._i0, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<1))
69 GPSADDBITSFLOAT(16, eph._Crc, 1.0/static_cast<double>(1<<5))
70 GPSADDBITSFLOAT(32, eph._omega, M_PI/static_cast<double>(1<<30)
71 /static_cast<double>(1<<1))
72 GPSADDBITSFLOAT(24, eph._OMEGADOT, M_PI/static_cast<double>(1<<30)
73 /static_cast<double>(1<<13))
74 GPSADDBITSFLOAT(14, eph._IDOT, M_PI/static_cast<double>(1<<30)
75 /static_cast<double>(1<<13))
76 GPSADDBITS(2,eph._L2Codes)
77 GPSADDBITS(10, eph._TOC.gpsw())
78 GPSADDBITS(4, ura)
79 GPSADDBITS(6, eph._health)
80 GPSADDBITSFLOAT(8, eph._TGD, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<1))
81 GPSADDBITS(10, eph._IODC)
82 GPSADDBITS(1, eph._fitInterval)
83 GPSADDBITS(3, 0) /* padding */
84 }
85 else {
86 GPSADDBITS(12, 1019)
87 GPSADDBITS(6,eph._prn.number())
88 GPSADDBITS(10, eph._TOC.gpsw())
89 GPSADDBITS(4, ura)
90 GPSADDBITS(2,eph._L2Codes)
91 GPSADDBITSFLOAT(14, eph._IDOT, M_PI/static_cast<double>(1<<30)
92 /static_cast<double>(1<<13))
93 GPSADDBITS(8, eph._IODE)
94 GPSADDBITS(16, static_cast<int>(eph._TOC.gpssec())>>4)
95 GPSADDBITSFLOAT(8, eph._clock_driftrate, 1.0/static_cast<double>(1<<30)
96 /static_cast<double>(1<<25))
97 GPSADDBITSFLOAT(16, eph._clock_drift, 1.0/static_cast<double>(1<<30)
98 /static_cast<double>(1<<13))
99 GPSADDBITSFLOAT(22, eph._clock_bias, 1.0/static_cast<double>(1<<30)
100 /static_cast<double>(1<<1))
101 GPSADDBITS(10, eph._IODC)
102 GPSADDBITSFLOAT(16, eph._Crs, 1.0/static_cast<double>(1<<5))
103 GPSADDBITSFLOAT(16, eph._Delta_n, M_PI/static_cast<double>(1<<30)
104 /static_cast<double>(1<<13))
105 GPSADDBITSFLOAT(32, eph._M0, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<1))
106 GPSADDBITSFLOAT(16, eph._Cuc, 1.0/static_cast<double>(1<<29))
107 GPSADDBITSFLOAT(32, eph._e, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<3))
108 GPSADDBITSFLOAT(16, eph._Cus, 1.0/static_cast<double>(1<<29))
109 GPSADDBITSFLOAT(32, eph._sqrt_A, 1.0/static_cast<double>(1<<19))
110 GPSADDBITS(16, static_cast<int>(eph._TOEsec)>>4)
111 GPSADDBITSFLOAT(16, eph._Cic, 1.0/static_cast<double>(1<<29))
112 GPSADDBITSFLOAT(32, eph._OMEGA0, M_PI/static_cast<double>(1<<30)
113 /static_cast<double>(1<<1))
114 GPSADDBITSFLOAT(16, eph._Cis, 1.0/static_cast<double>(1<<29))
115 GPSADDBITSFLOAT(32, eph._i0, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<1))
116 GPSADDBITSFLOAT(16, eph._Crc, 1.0/static_cast<double>(1<<5))
117 GPSADDBITSFLOAT(32, eph._omega, M_PI/static_cast<double>(1<<30)
118 /static_cast<double>(1<<1))
119 GPSADDBITSFLOAT(24, eph._OMEGADOT, M_PI/static_cast<double>(1<<30)
120 /static_cast<double>(1<<13))
121 GPSADDBITSFLOAT(8, eph._TGD, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<1))
122 GPSADDBITS(6, eph._health)
123 GPSADDBITS(1, eph._L2PFlag)
124 GPSADDBITS(1, eph._fitInterval)
125 }
126
127 startbuffer[0]=0xD3;
128 startbuffer[1]=(size >> 8);
129 startbuffer[2]=size;
130 unsigned long i = CRC24(size+3, startbuffer);
131 buffer[size++] = i >> 16;
132 buffer[size++] = i >> 8;
133 buffer[size++] = i;
134 size += 3;
135 return size;
136}
137
138// build up RTCM3 for GLONASS
139////////////////////////////////////////////////////////////////////////////
140#define GLONASSTOINT(type, value) static_cast<type>(round(value))
141
142#define GLONASSADDBITS(a, b) {bitbuffer = (bitbuffer<<(a)) \
143 |(GLONASSTOINT(long long,b)&((1ULL<<(a))-1)); \
144 numbits += (a); \
145 while(numbits >= 8) { \
146 buffer[size++] = bitbuffer>>(numbits-8);numbits -= 8;}}
147#define GLONASSADDBITSFLOATM(a,b,c) {int s; long long i; \
148 if(b < 0.0) \
149 { \
150 s = 1; \
151 i = GLONASSTOINT(long long,(-b)/(c)); \
152 if(!i) s = 0; \
153 } \
154 else \
155 { \
156 s = 0; \
157 i = GLONASSTOINT(long long,(b)/(c)); \
158 } \
159 GLONASSADDBITS(1,s) \
160 GLONASSADDBITS(a-1,i)}
161
162int t_ephEncoder::RTCM3(const t_ephGlo& eph, unsigned char *buffer)
163{
164
165 int size = 0;
166 int numbits = 0;
167 long long bitbuffer = 0;
168 unsigned char *startbuffer = buffer;
169 buffer= buffer+3;
170
171 GLONASSADDBITS(12, 1020)
172 GLONASSADDBITS(6, eph._prn.number())
173 GLONASSADDBITS(5, 7+eph._frequency_number)
174 GLONASSADDBITS(1, 0)
175 GLONASSADDBITS(1, 0)
176 GLONASSADDBITS(2, 0)
177 eph._tki=eph._tki+3*60*60;
178 GLONASSADDBITS(5, static_cast<int>(eph._tki)/(60*60))
179 GLONASSADDBITS(6, (static_cast<int>(eph._tki)/60)%60)
180 GLONASSADDBITS(1, (static_cast<int>(eph._tki)/30)%30)
181 GLONASSADDBITS(1, eph._health)
182 GLONASSADDBITS(1, 0)
183 unsigned long long timeofday = (static_cast<int>(eph._tt.gpssec()+3*60*60-eph._gps_utc)%86400);
184 GLONASSADDBITS(7, timeofday/60/15)
185 GLONASSADDBITSFLOATM(24, eph._x_velocity*1000, 1000.0/static_cast<double>(1<<20))
186 GLONASSADDBITSFLOATM(27, eph._x_pos*1000, 1000.0/static_cast<double>(1<<11))
187 GLONASSADDBITSFLOATM(5, eph._x_acceleration*1000, 1000.0/static_cast<double>(1<<30))
188 GLONASSADDBITSFLOATM(24, eph._y_velocity*1000, 1000.0/static_cast<double>(1<<20))
189 GLONASSADDBITSFLOATM(27, eph._y_pos*1000, 1000.0/static_cast<double>(1<<11))
190 GLONASSADDBITSFLOATM(5, eph._y_acceleration*1000, 1000.0/static_cast<double>(1<<30))
191 GLONASSADDBITSFLOATM(24, eph._z_velocity*1000, 1000.0/static_cast<double>(1<<20))
192 GLONASSADDBITSFLOATM(27,eph._z_pos*1000, 1000.0/static_cast<double>(1<<11))
193 GLONASSADDBITSFLOATM(5, eph._z_acceleration*1000, 1000.0/static_cast<double>(1<<30))
194 GLONASSADDBITS(1, 0)
195 GLONASSADDBITSFLOATM(11, eph._gamma, 1.0/static_cast<double>(1<<30)
196 /static_cast<double>(1<<10))
197 GLONASSADDBITS(2, 0) /* GLONASS-M P */
198 GLONASSADDBITS(1, 0) /* GLONASS-M ln(3) */
199 GLONASSADDBITSFLOATM(22, eph._tau, 1.0/static_cast<double>(1<<30))
200 GLONASSADDBITS(5, 0) /* GLONASS-M delta tau */
201 GLONASSADDBITS(5, eph._E)
202 GLONASSADDBITS(1, 0) /* GLONASS-M P4 */
203 GLONASSADDBITS(4, 0) /* GLONASS-M FT */
204 GLONASSADDBITS(11, 0) /* GLONASS-M NT */
205 GLONASSADDBITS(2, 0) /* GLONASS-M active? */
206 GLONASSADDBITS(1, 0) /* GLONASS additional data */
207 GLONASSADDBITS(11, 0) /* GLONASS NA */
208 GLONASSADDBITS(32, 0) /* GLONASS tau C */
209 GLONASSADDBITS(5, 0) /* GLONASS-M N4 */
210 GLONASSADDBITS(22, 0) /* GLONASS-M tau GPS */
211 GLONASSADDBITS(1, 0) /* GLONASS-M ln(5) */
212 GLONASSADDBITS(7, 0) /* Reserved */
213
214 startbuffer[0]=0xD3;
215 startbuffer[1]=(size >> 8);
216 startbuffer[2]=size;
217 unsigned long i = CRC24(size+3, startbuffer);
218 buffer[size++] = i >> 16;
219 buffer[size++] = i >> 8;
220 buffer[size++] = i;
221 size += 3;
222 return size;
223}
224
225// build up RTCM3 for Galileo
226////////////////////////////////////////////////////////////////////////////
227#define GALILEOTOINT(type, value) static_cast<type>(round(value))
228
229#define GALILEOADDBITS(a, b) {bitbuffer = (bitbuffer<<(a)) \
230 |(GALILEOTOINT(long long,b)&((1LL<<a)-1)); \
231 numbits += (a); \
232 while(numbits >= 8) { \
233 buffer[size++] = bitbuffer>>(numbits-8);numbits -= 8;}}
234#define GALILEOADDBITSFLOAT(a,b,c) {long long i = GALILEOTOINT(long long,(b)/(c)); \
235 GALILEOADDBITS(a,i)};
236
237int t_ephEncoder::RTCM3(const t_ephGal& eph, unsigned char *buffer) {
238 int size = 0;
239 int numbits = 0;
240 long long bitbuffer = 0;
241 unsigned char *startbuffer = buffer;
242 buffer= buffer+3;
243
244 int SISA = indexFromAccuracy(eph._SISA, eph.type());
245
246 GALILEOADDBITS(12, eph._inav ? 1046 : 1045)
247 GALILEOADDBITS(6, eph._prn.number())
248 GALILEOADDBITS(12, eph._TOC.galw())
249 GALILEOADDBITS(10, eph._IODnav)
250 GALILEOADDBITS(8, SISA)
251 GALILEOADDBITSFLOAT(14, eph._IDOT, M_PI/static_cast<double>(1<<30)
252 /static_cast<double>(1<<13))
253 GALILEOADDBITS(14, eph._TOC.gpssec()/60)
254 GALILEOADDBITSFLOAT(6, eph._clock_driftrate, 1.0/static_cast<double>(1<<30)
255 /static_cast<double>(1<<29))
256 GALILEOADDBITSFLOAT(21, eph._clock_drift, 1.0/static_cast<double>(1<<30)
257 /static_cast<double>(1<<16))
258 GALILEOADDBITSFLOAT(31, eph._clock_bias, 1.0/static_cast<double>(1<<30)
259 /static_cast<double>(1<<4))
260 GALILEOADDBITSFLOAT(16, eph._Crs, 1.0/static_cast<double>(1<<5))
261 GALILEOADDBITSFLOAT(16, eph._Delta_n, M_PI/static_cast<double>(1<<30)
262 /static_cast<double>(1<<13))
263 GALILEOADDBITSFLOAT(32, eph._M0, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<1))
264 GALILEOADDBITSFLOAT(16, eph._Cuc, 1.0/static_cast<double>(1<<29))
265 GALILEOADDBITSFLOAT(32, eph._e, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<3))
266 GALILEOADDBITSFLOAT(16, eph._Cus, 1.0/static_cast<double>(1<<29))
267 GALILEOADDBITSFLOAT(32, eph._sqrt_A, 1.0/static_cast<double>(1<<19))
268 GALILEOADDBITS(14, eph._TOEsec/60)
269 GALILEOADDBITSFLOAT(16, eph._Cic, 1.0/static_cast<double>(1<<29))
270 GALILEOADDBITSFLOAT(32, eph._OMEGA0, M_PI/static_cast<double>(1<<30)
271 /static_cast<double>(1<<1))
272 GALILEOADDBITSFLOAT(16, eph._Cis, 1.0/static_cast<double>(1<<29))
273 GALILEOADDBITSFLOAT(32, eph._i0, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<1))
274 GALILEOADDBITSFLOAT(16, eph._Crc, 1.0/static_cast<double>(1<<5))
275 GALILEOADDBITSFLOAT(32, eph._omega, M_PI/static_cast<double>(1<<30)
276 /static_cast<double>(1<<1))
277 GALILEOADDBITSFLOAT(24, eph._OMEGADOT, M_PI/static_cast<double>(1<<30)
278 /static_cast<double>(1<<13))
279 GALILEOADDBITSFLOAT(10, eph._BGD_1_5A, 1.0/static_cast<double>(1<<30)
280 /static_cast<double>(1<<2))
281 if(eph._inav)
282 {
283 GALILEOADDBITSFLOAT(10, eph._BGD_1_5B, 1.0/static_cast<double>(1<<30)
284 /static_cast<double>(1<<2))
285 GALILEOADDBITS(2, static_cast<int>(eph._E5bHS))
286 GALILEOADDBITS(1, eph._e5bDataInValid ? 1 : 0)
287 GALILEOADDBITS(2, static_cast<int>(eph._E1_bHS))
288 GALILEOADDBITS(1, eph._e1DataInValid ? 1 : 0)
289 }
290 else
291 {
292 GALILEOADDBITS(2, static_cast<int>(eph._E5aHS))
293 GALILEOADDBITS(1, eph._e5aDataInValid ? 1 : 0)
294 }
295
296 GALILEOADDBITS((eph._inav ? 2 : 7), 0)
297
298 startbuffer[0]=0xD3;
299 startbuffer[1]=(size >> 8);
300 startbuffer[2]=size;
301 unsigned long i = CRC24(size+3, startbuffer);
302 buffer[size++] = i >> 16;
303 buffer[size++] = i >> 8;
304 buffer[size++] = i;
305 size += 3;
306 return size;
307}
308
309// build up RTCM3 for SBAS
310////////////////////////////////////////////////////////////////////////////
311#define SBASTOINT(type, value) static_cast<type>(round(value))
312
313#define SBASADDBITS(a, b) {bitbuffer = (bitbuffer<<(a)) \
314 |(SBASTOINT(long long,b)&((1ULL<<a)-1)); \
315 numbits += (a); \
316 while(numbits >= 8) { \
317 buffer[size++] = bitbuffer>>(numbits-8);numbits -= 8;}}
318#define SBASADDBITSFLOAT(a,b,c) {long long i = SBASTOINT(long long,(b)/(c)); \
319 SBASADDBITS(a,i)};
320
321int t_ephEncoder::RTCM3(const t_ephSBAS& eph, unsigned char* buffer) {
322 int size = 0;
323 int numbits = 0;
324 long long bitbuffer = 0;
325 unsigned char *startbuffer = buffer;
326 buffer= buffer+3;
327
328 int ura = indexFromAccuracy(eph._ura, eph.type());
329 SBASADDBITS(12, 1043)
330 SBASADDBITS(6, eph._prn.number()-20)
331 SBASADDBITS(8, eph._IODN)
332 SBASADDBITS(13, static_cast<int>(eph._TOC.daysec())>>4)
333 SBASADDBITS(4, ura)
334 SBASADDBITSFLOAT(30, eph._x_pos, 0.08)
335 SBASADDBITSFLOAT(30, eph._y_pos, 0.08)
336 SBASADDBITSFLOAT(25, eph._z_pos, 0.4)
337 SBASADDBITSFLOAT(17, eph._x_velocity, 0.000625)
338 SBASADDBITSFLOAT(17, eph._y_velocity, 0.000625)
339 SBASADDBITSFLOAT(18, eph._z_velocity, 0.004)
340 SBASADDBITSFLOAT(10, eph._x_acceleration, 0.0000125)
341 SBASADDBITSFLOAT(10, eph._y_acceleration, 0.0000125)
342 SBASADDBITSFLOAT(10, eph._z_acceleration, 0.0000625)
343 SBASADDBITSFLOAT(12, eph._agf0, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<1))
344 SBASADDBITSFLOAT(8, eph._agf1, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<10))
345 SBASADDBITS(2,0);
346
347 startbuffer[0]=0xD3;
348 startbuffer[1]=(size >> 8);
349 startbuffer[2]=size;
350 unsigned long i = CRC24(size+3, startbuffer);
351 buffer[size++] = i >> 16;
352 buffer[size++] = i >> 8;
353 buffer[size++] = i;
354 size += 3;
355 return size;
356}
357
358// build up RTCM3 for BDS
359////////////////////////////////////////////////////////////////////////////
360#define BDSTOINT(type, value) static_cast<type>(round(value))
361
362#define BDSADDBITS(a, b) {bitbuffer = (bitbuffer<<(a)) \
363 |(BDSTOINT(long long,b)&((1ULL<<a)-1)); \
364 numbits += (a); \
365 while(numbits >= 8) { \
366 buffer[size++] = bitbuffer>>(numbits-8);numbits -= 8;}}
367#define BDSADDBITSFLOAT(a,b,c) {long long i = BDSTOINT(long long,(b)/(c)); \
368 BDSADDBITS(a,i)};
369
370int t_ephEncoder::RTCM3(const t_ephBDS& eph, unsigned char* buffer) {
371 int size = 0;
372 int numbits = 0;
373 long long bitbuffer = 0;
374 unsigned char *startbuffer = buffer;
375 buffer= buffer+3;
376
377 int URA = indexFromAccuracy(eph._URA, eph.type());
378 BDSADDBITS(12, RTCM3ID_BDS)
379 BDSADDBITS(6, eph._prn.number())
380 BDSADDBITS(13, eph._TOC.bdsw() - 1356.0)
381 BDSADDBITS(4, URA);
382 BDSADDBITSFLOAT(14, eph._IDOT, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<13))
383 BDSADDBITS(5, eph._AODE)
384 BDSADDBITS(17, static_cast<int>(eph._TOC.bdssec())>>3)
385 BDSADDBITSFLOAT(11, eph._clock_driftrate, 1.0/static_cast<double>(1<<30)
386 /static_cast<double>(1<<30)/static_cast<double>(1<<6))
387 BDSADDBITSFLOAT(22, eph._clock_drift, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<20))
388 BDSADDBITSFLOAT(24, eph._clock_bias, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<3))
389 BDSADDBITS(5, eph._AODC)
390 BDSADDBITSFLOAT(18, eph._Crs, 1.0/static_cast<double>(1<<6))
391 BDSADDBITSFLOAT(16, eph._Delta_n, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<13))
392 BDSADDBITSFLOAT(32, eph._M0, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<1))
393 BDSADDBITSFLOAT(18, eph._Cuc, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<1))
394 BDSADDBITSFLOAT(32, eph._e, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<3))
395 BDSADDBITSFLOAT(18, eph._Cus, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<1))
396 BDSADDBITSFLOAT(32, eph._sqrt_A, 1.0/static_cast<double>(1<<19))
397 BDSADDBITS(17, static_cast<int>(eph._TOE.bdssec())>>3)
398 BDSADDBITSFLOAT(18, eph._Cic, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<1))
399 BDSADDBITSFLOAT(32, eph._OMEGA0, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<1))
400 BDSADDBITSFLOAT(18, eph._Cis, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<1))
401 BDSADDBITSFLOAT(32, eph._i0, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<1))
402 BDSADDBITSFLOAT(18, eph._Crc, 1.0/static_cast<double>(1<<6))
403 BDSADDBITSFLOAT(32, eph._omega, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<1))
404 BDSADDBITSFLOAT(24, eph._OMEGADOT, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<13))
405 BDSADDBITSFLOAT(10, eph._TGD1, 0.0000000001)
406 BDSADDBITSFLOAT(10, eph._TGD2, 0.0000000001)
407 BDSADDBITS(1, eph._SatH1)
408 BDSADDBITS(1, 0) /* reserved bit, fill up 8 bits */
409
410 startbuffer[0]=0xD3;
411 startbuffer[1]=(size >> 8);
412 startbuffer[2]=size;
413 unsigned long i = CRC24(size+3, startbuffer);
414 buffer[size++] = i >> 16;
415 buffer[size++] = i >> 8;
416 buffer[size++] = i;
417 size += 3;
418 return size;
419}
Note: See TracBrowser for help on using the repository browser.