Skip to content

PyFMI is a package for loading and interacting with Functional Mock-Up Units (FMUs) both for Model Exchange and Co-Simulation, which are compiled dynamic models compliant with the Functional Mock-Up Interface (FMI)

License

Notifications You must be signed in to change notification settings

fmi-tools/PyFMI

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About

PyFMI is a package for loading and interacting with Functional Mock-Up Units (FMUs) both for Model Exchange and Co-Simulation, which are compiled dynamic models compliant with the Functional Mock-Up Interface (FMI).

For a more indebt technical description of the features / functionality see the following link.

For citing PyFMI, please use:

Andersson, C, Åkesson, J & Führer, C 2016, PyFMI: A Python Package for Simulation of Coupled Dynamic Models with the Functional Mock-up Interface. Technical Report in Mathematical Sciences, nr. 2, vol. 2016, vol. LUTFNA-5008-2016, Centre for Mathematical Sciences, Lund University.

Contributing

For information about contributing, see https://github.com/modelon-community/contributing.

Installation from source

PyFMI can be built and installed from source, note this requires FMI library. Additional details are found in the file setup.py.

python setup.py install --fmil-home=/path/to/FMI_Library/

Here the flag "--fmil-home" points to where FMI Library is installed. The Python package Assimulo needs to be installed in order to build from source.

Installation using CONDA

conda install -c conda-forge pyfmi

Note that some examples requires optional dependencies for plotting, they are:

  • wxPython
  • matplotlib

FMU Import Compliance

