Skip to main content

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

Test

The tests for Co-Simulation and ModelExchange in test_fmuAdapter.py don’t work together yet and have to be called separately (by commenting out the respective other one in @pytest.mark.parametrize(“fmi_type,fmu_dir”).

The FMU for the test is based on https://github.com/qtronic/fmusdk.

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='dp',
                    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')

Getting help

If you need help, please visit the mosaik-users mailing list .

Changelog

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

Authors

The adapter was initially developed by Cornelius Steinbrink and updated and extended by Thomas Raub and Jan Sören Schwarz.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mosaik_fmi-0.2.tar.gz (14.2 kB view hashes)

Uploaded Source

Built Distribution

mosaik_fmi-0.2-py3-none-any.whl (15.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page