Tune Simulink Blocks Using Compensator Editor
This example shows how to tune Simulink® blocks using the Compensator Editor dialog box in Control System Designer.
Open the Model
This example uses a model of a speed control system for a sparking ignition engine. The initial compensator has been designed in a fashion similar to the method shown in Single Loop Feedback/Prefilter Compensator Design.
Open and explore the engine speed control model.
This example uses the Compensator Editor to tune Simulink blocks. When tuning a block in Simulink using Control System Designer, you can tune the block parameters directly or you can tune a zero-pole-gain representation of the block. For example, in the speed control example there is a PID controller with filtered derivative
This block implements the traditional PID with filtered derivative as:
In this block
N are the parameters that are available for tuning. Another approach is to reformulate the block transfer function to use zero-pole-gain format:
This formulation of poles, zeros, and gains allows for direct graphical tuning on design plots such as Bode, root locus, and Nichols plots. Additionally, Control System Designer allows for both representations to be tuned using the compensator editor. The tuning of both representations is available for all supported blocks in Simulink Control Design™. For more information, see What Blocks Are Tunable?.
Open Control System Designer
In this example, to tune the compensators in this feedback system, open a preconfigured Control System Designer session by double clicking the subsystem in the lower left-hand corner of the model.
Compensator Editor Dialog Box
You can view the representations of the PID compensator using the Compensator Editor dialog box. To open the Compensator Editor, in the Data Browser, in the Controllers and Fixed Blocks section, double-click
scdspeedctrl_PID_Controller. In the Compensator Editor dialog box, in the Compensator section, you can view and edit any of the compensators in your system.
On the Pole/Zero tab, you can add, delete, and edit compensator poles and zeros. Since the PID with filtered derivative is fixed in structure, the number of poles and zeros is limited to having up to two zeros, one pole, and an integrator at
s = 0.
On the Parameter tab, you can independently tune the
Enter new parameters values in the Value column. To interactively tune the parameters, use the sliders. You can change the slider limits using the Min Value and Max Value columns.
When you change parameter values, any associated editor and analysis plots automatically update.
The design requirements in Single Loop Feedback/Prefilter Compensator Design can be met with the following controller parameters:
P = 0.0012191 I = 0.0030038
Numerator = 10 Denominator = [1 10]
In the Compensator Editor dialog box, specify these parameters. Then, in Control System Designer, view the closed-loop responses.
Update Simulink Model
To write the compensator parameters back to the Simulink model, click Update Blocks. You can then test your design on the nonlinear model.