PyFMI is tested daily in several different ways:

  • Extensive external testing within the Optimica Compiler Toolkit (OCT) provided by Modelon using all models in Modelon Modelica libraries (7000+ models), exported as FMUs.
  • Unit tests from the tests directory. These use FMUs generated by
    • OCT
    • JModelica.org
    • FMUs in the example directory are generated via FMU SDK by Qtronic, more information is available in related README.txt for these FMUs with proper license text.
  • PyFMI is the default execution engine for Modelon Impact.
  • Testing with FMUs from FMI Cross Check and commit 55c6704:
    • All the win64 Dymola FMUs have been tested with PyFMI 2.11.0 and pass with default options.
    • On Ubuntu 20.04 using Python 3.9, PyFMI 2.11.0, the following FMUs pass (95 out of 116):
      • fmus/2.0/me/linux64/MapleSim/2015.1/ControlledTemperature/ControlledTemperature.fmu
      • fmus/2.0/me/linux64/MapleSim/2015.1/CoupledClutches/CoupledClutches.fmu
      • fmus/2.0/me/linux64/MapleSim/2015.1/Rectifier/Rectifier.fmu
      • fmus/2.0/me/linux64/MapleSim/2015.2/ControlledTemperature/ControlledTemperature.fmu
      • fmus/2.0/me/linux64/MapleSim/2015.2/CoupledClutches/CoupledClutches.fmu
      • fmus/2.0/me/linux64/MapleSim/2015.2/Rectifier/Rectifier.fmu
      • fmus/2.0/me/linux64/MapleSim/2016.1/ControlledTemperature/ControlledTemperature.fmu
      • fmus/2.0/me/linux64/MapleSim/2016.1/CoupledClutches/CoupledClutches.fmu
      • fmus/2.0/me/linux64/MapleSim/2016.1/Rectifier/Rectifier.fmu
      • fmus/2.0/me/linux64/MapleSim/2016.2/ControlledTemperature/ControlledTemperature.fmu
      • fmus/2.0/me/linux64/MapleSim/2016.2/CoupledClutches/CoupledClutches.fmu
      • fmus/2.0/me/linux64/MapleSim/2016.2/Rectifier/Rectifier.fmu
      • fmus/2.0/me/linux64/MapleSim/2018/ControlledTemperature/ControlledTemperature.fmu
      • fmus/2.0/me/linux64/MapleSim/2018/CoupledClutches/CoupledClutches.fmu
      • fmus/2.0/me/linux64/MapleSim/2018/Rectifier/Rectifier.fmu
      • fmus/2.0/me/linux64/MapleSim/2019/ControlledTemperature/ControlledTemperature.fmu
      • fmus/2.0/me/linux64/MapleSim/2019/CoupledClutches/CoupledClutches.fmu
      • fmus/2.0/me/linux64/MapleSim/2019/Rectifier/Rectifier.fmu
      • fmus/2.0/me/linux64/MapleSim/2021.1/ControlledTemperature/ControlledTemperature.fmu
      • fmus/2.0/me/linux64/MapleSim/2021.1/CoupledClutches/CoupledClutches.fmu
      • fmus/2.0/me/linux64/MapleSim/2021.1/Rectifier/Rectifier.fmu
      • fmus/2.0/me/linux64/MapleSim/2021.2/ControlledTemperature/ControlledTemperature.fmu
      • fmus/2.0/me/linux64/MapleSim/2021.2/CoupledClutches/CoupledClutches.fmu
      • fmus/2.0/me/linux64/MapleSim/2021.2/Rectifier/Rectifier.fmu
      • fmus/2.0/me/linux64/MapleSim/7.01/ControlledTemperature/ControlledTemperature.fmu
      • fmus/2.0/me/linux64/solidThinking_Activate/2020/ActivateRC/ActivateRC.fmu
      • fmus/2.0/me/linux64/solidThinking_Activate/2020/Arenstorf/Arenstorf.fmu
      • fmus/2.0/me/linux64/solidThinking_Activate/2020/Boocwen/Boocwen.fmu
      • fmus/2.0/me/linux64/solidThinking_Activate/2020/CVloop/CVloop.fmu (simulated with Radau5ODE instead of CVode)
      • fmus/2.0/me/linux64/solidThinking_Activate/2020/Pendulum/Pendulum.fmu
      • fmus/2.0/me/linux64/SystemModeler/5.0/ControlledTemperature/ControlledTemperature.fmu
      • fmus/2.0/me/linux64/SystemModeler/5.0/CoupledClutches/CoupledClutches.fmu
      • fmus/2.0/me/linux64/Test-FMUs/0.0.1/BouncingBall/BouncingBall.fmu
      • fmus/2.0/me/linux64/Test-FMUs/0.0.1/Dahlquist/Dahlquist.fmu
      • fmus/2.0/me/linux64/Test-FMUs/0.0.1/Feedthrough/Feedthrough.fmu
      • fmus/2.0/me/linux64/Test-FMUs/0.0.1/Resource/Resource.fmu
      • fmus/2.0/me/linux64/Test-FMUs/0.0.1/Stair/Stair.fmu
      • fmus/2.0/me/linux64/Test-FMUs/0.0.1/VanDerPol/VanDerPol.fmu
      • fmus/2.0/me/linux64/Test-FMUs/0.0.2/BouncingBall/BouncingBall.fmu
      • fmus/2.0/me/linux64/Test-FMUs/0.0.2/Dahlquist/Dahlquist.fmu
      • fmus/2.0/me/linux64/Test-FMUs/0.0.2/Feedthrough/Feedthrough.fmu
      • fmus/2.0/me/linux64/Test-FMUs/0.0.2/Resource/Resource.fmu
      • fmus/2.0/me/linux64/Test-FMUs/0.0.2/Stair/Stair.fmu
      • fmus/2.0/me/linux64/Test-FMUs/0.0.2/VanDerPol/VanDerPol.fmu
      • fmus/2.0/cs/linux64/20sim/4.6.4.8004/TorsionBar/TorsionBar.fmu
      • fmus/2.0/cs/linux64/EDALab_HIFSuite/2017.05_antlia/b01/b01.fmu
      • fmus/2.0/cs/linux64/EDALab_HIFSuite/2017.05_antlia/des56_original/des56_original.fmu
      • fmus/2.0/cs/linux64/EDALab_HIFSuite/2017.05_antlia/m6502/m6502.fmu
      • fmus/2.0/cs/linux64/EDALab_HIFSuite/2017.05_antlia/uart/uart.fmu
      • fmus/2.0/cs/linux64/MapleSim/2015.1/ControlledTemperature/ControlledTemperature.fmu
      • fmus/2.0/cs/linux64/MapleSim/2015.1/CoupledClutches/CoupledClutches.fmu
      • fmus/2.0/cs/linux64/MapleSim/2015.1/Rectifier/Rectifier.fmu
      • fmus/2.0/cs/linux64/MapleSim/2015.2/ControlledTemperature/ControlledTemperature.fmu
      • fmus/2.0/cs/linux64/MapleSim/2015.2/CoupledClutches/CoupledClutches.fmu
      • fmus/2.0/cs/linux64/MapleSim/2015.2/Rectifier/Rectifier.fmu
      • fmus/2.0/cs/linux64/MapleSim/2016.1/ControlledTemperature/ControlledTemperature.fmu
      • fmus/2.0/cs/linux64/MapleSim/2016.1/CoupledClutches/CoupledClutches.fmu
      • fmus/2.0/cs/linux64/MapleSim/2016.1/Rectifier/Rectifier.fmu
      • fmus/2.0/cs/linux64/MapleSim/2016.2/ControlledTemperature/ControlledTemperature.fmu
      • fmus/2.0/cs/linux64/MapleSim/2016.2/CoupledClutches/CoupledClutches.fmu
      • fmus/2.0/cs/linux64/MapleSim/2016.2/Rectifier/Rectifier.fmu
      • fmus/2.0/cs/linux64/MapleSim/2018/ControlledTemperature/ControlledTemperature.fmu
      • fmus/2.0/cs/linux64/MapleSim/2018/CoupledClutches/CoupledClutches.fmu
      • fmus/2.0/cs/linux64/MapleSim/2018/Rectifier/Rectifier.fmu
      • fmus/2.0/cs/linux64/MapleSim/2019/ControlledTemperature/ControlledTemperature.fmu
      • fmus/2.0/cs/linux64/MapleSim/2019/CoupledClutches/CoupledClutches.fmu
      • fmus/2.0/cs/linux64/MapleSim/2019/Rectifier/Rectifier.fmu
      • fmus/2.0/cs/linux64/MapleSim/2021.1/ControlledTemperature/ControlledTemperature.fmu
      • fmus/2.0/cs/linux64/MapleSim/2021.1/CoupledClutches/CoupledClutches.fmu
      • fmus/2.0/cs/linux64/MapleSim/2021.1/Rectifier/Rectifier.fmu
      • fmus/2.0/cs/linux64/MapleSim/2021.2/ControlledTemperature/ControlledTemperature.fmu
      • fmus/2.0/cs/linux64/MapleSim/2021.2/CoupledClutches/CoupledClutches.fmu
      • fmus/2.0/cs/linux64/MapleSim/2021.2/Rectifier/Rectifier.fmu
      • fmus/2.0/cs/linux64/MapleSim/7.01/ControlledTemperature/ControlledTemperature.fmu
      • fmus/2.0/cs/linux64/solidThinking_Activate/2020/ActivateRC/ActivateRC.fmu
      • fmus/2.0/cs/linux64/solidThinking_Activate/2020/Arenstorf/Arenstorf.fmu
      • fmus/2.0/cs/linux64/solidThinking_Activate/2020/Boocwen/Boocwen.fmu
      • fmus/2.0/cs/linux64/solidThinking_Activate/2020/CVloop/CVloop.fmu
      • fmus/2.0/cs/linux64/solidThinking_Activate/2020/DiscreteController/DiscreteController.fmu
      • fmus/2.0/cs/linux64/solidThinking_Activate/2020/Pendulum/Pendulum.fmu
      • fmus/2.0/cs/linux64/Test-FMUs/0.0.1/BouncingBall/BouncingBall.fmu
      • fmus/2.0/cs/linux64/Test-FMUs/0.0.1/Dahlquist/Dahlquist.fmu
      • fmus/2.0/cs/linux64/Test-FMUs/0.0.1/Feedthrough/Feedthrough.fmu
      • fmus/2.0/cs/linux64/Test-FMUs/0.0.1/Resource/Resource.fmu
      • fmus/2.0/cs/linux64/Test-FMUs/0.0.1/Stair/Stair.fmu
      • fmus/2.0/cs/linux64/Test-FMUs/0.0.1/VanDerPol/VanDerPol.fmu
      • fmus/2.0/cs/linux64/Test-FMUs/0.0.2/BouncingBall/BouncingBall.fmu
      • fmus/2.0/cs/linux64/Test-FMUs/0.0.2/Dahlquist/Dahlquist.fmu
      • fmus/2.0/cs/linux64/Test-FMUs/0.0.2/Feedthrough/Feedthrough.fmu
      • fmus/2.0/cs/linux64/Test-FMUs/0.0.2/Resource/Resource.fmu
      • fmus/2.0/cs/linux64/Test-FMUs/0.0.2/Stair/Stair.fmu
      • fmus/2.0/cs/linux64/Test-FMUs/0.0.2/VanDerPol/VanDerPol.fmu
      • fmus/2.0/cs/linux64/YAKINDU_Statechart_Tools/4.0.4/BouncingBall/BouncingBall.fmu
      • fmus/2.0/cs/linux64/YAKINDU_Statechart_Tools/4.0.4/Feedthrough/Feedthrough.fmu
      • fmus/2.0/cs/linux64/YAKINDU_Statechart_Tools/4.0.4/Stairs/Stairs.fmu
    • Those that does not pass are believed to fail due to:
      • Linux compliance issues.
      • AMESim FMUs fail since FMUs that need an execution tool are not supported.
  • Reference FMUs
    • All FMUs pass on both win64 and linux64 (tested on Ubuntu 20.04).

About

PyFMI is a package for loading and interacting with Functional Mock-Up Units (FMUs) both for Model Exchange and Co-Simulation, which are compiled dynamic models compliant with the Functional Mock-Up Interface (FMI)

Topics

Resources

License

Stars

Watchers

Forks

Languages

  • Python 100.0%