MPC is a type of controller that is frequently used in real and industrial applications. The simplicity of this controller is one of the most important advantages of this controller that persuades researchers to employ it in their applications. This project implements the data-driven type of MPC in which the controller does not have any information about the main system that is desired to be controlled. This property is very interesting because this controller can be exploited without any required idea about the system. You can easily use this controller in your Simulink file through connecting the system's output and its desired signals.
This article implements a data-driven model predictive controller (MPC) in the Simulink Matlab. The controller utilizes the on-line data that are given from the original system and the desired signals. In fact, the controller tries to reach the system's output to the desired signal by evaluating the control input. The control input is the output of the controller that is applied to the original system. Thus, the controller has two inputs and one output ports which are the system's output, desired reference signal, and the control input, respectively. The controller is implemented in a Simulink subsystem that its parameters can be easily modified through double-clicking on the subsystem and inserting the desired controller's parameters which are presented in the following.
The developed subsystem fits an ARIMA model on the real system's outputs and inputs. Then, an MPC is applied to the on-line estimated ARIMA model for the control aim. The main control aim is to reach the system's outputs to the desired reference signals. In the following, the developed subsystem is shown:
The developed subsystem as shown in the above picture can be directly used by connecting its ports into the original system that is desired to be controlled.
As stated earlier, the developed Simulink subsystem simultaneously implements an online model fitting and model predictive controller (MPC). In the first step, an ARIMA model is considered as follows:
u(t) are the outputs and inputs of the original system. Parameters mu and my stand for the numbers of the outputs and inputs of the original system. Also, parameters p and q are the orders of the ARIMA model which are used in the above equation. These parameters can be manually modified by changing them in the parameters of the subsystem. The developed subsystem fits a model like the above one on the inputs and outputs of the original system which its internal properties are supposed to be fully unknown.
In the second step, an appropriate MPC is applied to the obtained ARIMA model. The controller attempts to reach the system's outputs
y(t) to the desired reference signals yd(t) by properly designing the control sequence based on the idea of MPC. The controller parameters involving the prediction and control horizons are denoted by
Nu in the developed subsystem. In fact, the controller predicts the system's output
y(t) in the future steps as given below:
Then, the controller precisely determines the control sequence
U=[U(t) U(t+1) ... U(t+Nu-1)] such that the prediction outputs
Y=[y(t+1) y(t+2) ... y(t+Ny)] closes to the reference signals
yd(t). For this purpose, an optimization problem is defined and solved to optimally determine the control sequence
U. The optimum control sequence is obtained at each step
t and its first entry is applied to the original system as the control input.
It should be noted that the developed subsystem can be used for both SISO and MIMO systems. It means the systems may have more than one output and input ports.
Using the Code
In this subsection, some explanatory notes about the utilization of the developed subsystem are given in some examples.
In the first example, assume it is desired to control the LTI system
1/(s+1) to follow a sine-wave reference signal as shown in the following picture:
The above picture simply describes how the developed controller can be used in the Simulink. For this purpose, the original system (that is
1/(s+1)) is implemented and its output is connected to the "
y" port of the Data-Driven MPC and the "
uc" port of the data-driven MPC is connected to its input. The desired reference signal is considered as a sine-wave that its parameters can be modified. Then, the controller tries to close the output signal of the original system into the desired signal.
By clicking on the Data-Driven MPC, the following properties are shown:
Some of the above parameters are previously defined and the others are defined here. Parameter "
T" stands for the time step. Parameters "
umax" and "
udmax" represent the minimum, maximum, and the time-derivative maximum of the control input signal, respectively. All of these parameters can be changed due to the limits of the original system. In the sequel, the system's output and its desired signal are shown to evaluate the performance of the controller:
As can be seen, the controller properly controls the system.
In the second example, the data-driven MPC is applied to a water-tank system to control its level. The details of this example is given in Example2.slx in the attached file and it is shown here:
The desired Water Level is set at 2 and the Data-Driven MPC is exploited of this control aim. The controller can be easily used without any information about the internal of the original system which is a Water-Tank system in this example. The parameters of the controller can be adjusted based on the operator limits and commands. The following figure shows the appropriate tracking of the system's output signal:
The above figure reveals the ability of the implemented controller to control the Water Level in this example.
The developed subsystem utilizes a script which is noted by myfun that simulates both online estimation and MPC design. The code is given in the following:
global U Y P th Uo yh;
The above code is internally used in the developed subsystem that explains how the data-driven MPC is implemented.
Points of Interest
This Simulink subsystem can be easily used by inserting it into any control loops. This subsystem can be used in the scientific articles as a comparative controller to evaluate the performance of your developed controller.
- 18th October, 2020: Initial version