Main Content

Tune Simulink Blocks Using Compensator Editor

This example shows how to tune Simulink® blocks using the Compensator Editor dialog box inControl 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 inSingle Loop Feedback/Prefilter Compensator Design.

Open and explore the engine speed control model.

open_system('scdspeedctrl')

Introduction

This example uses theCompensator Editorto tune Simulink blocks. When tuning a block in Simulink usingControl System Designer,您可以调整块参数直接或哟u 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镜头分割speedctrl/PID Controller:

This block implements the traditional PID with filtered derivative as:

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

在这个街区P,I,D, andNare 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,Control System Designerallows 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, seeWhat Blocks Are Tunable?.

Open Control System Designer

In this example, to tune the compensators in this feedback system, open a preconfiguredControl System Designersession 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 theData Browser, in theControllers and Fixed Blockssection, double-click镜头分割speedctrl_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 thePole/Zerotab, 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 ats = 0.

On theParametertab, you can independently tune theP,I,D, andNparameters.

Enter new parameters values in theValuecolumn. To interactively tune the parameters, use the sliders. You can change the slider limits using theMin ValueandMax Valuecolumns.

When you change parameter values, any associated editor and analysis plots automatically update.

Complete Design

The design requirements inSingle Loop Feedback/Prefilter Compensator Designcan be met with the following controller parameters:

  • 镜头分割speedctrl/PID Controller:

P = 0.0012191 I = 0.0030038
  • 镜头分割speedctrl/Reference Filter:

Numerator = 10 Denominator = [1 10]

In the Compensator Editor dialog box, specify these parameters. Then, inControl System Designer, view the closed-loop responses.

Update Simulink Model

To write the compensator parameters back to the Simulink model, clickUpdate Blocks. You can then test your design on the nonlinear model.

bdclose('scdspeedctrl')

See Also

Related Topics