Controlador de Diseño Con MPC Designer - MATLAB y Simulink
Controlador de Diseño Con MPC Designer - MATLAB y Simulink
Controlador de Diseño Con MPC Designer - MATLAB y Simulink
Modelo CSTR
Las siguientes ecuaciones diferenciales representan el modelo linealizado de un reactor continuo de tanque agitado (CSTR) que involucra una reacción exotérmica:
d C ′A
= a11C ′ A + a12T ′ + b11T ′c + b12C ′ A i
d t
d T′
= a21C ′ A + a22T ′ + b21T ′c + b22C ′ A i
d t
Los términos primos, como C ′ A , denotan una desviación de la condición nominal de estado estacionario en la que se ha linealizado el modelo.
La medición de las concentraciones de reactivo es a menudo difícil. Para este ejemplo, suponga que:
https://www.mathworks.com/help/mpc/gs/introduction.html 1/24
7/1/2020 Controlador de diseño con MPC Designer - MATLAB y Simulink
d x
= Ax + Bu
d t
y = C x + D u
dónde,
[ ] [ ] [ ]
C ′A T ′c T′
x = , u = , y =
T′ C ′A C ′A
i
[ ] [ ] [
] [ ]
un11 un12 b11 b12 0 0 1 0 0
A = , B = , C = , D =
un21 un22 b21 b22 1 0 0 0 0
For this example, the coolant temperature has a limited range of ±10 degrees from its nominal value and a limited rate of change of ±4 degrees per sample period.
mpcDesigner
https://www.mathworks.com/help/mpc/gs/introduction.html 2/24
7/1/2020 Controlador de diseño con MPC Designer - MATLAB y Simulink
On the MPC Designer tab, in the Structure section, click MPC Structure.
In the Define MPC Structure By Importing dialog box, in the Select a plant model or an MPC controller table, select the CSTR model.
https://www.mathworks.com/help/mpc/gs/introduction.html 3/24
7/1/2020 Controlador de diseño con MPC Designer - MATLAB y Simulink
Since CSTR is a stable, continuous-time LTI system, MPC Designer sets the controller sample time to 0.1 T , where T is the average rise time of CSTR. For this example, in
r r
the Specify MPC controller sample time field, enter a sample time of 1.
By default, all plant inputs are defined as manipulated variables and all plant outputs as measured outputs. In the Assign plant i/o channels section, assign the input and
output channel indices such that:
https://www.mathworks.com/help/mpc/gs/introduction.html 4/24
7/1/2020 Controlador de diseño con MPC Designer - MATLAB y Simulink
The app imports the CSTR plant to the Data Browser. The following are also added to the Data Browser:
https://www.mathworks.com/help/mpc/gs/introduction.html 5/24
7/1/2020 Controlador de diseño con MPC Designer - MATLAB y Simulink
• mpc1 — Default MPC controller created using sys as its internal model.
• scenario1 — Default simulation scenario.
The app runs the default simulation scenario and updates the Input Response and Output Response plots.
https://www.mathworks.com/help/mpc/gs/introduction.html 6/24
7/1/2020 Controlador de diseño con MPC Designer - MATLAB y Simulink
Tip
https://www.mathworks.com/help/mpc/gs/introduction.html 7/24
7/1/2020 Controlador de diseño con MPC Designer - MATLAB y Simulink
To view the response plots side-by-side, on the View tab, in the Tiles section, click Left/Right.
Once you define the MPC structure, you cannot change it within the current MPC Designer session. To use a different channel configuration, start a new session of the app.
In the Input and Output Channel Specifications dialog box, in the Name column, specify a meaningful name for each input and output channel.
In the Unit column, optionally specify the units for each channel.
Since the state-space model is defined using deviations from the nominal operating point, set the Nominal Value for each input and output channel to 0.
Keep the Scale Factor for each channel at the default value of 1.
https://www.mathworks.com/help/mpc/gs/introduction.html 8/24
7/1/2020 Controlador de diseño con MPC Designer - MATLAB y Simulink
Click OK.
The Input Response and Output Response plot labels update to reflect the new signal names and units.
In the Simulation Scenario dialog box, increase the Simulation duration to 30 seconds.
In the Reference Signals table, in the first row, specify a step Size of 2 and a Time of 5.
In the Signal column, in the second row, select a Constant reference to hold the concentration setpoint at its nominal value.
https://www.mathworks.com/help/mpc/gs/introduction.html 9/24
7/1/2020 Controlador de diseño con MPC Designer - MATLAB y Simulink
The default scenario is configured to simulate a step change of 2 degrees in the reactor temperature, T, at a time of 5 seconds.
Click OK.
The response plots update to reflect the new simulation scenario configuration.
In the Data Browser, in the Scenarios section, click scenario1. Click scenario1 a second time, and rename the scenario to stepT.
https://www.mathworks.com/help/mpc/gs/introduction.html 10/24
7/1/2020 Controlador de diseño con MPC Designer - MATLAB y Simulink
The response plots update to reflect the new horizons. The Input Response plot shows that the control actions for the manipulated variable violate the required coolant
temperature constraints.
https://www.mathworks.com/help/mpc/gs/introduction.html 12/24
7/1/2020 Controlador de diseño con MPC Designer - MATLAB y Simulink
In the Constraints dialog box, in the Input Constraints section, enter the coolant temperature upper and lower bounds in the Min and Max columns respectively.
Specify the rate of change limits in the RateMin and RateMax columns.
Click OK.
https://www.mathworks.com/help/mpc/gs/introduction.html 13/24
7/1/2020 Controlador de diseño con MPC Designer - MATLAB y Simulink
The Input Response plot shows the constrained manipulated variable control actions. Even with the constrained rate of change, the coolant temperature rises quickly to its
maximum limit within three control intervals.
https://www.mathworks.com/help/mpc/gs/introduction.html 14/24
7/1/2020 Controlador de diseño con MPC Designer - MATLAB y Simulink
In the Input Weights table, increase the manipulated variable (MV) Rate Weight to 0.3. Increasing the MV rate weight penalizes large MV changes in the controller
optimization cost function.
In the Output Weights table, keep the default Weight values. By default, all unmeasured outputs have zero weights.
Since there is only one manipulated variable, if the controller tries to hold both outputs at specific setpoints, one or both outputs will exhibit steady-state error in their
responses. Since the controller ignores setpoints for outputs with zero weight, setting the concentration output weight to zero allows reactor temperature setpoint tracking with
zero steady-state error.
Click OK.
https://www.mathworks.com/help/mpc/gs/introduction.html 15/24
7/1/2020 Controlador de diseño con MPC Designer - MATLAB y Simulink
The Input Response plot shows the more conservative control actions, which result in a slower Output Response.
https://www.mathworks.com/help/mpc/gs/introduction.html 16/24
7/1/2020 Controlador de diseño con MPC Designer - MATLAB y Simulink
https://www.mathworks.com/help/mpc/gs/introduction.html 17/24
7/1/2020 Controlador de diseño con MPC Designer - MATLAB y Simulink
When you adjust the controller tuning weights using the Closed-Loop Performance slider, MPC Designer does not change the weights you specified in the Weights dialog
box. Instead, the slider controls an adjustment factor, which is used with the user-specified weights to define the actual controller weights.
https://www.mathworks.com/help/mpc/gs/introduction.html 18/24
7/1/2020 Controlador de diseño con MPC Designer - MATLAB y Simulink
This factor is 1 when the slider is centered; its value decreases as the slider moves left and increases as the slider moves right. The weighting factor multiplies the
manipulated variable and output variable weights and divides the manipulated variable rate weights from the Weights dialog box.
To view the actual controller weights, export the controller to the MATLAB® workspace, and view the Weights property of the exported controller object.
On the MPC Designer tab, in the Scenario section, click Plot Scenario > New Scenario.
In the Simulation Scenario dialog box, set the Simulation duration to 30 seconds.
In the Unmeasured Disturbances table, in the Signal drop-down list, select Step.
https://www.mathworks.com/help/mpc/gs/introduction.html 19/24
7/1/2020 Controlador de diseño con MPC Designer - MATLAB y Simulink
Click OK.
The app adds new scenario to the Data Browser and creates new corresponding Input Response and Output Response plots.
https://www.mathworks.com/help/mpc/gs/introduction.html 20/24
7/1/2020 Controlador de diseño con MPC Designer - MATLAB y Simulink
In the Output Response plots, the controller returns the reactor temperature, T, to a value near its setpoint as expected. However, the required control actions cause an
increase in the output concentration, CA to 6 kgmol/m3.
https://www.mathworks.com/help/mpc/gs/introduction.html 21/24
7/1/2020 Controlador de diseño con MPC Designer - MATLAB y Simulink
In the Constraints dialog box, in the Output Constraints section, the second row of the table, specify a Max unmeasured output (UO) value of 3.
By default, all output constraints are soft, meaning that their MinECR and MaxECR values are greater than zero. To soften the unmeasured output (UO) constraint further,
increase its MaxECR value.
Click OK.
https://www.mathworks.com/help/mpc/gs/introduction.html 22/24
7/1/2020 Controlador de diseño con MPC Designer - MATLAB y Simulink
In the Output Response plots, once the reactor concentration, CA, approaches 3 kgmol/m3, the reactor temperature, T, starts to increase. Since there is only one
manipulated variable, the controller makes a compromise between the two competing control objectives: Temperature control and constraint satisfaction. A softer output
constraint enables the controller to sacrifice the constraint requirement more to achieve improved temperature tracking.
https://www.mathworks.com/help/mpc/gs/introduction.html 23/24
7/1/2020 Controlador de diseño con MPC Designer - MATLAB y Simulink
Since the output constraint is soft, the controller maintain adequate temperature control by allowing a small concentration constraint violation. In general, depending on your
application requirements, you can experiment with different constraint settings to achieve an acceptable control objective compromise.
Export Controller
In the Tuning tab, in the Analysis section, click Export Controller to save the tuned controller, mpc1, to the MATLAB workspace.
You cannot delete the current controller. Also, you cannot delete a plant or scenario if it is the only listed plant or scenario.
If a plant is used by any controller or scenario, you cannot delete the plant.
To delete multiple plants, controllers, or scenarios, hold Shift and click each item that you want to delete.
References
[1] Seborg, D. E., T. F. Edgar, and D. A. Mellichamp, Process Dynamics and Control, 2nd Edition, Wiley, 2004, pp. 34–36 and 94–95.
See Also
MPC Designer
Related Topics
• Specify Constraints
• Tune Weights
• Design MPC Controller in Simulink
https://www.mathworks.com/help/mpc/gs/introduction.html 24/24