UAT 314 Automation, Robotics and Intelligent Control Systems
Worksheet 3 Simulating an altitude controller
Objective
Simulate and compare P, PI and PID controllers on a first-order system and understand integrator windup and anti-windup
Equipment and materials
- Computer with Python and matplotlib
- PX4 SITL tuning log (if available)
Safety
- Desk and simulation work only; no flying
Steps
- Write a Python simulation of a discrete first-order system with P, PI and PID
- Compare rise time, overshoot and steady-state error
- Add actuator limits and observe integrator windup
- Add anti-windup and compare
- Read a PX4 SITL tuning log (if available) and identify which loop is tuned first
Record of results
| Controller | Kp, Ki, Kd | Rise time 10-90% (s) | Overshoot (%) | Steady-state error |
|---|---|---|---|---|
| Case | Limit on u | Peak of y | Overshoot (%) | Time into 2% band (s) |
|---|---|---|---|---|
Questions
Does the steady-state error of P control in your simulation match 1/(1 + KpK)? If not, why might that be?
From Table 1, what does the I term fix, and what does your group trade for it in rise time or overshoot?
From the plots for Table 2, what is the integral doing while u is at its limit, and why does that make y overshoot the setpoint?
If a real test rig gives Ku = 2.0 and Tu = 0.5 s, what are Kp, Ki and Kd by Ziegler-Nichols, and why must you never find Ku by making a real drone oscillate?
Why must the angular-rate loop be tuned before the attitude and position loops? Use what you see in the log or the lesson's Figure 2.
Check before you hand in
What to hand in
- Simulation code
- Plots and comparison table for three controllers
- Plots before and after anti-windup
- Conclusion on cascaded tuning order