Update the inner loop PI controller with the new gains.
Kpv = VoltageLoopGains(1);
Kiv = VoltageLoopGains(2);
Tuning Outer Loop PI Controller
Next, tune the outer speed loop. In the Autotuning Voltage subsystem, change the value
of the constant block Tune Inner Voltage Loop to 0, to disable the inner voltage loop
tuning. Note that the inner loop controller already uses the newly tuned gains.
set_param([mdl '/Control/Tune Inner Voltage Loop'],'Value','0');
Similarly, in the Autotuning Speed subsystem, change the constant Tune Outer Speed
Loop in the subsystem Autotuning Speed to 1 to enable the outer speed loop tuning. For
this loop, use a closed-loop autotuning duration of 0.9 seconds, beginning at 1 second.
The nominal speed for tuning is 2000 RPM.
set_param([mdl '/Control/Tune Outer Speed Loop'],'Value','1');
Run the simulation again. When the experiment concludes, the Closed-Loop PID
Autotuner block returns the tuned PID controller gains for the outer speed loop. The
model sends them to the MATLAB workspace as the array SpeedLoopGains.
close_system([mdl '/Visualization/VDC (Inner)']);
open_system([mdl '/Visualization/RPM (Outer)']);
sim(mdl);
BLDC Motor Speed Control with Cascade PI controllers