FMPy | Simulate Functional Mockup Units in Python

 by   CATIA-Systems Python Version: 0.3.21 License: Non-SPDX

kandi X-RAY | FMPy Summary

kandi X-RAY | FMPy Summary

FMPy is a Python library typically used in Simulation applications. FMPy has no bugs, it has no vulnerabilities, it has build file available and it has low support. However FMPy has a Non-SPDX License. You can install using 'pip install FMPy' or download it from GitHub, PyPI.

FMPy is a free Python library to simulate Functional Mock-up Units (FMUs) that...
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              FMPy has a low active ecosystem.
              It has 298 star(s) with 102 fork(s). There are 27 watchers for this library.
              There were 1 major release(s) in the last 6 months.
              There are 71 open issues and 432 have been closed. On average issues are closed in 5 days. There are 2 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of FMPy is 0.3.21

            kandi-Quality Quality

              FMPy has 0 bugs and 0 code smells.

            kandi-Security Security

              FMPy has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              FMPy code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              FMPy has a Non-SPDX License.
              Non-SPDX licenses can be open source with a non SPDX compliant license, or non open source licenses, and you need to review them closely before use.

            kandi-Reuse Reuse

              FMPy releases are available to install and integrate.
              Deployable package is available in PyPI.
              Build file is available. You can build the component from source.
              Installation instructions, examples and code snippets are available.
              FMPy saves you 6010 person hours of effort in developing the same functionality from scratch.
              It has 15059 lines of code, 550 functions and 106 files.
              It has high code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of FMPy
            Get all kandi verified functions for this library.

            FMPy Key Features

            No Key Features are available at this moment for FMPy.

            FMPy Examples and Code Snippets

            No Code Snippets are available at this moment for FMPy.

            Community Discussions

            QUESTION

            Modelica model and its fmu give different results for the same input
            Asked 2021-Jul-05 at 07:31

            I have a simple motor model in Modelica which gives expected velocity output when run in Dymola for constant voltage. But when I export it as a co-simulation fmu (with Dymola's dassl solver) it gives different answer in other environments like fmpy and Simulink.

            ...

            ANSWER

            Answered 2021-Jul-05 at 07:31

            I think the root of the issue is the implementation of the state-space equations. The posted equations use a delay operator within a continuous system. As far as I understand, this is not correct.

            The continuous version should be

            Source https://stackoverflow.com/questions/68200816

            QUESTION

            Purpose of cswrapper code, sundials solver in FMPy
            Asked 2021-Apr-06 at 09:38

            About FMPy which is a python package for FMU simulation. I need one clarification : What is the purpose of cswrapper code, sundials solver or functions? Is it only required for ModelExchange type FMU simulation and not for Co-simulation type FMU simulation? https://github.com/CATIA-Systems/FMPy

            ...

            ANSWER

            Answered 2021-Apr-06 at 09:38

            With the cswrapper code you can "wrap" a ME FMU as a CS FMU by adding a (sundials) solver, see https://github.com/CATIA-Systems/FMPy/issues/127. So you get from a ME a CS FMU. Additionally, the CVODE solver can be used to simulate ME FMUs in fmpy.

            Source https://stackoverflow.com/questions/66950331

            QUESTION

            How to co-simulate fmu with a Python function?
            Asked 2021-Feb-26 at 13:59

            With Python libraries like FMPy I am able to simulate fmus (using fmpy.simulate_fmu) for given start_time and stop_time. In such case, the function simulate_fmu completes the simulation and return the time-series results.

            However, I want to create a closed loop between fmu and a Python function (i.e. in a Python script initialize the fmu, get the results from fmu after every 0.1s and based on that update the input value to the fmu for the next timestep). Is there a way to achieve this using existing libraries like fmpy or pyfmi?

            ...

            ANSWER

            Answered 2021-Feb-05 at 15:26

            The short answer is yes the tools you mention are set up to do what you are asking.

            A long answer can be found for FMPy:

            But the gist is to perform changes during simulation like you are asking the approach you want you need to go a layer deeper than simulate_fmu and use doStep and associated setup. The functions/approach needed for these are defined by the FMI standard while highler level implmentations like simulate_fmu are not and are therefore tool dependent implementations of the standard.

            The cliff notes are:

            • Prep the Simulation Inputs
              • e.g., unzip the FMU, define simulation setup, and instantiate the FMU

            Source https://stackoverflow.com/questions/66051450

            QUESTION

            Unable to find out which FMU has error in fmpy
            Asked 2020-Sep-17 at 11:17

            I simulated a batch of 5 FMUs by putting a function containing the fmpy simulate in a loop. 4 of them simulate correctly. The fifth one due to a wrong parameter shows an error.

            My question is, is there any way to find out in which FMU the error comes during simulation

            Ideally the output should look like: FMU1: OK FMU2: OK FMI3: 'Error' and so on

            ...

            ANSWER

            Answered 2020-Sep-17 at 11:17

            You can catch the exception and return the status message together with the result like so

            Source https://stackoverflow.com/questions/63154366

            QUESTION

            How to handle unit conversions while interacting with FMUs?
            Asked 2020-Apr-11 at 08:46

            I have a python script that filters and lists the parameters, their units and default values from a fmu using the read_model_description function from FMPy library and writes in an excel sheet (related discussion). Then using the simulate_fmu function the script simulates the fmu and writes the results with units back in the excel sheet.

            In filtering the parameters and output variable, I use this line to get their units.
            unit = variable.declaredType.unit if hasattr(variable.declaredType,'unit') else '-'

            While interacting with the fmu, the parameter and variable values are in default SI units. I guess this is according to the FMI standard. However, in the modelDescription.xml under I see that there is information regarding the default SI unit to displayUnit conversion. For example:

            ...

            ANSWER

            Answered 2020-Apr-11 at 08:46

            In the FMPy source I did not find any place where unit conversion is implemented.

            But all the relevant information is read in model_description.py.

            The display unit information ends up in modelDescription.unitDefinitions. E.g. to convert a value val = 1.013e5 # Pa to all defined display units, the following might work:

            Source https://stackoverflow.com/questions/61150900

            QUESTION

            Is there a way to list of parameters of FMU (or of submodel in FMU) using the python libraries FMPy or pyFMI?
            Asked 2020-Mar-03 at 20:05

            I have a FMU of a model and the use case is to change parameter values of the FMU to see the impact on the results. Is there a way to list top level parameters of the FMU using either FMPy or pyFMI if I dont' have access to the Modelica model?

            One of the process I have been following is to open the FMU using FMPy.gui and go through the list of parameters and then use them in the script but I would like to know if there an easier way of doing it so that I can list then in the Jupyter notebook and change the parameters as needed?

            ...

            ANSWER

            Answered 2020-Mar-02 at 19:10

            In FMI there is no distinction between top level parameters and other parameters. To list all available parameters in the model using PyFMI (FMI 2.0):

            Source https://stackoverflow.com/questions/60492290

            QUESTION

            fmi2GetFMUState/fmi2SetFMUState supported for Matlab/OpenModelica generated FMUs?
            Asked 2020-Jan-12 at 07:51

            I am trying to test a simple fmu to save and restore the states.

            For example openmodelica:

            ...

            ANSWER

            Answered 2020-Jan-12 at 07:51

            With respect to fmi2GetFMUstate/fmi2SetFMUstate, the FMI Specification, section 2.1.8. states:

            These functions are only supported by the FMU, if the optional capability flag in the XML file is explicitly set to true (see sections 3.3.1 and 4.3.1).

            You can unzip the fmu file and take a look at the modelDescription.xml file to find out if the flag is set: If it is false or not set all, the get and set functions are not supported.

            Source https://stackoverflow.com/questions/59691189

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install FMPy

            Several options are available:. If you don't have Python on your machine you can install Anaconda Python.
            Install with conda: conda install -c conda-forge fmpy
            Install with from PyPI: python -m pip install fmpy[complete]
            Install a development build

            Support

            You're starting a project, need training or professional support? Our partners at LTX Simulation are ready to help you. Please send an e-mail to support@ltx.de for a quote. © 2020 Dassault Systèmes.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            Install
          • PyPI

            pip install FMPy

          • CLONE
          • HTTPS

            https://github.com/CATIA-Systems/FMPy.git

          • CLI

            gh repo clone CATIA-Systems/FMPy

          • sshUrl

            git@github.com:CATIA-Systems/FMPy.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link