Changeset 2771 in ntrip
- Timestamp:
- Dec 12, 2010, 3:37:38 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/RTCM3/ephemeris.cpp
r2561 r2771 305 305 _xv(6) = _z_velocity * 1.e3; 306 306 } 307 308 // Set Galileo Satellite Position 309 //////////////////////////////////////////////////////////////////////////// 310 void t_ephGal::set(const galileoephemeris* ee) { 311 ostringstream prn; 312 prn << 'E' << setfill('0') << setw(2) << ee->satellite; 313 314 _prn = prn.str(); 315 316 _GPSweek = ee->Week; 317 _GPSweeks = ee->TOE; 318 319 _TOC = ee->TOC; 320 _TOE = ee->TOE; 321 _IODnav = ee->IODnav; 322 323 _clock_bias = ee->clock_bias ; 324 _clock_drift = ee->clock_drift ; 325 _clock_driftrate = ee->clock_driftrate; 326 327 _Crs = ee->Crs; 328 _Delta_n = ee->Delta_n; 329 _M0 = ee->M0; 330 _Cuc = ee->Cuc; 331 _e = ee->e; 332 _Cus = ee->Cus; 333 _sqrt_A = ee->sqrt_A; 334 _Cic = ee->Cic; 335 _OMEGA0 = ee->OMEGA0; 336 _Cis = ee->Cis; 337 _i0 = ee->i0; 338 _Crc = ee->Crc; 339 _omega = ee->omega; 340 _OMEGADOT = ee->OMEGADOT; 341 _IDOT = ee->IDOT; 342 } 343 344 // Compute Galileo Satellite Position (virtual) 345 //////////////////////////////////////////////////////////////////////////// 346 void t_ephGal::position(int GPSweek, double GPSweeks, 347 double* xc, 348 double* vv) const { 349 350 static const double secPerWeek = 7 * 86400.0; 351 static const double omegaEarth = 7292115.1467e-11; 352 static const double gmWGS = 398.6005e12; 353 354 memset(xc, 0, 4*sizeof(double)); 355 memset(vv, 0, 3*sizeof(double)); 356 357 double a0 = _sqrt_A * _sqrt_A; 358 if (a0 == 0) { 359 return; 360 } 361 362 double n0 = sqrt(gmWGS/(a0*a0*a0)); 363 double tk = GPSweeks - _TOE; 364 if (GPSweek != _GPSweek) { 365 tk += (GPSweek - _GPSweek) * secPerWeek; 366 } 367 double n = n0 + _Delta_n; 368 double M = _M0 + n*tk; 369 double E = M; 370 double E_last; 371 do { 372 E_last = E; 373 E = M + _e*sin(E); 374 } while ( fabs(E-E_last)*a0 > 0.001 ); 375 double v = 2.0*atan( sqrt( (1.0 + _e)/(1.0 - _e) )*tan( E/2 ) ); 376 double u0 = v + _omega; 377 double sin2u0 = sin(2*u0); 378 double cos2u0 = cos(2*u0); 379 double r = a0*(1 - _e*cos(E)) + _Crc*cos2u0 + _Crs*sin2u0; 380 double i = _i0 + _IDOT*tk + _Cic*cos2u0 + _Cis*sin2u0; 381 double u = u0 + _Cuc*cos2u0 + _Cus*sin2u0; 382 double xp = r*cos(u); 383 double yp = r*sin(u); 384 double OM = _OMEGA0 + (_OMEGADOT - omegaEarth)*tk - 385 omegaEarth*_TOE; 386 387 double sinom = sin(OM); 388 double cosom = cos(OM); 389 double sini = sin(i); 390 double cosi = cos(i); 391 xc[0] = xp*cosom - yp*cosi*sinom; 392 xc[1] = xp*sinom + yp*cosi*cosom; 393 xc[2] = yp*sini; 394 395 double tc = GPSweeks - _TOC; 396 if (GPSweek != _GPSweek) { 397 tc += (GPSweek - _GPSweek) * secPerWeek; 398 } 399 xc[3] = _clock_bias + _clock_drift*tc + _clock_driftrate*tc*tc; 400 401 // Velocity 402 // -------- 403 double tanv2 = tan(v/2); 404 double dEdM = 1 / (1 - _e*cos(E)); 405 double dotv = sqrt((1.0 + _e)/(1.0 - _e)) / cos(E/2)/cos(E/2) / (1 + tanv2*tanv2) 406 * dEdM * n; 407 double dotu = dotv + (-_Cuc*sin2u0 + _Cus*cos2u0)*2*dotv; 408 double dotom = _OMEGADOT - omegaEarth; 409 double doti = _IDOT + (-_Cic*sin2u0 + _Cis*cos2u0)*2*dotv; 410 double dotr = a0 * _e*sin(E) * dEdM * n 411 + (-_Crc*sin2u0 + _Crs*cos2u0)*2*dotv; 412 double dotx = dotr*cos(u) - r*sin(u)*dotu; 413 double doty = dotr*sin(u) + r*cos(u)*dotu; 414 415 vv[0] = cosom *dotx - cosi*sinom *doty // dX / dr 416 - xp*sinom*dotom - yp*cosi*cosom*dotom // dX / dOMEGA 417 + yp*sini*sinom*doti; // dX / di 418 419 vv[1] = sinom *dotx + cosi*cosom *doty 420 + xp*cosom*dotom - yp*cosi*sinom*dotom 421 - yp*sini*cosom*doti; 422 423 vv[2] = sini *doty + yp*cosi *doti; 424 425 // Relativistic Correction 426 // ----------------------- 427 // xc(4) -= 4.442807633e-10 * _e * sqrt(a0) *sin(E); 428 xc[3] -= 2.0 * (xc[0]*vv[0] + xc[1]*vv[1] + xc[2]*vv[2]) / t_CST::c / t_CST::c; 429 } 430
Note:
See TracChangeset
for help on using the changeset viewer.