modelica 0.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- modelica/__init__.py +21 -0
- modelica/py.typed +0 -0
- modelica-0.0.1.dist-info/METADATA +106 -0
- modelica-0.0.1.dist-info/RECORD +6 -0
- modelica-0.0.1.dist-info/WHEEL +4 -0
- modelica-0.0.1.dist-info/licenses/LICENSE +21 -0
modelica/__init__.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"""Pure-Python Modelica toolchain: parse, flatten, simulate, exchange.
|
|
2
|
+
|
|
3
|
+
The package is layered, and each layer is usable without the ones above it:
|
|
4
|
+
|
|
5
|
+
* ``modelica.lang`` -- Modelica source -> tokens -> AST (hand-written lexer/parser).
|
|
6
|
+
* ``modelica.ir`` -- AST -> flat model: variables, equations, an expression IR;
|
|
7
|
+
then matching/BLT sorting and index reduction down to a solvable system.
|
|
8
|
+
* ``modelica.sim`` -- the flat model as an ODE/DAE problem plus solver backends and
|
|
9
|
+
event (zero-crossing) handling.
|
|
10
|
+
* ``modelica.fmi`` -- FMI 3.0: read/simulate an existing FMU, and export a flat model
|
|
11
|
+
as one.
|
|
12
|
+
* ``modelica.ssp`` -- SSP 2.0: system composition (.ssd/.ssv/.ssb inside a .ssp) and a
|
|
13
|
+
co-simulation master over the components it names.
|
|
14
|
+
|
|
15
|
+
``import modelica`` pulls in no third-party dependency; numerics live behind the ``sim``
|
|
16
|
+
extra so that tooling which only reads model *structure* stays cheap to install.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
__version__ = "0.0.1"
|
|
20
|
+
|
|
21
|
+
__all__ = ["__version__"]
|
modelica/py.typed
ADDED
|
File without changes
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: modelica
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Pure-Python Modelica toolchain: parse, flatten, simulate, and exchange via FMI 3.0 and SSP 2.0
|
|
5
|
+
Project-URL: Homepage, https://gitlab.com/jorgeecardona/pymodelica
|
|
6
|
+
Project-URL: Repository, https://gitlab.com/jorgeecardona/pymodelica
|
|
7
|
+
Project-URL: Changelog, https://gitlab.com/jorgeecardona/pymodelica/-/blob/main/CHANGELOG.md
|
|
8
|
+
Project-URL: Documentation, https://jorgeecardona.gitlab.io/pymodelica/
|
|
9
|
+
Author-email: Jorge Cardona <jorgeecardona@gmail.com>
|
|
10
|
+
License-Expression: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: co-simulation,dae,digital-twin,fmi,fmu,modelica,simulation,ssp,system-modeling
|
|
13
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: Operating System :: MacOS
|
|
16
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Topic :: Scientific/Engineering
|
|
22
|
+
Classifier: Typing :: Typed
|
|
23
|
+
Requires-Python: >=3.11
|
|
24
|
+
Provides-Extra: docs
|
|
25
|
+
Requires-Dist: mkdocs-material>=9.5; extra == 'docs'
|
|
26
|
+
Requires-Dist: mkdocs>=1.6; extra == 'docs'
|
|
27
|
+
Provides-Extra: sim
|
|
28
|
+
Requires-Dist: numpy>=2.0; extra == 'sim'
|
|
29
|
+
Requires-Dist: scipy>=1.13; extra == 'sim'
|
|
30
|
+
Provides-Extra: sundials
|
|
31
|
+
Requires-Dist: scikit-sundae>=1.0; extra == 'sundials'
|
|
32
|
+
Description-Content-Type: text/markdown
|
|
33
|
+
|
|
34
|
+
# modelica
|
|
35
|
+
|
|
36
|
+
A pure-Python Modelica toolchain: **parse** Modelica, **flatten** it to a DAE, **simulate**
|
|
37
|
+
it, and interoperate with the two Modelica Association exchange standards — **FMI 3.0**
|
|
38
|
+
for single components and **SSP 2.0** for systems of them.
|
|
39
|
+
|
|
40
|
+
> Distribution name is `modelica`; the git repo keeps its historical name `pymodelica`.
|
|
41
|
+
> (PyPI's `pymodelica` is held by an abandoned Modelon/JModelica.org upload.)
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
pip install modelica # core: parse + model structure, zero dependencies
|
|
45
|
+
pip install "modelica[sim]" # + numpy/scipy for simulation
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Status
|
|
49
|
+
|
|
50
|
+
Pre-alpha. This is a **full rewrite** of a 2010 Python 2 experiment — none of that code
|
|
51
|
+
survives, only the goal. Python 3.11+.
|
|
52
|
+
|
|
53
|
+
## Why
|
|
54
|
+
|
|
55
|
+
The Python side of Modelica is split: [FMPy](https://github.com/CATIA-Systems/FMPy) and
|
|
56
|
+
[PyFMI](https://github.com/modelon-community/PyFMI) *consume* FMUs that some other tool
|
|
57
|
+
compiled, and the tools that actually compile Modelica (Dymola, OpenModelica, JModelica)
|
|
58
|
+
are large non-Python programs. Nothing in Python takes Modelica source all the way to a
|
|
59
|
+
running simulation, and nothing treats the model — flat equations, the incidence structure,
|
|
60
|
+
the index — as an ordinary Python data structure you can inspect and rewrite.
|
|
61
|
+
|
|
62
|
+
That gap is the project: a readable, dependency-light implementation where every stage is a
|
|
63
|
+
value you can hold.
|
|
64
|
+
|
|
65
|
+
## Layers
|
|
66
|
+
|
|
67
|
+
Each layer is usable without the ones above it.
|
|
68
|
+
|
|
69
|
+
| Module | Does |
|
|
70
|
+
| --- | --- |
|
|
71
|
+
| `modelica.lang` | Modelica source → tokens → AST (hand-written lexer/parser, positions carried for diagnostics) |
|
|
72
|
+
| `modelica.ir` | AST → flat model (variables, equations, expression IR), then matching / BLT sorting / index reduction |
|
|
73
|
+
| `modelica.sim` | flat model → ODE/DAE problem, solver backends, event (zero-crossing) handling |
|
|
74
|
+
| `modelica.fmi` | FMI 3.0 — read and simulate an FMU; export a flat model as one |
|
|
75
|
+
| `modelica.ssp` | SSP 2.0 — `.ssd`/`.ssv`/`.ssb` inside a `.ssp`, and a co-simulation master over the components |
|
|
76
|
+
|
|
77
|
+
See [the architecture notes](docs/architecture.md) for the data model and the order things
|
|
78
|
+
get built in.
|
|
79
|
+
|
|
80
|
+
## Development
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
make install-hooks # once after cloning: pre-commit (auto version bump + ruff), pre-push (full check)
|
|
84
|
+
make check # lint + typecheck + test, exactly what CI gates on
|
|
85
|
+
make docs # build the mkdocs site strictly
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
The toolchain is pinned in `.prototools` (moon + uv) — `proto install` brings up
|
|
89
|
+
everything. All task ordering lives in `moon.yml`; CI is a single `moon run :ci`.
|
|
90
|
+
|
|
91
|
+
## Releasing
|
|
92
|
+
|
|
93
|
+
There is no manual release step. `pyproject.toml`'s `version` is the single source of
|
|
94
|
+
truth:
|
|
95
|
+
|
|
96
|
+
* the pre-commit hook auto-bumps the patch version whenever `src/**/*.py` changes;
|
|
97
|
+
* `scripts/ci-version-guard` fails the pipeline if shipped source moved without a bump
|
|
98
|
+
(the non-bypassable counterpart);
|
|
99
|
+
* on `main`, `moon run :release` publishes to PyPI **only if that version isn't there
|
|
100
|
+
yet**, via GitLab OIDC Trusted Publishing — no API token is stored anywhere.
|
|
101
|
+
|
|
102
|
+
Docs are published to GitLab Pages from the same pipeline.
|
|
103
|
+
|
|
104
|
+
## License
|
|
105
|
+
|
|
106
|
+
MIT © Jorge Cardona
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
modelica/__init__.py,sha256=FrTYlgAimTOlrPajKHYRF6QRK5yJguqurEQf9Glz7-I,978
|
|
2
|
+
modelica/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
+
modelica-0.0.1.dist-info/METADATA,sha256=4Qdx074A_oKOqpCYAPzR_IzDqz4AATlG6iFqGnRurUc,4585
|
|
4
|
+
modelica-0.0.1.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
|
|
5
|
+
modelica-0.0.1.dist-info/licenses/LICENSE,sha256=6dP7w8m4xJH1IQumkEnTTCY4BJO16jnKEG-xPIj9y90,1070
|
|
6
|
+
modelica-0.0.1.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Jorge Cardona
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|