Skip to content

About

3-DOF missile intercept simulator in Python: True Proportional Navigation vs. a randomly evading target, with CLI parameter sweeps and Monte Carlo kill-probability statistics.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

3D Missile Intercept Simulator

License: MIT Python Dependencies Platform

A 3-DOF missile intercept simulator written in Python. It evaluates True Proportional Navigation (TPN) guidance against a randomly evading airborne target, and supports Monte Carlo parameter sweeps to estimate kill probability across many randomized engagements.

Project Overview

The simulator models a ground-launched interceptor against a manoeuvring target. Rather than flying a pre-programmed path, the target changes heading and climb rate at random times, so each run produces a different engagement geometry. A single run returns a trajectory and telemetry; a multi-run batch returns aggregate statistics.

A Note on Methodology and AI-Assisted Development

The flight mechanics, the TPN vector formulation and the numerical integration were derived and coded by hand. An in-IDE AI assistant was used to generate boilerplate for the visualization layer — Matplotlib 3D axes setup and time-series panel layout — so that the engineering effort stayed on the physics and the guidance law.

Model Description

Target

The target is a kinematic model, not a force-integrated one. Speed magnitude is held constant; the state that evolves is the heading angle and the vertical speed. At each step the velocity vector is rebuilt from those two quantities:

$$ \mathbf{V} = \left[, V_h \cos\psi,; V_h \sin\psi,; v_z ,\right], \qquad V_h = \sqrt{\max\left(V^2 - v_z^2,; (0.4,V)^2\right)} $$

The floor on $V_h$ prevents the horizontal component from collapsing during a steep climb, which would otherwise stall the target in place.

Manoeuvres are triggered by a Poisson process: the wait between manoeuvres is drawn from an exponential distribution with mean maneuver_period_s (default 20 s), so evasions occur at unpredictable moments rather than on a fixed schedule. Each trigger draws a new heading offset (uniform in $\pm90°$) and a new target climb rate (uniform in $\pm25$ m/s).

The commanded heading is not reached instantly. The turn rate is capped by the tighter of two limits:

$$ \omega_{max} = \min\left( \omega_{lim},; \frac{(n_{z,max} - 1),g}{V_h} \right) $$

The second term is the coordinated-turn constraint: a heavier turn demands more lift, and the airframe cannot exceed its structural load factor $n_{z,max}$. The first term, heading_rate_max_rads (default 0.08 rad/s ≈ 4.6°/s), is an independent kinematic cap standing in for the roll-in time and control authority that a point-mass model does not resolve.

Which limit actually binds depends on the parameters. At the defaults ($V = 250$ m/s, $n_{z,max} = 5$), the load-factor term evaluates to 0.157 rad/s, so the 0.08 rad/s kinematic cap is the active constraint and the target never reaches its structural limit — the telemetry plateaus at $n_z \approx 3.0$, exactly $1 + V\omega_{lim}/g$. The structural limit becomes the binding one only at higher speeds or lower $n_{z,max}$: raise --target-speed past ~490 m/s, or drop --nz-max below ~3.0, and the behaviour switches. This is worth knowing before reading the load-factor panel as evidence of structural saturation.

Vertical speed slews toward its commanded value at 10 m/s², and altitude is clamped to [altitude_min_m, altitude_max_m]; hitting a bound zeroes $v_z$ and reverses the command at half magnitude.

The reported $n_z$ is derived from the horizontal turn rate only ($n_z = 1 + V_h,\omega/g$); the vertical manoeuvre does not contribute to it.

Missile

The missile is a 3-DOF point mass. Three accelerations are summed and integrated directly:

$$ \mathbf{a}_{tot} = \mathbf{a}_{thrust} + \mathbf{a}_{cmd} + \mathbf{g} $$

Guidance — True Proportional Navigation. TPN steers on the rotation rate of the Line-Of-Sight vector rather than pointing at the target's current position. With $\mathbf{r}$ the LOS vector and $\mathbf{v}_{rel}$ the relative velocity:

$$ V_c = -\hat{\mathbf{r}} \cdot \mathbf{v}_{rel}, \qquad \boldsymbol{\omega}_{LOS} = \frac{\mathbf{r} \times \mathbf{v}_{rel}}{|\mathbf{r}|^2}, \qquad \mathbf{a}_{cmd} = N' , V_c , (\boldsymbol{\omega}_{LOS} \times \hat{\mathbf{r}}) $$

The logic is that on a pure collision course the LOS direction stays fixed and $\boldsymbol{\omega}_{LOS}$ is zero, so any residual LOS rotation is exactly the error to null. $N'$ (default 4.0) sets how hard that error is corrected: too low and the missile trails the target instead of leading it; too high and it overreacts to noise and geometry transients, bleeding energy into unnecessary lateral acceleration.

