Orbit mechanics, including Keplerian, spherical and cartesian elements. More...
Classes | |
struct | orb_data_s |
Structure for storing orbit data. More... | |
struct | gps_data_s |
Data structure for the GPS model. More... | |
struct | gps_orb_out_s |
Structure for storing the orbit data output of the GPS Model. More... | |
Typedefs | |
typedef struct orb_data_s | orb_data_t |
Structure for storing orbit data. | |
typedef struct gps_data_s | gps_data_t |
Data structure for the GPS model. | |
typedef struct gps_orb_out_s | gps_orb_out_t |
Structure for storing the orbit data output of the GPS Model. | |
Functions | |
void | el_to_rv (const orb_data_t &data, ml_matrix &pos, ml_matrix &vel) |
Converts orbital elements to r and v for an elliptic orbit. | |
orb_data_t | rv_to_el (const ml_matrix &pos, const ml_matrix &vel, double mu=MU_EARTH) |
Converts position and velocity vectors to Keplerian orbital elements. | |
double | rv_to_sma (double r_mag, double v_mag, double mu=MU_EARTH) |
Computes the semimajor axis given position and velocity. | |
double | mean_to_true (double ecc, double mean) |
Computes the true anomaly from the mean anomaly. | |
double | mean_to_ecc (double ecc, double mean) |
Generate the eccentric anomaly from the mean anomaly and the eccentricity. | |
double | ecc_to_true (double ecc, double hyp) |
Computes the true anomaly from the eccentric or hyperbolic anomaly. | |
double | ecc_to_mean (double ecc, double hyp) |
Converts eccentric anomaly to mean anomaly. | |
double | true_to_mean (double ecc, double nu) |
Converts true anomaly to mean anomaly. | |
double | mean_to_true_abs (double ecc, double mean_anom) |
Converts mean anomaly to true without wrapping. | |
double | true_to_ecc (double ecc, double nu) |
Converts true anomaly to eccentric or hyperbolic anomaly. | |
double | rarp_to_ecc (double ap, double per) |
Compute the eccentricity from apogee and perigee radii. | |
double | rarp_to_sma (double ap, double per) |
Computes the semi major axis from apogee and perigee radii. | |
double | slr (double ecc, double sma) |
Compute the semi-latus rectum. | |
ml_matrix | cp_to_i (double inc, double raan, double w) |
Converts the transformation matrix from the perifocal frame to the inertial frame. | |
double | orb_rate (double r, double a, double mu=MU_EARTH) |
Compute the orbital rate for non-circular orbits, or distance units other than [km]. | |
double | orb_rate (double r) |
Compute the orbital rate for circular orbits and distance units in [km]. | |
double | period (double a, double mu=MU_EARTH) |
Compute the orbital period. | |
void | lin_orb (double n, ml_matrix &a, ml_matrix &b, double dt) |
Computes the linearized orbit equations. | |
void | rv_orb_gen (const ml_matrix &el, const ml_matrix &t, ml_matrix &r, ml_matrix &v, double mu=MU_EARTH) |
Generate an orbit by propagating Keplerian elements. | |
void | rv_orb_gen (const orb_data_t &el, const ml_matrix &t, ml_matrix &r, ml_matrix &v, double mu=MU_EARTH) |
Generate an orbit by propagating Keplerian elements. | |
ml_matrix | cart_orb_rhs (const ml_matrix &x) |
Computes the right-hand-side of the unforced orbit equations about a mass point in cartesian coordinates. | |
ml_matrix | cart_orb_rhs (const ml_matrix &x, const ml_matrix &a) |
Right hand side of the cartesion equations of motion. | |
ml_matrix | satellite_visibility (const ml_matrix &from_pos, const ml_matrix &targets, double horizon_angle, double radius) |
Compute satellite visibility. | |
ml_matrix | planetary_accelerations (const ml_matrix &pos, double jd, int center) |
Compute perturbations due to other planets aside from the center. | |
ml_matrix | acc_planet (const ml_matrix &pos, double mu, const ml_matrix &rho) |
Acceleration due to a planet on a spacecraft within the sphere of influence of another body. | |
ml_matrix | orbit_acquisition_dv (ml_matrix &t, const orb_data_t &elI, const orb_data_t &elF, double smaTol=0.5, double incTol=1e-3, double raTol=1e-3) |
Compute delta-v sequence to acquire orbit. | |
double | phase_change_dv (double a0, double deltaA, double kTarget, double mu) |
Compute delta-v for a phase change. | |
ml_matrix | gps_satellite (double jD) |
GPS Satellite. |
void el_to_rv | ( | const orb_data_t & | data, |
ml_matrix & | pos, | ||
ml_matrix & | vel | ||
) |
Converts orbital elements to r and v for an elliptic orbit.
data | Orbital elements for the satellite. |
pos | position "r" matrix to be returned (km). |
vel | velocity "v" matrix to be returned (km/s). |
References orb_data_s::ecc, orb_data_s::inc, orb_data_s::mean_anom, MU_EARTH, orb_data_s::perigee, orb_data_s::raan, and orb_data_s::sma.
orb_data_t rv_to_el | ( | const ml_matrix & | pos, |
const ml_matrix & | vel, | ||
double | mu | ||
) |
pos | position "r" matrix for the satellite (km). |
vel | velocity "v" matrix for the satellite (km/s). |
mu | gravitational constant for the central body of the orbit pair (km^3/sec^2) |
References orb_data_s::ecc, orb_data_s::inc, orb_data_s::mean_anom, orb_data_s::orb_rate, orb_data_s::perigee, PI, orb_data_s::raan, orb_data_s::sma, orb_data_s::true_anom, and TWO_PI.
double rv_to_sma | ( | double | r_mag, |
double | v_mag, | ||
double | mu | ||
) |
Computes the semimajor axis given position and velocity.
r_mag | Position magnitude (length). |
v_mag | Velocity magnitude (length/s). |
mu | Gravitational parameter (length^3/s^2). |
double mean_to_true | ( | double | ecc, |
double | mean_anom | ||
) |
ecc | Eccentricity. |
mean_anom | Mean anomaly (rad). |
double mean_to_ecc | ( | double | ecc, |
double | mean_anom | ||
) |
ecc | Eccentricity. |
mean_anom | Mean anomaly (rad). |
double ecc_to_true | ( | double | ecc, |
double | hyp | ||
) |
ecc | Eccentricity. |
hyp | Hyperbolic anomaly (rad0. |
double ecc_to_mean | ( | double | ecc, |
double | hyp | ||
) |
ecc | Eccentricity. |
hyp | Hyperbolic anomaly (rad). |
double true_to_mean | ( | double | ecc, |
double | nu | ||
) |
ecc | Eccentricity. |
nu | True anomaly (rad). |
double mean_to_true_abs | ( | double | ecc, |
double | mean_anom | ||
) |
double true_to_ecc | ( | double | ecc, |
double | nu | ||
) |
ecc | Eccentricity in radians. |
nu | True anomaly in radians. |
double rarp_to_ecc | ( | double | ap, |
double | per | ||
) |
ap | Apogee radius. |
per | Perigee radius. |
double rarp_to_sma | ( | double | ap, |
double | per | ||
) |
Computes the semi major axis from apogee and perigee radii.
ap | Apogee radius. |
per | Perigee radius. |
double slr | ( | double | ecc, |
double | sma | ||
) |
ecc | Eccentricity. |
sma | Semi major axis (or perigee radius for parabola). |
ml_matrix cp_to_i | ( | double | inc, |
double | raan, | ||
double | w | ||
) |
inc | Inclination (rad). |
raan | Right ascension of the ascending node (rad). |
w | Argument of perigee (rad). |
double orb_rate | ( | double | r, |
double | sma, | ||
double | mu | ||
) |
r | Radius |
sma | Semi major axis (inf for parabola) |
mu | Gravitational parameter |
double orb_rate | ( | double | r ) |
double period | ( | double | a, |
double | mu | ||
) |
Compute the orbital period.
The units for a and mu must be consistent, for example [km] and [km3/s2]. FLT_MAX is substituted for infinity.
a | Semi-major axis |
mu | Gravitation parameter, default is Earth |
References TWO_PI.
void lin_orb | ( | double | n, |
ml_matrix & | a, | ||
ml_matrix & | b, | ||
double | dt | ||
) |
If value of dT is not equal to -1 it will generate the discrete time equations.
n | (1) orbit rate (rad/s). |
a | (6,6) State transition matrix. |
b | (6,3) Input matrix. |
dt | (1) Time step (s). |
void rv_orb_gen | ( | const ml_matrix & | el, |
const ml_matrix & | t, | ||
ml_matrix & | pos, | ||
ml_matrix & | vel, | ||
double | mu | ||
) |
el | (6,1) Elements vector [a,i,W,w,e,M] |
t | (1,n) Times from 0 to ° (sec) |
pos | (3,n) Position vectors for times t |
vel | (3,n) Velocity vectors for times t |
mu | (1,1) Gravitational potential |
References orb_data_s::ecc, orb_data_s::inc, orb_data_s::mean_anom, orb_data_s::perigee, orb_data_s::raan, and orb_data_s::sma.
void rv_orb_gen | ( | const orb_data_t & | el, |
const ml_matrix & | t, | ||
ml_matrix & | pos, | ||
ml_matrix & | vel, | ||
double | mu | ||
) |
Overloaded for calling with elements of type "orb_data_s"
el | (6,1) Elements vector [a,i,W,w,e,M] |
t | (1,n) Times from 0 to ° (sec) |
pos | (3,n) Position vectors for times t |
vel | (3,n) Velocity vectors for times t |
mu | (1,1) Gravitational potential |
References orb_data_s::ecc, orb_data_s::inc, orb_data_s::mean_anom, orb_data_s::perigee, orb_data_s::raan, and orb_data_s::sma.
ml_matrix cart_orb_rhs | ( | const ml_matrix & | x ) |
x | (6,1) State [x;y;z;dx/dt;dy/dt;dz/dt], pos: (km), vel: (km/s) |
References MU_EARTH.
ml_matrix cart_orb_rhs | ( | const ml_matrix & | x, |
const ml_matrix & | a | ||
) |
x | (6,1) Current state vector, pos: (km), vel: (km/s). |
a | (3,1) Acceleration vector (km/s/s). |
References MU_EARTH.
ml_matrix satellite_visibility | ( | const ml_matrix & | from_pos, |
const ml_matrix & | targets, | ||
double | horizon_angle, | ||
double | radius | ||
) |
from_pos | Position of the viewing satellite. |
targets | Positions of possibly visible satellites. |
horizon_angle | Angle above horizon for visibility |
radius | Planet radius. |
ml_matrix planetary_accelerations | ( | const ml_matrix & | pos, |
double | jd, | ||
int | center | ||
) |
ml_matrix acc_planet | ( | const ml_matrix & | pos, |
double | mu, | ||
const ml_matrix & | rho | ||
) |
pos | (3,1) Vector of the spacecraft from the central body |
mu | (1) Planet's gravitational parameter |
rho | (3,:) Vector of the planet from the central body |
ml_matrix orbit_acquisition_dv | ( | ml_matrix & | t, |
const orb_data_t & | elI, | ||
const orb_data_t & | elF, | ||
double | smaTol, | ||
double | incTol, | ||
double | raTol | ||
) |
Compute delta-v sequence to acquire orbit.
Inclination and right ascension correction are a single burn. Semi-major axis correction is a two-burn Hohmann transfer set. The conditions for performing a SMA correction are: 1. The SMA error exceeds the tolerance, AND 2. a) The final SMA is smaller than the initial, OR b) Both the inc. and r.a. error are within tolerance. The times will include the wait time for the necessary Hohmann phasing.
t | delta-V time (output) |
elI | Initial orbital elements |
elF | Final orbital elements |
smaTol | Tolerance on semi-major axis |
incTol | Tolerance on inclination |
raTol | Tolerance on right ascension |
References orb_data_s::inc, orb_data_s::mean_anom, orb_data_s::perigee, PI, orb_data_s::raan, and orb_data_s::sma.
double phase_change_dv | ( | double | a0, |
double | deltaA, | ||
double | kTarget, | ||
double | mu | ||
) |
Compute delta-v for a phase change.
a0 | (1,1) Initial semi-major axis |
deltaA | (1,1) Phase change |
kTarget | (1,1) Number of revolutions |
mu | (1,1) Planet's gravitational parameter |
References PI.