Skip to main content

CatalogMotor

Struct CatalogMotor 

Source
pub struct CatalogMotor {
Show 20 fields pub motor_id: String, pub manufacturer: String, pub manufacturer_abbrev: String, pub designation: String, pub common_name: String, pub impulse_class: ImpulseClass, pub motor_type: MotorType, pub case_info: Option<String>, pub prop_info: Option<String>, pub delays: Option<String>, pub diameter_mm: f64, pub length_mm: f64, pub total_impulse_ns: f64, pub average_thrust_n: f64, pub max_thrust_n: Option<f64>, pub burn_time_s: f64, pub propellant_mass_g: Option<f64>, pub total_mass_g: Option<f64>, pub stated: StatedFigures, pub curves: Vec<CatalogCurve>,
}
Expand description

One motor’s catalog entry, in the units motor files use.

Fields§

§motor_id: String

ThrustCurve.org’s id for the motor.

§manufacturer: String

Manufacturer name.

§manufacturer_abbrev: String

Manufacturer abbreviation.

§designation: String

Full designation, such as 1266J760-19A.

§common_name: String

Common name, such as J760.

§impulse_class: ImpulseClass

Impulse class letter.

§motor_type: MotorType

Single-use or reload.

§case_info: Option<String>

The case a reload fits, such as Pro54-3G.

§prop_info: Option<String>

The propellant.

§delays: Option<String>

Available delays as written (6,10,14, 4-6, P; the bundled index copies the curve file’s header); see CatalogMotor::delays.

§diameter_mm: f64

Diameter, mm.

§length_mm: f64

Length, mm.

§total_impulse_ns: f64

Total impulse, N·s (ThrustCurve::total_impulse_ns in the bundled index).

§average_thrust_n: f64

Average thrust, N (ThrustCurve::average_thrust_n in the bundled index).

§max_thrust_n: Option<f64>

Peak thrust, N (ThrustCurve::peak_thrust_n in the bundled index).

§burn_time_s: f64

Burn time, s (ThrustCurve::burn_time_s, the NFPA 1125 window, in the bundled index).

§propellant_mass_g: Option<f64>

Propellant mass, g.

§total_mass_g: Option<f64>

Loaded mass, g.

§stated: StatedFigures

The figures ThrustCurve.org’s record states for the motor, which each curve file is checked against (CurveCheck).

§curves: Vec<CatalogCurve>

The motor’s curves.

Implementations§

Source§

impl CatalogMotor

Source

pub fn delays(&self) -> DelayList

The delay settings read from CatalogMotor::delays; empty when none are recorded.

Source

pub fn thrust_curve( &self, curve: &CatalogCurve, text: &str, ) -> Result<ThrustCurve, MotorError>

Reads a curve of this motor from its file’s text.

§Errors
Source

pub fn motor( &self, curve: &CatalogCurve, text: &str, ) -> Result<SolidMotor, MotorError>

The motor with the curve read from text, built with SolidMotor::from_envelope from this entry’s diameter, length and masses. The curve file’s header is used only for a mass the metadata lacks.

§Errors

As CatalogMotor::thrust_curve and SolidMotor::from_envelope, and MotorError::Inconsistent for a hybrid (HPR Sim models solids only) or when neither the metadata nor the file gives the masses. The text is not checked against the curve’s SHA-256: pass the file the curve names.

Source

pub fn bundled_motor(&self) -> Result<SolidMotor, MotorError>

The motor with its default curve (CatalogMotor::default_curve).

§Errors

MotorError::Inconsistent if the entry has no bundled curve file, and CatalogMotor::motor’s errors.

Source

pub fn ranked_curves(&self) -> Vec<&CatalogCurve>

The motor’s curves in the order its default is taken (ADR-298 §5): a file whose check passes first, then the order ADR-154 fetches in, RASP before RockSim, each ranked by who measured it (a certification test, the maker, then a user), the index’s order within a rank.

Source

pub fn default_curve(&self) -> Option<&CatalogCurve>

The curve a flight takes when none is named: the first of CatalogMotor::ranked_curves whose file is bundled, so a passing file where one is.

Source

pub fn curve_for_digest( &self, digest: Option<&str>, ) -> Option<(&CatalogCurve, &'static str)>

The curve a design file’s motor flies, with its bundled file’s text: the file OpenRocket’s curve for digest maps to (crate::openrocket_curves::file_for) where it is one of this motor’s bundled files (ADR-288 §3), else CatalogMotor::default_curve.

Source

pub fn default_curve_text(&self) -> Option<(&CatalogCurve, &'static str)>

CatalogMotor::default_curve with its bundled file’s text.

Source

pub fn failing_figures(&self, curve: &CatalogCurve) -> Vec<FigureGap>

The figures of curve’s check outside CHECK_BOUND of this motor’s stated ones, in the order total impulse, average thrust, burn time; empty when the file passes.

Source

pub fn propellant_warning(&self, curve: &CatalogCurve) -> Option<String>

The warning for flying curve when the propellant mass it flies with (the entry’s, else its header’s; CatalogMotor::motor) is more than PROPELLANT_SHORT_BOUND below the record’s, naming both masses and the gap; None when it isn’t (a file exactly at the bound draws none), when the record states no propellant mass, or when the file isn’t bundled or doesn’t read.

Source

pub fn mass_warnings(&self, curve: &CatalogCurve) -> Vec<String>

The warnings for the masses flying curve takes (CatalogMotor::motor): a loaded mass more than LOADED_MASS_BOUND from the record’s, either way, naming both masses; else a burnout mass, loaded less propellant, more than BURNOUT_MASS_BOUND of the record’s burnout mass from it, either way, naming both; and a propellant share outside PROPELLANT_SHARE_SPAN, the span the records state. Empty when neither holds, or when the file isn’t bundled or doesn’t read. Compared as masses, so a loaded mass exactly at the bound draws none. A NaN flown mass warns. A record loaded mass that is NaN, infinite or not above zero, or a record propellant mass that is NaN, infinite or below zero, counts as no record.

Source

pub fn flight_warnings(&self, curve: &CatalogCurve) -> Vec<String>

Every warning flying curve draws: its failing check (CatalogMotor::check_warning), a light propellant mass (CatalogMotor::propellant_warning) and its masses against the record (CatalogMotor::mass_warnings), in that order.

Source

pub fn flight_warning_kinds(&self, curve: &CatalogCurve) -> Vec<MotorWarning>

CatalogMotor::flight_warnings, each with its kind, so a count by kind doesn’t hang on the words (issue #1287). The file is read once.

Source

pub fn check_warning(&self, curve: &CatalogCurve) -> Option<String>

The warning for flying curve when its check fails, naming the motor, the file and each failing figure’s signed gap, file against ThrustCurve.org’s stated figure; None when it passes.

Trait Implementations§

Source§

impl Clone for CatalogMotor

Source§

fn clone(&self) -> CatalogMotor

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for CatalogMotor

Source§

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

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

impl<'de> Deserialize<'de> for CatalogMotor

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 PartialEq for CatalogMotor

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for CatalogMotor

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 StructuralPartialEq for CatalogMotor

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

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

Source§

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

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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.

Source§

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

Source§

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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>,

Source§

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.