A longitudinal aircraft dynamics simulation with thrust vectoring control, demonstrating gain-scheduled PID control and control allocation across the flight envelope.
This project implements a complete 2D (longitudinal) flight control system for an F-16 class fighter aircraft with thrust vectoring capability. It demonstrates:
- Realistic 6DOF longitudinal dynamics with nonlinear aerodynamics
- Gain-scheduled PID control adapted to angle of attack
- Control allocation between elevator and thrust vectoring nozzle
- Professional numerical integration using scipy's adaptive RK45 solver
- β Trimmed flight calculation using nonlinear optimization
- β High-fidelity aerodynamics from tabulated coefficient data (Ξ± = -10Β° to 90Β°)
- β Thrust vectoring model with Β±20Β° nozzle deflection limits
- β Adaptive control allocation that shifts authority based on flight condition
- β Robust integration with automatic error control (rtol=1e-6)
- RMS Tracking Error: 0.119 deg/s (near-perfect)
- Control Strategy: Elevator dominant (conventional control sufficient)
- Nozzle Usage: 0% (not needed)
- RMS Tracking Error: 4.945 deg/s (acceptable for extreme upset)
- Control Strategy: Thrust vectoring dominant (100% of time)
- Nozzle Usage: Up to 5.46Β° deflection
Key Insight: Thrust vectoring provides essential control authority during post-stall upset recovery where conventional surfaces are ineffective.
git clone https://github.com/Kumar-S-Bhat/thrust-vectoring
cd thrust-vectoring
pip install -r requirements.txt# Pitch rate tracking demonstration
python examples/q_tracking.py
# View results
# Plots saved as: q_tracking_comparison.pngthrust-vectoring/
βββ src/
β βββ aircraft/
β β βββ dynamics.py # 6DOF longitudinal equations
β β βββ aerodynamics.py # Aero coefficient tables
β β βββ frames.py # Coordinate transformations
β βββ propulsion/
β β βββ thrust_model.py # Engine thrust model
β β βββ nozzle.py # TVC system
β β βββ actuator.py # Nozzle actuator dynamics
β βββ control/
β β βββ pid.py # PID controller with anti-windup
β β βββ gain_scheduled.py # Gain-scheduled PID
β β βββ allocator.py # Control allocation
β β βββ pitch_controller.py # Longitudinal controller
β βββ simulation/
β βββ trim_solver.py # Trim condition solver
βββ examples/
β βββ q_tracking.py # Pitch rate tracking demo
β βββ nozzle_step.py # Actuator response test
β βββ simulate_flight.py # Open-loop flight simulation
β βββ tune_pid_nozzle.py # PID gain tuning
βββ tests/
β βββ test_actuator_response.py
β βββ test_dynamics.py
β βββ test_pid_response.py
β βββ test_thrust_model.py
β βββ test_trim.py
βββ data/
β βββ aero_tables.csv # Aerodynamic coefficient data
βββ q_tracking_comparison.png # Results visualization
βββ requirements.txt
βββ LICENSE
βββ .gitignore
βββ README.md
- Type: F-16 class fighter
- Mass: 9,300 kg
- Pitch Inertia: 55,814 kgΒ·mΒ²
- Wing Area: 27.87 mΒ²
- Thrust: 130 kN (sea level static)
- Outer Loop: Proportional alpha-to-rate controller (Kp = 3.0)
- Inner Loop: Gain-scheduled pitch rate PID
- Kp: 10,000,000 - 200,000 NΒ·m (varies with Ξ±)
- Ki: 6,000,000 - 10,000 NΒ·mΒ·s (decreases at high Ξ±)
- Kd: 300,000 - 3,500,000 NΒ·m/s (increases with Ξ±)
- Method: scipy.integrate.solve_ivp with RK45
- Tolerance: rtol=1e-6, atol=1e-9
- Advantages: Adaptive step sizing, guaranteed error bounds
| Scenario | Elevator (max) | Nozzle (max) | Dominant Control |
|---|---|---|---|
| Low Alpha (200 m/s) | 0.30Β° | 0.00Β° | Elevator |
| Post-Stall Upset (35Β°) | 0.75Β° | 5.46Β° | Thrust Vectoring |
The system achieves excellent tracking at low angle of attack where aerodynamics are well-behaved. At post-stall conditions (35Β° alpha), tracking degrades but the system successfully recovers from the upset using thrust vectoring.
This project demonstrates:
-
Aircraft Dynamics Modeling
- 6DOF equations in body frame
- Aerodynamic force/moment calculation
- Thrust vectoring kinematics
-
Control System Design
- Gain scheduling for nonlinear systems
- Control allocation for over-actuated systems
- PID tuning and anti-windup
-
Numerical Methods
- ODE integration with error control
- Trim solving via nonlinear optimization
- Professional simulation architecture
- 2D Only: Longitudinal dynamics only (no roll/yaw)
- Simplified Aerodynamics: 1D tables (no Ξ², Mach effects)
- No Actuator Lag: Instant control response (simplified)
- Linear Control Basis: PID struggles at extreme angles (>40Β°)
-
Full 6DOF Dynamics
- Add lateral-directional equations
- Implement aileron and rudder
- Model inertia coupling effects
-
Advanced Control
- Dynamic inversion for nonlinear regimes
- LQR for optimal gains
- Adaptive control for robustness
-
Enhanced Realism
- Actuator dynamics (rate limits, lag)
- Sensor noise and filtering
- Atmospheric turbulence
-
Extended Analysis
- Modal analysis (eigenvalues, damping ratios)
- Stability margins
- Flight envelope exploration
- Stevens, B. L., & Lewis, F. L. (2003). Aircraft Control and Simulation. Wiley.
- Nelson, R. C. (1998). Flight Stability and Automatic Control. McGraw-Hill.
- Etkin, B., & Reid, L. D. (1996). Dynamics of Flight: Stability and Control. Wiley.
- NASA Technical Reports on F-16 aerodynamics
- Anderson, J. D. (2017). Fundamentals of Aerodynamics. McGraw-Hill.
- Ogata, K. (2010). Modern Control Engineering. Prentice Hall.
- Γ strΓΆm, K. J., & Murray, R. M. (2021). Feedback Systems. Princeton University Press.
Kumar S Bhat
Aerospace Engineering Student
Indian Institute of Engineering Science and Technology, Shibpur
LinkedIn: https://www.linkedin.com/in/kumar-bhat-6337a7332/
GitHub: https://github.com/Kumar-S-Bhat
MIT License - See LICENSE file for details.
- Aircraft parameters based on publicly available F-16 data
- Control architecture inspired by modern fighter flight control systems
- Project developed as part of aerospace engineering coursework
This project demonstrates aerospace engineering principles including flight dynamics, control systems, and numerical simulation. It is intended for educational purposes.