1 Star 0 Fork 0

陈伟 / FMPy

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
CC-BY-4.0

Build Status PyPI Conda Read the Docs

FMPy

FMPy is a free Python library to simulate Functional Mock-up Units (FMUs) that...

Installation

Several options are available:

  • Install with conda: conda install -c conda-forge fmpy
  • Install with from PyPI: python -m pip install fmpy[complete]
  • Install a development build

If you don't have Python on your machine you can install Miniforge.

Start the Graphical User Interface

You can start the FMPy GUI with python -m fmpy.gui

FMPy GUI

Simulate an FMU in Python

To follow this example download Rectifier.fmu for your platform by clicking on the respective link: Linux, macOS, Windows. Change to the folder where you've saved the FMU and open a Python prompt.

>>> from fmpy import *
>>> fmu = 'Rectifier.fmu'
>>> dump(fmu)  # get information

Model Info

  FMI Version       2.0
  Model Name        Rectifier
  Description       Model Rectifier
  Platforms         win64
  Continuous States 4
  Event Indicators  6
  Variables         63
  Generation Tool   MapleSim (1267140/1267140/1267140)
  Generation Date   2017-10-04T12:07:10Z

Default Experiment

  Stop Time         0.1
  Step Size         1e-07

Variables (input, output)

Name                Causality          Start Value  Unit     Description
outputs             output        282.842712474619  V        Rectifier1.Capacitor1.v
>>> result = simulate_fmu(fmu)         # simulate the FMU
>>> from fmpy.util import plot_result  # import the plot function
>>> plot_result(result)                # plot two variables

Rectifier Result

Simulate an FMU on the command line

To get information about an FMU directly from the command line change to the folder where you've saved the FMU and enter

fmpy info Rectifier.fmu

Simulate the FMU and plot the results

fmpy simulate Rectifier.fmu --show-plot

Get more information about the available options

fmpy --help

Create a Jupyter Notebook

To create a Jupyter Notebook open an FMU in the FMPy GUI and select Tools > Create Jupyter Notebook... or run

fmpy create-jupyter-notebook Rectifier.fmu

on the command line and open the notebook in Jupyter with

jupyter notebook Rectifier.ipynb

Web App

Start the Web App

The FMPy Web App is built with Dash and a great way to share your FMUs with anyone that has a web browser. To start it run

python -m fmpy.webapp Rectifier.fmu

on the command line or use --help for more options.

Web App

Advanced Usage

To learn more about how to use FMPy in you own scripts take a look at the coupled_clutches.py, custom_input.py and parameter_variation.py examples.

Commercial 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.


© 2023 Dassault Systèmes

FMPy ==== FMPy is released under the 2-Clause BSD license: Copyright (c) 2017-2023 Dassault Systemes. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Icons ===== The icons and materials included in the project are released under the Creative Commons Attribution 4.0 International Public License (CC BY 4.0) available on https://creativecommons.org/licenses/by/4.0/. Some icons are based on Bootstrap Icons (https://github.com/twbs/icons) released under the MIT license (https://github.com/twbs/icons/blob/main/LICENSE). Some icons are based on Font Awesome Free Icons (https://github.com/twbs/icons) released under the CC BY 4.0 License (https://creativecommons.org/licenses/by/4.0/). FMI Header and Model Description Schema files ================================================== FMPy contains a copy of the FMI header and model description schema files that are available from http://fmi-standard.org/downloads/ and subject to the following licence. Copyright © 2008-2011 MODELISAR consortium, 2012-2013 Modelica Association Project "FMI" All rights reserved. ---------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ---------------------------------------------------------------------------- with the extension: You may distribute or publicly perform any modification only under the terms of this license. (Note, this means that if you distribute a modified file, the modified file must also be provided under this license). SUNDIALS ======== FMPy contains a compiled version of the CVODE solver that is part of SUNDIALS available from http://computation.llnl.gov/projects/sundials and subject to the following licence. Copyright (c) 2002-2016, Lawrence Livermore National Security. Produced at the Lawrence Livermore National Laboratory. Written by A.C. Hindmarsh, D.R. Reynolds, R. Serban, C.S. Woodward, S.D. Cohen, A.G. Taylor, S. Peles, L.E. Banks, and D. Shumaker. LLNL-CODE-667205 (ARKODE) UCRL-CODE-155951 (CVODE) UCRL-CODE-155950 (CVODES) UCRL-CODE-155952 (IDA) UCRL-CODE-237203 (IDAS) LLNL-CODE-665877 (KINSOL) All rights reserved. This file is part of SUNDIALS. For details, see http://computation.llnl.gov/projects/sundials Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the disclaimer below. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the disclaimer (as noted below) in the documentation and/or other materials provided with the distribution. 3. Neither the name of the LLNS/LLNL nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL SECURITY, LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Additional BSD Notice --------------------- 1. This notice is required to be provided under our contract with the U.S. Department of Energy (DOE). This work was produced at Lawrence Livermore National Laboratory under Contract No. DE-AC52-07NA27344 with the DOE. 2. Neither the United States Government nor Lawrence Livermore National Security, LLC nor any of their employees, makes any warranty, express or implied, or assumes any liability or responsibility for the accuracy, completeness, or usefulness of any information, apparatus, product, or process disclosed, or represents that its use would not infringe privately-owned rights. 3. Also, reference herein to any specific commercial products, process, or services by trade name, trademark, manufacturer or otherwise does not necessarily constitute or imply its endorsement, recommendation, or favoring by the United States Government or Lawrence Livermore National Security, LLC. The views and opinions of authors expressed herein do not necessarily state or reflect those of the United States Government or Lawrence Livermore National Security, LLC, and shall not be used for advertising or product endorsement purposes.

简介

github FMPy库同步 展开 收起
Python 等 5 种语言
CC-BY-4.0
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/chentt05/FMPy.git
git@gitee.com:chentt05/FMPy.git
chentt05
FMPy
FMPy
main

搜索帮助

344bd9b3 5694891 D2dac590 5694891