OpenModelica / OMSimulator

The OpenModelica FMI & SSP-based co-simulation environment.
Other
67 stars 49 forks source link

FMU not working in OMSimulator with python interface #1283

Closed Primkins closed 3 months ago

Primkins commented 4 months ago

Description

OMSimulator(V2.1.1) with python interface is having issues in reading the FMU created in Openmodelica(V1.23.0) on windows 11 system.

Steps to reproduce the behavior

Create a Step block FMU in Openmodelica (V1.23.0), and try to run in OMSimulator (V2.1.1) with python interface. it fails. Create a Step block FMU in Openmodelica (V1.14.0), and try to run in OMSimulator (V2.1.1) with python interface. it runs.

error: [fmiLogger] module FMICAPI: Could not load the FMU binary: The specified module could not be found.

Screenshots

image

Version and OS

arun3688 commented 4 months ago

@Primkins i guess the latest version of OMSimulator should be OMSimulator v2.1.1.post248, please download the latest nightly builds and test it , it should work

Primkins commented 4 months ago

Pip fails on installing the OMSimulator-V2.1.1.post248 with this URL https://[build.openmodelica.org/omsimulator/nightly/win-msvc64/OMSimulator-win64-v2.1.1.post248-gf7c50c9.zip]. Please share the URL of OMSimulator-V2.1.1.post248.

OMS

It installs OMSimulator-V2.1.1.post190 only.

arun3688 commented 4 months ago

@Primkins ok i see that you are using pip package, the pip package is not updated yet, I will make a new release in pip today

Primkins commented 4 months ago

Is this updated?

arun3688 commented 4 months ago

no not yet, unfortunately I am little bit busy with some works, I will try to fix this week

Primkins commented 4 months ago

OK. Thank you.

arun3688 commented 4 months ago

@Primkins but if you are using OpenModelica you can use the latest OMSimulator from there

Primkins commented 4 months ago

I require OMSimulator for running the FMU from python.

Primkins commented 4 months ago

https://[openmodelica.org](https://openmodelica.org/)/ site is down.

arun3688 commented 4 months ago

@Primkins yes it is down, i guess some server issue, it will be fixed soon

arun3688 commented 4 months ago

@Primkins the site is back online https://openmodelica.org/

Primkins commented 4 months ago

Thank you

Primkins commented 4 months ago

Has this been updated?

arun3688 commented 4 months ago

@Primkins No I am little busy with other works, I will be free in the middle of this week and see if i can fix it, it seems the zip files are not uploaded to server and that is the issue, i need to look into it

Primkins commented 4 months ago

OK. Thank you

adrpo commented 3 months ago

The problem is this: https://github.com/OpenModelica/OpenModelica/issues/11604 and this: https://github.com/OpenModelica/OpenModelica/issues/12065. Try to build the FMU with v1.22.3 or the nightly-build.

adrpo commented 3 months ago

Ah, it might also be that Windows 11 has changed the way it searches for dlls. I think @AnHeuermann has looked into it and fixed it in the fmi4c library but we will need to port that change to OMSimulator.

Primkins commented 3 months ago

OK. Thank you. I will check.

arun3688 commented 3 months ago

@Primkins In the meanwhile the you should get the latest OMSimulator python artifacts from here https://test.openmodelica.org/jenkins/job/OMSimulator/job/master/764/, Currently the artifacts are not uploaded to the server, So please use the attached zip file for the latest OMSimulator python pip package, you must unzip this in the following location lib/site-packages/ to know where the site-package path type the following in a terminal python -m site

(base) c:\juliatest\OMSimulator\OMSimulator>python -m site
sys.path = [
    'c:\\juliatest\\OMSimulator\\OMSimulator',
    'C:\\ProgramData\\Anaconda3\\python38.zip',
    'C:\\ProgramData\\Anaconda3\\DLLs',
    'C:\\ProgramData\\Anaconda3\\lib',
    'C:\\ProgramData\\Anaconda3',
    'C:\\Users\\arupa54\\AppData\\Roaming\\Python\\Python38\\site-packages',
    'C:\\ProgramData\\Anaconda3\\lib\\site-packages',
    'C:\\ProgramData\\Anaconda3\\lib\\site-packages\\certifi-2020.12.5-py3.8.egg',
    'C:\\ProgramData\\Anaconda3\\lib\\site-packages\\ompython-3.5.0-py3.8.egg',
    'C:\\ProgramData\\Anaconda3\\lib\\site-packages\\win32',
    'C:\\ProgramData\\Anaconda3\\lib\\site-packages\\win32\\lib',
    'C:\\ProgramData\\Anaconda3\\lib\\site-packages\\Pythonwin',
]

for me it is C:\\ProgramData\\Anaconda3\\lib\\site-packages and you can unzip it here and it should work i hope

OMSimulator.zip

arun3688 commented 3 months ago

Ah, it might also be that Windows 11 has changed the way it searches for dlls. I think @AnHeuermann has looked into it and fixed it in the fmi4c library but we will need to port that change to OMSimulator.

Yes i will update the submodule

Primkins commented 3 months ago

Installed the OpenModelica-V1.23 nightly build version (OpenModelica-v1.23.0-dev-376-g4df9b45477-64bit.exe) and created the BouncingBall.fmu Copied the OMSimulator folder under python installed location (C:\Python38\Lib\site-packages).

Upon running the bouncing ball fmu from python, below error is displayed

status: [correct] ok status: [correct] ok error: [validateFMU] could not load the ssd schema file: C:/Python38/share/OMSimulator/schema/fmi2/fmi2ModelDescription.xsd error: [terminate] Model "test" is in wrong model state status: [correct] ok Loading DLL failed: D:\TestFMU\test_tmp\test-qc3mkx2u\temp\0001_A\binaries\win64\BouncingBall.dll Failed to load functions for FMI 2.info: fmi2Instantiate() failed Function "fmi2FreeInstance" is not provided by this FMU. info: 0 warnings info: 2 errors

arun3688 commented 3 months ago

@Primkins Submodule OMSimulator is not pushed to OpenModelica master yet, This PR https://github.com/OpenModelica/OMSimulator/pull/1284 got stuck for some unknown reason, Hopefullly this will be fixed by today

arun3688 commented 3 months ago

@Primkins the pip package is fixed now and the latest OMSimulator version is published to pip https://pypi.org/project/OMSimulator/2.1.1.post257/, please update your omsimulator pip package pip install OMSimulator -U and test it and also download the latest openmodelica nightly builds from tomorrow and export the fmu's and hopefully everything should work, I did some testing and it works from my side

Primkins commented 3 months ago

The issue has been resolved. Thanks