Struct nyx_space::cosmic::Spacecraft
source · pub struct Spacecraft {
pub orbit: Orbit,
pub dry_mass_kg: f64,
pub fuel_mass_kg: f64,
pub srp: SrpConfig,
pub drag: DragConfig,
pub thruster: Option<Thruster>,
pub mode: GuidanceMode,
pub stm: Option<OMatrix<f64, Const<9>, Const<9>>>,
}
Expand description
A spacecraft state, composed of its orbit, its dry and fuel (wet) masses (in kg), its SRP configuration, its drag configuration, its thruster configuration, and its guidance mode.
Optionally, the spacecraft state can also store the state transition matrix from the start of the propagation until the current time (i.e. trajectory STM, not step-size STM).
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: SrpConfig
Solar Radiation Pressure configuration for this spacecraft
drag: DragConfig
§thruster: Option<Thruster>
§mode: GuidanceMode
Any extra information or extension that is needed for specific guidance laws
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) STM is contains position and velocity, Cr, Cd, fuel mass
Implementations§
source§impl Spacecraft
impl Spacecraft
sourcepub fn builder() -> SpacecraftBuilder<((), (), (), (), (), (), (), ())>
pub fn builder() -> SpacecraftBuilder<((), (), (), (), (), (), (), ())>
Create a builder for building Spacecraft
.
On the builder, call .orbit(...)
, .dry_mass_kg(...)
(optional), .fuel_mass_kg(...)
(optional), .srp(...)
(optional), .drag(...)
(optional), .thruster(...)
(optional), .mode(...)
(optional), .stm(...)
(optional) to set the values of the fields.
Finally, call .build()
to create the instance of Spacecraft
.
source§impl Spacecraft
impl Spacecraft
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,
mode: GuidanceMode
) -> Self
pub fn from_thruster( orbit: Orbit, dry_mass_kg: f64, fuel_mass_kg: f64, thruster: Thruster, mode: GuidanceMode ) -> Self
Initialize a spacecraft state from only a thruster and mass. Use this when designing guidance laws while 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_km_s(self, dv_km_s: 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) -> PhysicsResult<(f64, f64, f64)>
pub fn rss(&self, other: &Self) -> PhysicsResult<(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 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 Add<Matrix<f64, Const<6>, Const<1>, <DefaultAllocator as Allocator<f64, Const<6>>>::Buffer>> for Spacecraft
impl Add<Matrix<f64, Const<6>, Const<1>, <DefaultAllocator as Allocator<f64, Const<6>>>::Buffer>> for Spacecraft
source§impl Add<Matrix<f64, Const<9>, Const<1>, <DefaultAllocator as Allocator<f64, Const<9>>>::Buffer>> for Spacecraft
impl Add<Matrix<f64, Const<9>, Const<1>, <DefaultAllocator as Allocator<f64, Const<9>>>::Buffer>> for Spacecraft
source§impl Clone for Spacecraft
impl Clone for Spacecraft
source§fn clone(&self) -> Spacecraft
fn clone(&self) -> Spacecraft
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl ConfigRepr for Spacecraft
impl ConfigRepr for Spacecraft
source§fn load<P>(path: P) -> Result<Self, ConfigError>
fn load<P>(path: P) -> Result<Self, ConfigError>
source§fn load_many<P>(path: P) -> Result<Vec<Self>, ConfigError>
fn load_many<P>(path: P) -> Result<Vec<Self>, ConfigError>
source§fn load_named<P>(path: P) -> Result<BTreeMap<String, Self>, ConfigError>
fn load_named<P>(path: P) -> Result<BTreeMap<String, Self>, ConfigError>
source§fn loads_many(data: &str) -> Result<Vec<Self>, ConfigError>
fn loads_many(data: &str) -> Result<Vec<Self>, ConfigError>
source§fn loads_named(data: &str) -> Result<BTreeMap<String, Self>, ConfigError>
fn loads_named(data: &str) -> Result<BTreeMap<String, Self>, ConfigError>
source§impl Debug for Spacecraft
impl Debug for Spacecraft
source§impl Default for Spacecraft
impl Default for Spacecraft
source§impl<'de> Deserialize<'de> for Spacecraft
impl<'de> Deserialize<'de> for Spacecraft
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl Display for Spacecraft
impl Display for Spacecraft
source§impl EstimateFrom<Spacecraft, RangeDoppler> for Spacecraft
impl EstimateFrom<Spacecraft, RangeDoppler> for Spacecraft
source§fn extract(from: Spacecraft) -> Self
fn extract(from: Spacecraft) -> Self
source§fn sensitivity(
msr: &RangeDoppler,
receiver: Self,
transmitter: Orbit
) -> OMatrix<f64, <RangeDoppler as Measurement>::MeasurementSize, Self::Size>
fn sensitivity( msr: &RangeDoppler, receiver: Self, transmitter: Orbit ) -> OMatrix<f64, <RangeDoppler as Measurement>::MeasurementSize, Self::Size>
source§impl EventEvaluator<Spacecraft> for Event
impl EventEvaluator<Spacecraft> for Event
source§fn eval(
&self,
state: &Spacecraft,
almanac: Arc<Almanac>
) -> Result<f64, EventError>
fn eval( &self, state: &Spacecraft, almanac: Arc<Almanac> ) -> Result<f64, EventError>
fn epoch_precision(&self) -> Duration
fn value_precision(&self) -> f64
source§fn eval_string(
&self,
state: &Spacecraft,
_almanac: Arc<Almanac>
) -> Result<String, EventError>
fn eval_string( &self, state: &Spacecraft, _almanac: Arc<Almanac> ) -> Result<String, EventError>
fn eval_crossing( &self, prev_state: &S, next_state: &S, almanac: Arc<Almanac> ) -> Result<bool, EventError>
source§impl EventEvaluator<Spacecraft> for PenumbraEvent
impl EventEvaluator<Spacecraft> 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)
source§fn eval(
&self,
sc: &Spacecraft,
almanac: Arc<Almanac>
) -> Result<f64, EventError>
fn eval( &self, sc: &Spacecraft, almanac: Arc<Almanac> ) -> Result<f64, EventError>
source§fn eval_string(
&self,
state: &Spacecraft,
almanac: Arc<Almanac>
) -> Result<String, EventError>
fn eval_string( &self, state: &Spacecraft, almanac: Arc<Almanac> ) -> Result<String, EventError>
fn eval_crossing( &self, prev_state: &S, next_state: &S, almanac: Arc<Almanac> ) -> Result<bool, EventError>
source§impl EventEvaluator<Spacecraft> for UmbraEvent
impl EventEvaluator<Spacecraft> 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)
source§fn eval(
&self,
sc: &Spacecraft,
almanac: Arc<Almanac>
) -> Result<f64, EventError>
fn eval( &self, sc: &Spacecraft, almanac: Arc<Almanac> ) -> Result<f64, EventError>
source§fn eval_string(
&self,
state: &Spacecraft,
almanac: Arc<Almanac>
) -> Result<String, EventError>
fn eval_string( &self, state: &Spacecraft, almanac: Arc<Almanac> ) -> Result<String, EventError>
fn eval_crossing( &self, prev_state: &S, next_state: &S, almanac: Arc<Almanac> ) -> Result<bool, EventError>
source§impl From<CartesianState> for Spacecraft
impl From<CartesianState> for Spacecraft
source§impl Interpolatable for Spacecraft
impl Interpolatable for Spacecraft
source§fn interpolate(
self,
epoch: Epoch,
states: &[Self]
) -> Result<Self, InterpolationError>
fn interpolate( self, epoch: Epoch, states: &[Self] ) -> Result<Self, InterpolationError>
source§fn export_params() -> Vec<StateParameter>
fn export_params() -> Vec<StateParameter>
source§impl LowerExp for Spacecraft
impl LowerExp for Spacecraft
source§impl LowerHex for Spacecraft
impl LowerHex for Spacecraft
fn orbital_state(&self) -> Orbit
source§fn expected_state(&self) -> Orbit
fn expected_state(&self) -> Orbit
source§impl PartialEq for Spacecraft
impl PartialEq for Spacecraft
source§impl Serialize for Spacecraft
impl Serialize for Spacecraft
source§impl State for Spacecraft
impl State for Spacecraft
source§fn to_vector(&self) -> OVector<f64, Const<90>>
fn to_vector(&self) -> OVector<f64, Const<90>>
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>>)
fn set(&mut self, epoch: Epoch, vector: &OVector<f64, Const<90>>)
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>, DynamicsError>
fn stm(&self) -> Result<OMatrix<f64, Self::Size, Self::Size>, DynamicsError>
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§fn value(&self, param: StateParameter) -> Result<f64, StateError>
fn value(&self, param: StateParameter) -> Result<f64, StateError>
source§impl TrackingDeviceSim<Spacecraft, RangeDoppler> for GroundStation
impl TrackingDeviceSim<Spacecraft, RangeDoppler> for GroundStation
source§fn measure(
&mut self,
epoch: Epoch,
traj: &Traj<Spacecraft>,
rng: Option<&mut Pcg64Mcg>,
almanac: Arc<Almanac>
) -> Result<Option<RangeDoppler>, ODError>
fn measure( &mut self, epoch: Epoch, traj: &Traj<Spacecraft>, rng: Option<&mut Pcg64Mcg>, almanac: Arc<Almanac> ) -> Result<Option<RangeDoppler>, ODError>
Perform a measurement from the ground station to the receiver (rx).
source§fn measurement_noise(
&mut self,
epoch: Epoch
) -> Result<OMatrix<f64, <RangeDoppler as Measurement>::MeasurementSize, <RangeDoppler as Measurement>::MeasurementSize>, ODError>
fn measurement_noise( &mut self, epoch: Epoch ) -> Result<OMatrix<f64, <RangeDoppler as Measurement>::MeasurementSize, <RangeDoppler as Measurement>::MeasurementSize>, ODError>
Returns the measurement noise of this ground station.
§Methodology
Noises are modeled using a StochasticNoise process, defined by the sigma on the turn-on bias and on the steady state noise. The measurement noise is computed assuming that all measurements are independent variables, i.e. the measurement matrix is a diagonal matrix. The first item in the diagonal is the range noise (in km), set to the square of the steady state sigma. The second item is the Doppler noise (in km/s), set to the square of the steady state sigma of that Gauss Markov process.
source§fn location(
&self,
epoch: Epoch,
frame: Frame,
almanac: Arc<Almanac>
) -> AlmanacResult<Orbit>
fn location( &self, epoch: Epoch, frame: Frame, almanac: Arc<Almanac> ) -> AlmanacResult<Orbit>
fn measure_instantaneous( &mut self, rx: Spacecraft, rng: Option<&mut Pcg64Mcg>, almanac: Arc<Almanac> ) -> Result<Option<RangeDoppler>, ODError>
source§impl UpperHex for Spacecraft
impl UpperHex for Spacecraft
impl Copy for Spacecraft
Auto Trait Implementations§
impl Freeze for Spacecraft
impl RefUnwindSafe for Spacecraft
impl Send for Spacecraft
impl Sync for Spacecraft
impl Unpin for Spacecraft
impl UnwindSafe for Spacecraft
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> FromDhall for Twhere
T: DeserializeOwned,
impl<T> FromDhall for Twhere
T: DeserializeOwned,
fn from_dhall(v: &Value) -> Result<T, Error>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§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.