kdavies4 / ModelicaRes

Set up, analyze, and plot Modelica simulations in Python
http://kdavies4.github.io/ModelicaRes/
Other
51 stars 20 forks source link

Support simulations via FMI #19

Open kdavies4 opened 10 years ago

kdavies4 commented 10 years ago

Use PyFMI; see http://www.os.is/gogn/Skyrslur/OS-2012/OS-2012-06/OS-2012-06-03.pdf and http://nbviewer.ipython.org/gist/saroele/e6f176ac0ff391e8982a

kdavies4 commented 9 years ago

Will be supported via a context manager: modelicares.exps.simulators.fmi

arnoutaertgeerts commented 9 years ago

Most of the implementation is done and works on Windows. I tried to stay as close as possible to your programming style of the dymosim class. 3f22fdc9ed72967996352c82b9807483bf008dbd

If we need some other features, let me know!

kdavies4 commented 9 years ago

I got the following error when I tried simulations.ipynb: AttributeError: 'pyfmi.fmi.FMUModelCS1' object has no attribute 'setup_experiment

I got a similar error with using ME instead of CS: AttributeError: 'pyfmi.fmi.FMUModelME1' object has no attribute 'setup_experiment'

When I commented out the self.fmu.setup_experiment() line of exps.simulators.fmi.load and generated a FMU with a binary for my platform, that IPython notebook worked. What do you think happened? Do we have different versions of PyFMI? I think I have version 2.0.

kdavies4 commented 9 years ago

Otherwise, we mostly just need to clean things up (code, docstrings, examples). I need to do a sensitivity analysis (Morris method) using the exps module for my research. If that leads to any useful functions I'll add them. I'd like to release all this in a new version before the next Activity 1.4 mtg (mid to late Jan).

Good work!

kdavies4 commented 9 years ago

Here's an idea: instead of internally storing memory_result, run() and continue_run() could return the results as SimRes instances. The best way might be to extend the pyfmi results class (ResultBase or JMResultBase) on SimRes, but that would require agreement from the PyFMI developers.

arnoutaertgeerts commented 9 years ago

The AttributeError was due to a different version of the FMU, not of PyFMI. I fixed this in 1e0027f0b6afaff75bd6dbaac0cc9b669bbb9a6d.

kdavies4 commented 9 years ago

Great!