Simulation¶
Main entry point for running internal ballistics simulations. InternalBallisticsSimulation takes a motor model and simulation parameters (time step, igniter pressure, external pressure), then marches through time using an RK4 solver to produce a complete motor state with time-series data for thrust, chamber pressure, propellant mass, efficiency losses, and more.
The returned MotorState object (see states) contains all computed arrays for post-processing or adapter export.
machwave.simulation
¶
InternalBallisticsSimulation
¶
Internal ballistics simulation class.
Attributes:
| Name | Type | Description |
|---|---|---|
motor |
Motor
|
Motor object. |
params |
InternalBallisticsSimulationParams
|
Simulation parameters. |
t |
ndarray
|
Array of time values. |
motor_state |
MotorState | None
|
Motor state object. |
Source code in machwave/simulation.py
get_motor_state()
¶
Returns the motor state object based on the type of the motor.
Source code in machwave/simulation.py
print_results()
¶
Prints the results of the simulation.
Source code in machwave/simulation.py
run()
¶
Runs the main loop of the simulation, returning the time array and the motor state object.
Source code in machwave/simulation.py
InternalBallisticsSimulationParams
dataclass
¶
Parameters for an internal ballistics simulation.
Attributes:
| Name | Type | Description |
|---|---|---|
d_t |
float
|
Time step. |
igniter_pressure |
float
|
Igniter pressure. |
external_pressure |
float
|
External pressure. |
other_losses |
float
|
Additional losses not covered by specific loss mechanisms, as a fraction in [0, 1] (e.g. 0.12 for 12%). |