Struct nyx_space::cosmic::BaseSpacecraft
source · pub struct BaseSpacecraft<X: SpacecraftExt> {
pub orbit: Orbit,
pub dry_mass_kg: f64,
pub fuel_mass_kg: f64,
pub srp_area_m2: f64,
pub drag_area_m2: f64,
pub cr: f64,
pub cd: f64,
pub thruster: Option<Thruster>,
pub stm: Option<OMatrix<f64, Const<9>, Const<9>>>,
pub ext: X,
}
Expand description
A spacecraft state
Fields§
§orbit: Orbit
Initial orbit the vehicle is in
dry_mass_kg: f64
Dry mass, i.e. mass without fuel, in kg
fuel_mass_kg: f64
Fuel mass (if fuel mass is negative, thrusting will fail, unless configured to break laws of physics)
srp_area_m2: f64
in m^2
drag_area_m2: f64
in m^2
cr: f64
coefficient of reflectivity, must be between 0.0 (translucent) and 2.0 (all radiation absorbed and twice the force is transmitted back).
cd: f64
coefficient of drag; (spheres are between 2.0 and 2.1, use 2.2 in Earth’s atmosphere).
thruster: Option<Thruster>
§stm: Option<OMatrix<f64, Const<9>, Const<9>>>
Optionally stores the state transition matrix from the start of the propagation until the current time (i.e. trajectory STM, not step-size STM)
ext: X
Any extra information or extension that is needed for specific guidance laws
Implementations§
source§impl<X: SpacecraftExt> BaseSpacecraft<X>
impl<X: SpacecraftExt> BaseSpacecraft<X>
sourcepub fn new(
orbit: Orbit,
dry_mass_kg: f64,
fuel_mass_kg: f64,
srp_area_m2: f64,
drag_area_m2: f64,
cr: f64,
cd: f64
) -> Self
pub fn new( orbit: Orbit, dry_mass_kg: f64, fuel_mass_kg: f64, srp_area_m2: f64, drag_area_m2: f64, cr: f64, cd: f64 ) -> Self
Initialize a spacecraft state from all of its parameters
sourcepub fn from_thruster(
orbit: Orbit,
dry_mass_kg: f64,
fuel_mass_kg: f64,
thruster: Thruster,
ext: X
) -> Self
pub fn from_thruster( orbit: Orbit, dry_mass_kg: f64, fuel_mass_kg: f64, thruster: Thruster, ext: X ) -> Self
Initialize a spacecraft state from only a thruster and mass. Use this when designing guidance laws whilke ignoring drag and SRP.
sourcepub fn from_srp_defaults(orbit: Orbit, dry_mass_kg: f64, srp_area_m2: f64) -> Self
pub fn from_srp_defaults(orbit: Orbit, dry_mass_kg: f64, srp_area_m2: f64) -> Self
Initialize a spacecraft state from the SRP default 1.8 for coefficient of reflectivity (fuel mass and drag parameters nullified!)
sourcepub fn from_drag_defaults(
orbit: Orbit,
dry_mass_kg: f64,
drag_area_m2: f64
) -> Self
pub fn from_drag_defaults( orbit: Orbit, dry_mass_kg: f64, drag_area_m2: f64 ) -> Self
Initialize a spacecraft state from the SRP default 1.8 for coefficient of drag (fuel mass and SRP parameters nullified!)
pub fn with_dv(self, dv: Vector3<f64>) -> Self
sourcepub fn with_dry_mass(self, dry_mass_kg: f64) -> Self
pub fn with_dry_mass(self, dry_mass_kg: f64) -> Self
Returns a copy of the state with a new dry mass
sourcepub fn with_fuel_mass(self, fuel_mass_kg: f64) -> Self
pub fn with_fuel_mass(self, fuel_mass_kg: f64) -> Self
Returns a copy of the state with a new fuel mass
sourcepub fn with_srp(self, srp_area_m2: f64, cr: f64) -> Self
pub fn with_srp(self, srp_area_m2: f64, cr: f64) -> Self
Returns a copy of the state with a new SRP area and CR
sourcepub fn with_srp_area(self, srp_area_m2: f64) -> Self
pub fn with_srp_area(self, srp_area_m2: f64) -> Self
Returns a copy of the state with a new SRP area
sourcepub fn with_cr(self, cr: f64) -> Self
pub fn with_cr(self, cr: f64) -> Self
Returns a copy of the state with a new coefficient of reflectivity
sourcepub fn with_drag(self, drag_area_m2: f64, cd: f64) -> Self
pub fn with_drag(self, drag_area_m2: f64, cd: f64) -> Self
Returns a copy of the state with a new drag area and CD
sourcepub fn with_drag_area(self, drag_area_m2: f64) -> Self
pub fn with_drag_area(self, drag_area_m2: f64) -> Self
Returns a copy of the state with a new SRP area
sourcepub fn with_cd(self, cd: f64) -> Self
pub fn with_cd(self, cd: f64) -> Self
Returns a copy of the state with a new coefficient of drag
sourcepub fn with_orbit(self, orbit: Orbit) -> Self
pub fn with_orbit(self, orbit: Orbit) -> Self
Returns a copy of the state with a new orbit
sourcepub fn rss(&self, other: &Self) -> (f64, f64, f64)
pub fn rss(&self, other: &Self) -> (f64, f64, f64)
Returns the root sum square error between this spacecraft and the other, in kilometers for the position, kilometers per second in velocity, and kilograms in fuel
sourcepub fn enable_stm(&mut self)
pub fn enable_stm(&mut self)
Sets the STM of this state of identity, which also enables computation of the STM for spacecraft navigation
sourcepub fn degrade_to_spacecraft(&self) -> Spacecraft
pub fn degrade_to_spacecraft(&self) -> Spacecraft
Allows the automatic conversion of a BaseSpacecraft into a standard spacecraft.
WARNING: This will IGNORE the extra
of BaseSpacecraft
source§impl BaseSpacecraft<GuidanceMode>
impl BaseSpacecraft<GuidanceMode>
sourcepub fn with_guidance_mode(self, mode: GuidanceMode) -> Self
pub fn with_guidance_mode(self, mode: GuidanceMode) -> Self
Returns a copy of the state with the provided guidance mode
pub fn mode(&self) -> GuidanceMode
pub fn mut_mode(&mut self, mode: GuidanceMode)
Trait Implementations§
source§impl<X: SpacecraftExt> Add<Matrix<f64, Const<6>, Const<1>, <DefaultAllocator as Allocator<f64, Const<6>, Const<1>>>::Buffer>> for BaseSpacecraft<X>
impl<X: SpacecraftExt> Add<Matrix<f64, Const<6>, Const<1>, <DefaultAllocator as Allocator<f64, Const<6>, Const<1>>>::Buffer>> for BaseSpacecraft<X>
source§impl<X: SpacecraftExt> Add<Matrix<f64, Const<9>, Const<1>, <DefaultAllocator as Allocator<f64, Const<9>, Const<1>>>::Buffer>> for BaseSpacecraft<X>
impl<X: SpacecraftExt> Add<Matrix<f64, Const<9>, Const<1>, <DefaultAllocator as Allocator<f64, Const<9>, Const<1>>>::Buffer>> for BaseSpacecraft<X>
source§impl<X: Clone + SpacecraftExt> Clone for BaseSpacecraft<X>
impl<X: Clone + SpacecraftExt> Clone for BaseSpacecraft<X>
source§fn clone(&self) -> BaseSpacecraft<X>
fn clone(&self) -> BaseSpacecraft<X>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<X: Debug + SpacecraftExt> Debug for BaseSpacecraft<X>
impl<X: Debug + SpacecraftExt> Debug for BaseSpacecraft<X>
source§impl<X: SpacecraftExt> Default for BaseSpacecraft<X>
impl<X: SpacecraftExt> Default for BaseSpacecraft<X>
source§impl<X: SpacecraftExt> Display for BaseSpacecraft<X>
impl<X: SpacecraftExt> Display for BaseSpacecraft<X>
source§impl EstimateFrom<BaseSpacecraft<GuidanceMode>> for Orbit
impl EstimateFrom<BaseSpacecraft<GuidanceMode>> for Orbit
source§fn extract(from: Spacecraft) -> Self
fn extract(from: Spacecraft) -> Self
source§impl EstimateFrom<BaseSpacecraft<GuidanceMode>> for Spacecraft
impl EstimateFrom<BaseSpacecraft<GuidanceMode>> for Spacecraft
source§fn extract(from: Spacecraft) -> Self
fn extract(from: Spacecraft) -> Self
source§impl EventEvaluator<BaseSpacecraft<GuidanceMode>> for Event
impl EventEvaluator<BaseSpacecraft<GuidanceMode>> for Event
fn eval(&self, state: &Spacecraft) -> f64
fn epoch_precision(&self) -> Duration
fn value_precision(&self) -> f64
fn eval_crossing(&self, prev_state: &S, next_state: &S) -> bool
source§impl EventEvaluator<BaseSpacecraft<GuidanceMode>> for PenumbraEvent
impl EventEvaluator<BaseSpacecraft<GuidanceMode>> for PenumbraEvent
source§fn epoch_precision(&self) -> Duration
fn epoch_precision(&self) -> Duration
Stop searching when the time has converged to less than 0.1 seconds
source§fn value_precision(&self) -> f64
fn value_precision(&self) -> f64
Finds the slightest penumbra within 2%(i.e. 98% in visibility)
fn eval(&self, sc: &Spacecraft) -> f64
fn eval_crossing(&self, prev_state: &S, next_state: &S) -> bool
source§impl EventEvaluator<BaseSpacecraft<GuidanceMode>> for UmbraEvent
impl EventEvaluator<BaseSpacecraft<GuidanceMode>> for UmbraEvent
source§fn epoch_precision(&self) -> Duration
fn epoch_precision(&self) -> Duration
Stop searching when the time has converged to less than 0.1 seconds
source§fn value_precision(&self) -> f64
fn value_precision(&self) -> f64
Finds the darkest part of an eclipse within 2% of penumbra (i.e. 98% in shadow)
fn eval(&self, sc: &Spacecraft) -> f64
fn eval_crossing(&self, prev_state: &S, next_state: &S) -> bool
source§impl<X: SpacecraftExt> LowerExp for BaseSpacecraft<X>
impl<X: SpacecraftExt> LowerExp for BaseSpacecraft<X>
source§impl<X: SpacecraftExt> LowerHex for BaseSpacecraft<X>
impl<X: SpacecraftExt> LowerHex for BaseSpacecraft<X>
source§impl MdHdlr<BaseSpacecraft<GuidanceMode>> for OrbitStateOutput
impl MdHdlr<BaseSpacecraft<GuidanceMode>> for OrbitStateOutput
fn handle(&mut self, state: &Spacecraft)
source§impl MeasurementDevice<BaseSpacecraft<GuidanceMode>, StdMeasurement> for GroundStation
impl MeasurementDevice<BaseSpacecraft<GuidanceMode>, StdMeasurement> for GroundStation
source§fn measure(&self, sc_rx: &Spacecraft) -> Option<StdMeasurement>
fn measure(&self, sc_rx: &Spacecraft) -> Option<StdMeasurement>
Perform a measurement from the ground station to the receiver (rx).
source§impl<X: SpacecraftExt> PartialEq<BaseSpacecraft<X>> for BaseSpacecraft<X>
impl<X: SpacecraftExt> PartialEq<BaseSpacecraft<X>> for BaseSpacecraft<X>
source§impl<X: SpacecraftExt> State for BaseSpacecraft<X>
impl<X: SpacecraftExt> State for BaseSpacecraft<X>
source§fn as_vector(&self) -> Result<OVector<f64, Const<90>>, NyxError>
fn as_vector(&self) -> Result<OVector<f64, Const<90>>, NyxError>
The vector is organized as such: [X, Y, Z, Vx, Vy, Vz, Cr, Cd, Fuel mass, STM(9x9)]
source§fn set(
&mut self,
epoch: Epoch,
vector: &OVector<f64, Const<90>>
) -> Result<(), NyxError>
fn set( &mut self, epoch: Epoch, vector: &OVector<f64, Const<90>> ) -> Result<(), NyxError>
Vector is expected to be organized as such: [X, Y, Z, Vx, Vy, Vz, Cr, Cd, Fuel mass, STM(9x9)]
source§fn stm(&self) -> Result<OMatrix<f64, Self::Size, Self::Size>, NyxError>
fn stm(&self) -> Result<OMatrix<f64, Self::Size, Self::Size>, NyxError>
diag(STM) = [X,Y,Z,Vx,Vy,Vz,Cr,Cd,Fuel] WARNING: Currently the STM assumes that the fuel mass is constant at ALL TIMES!
type VecLength = Const<90>
source§fn reset_stm(&mut self)
fn reset_stm(&mut self)
source§fn zeros() -> Self
fn zeros() -> Self
source§fn add(self, other: OVector<f64, Self::Size>) -> Self
fn add(self, other: OVector<f64, Self::Size>) -> Self
source§impl<X: SpacecraftExt> UpperExp for BaseSpacecraft<X>
impl<X: SpacecraftExt> UpperExp for BaseSpacecraft<X>
source§impl<X: SpacecraftExt> UpperHex for BaseSpacecraft<X>
impl<X: SpacecraftExt> UpperHex for BaseSpacecraft<X>
impl<X: Copy + SpacecraftExt> Copy for BaseSpacecraft<X>
Auto Trait Implementations§
impl<X> RefUnwindSafe for BaseSpacecraft<X>where X: RefUnwindSafe,
impl<X> Send for BaseSpacecraft<X>
impl<X> Sync for BaseSpacecraft<X>
impl<X> Unpin for BaseSpacecraft<X>where X: Unpin,
impl<X> UnwindSafe for BaseSpacecraft<X>where X: UnwindSafe,
Blanket Implementations§
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> Printing<T> for Twhere
T: Display,
impl<T> Printing<T> for Twhere T: Display,
§fn to_str(self) -> String
fn to_str(self) -> String
printing.rs
. §fn to_plainstr(self) -> String
fn to_plainstr(self) -> String
printing.rs
.§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.