How to specify a nonlinear mpc controller for continuous time delay differential equation state function?

I have a system of continuous-time nonlinear delay differential equations with two states and two explicit time delays. I would like to build a nonlinear mpc controller for this system, but I am not sure how to write a state function with time delays.
The system:
Where are the state varaibles, are constants, u is the manipulated variable, and are the continuous-time nonlinear state equations.
Is this possible to do using nlmpc ?

 Respuesta aceptada

You can basically add states to help model the delays. So your new discretized state vector would be [x(k) y(k) x(k-1) y(k-1) ... x(k-tau1/Ts) y(t-tau2/Ts)]. Then you can use the respective state function with nlmpc.

4 comentarios

Thanks this worked great. I was able to get it to work using the following setup:
For
nlobj = nlmpc(6,6,1);
nlobj.Model.StateFcn = @stateFunc;
function xdot = stateFunc(x,u)
xdot = [f1(x(1),x(2),x(5),x(6),u(1)); % x(t+1) = f1(x,y,x(t-2),y(t-2),u)
f2(x(1),x(2),x(5),x(6),u(1)); % y(t+1) = f2(x,y,x(t-2),y(t-2),u)
x(1)-x(3); % x(t) = x(t-1)
x(2)-x(4); % y(t) = y(t-1)
x(3)-x(5); % x(t-1) = x(t-2)
x(4)-x(6)] % y(t-1) = y(t-2)
end
I'm guessing when matlab discretizes the system it computes not so that's why I have etc instead of just passing etc.
However, having a delay longer than 1 or 2 timesteps would introduce a lot of new variables and make the computation very slow. Is there a way around that?
Can't think of any other way that would work. Maybe another option would be to fit a data-driven model? If # of states becomes high with an analytical model, you may still be able to capture the dynamics with the original number of states if you have data. Model Predictive Control Toolbox supports neural ODEs since R2022b so you can give it a try
Ok makes sense. I will look into that. Thanks for your help!
In this case I was able to rescale the time variable in the delay differential equations so that the needed time delays were small which made the computation tractable. But in other cases I like the idea of fitting a data-driven model and I'm going to look into that as well anyways.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Model Predictive Control Toolbox en Centro de ayuda y File Exchange.

Productos

Preguntada:

el 14 de Mzo. de 2023

Comentada:

el 20 de Mzo. de 2023

Community Treasure Hunt

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

Start Hunting!

Translated by