OptimizedOrbitPositions Class Reference

#include <orsa_orbit.h>

Collaboration diagram for OptimizedOrbitPositions:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 OptimizedOrbitPositions (const OrbitWithEpoch &orbit)
Sky PropagatedSky_J2000 (const UniverseTypeAwareTime &, const std::string &obscode, const bool integrate=true, const bool light_time_corrections=true)
void PropagatedPosVel (const UniverseTypeAwareTime &, Vector &, Vector &, bool integrate=true)
OrbitWithEpoch PropagatedOrbit (const UniverseTypeAwareTime &, bool integrate=true)

Constructor & Destructor Documentation

OptimizedOrbitPositions const OrbitWithEpoch orbit  ) 
 

Definition at line 869 of file orsa_orbit.cc.

References orsa::EARTH_AND_MOON, orsa::JUPITER, orsa::MARS, orsa::MERCURY, orsa::NEPTUNE, orsa::SATURN, orsa::SUN, orsa::URANUS, and orsa::VENUS.

00869                                                                               : _orbit(orbit) {
00870     
00871     l.push_back(SUN);
00872     l.push_back(MERCURY);
00873     l.push_back(VENUS);
00874     l.push_back(EARTH_AND_MOON);
00875     l.push_back(MARS);
00876     l.push_back(JUPITER);
00877     l.push_back(SATURN);
00878     l.push_back(URANUS);
00879     l.push_back(NEPTUNE);   
00880     
00881     frames.clear();
00882   }


Member Function Documentation

OrbitWithEpoch PropagatedOrbit const UniverseTypeAwareTime ,
bool  integrate = true
 

Definition at line 884 of file orsa_orbit.cc.

References Integrator::accuracy, OrbitWithEpoch::Compute(), orsa::DAY, Radau15::e, OrbitWithEpoch::epoch, orsa::FromUnits(), orsa::GetG(), orsa::GetMSun(), Evolution::Integrate(), Orbit::M, orsa::NEWTON, Orbit::Period(), Evolution::push_back(), OrbitWithEpoch::RelativePosVel(), Evolution::SetIntegrator(), Evolution::SetInteraction(), Evolution::SetMaxUnsavedSubSteps(), Body::SetPosition(), Evolution::SetSamplePeriod(), orsa::SetupSolarSystem(), Body::SetVelocity(), Frame::size(), Evolution::size(), orsa::SUN, UniverseTypeAwareTime::Time(), Integrator::timestep, and orsa::twopi.

Referenced by OptimizedOrbitPositions::PropagatedPosVel(), and OptimizedOrbitPositions::PropagatedSky_J2000().

00884                                                                                                                         {
00885     
00886     std::sort(frames.begin(),frames.end());
00887     
00888     /* 
00889        for (unsigned int k=0;k<frames.size();++k) {
00890        ORSA_ERROR("OptimizedOrbitPositions::PropagatedOrbit(...)  ==> frame[%i] time: %f   dt: %f",k,frames[k].GetTime(),(frames[k]-final_time).absolute().GetDouble());
00891        }
00892     */
00893     
00894     if (!integrate) {
00895       OrbitWithEpoch oe(_orbit);
00896       oe.M += twopi*(final_time.Time() - _orbit.epoch.Time())/(_orbit.Period());
00897       oe.M  = fmod(10*twopi+fmod(oe.M,twopi),twopi);
00898       oe.epoch = final_time;
00899       return (oe);
00900     }
00901     
00902     Frame start_frame;
00903     
00904     if (frames.size() > 0) {
00905       
00906       if (final_time <= frames[0]) {
00907         start_frame = frames[0];
00908         // ORSA_ERROR("OptimizedOrbitPositions::PropagatedOrbit(...)  ==> starting from a saved frame...");
00909       } else if (final_time >= frames[frames.size()-1]) {
00910         start_frame = frames[frames.size()-1];  
00911         // ORSA_ERROR("OptimizedOrbitPositions::PropagatedOrbit(...)  ==> starting from a saved frame...");
00912       } else {
00913         unsigned int k=1;
00914         while (k < frames.size()) {
00915           
00916           if ( (final_time >= frames[k-1]) && (final_time <= frames[k]) ) {
00917             if ((final_time-frames[k-1]).absolute() < (frames[k]-final_time).absolute()) {
00918               start_frame = frames[k-1];
00919               // ORSA_ERROR("OptimizedOrbitPositions::PropagatedOrbit(...)  ==> starting from a saved frame...");
00920               break;
00921             } else {
00922               start_frame = frames[k];
00923               // ORSA_ERROR("OptimizedOrbitPositions::PropagatedOrbit(...)  ==> starting from a saved frame...");
00924               break;
00925             }
00926           }
00927           
00928           ++k;
00929         }
00930       }
00931       
00932     } else {
00933       
00934       // ORSA_ERROR("OptimizedOrbitPositions::PropagatedOrbit(...)  ==> first call...");
00935       
00936       SetupSolarSystem(start_frame,l,_orbit.epoch);
00937       // start_frame.SetDate(_orbit.epoch);
00938       
00939       const JPLBody Sun(SUN,_orbit.epoch);
00940       
00941       Body b("object");
00942       Vector r, v;
00943       _orbit.RelativePosVel(r,v);
00944       r += Sun.position();
00945       v += Sun.velocity();
00946       // cerr << "b.position: " << b.position.x << "  " << b.position.y << "  " << b.position.z << endl;
00947       b.SetPosition(r);
00948       b.SetVelocity(v);
00949       
00950       start_frame.push_back(b);
00951       
00952       frames.push_back(start_frame);
00953     }
00954     
00955     Radau15 itg; 
00956     itg.accuracy = 1.0e-12;
00957     itg.timestep = FromUnits(1.0,DAY);
00958     
00959     Evolution evol;
00960     evol.SetInteraction(NEWTON);
00961     evol.SetIntegrator(&itg);
00962     evol.push_back(start_frame);
00963     evol.SetMaxUnsavedSubSteps(100000);
00964     // obs_utat.SetDate(final_time.GetDate()); 
00965     // evol.sample_period = orbit_epoch_frame.Time() - obs_utat.Time(); // important, otherwise the final frame is not saved
00966     // evol.sample_period = (orbit_epoch_frame.Time() - obs_utat.Time())*(1.0-1.0e-8); // important, otherwise the final frame is not saved
00967     // evol.sample_period = (start_frame.Time() - obs_utat.Time())*(1.0-1.0e-8); // important, otherwise the final frame is not saved
00968     // evol.sample_period = (start_frame.Time() - obs_utat.Time());
00969     // evol.sample_period = start_frame - final_time;
00970     evol.SetSamplePeriod(final_time - start_frame);
00971     evol.Integrate(final_time,true);
00972     
00973     Frame last_frame = evol[evol.size()-1];
00974     
00975     // don't add the frame if the size of evol is 1,
00976     // because this means that the integration was not needed,
00977     // and the 'frames' already contains it.
00978     if (evol.size() > 1) frames.push_back(last_frame);
00979     
00980     const Vector relative_position = last_frame[last_frame.size()-1].position() - last_frame[0].position();
00981     const Vector relative_velocity = last_frame[last_frame.size()-1].velocity() - last_frame[0].velocity();
00982     
00983     OrbitWithEpoch oe;
00984     oe.Compute(relative_position,relative_velocity,GetG()*GetMSun(),final_time);
00985     
00986     return (oe);
00987   }

