Starting with release R2014a, Simulink Control Design provides capabilities for tuning PID controllers for plants that cannot be linearized.
You can identify a linear plant model using simulation input-output data and use this linear model for control design.
This example is a model of a buck converter. The model uses a switching power supply to convert a 30 V DC supply into a regulated DC
supply. The converter is modeled using MOSFETs. Therefore, the converter response from reference voltage to measured voltage
includes the MOSFET switches. Voltage regulation is done by a PID Controller which is modeled with a PID Controller block
inside of this Feedback Controller subsystem. As you can see the PID Controller is initialized with default gains. Let’s run the simulation. We
see an initial transient to get to a reference value of 15 Volts. At 2.5 milliseconds there is a disturbance – current load is applied. At 4
milliseconds the voltage reference changes from 15 to 25 Volts. Finally, at 5 milliseconds, the current load is removed. As the simulation
results show, this PID Controller design produces some overshoot, has slow settling time, and creates strong oscillations of the
control signal. We would like to tune a PID Controller to improve the performance. When we launch a PID Tuner, it tries to linearize the
model. Because we have MOSFETS in the linearization path, and MOSFETS are discontinuities, the exact linearization of the
model fails. We will use simulation input-output data to create a linear plant model. To do that, we will
select the option to identify a new plant, and we will simulate the model to obtain input/output data for system identification. This requires
System Identification Toolbox. The tool that opens up simulates the plant seen by the controller. The PID Controller is temporarily
removed from the model. An input signal is injected where the output of the PID Controller used to be. The resulting signal at the point
where the PID input used to be is logged. This input-output data describes the response of the plant seen by the controller. The PID Tuner uses
this response data to estimate a linear plant model. We next need to configure the data generation
signal to use a step input signal. We specify the sample time, the controller sample time. We also specify the offset. This is the controller
output value that puts the converter in a state where the output voltage is near 15 Volts and gives the operating point around which to tune
the controller. We also need to specify the onset time. This is when the step will happen. We set this time so that converter has enough time to
reach the 15 Volts steady state before the step change is applied. We specify the step amplitude to be 0.4. This will make the actual
plant input increase from the value of 0.5 to the value of 0.9 at onset time of 0.003 seconds. We can now run the simulation and collect the I/O
data. In this plot, we see three curves. The red one is the offset response. This is the result when we
introduce a constant offset of 0.5 to the model. As we can see, the model undergoes the initial transient to convert to a steady state. We then
see when the current load is applied, when the reverence voltage changes, and when the current load is removed. Remember, this signal
is control error signal, the difference between the reference voltage and the measured voltage.
The blue curve is the control error signal when the step change in the plant input is applied. The green curve is the difference between the
blue curve (when the step is applied) and the red curve (the baseline). The data shown in the green curve is what we will use for system
identification. We start with selecting a model structure. By default, a model with one pole is selected. We
can interactively tune model parameters, pole location, and system gain to make the model output match the data. We can try different
model structures, for example, a model with a pair of complex conjugate poles. We can tune model parameters interactively, or tune them
automatically. Once we have a good fit between the model and the simulation data, we can save the obtained linear model for PID Tuning.
Our controller output is the duty cycle for the PWM, and must be between 0 and 1. So, let’s add another plot to look at the controller effort,
and look at the reference tracking and controller effort plots side by side. We can fine tune the design by using the sliders, and once we have
an acceptable design, we can use it to update PID Controller block parameters. The last step is to verify the performance in
nonlinear simulation. As we can see we reduced the overshoot, improved the settling time, and made the response more stable, so that the
control signal does not have the oscillations we saw before. This concludes the video.