Hello, in this video today, we will show how you can automatically tune the gains of a cascaded PID controller
that controls the inner voltage and outer speed loop of a BLDC motor with a trapezoidal back-EMF.
We will be working with a plant model of a 3-Phase BLDC motor with a power link
which has been modelled using non-ideal semiconductor devices with Simscape Power Systems.
The main objective in this example would be to come up with effective gains for the cascaded PI control
loops which help track the speed demand required from the motor.
In the Simulink model, we have the current setup which includes a DC voltage source of 48 Volts,
a DC-DC buck converter connected to a 3-Phase power inverter link and the 3 phase BLDC motor.
In the subsystem named ‘Control’ here, you can see the cascaded PI control loop architecture.
Here, you have an outer loop that controls the speed and an inner loop that will regulate the Buck converter output voltage.
The final controller output here is the Pulse Width Modulated signal that will be
fed to the MOSFET of the buck converter.
The parameters of this physical setup can be changed based on requirements.
The PI gains were set at initial guesses. Those values do not provide the best performance from the speed controller.
When we run the simulation we can see the speed demanded from the motor in yellow and the actual motor speed in blue.
The reference tracking controller performance is sluggish with a slow rise time,
an underdamped response and a significant overshoot.
We will need to tune the PI controller gains to get a better controller performance with a good reference tracking.
To do this we will use the Closed Loop PID Autotuner introduced in Simulink Control Design release of R2018a.
This block lets us tune the PID gains for a controller while the plant continues to be in
stable closed loop operation with the initial controller.
Firstly, we would need to modify the control loop architecture to include this closed loop PID Autotuner block.
Let us start by modifying the outer speed loop.
Here, we have placed the Closed Loop PID Auto tuner after the PI block in a subsystem called ‘Autotuning Speed’
and included a simple enabling logic to enable this block during a specific time of the simulation.
We have chosen a nominal speed of 2000 RPM to which the motor ramps up to and attains steady state operation
before we start injecting excitation signals through this block.
We will now set the tuning requirements and experiment settings for this
outer speed loop in the block dialog of the Closed Loop PID Autotuner.
Under the ‘Tuning’ tab, we set the controller form and type to be PI and Parallel as in this case.
For the tuning goals, we set a target phase margin of 60 degrees
as this generally provides both a robust and better controller performance.
We have chosen a target bandwidth of 100 rad/second
to provide us with a sufficiently fast controller response in this case.
Now, as a rule of thumb the closed loop experiment should be run for a
time of 200 divided by target bandwidth as a conservative estimate.
We will be running this experiment for 0.9 seconds as this should be sufficient.
Under the ‘Experiment’ tab of the Closed Loop PID Autotuner
we will set the plant type to be stable and the plant sign to be positive as in this case.
For the amplitude of sinusoidal perturbations, let’s choose a value of 1 so
that the plant can be suitably excited within the saturation limit.
Similarly, the Closed Loop PID Autotuner block is set up for the inner voltage loop in the subsystem called ‘Autotuning Voltage’.
The block dialog properties are the almost the same as the outer loop except for the target bandwidth
which has been set to 400 rad/sec.
We will be running the closed loop experiment from 1 second to 1.8 seconds with a nominal voltage set at 12.5 volts.
After this is setup, the control architecture looks like this.
We have included the constant blocks ‘Tune Outer Speed Loop’ and ‘Tune Inner Voltage Loop’
which will help in enabling and disabling the Closed Loop PID Autotuner blocks during the tuning runs.
We will follow the procedure of tuning the control loops sequentially,
first the inner loop and then the outer loop.
Once both the loops have been tuned, we can then use these gains
for the controllers and run the model to verify if we obtain a better controller performance.
Let’s enable the inner loop tuning by changing the value of the constant block ‘Tune Inner Voltage Loop’ from 0 to 1.
As the simulation is run, the closed loop experiment runs in the stipulated time
with the Closed Loop PID Autotuner injecting perturbations into the plant, in addition to the
controller request computed by the PI controller.
At the end of the experiment, the block computes the plant frequency response
at several frequencies near the target bandwidth
and then uses this frequency response to automatically compute the PI gains and update them.
Next, enable the tuning of the outer speed loop and disable the inner voltage tuning.
The closed loop experiment is again performed on this loop as the simulation is rerun.
After the block runs through the same process of calculating the plant frequency responses
and tuning the PI gains, we can copy the updated gains back into this PI controller.
Now that the tuning process for both the controllers are done, we can run the simulation
again after disabling the tuning process for both the loops.
Now, we can see a much faster response and good reference tracking
both in the speed loop and the dc link voltage loop.
This concludes the video.