Adapter for FMUs (ME or CS) in mosaik
Project description
This mosaik-fmi adapter allows to couple FMUs, which are based on the FMI standard (https://fmi-standard.org) with mosaik.
Installation
mosaik-fmi is based on the FMI++ library, which can be found at https://fmipp.sourceforge.io/
The FMI++ python interface is used, which can be found at https://github.com/AIT-IES/py-fmipp. See this page also for details about installation and requirements of the python interface.
Test
The FMUs for the test is based on https://github.com/modelica/Reference-FMUs.
How to Use
Specify simulator configurations within your scenario script:
sim_config = { 'FMI': { 'python': 'mosaik_fmi.mosaik_fmi:FmuAdapter', }, ... }
Initialize the FMU Simulator:
fmu_sim = world.start('FMI', integrator='integratorCK', work_dir='path/to/the/fmu/directory', fmu_name='FMU_name', fmi_version='2', fmi_type='cs', logging_on=False, instance_name='FMU_name', step_size=60*60)
Instantiate FMU model entity:
fmu_entity = fmu_sim.FMU_name.create(1, input_1=1.0, # FMU input variable input_2=2.0, # All variables are listed in modelDescription.xml ... )
Connect FMU output to another simulator’s input:
world.connect(fmu_entity[0], other_simulator,'fmu_output_1', 'simulator_input_1')
Selecting integrator
Refer to https://fmipp.readthedocs.io/projects/py-fmipp/en/latest/getting-started/model-exchange.html#classes-fmumodelexchangev1-and-fmumodelexchangev2 for choosing different integration algorithms
Getting help
If you need help, please visit the mosaik-users mailing list .
Changelog
1.0 – 2023-06-14
New: add test cases to test FMI v1 and v2
Fix: model identifier parsing fixed for FMI v1
Update: use fmipp.export.fmippex instead of fmipp
0.2 – 2022-02-23
Fix: FMI model identifier instead of model name needed to create FMU using fmipp
0.1 – 2020-08-14
Initial release
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file mosaik_fmi-1.0.tar.gz
.
File metadata
- Download URL: mosaik_fmi-1.0.tar.gz
- Upload date:
- Size: 6.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fcb8db73b14c5e5648a9a83477da1058f22bf711921c452f14f927e3055c3322 |
|
MD5 | 03e18c13160270effbb539ed46fb2f3a |
|
BLAKE2b-256 | 89df8819e27e6dbaf53e44f8236b620876638e075611665220b174c7c5d14738 |
File details
Details for the file mosaik_fmi-1.0-py3-none-any.whl
.
File metadata
- Download URL: mosaik_fmi-1.0-py3-none-any.whl
- Upload date:
- Size: 7.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 690328413ba5b4a430c010902fd4f8d7d34c25eff72b2482b09f72a9f9fdb154 |
|
MD5 | d823406fb9b105099be031cfefad15ad |
|
BLAKE2b-256 | 5825f498300d799d32be00515e13adef692c51e23f7aab90327d130182fd5fe0 |