How to design a MPC controller

3 visualizaciones (últimos 30 días)
Pablo Horrillo Quintero
Pablo Horrillo Quintero el 6 de Nov. de 2023
Respondida: Ayush el 29 de Jul. de 2025
Hello everyone,
I'm designing a MPC controller with three manipulated variables (MV) and three measured outputs(MO). My question is: is there a way to set that when one manipulated variable (for example MV1) is positive the other must be strictly zero (MV2=0), and when MV2 is negative then MV1=0 ?
Thank you in advance for your support
Best regards.

Respuestas (1)

Ayush
Ayush el 29 de Jul. de 2025
I understand that you are designing a Model Predictive Controller (MPC) in MATLAB with three manipulated variables (MVs) and three measured outputs (MOs), and you would like to enforce a conditional constraint: when MV1 is positive, MV2 must be zero; and when MV2 is negative, MV1 must be zero. This is a classic case of a mutually exclusive control strategy between two actuators.
According to me, the standard MPC controllers in MATLAB (such as those built using the Model Predictive Control Toolbox) are optimized for handling linear inequality and bound constraints. However, the type of constraint you're trying to implement introduces logical conditions (like when MV1 > 0 ⇒ MV2 = 0), which are non-convex and fall under the category of mixed-integer logic, something that is not directly supported by the standard MPC controller.
Here are a few technical strategies you can explore:
1. Custom Cost Function with High Penalty (Nonlinear MPC):
If you are using a Nonlinear MPC controller (via nlmpc), you can define a custom cost function that heavily penalizes simultaneous activation of both MV1 and MV2. For example:
if MV(1) > 0 && MV(2) ~= 0
cost = cost + largePenalty;
end
if MV(2) < 0 && MV(1) ~= 0
cost = cost + largePenalty;
end
This would not enforce the constraint strictly, but with a sufficiently large penalty it will bias the solver toward satisfying your condition.
2. Enforce Constraint via Custom Inequality in Nonlinear MPC:
You can use a custom inequality constraint function:
function [ineqCon] = myIneqConFunction(X, U, e, data)
MV1 = U(1);
MV2 = U(2);
ineqCon = [MV1 * abs(MV2)]; % Penalizes when both non-zero
end
This forces the product of the two MVs to be zero (or close), discouraging simultaneous activity.
3. Switch-Based Subsystem Logic:
Another approach is to use a control allocator block or custom logic in Simulink to implement conditional control. For instance, based on system states or outputs, determine which MV should be active and pass this decision to the MPC as dynamic constraints or manipulated variable bounds using setConstraint or setManipulatedVariable.
For more information on Non-linear model predictive controller, you can refer to the following official documentation: https://www.mathworks.com/help/mpc/ref/nlmpc.html
Hope it helps!

Categorías

Más información sobre Controller Creation en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by