Non-linear Model Predictive Control Toolbox: manipulated variable remains constant

6 views (last 30 days)
Hello,
I am using the Non Linear MPC toolbox for controlling one variable in the BSM1 benchmark simulator. Only one state and one manipulated variable are used, other variables are required for the model but are considered measured disturbances. Everything is defined along with the nlmpc object (Prediction and Control horizons, minimum and maximum values of state and manipulated variables, cost function) and no error is given. The simulation runs fine, the nlp.status variable gives positive values (1 or 2) and everything seems to work, apart from the fact that the manipulated variable remains constant, at the maximum possible value defined in the constraint. If I set the maximum as 140, it stays at 140, if I set to 360, it stays at 360.
The controlled variable (dissolved oxygen in Tank 5) is always very far away from the required set point of 2. I used the 'ref' ability of the nlmpc object for set-point tracking and then changed for a cost function equal to:
nlobj.Optimization.CustomCostFcn = @(X,U,e,data) sum((X(1:10, 1) - ref(:)).^2)
where
ref = 2*ones(1, 10) (10 here is the prediction horizon).
In the diagnostic viewer the only message that pops up is:
Slack variable unused or zero-weighted in your custom cost function. All constraints will be hard.
Any clue on what might not be working?
Thank you!

Accepted Answer

Emmanouil Tzorakoleftherakis
Well maybe that's the best the controller can do. I suggest removing the constraint on the manipulated variable temporarily and run the simulation. If you get the desired behavior then, that just means that the constraint is to blame and you should consider either relaxing it or making it soft.
  1 Comment
Jorge Pereira
Jorge Pereira on 2 May 2023
Thank you for your reply. I removed the constraint and the manipulated variable's values became even higher. I assume this is the best the controller can do. I will analyze the State Function and try to better understand its behavior.

Sign in to comment.

More Answers (0)

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!