Skip to content

PropellantPool

Defined in: propellant.rs:31

pub struct PropellantPool

The floor under a spacecraft’s mass, and what is left above it.

The mass itself is the integrated state (SpacecraftState::mass(crate::SpacecraftState::mass)); this is the constant it is measured against.

fn new(dry_mass: f64) -> Self

A pool whose spacecraft masses dry_mass [kg] with nothing left to burn.

Panics unless the floor is positive and finite. Zero would put the floor on the singularity of F/m, where the boundary the propagation stops at is the one place the right-hand side cannot be evaluated.

A positive floor does not by itself keep a trial step finite: the search re-steps an interval under the mode that held before the crossing, so it steps past the floor on purpose, and a wide enough step takes a stage below zero mass (measured: a floor of 1 kg, an initial mass of 1.1 and a flow of 2.2 kg/s put RK4’s midpoint at exactly zero with dt = 1). What covers that is the system: at a state whose mass is not positive it drops the acceleration every model and effector reported, since that is the half F/m makes an infinity of. The mass rate is kept — it is not singular in the mass, and it is what the search reads the crossing from.


fn dry_mass(&self) -> f64

The mass with no propellant left [kg].


fn remaining(&self, mass: f64) -> f64

Propellant left at mass [kg], and never negative.

A boundary search steps past the floor on purpose, so a state below it reaches this; what is left there is nothing.


fn is_empty(&self, mass: f64) -> bool

Whether a spacecraft of this mass has anything left to burn.

Exactly on the floor counts as empty: the propellant is what is above it.


fn initial_mode(&self, mass: f64) -> ConstraintMode

The mode a spacecraft of this mass starts in.

Three cases, and the middle one is why this is not a comparison the propagation repeats: below the floor is an input error, on the floor is a vehicle that starts empty — which no search can find, since a margin of exactly zero has not been crossed — and above it is a vehicle with propellant.

Panics below the floor: a spacecraft cannot have less than no propellant, and settling it up to the floor would hide the input error by adding mass. Panics on a mass that is not a finite number too — a NaN is below nothing and an infinity is above everything, and neither names a spacecraft.