Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

External Control of a simulation

External Control of a simulation

Hello,

Do you know how to control a simulation from a C++ application ?

I explain my need :

I need to control from a custom C++ HMI a simulation step by step and for each calculation step :

- Before the calculation step, I need to modify some parameters of the model
- After the calculation step, I need to retrieve some variables of the model.

Thank you for your help.

Re: External Control of a simulation

Hello pco38

You can do it using sockets. There is a sample here (http://www.modelica-forum.com/forums/lo … p/t17.html) that is also referenced here (http://kempproject.blogspot.com.es/2013 … art-1.html).

This sample shows communication between an OpenModelica simulation and other programs for co-simulation.

It is very simple. If you find any problem please post it.

Now OpenModelica supports CORBA for communication with simulations. However most of times OpenModelica users do not need the sophisticated CORBA interface. A very simple message exchange library as the one shown in example is just enough. It would be great if OpenModelica project would include something similar.

Best regards
Koldo

Re: External Control of a simulation

Hello Koldo,

Thank you very much for your help. I'll try this method.

Best regards.

Re: External Control of a simulation

You're welcome current/smile

Anyway a question still unsolved for the Modelica model is to know exactly the simulation steps.

Now the model do not know when a step has finished. That is a matter of the solver and remains hidden for the model. This makes more difficult to couple simulations.

There are 0 guests and 0 other users also viewing this topic
You are here: