MHE and MPC of Modelica models with GEKKO

123 views
Skip to first unread message

Sushil Cherian

unread,
Jul 27, 2019, 6:29:03 AM7/27/19
to apmonitor
I work with Modelica for equation based physical modeling of thermal power plants, using OpenModelica. It works well for simulation, using libraries such as ThermoSysPro. Even though optimization can be done using the Modelica language extension Optimica, the tools OpenModelica and JModelica.org does not seem well developed for online applications such as MHE and MPC.

I was wondering if there is a way to import Modelica models into GEKKO and use it for MHE and MPC. OpenModelica with ThermoSysPro provides a rich library of components for power plant modeling, while GEKKO provides a great platform for optimization. Would be great to get these two tools to work together. FMI seems to be a good choice for importing Modelica models into GEKKO, Is anyone aware of any work along these lines?

Would be interested to hear thoughts from other users.

Best regards
Sushil Cherian

John Hedengren

unread,
Jul 29, 2019, 5:59:29 AM7/29/19
to APM Google Groups
Sushil,

One of the issues with interfacing to other modeling languages is that Gekko solvers need the following information:
  • Variables with default values and constraints
  • Objective function
  • Equations
  • Evaluation of equation residuals
  • Sparsity structure
  • Gradients (1st derivatives)
  • Gradient of the equations
  • Gradient of the objective function
  • Some solvers:
    • Hessian of the Lagrangian (2nd derivatives)
    • 2nd Derivative of the equations
    • 2nd Derivative of the objective function
In addition to these requirements, the equations and objective function should have continuous first and second derivatives in open equation format. A common issue is the use of if statements in the model.

Would you be interested to interface Gekko with OpenModelica or recommend someone who could do that? I could provide an API that would allow the packages to work together seamlessly.

Best regards,
John Hedengren

--
--
APMonitor user's group e-mail list.
- To post a message, send email to apmo...@googlegroups.com
- To unsubscribe, send email to apmonitor+...@googlegroups.com
- Visit this group at http://groups.google.com/group/apmonitor
---
You received this message because you are subscribed to the Google Groups "apmonitor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to apmonitor+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/apmonitor/3bd00ca1-0813-46b9-bd1e-98440e87baa3%40googlegroups.com.


--
Best regards,

John Hedengren
APMonitor Optimization Suite

Sushil Cherian

unread,
Aug 6, 2019, 8:49:45 AM8/6/19
to apmonitor
Dr. Hedengren,

Thank you for your response.
At the moment, I am not sure I have enough expertise to attempt an interface of Modelica and GEKKO myself. I will probably spend some more time learning further details about both, and come back to you.
Meanwhile I will also talk to some people working on Modelica about this.

Best regards
Sushil Cherian
- To unsubscribe, send email to apmo...@googlegroups.com

- Visit this group at http://groups.google.com/group/apmonitor
---
You received this message because you are subscribed to the Google Groups "apmonitor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to apmo...@googlegroups.com.

Sushil Cherian

unread,
Aug 13, 2019, 9:27:05 AM8/13/19
to apmonitor
Dr. Hedengren,
I found some interesting work done at Lund University and Modelon regarding optimization-friendly implementation of thermodynamic functions in Modelica. Please see the paper below:

This paper describes the development of an optimization -friendly thermodynamic property model of water and steam that cover s liquid, vapor, 2 -phase as well as the super -critical region. All equations are at least twice continuously differentiable with respect to all model variables and can be used in dynamic optimization problems solved by efficient derivative - based algorithms. 

Unfortunately it appears that it is not open-source, but commercially available from Modelon AB.

Rgds
Sushil Cherian

John Hedengren

unread,
Aug 13, 2019, 9:32:12 AM8/13/19
to APM Google Groups
Sushil,

Thanks for the tip - this is a very helpful suggestion. We'd like to do the same thing with many compounds and with mixtures of compounds.

John Hedengren

- To unsubscribe, send email to apmonitor+...@googlegroups.com

- Visit this group at http://groups.google.com/group/apmonitor
---
You received this message because you are subscribed to the Google Groups "apmonitor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to apmonitor+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/apmonitor/6b407841-58bf-4f98-8e6a-2bcbbabaab4d%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages