MPC in simulink issue

53 views
Skip to first unread message

Mahdi

unread,
Aug 5, 2020, 9:44:57 PM8/5/20
to YALMIP
Hi Johan,

My project is controlling a device by MPC. I want to use my designed MPC algorithm in Simulink. I used "Interpreted Matlab function" and I was successful to apply the MPC on my system during the whole run time.
But, since I only need the controller to be active in a part of my simulation time, I need the MPC block to be deactivated for the rest of the simulation time.

The thing I did was that I multiplied the MPC output to zero so that the MPC doesn't apply any output to the system whenever I don't want it to, but by doing this not only the speed of the simulation is low but also I can't use some of my constraints because those constraints would be violated by the system during the rest of simulation time. 

Is there any way to deactivate the MPC Interpreted Matlab function block and activate it whenever I need it?

Best
Mahdi

Johan Löfberg

unread,
Aug 6, 2020, 2:53:03 AM8/6/20
to YALMIP
Add an extra input to the mpc controller to control if you want to solve the problem or not. There are also built-in blocks in simulink to active/deativate sub-blocks

However, your question makes little sense. You use the MPC controller to handle the constraint and then you don't understand why the constraints aren't satisfied when you have turned off the controller?

Mahdi

unread,
Aug 6, 2020, 3:35:59 AM8/6/20
to YALMIP
Thanks for the reply. I tried some built-in blocks of Simulink, but it wasn't successful. I didn't try the extra input that you mentioned, I will try that.
My MPC controller should be activated when a disturbance is applied to the system to bring back the system to its normal condition by imposing some constraints on the system. Therefore when the system is in its normal condition, having those constraints will only disturb the system or make the solution infeasible.
Reply all
Reply to author
Forward
0 new messages