|On this page…|
In this example, you get an overview of the steps for tuning compensator parameters. Before you begin, you need:
A model in the MATLAB workspace representing your plant
Design requirements for your system
To tune parameters:
Open the control design GUIs by typing the following in the MATLAB Command Window:
This command opens the Control and Estimation Tools Manager and the SISO Design Tool, as shown in the following figure.
Define the control architecture for your system.
In the Architecture tab of the Control and Estimation Tools Manager, click Control Architecture.
In the Control Architecture dialog box, select the control architecture.
Specify the sign of summing junctions as + or -.
Specify the plant model and initial guesses for the compensator elements in the control architecture.
In the Architecture tab of the Control and Estimation Tools Manager, click System Data.
In the System Data dialog box, browse for a model in the MATLAB® workspace.
Design a compensator using automated tuning, for example PID Tuning.
In the Automated Tuning tab of the Control and Estimation Tools Manager, select an automated tuning method.
Specify tuning options.
Click Update Compensator to tune parameters.
Evaluate the system's closed-loop performance.
Plot the system response.
In the Analysis Plots tab, select a plot type.
Select the type of response for each plot.
Display specific performance characteristic for your system. Compare values to design requirements.
Right-click to select performance characteristics.
Click on the dot that appears to view the characteristic value.
Refine compensator design using graphical tuning.
Create plots for graphical tuning.
In the Graphical Tuning tab, select the loop to tune in each plot.
Select plot types.
In a design plot, modify the compensator by adding poles, zeros, lead, and lag, for example. To do this, right-click to add dynamic elements in the controller structure.
Add a new pole, for example, by clicking the pole location on the plot.
Modify the compensator structure by moving the poles, zeros, and other dynamic elements directly on the plot.
Export the compensator to the MATLAB workspace for further analysis.
In the Control and Estimation Tools Manager, select File > Export.
In the SISO Tool Export dialog box, select the compensator.
Click Export to Workspace.
The SISO Design Tool has the following components:
SISO Design Task node in the Control and Estimation Tools Manager is a user interface (UI) that facilitates the design of compensators for single-input, single-output feedback loops through a series of interactive tabs.
The Graphical Tuning window is a graphical user interface (GUI) for displaying and manipulating the Bode, root locus, and Nichols plots for the controller currently being designed. This window is titled SISO Design for Design Name.
The LTI Viewer associated with the SISO Design Task. For instructions on how to operate the LTI Viewer, see LTI Viewer for SISO Design Task Design Requirements.
The SISO Design Tool facilitates the design of compensators for single-input, single-output feedback loops, lets you iterate on your designs and perform the following tasks:
If you have not built the DC motor model, type
at the MATLAB prompt. This loads a collection of linear models, including the DC motor. To open the SISO Design Tool and import the DC motor, type
This command opens:
The SISO Design Task node in the Control and Estimation Tools Manager
The Graphical Tuning window with the root locus and open-loop Bode diagrams for the DC motor plotted by default
SISO Design Task Node (Architecture Tab)
Graphical Tuning Window with the DC Motor Example
The SISO Design Task node in the Control and Estimation Tools Manager contains the following tabs for specifying controller design and behavior:
Change the feedback structure and label signals and blocks.
Configure loops for multi-loop design by opening signals to remove the effects of other feedback loops.
Import LTI models or row or column arrays of LTI models into your system.
Convert sample time of the system or switch between different sample times to design different compensators.
Specify nominal model and frequency grid for multimodel computations.
Directly edit compensator poles, zeros, and gains.
Add or remove compensator poles and zeros.
Configure design plots in the Graphical Tuning window.
Use design plots to graphically manipulate system response.
Configure analysis plots in the LTI Viewer.
Use analysis plots to view the response of open- or closed-loop systems.
Automatically generate compensators using optimization-based, PID, internal model control (IMC), linear-quadratic-Gaussian (LQG), or loop shaping methods.
Use optimization-based methods that automatically tune the system to satisfy design requirements (available when you have the Simulink® Design Optimization™ product).
If you type sisotool at the MATLAB prompt, the Control and Estimation Tools Manager opens with the SISO Design Task node and an empty Graphical Tuning window.
The System Data dialog box opens, as shown in the following figure.
G is a plant modeled as an LTI model or multiple plants modeled as a row or column array of LTI models. If H is also an array, their sizes must match.
H is the sensor modeled as an LTI model or multiple sensors modeled as a row or column array of LTI models. If G is also an array, their sizes must match.
C is a controller and is an LTI model.
F is a prefilter and is an LTI model.
The default values of G, H, C, and F are 1. See Feedback Structure for more information.
Note: If you import an array of LTI models for either G or H or both for control design, you can use the default multimodel options or configure the options by clicking Multimodel Configuration in the Architecture tab. For more information, see Control Design Analysis of Multiple Models.
To import the DC motor model:
You can now see sys_dc in the System Data dialog box.
The Graphical Tuning window updates with the DC motor model, as shown in the following figure.
The SISO Design Tool, by default, assumes that the compensator is in the forward path, i.e., that the feedback structure looks like this figure.
Default Feedback Structure — Compensator in the Forward Path
In this figure:
G represents the plant
H represents the sensor dynamics
F represents the prefilter
C represents the compensator
The default values for F, H, and C are all 1. You can see the default values in the System Data dialog box. This means that, by default, the compensator has unity gain.
For the DC motor, G contains the DC motor model, sys_dc.
In the Architecture page, click Control Architecture to open the Control Architecture dialog box.
You can use the Signs and Blocks and Signals panes to change the sign of the feedback signal into a summing junction and rename blocks and signals in the diagram respectively. See Block Diagram Structure Modifications for more details.
On any tab in the SISO Design Task node, click Show Architecture to see the current architecture and a list of the identifiers and names associated with the components.
As you design different controllers, you examine the various loop responses for a particular design. For example, to view the closed-loop step response, click the Analysis Plots tab. This tab lists the available responses, as shown in the following figure.
Select the plot types for each plot in the Analysis Plots area. Then select the plots to appear in the Plots list in the Contents of Plots table, as shown in the following figure.
Analysis Plots Loop Response Selection
After you select a plot, the LTI Viewer opens and displays the appropriate response(s) opens. You can also click Show Analysis Plot to open the LTI Viewer.
The following figure shows the resulting plot for the closed-loop step response of the DC motor.
LTI Viewer Showing the Step Response for the DC Motor
The settling time of the DC motor is about 1.5 seconds, which is too slow for many applications. Also, the plot shows a large steady-state error. You can use Bode diagram techniques to improve the response time and steady-state error of the DC motor step response, as described in Bode Diagram Design.
For a row or column array of LTI models, the analysis plots show the response of the nominal model only. To view the responses of the remaining models in the array, right-click the plot, and select one of the following options:
Multimodel Display > Bounds — Displays an envelope encompassing all model responses.
Multimodel Display > Individual Responses — Displays individual model responses.
The plot line in darker shade of blue is the response of the nominal model. When you design a controller for the nominal plant, you can simultaneously analyze the controller's effect on the remaining model responses in the array. For more information on analyzing control design for multiple models, see Control Design Analysis of Multiple Models.
As you select different compensator designs, the software computes the responses and updates the response plots in real-time in the LTI Viewer associated with your SISO Design Task. For an array, this computation is expensive. Therefore, real-time updates may cause delay in refreshing the plots for:
A large number of responses
Responses of a large number of models
To deactivate real-time updates, unselect the Real-Time Update option.
The SISO Design for SISO Design Task graphical tuning window is a graphical user interface (GUI) that you use to display and manipulate the Bode, root locus, and Nichols plots for the controller currently being designed. You can accomplish most control design tasks using the tabs in the SISO Design Task node in the Control and Estimation Tools Manager.
The graphical tuning window shows the plots configured in the Graphical Tuning tab.
This topic describes some of the methods you can use to navigate in the Graphical Tuning window and manipulate the window's appearance.
The Graphical Tuning window shows:
Poles as x's
Zeros as o's
Gain and phase margins (by default) in the lower-left corners of the Bode magnitude and phase plots
For the DC motor, the graphical tuning window resembles the following figure.
For a row or column arrays of LTI models, the plots show the individual responses and poles and zeros of all models in the array, as shown in the following figure.
The plot line in darker shade of blue represents the response of the nominal model. This plot also displays the response characteristics of the nominal model.
You can change the display to view an envelope that encompasses all individual model responses. To do so, right-click the plot, and select Multimodel Display > Bounds. The bounds resemble the following figure.
As you are designing a controller for the nominal plant, you can simultaneously analyze the controller's effect on the remaining models in the array. The software computes the response for each model and plots them. This computation is expensive and results in a slower refresh of the plots for:
Large number of responses
Responses for a large number of models
Dense frequency grid
To speed up the plot updates, change the display to plot the envelope instead of individual responses. For more information, see Control Design Analysis of Multiple Models.
The SISO Design Tool provides editors for setting plot options in the Graphical Tuning window. For example, if you want to change the frequency units on all the Bode plots created in the SISO Design Tool from rad/s to Hertz, select SISO Tool Preferences from the Edit menu in the SISO Design Task node on the Control and Estimation Tools Manager, as shown in the next figure.
This opens the SISO Tool Preferences dialog box.
Use the options on the Units page to make the change. This unit change persists for the entire session.
The SISO Design Tool has right-click menus available in any of the plot regions. Open the Bode magnitude menu by right-clicking in the Bode magnitude plot. The following menu appears.
Right-Click Menu for the Bode Magnitude Plot
Although the menus for each plot generally contain the same options, there are some options specific to each plot type:
The Open-Loop Bode Editor has a Gain Target option, the Closed-Loop Bode Editor has a Select Compensator option instead.
For arrays of LTI models, the Multimodel Display option for the Root Locus Editor has an option to show the poles and zeros of the nominal or all models, instead of Bounds and Individual Responses options.
The right-click menus contain numerous features. The DC motor example uses many of the available features; for a complete discussion of the right-click menus, see the help for the SISO Design Tool."
After you design the controller, you may want to save your design parameters for future implementation. You can do this by selecting:
File > Export in the Control and Estimation Tools Manager
File > Export in the Graphical Tuning window.
The SISO Tool Export dialog box opens:
Select models to export area shows a list of models for the components of your designs. For a plant or sensor modeled as row or column array of LTI models, the components are also arrays of LTI models.
Export As column displays variables with default names or previously named in the System Data dialog box.
Select design drop-down list lets you view the components of other designs.
To export your controller to the workspace:
To select multiple components, use the Shift key if they are all adjacent and the Ctrl key if they are not.
At the MATLAB prompt, type
to view the compensator variable C.
To see the format in which this variable is stored, type
Clicking Export to Disk opens the Export to Disk dialog box.
You can save your models as MAT-files in any folder. The default name for the MAT-file is the name of your original model. You can also specify a name for the MAT-file. If you save multiple components, they are stored in a single MAT-file.
You can store and retrieve intermediate compensators while you iterate on your compensator design. To store intermediate designs, click the Design History node or Store Design, both located on the SISO Design Task node in the Control and Estimation Tools Manager.
Alternatively, you can select Store/Retrieve from the Designs menu in the Graphical Tuning window. Using either method, the following Design History page opens.
Click Store Design to save the current design with the default name Design; the suffix increments when you store additional compensators without renaming them. You can rename the design by right-clicking the name under the node and selecting Rename.
To retrieve intermediate designs, again click the Design History node or select Store/Retrieve from the Designs menu. From the Design History page, select the design to retrieve, and then click Retrieve Design, as shown next.
Design History Page Listing Current Designs
The Graphical Tuning window automatically reverts to the selected compensator design.
Click any design name in the Design History to view a snapshot summary of the design, as shown in the following figure.
Design Snapshot Summary
Return to the compensator list by clicking the Design History node.
You can delete an intermediate design by selecting it from the Design History page and clicking Delete.