In this example, the engine speed reference signal goes from 2000 to 3000 rpm and then
back to 2000 rpm in the first 20 seconds. The original gains of P = 0.01 and I = 0.01
causes strong oscillation in the transient and need to be re-tuned.
At 20 seconds, the plant is running at the nominal operating point of 2000 rpm and online
PID tuning starts. The experiment duration is 50 seconds, because a conservative
guideline suggests that it takes about "100/bandwidth" seconds for online frequency
response estimation to converge.
When PID tuning stops at 70 seconds, new gains P = 0.0026 and I = 0.0065 are
immediately available at the "pid gains" outport and sent to the external P and I port of
PID block, overwriting the original gains. Note that there is almost no bump in transient
when the loop is closed and PID block resumes control at that moment.
The engine speed reference signal goes from 2000 to 3000 rpm and then back to 2000
rpm again between 80 and 100 seconds. The new PI gains provides a much better closed-
loop response.
Using Open-Loop PID Autotuner Block in External Mode
To tune PI controller against a physical engine in the external mode, you need to replace
the "Engine Model" section in the Simulink model with hardware interface blocks that
provide the rpm measurement as "y" and send throttle angle to the actuator as "u".
Here is an example Simulink diagram configured to tune in the external mode, assuming
your PI controller is running on an Arduino DUE board and communicating with your
physical engine via serial ports.
8 PID Autotuning