Class NBodyDynamics¶
Defined in File numerical_orbit_dynamics.h
Inheritance Relationships¶
Base Type¶
public lupnt::NumericalDynamics(Class NumericalDynamics)
Class Documentation¶
-
class NBodyDynamics : public lupnt::NumericalDynamics¶
Numerical point-mass, gravity-field, SRP, drag, and relativity orbit dynamics.
The model propagates Cartesian position and velocity in the selected integration frame. Body ephemerides are obtained in SI units internally and scaled to the configured UnitSystem at the dynamics boundary, so the propagated state, body constants, and force-model parameters remain unit-consistent.
Public Functions
-
NBodyDynamics()¶
-
NBodyDynamics(Config &dynamics_config)¶
Construct an n-body dynamics model from a YAML configuration.
Supported configuration fields include the integration frame, force-model switches, SRP and drag ballistic coefficients, and the unit system.
-
virtual State Propagate(const State &x0, Real t0, Real tf, const State *u, MatXd *stm) override¶
Propagate a Cartesian state and optionally compute the STM.
- Parameters:
x0 – Initial Cartesian state in the configured frame and unit system.
t0 – Initial TDB epoch in seconds.
tf – Final TDB epoch in seconds.
u – Optional control input.
stm – Optional state transition matrix output.
- Returns:
Final Cartesian state in the configured frame and unit system.
-
virtual VecX ComputeRates(Real t, const State &x) const override¶
Compute Cartesian position and velocity rates.
- Parameters:
t – TDB epoch in seconds.
x – Cartesian state in the configured frame and unit system.
- Returns:
Time derivative of the state in the configured unit system.
-
void AddBody(const Body &body)¶
Add a perturbing or central body to the dynamics model.
Bodies should use the same UnitSystem as the dynamics model. SetUnits() updates already-added built-in bodies to the requested units.
-
inline bool GetUseSrp()¶
Return true when solar radiation pressure is enabled.
-
inline bool GetUseDrag()¶
Return true when atmospheric drag is enabled.
-
inline bool GetUseRelativity() const¶
Return true when post-Newtonian relativistic corrections are enabled.
-
inline virtual StateType GetStateType() const override¶
Return the
StateTypetag of the state vector this dynamics model operates on (e.g.Cart6::TYPE,Attitude::TYPE,ClockState3::TYPE).Used by state-converters and asset wiring code to verify that a dynamics object is paired with a compatible state representation.
-
inline UnitSystem GetUnits() const¶
Return the active distance, time, and mass unit system.
-
inline void SetAutodiff(bool use_ad)¶
Enable or disable automatic differentiation rates.
-
void SetSrpCoefficient(Real CR, Real area, Real mass)¶
Set SRP coefficient from reflectivity coefficient, area, and mass.
-
void SetDragCoefficient(Real CD, Real area, Real mass)¶
Set drag coefficient from drag coefficient, area, and mass.
-
inline void SetUseSrp(bool use_srp)¶
Enable or disable solar radiation pressure.
-
inline void SetUseDrag(bool use_drag)¶
Enable or disable atmospheric drag.
-
inline void SetUseRelativity(bool use_relativity)¶
Enable or disable post-Newtonian relativistic corrections.
-
void SetUnits(const UnitSystem &units)¶
Set the active unit system for states, constants, and acceleration output.
Built-in bodies already registered with the model are recreated in the new unit system. Time epochs remain TDB seconds.
-
virtual State Propagate(const State &x0, Real t0, Real tf, const State *u = nullptr) override¶
Propagate the state from
t0totfwithout computing a state transition matrix.This is the core propagation entry point implemented by every concrete dynamics class (e.g. NumericalDynamics::Propagate, AnalyticalDynamics::Propagate, ClockDynamics::Propagate). It is called once per integration/measurement step by simulation drivers in applications/ and by agents/ to advance an object’s true or estimated state.
- Parameters:
x0 – Initial state at time
t0(layout/units defined by the subclass).t0 – Initial epoch [s, TDB since J2000 for orbit/attitude dynamics].
tf – Final epoch [s, TDB since J2000 for orbit/attitude dynamics].
u – Optional control/forcing input (e.g. thrust, RTN reference state); nullptr if unused.
- Returns:
Propagated state at time
tf.
-
virtual MatX Propagate(const State &x0, const VecX &tfs, const State *u = nullptr)¶
Propagate the state to a sequence of output epochs.
Repeatedly calls
Propagate(x0, t0, tf, u)between consecutive entries oftfs, accumulating each result as a row of the returned matrix. Used by applications/ and analysis scripts to generate a full trajectory time history in one call, with optional progress-bar output (see SetPrintProgress).- Parameters:
x0 – Initial state at
tfs(0).tfs – Vector of output epochs [s, TDB since J2000], including the initial epoch as
tfs(0).u – Optional control/forcing input applied at every step; nullptr if unused.
- Returns:
Matrix whose i-th row is the propagated state at
tfs(i).
-
NBodyDynamics()¶