pub struct ThrustCurve { /* private fields */ }Expand description
A thrust curve: thrust in newtons against time in seconds from ignition, joined by straight lines.
Built through ThrustCurve::new, which checks the samples; it serializes as its samples and
re-checks them when deserialized.
Implementations§
Source§impl ThrustCurve
impl ThrustCurve
Sourcepub fn new(times_s: Vec<f64>, thrusts_n: Vec<f64>) -> Result<Self, MotorError>
pub fn new(times_s: Vec<f64>, thrusts_n: Vec<f64>) -> Result<Self, MotorError>
Builds a curve from sample times (s) and thrusts (N). A (0, 0) sample is prepended when
the first time is after zero.
§Errors
MotorError::Inconsistentif the columns differ in length or are empty.MotorError::Domainfor a time or thrust that is not finite, a negative time, or a negative thrust.MotorError::TimesDecreasingif a time is before its predecessor. Equal times are a step.MotorError::NoThrustif the total impulse or the NFPA 1125 burn time is not positive (no positive thrust, or thrust only at a single instant).
Sourcepub fn times_s(&self) -> &[f64]
pub fn times_s(&self) -> &[f64]
The sample times, s, starting at 0 (including a prepended (0, 0)).
Sourcepub fn end_time_s(&self) -> f64
pub fn end_time_s(&self) -> f64
The last sample time, s. The thrust is zero from here on, this instant included.
Sourcepub fn peak_thrust_n(&self) -> f64
pub fn peak_thrust_n(&self) -> f64
The peak thrust, N: the largest delivered sample (see the module docs), which is the least
upper bound of ThrustCurve::thrust_n over time. A sample the thrust steps past inside a
run of three or more equal times does not count.
Sourcepub fn total_impulse_ns(&self) -> f64
pub fn total_impulse_ns(&self) -> f64
The total impulse I = ∫ F dt, N·s.
Sourcepub fn thrust_n(&self, t: f64) -> f64
pub fn thrust_n(&self, t: f64) -> f64
The thrust at time t (s after ignition), N: linear between samples, zero before ignition
and from the last sample on. A NaN time gives NaN.
Like any step, the end of the curve takes the later value at its own instant: a curve that ends above zero thrust gives zero at its last sample time, when all the propellant is gone.
Sourcepub fn impulse_ns(&self, t: f64) -> f64
pub fn impulse_ns(&self, t: f64) -> f64
The impulse delivered by time t, I(t) = ∫₀ᵗ F dt, N·s: exact for the piecewise-linear
thrust, zero before ignition and the total impulse after the last sample. A NaN time gives
NaN.
Sourcepub fn burn_window_s(&self) -> (f64, f64)
pub fn burn_window_s(&self) -> (f64, f64)
The NFPA 1125 burn window (start, end), s: when the thrust first reaches, and last falls
to, NFPA_1125_THRESHOLD of its peak, interpolated on the straight segments. Only
delivered samples (see the module docs) are compared with the threshold.
Sourcepub fn burn_time_s(&self) -> f64
pub fn burn_time_s(&self) -> f64
The NFPA 1125 burn time, s: the length of ThrustCurve::burn_window_s.
Sourcepub fn average_thrust_n(&self) -> f64
pub fn average_thrust_n(&self) -> f64
The average thrust, N: the total impulse over the NFPA 1125 burn time.
Trait Implementations§
Source§impl Clone for ThrustCurve
impl Clone for ThrustCurve
Source§fn clone(&self) -> ThrustCurve
fn clone(&self) -> ThrustCurve
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ThrustCurve
impl Debug for ThrustCurve
Source§impl<'de> Deserialize<'de> for ThrustCurve
impl<'de> Deserialize<'de> for ThrustCurve
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 JsonSchema for ThrustCurve
impl JsonSchema for ThrustCurve
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl PartialEq for ThrustCurve
impl PartialEq for ThrustCurve
Source§fn eq(&self, other: &ThrustCurve) -> bool
fn eq(&self, other: &ThrustCurve) -> bool
self and other values to be equal, and is used by ==.