3

I am making simulations for long times and I need to check the output when the simulation is continuing. Another reason is that I am doing real-time simulation so I want to see the output in real-time as well.

That would be perfect if OpenModelica creates an output file during the simulation so that I can read and plot it using 3rd party tools, maybe Python.

So far as I know, OpenModelica creates output file only at the end of the simulation. Is there a way to create an output file using a Modelica function? Assuming something like this:

when sample(0,100) then
  writeOutput();
end when;
falsterbo
  • 520
  • 1
  • 3
  • 15
  • OpenModelica can also provide simulation results on-the-fly using TCPI/IP communication. Is that interesting for you? – lochel Sep 14 '17 at 15:25
  • It sounds nice. Though my knowledge on the subject is limited, I will be looking into it. But if available, I would choose something simpler. Thanks for the advice. – falsterbo Sep 14 '17 at 16:00
  • 2
    Note that this issue is tool-specific. In e.g. Dymola the simulation result can be read during the simulation (and assumedly also in other tools). Note that I/O causes delays; that can be problematic for real-time simulations. – Hans Olsson Sep 15 '17 at 09:18
  • Yes, I know it is tool specific and I need to do it in OpenModelica. My simulation will be synchronized to the real time. So, 100 seconds of simulation takes approximately 10 seconds and writing the output file 2-3 seconds. Then I will be waiting for the real time to come to t=100s. But that is another issue I need to deal with. For now, I need to find a way to write the output file when I am waiting for real-time synchronization. Otherwise, RAM will be overloaded. – falsterbo Sep 16 '17 at 13:02
  • You could use the opc-ua plugin of OpenModelica if you want to read variables continuously. If your application crashes or is not fast enough, you might miss some values though (nothing is saved except in the result-files). You could write to a csv-file and read the last line every 100s, but I suspect the I/O would not flush and this is a bad idea. – sjoelund.se Oct 02 '17 at 13:27

0 Answers0