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)

Implementations§

source§

impl Spacecraft

source

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

source

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.

source

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!)

source

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!)

source

pub fn with_dv(self, dv: Vector3<f64>) -> Self

source

pub fn with_dry_mass(self, dry_mass_kg: f64) -> Self

Returns a copy of the state with a new dry mass

source

pub fn with_fuel_mass(self, fuel_mass_kg: f64) -> Self

Returns a copy of the state with a new fuel mass

source

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

source

pub fn with_srp_area(self, srp_area_m2: f64) -> Self

Returns a copy of the state with a new SRP area

source

pub fn with_cr(self, cr: f64) -> Self

Returns a copy of the state with a new coefficient of reflectivity

source

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

source

pub fn with_drag_area(self, drag_area_m2: f64) -> Self

Returns a copy of the state with a new SRP area

source

pub fn with_cd(self, cd: f64) -> Self

Returns a copy of the state with a new coefficient of drag

source

pub fn with_orbit(self, orbit: Orbit) -> Self

Returns a copy of the state with a new orbit

source

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

source

pub fn enable_stm(&mut self)

Sets the STM of this state of identity, which also enables computation of the STM for spacecraft navigation

source

pub fn with_stm(self) -> Self

Copies the current state but sets the STM to identity

source

pub fn mass_kg(&self) -> f64

Returns the total mass in kilograms

source

pub fn with_guidance_mode(self, mode: GuidanceMode) -> Self

Returns a copy of the state with the provided guidance mode

source

pub fn mode(&self) -> GuidanceMode

source

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

source§

fn add(self, other: OVector<f64, Const<6>>) -> Self

Adds the provided state deviation to this orbit

§

type Output = Spacecraft

The resulting type after applying the + operator.
source§

impl Add<Matrix<f64, Const<9>, Const<1>, <DefaultAllocator as Allocator<f64, Const<9>>>::Buffer>> for Spacecraft

source§

fn add(self, other: OVector<f64, Const<9>>) -> Self

Adds the provided state deviation to this orbit

§

type Output = Spacecraft

The resulting type after applying the + operator.
source§

impl Clone for Spacecraft

source§

fn clone(&self) -> Spacecraft

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl ConfigRepr for Spacecraft

source§

fn load<P>(path: P) -> Result<Self, ConfigError>
where P: AsRef<Path>,

Builds the configuration representation from the path to a yaml
source§

fn load_many<P>(path: P) -> Result<Vec<Self>, ConfigError>
where P: AsRef<Path>,

Builds a sequence of “Selves” from the provided path to a yaml
source§

fn load_named<P>(path: P) -> Result<HashMap<String, Self>, ConfigError>
where P: AsRef<Path>,

Builds a map of names to “selves” from the provided path to a yaml
source§

fn loads_many(data: &str) -> Result<Vec<Self>, ConfigError>

Builds a sequence of “Selves” from the provided string of a yaml
source§

impl Configurable for Spacecraft

§

type IntermediateRepr = Spacecraft

The intermediate representation needed to create Self or to serialize Self.
source§

fn from_config( cfg: Self::IntermediateRepr, _cosm: Arc<Cosm> ) -> Result<Self, ConfigError>
where Self: Sized,

Creates a new instance of self from the configuration.
source§

fn to_config(&self) -> Result<Self::IntermediateRepr, ConfigError>

Converts self into the intermediate representation which is serializable.
source§

fn from_yaml<P: AsRef<Path>>( path: P, cosm: Arc<Cosm> ) -> Result<Self, ConfigError>

source§

impl Debug for Spacecraft

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Spacecraft

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for Spacecraft

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Display for Spacecraft

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl EstimateFrom<Spacecraft, RangeDoppler> for Orbit

source§

fn extract(from: Spacecraft) -> Self

From the state extract the state to be estimated
source§

fn sensitivity( msr: &RangeDoppler, receiver: Self, transmitter: Self ) -> OMatrix<f64, <RangeDoppler as Measurement>::MeasurementSize, Self::Size>

Returns the measurement sensitivity (often referred to as H tilde). Read more
source§

impl EstimateFrom<Spacecraft, RangeDoppler> for Spacecraft

source§

fn extract(from: Spacecraft) -> Self

From the state extract the state to be estimated
source§

fn sensitivity( _msr: &RangeDoppler, _receiver: Self, _transmitter: Orbit ) -> OMatrix<f64, <RangeDoppler as Measurement>::MeasurementSize, Self::Size>

Returns the measurement sensitivity (often referred to as H tilde). Read more
source§

impl EventEvaluator<Spacecraft> for Event

source§

fn eval(&self, state: &Spacecraft) -> f64

Evaluation of the event, must return a value corresponding to whether the state is before or after the event
source§

fn epoch_precision(&self) -> Duration

source§

fn value_precision(&self) -> f64

source§

fn eval_string(&self, state: &Spacecraft) -> String

Returns a string representation of the event evaluation for the given state
source§

fn eval_crossing(&self, prev_state: &S, next_state: &S) -> bool

source§

impl EventEvaluator<Spacecraft> for PenumbraEvent

