Modelling of differential and linear equations together in gekko?

Viewed 74

Hello everyone and Gekko developers,

I want to model the following equations for my Thermal Energy Storage Systems,

Differential Algebraic Equations

which are both linear and differential. Some variables are also time dependent, come as external parameters. From the examples of Gekko, it look likes that I can only add equation such as mdl.Equation(T_a.dt() == mt*c_p_w*(T_b-T_a)) / d_w*c_p_w in this format, however for equation not involving differential, I want to add as normal equations also such as mdl.Equation(m[t] == mc - m[t]).

p.s How can I add both styles, and which mode and solver will allow this. ?

Thanks,

Best regards,

Rahul

1 Answers

I guess you want to implement a MPC for the system ?

The solver modes for each application are displayed in the Gekko Doc, for MPC it should be 6 if you aim for collocation. From my experience with Gekko it should work out if you just add the linear equations, as long as these keep the problem feasible. Normally, linear algebraic equations don't corrupt your DAE problem. Secondly, a nonlinear solver will also work for a linear problem (bc linear solvers are implemented in a nonlinear solver), so IPOPT for example should work fine in any case.

You can look on the APMonitor website for more examples, I am sure there are some involving linear equations. If you are not sure, how to define variables, there is a detailled documentation online. https://gekko.readthedocs.io/en/latest/index.html

Hope this helps, I am also just a user of gekko that set up a few scripts.

Related