Spacecraft Control Framework 1.0
Spacecraft Control Library
sc_gravity.h
Go to the documentation of this file.
1/*
2 * sc_gravity.h
3 *
4 * Programmers: Mike Paluszek, David Wilson, Wil Turner
5 *
6 * Copyright 1999-2006, Princeton Satellite Systems. All rights reserved.
7 *
8 * Gravity models.
9 *
10 */
11
18#ifndef __SC_GRAVITY__
19#define __SC_GRAVITY__
20
21#ifdef AS_OS_WINDOWS
22#include "matrixlib.h"
23#else
24#include <MatrixLib/MatrixLib.h>
25#endif
26
27
30typedef struct gravity_s {
31 double p_radius;
32 double mu;
33 ml_matrix s_coef;
34 ml_matrix c_coef;
35 ml_matrix c_dist;
36 ml_matrix s_dist;
37 ml_matrix l_coef;
38 int z_harm;
39 int t_harm;
42
44gravity_t *init_gravity(int z_harm, int t_harm, int spherical, double p_radius, double mu, const ml_matrix& c_dist, const ml_matrix& s_dist, const ml_matrix& j);
45
47void destroy_gravity(gravity_t *gravity);
48
50ml_matrix compute_gravity(gravity_t *gravity, const ml_matrix &x_eci, const ml_matrix &m_eci_to_ef );
51
53double total_energy_n_body (const ml_matrix& r, const ml_matrix& v, const ml_matrix& mass );
54
56ml_matrix gravity_n_body( const ml_matrix& r, const ml_matrix& mass, double eps = 0 );
57
59ml_matrix accel_planet( const ml_matrix& r, ml_matrix& mu, ml_matrix& rho );
60
62ml_matrix accel_planet( const ml_matrix& r, double mu, ml_matrix& rho );
63
64
65#endif
struct gravity_s gravity_t
Structure for storing gravitational properties of a planet, used to compute the gravitational matrix ...
ml_matrix accel_planet(const ml_matrix &r, ml_matrix &mu, ml_matrix &rho)
Compute the gravity for n bodies.
Definition: sc_gravity.cc:110
gravity_t * init_gravity(int z_harm, int t_harm, int spherical, double p_radius, double mu, const ml_matrix &c_dist, const ml_matrix &s_dist, const ml_matrix &j)
Allocate and initialize a gravity structure.
Definition: sc_gravity.cc:150
ml_matrix compute_gravity(gravity_t *gravity, const ml_matrix &x_eci, const ml_matrix &m_eci_to_ef)
Compute the gravity matrix at a location and time.
Definition: sc_gravity.cc:186
void destroy_gravity(gravity_t *gravity)
Deallocate a gravity structure.
Definition: sc_gravity.cc:174
double total_energy_n_body(const ml_matrix &r, const ml_matrix &v, const ml_matrix &mass)
Compute the total energy for n bodies.
Definition: sc_gravity.cc:23
ml_matrix gravity_n_body(const ml_matrix &r, const ml_matrix &mass, double eps=0)
Compute the gravity for n bodies.
Definition: sc_gravity.cc:50
Structure for storing gravitational properties of a planet, used to compute the gravitational matrix ...
Definition: sc_gravity.h:30
ml_matrix s_coef
The sine term coefficients.
Definition: sc_gravity.h:33
ml_matrix l_coef
Legendre coefficients.
Definition: sc_gravity.h:37
ml_matrix c_coef
The cosine term coefficients.
Definition: sc_gravity.h:34
int z_harm
Number of zonal harmonics.
Definition: sc_gravity.h:38
double p_radius
Planet equatorial radius.
Definition: sc_gravity.h:31
double mu
Planet spherical gravity coefficient.
Definition: sc_gravity.h:32
ml_matrix s_dist
Functions of distance from the planet center that multiply the s terms.
Definition: sc_gravity.h:36
int t_harm
Number of tesseral harmonics.
Definition: sc_gravity.h:39
int spherical
If non-zero, include the spherical gravity term in the output force.
Definition: sc_gravity.h:40
ml_matrix c_dist
Functions of distance from the planet center that multiply the c terms.
Definition: sc_gravity.h:35