How to specify time varying constraints(linear combination of input/output variables) using MPC Toolbox?

3 views (last 30 days)
To clarify the issue: I am working on designing a linear MPC controller. Ideally, I would like to speficy constraints that vary over the prediction horizon.
I know this is possible for simple lower and upper bounds on inputs/outputs (see: https://de.mathworks.com/help/mpc/ug/time-varying-weights-and-constraints.html ), atleast within MPC Designer. I also know that constraints(linear combination of input/output variables) can vary inbetween the solution cycle/at run-time (See: https://de.mathworks.com/help/mpc/ug/run-time-constraint-updating.html ). However, as of today, I could not find any way to vary linear combinations of input/output variables for linear MPC over the prediction horizon.
Is there a way to achieve what I am looking for?
Thanks in advance.

Answers (2)

Kothuri
Kothuri on 21 Jun 2024
To vary the linear combinations of input/output variables over the prediction horizon, you can try NonLinearMPC Design which offers a greater flexibility in defining the constraints.
Below are the documentation links for more information on Non-Linear MPC Design
  1 Comment
Benedikt Schmidt
Benedikt Schmidt on 21 Jun 2024
Hi Kothuri,
I know that it is possible with Nonlinear MPC, but Nonlinear MPC requires way more computational resources than linear MPC. Nevertheless, I found a workaround to avoid the issue of having to specify constraints that vary over the prediction horizon entirely.
But for anybody else having the same question as me: For linear MPC, there is no way to vary the matrices E, F, G, V and S over the prediction horizon (See: https://de.mathworks.com/help/mpc/ref/mpc.setconstraint.html ). To do that you need Nonlinear MPC, like Kothuri mentioned. What can however vary over the prediction horizon are the input/output/disturbance variables. So, if you have e.g. disturbance variables for which you know in advance what values they will take for future time steps, you can use Signal Previewing (See: https://de.mathworks.com/help/mpc/ug/improve-control-performance-with-look-ahead.html ). If you use previewing for a disturbance variable, the respective variable will vary over the prediction horizon. If you specified a constraint using setconstraint and the S matrix is not a zero matrix, than you get constraints, that vary over the prediction horizon (because of the previewing for that disturbance variable).
In short, you can not vary E, F, G, V or S matrices, but by using Signal Previewing, it's still possible to get constraints( i.e. linear combinations of input/output/disturbance variables) which vary over the prediction horizon.
That beeing said, the above idea (Signal Previewing + setconstraint) to create constraints that vary over the prediction horizon lead to numerical instability, which was caused by the Previewing (atleast I think so). Most of the solutions I got this way were infeasible. I resolved the issue by adding a new state to my state space model which represents the constraint that I want to enforce. For the new state I specified hard lower/upper bounds. So essentially I introduced a slack variable. This worked like a charm even which previewing enabled. Hope this gives people with the same issue some ideas on what to try.

Sign in to comment.


Jordan Olson
Jordan Olson on 24 Jun 2024
Hello Benedikt,
The simplest way to implement time-varying constraints for a nonlinear MPC is to use a multistage nonlinear MPC. This is essentially a special formulation of the standard nonlinear MPC where you can explicitly specify the cost and constraint functions separately for each stage from k to , p being the prediction horizon. For more information, please see the following:
  1 Comment
Benedikt Schmidt
Benedikt Schmidt on 24 Jun 2024
Hi Jordan,
thanks for the answer. I should have specified in the initial question, that what I was looking for was specifically intended for linear MPC. My bad. Nevertheless, my original problem was resolved.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!