Skip to main content

FMI/FMU co-simulation toolbox for PathSim

Project description

FMI/FMU co-simulation toolbox for PathSim

PyPI License

HomepageDocumentationGitHub


PathSim-FMI extends the PathSim simulation framework with block wrappers around the Functional Mock-up Interface (FMI 2.0 / 3.0). Drop an .fmu file into a PathSim simulation as either a co-simulation slave or as a model-exchange system driven by PathSim's own integrators. Built on top of FMPy.

Blocks

Block Description Key Parameters
CoSimulationFMU Wrap a Co-Simulation FMU, advanced on a fixed grid dt via fmi*DoStep fmu_path, dt, start_values
ModelExchangeFMU Wrap a Model-Exchange FMU, integrated by PathSim's solver of choice fmu_path, start_values
FMUWrapper Lower-level version-agnostic wrapper around FMPy (FMI 2.0 / 3.0) fmu_path

Install

pip install pathsim-fmi

In the PathView web app: install fails on purpose (the FMU runtime needs to load a native binary via ctypes, which Pyodide can't provide). Use the standalone PathView desktop app or any local Python environment.

Quick Example

from pathsim import Simulation, Connection
from pathsim.blocks import Scope
from pathsim_fmi import ModelExchangeFMU

fmu = ModelExchangeFMU("VanDerPol.fmu")
sco = Scope(labels=["x0", "x1"], sampling_period=0.02)

sim = Simulation(
    blocks=[fmu, sco],
    connections=[
        Connection(fmu[0], sco[0]),
        Connection(fmu[1], sco[1]),
    ],
    dt=0.01,
)
sim.run(5.0)
sco.plot()

Development

pip install -e ".[test]" fmpy ruff mypy
ruff check src/ tests/      # lint
ruff format src/ tests/     # format
mypy src/pathsim_fmi        # type check
pytest tests/ -v            # run tests

The test suite uses the official Modelica Reference-FMUs under tests/data/reference/ for portable smoke tests, plus a handful of legacy FMUs (under tests/data/) carried over from pathsim-core. The legacy FMUs ship darwin64 binaries that are x86_64 only, so the corresponding tests are auto-skipped on Apple Silicon; CI on Linux runs the full suite.

License

MIT

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

pathsim_fmi-0.1.0.tar.gz (3.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pathsim_fmi-0.1.0-py3-none-any.whl (12.9 kB view details)

Uploaded Python 3

File details

Details for the file pathsim_fmi-0.1.0.tar.gz.

File metadata

  • Download URL: pathsim_fmi-0.1.0.tar.gz
  • Upload date:
  • Size: 3.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pathsim_fmi-0.1.0.tar.gz
Algorithm Hash digest
SHA256 966f0ed09ab581a5c7634e6e6f4d6b80468626a2f6481ec3eca7234fdda547b2
MD5 5be8f99771f1a73b1a0ad682154f38fd
BLAKE2b-256 025daa219c387b94a91fae4cb27ac19a324e11a53295ad5e1dce44c96715114c

See more details on using hashes here.

Provenance

The following attestation bundles were made for pathsim_fmi-0.1.0.tar.gz:

Publisher: publish.yml on pathsim/pathsim-fmi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pathsim_fmi-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pathsim_fmi-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pathsim_fmi-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a224bd69ea0523e9111f0efbbf15985d10405e2c370b9e6ea9234c7671a2bedf
MD5 cc207ea329624cf95f2f9add1b877e1f
BLAKE2b-256 81a877fd31fc65fe796130ae9d58bd768ed87f3f8148f910d18fc805b9370cc0

See more details on using hashes here.

Provenance

The following attestation bundles were made for pathsim_fmi-0.1.0-py3-none-any.whl:

Publisher: publish.yml on pathsim/pathsim-fmi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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