Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members

PolarSatPosition Class Reference

#include <satposition.h>

Inheritance diagram for PolarSatPosition:

Inheritance graph
[legend]
Collaboration diagram for PolarSatPosition:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 PolarSatPosition (double=1000, double=90, double=0, double=0, double=0)
virtual coordinate coord ()
void set (double Altitude, double Lon, double Alpha, double inclination=90)
bool isascending ()
PolarSatPositionnext ()
int plane ()
int type ()
double period ()
Nodenode ()

Static Public Attributes

double time_advance_ = 0

Protected Member Functions

int command (int argc, const char *const *argv)

Protected Attributes

PolarSatPositionnext_
int plane_
double inclination_
coordinate initial_
double period_
int type_
Nodenode_

Constructor & Destructor Documentation

PolarSatPosition::PolarSatPosition double  = 1000,
double  = 90,
double  = 0,
double  = 0,
double  = 0
 

Definition at line 172 of file satposition.cc.

References plane_, POSITION_SAT_POLAR, set(), and SatPosition::type_.

00173                                 : next_(0), plane_(0) {
00174         set(altitude, Lon, Alpha, Inc);
00175         bind("plane_", &plane_);
00176         if (Plane) 
00177                 plane_ = int(Plane);
00178         type_ = POSITION_SAT_POLAR;
00179 }

Here is the call graph for this function:


Member Function Documentation

int PolarSatPosition::command int  argc,
const char *const *  argv
[protected]
 

Reimplemented from SatPosition.

Definition at line 295 of file satposition.cc.

References SatPosition::command(), and next_.

00295                                                               {     
00296         Tcl& tcl = Tcl::instance();
00297         if (argc == 2) {
00298         }
00299         if (argc == 3) {
00300                 if (strcmp(argv[1], "set_next") == 0) {
00301                         next_ = (PolarSatPosition *) TclObject::lookup(argv[2]);
00302                         if (next_ == 0) {
00303                                 tcl.resultf("no such object %s", argv[2]);
00304                                 return (TCL_ERROR);
00305                         }
00306                         return (TCL_OK);
00307                 }
00308         }
00309         return (SatPosition::command(argc, argv));
00310 }

Here is the call graph for this function:

coordinate PolarSatPosition::coord  )  [virtual]
 

Implements SatPosition.

Definition at line 238 of file satposition.cc.

References inclination_, SatPosition::initial_, NOW, SatPosition::period_, coordinate::phi, PI, coordinate::r, coordinate::theta, and SatPosition::time_advance_.

Referenced by SatLinkHandoffMgr::handoff(), and TermLinkHandoffMgr::handoff().

00239 {
00240         coordinate current;
00241         double partial;  // fraction of orbit period completed
00242         partial = 
00243             (fmod(NOW + time_advance_, period_)/period_) * 2*PI; //rad
00244         double theta_cur, phi_cur, theta_new, phi_new;
00245 
00246         // Compute current orbit-centric coordinates:
00247         // theta_cur adds effects of time (orbital rotation) to initial_.theta
00248         theta_cur = fmod(initial_.theta + partial, 2*PI);
00249         phi_cur = initial_.phi;
00250         // Reminder:  theta_cur and phi_cur are temporal translations of 
00251         // initial parameters and are NOT true spherical coordinates.
00252         //
00253         // Now generate actual spherical coordinates,
00254         // with 0 < theta_new < PI and 0 < phi_new < 360
00255 
00256         if (inclination_ < PI) {
00257                 // asin returns value between -PI/2 and PI/2, so 
00258                 // theta_new guaranteed to be between 0 and PI
00259                 theta_new = PI/2 - asin(sin(inclination_) * sin(theta_cur));
00260                 // if theta_new is between PI/2 and 3*PI/2, must correct
00261                 // for return value of atan()
00262                 if (theta_cur > PI/2 && theta_cur < 3*PI/2)
00263                         phi_new = atan(cos(inclination_) * tan(theta_cur)) + 
00264                             phi_cur + PI;
00265                 else
00266                         phi_new = atan(cos(inclination_) * tan(theta_cur)) + 
00267                             phi_cur;
00268                 phi_new = fmod(phi_new + 2*PI, 2*PI);
00269         } else 
00270                 printf("ERROR:  inclination_ > PI\n");
00271         
00272         current.r = initial_.r;
00273         current.theta = theta_new;
00274         current.phi = phi_new;
00275         return current;
00276 }

bool PolarSatPosition::isascending  ) 
 

Definition at line 284 of file satposition.cc.

References SatPosition::initial_, NOW, SatPosition::period_, PI, coordinate::theta, and SatPosition::time_advance_.

00285 {       
00286         double partial = (fmod(NOW + time_advance_, period_)/period_) * 2*PI; //rad
00287         double theta_cur = fmod(initial_.theta + partial, 2*PI);
00288         if ((theta_cur > PI/2)&&(theta_cur < 3*PI/2)) {
00289                 return 0;
00290         } else {
00291                 return 1;
00292         }
00293 }

PolarSatPosition* PolarSatPosition::next  )  [inline]
 