Gravity compensation. A constant $[0, 0, +g]$ term is added to the guidance command in all phases, cancelling weight so that the missile does not sag under gravity. Without it, the sag would itself rotate the LOS and the guidance law would spend steering authority correcting a self-inflicted error.

Acceleration limit. The guidance command and the gravity compensation are summed before saturation, and the combined vector is clipped to accel_max_lat_mps2 (default 300 m/s² ≈ 30 g). Consequence worth stating explicitly: gravity compensation draws from the same budget as guidance, so when the missile saturates during a hard manoeuvre it also stops fully compensating its own weight.

Propulsion. Boost applies constant thrust along the velocity vector for burn_time_s (default 5 s); afterwards the missile coasts. Mass is constant — propellant expenditure is not modelled — and speed is clipped to speed_max_mps. The missile is launched at $t = 0$ toward the target's position at that instant, with an initial speed of 80 m/s.

Integration and Termination

Fixed-step Euler integration at $dt = 0.05$ s (20 Hz). A run ends on any of:

  • distance below kill_radius_m (default 30 m) → intercept
  • missile altitude below zero → ground impact, miss
  • simulation time past t_max (default 120 s) → timeout, miss

Because the intercept test is evaluated once per step, the reported miss distance is discretisation-limited: at closing speeds around 1 km/s the missile covers roughly 55 m per step, so a 30 m kill radius can be flown through between samples. Reduce --dt for finer resolution near the endgame.

Results and Visualization

A single run produces a 3D trajectory plot plus telemetry panels: altitude, speed, missile–target distance (log scale, with the kill radius marked) and target load factor.

Visual Output
3D visualization of the missile trajectory and target evasion manoeuvres.

Terminal Output
Terminal output logging the engagement telemetry.

Limitations and Next Steps

Stated plainly, since they bound what the results mean:

  • No aerodynamic drag. The coast phase does not decelerate, so the missile retains full speed indefinitely and kinematic range is optimistic. Mach-dependent $C_d$ is the first correction needed for realistic range figures.
  • Constant missile mass. Propellant burn is not accounted for, so thrust-to-weight is understated during boost.
  • Point-mass only. No angle of attack, no roll dynamics, no control-surface lag. A 6-DOF rigid-body model would capture the delay between command and achieved acceleration, which is where basic PN typically loses performance.
  • Perfect state information. The guidance law reads exact target position and velocity — no seeker noise, no glint, no measurement lag, no filtering.
  • First-order integration. Euler at 20 Hz is adequate for trajectory shape but accumulates error; RK4 would tighten the endgame.
  • Basic TPN. Augmented Proportional Navigation, which adds an estimated target-acceleration term (typically from a Kalman filter), handles agile targets substantially better.

Installation and Execution

Prerequisites

  • NumPy — vector operations and numerical routines
  • Matplotlib — 3D plots and telemetry panels
pip install numpy matplotlib

Single Run

python 3D_Missile_Intercept_Simulator.py
python 3D_Missile_Intercept_Simulator.py --seed 42          # reproducible
python 3D_Missile_Intercept_Simulator.py --nz-max 7 --target-speed 300
python 3D_Missile_Intercept_Simulator.py --help             # full option list

Monte Carlo Batch

--runs N executes N engagements with incremental seeds, suppresses plotting, and reports kill probability, mean intercept time and mean miss distance:

python 3D_Missile_Intercept_Simulator.py --runs 100 --seed 0
python 3D_Missile_Intercept_Simulator.py --runs 100 --nav-constant 3.0

Sweeping --nav-constant, --nz-max or --maneuver-period across batches is the intended way to study guidance performance; a single run is a demonstration, not a result.

Key Parameters

Flag Default Meaning
--target-speed 250 m/s Target cruise speed (constant magnitude)
--nz-max 5.0 Target structural load factor
--maneuver-period 20 s Mean interval of the Poisson evasion process
--spawn-range 40 km Max target spawn radius
--nav-constant 4.0 TPN navigation ratio$N'$
--accel-max 300 m/s² Missile lateral acceleration limit
--burn-time 5 s Boost duration
--missile-speed 900 m/s Missile speed cap
--dt 0.05 s Integration step
--kill-radius 30 m Intercept threshold
--runs 1 Number of Monte Carlo runs

License

MIT.

About

3-DOF missile intercept simulator in Python: True Proportional Navigation vs. a randomly evading target, with CLI parameter sweeps and Monte Carlo kill-probability statistics.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Used by

Contributors

Languages