ensim.core.monte_carlo#
Dispersion studies over the six-degree-of-freedom flight. The statistics are explained under uncertainty.
Monte Carlo dispersion of 6-DOF flights.
Each run perturbs thrust, Isp, burn time, drag, launch elevation, fin
misalignment and wind, flies the vehicle with :func:simulate_flight_6dof
and records the impact point and performance. Runs are independent, so they
are spread over worker processes.
Landing statistics use only runs that reached the ground before
max_time; runs still airborne are counted separately.
DispersionConfig
dataclass
#
Uncertainty model for a dispersion study.
Multiplicative factors (thrust, Isp, burn time, Cd) are lognormal with mean one and the given coefficient of variation. Launch elevation is normal, fin misalignment uniform, wind speed a normal truncated at zero.
DispersionResult
dataclass
#
Statistics of a dispersion study.
SimulationResult
dataclass
#
Outcome of one dispersed flight.
run_monte_carlo #
run_monte_carlo(rocket: Rocket, thrust_vac: float, isp_vac: float, burn_time: float, config: DispersionConfig | None = None, launch_angle_deg: float = 85.0, launch_azimuth_deg: float = 0.0, exit_area: float = 0.0, dt: float = 0.02, max_time: float = 300.0, use_adaptive: bool = False, rail_length: float = 3.0, chute_diameter: float = 0.0, deploy_at_apogee: bool = True, progress: ProgressCallback | None = None, cancel: CancelCallback | None = None, flight_options: dict[str, Any] | None = None) -> DispersionResult
Run a dispersion study.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rocket
|
Rocket
|
Nominal vehicle. Each run receives its own copy. |
required |
thrust_vac
|
float
|
Nominal vacuum thrust, N. |
required |
isp_vac
|
float
|
Nominal vacuum specific impulse, s. |
required |
burn_time
|
float
|
Nominal burn time, s. |
required |
config
|
DispersionConfig | None
|
Uncertainty model; defaults to :class: |
None
|
launch_angle_deg
|
float
|
Nominal rail elevation above the horizon, deg. |
85.0
|
launch_azimuth_deg
|
float
|
Rail heading clockwise from north, deg. |
0.0
|
exit_area
|
float
|
Nozzle exit area, m², for the ambient-pressure thrust loss. |
0.0
|
dt
|
float
|
Integration step, s. |
0.02
|
max_time
|
float
|
Time limit of each flight, s. |
300.0
|
use_adaptive
|
bool
|
Use the adaptive integrator. |
False
|
rail_length
|
float
|
Launch rail length, m. |
3.0
|
chute_diameter
|
float
|
Main parachute diameter, m (0 = none). |
0.0
|
deploy_at_apogee
|
bool
|
Open the main at apogee rather than at a set height. |
True
|
progress
|
ProgressCallback | None
|
Called with (completed, total) after each run. |
None
|
cancel
|
CancelCallback | None
|
Polled between runs; return True to stop. |
None
|
flight_options
|
dict[str, Any] | None
|
Further keyword arguments for every flight (drogue, fill time, WGS-84 site, ...). They override the explicit ones. |
None
|
Raises:
| Type | Description |
|---|---|
SimulationCancelled
|
|
RuntimeError
|
Fewer than two runs succeeded. |
compute_cep #
Radius around center that contains half of points.
compute_confidence_ellipse #
compute_confidence_ellipse(points: ndarray, confidence: float = 0.997) -> tuple[float, float, float]
Covariance ellipse enclosing confidence of a bivariate normal fit.
Returns (semi-major, semi-minor, angle of the major axis from x in degrees).