Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Orbit Class Reference

Calculates the position of a satellite in a low, circular orbit. More...

#include <Orbit.h>

Inheritance diagram for Orbit::

StaticOrbit List of all members.

Public Methods

 Orbit (double asclon=0., double alt=600., double inc=28.5, double phs=0., double apitch=0., double ayaw=0., double aroll=0.)
 default constructor. More...

double get_phase (double timeInSeconds) const
 phase of the orbit as a proportion of a single period. More...

std::pair< double, double > coords (double timeInSeconds) const
 returns position as a pair using specified time. More...

virtual double latitude (double timeInSeconds) const
 latitude as a function of time (in minutes). More...

virtual double longitude (double timeInSeconds) const
 longitude as a function of time, taking into account the starting longitude and the eastward rotation of the earth. More...

virtual double pitch (double timeInSeconds) const
 pitch of the spacecraft (rotation around E-W axis) zenith pointing is pitch == 0. More...

virtual double yaw (double timeInSeconds) const
 yaw of the spacecraft (rotation around zenith) square to E-W and N-S axis represents yaw == 0. More...

virtual double roll (double timeInSeconds) const
 roll of the spacecraft (rotation around N-S axis) zenith pointing is roll == 0. More...

virtual double phase (double timeInSeconds) const
 phase of the orbit at a given time. More...

void inclination (double inc)
 set the inclination of the orbit. More...

void ascendingLon (double asc)
 set the longitude of the ascending node. More...

void startphase (double phi)
 set the phase of the orbit (in radians). More...

void displayRotation (Rotation rot)
 explicitly output the rotation matrix to the screen. More...

double startphase () const
 inlined access methods. More...

double period () const
double inclination () const
double altitude () const
double ascendingLon () const
Rotation CELTransform (double timeInSeconds)
Rotation Orbit::latLonTransform (double timeInSeconds) const
double Orbit::testLongitude (double timeInSeconds) const
double Orbit::testLatitude (double timeInSeconds) const

Protected Methods

virtual void setLatitude (double)
virtual void setLongitude (double)
virtual void setPitch (double)
virtual void setYaw (double)
virtual void setRoll (double)
void computeAttitudes (double timeInSeconds)

Private Attributes

double m_ascendingLon
double m_inclination
double m_altitude
double m_period
double m_sini
double m_cosi
double m_startphase
double m_precessPeriod
double m_degsPerRad
double m_secsperday
double m_rax
double m_raz
double m_decx
double m_decz

Friends

class GPS

Detailed Description

Calculates the position of a satellite in a low, circular orbit.

The path is assumed to go to the east, with the rotation of the earth, as is the case for most satellite orbits. All angles are expressed in degrees. Longitude increases to the east.


Constructor: The three arguments are 1. Longitude of the ascending node (where the orbit crosses the equator, moving northward) in degrees 2. Altitude in kilometers. Defaults to 600. 3. Orbital inclination in degrees. Defaults to 28.5.
Member functions: latitude(time) and longitude(time) give the position of the satellite (in degrees) when "time" minutes have elapsed since the ascending node passage. An update on time: Since the rest of the FluxSvc package uses seconds as a unit of time, the Orbit methods should expect to take seconds input, but the internals were written to use minutes as the used time format, so the methods were re-made to take "timeInSeconds" for input and calculate minutes internally. longitude is between 0 and 360. coords(time) returns the latitude and longitude as a pair<double,double>. period() returns the period of the orbit (in minutes). inclination(), altitude(), and ascendingLon() return the parameters used in the constructor, in case you forget. There is no need for an explicit destructor, copy constructor, or assignment operator.

$Header $

Definition at line 45 of file Orbit.h.


Constructor & Destructor Documentation

Orbit::Orbit double    asclon = 0.,
double    alt = 600.,
double    inc = 28.5,
double    phs = 0.,
double    pitch = 0.,
double    yaw = 0.,
double    roll = 0.
 

default constructor.

Definition at line 12 of file Orbit.cxx.

References inclination().

