|
1 | | -# mdreader 📖 |
2 | | - |
3 | | -A Python library for reading and parsing Functional Mock-up Interface (FMI 2.0 and 3.0) model description XML files into Pydantic models. |
4 | | - |
5 | | -[](https://badge.fury.io/py/mdreader) |
6 | | - |
7 | | -## Installation 📦 |
8 | | - |
9 | | -Add `mdreader` to your `pyproject.toml` with `uv` with: |
10 | | - |
11 | | -``` bash |
12 | | -uv add mdreader |
13 | | -``` |
14 | | - |
15 | | -> To install `uv`, see https://docs.astral.sh/uv/getting-started/installation/ |
16 | | -
|
17 | | -## How to use 🚀 |
18 | | - |
19 | | -To read and parse an FMI model description (works for both 2.0 and 3.0): |
20 | | - |
21 | | -```python |
22 | | -import mdreader.fmi2 as fmi2 |
23 | | -import mdreader.fmi3 as fmi3 |
24 | | - |
25 | | -# Read from XML file |
26 | | -md = fmi2.read_model_description("path/to/fmi2/modelDescription.xml") # or fmi3.read_model_description for 3.0 |
27 | | -# Read from FMU archive |
28 | | -md = fmi2.read_model_description("path/to/model.fmu") # or fmi3.read_model_description for 3.0 |
29 | | - |
30 | | -# Read from unzipped FMU directory |
31 | | -md = fmi2.read_model_description("path/to/unzipped/fmu/directory") # or fmi3.read_model_description for 3.0 |
32 | | - |
33 | | -print(md) |
34 | | -``` |
35 | | - |
36 | | -## Features ✨ |
37 | | - |
38 | | -- Parse FMI 2.0 and 3.0 model description XML files |
39 | | -- Read model information from FMU archives |
40 | | -- Access model metadata (name, version, author, GUID, etc.) |
41 | | -- Extract variable definitions (real, integer, boolean, string, enumeration, clock, binary) |
42 | | -- Access unit definitions and type definitions |
43 | | -- Support for Model Exchange, Co-Simulation, and Scheduled Execution interfaces |
44 | | -- Parse model structure, dependencies, and experiment configurations |
45 | | -- Full support for FMI 3.0 features including structural parameters, clock variables, and directional derivatives |
46 | | - |
47 | | -## Why another FMI model description reader? 🤔 |
48 | | - |
49 | | -* **Lightweight**: mdreader only depends on Pydantic |
50 | | -* **De/Serialization**: Pydantic models support easy serialization to/from JSON, dict, etc. |
51 | | -* **Validation**: mdreader uses Pydantic models to ensure the integrity of the parsed data |
52 | | -* **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 |
53 | | - |
54 | | -## Related projects 🔗 |
55 | | - |
56 | | -* [fmpy](https://github.com/CATIA-Systems/FMPy): A similar `read_model_description` function is available in FMPy, but it uses custom classes instead of Pydantic models and has more dependencies. |
57 | | - |
58 | | -## Licensing 📄 |
59 | | - |
60 | | -The code in this project is licensed under MIT license. |
61 | | -See the [LICENSE](LICENSE) file for details. |
| 1 | +Project is renamed to fmureader and moved to https://github.com/time-integral/fmureader |
0 commit comments