Skip to main content

SolidMotor

Struct SolidMotor 

Source
pub struct SolidMotor { /* private fields */ }
Expand description

A solid rocket motor.

Nothing here can tell a hybrid’s thrust curve from a solid’s, so the checks are at the edges: crate::catalog::CatalogMotor::motor refuses hybrids and the .rse reader warns about them (.eng files don’t say).

Implementations§

Source§

impl SolidMotor

Source

pub fn new( curve: ThrustCurve, propellant: Propellant, dry: MassElement, nozzle: Option<Nozzle>, ) -> Result<Self, MotorError>

Builds a motor from its thrust curve, propellant, dry mass (about its own center) and optional nozzle.

§Errors
  • MotorError::Domain for a non-positive or non-finite dry mass (the motor at burnout, whose center of mass needs some mass), a negative or non-finite dry inertia, a non-finite position, a column with non-positive mass, radius or length, a nozzle with a non-positive exit radius, a throat radius outside (0, exit radius], or a negative or non-finite reference pressure.
  • MotorError::Inconsistent for a column bore at least as wide as the column, bad grain geometry (BatesGrains::validate), or a curve and propellant mass whose effective exhaust velocity I/m_p is outside EXHAUST_VELOCITY_RANGE_M_S, which is what a propellant mass in the wrong unit looks like. Sizes can’t be checked this way.
Source

pub fn from_envelope( curve: ThrustCurve, diameter_m: f64, length_m: f64, propellant_mass_kg: f64, loaded_mass_kg: f64, ) -> Result<Self, MotorError>

A motor known only by its envelope, as in a motor file or catalog: diameter D, length L, propellant mass and loaded mass.

The assumptions are crude, and a motor with measured data should be built with SolidMotor::new instead:

  • the propellant is a solid column of radius D/2 filling the length, centered at L/2;
  • the dry mass (loaded minus propellant) is a thin tube of radius D/2 and length L, centered at L/2;
  • no nozzle is known, so thrust gets no ambient-pressure correction.
§Errors

MotorError::Domain for a non-positive or non-finite dimension or propellant mass, and MotorError::Inconsistent when the propellant mass is not below the loaded mass (the motor would weigh nothing at burnout), or when the curve and the propellant mass imply an effective exhaust velocity outside EXHAUST_VELOCITY_RANGE_M_S, which is what masses given in grams look like. Sizes given in millimeters don’t change it, so this check can’t catch them.

Source

pub fn with_added_dry_mass( self, hardware: MassElement, ) -> Result<Self, MotorError>

The same motor with more dry mass, such as a reload’s case and closures (when the loaded mass excludes them) or a motor retainer, combined about the new dry center of mass.

§Errors

MotorError::Domain for a negative or non-finite mass or inertia, or a non-finite position.

Source

pub fn curve(&self) -> &ThrustCurve

The thrust curve.

Source

pub fn propellant(&self) -> &Propellant

The propellant model.

Source

pub fn dry(&self) -> MassElement

The dry mass, about its own center of mass.

Source

pub fn nozzle(&self) -> Option<Nozzle>

The nozzle, when known.

Source

pub fn propellant_initial_mass_kg(&self) -> f64

The propellant mass at ignition m_p0, kg.

Source

pub fn exhaust_velocity_m_s(&self) -> f64

The effective exhaust velocity c = I_total / m_p0, m/s.

Source

pub fn burnout_time_s(&self) -> f64

The time the thrust curve ends and the propellant is gone, s.

Source

pub fn propellant_mass_kg(&self, t: f64) -> f64

The propellant left at time t, m_p0 (1 − I(t)/I_total), kg. A NaN time gives NaN.

Source

pub fn state(&self, t: f64) -> MotorState

The thrust and mass properties at t seconds after ignition. Before ignition the motor is loaded and after burnout it is empty.

Source

pub fn thrust_at_pressure_n(&self, t: f64, ambient_pa: f64) -> f64

The thrust at t with ambient pressure ambient_pa, N: F + (p_ref − p_a) A_e, with the nozzle’s Nozzle::reference_pressure_pa, strictly inside the burn (0 < t < t_end, as RocketPy’s flight applies it) where the curve’s thrust is positive, never below zero; the curve’s thrust elsewhere, without a nozzle, and with a nozzle that gives no reference pressure. A NaN time gives NaN, and so does a NaN ambient pressure where the term applies.

The term is the full-flow value throughout, so the thrust steps by it just after ignition and again at t_end (both events for an integrator), and in the ignition transient and the tail-off, where a real nozzle’s exit pressure is far from its full-flow value, it misstates the thrust (docs/physics/motor.md).

Trait Implementations§

Source§

impl Clone for SolidMotor

Source§

fn clone(&self) -> SolidMotor

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 SolidMotor

Source§

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

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

impl<'de> Deserialize<'de> for SolidMotor

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 JsonSchema for SolidMotor

Source§

fn schema_name() -> Cow<'static, str>

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn inline_schema() -> bool

Whether JSON Schemas generated for this type should be included directly in parent schemas, rather than being re-used where possible using the $ref keyword. Read more
Source§

impl PartialEq for SolidMotor

Source§

fn eq(&self, other: &SolidMotor) -> 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 SolidMotor

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 SolidMotor

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.