2

I'm trying to simulate a FMU exported from OpenModelica using pyFMI:

from pyfmi import load_fmu
import os
baseDir = os.path.dirname(os.getcwd())

fmu = baseDir + '\\Woody\\woody.fmu'
model = load_fmu(fmu)

# Get the options
opts = model.simulate_options()

# Specify tolerances
opts["CVode_options"]["atol"] = 1e-6
opts["CVode_options"]["rtol"] = 1e-6

# Simulate
res = model.simulate(final_time=1, options=opts)

However I keep getting the following error. I use Anaconda 2 and as far as I know I have all of the required packages (as required by the project page: https://pypi.org/project/PyFMI/)

Could not find No module named sundials
Could not find No module named kinsol
Could not find cannot import name dopri5
Could not find cannot import name rodas
Could not find cannot import name odassl
Could not find ODEPACK functions.
Could not find RADAR5
Could not find GLIMDA.
Traceback (most recent call last):
  File "C:\Projects\08 PIN3S 2019066\FMU\python\woody_pyfmi.py", line 17, in <module>
    res = model.simulate(final_time=1, options=opts)
  File "src\pyfmi\fmi.pyx", line 7654, in pyfmi.fmi.FMUModelME2.simulate
  File "src\pyfmi\fmi.pyx", line 301, in pyfmi.fmi.ModelBase._exec_simulate_algorithm
  File "src\pyfmi\fmi.pyx", line 295, in pyfmi.fmi.ModelBase._exec_simulate_algorithm
  File "C:\ProgramData\Anaconda2\lib\site-packages\pyfmi\fmi_algorithm_drivers.py", line 265, in __init__
    self._set_options()
  File "C:\ProgramData\Anaconda2\lib\site-packages\pyfmi\fmi_algorithm_drivers.py", line 434, in _set_options
    "The solver: "+solver+ " is unknown.")
pyfmi.common.algorithm_drivers.InvalidAlgorithmOptionException: 'Invalid algorithm options object: The solver: CVode is unknown.'

Whilst trying to figure out what could be wrong I came across the FMI Library, but I have no clue what I should do with that or how to compile it, and I have not found a comprehensive guide to do so.

jvandeweg
  • 133
  • 5

0 Answers0