Description
MPC3S is an open-source toolbox that provides several functions to Define, Solve, and Simulate different variations of the linear model predictive control (MPC) approach.
>> Download User Guide for MPC3S <<
(Currently, it is available just in PERSIAN)
(English version will be available soon)
Videos for learning MPC3S toolbox in YouTube:
Videos for learning MPC3S toolbox in APARAT (آپارات):
System Requirements
The MPC3S toolbox supports all the following platforms:
Installation
[1] Farhad Bayat, "Model Predictive Control: Theory and Applications", University of Zanjan, 2021.
[2] Farhad Bayat, "MPC3S: A toolbox for designing and implementing Model Predictive Control in MATLAB", www.znu.ac.ir/members/newpage/915/en, 2022.
Contact
Features
A Simple Example:
Consider a 1-st order SISO system with the following state-space model (Ts=1 sec):
The cost function associated with the MPC problem is assumed as:
where the design parameters are chosen as:
Furthermore, the following constraints are assumed:
We aim to design an MPC law for this system, and simulate the closed loop system with the following parameters:
SOLUTION:
Step-1:
Problem = MPC_Problem('SS');
Problem.Plant.Model.A = 0.5;
Problem.Plant.Model.B = 1;
Problem.Plant.Model.C = 1;
Problem.Plant.Ts = 1;
Problem.Plant.ny = 1;
Problem.Plant.nu = 1;
Problem.Cost.Np = 10;
Problem.Cost.Nc = 5;
Problem.Cost.Gama = 2;
Problem.Cost.Lamda = 1;
Problem.Constraints.umax = 1;
Problem.Constraints.umin = -1;
Problem.Constraints.Dumax = 0.2;
Problem.Constraints.Dumin = -0.2;
Step-2:
mpcLaw = MPC_Solve(Problem);
Step-3:
SimParams = MPC_SimParams('SS');
SimParams.Ref = 2*ones(1,50);
SimParams.Dist = [zeros(1,20),0.5*ones(1,30)];
SimParams.Noise.y = [zeros(1,30),0.05*(2*rand(1,20)-1)];
Results= MPC_Sim(mpcLaw,SimParams);
MPC_Plot(Results)
NOTE:
Two auxiliary functions "MPC_SimParams()" and "MPC_Plot()" are utilized to prepare simulation parameters and plotting the simulation results, respectively.
Finally, the closed-loop simulation results are shown in Figure 1 that verify the design objectives.
Figure 1: Closed-loop simulation results.