pub struct Rocket {
pub name: String,
pub stages: Vec<Stage>,
pub reference_diameter: ReferenceDiameter,
pub configurations: Vec<Configuration>,
}Expand description
A rocket design: its stages, how its reference diameter is chosen, and its motor configurations.
Fields§
§name: StringName.
stages: Vec<Stage>Stages from the nose aft. The first holds the nose cone. A parallel stage comes after the
stage it hangs on (Stage::parallel).
reference_diameter: ReferenceDiameterHow the reference diameter is chosen.
configurations: Vec<Configuration>Motor configurations.
Implementations§
Source§impl Rocket
impl Rocket
Sourcepub fn configuration(&self, id: &str) -> Option<&Configuration>
pub fn configuration(&self, id: &str) -> Option<&Configuration>
The configuration with id id.
Sourcepub fn check_configuration_ids(&self) -> Result<(), DesignError>
pub fn check_configuration_ids(&self) -> Result<(), DesignError>
Checks that configuration ids are unique and non-empty.
§Errors
DesignError::DuplicateId for the first empty or repeated id.
Sourcepub fn assemble(&self, configuration_id: &str) -> Result<Assembly, DesignError>
pub fn assemble(&self, configuration_id: &str) -> Result<Assembly, DesignError>
Resolves the tree and places the motors of configuration configuration_id.
§Errors
- As
Rocket::layoutandLayout::place_motors. DesignError::DuplicateIdfor an empty or repeated configuration id.DesignError::UnknownIdfor a configuration that doesn’t exist.
Sourcepub fn lay_out(&self) -> Result<LaidOut, DesignError>
pub fn lay_out(&self) -> Result<LaidOut, DesignError>
Lays the design out once (Rocket::layout), to check it (LaidOut::check) and
assemble it (LaidOut::into_assembly) without laying it out again: the layout is most
of the cost of either, and a Monte Carlo run builds a flight thousands of times.
§Errors
Source§impl Rocket
impl Rocket
Sourcepub fn layout(&self) -> Result<Layout, DesignError>
pub fn layout(&self) -> Result<Layout, DesignError>
Resolves the tree: checks its structure, fills in automatic dimensions, places every part, and computes the mass properties with overrides.
§Errors
DesignError::DuplicateIdfor an empty or repeated stage or component id.DesignError::Treefor a rocket with no stages, an empty stage, a part in the wrong place (an attached part in a stage’s list, a body component attached anywhere but in a pod set, anything else in a pod set, fins or pods on anything but a body tube, a pod set in a pod, children under anything but a body component, inner tube or pod set), a pod set with an override that doesn’t cover its pods, a missing or unexpected position, an automatic dimension that doesn’t apply or can’t be resolved, or a motor mount on anything but a body tube or inner tube.DesignError::Domainfor a pod set of no pods or more thanPodSet::MAX_COUNT, a radial offset or angle out of range, or a body component of no length in a stage.- Any part’s geometry, material or numerical error, a custom finish’s negative or non-finite roughness, and override errors.
Sourcepub fn unresolvable_body_radii(&self) -> Vec<UnresolvableRadius>
pub fn unresolvable_body_radii(&self) -> Vec<UnresolvableRadius>
The automatic body radii that layout cannot resolve, forward to aft.
These are the radii on a chain of automatic radii with no fixed radius anywhere along it:
a nose cone whose base looks back at a tube that looks forward at it, or a stage of tubes
that all say “automatic”. Neighbours are followed by the rule each AutoDimension
documents. layout refuses a design for which this list is not empty; what such a radius
should be is not in the design, so an importer that knows its source program’s convention
fills them in first (fill_unresolvable_body_radii).
A parallel stage’s body components are not listed: they take their radii from one another,
as a pod’s do, and layout refuses one it can’t resolve.
Only the body components’ own radii are listed. An automatic shoulder with no body tube
beside it, or an automatic dimension a part does not have, is refused by layout with its
own error instead.
Sourcepub fn fill_unresolvable_body_radii(
&mut self,
radius_m: f64,
) -> Vec<UnresolvableRadius>
pub fn fill_unresolvable_body_radii( &mut self, radius_m: f64, ) -> Vec<UnresolvableRadius>
Gives every radius unresolvable_body_radii lists the
fixed radius radius_m, drops its automatic mark, and returns what it filled.
Every radius on such a chain is listed, so the whole chain takes the one radius. Radii the neighbour rule could already reach are left as they are and resolve as before. The design no longer records that the filled radii were automatic, which is the point: it now says what they are.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Rocket
impl<'de> Deserialize<'de> for Rocket
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 Rocket
impl JsonSchema for Rocket
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 more