Definition at line 82 of file satposition.h.

References next_.

Referenced by SatLinkHandoffMgr::handoff(), and TermLinkHandoffMgr::handoff().

00082 { return next_; }

Node* SatPosition::node void   )  [inline, inherited]
 

Definition at line 62 of file satposition.h.

References SatPosition::node_.

Referenced by SatLinkHandoffMgr::handoff(), and TermLinkHandoffMgr::handoff().

00062 { return node_; }

double SatPosition::period  )  [inline, inherited]
 

Definition at line 61 of file satposition.h.

References SatPosition::period_.

00061 { return period_; }

int PolarSatPosition::plane  )  [inline]
 

Definition at line 83 of file satposition.h.

References plane_.

Referenced by SatNode::dumpSats(), and SatLinkHandoffMgr::handoff().

00083 { return plane_; }

void PolarSatPosition::set double  Altitude,
double  Lon,
double  Alpha,
double  inclination = 90
 

Definition at line 193 of file satposition.cc.

References DEG_TO_RAD, EARTH_RADIUS, inclination_, SatPosition::initial_, MU, SatPosition::period_, coordinate::phi, PI, coordinate::r, and coordinate::theta.

Referenced by PolarSatPosition().

00194 {
00195         if (Altitude < 0) {
00196                 fprintf(stderr, "PolarSatPosition:  altitude out of \
00197                    bounds: %f\n", Altitude);
00198                 exit(1);
00199         }
00200         initial_.r = Altitude + EARTH_RADIUS; // Altitude in km above the earth
00201         if (Alpha < 0 || Alpha >= 360) {
00202                 fprintf(stderr, "PolarSatPosition:  alpha out of bounds: %f\n", 
00203                     Alpha);
00204                 exit(1);
00205         }
00206         initial_.theta = DEG_TO_RAD(Alpha);
00207         if (Lon < -180 || Lon > 180) {
00208                 fprintf(stderr, "PolarSatPosition:  lon out of bounds: %f\n", 
00209                     Lon);
00210                 exit(1);
00211         }
00212         if (Lon < 0)
00213                 initial_.phi = DEG_TO_RAD(360 + Lon);
00214         else
00215                 initial_.phi = DEG_TO_RAD(Lon);
00216         if (Incl < 0 || Incl > 180) {
00217                 // retrograde orbits = (90 < Inclination < 180)
00218                 fprintf(stderr, "PolarSatPosition:  inclination out of \
00219                     bounds: %f\n", Incl); 
00220                 exit(1);
00221         }
00222         inclination_ = DEG_TO_RAD(Incl);
00223         // XXX: can't use "num = pow(initial_.r,3)" here because of linux lib
00224         double num = initial_.r * initial_.r * initial_.r;
00225         period_ = 2 * PI * sqrt(num/MU); // seconds
00226 }

int SatPosition::type  )  [inline, inherited]
 

Definition at line 60 of file satposition.h.

References SatPosition::type_.

Referenced by SatNode::dumpSats(), and TermLinkHandoffMgr::handoff().

00060 { return type_; }


Member Data Documentation

double PolarSatPosition::inclination_ [protected]
 

Definition at line 89 of file satposition.h.

Referenced by coord(), and set().

coordinate SatPosition::initial_ [protected, inherited]
 

Definition at line 69 of file satposition.h.

Referenced by GeoSatPosition::coord(), coord(), TermSatPosition::coord(), GeoSatPosition::GeoSatPosition(), isascending(), GeoSatPosition::set(), set(), TermSatPosition::set(), and TermSatPosition::TermSatPosition().

PolarSatPosition* PolarSatPosition::next_ [protected]
 

Definition at line 87 of file satposition.h.

Referenced by command(), and next().

Node* SatPosition::node_ [protected, inherited]
 

Definition at line 72 of file satposition.h.

Referenced by SatPosition::command(), and SatPosition::node().

double SatPosition::period_ [protected, inherited]
 

Definition at line 70 of file satposition.h.

Referenced by GeoSatPosition::coord(), coord(), TermSatPosition::coord(), GeoSatPosition::GeoSatPosition(), isascending(), SatPosition::period(), set(), and TermSatPosition::TermSatPosition().

int PolarSatPosition::plane_ [protected]
 

Definition at line 88 of file satposition.h.

Referenced by plane(), and PolarSatPosition().

double SatPosition::time_advance_ = 0 [static, inherited]
 

Definition at line 96 of file satposition.cc.

Referenced by GeoSatPosition::coord(), coord(), TermSatPosition::coord(), SatGeometry::get_longitude(), isascending(), and SatPosition::SatPosition().

int SatPosition::type_ [protected, inherited]
 

Definition at line 71 of file satposition.h.

Referenced by GeoSatPosition::GeoSatPosition(), PolarSatPosition(), TermSatPosition::TermSatPosition(), and SatPosition::type().


The documentation for this class was generated from the following files:
Generated on Tue Apr 20 13:08:16 2004 for NS2.26SourcesOriginal by doxygen 1.3.3