Tuning Simulink Blocks in the Compensator Editor

This example shows how to use Compensator Editor dialog box to tune Simulink blocks.

Open the Model

This example uses a model of speed control system for a sparking ignition engine. The initial compensator has been designed in a fashion similar to the example entitled "Single Loop Feedback/Prefilter Design". Take a few moments to explore the model.

Open the engine speed control model.



This example uses the Compensator Editor to tune Simulink blocks. When tuning a block in Simulink using the Control System Designer, you can use one of compensator parameter representations. These representations are the block parameters and the pole/zero/gain representations. For example, in the speed control example there is a PID controller with filtered derivative scdspeedctrl/PID Controller:

This block implements the traditional PID with filtered derivative as:

$$G(s) = P + {I \over s} + {D s \over Ns+1}$$

In this block P, I, D, and N are the parameters that are available for tuning. Another approach is to reformulate the block transfer function to use zero-pole-gain format:

$$G(s) = {Ps(Ns+1) + I(Ns+1) + D s^s \over s(Ns+1)} = {K(s^2+2 \zeta \omega_n+w_n^2) \over s(s + z)}$$

This formulation of poles, zeros, and gains allows for direct graphical tuning on design plots such as Bode, root locus, and Nichols plots. Additionally, the 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 pre-configured 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 area, 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 P, I, D, and N parameters.

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.

Complete Design

The design requirements in the example "Single Loop Feedback/Prefilter Design" can be met with the following controller parameters:

  • scdspeedctrl/PID Controller

         P = 0.0012191
         I = 0.0030038
  • scdspeedctrl/Reference Filter:

         Numerator = 10;
         Denominator = [1 10];

In the Compensator Editor dialog box, specify these parameters. The responses of the closed-loop system are shown below:

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.

Was this topic helpful?