00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include "Keplerian.h"
00014 namespace O_SESSAME {
00015
00016
00017 Keplerian::~Keplerian()
00018 {
00019 }
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 Keplerian* Keplerian::NewPointer()
00030 {
00031 return new Keplerian();
00032 }
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 Keplerian* Keplerian::Clone()
00043 {
00044 return new Keplerian(*this);
00045 }
00046
00047
00048
00049 Keplerian::Keplerian() : m_OrbitalElements(NUM_KEPLERIAN_ELEMENTS), m_OrbitalParameters( NUM_KEPLERIAN_PARAMETERS )
00050 {
00051 }
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062 Keplerian::Keplerian(const Vector& _Elements): m_OrbitalElements(NUM_KEPLERIAN_ELEMENTS), m_OrbitalParameters( NUM_KEPLERIAN_PARAMETERS )
00063 {
00064 SetKeplerianRepresentationTrueAnomaly( _Elements );
00065 }
00066
00067
00068
00069
00070
00071 Keplerian Keplerian::KeplerianCopy( )
00072 {
00073 return( *this );
00074 }
00075
00076
00077
00078
00079
00080
00081 void Keplerian::SetKeplerianRepresentationTrueAnomaly( const Vector& _OrbitalElements )
00082 {
00083
00084 m_OrbitalElements = _OrbitalElements;
00085
00086 m_OrbitalParameters( ARG_LATTITUDE ) = GetArgLattitude();
00087
00088 m_OrbitalParameters( LONG_PERIGEE ) = GetLongPerigee();
00089
00090 m_OrbitalParameters( TRUE_LONGITUDE ) = GetTrueLongitude();
00091
00092 m_OrbitalParameters( ECCENTRIC_ANOMALY ) = GetEccentricAnomalyFromTrueAnomaly();
00093
00094 m_OrbitalParameters( MEAN_ANOMALY ) = GetMeanAnomalyFromEccentricAnomaly();
00095
00096 return;
00097 }
00098
00099
00100
00101
00102
00103
00104 void Keplerian::SetKeplerianRepresentationEccentricAnomaly( const Vector& _OrbitalElements )
00105 {
00106
00107 m_OrbitalElements( _(SEMIMAJOR_AXIS, ARG_PERIGEE) ) = _OrbitalElements( _( SEMIMAJOR_AXIS, ARG_PERIGEE ) ) ;
00108
00109 m_OrbitalParameters( ECCENTRIC_ANOMALY ) = _OrbitalElements( VectorIndexBase + 5 );
00110
00111 GetTrueAnomalyFromEccentricAnomaly( m_OrbitalParameters( ECCENTRIC_ANOMALY ) );
00112
00113
00114 m_OrbitalParameters( ARG_LATTITUDE ) = GetArgLattitude();
00115
00116 m_OrbitalParameters( LONG_PERIGEE ) = GetLongPerigee();
00117
00118 m_OrbitalParameters( TRUE_LONGITUDE ) = GetTrueLongitude();
00119
00120 m_OrbitalParameters( MEAN_ANOMALY ) = GetMeanAnomalyFromEccentricAnomaly();
00121
00122 return;
00123 }
00124
00125
00126
00127
00128
00129
00130
00131 void Keplerian::SetKeplerianRepresentationMeanAnomaly( const Vector& _OrbitalElements )
00132 {
00133
00134 m_OrbitalElements( _(SEMIMAJOR_AXIS, ARG_PERIGEE) ) = _OrbitalElements( _( SEMIMAJOR_AXIS, ARG_PERIGEE ) ) ;
00135
00136
00137 m_OrbitalParameters( MEAN_ANOMALY ) = _OrbitalElements( VectorIndexBase + 5 );
00138
00139
00140 m_OrbitalParameters( ECCENTRIC_ANOMALY ) = GetEccentricAnomalyFromMeanAnomaly( m_OrbitalParameters( MEAN_ANOMALY ) );
00141
00142
00143 GetTrueAnomalyFromEccentricAnomaly( m_OrbitalParameters( ECCENTRIC_ANOMALY ) );
00144
00145
00146 m_OrbitalParameters( ARG_LATTITUDE ) = GetArgLattitude();
00147
00148 m_OrbitalParameters( LONG_PERIGEE ) = GetLongPerigee();
00149
00150 m_OrbitalParameters( TRUE_LONGITUDE ) = GetTrueLongitude();
00151
00152
00153
00154 return;
00155 }
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166 void Keplerian::SetPositionVelocity(const Vector& _position, const Vector& _velocity)
00167 {
00168 double radiusScalar = norm2( _position );
00169 double velocityScalar = norm2( _velocity );
00170 Vector angularMomentumVector = crossP( _position, _velocity);
00171 double angularMomentumScalar = norm2( angularMomentumVector );
00172
00173
00174 m_OrbitalElements(SEMIMAJOR_AXIS) = 1 / ( 2/radiusScalar - pow( velocityScalar, 2 )/MU );
00175
00176
00177 Vector Eccentricity(3);
00178 Eccentricity = ( crossP( _velocity, angularMomentumVector ) - MU/radiusScalar * _position ) / MU ;
00179 m_OrbitalElements(ECCENTRICITY) = norm2( Eccentricity );
00180
00181
00182 Vector i_e = Eccentricity/( m_OrbitalElements(ECCENTRICITY) );
00183 Vector i_h = angularMomentumVector/angularMomentumScalar;
00184 Vector i_p = crossP( i_h, i_e );
00185
00186 Vector i_r = _position/radiusScalar;
00187
00188 Matrix PN(3,3);
00189 PN( _(1), _(1,3) ) = ~i_e;
00190 PN( _(2), _(1,3) ) = ~i_p;
00191 PN( _(3), _(1,3) ) = ~i_h;
00192
00193
00194 if( PN(3,2) == 0 )
00195 m_OrbitalElements( LONG_ASC_NODE ) = atan2( PN(3,1), PN(3,2) );
00196 else
00197 m_OrbitalElements( LONG_ASC_NODE ) = atan2( PN(3,1), -PN(3,2) );
00198
00199
00200 m_OrbitalElements( INCLINATION ) = acos( PN(3,3) );
00201
00202
00203 m_OrbitalElements( ARG_PERIGEE ) = atan2( PN(1,3), PN(2,3) );
00204
00205
00206
00207 m_OrbitalElements( TRUE_ANOMALY ) = atan2( ( ( crossP(i_e, i_r) ).dot(i_h) ), ( i_e.dot( i_r ) ) );
00208
00209
00210 const double tolerance = 10e-8;
00211 if( abs( m_OrbitalElements(ECCENTRICITY) ) < tolerance )
00212 {
00213 m_OrbitalElements( ARG_PERIGEE ) = 0;
00214 if( m_OrbitalElements( INCLINATION ) < tolerance )
00215 {
00216 m_OrbitalElements(LONG_ASC_NODE) = 0;
00217 m_OrbitalElements(TRUE_ANOMALY) = acos( _position( VectorIndexBase ) / radiusScalar );
00218 if( _position( VectorIndexBase+1 ) < 0 )
00219 m_OrbitalElements(TRUE_ANOMALY) = 2*PI - m_OrbitalElements(TRUE_ANOMALY);
00220 }
00221 else
00222 {
00223
00224
00225 Vector K_Vector(3);
00226 K_Vector(VectorIndexBase+2) = 1;
00227 Vector lineNodes = crossP( K_Vector, angularMomentumVector );
00228 double magLineNodes = norm2( lineNodes );
00229 m_OrbitalElements( TRUE_ANOMALY ) = acos( lineNodes.dot( _position )/( magLineNodes * radiusScalar) );
00230 if( _position( VectorIndexBase+2 ) < 0 )
00231 m_OrbitalElements(TRUE_ANOMALY) = 2*PI - ( m_OrbitalElements( TRUE_ANOMALY ) );
00232 }
00233 }
00234
00235 else if( m_OrbitalElements( INCLINATION ) < tolerance )
00236 {
00237 m_OrbitalElements( LONG_ASC_NODE ) = 0;
00238 m_OrbitalElements( ARG_PERIGEE ) = acos( Eccentricity( VectorIndexBase ) / m_OrbitalElements(ECCENTRICITY) );
00239 if (Eccentricity(VectorIndexBase+2) < 0)
00240 m_OrbitalElements(ARG_PERIGEE) = 2*PI - m_OrbitalElements(ARG_PERIGEE);
00241 }
00242
00243
00244 m_OrbitalParameters( ARG_LATTITUDE ) = GetArgLattitude();
00245
00246
00247 m_OrbitalParameters( LONG_PERIGEE ) = GetLongPerigee();
00248
00249
00250 m_OrbitalParameters( TRUE_LONGITUDE ) = GetTrueLongitude();
00251
00252
00253 m_OrbitalParameters( ECCENTRIC_ANOMALY ) = GetEccentricAnomalyFromTrueAnomaly();
00254
00255
00256 m_OrbitalParameters( MEAN_ANOMALY ) = GetMeanAnomalyFromEccentricAnomaly();
00257
00258
00259 return;
00260 }
00261
00262
00263
00264
00265
00266
00267 double Keplerian::GetArgLattitude()
00268 {
00269 m_OrbitalParameters( ARG_LATTITUDE ) = m_OrbitalElements( ARG_PERIGEE ) + m_OrbitalElements( TRUE_ANOMALY );
00270 return( m_OrbitalParameters( ARG_LATTITUDE ) );
00271 }
00272
00273
00274
00275
00276
00277 double Keplerian::GetLongPerigee()
00278 {
00279 m_OrbitalParameters( LONG_PERIGEE ) = m_OrbitalElements( LONG_ASC_NODE ) + m_OrbitalElements( ARG_PERIGEE );
00280 return( m_OrbitalParameters( LONG_PERIGEE ) );
00281 }
00282
00283
00284
00285
00286
00287 double Keplerian::GetTrueLongitude()
00288 {
00289 m_OrbitalParameters( TRUE_LONGITUDE ) = m_OrbitalElements( LONG_ASC_NODE ) + m_OrbitalElements( ARG_PERIGEE ) + m_OrbitalElements( TRUE_ANOMALY );
00290 return( m_OrbitalParameters( TRUE_ANOMALY ) );
00291 }
00292
00293
00294
00295
00296
00297
00298 double Keplerian::GetEccentricAnomalyFromTrueAnomaly()
00299 {
00300
00301 m_OrbitalParameters( ECCENTRIC_ANOMALY ) = 2 * atan2( tan( m_OrbitalElements( TRUE_ANOMALY )/2 )
00302 * sqrt( ( 1 - m_OrbitalElements( ECCENTRICITY ) ) ), sqrt( ( 1 + m_OrbitalElements( ECCENTRICITY ) ) ) );
00303 return( m_OrbitalParameters( ECCENTRIC_ANOMALY ) );
00304 }
00305
00306
00307
00308
00309
00310 double Keplerian::GetMeanAnomalyFromEccentricAnomaly()
00311 {
00312
00313 m_OrbitalParameters(MEAN_ANOMALY) = m_OrbitalParameters( ECCENTRIC_ANOMALY ) - m_OrbitalElements( ECCENTRICITY )
00314 *sin( m_OrbitalParameters( ECCENTRIC_ANOMALY ) );
00315 return( m_OrbitalParameters( MEAN_ANOMALY ) );
00316 }
00317
00318
00319
00320
00321
00322
00323
00324 void Keplerian::SetPositionVelocity(const Vector& _PositionVelocity)
00325 {
00326 Vector Pos(3);
00327 Pos(_) = _PositionVelocity(_(VectorIndexBase, VectorIndexBase+2));
00328 Vector Vel(3);
00329 Vel(_) = _PositionVelocity(_(VectorIndexBase+3, VectorIndexBase+5));
00330
00331 SetPositionVelocity(Pos, Vel);
00332 }
00333
00334
00335
00336
00337
00338
00339
00340
00341 void Keplerian::SetPositionVelocity(const Vector& _Position, const Vector& _Velocity, const OrbitFrame& _OrbFrame)
00342 {
00343
00344 Vector Position = _OrbFrame.GetRotation2IJK() * _Position;
00345 Vector Velocity = _OrbFrame.GetRotation2IJK() * _Velocity;
00346
00347
00348 SetPositionVelocity(Position, Velocity);
00349 }
00350
00351
00352
00353
00354
00355
00356
00357 void Keplerian::SetPositionVelocity(const Vector& _PositionVelocity, const OrbitFrame& _OrbFrame)
00358 {
00359 Vector Pos(3); Pos(_) = _PositionVelocity(_(VectorIndexBase, VectorIndexBase+2));
00360 Vector Vel(3); Vel(_) = _PositionVelocity(_(VectorIndexBase+3, VectorIndexBase+5));
00361
00362 SetPositionVelocity(Pos, Vel, _OrbFrame);
00363 }
00364
00365
00366
00367
00368
00369
00370
00371 Vector Keplerian::GetPositionVelocity() const
00372 {
00373
00374
00375 Rotation _transformMatrix = R3( -GetLongAscNode() ) * R1( -GetInclination() ) * R3( -GetArgPerigee() );
00376
00377 Vector _positionVelocityPQW(6);
00378 _positionVelocityPQW = GetPositionVelocityPQW();
00379
00380 Vector _positionVelocityECI(6);
00381 _positionVelocityECI( _(VectorIndexBase + 0, VectorIndexBase + 2) )
00382 = _transformMatrix * _positionVelocityPQW( _(VectorIndexBase + 0, VectorIndexBase + 2) );
00383 _positionVelocityECI( _(VectorIndexBase + 3, VectorIndexBase + 5) )
00384 = _transformMatrix * _positionVelocityPQW( _(VectorIndexBase + 3, VectorIndexBase + 5) );
00385
00386 return _positionVelocityECI;
00387 }
00388
00389
00390
00391
00392
00393
00394 Vector Keplerian::GetPositionVelocityPQW() const
00395 {
00396 Vector _positionVelocity(6);
00397
00398 _positionVelocity(VectorIndexBase + 0) = (GetSemiParameter() * cos(GetTrueAnomaly())) / (1 + GetEccentricity() * cos(GetTrueAnomaly()));
00399 _positionVelocity(VectorIndexBase + 1) = (GetSemiParameter() * sin(GetTrueAnomaly())) / (1 + GetEccentricity() * cos(GetTrueAnomaly()));
00400
00401 _positionVelocity(VectorIndexBase + 3) = -sqrt(MU/GetSemiParameter()) * sin(GetTrueAnomaly());
00402 _positionVelocity(VectorIndexBase + 4) = sqrt(MU/GetSemiParameter()) * (GetEccentricity() + cos(GetTrueAnomaly()));
00403
00404
00405 return _positionVelocity;
00406 }
00407
00408
00409
00410
00411
00412 Vector Keplerian::GetPositionVelocity(const OrbitFrame& _TargetOrbFrame) const
00413 {
00414 Vector _positionVelocity = GetPositionVelocity();
00415
00416
00417 _positionVelocity(_(VectorIndexBase, VectorIndexBase+2)) = _TargetOrbFrame.GetRotationFromIJK() * _positionVelocity(_(VectorIndexBase, VectorIndexBase+2));
00418 _positionVelocity(_(VectorIndexBase+3, VectorIndexBase+5)) = _TargetOrbFrame.GetRotationFromIJK() * _positionVelocity(_(VectorIndexBase+3, VectorIndexBase+5));
00419 return _positionVelocity;
00420 }
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430 void Keplerian::GetPositionVelocity(Vector& _position, Vector& _velocity) const
00431 {
00432 Vector _positionVelocity = GetPositionVelocity();
00433 _position = _positionVelocity( _(VectorIndexBase, VectorIndexBase+2) );
00434 _velocity = _positionVelocity( _(VectorIndexBase+3, VectorIndexBase+5) );
00435
00436 return;
00437 }
00438
00439
00440
00441
00442
00443
00444
00445 void Keplerian::GetPositionVelocity(Vector& _Position, Vector& _Velocity, const OrbitFrame& _TargetOrbFrame) const
00446 {
00447
00448 GetPositionVelocity(_Position, _Velocity);
00449
00450
00451 _Position = _TargetOrbFrame.GetRotationFromIJK() * _Position;
00452 _Velocity = _TargetOrbFrame.GetRotationFromIJK() * _Velocity;
00453
00454 return;
00455 }
00456
00457
00458
00459
00460
00461
00462
00463 double Keplerian::GetEccentricAnomalyFromMeanAnomaly(const double& _MeanAnomaly)
00464 {
00465
00466 const double tolerance = 1e-11;
00467
00468 double _EccentricAnomaly;
00469 double testEccAnomaly;
00470 double eccentricity = m_OrbitalElements(ECCENTRICITY);
00471
00472
00473 testEccAnomaly = _MeanAnomaly;
00474 _EccentricAnomaly = testEccAnomaly -
00475 ( testEccAnomaly - eccentricity*sin(testEccAnomaly) - _MeanAnomaly ) /
00476 ( 1 - eccentricity*cos(testEccAnomaly) );
00477
00478 while ( fabs(_EccentricAnomaly-testEccAnomaly) > tolerance )
00479 {
00480 testEccAnomaly = _EccentricAnomaly;
00481 _EccentricAnomaly = testEccAnomaly -
00482 ( testEccAnomaly - eccentricity*sin(testEccAnomaly) - _MeanAnomaly ) /
00483 ( 1 - eccentricity*cos(testEccAnomaly) );
00484 }
00485
00486 return _EccentricAnomaly;
00487 }
00488
00489
00490
00491
00492
00493
00494
00495
00496
00497 void Keplerian::GetTrueAnomalyFromEccentricAnomaly(const double& _EccentricAnomaly)
00498 {
00499
00500 double cosTrueAnomaly;
00501 double sinTrueAnomaly;
00502 double semimajoraxis = m_OrbitalElements(SEMIMAJOR_AXIS);
00503 double eccentricity = m_OrbitalElements(ECCENTRICITY);
00504
00505 cosTrueAnomaly = ( eccentricity - cos(_EccentricAnomaly) ) /
00506 ( eccentricity*cos(_EccentricAnomaly) - 1 );
00507 sinTrueAnomaly = ( ( semimajoraxis*sqrt(1 - eccentricity*eccentricity) ) /
00508 ( semimajoraxis*(1 - eccentricity*cos(_EccentricAnomaly)) ) ) *
00509 sin(_EccentricAnomaly);
00510
00511 m_OrbitalElements(TRUE_ANOMALY) = atan2( sinTrueAnomaly, cosTrueAnomaly );
00512 if ( m_OrbitalElements(TRUE_ANOMALY) < 0 );
00513 {
00514 m_OrbitalElements(TRUE_ANOMALY) = m_OrbitalElements(TRUE_ANOMALY) + 2*PI;
00515 }
00516
00517 return;
00518 }
00519
00520
00521
00522
00523
00524
00525
00526
00527
00528
00529
00530
00531
00532
00533
00534
00535
00536
00537
00538
00539
00540
00541
00542
00543
00544
00545
00546
00547 tleStruct Keplerian::ReadTwoLineElementSet(const string& _TwoLineElementSet)
00548 {
00549
00550 int finder = 0;
00551 int endlfinder;
00552 int finderLength;
00553
00554 string LineZero;
00555 string LineOne;
00556 string LineTwo;
00557
00558 stringstream placeholder;
00559 int exponent;
00560
00561
00562 endlfinder = _TwoLineElementSet.find('\n',finder);
00563 finderLength = endlfinder - finder;
00564 LineZero = _TwoLineElementSet.substr(finder,finderLength);
00565
00566 finder = endlfinder + 1;
00567 endlfinder = _TwoLineElementSet.find('\n',finder);
00568 finderLength = endlfinder - finder;
00569 LineOne = _TwoLineElementSet.substr(finder,finderLength);
00570
00571 finder = endlfinder + 1;
00572 endlfinder = _TwoLineElementSet.size();
00573 finderLength = endlfinder - finder;
00574 LineTwo = _TwoLineElementSet.substr(finder,finderLength);
00575
00576
00577
00578
00579
00580
00581
00582
00583 m_tleData.satName = LineZero.substr(0,24);
00584
00585
00586
00587
00588
00589
00590 finder = 2;
00591 endlfinder = LineOne.find(' ',finder);
00592 finderLength = endlfinder - finder;
00593 placeholder << LineOne.substr(finder,finderLength-1);
00594 placeholder >> m_tleData.satNumber;
00595
00596 placeholder.clear();
00597 placeholder << LineOne.substr(endlfinder-1,1);
00598 placeholder >> m_tleData.satClassification;
00599
00600
00601 finder = endlfinder + 1;
00602 endlfinder = LineOne.find(' ',finder);
00603 placeholder.clear();
00604 placeholder << LineOne.substr(finder,2);
00605 placeholder >> m_tleData.launchYear;
00606
00607
00608
00609 placeholder.clear();
00610 placeholder << LineOne.substr(finder+2,3);
00611 placeholder >> m_tleData.launchNumber;
00612
00613 placeholder.clear();
00614 finderLength = endlfinder - finder;
00615 placeholder << LineOne.substr(finder+5,finderLength-5);
00616 placeholder >> m_tleData.launchPiece;
00617
00618
00619 finder = endlfinder + 1;
00620 endlfinder = LineOne.find(' ',finder);
00621 placeholder.clear();
00622 placeholder << LineOne.substr(finder,2);
00623 placeholder >> m_tleData.epochYear;
00624
00625 placeholder.clear();
00626 finderLength = endlfinder - finder;
00627 placeholder << LineOne.substr(finder+2,finderLength-2);
00628 placeholder >> m_tleData.epochDay;
00629
00630
00631 finder = endlfinder + 1;
00632 endlfinder = LineOne.find(' ',finder);
00633 finderLength = endlfinder - finder;
00634 placeholder.clear();
00635 placeholder << LineOne.substr(finder,finderLength);
00636 placeholder >> m_tleData.meanmotion1stDeriv;
00637
00638
00639 finder = endlfinder + 1;
00640 endlfinder = LineOne.find_first_of("-+",finder+1);
00641 finderLength = endlfinder - finder;
00642 placeholder.clear();
00643 placeholder << LineOne.substr(finder,finderLength);
00644 placeholder >> m_tleData.meanmotion2ndDeriv;
00645 finder = endlfinder;
00646 endlfinder = LineOne.find(' ',finder);
00647 finderLength = endlfinder - finder;
00648 placeholder.clear();
00649 placeholder << LineOne.substr(finder,finderLength);
00650 placeholder >> exponent;
00651 m_tleData.meanmotion2ndDeriv *= pow(10.0,exponent);
00652 if ( LineOne[finder] == '+' || LineOne[finder] == '-' )
00653 m_tleData.meanmotion2ndDeriv /= pow(10.0,finderLength-1);
00654 else
00655 m_tleData.meanmotion2ndDeriv /= pow(10.0,finderLength);
00656
00657
00658 finder = endlfinder + 1;
00659 endlfinder = LineOne.find_first_of("-+",finder+1);
00660 finderLength = endlfinder - finder;
00661 placeholder.clear();
00662 placeholder << LineOne.substr(finder,finderLength);
00663 placeholder >> m_tleData.bstarDrag;
00664 finder = endlfinder;
00665 endlfinder = LineOne.find(' ',finder);
00666 placeholder.clear();
00667 placeholder << LineOne.substr(finder,finderLength);
00668 placeholder >> exponent;
00669 m_tleData.bstarDrag *= pow(10.0,exponent);
00670 if ( LineOne[finder] == '+' || LineOne[finder] == '-' )
00671 m_tleData.bstarDrag /= pow(10.0,finderLength-1);
00672 else
00673 m_tleData.bstarDrag /= pow(10.0,finderLength);
00674
00675
00676 finder = endlfinder + 1;
00677 endlfinder = LineOne.find(' ',finder);
00678 finderLength = endlfinder - finder;
00679 placeholder.clear();
00680 placeholder << LineOne.substr(finder,finderLength);
00681 placeholder >> m_tleData.ephemerisType;
00682
00683
00684 finder = endlfinder + 1;
00685 endlfinder = LineOne.size()-1;
00686 finderLength = endlfinder - finder;
00687 placeholder.clear();
00688 placeholder << LineOne.substr(finder,finderLength);
00689 placeholder >> m_tleData.elementNumber;
00690
00691
00692 placeholder.clear();
00693 placeholder << LineOne.substr(endlfinder,1);
00694 placeholder >> m_tleData.checksumLine1;
00695
00696
00697
00698
00699
00700
00701
00702 endlfinder = LineTwo.find(' ',2);
00703 finder = endlfinder + 1;
00704 endlfinder = LineTwo.find(' ',finder);
00705 finderLength = endlfinder - finder;
00706 placeholder.clear();
00707 placeholder << LineTwo.substr(finder,finderLength);
00708 placeholder >> m_OrbitalElements(INCLINATION);
00709 m_OrbitalElements(INCLINATION) *= PI/180.0;
00710
00711
00712 finder = endlfinder + 1;
00713 endlfinder = LineTwo.find(' ',finder);
00714 finderLength = endlfinder - finder;
00715 placeholder.clear();
00716 placeholder << LineTwo.substr(finder,finderLength);
00717 placeholder >> m_OrbitalElements(LONG_ASC_NODE);
00718 m_OrbitalElements(LONG_ASC_NODE) *= PI/180.0;
00719
00720
00721
00722 finder = endlfinder + 1;
00723 endlfinder = LineTwo.find(' ',finder);
00724 finderLength = endlfinder - finder;
00725 placeholder.clear();
00726 placeholder << "0." << LineTwo.substr(finder,finderLength);
00727 placeholder >> m_OrbitalElements(ECCENTRICITY);
00728 m_OrbitalElements(ECCENTRICITY) *= PI/180.0;
00729
00730
00731 finder = endlfinder + 1;
00732 endlfinder = LineTwo.find(' ',finder);
00733 finderLength = endlfinder - finder;
00734 placeholder.clear();
00735 placeholder << LineTwo.substr(finder,finderLength);
00736 placeholder >> m_OrbitalElements(ARG_PERIGEE);
00737 m_OrbitalElements(ARG_PERIGEE) *= PI/180.0;
00738
00739
00740 finder = endlfinder + 1;
00741 endlfinder = LineTwo.find(' ',finder);
00742 finderLength = endlfinder - finder;
00743 placeholder.clear();
00744 placeholder << LineTwo.substr(finder,finderLength);
00745 placeholder >> m_tleData.meanAnomaly;
00746 m_tleData.meanAnomaly *= PI/180.0;
00747 m_tleData.eccentricAnomaly = GetEccentricAnomalyFromMeanAnomaly(m_tleData.meanAnomaly);
00748
00749
00750 finder = endlfinder + 1;
00751 endlfinder = LineTwo.size()-1;
00752 placeholder.clear();
00753 placeholder << LineTwo.substr(finder,11);
00754 placeholder >> m_tleData.meanMotion;
00755
00756 m_OrbitalElements(SEMIMAJOR_AXIS) = pow( (MU/pow(m_tleData.meanMotion,2)), (1.0/3.0) );
00757
00758 GetTrueAnomalyFromEccentricAnomaly(m_tleData.eccentricAnomaly);
00759
00760
00761 placeholder.clear();
00762 placeholder << LineTwo.substr(finder+11,5);
00763 placeholder >> m_tleData.revolutionNumber;
00764
00765
00766 placeholder.clear();
00767 placeholder << LineTwo.substr(endlfinder,1);
00768 placeholder >> m_tleData.checksumLine2;
00769
00770 return m_tleData;
00771 }
00772
00773
00774
00775
00776
00777
00778
00779
00780
00781
00782
00783
00784
00785
00786
00787
00788
00789
00790
00791
00792
00793
00794 void Keplerian::SetState(const Vector& _Elements)
00795 {
00796
00797 SetKeplerianRepresentationTrueAnomaly( _Elements );
00798
00799 return;
00800 }
00801
00802
00803
00804
00805
00806 Vector Keplerian::GetState() const
00807 {
00808 return m_OrbitalElements;
00809 }
00810
00811
00812
00813
00814
00815 void Keplerian::GetState(Vector& _Elements) const
00816 {
00817 _Elements = m_OrbitalElements;
00818 return;
00819 }
00820
00821
00822
00823
00824 }
00825
00826
00827
00828
00829
00830
00831
00832
00833
00834
00835
00836
00837
00838
00839
00840
00841
00842
00843
00844
00845
00846
00847
00848
00849
00850
00851
00852
00853
00854
00855
00856
00857
00858
00859
00860
00861
00862
00863
00864
00865
00866
00867
00868
00869
00870
00871
00872
00873
00874
00875
00876
00877
00878
00879