00013                                                        :
00014 // constructor
00015 m_ascendingLon(asclon),
00016 m_altitude(alt),
00017 m_period(1.6612e-4 * pow(alt+6371.2, 1.5)),// Kepler's Law
00018 m_startphase(phs),
00019 m_precessPeriod(66.*24.*60.),
00020 m_degsPerRad(360./6.2831853),
00021 m_secsperday(24.*60.*60.)
00022 
00023 {
00024     inclination( inc );
00025     
00026 }


Member Function Documentation

double Orbit::altitude   const [inline]
 

Definition at line 158 of file Orbit.h.

References m_altitude.

00158 {return m_altitude;}

double Orbit::ascendingLon   const [inline]
 

Definition at line 160 of file Orbit.h.

References m_ascendingLon.

00160 {return m_ascendingLon;}

void Orbit::ascendingLon double    asc
 

set the longitude of the ascending node.

Definition at line 35 of file Orbit.cxx.

References m_ascendingLon.

Referenced by GPS::ascendingLon(), and GPS::synch().

00036 {
00037     m_ascendingLon = asc;
00038 }

Rotation Orbit::CELTransform double    timeInSeconds
 

Definition at line 90 of file Orbit.cxx.

References m_degsPerRad, m_inclination, m_precessPeriod, and phase().

00090                                                 {
00091     double time = timeInSeconds/60.;
00092     // Purpose:  Return the 3x3 matrix which transforms a vector from a galactic 
00093     // coordinate system to a local coordinate system.
00094     
00095     //THIS IS THE PART WHERE WE MAKE THE MATRIX CEL INTO SOMETHING WE CAN USE
00096     Rotation gal,cel,cel1,cel2,cel3,cel4;
00097     
00098     //the x axis must eventually be rotated so that it points east, instead of along
00099     //the direction of orbital travel
00100     double makeXeast = (m_inclination/m_degsPerRad)*cos(phase(timeInSeconds));
00101     
00102     //and here we construct the rotation matrices
00103     
00104     //gal is the matrix which rotates (cartesian)celestial coordiantes into (cartesian)galactic ones
00105     gal.rotateZ(-282.25/m_degsPerRad).rotateX(-62.6/m_degsPerRad).rotateZ(33./m_degsPerRad);
00106     
00107     //cel is the matrix which rotates (cartesian)local coordinates into (cartesian)celestial ones
00108     cel1.rotateZ(makeXeast);
00109     cel2.rotateY(phase(timeInSeconds));
00110     cel3.rotateZ(-m_inclination*M_2PI/360.);
00111     cel4.rotateY((time/m_precessPeriod)*M_2PI);
00112     
00113     //so gal*cel should be the matrix that makes local coordiates into galactic ones.
00114     Rotation glstToGal = gal*cel4*cel3*cel2*cel1;
00115     
00116     //displayRotation(glstToGal);
00117     
00118     //we want the rotation from galactic to local.
00119     return glstToGal.inverse();
00120 }

void Orbit::computeAttitudes double    timeInSeconds [protected]
 

Definition at line 124 of file Orbit.cxx.

References latitude(), longitude(), m_ascendingLon, m_decx, m_decz, m_inclination, m_precessPeriod, m_rax, and m_raz.

00124                                                 {
00125     double time = timeInSeconds/60.;
00126     // Purpose: computation of pointing characteristics of GLAST - assumed, here, to be zenith-pointing
00127     
00128     //lat, lon, sidereal??? time becomes J2000.0 coordinates here:
00129     m_raz=((time/(24.0*60.0*60.0))*360.0)+longitude(timeInSeconds);  //need to take into account starting phase too!
00130     if(m_raz > 360.0) m_raz-=360.0;
00131     if(m_raz < 0.0 ) m_raz+=360.0;
00132     m_decz=latitude(timeInSeconds);
00133     //and then the eastward-pointing x-axis should have 90 degrees more ascension, and declination=0
00134     m_rax=m_raz-90.0;
00135     if(m_rax > 360.0) m_rax-=360.0;
00136     if(m_rax < 0.0 ) m_rax+=360.0;
00137     m_decx=0.;
00138 }

std::pair< double, double > Orbit::coords double    timeInSeconds const
 

returns position as a pair using specified time.

Definition at line 86 of file Orbit.cxx.

References latitude(), and longitude().

00086                                                                {
00087     return std::make_pair(latitude(timeInSeconds), longitude(timeInSeconds));
00088 }

