Changeset 2221 in ntrip for trunk/BNC/RTCM3/ephemeris.cpp
- Timestamp:
- Jan 12, 2010, 8:36:29 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/RTCM3/ephemeris.cpp
r1239 r2221 5 5 6 6 #include "ephemeris.h" 7 #include "bncutils.h" 7 8 #include "timeutils.h" 8 9 … … 270 271 out << endl; 271 272 } 273 274 // Derivative of the state vector using a simple force model (static) 275 //////////////////////////////////////////////////////////////////////////// 276 ColumnVector t_ephGlo::glo_deriv(double /* tt */, const ColumnVector& xv) { 277 278 // State vector components 279 // ----------------------- 280 ColumnVector rr = xv.rows(1,3); 281 ColumnVector vv = xv.rows(4,6); 282 283 // Acceleration 284 // ------------ 285 static const double GM = 398.60044e12; 286 static const double AE = 6378136.0; 287 static const double OMEGA = 7292115.e-11; 288 static const double C20 = -1082.63e-6; 289 290 double rho = rr.norm_Frobenius(); 291 double t1 = -GM/(rho*rho*rho); 292 double t2 = 3.0/2.0 * C20 * (GM*AE*AE) / (rho*rho*rho*rho*rho); 293 double t3 = OMEGA * OMEGA; 294 double t4 = 2.0 * OMEGA; 295 double z2 = rr(3) * rr(3); 296 297 // Vector of derivatives 298 // --------------------- 299 ColumnVector va(6); 300 va(1) = vv(1); 301 va(2) = vv(2); 302 va(3) = vv(3); 303 va(4) = (t1 + t2*(1.0-5.0*z2/(rho*rho)) + t3) * rr(1) + t4*vv(2); 304 va(5) = (t1 + t2*(1.0-5.0*z2/(rho*rho)) + t3) * rr(2) - t4*vv(1); 305 va(6) = (t1 + t2*(3.0-5.0*z2/(rho*rho)) ) * rr(3); 306 307 return va; 308 } 309 310 // Compute Glonass Satellite Position (virtual) 311 //////////////////////////////////////////////////////////////////////////// 312 void t_ephGlo::position(int GPSweek, double GPSweeks, 313 double* xc, double* vv) const { 314 315 static const double secPerWeek = 7 * 86400.0; 316 static const double nominalStep = 10.0; 317 318 memset(xc, 0, 4*sizeof(double)); 319 memset(vv, 0, 3*sizeof(double)); 320 321 double dtPos = GPSweeks - _tt; 322 if (GPSweek != _GPSweek) { 323 dtPos += (GPSweek - _GPSweek) * secPerWeek; 324 } 325 326 int nSteps = int(fabs(dtPos) / nominalStep) + 1; 327 double step = dtPos / nSteps; 328 329 for (int ii = 1; ii <= nSteps; ii++) { 330 _xv = rungeKutta4(_tt, _xv, step, glo_deriv); 331 _tt += step; 332 } 333 334 // Position and Velocity 335 // --------------------- 336 xc[0] = _xv(1); 337 xc[1] = _xv(2); 338 xc[2] = _xv(3); 339 340 vv[0] = _xv(4); 341 vv[1] = _xv(5); 342 vv[2] = _xv(6); 343 344 // Clock Correction 345 // ---------------- 346 double dtClk = GPSweeks - _GPSweeks; 347 if (GPSweek != _GPSweek) { 348 dtClk += (GPSweek - _GPSweek) * secPerWeek; 349 } 350 xc[3] = -_tau + _gamma * dtClk; 351 } 352 353 // IOD of Glonass Ephemeris (virtual) 354 //////////////////////////////////////////////////////////////////////////// 355 int t_ephGlo::IOD() const { 356 357 bool old = false; 358 359 if (old) { // 5 LSBs of iod are equal to 5 LSBs of tb 360 unsigned int tb = int(fmod(_GPSweeks,86400.0)); //sec of day 361 const int shift = sizeof(tb) * 8 - 5; 362 unsigned int iod = tb << shift; 363 return (iod >> shift); 364 } 365 else { 366 return int(fmod(_tki, 3600)) / 30; 367 } 368 } 369 370 // Print Glonass Ephemeris (virtual) 371 //////////////////////////////////////////////////////////////////////////// 372 void t_ephGlo::print(std::ostream& out) const { 373 374 } 375 376 // Set Glonass Ephemeris 377 //////////////////////////////////////////////////////////////////////////// 378 void t_ephGlo::set(const glonassephemeris* ee) { 379 380 }
Note:
See TracChangeset
for help on using the changeset viewer.