Giter VIP home page Giter VIP logo

Comments (8)

hyumo avatar hyumo commented on August 23, 2024

In order to run the FMU in a certain platform, it must be exported with the corresponding platform binary or with source code (optional). Details could be found here in the FMI standard: https://fmi-standard.org/docs/2.0.1-develop/#_fmu_distribution

If you are using windows, I guess it is just because the FMU is only exported with 64 bit binary without source code, however, your python environment is in 32 bit. See a solved issue #49

Disclaimer: I am not a developer of fmpy

from fmpy.

chrbertsch avatar chrbertsch commented on August 23, 2024

(generally for such general questions on FMI, Stack overflow might be a better place to ask)
Please provide more information:

  • Which versions of tools are you using (32bit/64bit)?
  • Could you please attach the FMU?
  • Do you use a ME/CS FMU? FMI 1.0 or 2.0?

The error message looks like you are trying to import an FMU with 64bit binaries only into a 32bit Python/fmpy.

In order to support import of source Code FMUs, the tools need to define the files to be compiled, see p 67 of the FMI 2.0 specification https://svn.modelica.org/fmi/branches/public/specifications/v2.0/FMI_for_ModelExchange_and_CoSimulation_v2.0.pdf . This does not seem to be the case in the case of the FMU exported by OpenModelica. fmpy only claims to run source code FMUs exported from Dymola, but might to so also for FMUs by other tools if they provide the necessary information.

Disclaimer: I am not a developer of fmpy

from fmpy.

fa1247 avatar fa1247 commented on August 23, 2024

Thank you for your reply. The FMU is exported with source code. In the dump(fmu), it said the platform is c-code and I can see all the .c and .h file within the fmu file. If the FMU is exported with binary I think there should be a dll file but there isn't.
image
image

from fmpy.

t-sommer avatar t-sommer commented on August 23, 2024

The dump() function determines the supported platforms based on the contents of the FMU. If the source files are not specified in the modelDescription.xml it's not a valid C-code FMU.

See FMI 2.0 Spec, 2.3 FMU Distribution:

All C source file names that need to be defined in a compiler directive have to be defined in the xml-file under structure and

The easiest way to simulate the FMU is to install a 64-bit Python, e.g. Anaconda.

from fmpy.

fa1247 avatar fa1247 commented on August 23, 2024

Thank you for your replies.
I followed your instructions but still failed.

My test environment is as follows:
Lenevo laptop;
Windows 10 1809 64-bit;
Python 3.6.5 32-bit (Anaconda) and Python 3.6.5 64-bit(Miniconda) installed in different folders;
FMU file generated from the same model by openmodelica 32-bit and 64-bit.

As the ticket says. FMU file should be the same-bit as the software that generating it.

I have tried all four combinations (32FMU-32Python; 32-64; 64-64; 64-32 ). Every time I got the same error "Exception: The current platform (win32/64) is not supported by the FMU."

I think 64-bit FMU generated by 64-bit openmodelica should work in 64-bit Python. Maybe there is some dissonance between openmodelica and FMPy.

These are two FMU files, I don't how to share them efficiently.
FMU files google drive

from fmpy.

chrbertsch avatar chrbertsch commented on August 23, 2024

The FMUs you uploaded to not contain a "binaries" folder, so the do not contain any binaries for win32 or win64 nor any other binaries. This is a problem of creating FMUs from OpenModelica, not of importing and simulating them with fmpy.

from fmpy.

t-sommer avatar t-sommer commented on August 23, 2024

You claim that

The fmu file works fine in Matlab 2018

Did you actually test it with the files you provided?

from fmpy.

fa1247 avatar fa1247 commented on August 23, 2024

Sorry for the wrong report bug.

I installed too many versions of nigntly build OpenModelica during the test. In a previous version, the FMU export feature works fine. But after a point in time, this feature broke and the files generated are broken too. It's a bug in OM. I reinstall the stable 64-bit version OM and everything works.

Thank you again for your precious time.

PS: the URL in download_test_file() seems outdated.

from fmpy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.