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

Last change on this file since 9407 was 9328, checked in by stuerze, 4 years ago

bug fixed in IRNSS epehemeris ecoding / decoding

File size: 17.1 KB
Line 
1
2#include "ephEncoder.h"
3
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;
16 int ura = indexFromAccuracy(eph._ura, eph.type());
17 int L5Flag, SFlag, fitIntervalFlag;
18
19 if (eph.type() == t_eph::QZSS) {
20 GPSADDBITS(12, 1044)
21 GPSADDBITS(4, eph._prn.number())
22 GPSADDBITS(16, static_cast<int>(eph._TOC.gpssec())>>4)
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))
26 GPSADDBITS(8, eph._IODE)
27 GPSADDBITSFLOAT(16, eph._Crs, 1.0/static_cast<double>(1<<5))
28 GPSADDBITSFLOAT(16, eph._Delta_n, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<13))
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))
36 GPSADDBITSFLOAT(32, eph._OMEGA0, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<1))
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))
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))
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))
48 GPSADDBITS(10, eph._IODC)
49 (eph._fitInterval == 2.0) ? fitIntervalFlag = 0 : fitIntervalFlag = 1;
50 GPSADDBITS(1, fitIntervalFlag)
51 GPSADDBITS(3, 0) /* padding */
52 } else if (eph.type() == t_eph::IRNSS) {
53 GPSADDBITS(12, 1041)
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 GPSADDBITS(2, 0) /* padding */
88 GPSADDBITSFLOAT(32, eph._M0, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<1))
89 GPSADDBITS(16, static_cast<int>(eph._TOEsec)>>4)
90 GPSADDBITSFLOAT(32, eph._e, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<3))
91 GPSADDBITSFLOAT(32, eph._sqrt_A, 1.0/static_cast<double>(1<<19))
92 GPSADDBITSFLOAT(32, eph._OMEGA0, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<1))
93 GPSADDBITSFLOAT(32, eph._omega, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<1))
94 GPSADDBITSFLOAT(22, eph._OMEGADOT, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<11))
95 GPSADDBITSFLOAT(32, eph._i0, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<1))
96 GPSADDBITS(2, 0) /* padding */
97 } else {
98 GPSADDBITS(12, 1019)
99 GPSADDBITS(6,eph._prn.number())
100 GPSADDBITS(10, eph._TOC.gpsw())
101 GPSADDBITS(4, ura)
102 GPSADDBITS(2,eph._L2Codes)
103 GPSADDBITSFLOAT(14, eph._IDOT, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<13))
104 GPSADDBITS(8, eph._IODE)
105 GPSADDBITS(16, static_cast<int>(eph._TOC.gpssec())>>4)
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))
109 GPSADDBITS(10, eph._IODC)
110 GPSADDBITSFLOAT(16, eph._Crs, 1.0/static_cast<double>(1<<5))
111 GPSADDBITSFLOAT(16, eph._Delta_n, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<13))
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))
119 GPSADDBITSFLOAT(32, eph._OMEGA0, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<1))
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))
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))
125 GPSADDBITSFLOAT(8, eph._TGD, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<1))
126 GPSADDBITS(6, eph._health)
127 GPSADDBITS(1, eph._L2PFlag)
128 (eph._fitInterval == 4.0) ? fitIntervalFlag = 0 : fitIntervalFlag = 1;
129 GPSADDBITS(1, fitIntervalFlag)
130 }
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)
155 GLONASSADDBITS(6, eph._prn.number())
156 GLONASSADDBITS(5, 7+eph._frequency_number)
157 GLONASSADDBITS(1, eph._almanac_health)
158 GLONASSADDBITS(1, eph._almanac_health_availablility_indicator)
159 GLONASSADDBITS(2, eph._P1)
160 int tki = static_cast<int>(eph._tki)+3*60*60;
161 if (tki > 86400) {tki -= 86400;}
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)
165 GLONASSADDBITS(1, eph._health)
166 GLONASSADDBITS(1, eph._P2)
167 unsigned long long timeofday = (static_cast<int>(eph._tt.gpssec()+3*60*60-eph._gps_utc)%86400);
168 GLONASSADDBITS(7, timeofday/60/15)
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))
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) */
182 GLONASSADDBITSFLOATM(22, eph._tau, 1.0/static_cast<double>(1<<30))
183 GLONASSADDBITSFLOATM(5, eph._M_delta_tau, 1.0/static_cast<double>(1<<30)) /* GLONASS-M delta tau */
184 GLONASSADDBITS(5, eph._E)
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) */
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
217 int SISA = indexFromAccuracy(eph._SISA, eph.type());
218
219 GALILEOADDBITS(12, eph._inav ? 1046 : 1045)
220 GALILEOADDBITS(6, eph._prn.number())
221 GALILEOADDBITS(12, eph._TOC.galw())
222 GALILEOADDBITS(10, eph._IODnav)
223 GALILEOADDBITS(8, SISA)
224 GALILEOADDBITSFLOAT(14, eph._IDOT, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<13))
225 GALILEOADDBITS(14, eph._TOC.gpssec()/60)
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))
229 GALILEOADDBITSFLOAT(16, eph._Crs, 1.0/static_cast<double>(1<<5))
230 GALILEOADDBITSFLOAT(16, eph._Delta_n, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<13))
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))
238 GALILEOADDBITSFLOAT(32, eph._OMEGA0, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<1))
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))
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))
245 if(eph._inav) {
246 GALILEOADDBITSFLOAT(10, eph._BGD_1_5B, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<2))
247 GALILEOADDBITS(2, static_cast<int>(eph._E5bHS))
248 GALILEOADDBITS(1, eph._e5bDataInValid ? 1 : 0)
249 GALILEOADDBITS(2, static_cast<int>(eph._E1_bHS))
250 GALILEOADDBITS(1, eph._e1DataInValid ? 1 : 0)
251 } else {
252 GALILEOADDBITS(2, static_cast<int>(eph._E5aHS))
253 GALILEOADDBITS(1, eph._e5aDataInValid ? 1 : 0)
254 }
255
256 GALILEOADDBITS((eph._inav ? 2 : 7), 0)
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
269// build up RTCM3 for SBAS
270////////////////////////////////////////////////////////////////////////////
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
278 int ura = indexFromAccuracy(eph._ura, eph.type());
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)
283 SBASADDBITS(4, ura)
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))
295 SBASADDBITS(2,0);
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;
306}
307
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
317 int URA = indexFromAccuracy(eph._URA, eph.type());
318 BDSADDBITS(12, 1042)
319 BDSADDBITS(6, eph._prn.number())
320 BDSADDBITS(13, eph._TOC.bdsw())
321 BDSADDBITS(4, URA);
322 BDSADDBITSFLOAT(14, eph._IDOT, M_PI/static_cast<double>(1<<30)/static_cast<double>(1<<13))
323 BDSADDBITS(5, eph._AODE)
324 BDSADDBITS(17, static_cast<int>(eph._TOC.bdssec())>>3)
325 BDSADDBITSFLOAT(11, eph._clock_driftrate, 1.0/static_cast<double>(1<<30)/static_cast<double>(1<<30)/static_cast<double>(1<<6))
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))
336 BDSADDBITS(17, static_cast<int>(eph._TOE.bdssec())>>3)
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))
341 BDSADDBITSFLOAT(18, eph._Crc, 1.0/static_cast<double>(1<<6))
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)
347 BDSADDBITS(1, 0) /* reserved bit, fill up 8 bits */
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;
358}
359
Note: See TracBrowser for help on using the repository browser.