source§

fn epoch_precision(&self) -> Duration

Stop searching when the time has converged to less than 0.1 seconds

source§

fn value_precision(&self) -> f64

Finds the slightest penumbra within 2%(i.e. 98% in visibility)

source§

fn eval(&self, sc: &Spacecraft) -> f64

Evaluation of the event, must return a value corresponding to whether the state is before or after the event
source§

fn eval_string(&self, state: &Spacecraft) -> String

Returns a string representation of the event evaluation for the given state
source§

fn eval_crossing(&self, prev_state: &S, next_state: &S) -> bool

source§

impl EventEvaluator<Spacecraft> for UmbraEvent

source§

fn epoch_precision(&self) -> Duration

Stop searching when the time has converged to less than 0.1 seconds

source§

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) -> f64

Evaluation of the event, must return a value corresponding to whether the state is before or after the event
source§

fn eval_string(&self, state: &Spacecraft) -> String

Returns a string representation of the event evaluation for the given state
source§

fn eval_crossing(&self, prev_state: &S, next_state: &S) -> bool

source§

impl Interpolatable for Spacecraft

source§

fn interpolate(self, epoch: Epoch, states: &[Self]) -> Result<Self, NyxError>

Interpolates a new state at the provided epochs given a slice of states.
source§

fn frame(&self) -> Frame

Returns the frame of this state
source§

fn set_frame(&mut self, frame: Frame)

Sets the frame of this state
source§

fn export_params() -> Vec<StateParameter>

List of state parameters that will be exported to a trajectory file in addition to the epoch (provided in this different formats).
source§

fn orbit(&self) -> &Orbit

Returns the orbit
source§

impl LowerExp for Spacecraft

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter.
source§

impl LowerHex for Spacecraft

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter.
source§

impl PartialEq for Spacecraft

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for Spacecraft

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl State for Spacecraft

source§

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>

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>

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 Size = Const<9>

Size of the state and its STM
§

type VecLength = Const<90>

source§

fn reset_stm(&mut self)

Return this state as a vector for the propagation/estimation By default, this is not implemented. This function must be implemented when filtering on this state.
source§

fn zeros() -> Self

Initialize an empty state By default, this is not implemented. This function must be implemented when filtering on this state.
source§

fn epoch(&self) -> Epoch

Retrieve the Epoch
source§

fn set_epoch(&mut self, epoch: Epoch)

Set the Epoch
source§

fn add(self, other: OVector<f64, Self::Size>) -> Self

By default, this is not implemented. This function must be implemented when filtering on this state.
source§

fn value(&self, param: StateParameter) -> Result<f64, NyxError>

Return the value of the parameter, returns an error by default
source§

fn set_value(&mut self, param: StateParameter, val: f64) -> Result<(), NyxError>

Allows setting the value of the given parameter. NOTE: Most parameters where the value is available CANNOT be also set for that parameter (it’s a much harder problem!)
source§

fn unset_stm(&mut self)

Unsets the STM for this state
source§

fn set_with_delta_seconds( self, delta_t_s: f64, vector: &OVector<f64, Self::VecLength> ) -> Self

Reconstruct a new State from the provided delta time in seconds compared to the current state and with the provided vector.
source§

impl TrackingDeviceSim<Spacecraft, RangeDoppler> for GroundStation

source§

fn measure( &mut self, epoch: Epoch, traj: &Traj<Spacecraft>, rng: Option<&mut Pcg64Mcg>, cosm: Arc<Cosm> ) -> Result<Option<RangeDoppler>, NyxError>

Perform a measurement from the ground station to the receiver (rx).

source§

fn name(&self) -> String

Returns the name of this tracking data simulator
source§

fn location(&self, epoch: Epoch, frame: Frame, cosm: &Cosm) -> Orbit

Returns the device location at the given epoch and in the given frame.
source§

fn measure_instantaneous( &mut self, rx: Spacecraft, rng: Option<&mut Pcg64Mcg>, cosm: Arc<Cosm> ) -> Result<Option<RangeDoppler>, NyxError>

source§

impl UpperExp for Spacecraft

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter.
source§

impl UpperHex for Spacecraft

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter.
source§

impl Copy for Spacecraft

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Printing<T> for T
where T: Display,

§

fn to_str(self) -> String

Method to serialize. Decorates Vecs with square brackets and tuples with round ones. Implementation code is in printing.rs.
§

fn to_plainstr(self) -> String

Method to serialize in minimal form (space separated, no brackets) Implementation code is in printing.rs.
§

fn rd(self) -> String

Printable in red
§

fn gr(self) -> String

Printable in green
§

fn bl(self) -> String

Printable in blue
§

fn yl(self) -> String

Printable in yellow
§

fn mg(self) -> String

Printable in magenta
§

fn cy(self) -> String

Printable in cyan
§

fn wvec(self, f: &mut File) -> Result<(), Error>

Method to write vector(s) to file f (space separated, without brackets). Passes up io errors
§

fn pvec(self)

Method to print vector(s) to stdout (space separated,without brackets).
source§

impl<T> Same for T

§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,