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

Last change on this file since 10525 was 10215, checked in by stuerze, 14 months ago

minor changes

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