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

SatGeometry Class Reference

#include <satgeometry.h>

Inheritance diagram for SatGeometry:

Inheritance graph
[legend]
Collaboration diagram for SatGeometry:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 SatGeometry ()

Static Public Member Functions

double distance (coordinate, coordinate)
void spherical_to_cartesian (double, double, double, double &, double &, double &)
double propdelay (coordinate, coordinate)
double get_latitude (coordinate)
double get_longitude (coordinate)
double get_radius (coordinate a)
double get_altitude (coordinate)
double check_elevation (coordinate, coordinate, double)
int are_satellites_mutually_visible (coordinate, coordinate)

Protected Member Functions

int command ()

Constructor & Destructor Documentation

SatGeometry::SatGeometry  )  [inline]
 

Definition at line 73 of file satgeometry.h.

00073 { printf("Started\n");}


Member Function Documentation

int SatGeometry::are_satellites_mutually_visible coordinate  ,
coordinate 
[static]
 

Definition at line 144 of file satgeometry.cc.

References ATMOS_MARGIN, distance(), EARTH_RADIUS, FALSE, get_radius(), and TRUE.

Referenced by SatLinkHandoffMgr::handoff().

00145 {
00146         // if we drop a perpendicular from the ISL to the Earth's surface,
00147         // we have a right triangle.  The atmospheric margin is the minimum
00148         // ISL grazing altitude.
00149         double c, d, min_radius, grazing_radius;
00150         double radius = get_radius(first); // could just use first.r here.
00151         double distance_ = distance(first, second);
00152         c = radius * radius;
00153         d = (distance_/2) * (distance_/2);
00154         grazing_radius = (EARTH_RADIUS + ATMOS_MARGIN);
00155         min_radius = sqrt(c - d);
00156         if (min_radius >= grazing_radius) {
00157                 return TRUE;
00158         } else {
00159                 return FALSE;
00160         }
00161 }

Here is the call graph for this function:

double SatGeometry::check_elevation coordinate  ,
coordinate  ,
double 
[static]
 

Definition at line 117 of file satgeometry.cc.

References distance(), EARTH_RADIUS, and coordinate::r.

Referenced by TermLinkHandoffMgr::handoff().

00119 {
00120         double S = satellite.r;  // satellite radius
00121         double S_2 = satellite.r * satellite.r;  // satellite radius^2
00122         double E = EARTH_RADIUS;
00123         double E_2 = E * E;
00124         double d, theta, alpha;
00125 
00126         d = distance(satellite, terminal);
00127         if (d < sqrt(S_2 - E_2)) {
00128                 // elevation angle > 0
00129                 theta = acos((E_2+S_2-(d*d))/(2*E*S));
00130                 alpha = acos(sin(theta) * S/d);
00131                 return ( (alpha > elev_mask_) ? alpha : 0);
00132         } else
00133                 return 0;
00134 }

Here is the call graph for this function:

int SatGeometry::command  )  [inline, protected]
 

Definition at line 87 of file satgeometry.h.

00087 { return 0; }

double SatGeometry::distance coordinate  ,
coordinate 
[static]
 

Definition at line 56 of file satgeometry.cc.

References DISTANCE, coordinate::phi, coordinate::r, BaseTrace::round(), spherical_to_cartesian(), and coordinate::theta.

Referenced by are_satellites_mutually_visible(), check_elevation(), SatLinkHandoffMgr::handoff(), and propdelay().

00057 {
00058         double a_x, a_y, a_z, b_x, b_y, b_z;     // cartesian
00059         spherical_to_cartesian(a.r, a.theta, a.phi, a_x, a_y, a_z);
00060         spherical_to_cartesian(b.r, b.theta, b.phi, b_x, b_y, b_z);
00061         return (BaseTrace::round(DISTANCE(a_x, a_y, a_z, b_x, b_y, b_z), 1.0E+8));
00062 
00063 
00064 }

Here is the call graph for this function:

double SatGeometry::get_altitude coordinate   )  [static]
 

Definition at line 81 of file satgeometry.cc.

References EARTH_RADIUS, and coordinate::r.

00082 {
00083         return (a.r - EARTH_RADIUS);
00084 }

double SatGeometry::get_latitude coordinate   )  [static]
 

Definition at line 87 of file satgeometry.cc.

References PI, and coordinate::theta.

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

00088 {
00089         return (PI/2 - a.theta);
00090 }

double SatGeometry::get_longitude coordinate   )  [static]
 

Definition at line 96 of file satgeometry.cc.

References EARTH_PERIOD, NOW, coordinate::phi, PI, and SatPosition::time_advance_.

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

00097 {
00098         double period = EARTH_PERIOD; // period of earth in seconds
00099         // adjust longitude so that it is earth-centric (i.e., account
00100         // for earth rotating beneath).   
00101         double earth_longitude = fmod((coord_.phi -
00102            (fmod(NOW + SatPosition::time_advance_,period)/period) * 2*PI), 
00103             2*PI);
00104         // Bring earth_longitude to be within (-PI, PI)
00105         if (earth_longitude < (-1*PI))
00106                 earth_longitude = 2*PI + earth_longitude;
00107         if (earth_longitude > PI)
00108                 earth_longitude = (-(2*PI - earth_longitude));
00109         if (fabs(earth_longitude) < 0.0001)
00110                 return 0;   // To avoid trace output of "-0.00"
00111         else
00112                 return (earth_longitude);
00113 }       

double SatGeometry::get_radius coordinate  a  )  [inline, static]
 

Definition at line 80 of file satgeometry.h.

References coordinate::r.

Referenced by are_satellites_mutually_visible().

00080 { return a.r; }

double SatGeometry::propdelay coordinate  ,
coordinate 
[static]
 

Definition at line 75 of file satgeometry.cc.

References distance(), LIGHT, and BaseTrace::round().

Referenced by SatChannel::get_pdelay().

00076 {
00077         double delay = distance(a, b)/LIGHT;
00078         return (BaseTrace::round(delay, 1.0E+8));
00079 }

Here is the call graph for this function:

void SatGeometry::spherical_to_cartesian double  ,
double  ,
double  ,
double &  ,
double &  ,
double & 
[static]
 

Definition at line 66 of file satgeometry.cc.

Referenced by distance().

00068 {      
00069         X = R * sin(Theta) * cos (Phi);
00070         Y = R * sin(Theta) * sin (Phi);
00071         Z = R * cos(Theta);
00072 }


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