0

I follow word by word Jmodelica user's manual for installation and when running the fmu example in IPython I get:

from pymodelica import compile_fmu
from pyfmi import load_fmu
my_fmu = compile_fmu('RLC_Circuit','RLC_Circuit.mo')

Could not find file: RLC_Circuit.mo (The system cannot find the file specified)

The file RLC_Circuit.mo is present in a folder but apparently "the system cannot find it". So how to add a path of the parent folder ?

leoo321
  • 31
  • 4
  • I figured out that the 'RLC_Circuit.mo' file is not defined in the environment variable MODELICAPATH and therefore cannot be found... however, if the path leading to the RLC_Circuit file is added to the env var MODELICAPATH, then the class cannot be read as it should be defined within a package. The question is, why in the user's guide none of this is said? and why in the user's guide, in the printed example, the RLC_Circuit is supposed to be compiled by simply calling the name file, but in practice the only way to make it work is by passing the whole path from C:\JModelica.org... ? – leoo321 Nov 06 '18 at 21:26
  • Could it be that this issue because on my PC I also have OpenModelica installed ? – leoo321 Nov 06 '18 at 21:29

1 Answers1

0

Have a look at RLC.py in install/Python{_64}/pyjmi/examples. There you can see how to add the path to the .mo file in compile_fmu.

are
  • 58
  • 5
  • Thank you. In that example RLC.py, the absolute path to the file is passed as the second argument to compile_fmu. I wanted to figure out how to add the path of a file to the MODELICAPATH so that any file can be passed just by the sole filename (without explicitly passing the whole path). – leoo321 Nov 08 '18 at 09:48