void Orbit::displayRotation Rotation    rot
 

explicitly output the rotation matrix to the screen.

Definition at line 174 of file Orbit.cxx.

00174                                        {
00175     
00176     std::cout << "{" << rot.xx() << ' ' << rot.xy() << ' ' << rot.xz() << std::endl
00177         << rot.yx() << ' ' << rot.yy() << ' ' << rot.yz() << std::endl
00178         << rot.zx() << ' ' << rot.zy() << ' ' << rot.zz() << "}" << std::endl;
00179 }

double Orbit::get_phase double    timeInSeconds const
 

phase of the orbit as a proportion of a single period.

double Orbit::inclination   const [inline]
 

Definition at line 156 of file Orbit.h.

References m_inclination.

Referenced by Orbit().

00156 {return m_inclination;}

void Orbit::inclination double    inc
 

set the inclination of the orbit.

Definition at line 28 of file Orbit.cxx.

References m_cosi, m_inclination, and m_sini.

00029 {
00030     m_inclination = inc;
00031     m_sini = (sin(m_inclination*M_2PI/360.));
00032     m_cosi = (cos(m_inclination*M_2PI/360.));
00033 }

double Orbit::latitude double    timeInSeconds const [virtual]
 

latitude as a function of time (in minutes).

Parameters:
latitude  Latitude is in the range (-180,180)

Definition at line 45 of file Orbit.cxx.

References m_period, m_sini, and startphase().

Referenced by computeAttitudes(), coords(), and GPS::lat().

00045                                                  {
00046     double time = timeInSeconds/60.;
00047     // Purpose:  Return the latitude as a function of time (in minutes)
00048     // Input:  the current time
00049     return (360./M_2PI) * asin(m_sini * sin(M_2PI*time/m_period + startphase()));
00050 }

double Orbit::longitude double    timeInSeconds const [virtual]
 

longitude as a function of time, taking into account the starting longitude and the eastward rotation of the earth.

Parameters:
longitude  Longitude is in the range (0,360)

Definition at line 52 of file Orbit.cxx.

References m_ascendingLon, m_cosi, m_period, phase(), and startphase().

Referenced by computeAttitudes(), coords(), and GPS::lon().

00052                                                   {
00053     double time = timeInSeconds/60.;
00054     // Purpose:  Return the longitude as a function of time, taking into account the starting
00055     // longitude and the eastward rotation of the earth
00056     // Input:  current time
00057     double phase = M_2PI * time / m_period + startphase();
00058     double lon = (360./M_2PI) * atan2(m_cosi*sin(phase), cos(phase)) -
00059         360.* time /1440. + m_ascendingLon; // orbital motion - earth rotation
00060     lon = fmod(lon, 360.);   // Fold into the range [0, 360)
00061     if (lon < 0.) lon += 360.;
00062     return lon;
00063 }

Rotation Orbit::Orbit::latLonTransform double    timeInSeconds const
 

double Orbit::Orbit::testLatitude double    timeInSeconds const
 

double Orbit::Orbit::testLongitude double    timeInSeconds const
 

double Orbit::period   const [inline]
 

Definition at line 154 of file Orbit.h.

References m_period.

Referenced by phase(), and GPS::phase().

00154 {return m_period;}

double Orbit::phase double    timeInSeconds const [virtual]
 

phase of the orbit at a given time.

Definition at line 80 of file Orbit.cxx.

References period(), and startphase().

Referenced by CELTransform(), longitude(), and GPS::phase().

00080                                                {
00081     double time = timeInSeconds/60.;
00082     double p = period();
00083     return (p == 0) ? 0. : (time/p) * 2*M_PI + startphase();
00084 }

double Orbit::pitch double    timeInSeconds const [virtual]
 

pitch of the spacecraft (rotation around E-W axis) zenith pointing is pitch == 0.

Definition at line 65 of file Orbit.cxx.

Referenced by GPS::pitch().

00065                                                {
00066     double time = timeInSeconds/60.;
00067     return 0.;
00068 }

double Orbit::roll double    timeInSeconds const [virtual]
 

roll of the spacecraft (rotation around N-S axis) zenith pointing is roll == 0.

