A Python script that simulates the 3D flight path of a powered rocket, factoring in variable gravity, variable mass, a dynamic atmosphere, aerodynamic drag, wind, and thrust.
- Models forces like gravity, drag, and wind.
- Uses a time-step simulation to calculate the flight path.
- Considers when the engine is on and calculates thrust
- Simulates variable mass as fuel is consumed
- Calculates gravity at each time step
- Finds the drag coefficient based on mach number at each time step
- Finds air density, temperature, and pressure at each altitude
- Generates a detailed plot of the trajectory using Matplotlib.
- Clone this repository.
- Create and activate a virtual environment.
- Install the required packages:
pip install -r requirements.txt - Run the simulation:
python3 main.py
This project includes a rigorous physics validation suite to ensure simulation accuracy.
Tests individual physics formulas (ISA model, gravity, drag, thrust vectors) against known physical laws:
python3 physics_tests.pyRuns the simulator through various configurations (vertical launch, optimal range, wind effects) to verify trajectory behavior:
python3 simulation_tests.py