Skip to main content

A Python library for reading and parsing Functional Mock-up Interface model description XML file.

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

Project description

mdreader 📖

A Python library for reading and parsing Functional Mock-up Interface (FMI 2.0 and 3.0) model description XML files into Pydantic models.

PyPI version

Installation 📦

Add mdreader to your pyproject.toml with uv with:

uv add mdreader

To install uv, see https://docs.astral.sh/uv/getting-started/installation/

How to use 🚀

To read and parse an FMI model description (works for both 2.0 and 3.0):

import mdreader.fmi2 as fmi2
import mdreader.fmi3 as fmi3

# Read from XML file
md = fmi2.read_model_description("path/to/fmi2/modelDescription.xml")  # or fmi3.read_model_description for 3.0
# Read from FMU archive
md = fmi2.read_model_description("path/to/model.fmu")  # or fmi3.read_model_description for 3.0

# Read from unzipped FMU directory
md = fmi2.read_model_description("path/to/unzipped/fmu/directory")  # or fmi3.read_model_description for 3.0

print(md)

Features ✨

  • Parse FMI 2.0 and 3.0 model description XML files
  • Read model information from FMU archives
  • Access model metadata (name, version, author, GUID, etc.)
  • Extract variable definitions (real, integer, boolean, string, enumeration, clock, binary)
  • Access unit definitions and type definitions
  • Support for Model Exchange, Co-Simulation, and Scheduled Execution interfaces
  • Parse model structure, dependencies, and experiment configurations
  • Full support for FMI 3.0 features including structural parameters, clock variables, and directional derivatives

Why another FMI model description reader? 🤔

  • Lightweight: mdreader only depends on Pydantic
  • De/Serialization: Pydantic models support easy serialization to/from JSON, dict, etc.
  • Validation: mdreader uses Pydantic models to ensure the integrity of the parsed data
  • FMI version specific: The fmi2.FMIModelDescription and fmi3.FMIModelDescription classes are specific to their respective FMI versions (not a mix of versions), making it simpler to use for each version

Related projects 🔗

  • fmpy: A similar read_model_description function is available in FMPy, but it uses custom classes instead of Pydantic models and has more dependencies.

Licensing 📄

The code in this project is licensed under MIT license. See the LICENSE file for details.

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

mdreader-0.3.1.tar.gz (32.7 kB view details)

Uploaded Source

Built Distribution

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

mdreader-0.3.1-py3-none-any.whl (34.4 kB view details)

Uploaded Python 3

File details

Details for the file mdreader-0.3.1.tar.gz.

File metadata

  • Download URL: mdreader-0.3.1.tar.gz
  • Upload date:
  • Size: 32.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for mdreader-0.3.1.tar.gz
Algorithm Hash digest
SHA256 b66d591eea611eee56a7261e0f6515d66ae2a1f16f8eed1ccefef493214e69a6
MD5 5e465d8ef1102e5b61da95af27767c54
BLAKE2b-256 ec645ecc062d24f35732c1b963c11061d7e101c3492e35927bad585ebda1306a

See more details on using hashes here.

File details

Details for the file mdreader-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: mdreader-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 34.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for mdreader-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 434028ba77e27669f611c01e4593ff581bd886722474b24e430d5f352417fce3
MD5 d7b0722c78c225d8a3ac3029aa0c7139
BLAKE2b-256 51b913af9b1795ac5bd1ed6f8822444f18950dbf28aad26706d62d3ede3a885a

See more details on using hashes here.

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