Definition at line 75 of file Orbit.cxx.

Referenced by GPS::roll().

00075                                               {
00076     double time = timeInSeconds/60.;
00077     return 0.;
00078 }

virtual void Orbit::setLatitude double    l [inline, protected, virtual]
 

Reimplemented in StaticOrbit.

Definition at line 119 of file Orbit.h.

Referenced by GPS::lat(), and GPS::setState().

00119 {}

virtual void Orbit::setLongitude double    l [inline, protected, virtual]
 

Reimplemented in StaticOrbit.

Definition at line 120 of file Orbit.h.

Referenced by GPS::lon(), and GPS::setState().

00120 {}

virtual void Orbit::setPitch double    p [inline, protected, virtual]
 

Reimplemented in StaticOrbit.

Definition at line 121 of file Orbit.h.

Referenced by GPS::pitch(), and GPS::setState().

00121 {}

virtual void Orbit::setRoll double    r [inline, protected, virtual]
 

Reimplemented in StaticOrbit.

Definition at line 123 of file Orbit.h.

Referenced by GPS::roll(), and GPS::setState().

00123 {}

virtual void Orbit::setYaw double    y [inline, protected, virtual]
 

Reimplemented in StaticOrbit.

Definition at line 122 of file Orbit.h.

Referenced by GPS::setState(), and GPS::yaw().

00122 {}

double Orbit::startphase   const [inline]
 

inlined access methods.

Definition at line 162 of file Orbit.h.

References m_startphase.

Referenced by latitude(), longitude(), and phase().

00162 {return m_startphase;}

void Orbit::startphase double    phs
 

set the phase of the orbit (in radians).

Definition at line 40 of file Orbit.cxx.

References m_startphase.

Referenced by GPS::phase().

00041 {
00042     m_startphase = phs;
00043 }

double Orbit::yaw double    timeInSeconds const [virtual]
 

yaw of the spacecraft (rotation around zenith) square to E-W and N-S axis represents yaw == 0.

Definition at line 70 of file Orbit.cxx.

Referenced by GPS::yaw().

00070                                              {
00071     double time = timeInSeconds/60.;
00072     return 0.;
00073 }


Friends And Related Function Documentation

friend class GPS [friend]
 

Definition at line 130 of file Orbit.h.


Member Data Documentation

double Orbit::m_altitude [private]
 

Definition at line 135 of file Orbit.h.

Referenced by altitude().

double Orbit::m_ascendingLon [private]
 

Definition at line 133 of file Orbit.h.

Referenced by ascendingLon(), computeAttitudes(), and longitude().

double Orbit::m_cosi [private]
 

Definition at line 138 of file Orbit.h.

Referenced by inclination(), and longitude().

double Orbit::m_decx [private]
 

Definition at line 149 of file Orbit.h.

Referenced by computeAttitudes().

double Orbit::m_decz [private]
 

Definition at line 150 of file Orbit.h.

Referenced by computeAttitudes().

double Orbit::m_degsPerRad [private]
 

Definition at line 142 of file Orbit.h.

Referenced by CELTransform().

double Orbit::m_inclination [private]
 

Definition at line 134 of file Orbit.h.

Referenced by CELTransform(), computeAttitudes(), and inclination().

double Orbit::m_period [private]
 

Definition at line 136 of file Orbit.h.

Referenced by latitude(), longitude(), and period().

double Orbit::m_precessPeriod [private]
 

Definition at line 140 of file Orbit.h.

Referenced by CELTransform(), and computeAttitudes().

double Orbit::m_rax [private]
 

Definition at line 147 of file Orbit.h.

Referenced by computeAttitudes().

double Orbit::m_raz [private]
 

Definition at line 148 of file Orbit.h.

Referenced by computeAttitudes().

double Orbit::m_secsperday [private]
 

Definition at line 143 of file Orbit.h.

double Orbit::m_sini [private]
 

Definition at line 137 of file Orbit.h.

Referenced by inclination(), and latitude().

double Orbit::m_startphase [private]
 

Definition at line 139 of file Orbit.h.

Referenced by startphase().


The documentation for this class was generated from the following files:
Generated on Wed Oct 16 14:01:35 2002 by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001