This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Test Controller Robustness

This example shows how to test the sensitivity of your model predictive controller to prediction errors using simulations.

It is good practice to test the robustness of your controller to prediction errors. Classical phase and gain margins are one way to quantify robustness for a SISO application. Robust Control Toolbox™ software provides sophisticated approaches for MIMO systems. It can also be helpful to run simulations.

Define Plant Model

For this example, use the CSTR model described in Design Controller Using MPC Designer.

A = [-0.0285 -0.0014; -0.0371 -0.1476];
B = [-0.0850 0.0238; 0.0802 0.4462];
C = [0 1; 1 0];
D = zeros(2,2);
CSTR = ss(A,B,C,D);

Specify the signal names and signal types for the plant.

CSTR.InputName = {'T_c','C_A_i'};
CSTR.OutputName = {'T','C_A'};
CSTR.StateName = {'C_A','T'};
CSTR = setmpcsignals(CSTR,'MV',1,'UD',2,'MO',1,'UO',2);

Open MPC Designer, and import the plant model.

mpcDesigner(CSTR)

The app imports the plant model and adds it to the Data Browser. It also creates a default controller and a default simulation scenario.

Design Controller

Typically, you would design your controller by specifying scaling factors, defining constraints, and adjusting tuning weights. For this example, modify the controller sample time, and keep the other controller settings at their default values.

In MPC Designer, on the Tuning tab, in the Horizon section, specify a Sample time of 0.25 seconds.

The Input Response and Output Response plots update to reflect the new sample time.

Configure Simulation Scenario

To test controller setpoint tracking and unmeasured disturbance rejection, modify the default simulation scenario.

In the Data Browser, in the Scenarios sections, right-click scenario1, and select Edit.

In the Simulation Scenario dialog box, specify a Simulation duration of 50 seconds.

In the Reference Signals table, keep the default Ref of T setpoint configuration, which simulates a unit-step change in the reactor temperature.

To hold the concentration setpoint at its nominal value, in the second row, in the Signal drop-down list, select Constant.

Simulate a unit-step unmeasured disturbance at a time of 25 seconds. In the Unmeasured Disturbances table, in the Signal drop-down list, select Step, and specify a Time of 25.

Click OK.

The app runs the simulation scenario, and updates the response plots to reflect the new simulation settings. For this scenario, the internal model of the controller is used in the simulation. Therefore, the simulation results represent the controller performance when there are no prediction errors.

Define Perturbed Plant Models

Suppose that you want to test the sensitivity of your controller to plant changes that modify the effect of the coolant temperature on the reactor temperature. You can simulate such changes by perturbing element B(2,1) of the CSTR input-to-state matrix.

In the MATLAB® Command Window, specify the perturbation matrix.

dB = [0 0;0.05 0];

Create the two perturbed plant models.

perturbUp = CSTR;
perturbUp.B = perturbUp.B + dB;

perturbDown = CSTR;
perturbDown.B = perturbDown.B - dB;

Examine Step Responses of Perturbed Plants

To examine the effects of the plant perturbations, plot the plant step responses.

step(CSTR,perturbUp,perturbDown)
legend('CSTR','peturbUp','perturbDown')

Perturbing element B(2,1) of the CSTR plant changes the magnitude of the response of the reactor temperature, T, to changes in the coolant temperature, Tc.

Import Perturbed Plants

In MPC Designer, on the MPC Designer tab, in the Import section, click Import Plant.

In the Import Plant Model dialog box, select the perturbUp and perturbDown models.

Click Import.

The app imports the models and adds them to the Data Browser.

Define Perturbed Plant Simulation Scenarios

Create two simulation scenarios that use the perturbed plant models.

In the Data Browser, in the Scenarios section, double-click scenario1, and rename it accurate.

Right-click accurate, and click Copy. Rename accurate_Copy to errorUp.

Right-click errorUp, and select Edit.

In the Simulation Scenario dialog box, in the Plant used in simulation drop-down list, select perturbUp.

Click OK.

Repeat this process for the second perturbed plant.

Copy the accurate scenario and rename it to errorDown.

Edit errorDown, selecting the perturbDown plant.

Examine errorUp Simulation Response

On the MPC Designer tab, in the Scenario section, click Plot Scenario > errorUp.

The app creates the errorUp: Input and errorUp: Output tabs, and displays the simulation response.

To view the accurate and errorUp responses side-by-side, drag the accurate: Output tab into the left plot panel.

The perturbation creates a plant, perturbUp, that responds faster to manipulated variable changes than the controller predicts. On the errorUp: Output tab, in the Output Response plot, the T setpoint step response has about 10% overshoot with a longer settling time. Although this response is worse than the response of the accurate simulation, it is still acceptable. The faster plant response leads to a smaller peak error due to the unmeasured disturbance. Overall, the controller is able to control the perturbUp plant successfully despite the internal model prediction error.

Examine errorDown Simulation Response

On the MPC Designer tab, in the Scenario section, click Plot Scenario > errorDown.

The app creates the errorDown: Input and errorDown: Output tabs, and displays the simulation response.

To view the accurate and errorDown responses side-by-side, click the accurate: Output tab in the left display panel.

The perturbation creates a plant, perturbDown, that responds slower to manipulated variable changes than the controller predicts. On the errorDown: Output tab, in the Output Response plot, the setpoint tracking and disturbance rejection are worse than for the unperturbed plant.

Depending on the application requirements and the real-world potential for such plant changes, the degraded response for the perturbDown plant may require modifications to the controller design.

See Also

|

Related Topics