Here is the call graph for this function:

void PropagatedPosVel const UniverseTypeAwareTime ,
Vector ,
Vector ,
bool  integrate = true
 

Definition at line 1176 of file orsa_orbit.cc.

References OptimizedOrbitPositions::PropagatedOrbit(), and OrbitWithEpoch::RelativePosVel().

01176                                                                                                                                             {
01177     OrbitWithEpoch oe = PropagatedOrbit(final_time,integrate);
01178     oe.RelativePosVel(position,velocity,final_time);
01179   }

Here is the call graph for this function:

Sky PropagatedSky_J2000 const UniverseTypeAwareTime ,
const std::string &  obscode,
const bool  integrate = true,
const bool  light_time_corrections = true
 

Definition at line 989 of file orsa_orbit.cc.

References Sky::Compute_J2000(), orsa::EARTH, orsa::GetC(), Vector::Length(), orsa::location_file, LocationFile::ObsPos(), OptimizedOrbitPositions::PropagatedOrbit(), OrbitWithEpoch::RelativePosVel(), and orsa::SUN.

Referenced by orsa::Compute(), orsa::gauss_v_f(), orsa::least_sq_f(), orsa::OrbitDifferentialCorrectionsLeastSquares(), orsa::residual(), and orsa::RMS_residuals().

00989                                                                                                                                                                           {
00990     
00991     OrbitWithEpoch oe = PropagatedOrbit(final_time,integrate);
00992     
00993     // Frame frame;
00994     // SetupSolarSystem(frame,l,final_time);
00995     
00996     /* 
00997        Config conf;
00998        OrsaConfigFile ocf(&conf);
00999        ocf.Read();
01000        ocf.Close();
01001     */
01002     
01003     /* 
01004        LocationFile lf;
01005        lf.SetFileName(config->paths[OBSCODE]->GetValue().c_str());
01006        lf.Read();
01007        lf.Close();
01008     */
01009     
01010     JPLBody Sun(SUN,final_time.GetDate());
01011     JPLBody Earth(EARTH,final_time.GetDate());
01012     
01013     // Vector geo = frame[3].position()-frame[0].position();
01014     Vector geo = Earth.position();
01015     // geo += lf.ObsPos(obscode,final_time.GetDate());
01016     geo += location_file->ObsPos(obscode,final_time.GetDate());
01017     
01018     Vector r,v;
01019     oe.RelativePosVel(r,v,final_time);
01020     r += Sun.position();
01021     v += Sun.velocity();
01022     
01023     Vector relative_position = r - geo;
01024     
01025     Sky sky;
01026     // sky.Compute(relative_position,final_time);
01027     // sky.Compute_J2000(relative_position);
01028     // 
01029     if (light_time_corrections) {
01030       sky.Compute_J2000(relative_position-v*relative_position.Length()/GetC());
01031     } else {
01032       sky.Compute_J2000(relative_position);
01033     }
01034     
01035     return sky;
01036   }

Here is the call graph for this function:


The documentation for this class was generated from the following files:
Generated on Tue Jan 11 15:29:37 2005 for liborsa by  doxygen 1.4.0