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
impl SolidMotor
Sourcepub fn new(
curve: ThrustCurve,
propellant: Propellant,
dry: MassElement,
nozzle: Option<Nozzle>,
) -> Result<Self, MotorError>
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::Domainfor 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::Inconsistentfor a column bore at least as wide as the column, bad grain geometry (BatesGrains::validate), or a curve and propellant mass whose effective exhaust velocityI/m_pis outsideEXHAUST_VELOCITY_RANGE_M_S, which is what a propellant mass in the wrong unit looks like. Sizes can’t be checked this way.
Sourcepub fn from_envelope(
curve: ThrustCurve,
diameter_m: f64,
length_m: f64,
propellant_mass_kg: f64,
loaded_mass_kg: f64,
) -> Result<Self, MotorError>
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/2filling the length, centered atL/2; - the dry mass (loaded minus propellant) is a thin tube of radius
D/2and lengthL, centered atL/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.
Sourcepub fn with_added_dry_mass(
self,
hardware: MassElement,
) -> Result<Self, MotorError>
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.
Sourcepub fn curve(&self) -> &ThrustCurve
pub fn curve(&self) -> &ThrustCurve
The thrust curve.
Sourcepub fn propellant(&self) -> &Propellant
pub fn propellant(&self) -> &Propellant
The propellant model.
Sourcepub fn dry(&self) -> MassElement
pub fn dry(&self) -> MassElement
The dry mass, about its own center of mass.
Sourcepub fn propellant_initial_mass_kg(&self) -> f64
pub fn propellant_initial_mass_kg(&self) -> f64
The propellant mass at ignition m_p0, kg.
Sourcepub fn exhaust_velocity_m_s(&self) -> f64
pub fn exhaust_velocity_m_s(&self) -> f64
The effective exhaust velocity c = I_total / m_p0, m/s.
Sourcepub fn burnout_time_s(&self) -> f64
pub fn burnout_time_s(&self) -> f64
The time the thrust curve ends and the propellant is gone, s.
Sourcepub fn propellant_mass_kg(&self, t: f64) -> f64
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.
Sourcepub fn state(&self, t: f64) -> MotorState
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.
Sourcepub fn thrust_at_pressure_n(&self, t: f64, ambient_pa: f64) -> f64
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
impl Clone for SolidMotor
Source§fn clone(&self) -> SolidMotor
fn clone(&self) -> SolidMotor
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 SolidMotor
impl Debug for SolidMotor
Source§impl<'de> Deserialize<'de> for SolidMotor
impl<'de> Deserialize<'de> for SolidMotor
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 SolidMotor
impl JsonSchema for SolidMotor
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 SolidMotor
impl PartialEq for SolidMotor
Source§fn eq(&self, other: &SolidMotor) -> bool
fn eq(&self, other: &SolidMotor) -> bool
self and other values to be equal, and is used by ==.