Skip to main content

hpr_sim/
lib.rs

1//! The 6-DOF flight engine: state, launch rail phase, integrators, events, recovery, separation and
2//! the recorder.
3//!
4//! **Guide:** [How a flight is simulated][guide-flight], [Rigid-body flight][guide-rigid-body],
5//! [Time integration][guide-integration] and [Recovery][guide-recovery]: the models, their sources,
6//! how well they are validated and what they leave out.
7//!
8//! [guide-flight]: https://nrdptel.github.io/hpr-sim/how-a-flight-is-simulated.html
9//! [guide-rigid-body]: https://nrdptel.github.io/hpr-sim/physics/flight.html
10//! [guide-integration]: https://nrdptel.github.io/hpr-sim/physics/integration.html
11//! [guide-recovery]: https://nrdptel.github.io/hpr-sim/physics/recovery.html
12//! [roadmap]: https://github.com/nrdptel/hpr-sim/blob/main/docs/ROADMAP.md
13//! [m2-2e10]: https://nrdptel.github.io/hpr-sim/decisions-and-roadmap.html#m2-2e10
14//!
15//! - [`flight`]: a [`Simulation`] of a rocket, its [`Environment`] and its [`Rail`], flown from
16//!   ignition through the pad, rail and free-flight phases to the ground.
17//! - [`dynamics`]: the rigid-body equations of motion with varying mass and jet damping.
18//! - [`rail`]: the rail's geometry and friction, and where a design's guides leave it.
19//! - [`recovery`]: recovery devices, their triggers and inflation, the descent under them, and
20//!   separation into bodies that each fly to their own landing.
21//! - [`shifts`]: mass that moves along the airframe in flight, and what it does to the mass
22//!   properties.
23//! - [`releases`]: mass released in flight, the rest flying on and the part falling on its own.
24//! - [`recorder`]: the [`Observer`] trait, flight [`Sample`]s and the channel [`Recorder`].
25//! - [`integrator`]: adaptive Dormand–Prince 5(4) with dense output, and fixed-step RK4, advancing
26//!   to stop times and events.
27//! - [`events`]: event directions and Brent's root finder.
28//! - [`metrics`]: what a flight comes to: its peaks, apogee, stability margins, optimum ejection
29//!   delays and landings.
30//! - [`envelope`]: the operating envelope's four flags: past the validated range, at high angle of
31//!   attack, outside the core band and beyond the envelope.
32//! - [`flutter`]: a fin's flutter speed and margin by NACA TN 4197's criterion.
33//! - [`export`]: a recording as CSV or JSON, and the flight path and landings as GeoJSON or KML.
34//!
35//! Status: the flight from the pad to the ground under parachutes, streamers or tumbling, a
36//! separation whose bodies each land, and staging: each motor lights at its own time, and a
37//! separation with the nose's body still to burn lets that body fly on as a sustainer while the
38//! booster descends ([`flight`]). A cluster flies one motor in each of its tubes, a tube or a
39//! motor can be set never to light, and a `.ork` file's staging settings and clusters fly too
40//! (milestone [M1.9][roadmap] of the roadmap, and [M2.2e10][m2-2e10] for a motor that never
41//! lights).
42
43pub mod dynamics;
44pub mod envelope;
45pub mod environment;
46pub mod error;
47pub mod events;
48pub mod export;
49pub mod flight;
50pub mod flutter;
51pub mod integrator;
52pub mod issues;
53pub mod metrics;
54pub mod pieces;
55pub mod rail;
56pub mod recorder;
57pub mod recovery;
58pub mod releases;
59pub mod shifts;
60mod staging;
61pub mod state;
62
63pub use dynamics::Phase;
64pub use envelope::EnvelopeFlag;
65pub use environment::Environment;
66pub use error::SimError;
67pub use events::{Direction, EVENT_TIME_RESOLUTION_S, RootError, find_root};
68pub use export::TrackPoint;
69pub use flight::{
70    EventKind, FlightEvent, FlightResult, FlightSettings, Simulation, Termination, UserEvent,
71};
72pub use flutter::{FlutterMargin, FlutterPanel};
73pub use integrator::{
74    Adaptive, Advance, DEFAULT_STEP_LIMIT, IntegrationError, Integrator, Method, OdeSystem,
75    SettingsError, Stats, Step,
76};
77pub use issues::{IssueWarning, KnownIssue};
78pub use metrics::{FlightMetrics, FlightSummary};
79pub use pieces::{Ejection, Parting};
80pub use rail::{Guides, Rail};
81pub use recorder::{Channel, FlightStep, Observer, Recorder, Sample};
82pub use recovery::{
83    BodyEvent, BodyFlight, BodySample, CanopyType, Device, DeviceDrag, Inflation, Separation,
84    StreamerModel, Trigger, terminal_speed_m_s,
85};
86pub use releases::{MassRelease, ReleasedFlight};
87pub use shifts::{MIN_SHIFT_DURATION_S, MassShift};
88pub use state::{STATE_LEN, State};
89
90#[cfg(test)]
91mod testing;
92
93#[cfg(test)]
94mod tests;