# Is it possible to switch between multiple adaptive MPC controller?

3 views (last 30 days)
Artem Wendler on 8 Aug 2022
Commented: Walter Roberson on 9 Aug 2022
Hello,
I have two adaptive MPC controller, which control different manipulated variables (MV) in a plant. I need to switch between these two based on a specific condition. I modelled the controllers in matlab and Im using them in simulink. The plant and the linearized model updater are also coded in matlab and called with a MatlabFunction.
For example: If a certain criteria is given, then the first MPC should be "on" and if not, then the second should be "on".
Is this even possible?
Or should I use only one MPC, which controlls all MVs of the plant? But in that case some of the MVs need to be off or set to 0 if the others being manipulated.
I know you can controll two MPCs with a switch based on their cost function, but in my case I need a different criteria not the cost function. And in that example both MPCs control the same MVs. So I thought there should be a similar solution.
Thanks
##### 1 CommentShowHide None
Walter Roberson on 9 Aug 2022

Sam Chak on 9 Aug 2022
I'm not sure how complicated is your problem. If the ON/OFF switching is triggered by a simple event that depends on the state, then you can try this idea, mathematically. where k2 = 1.00; % trigger ON when x <= 0.5
k1 = 0.25; % else
F = @(t, x) [- (k1*(sign(x - 0.5) + 1)/2 + k2*(1 - sign(x - 0.5))/2).*x];
[t, x] = ode45(F, [0 10], 1);
plot(t, x), grid on, xlabel('t') Else, you can try if you can use the event location approach.

R2022a

### Community Treasure Hunt

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

Start Hunting!