Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to use new versions of Dymola? #37

Open
alfoa opened this issue Mar 2, 2021 · 2 comments
Open

how to use new versions of Dymola? #37

alfoa opened this issue Mar 2, 2021 · 2 comments

Comments

@alfoa
Copy link

alfoa commented Mar 2, 2021

in the new versions of dymola (2020, 2021) there is no "dymola" in the bin folder.
How can I modify SimulatorToFMU to make an use of the new Dymola?
Andrea

@alfoa
Copy link
Author

alfoa commented Mar 3, 2021

I tried to modify SimulatorToFMU.py in order to use the "Dymola.exe".
It goes on for a while till the export of the FMU where the foolowing error is raised:

Missing base class Modelica.Blocks.Interfaces.BlockIcon
File: C:/Users/ALFOA/projects/raven/test_turbine_fmi/GTTProm.mo, line 1
Context: GTTProm

Component type specifier SimulatorToFMU.Python37.Functions.BaseClasses.PythonObject not found
File: C:/Users/ALFOA/projects/raven/test_turbine_fmi/GTTProm.mo, line 23
Component context: obj
Component declared as SimulatorToFMU.Python37.Functions.BaseClasses.PythonObject obj in GTTProm

ERRORS have been issued.

Any clue?

@alfoa
Copy link
Author

alfoa commented Mar 3, 2021

This is the screen output:

$ python  /c/Users/ALFOA/AppData/Roaming/Python/Python37/site-packages/simulatortofmu/parser/SimulatorToFMU.py -s GTTProm_wrapper.py -cf config.txt -i SimulatorModelDescription.xml -t dymola -pv 37
WARNING:root:Path to the installation folder of tool=dymola was not specified. Make sure that the tool is on the system path otherwise compilation will fail.
INFO:root:FMI version not specified. Version 2.0 will be used.
INFO:root:FMI API not specified. Model Exchange (me) API will be used.
INFO:root:Print Modelica model
INFO:root:SimulatorModelDescription.xml is a valid XML document.
INFO:root:Invalid characters will be removed from the model name=GTTProm.
INFO:root:The new model name is GTTProm.
INFO:root:Declare the Python module name as GTTProm_wrapper.
INFO:root:Invalid characters will be removed from the variable name SES_Demand.
INFO:root:The new variable name is SES_Demand.
INFO:root:Invalid characters will be removed from the variable name SES.generator.P_flow.
INFO:root:The new variable name is SES_generator_P_flow.
INFO:root:Check for duplicates in input, output and parameter variable names.
INFO:root:Parsing of SimulatorModelDescription.xml was successfull.
WARNING:root:The output file GTTProm.mo exists and will be overwritten.
INFO:root:The Modelica model GTTProm.mo of GTTProm is successfully created.
INFO:root:The Modelica model GTTProm.mo of GTTProm is in C:\Users\ALFOA\projects\raven\test_turbine_fmi.
INFO:root:Generate FMU
INFO:root:The FMU GTTProm.fmu is successfully created.
INFO:root:The FMU GTTProm.fmu is in C:\Users\ALFOA\projects\raven\test_turbine_fmi.
INFO:root:Create scripts folder
INFO:root:Create the folder Simulator.scripts with scripts to be added to the PYTHONPATH.
INFO:root:Create binaries folder
INFO:root:Create the folder Simulator.binaries with binaries to be added to the system PATH.
INFO:root:C:\Users\ALFOA\AppData\Roaming\Python\Python37\site-packages\simulatortofmu\parser\libraries\modelica\SimulatorToFMU\Resources\Library\win32\SimulatorToFMUPython37.dll will be copied to the binaries folder GTTProm.binaries.tmp\win32.
INFO:root:C:\Users\ALFOA\AppData\Roaming\Python\Python37\site-packages\simulatortofmu\parser\libraries\modelica\SimulatorToFMU\Resources\Library\win32\python37.dll will be copied to the binaries folder GTTProm.binaries.tmp\win32.
INFO:root:C:\Users\ALFOA\AppData\Roaming\Python\Python37\site-packages\simulatortofmu\parser\libraries\modelica\SimulatorToFMU\Resources\Library\win64\SimulatorToFMUPython37.dll will be copied to the binaries folder GTTProm.binaries.tmp\win64.
INFO:root:C:\Users\ALFOA\AppData\Roaming\Python\Python37\site-packages\simulatortofmu\parser\libraries\modelica\SimulatorToFMU\Resources\Library\win64\python37.dll will be copied to the binaries folder GTTProm.binaries.tmp\win64.
INFO:root:Clean temporary files
INFO:root:Rewrite FMU
============Exporting scripts=['C:\\\\Users\\\\ALFOA\\\\projects\\\\raven\\\\test_turbine_fmi\\\\GTTProm_wrapper.py'] as Functional Mock-up Unit. API=me, Version=2, Export Tool=dymola
ScalarVariables=[{'name': 'SES_Demand', 'vartype': 'Real', 'causality': 'input', 'unit': 'W', 'description': 'Demand Load', 'start': '0.0', 'annotation': ' annotation(Placement(transformation(extent={{-122,68},{-100,90}})))'}, {'name': 'SES_generator_P_flow', 'vartype': 'Real', 'causality': 'output', 'unit': 'W', 'description': 'Power', 'annotation': ' annotation(Placement(transformation(extent={{100,70},{120,90}})))'}]
Dymola.exe O2NRUG_GTTProm.mos
Traceback (most recent call last):
  File "C:/Users/ALFOA/AppData/Roaming/Python/Python37/site-packages/simulatortofmu/parser/SimulatorToFMU.py", line 1626, in <module>
    main()
  File "C:/Users/ALFOA/AppData/Roaming/Python/Python37/site-packages/simulatortofmu/parser/SimulatorToFMU.py", line 563, in main
    Simulator.rewrite_fmu()
  File "C:/Users/ALFOA/AppData/Roaming/Python/Python37/site-packages/simulatortofmu/parser/SimulatorToFMU.py", line 1525, in rewrite_fmu
    shutil.copy2(fmu_name, fmutmp)
  File "C:\Users\ALFOA\AppData\Local\Continuum\miniconda3\lib\shutil.py", line 266, in copy2
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "C:\Users\ALFOA\AppData\Local\Continuum\miniconda3\lib\shutil.py", line 120, in copyfile
    with open(src, 'rb') as fsrc:
FileNotFoundError: [Errno 2] No such file or directory: 'GTTProm.fmu'

If fails here but it looks like the reason is that the fmu is never created

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant