pymoca 0.9.1__tar.gz → 0.9.2.dev0__tar.gz
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.
- {pymoca-0.9.1 → pymoca-0.9.2.dev0}/MANIFEST.in +0 -1
- pymoca-0.9.2.dev0/PKG-INFO +128 -0
- pymoca-0.9.2.dev0/java/antlr-4.13.1-complete.jar +0 -0
- pymoca-0.9.2.dev0/pyproject.toml +66 -0
- {pymoca-0.9.1 → pymoca-0.9.2.dev0}/setup.cfg +1 -8
- pymoca-0.9.2.dev0/setup.py +11 -0
- pymoca-0.9.2.dev0/src/pymoca/__init__.py +2 -0
- {pymoca-0.9.1 → pymoca-0.9.2.dev0}/src/pymoca/_version.py +4 -4
- {pymoca-0.9.1 → pymoca-0.9.2.dev0}/src/pymoca/backends/casadi/api.py +4 -2
- pymoca-0.9.2.dev0/src/pymoca/generated/ModelicaLexer.py +454 -0
- {pymoca-0.9.1 → pymoca-0.9.2.dev0}/src/pymoca/generated/ModelicaListener.py +4 -2
- {pymoca-0.9.1 → pymoca-0.9.2.dev0}/src/pymoca/generated/ModelicaParser.py +660 -621
- {pymoca-0.9.1 → pymoca-0.9.2.dev0}/src/pymoca/generated/ModelicaVisitor.py +2 -2
- pymoca-0.9.2.dev0/src/pymoca.egg-info/PKG-INFO +128 -0
- {pymoca-0.9.1 → pymoca-0.9.2.dev0}/src/pymoca.egg-info/SOURCES.txt +2 -2
- pymoca-0.9.2.dev0/src/pymoca.egg-info/requires.txt +23 -0
- pymoca-0.9.1/PKG-INFO +0 -48
- pymoca-0.9.1/java/antlr-4.7-complete.jar +0 -0
- pymoca-0.9.1/setup.py +0 -147
- pymoca-0.9.1/src/pymoca/__init__.py +0 -4
- pymoca-0.9.1/src/pymoca/generated/ModelicaLexer.py +0 -507
- pymoca-0.9.1/src/pymoca.egg-info/PKG-INFO +0 -48
- pymoca-0.9.1/src/pymoca.egg-info/requires.txt +0 -25
- pymoca-0.9.1/versioneer.py +0 -1822
- {pymoca-0.9.1 → pymoca-0.9.2.dev0}/LICENSE +0 -0
- {pymoca-0.9.1 → pymoca-0.9.2.dev0}/README.md +0 -0
- {pymoca-0.9.1 → pymoca-0.9.2.dev0}/doc/.gitignore +0 -0
- {pymoca-0.9.1 → pymoca-0.9.2.dev0}/doc/Makefile +0 -0
- {pymoca-0.9.1 → pymoca-0.9.2.dev0}/doc/make.bat +0 -0
- {pymoca-0.9.1 → pymoca-0.9.2.dev0}/doc/source/modules.rst +0 -0
- {pymoca-0.9.1 → pymoca-0.9.2.dev0}/doc/source/pymoca.generated.rst +0 -0
- {pymoca-0.9.1 → pymoca-0.9.2.dev0}/doc/source/pymoca.rst +0 -0
- {pymoca-0.9.1 → pymoca-0.9.2.dev0}/doc/source/setup.rst +0 -0
- {pymoca-0.9.1 → pymoca-0.9.2.dev0}/src/pymoca/Modelica.g4 +0 -0
- {pymoca-0.9.1 → pymoca-0.9.2.dev0}/src/pymoca/ast.py +0 -0
- {pymoca-0.9.1 → pymoca-0.9.2.dev0}/src/pymoca/backends/__init__.py +0 -0
- {pymoca-0.9.1 → pymoca-0.9.2.dev0}/src/pymoca/backends/casadi/__init__.py +0 -0
- {pymoca-0.9.1 → pymoca-0.9.2.dev0}/src/pymoca/backends/casadi/_options.py +0 -0
- {pymoca-0.9.1 → pymoca-0.9.2.dev0}/src/pymoca/backends/casadi/alias_relation.py +0 -0
- {pymoca-0.9.1 → pymoca-0.9.2.dev0}/src/pymoca/backends/casadi/generator.py +0 -0
- {pymoca-0.9.1 → pymoca-0.9.2.dev0}/src/pymoca/backends/casadi/model.py +0 -0
- {pymoca-0.9.1 → pymoca-0.9.2.dev0}/src/pymoca/backends/casadi/mtensor.py +0 -0
- {pymoca-0.9.1 → pymoca-0.9.2.dev0}/src/pymoca/backends/sympy/__init__.py +0 -0
- {pymoca-0.9.1 → pymoca-0.9.2.dev0}/src/pymoca/backends/sympy/generator.py +0 -0
- {pymoca-0.9.1 → pymoca-0.9.2.dev0}/src/pymoca/backends/sympy/runtime.py +0 -0
- {pymoca-0.9.1 → pymoca-0.9.2.dev0}/src/pymoca/backends/xml/__init__.py +0 -0
- {pymoca-0.9.1 → pymoca-0.9.2.dev0}/src/pymoca/backends/xml/analysis.py +0 -0
- {pymoca-0.9.1 → pymoca-0.9.2.dev0}/src/pymoca/backends/xml/generator.py +0 -0
- {pymoca-0.9.1 → pymoca-0.9.2.dev0}/src/pymoca/backends/xml/model.py +0 -0
- {pymoca-0.9.1 → pymoca-0.9.2.dev0}/src/pymoca/backends/xml/parser.py +0 -0
- {pymoca-0.9.1 → pymoca-0.9.2.dev0}/src/pymoca/backends/xml/sim_scipy.py +0 -0
- {pymoca-0.9.1 → pymoca-0.9.2.dev0}/src/pymoca/generated/__init__.py +0 -0
- {pymoca-0.9.1 → pymoca-0.9.2.dev0}/src/pymoca/parser.py +0 -0
- {pymoca-0.9.1 → pymoca-0.9.2.dev0}/src/pymoca/tree.py +0 -0
- {pymoca-0.9.1 → pymoca-0.9.2.dev0}/src/pymoca.egg-info/dependency_links.txt +0 -0
- {pymoca-0.9.1 → pymoca-0.9.2.dev0}/src/pymoca.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: pymoca
|
|
3
|
+
Version: 0.9.2.dev0
|
|
4
|
+
Summary: A Modelica to computer algebra system (CAS) translator.
|
|
5
|
+
Author: Pymoca Contributors
|
|
6
|
+
Maintainer-email: Jack Vreeken <jack@vreeken.me>, Kent Rutan <gs1150e@icloud.com>
|
|
7
|
+
License: Copyright (c) 2016-2021, James Goppert and the Pymoca contributors.
|
|
8
|
+
All rights reserved.
|
|
9
|
+
|
|
10
|
+
Redistribution and use in source and binary forms, with or without
|
|
11
|
+
modification, are permitted provided that the following conditions are met:
|
|
12
|
+
|
|
13
|
+
* Redistributions of source code must retain the above copyright notice, this
|
|
14
|
+
list of conditions and the following disclaimer.
|
|
15
|
+
|
|
16
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
17
|
+
this list of conditions and the following disclaimer in the documentation
|
|
18
|
+
and/or other materials provided with the distribution.
|
|
19
|
+
|
|
20
|
+
* Neither the name of pymoca nor the names of its
|
|
21
|
+
contributors may be used to endorse or promote products derived from
|
|
22
|
+
this software without specific prior written permission.
|
|
23
|
+
|
|
24
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
25
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
26
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
27
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
28
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
29
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
30
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
31
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
32
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
33
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
Project-URL: homepage, https://github.com/pymoca/pymoca
|
|
37
|
+
Keywords: modelica,simulation,compiler
|
|
38
|
+
Classifier: Development Status :: 3 - Alpha
|
|
39
|
+
Classifier: Intended Audience :: Science/Research
|
|
40
|
+
Classifier: Intended Audience :: Developers
|
|
41
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
42
|
+
Classifier: Programming Language :: Python
|
|
43
|
+
Classifier: Programming Language :: Python :: 3
|
|
44
|
+
Classifier: Programming Language :: Other
|
|
45
|
+
Classifier: Topic :: Software Development
|
|
46
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
47
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
48
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
49
|
+
Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
50
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
51
|
+
Classifier: Operating System :: POSIX
|
|
52
|
+
Classifier: Operating System :: Unix
|
|
53
|
+
Classifier: Operating System :: MacOS
|
|
54
|
+
Classifier: Topic :: Software Development :: Code Generators
|
|
55
|
+
Classifier: Topic :: Software Development :: Compilers
|
|
56
|
+
Classifier: Topic :: Software Development :: Embedded Systems
|
|
57
|
+
Requires-Python: >=3.9
|
|
58
|
+
Description-Content-Type: text/markdown
|
|
59
|
+
License-File: LICENSE
|
|
60
|
+
Requires-Dist: numpy>=1.8.2
|
|
61
|
+
Requires-Dist: antlr4-python3-runtime==4.13.*
|
|
62
|
+
Provides-Extra: casadi
|
|
63
|
+
Requires-Dist: casadi>=3.4.0; extra == "casadi"
|
|
64
|
+
Requires-Dist: setuptools>=60.0.0; extra == "casadi"
|
|
65
|
+
Provides-Extra: lxml
|
|
66
|
+
Requires-Dist: lxml>=3.5.0; extra == "lxml"
|
|
67
|
+
Requires-Dist: scipy>=0.13.3; extra == "lxml"
|
|
68
|
+
Provides-Extra: sympy
|
|
69
|
+
Requires-Dist: sympy>=0.7.6.1; extra == "sympy"
|
|
70
|
+
Requires-Dist: scipy>=0.13.3; extra == "sympy"
|
|
71
|
+
Requires-Dist: jinja2>=2.10.1; extra == "sympy"
|
|
72
|
+
Provides-Extra: examples
|
|
73
|
+
Requires-Dist: jupyterlab; extra == "examples"
|
|
74
|
+
Requires-Dist: matplotlib; extra == "examples"
|
|
75
|
+
Requires-Dist: control<=0.10.0,>=0.9.3.post2; extra == "examples"
|
|
76
|
+
Provides-Extra: all
|
|
77
|
+
Requires-Dist: pymoca[casadi,examples,lxml,sympy]; extra == "all"
|
|
78
|
+
|
|
79
|
+
# <img alt="Pymoca" src="branding/icons/pymocalogo.svg" height="60">
|
|
80
|
+
|
|
81
|
+
A Modelica to computer algebra system (CAS) compiler written in python.
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
[](https://github.com/pymoca/pymoca/actions?query=workflow%3ACI)
|
|
85
|
+
[](https://codecov.io/gh/pymoca/pymoca)
|
|
86
|
+
[](https://zenodo.org/badge/latestdoi/20664755)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
## Install
|
|
90
|
+
|
|
91
|
+
Python / PyPI:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
pip install pymoca
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Anaconda / Conda:
|
|
98
|
+
1. Install anaconda 3.
|
|
99
|
+
|
|
100
|
+
2. Setup environment.
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
./create_conda_env.sh enduser
|
|
104
|
+
. activate pymoca
|
|
105
|
+
jupyter notebook
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Examples
|
|
109
|
+
* [Sympy Example](test/notebooks/Spring.ipynb)
|
|
110
|
+
* [Casadi Example](test/notebooks/Casadi.ipynb)
|
|
111
|
+
* [ModelicaXML Example](test/notebooks/XML.ipynb)
|
|
112
|
+
|
|
113
|
+
## Roadmap
|
|
114
|
+
|
|
115
|
+
### Completed Tasks
|
|
116
|
+
|
|
117
|
+
* Parsing Modelica
|
|
118
|
+
* Sympy Simulation/CAS creation for simple models
|
|
119
|
+
* Casadi CAS creation for simple models
|
|
120
|
+
|
|
121
|
+
### TODO
|
|
122
|
+
|
|
123
|
+
* Gather requirements and unify Casadi model
|
|
124
|
+
* Lazy parsing for reading large libraries
|
|
125
|
+
* Support more of Modelica language elements
|
|
126
|
+
|
|
127
|
+
<!--- vim:ts=4:sw=4:expandtab:
|
|
128
|
+
!-->
|
|
Binary file
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools", "versioneer[toml]==0.29"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "pymoca"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
license = { file = "LICENSE" }
|
|
9
|
+
description = "A Modelica to computer algebra system (CAS) translator."
|
|
10
|
+
keywords = ["modelica", "simulation", "compiler"]
|
|
11
|
+
readme = "README.md"
|
|
12
|
+
authors = [{ name = "Pymoca Contributors" }]
|
|
13
|
+
maintainers = [
|
|
14
|
+
{ name = "Jack Vreeken", email = "jack@vreeken.me" },
|
|
15
|
+
{ name = "Kent Rutan", email = "gs1150e@icloud.com" },
|
|
16
|
+
]
|
|
17
|
+
requires-python = ">=3.9"
|
|
18
|
+
dependencies = ["numpy >= 1.8.2", "antlr4-python3-runtime == 4.13.*"]
|
|
19
|
+
classifiers = [
|
|
20
|
+
"Development Status :: 3 - Alpha",
|
|
21
|
+
"Intended Audience :: Science/Research",
|
|
22
|
+
"Intended Audience :: Developers",
|
|
23
|
+
"License :: OSI Approved :: BSD License",
|
|
24
|
+
"Programming Language :: Python",
|
|
25
|
+
"Programming Language :: Python :: 3",
|
|
26
|
+
"Programming Language :: Other",
|
|
27
|
+
"Topic :: Software Development",
|
|
28
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
29
|
+
"Topic :: Scientific/Engineering :: Mathematics",
|
|
30
|
+
"Topic :: Scientific/Engineering :: Physics",
|
|
31
|
+
"Topic :: Scientific/Engineering :: Visualization",
|
|
32
|
+
"Operating System :: Microsoft :: Windows",
|
|
33
|
+
"Operating System :: POSIX",
|
|
34
|
+
"Operating System :: Unix",
|
|
35
|
+
"Operating System :: MacOS",
|
|
36
|
+
"Topic :: Software Development :: Code Generators",
|
|
37
|
+
"Topic :: Software Development :: Compilers",
|
|
38
|
+
"Topic :: Software Development :: Embedded Systems",
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
[project.urls]
|
|
42
|
+
homepage = "https://github.com/pymoca/pymoca"
|
|
43
|
+
|
|
44
|
+
[project.optional-dependencies]
|
|
45
|
+
# Note that we need setuptools for the distutils.ccompiler dependency
|
|
46
|
+
# in the CasADi backend.
|
|
47
|
+
casadi = ["casadi>=3.4.0", "setuptools>=60.0.0"]
|
|
48
|
+
lxml = ["lxml>=3.5.0", "scipy>=0.13.3"]
|
|
49
|
+
sympy = ["sympy>=0.7.6.1", "scipy>=0.13.3", "jinja2>=2.10.1"]
|
|
50
|
+
examples = ["jupyterlab", "matplotlib", "control>=0.9.3.post2,<=0.10.0"]
|
|
51
|
+
all = ["pymoca[casadi,lxml,sympy,examples]"]
|
|
52
|
+
|
|
53
|
+
# TODO: Uncomment this when moving away from versioneer.
|
|
54
|
+
# [tool.setuptools.dynamic]
|
|
55
|
+
# version = { attr = "pymoca.__version__" }
|
|
56
|
+
|
|
57
|
+
# See the docstring in versioneer.py for instructions. Note that after changing
|
|
58
|
+
# this section, run `versioneer install --no-vendor`, commit the results.
|
|
59
|
+
|
|
60
|
+
[tool.versioneer]
|
|
61
|
+
VCS = "git"
|
|
62
|
+
style = "pep440"
|
|
63
|
+
versionfile_source = "src/pymoca/_version.py"
|
|
64
|
+
versionfile_build = "pymoca/_version.py"
|
|
65
|
+
tag_prefix = ""
|
|
66
|
+
parentdir_prefix = "pymoca-"
|
|
@@ -1,14 +1,6 @@
|
|
|
1
1
|
[metadata]
|
|
2
2
|
license_file = LICENSE
|
|
3
3
|
|
|
4
|
-
[versioneer]
|
|
5
|
-
VCS = git
|
|
6
|
-
style = pep440
|
|
7
|
-
versionfile_source = src/pymoca/_version.py
|
|
8
|
-
versionfile_build = pymoca/_version.py
|
|
9
|
-
tag_prefix =
|
|
10
|
-
parentdir_prefix = pymoca-
|
|
11
|
-
|
|
12
4
|
[flake8]
|
|
13
5
|
max-line-length = 99
|
|
14
6
|
exclude =
|
|
@@ -31,6 +23,7 @@ exclude =
|
|
|
31
23
|
src/pymoca/backends/casadi/alias_relation.py,
|
|
32
24
|
src/pymoca/backends/sympy/generator.py,
|
|
33
25
|
src/pymoca/backends/sympy/runtime.py,
|
|
26
|
+
src/pymoca/backends/xml/generator.py,
|
|
34
27
|
src/pymoca/tree.py,
|
|
35
28
|
src/pymoca/ast.py,
|
|
36
29
|
src/pymoca/ast.py,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
# This file was generated by 'versioneer.py' (0.
|
|
2
|
+
# This file was generated by 'versioneer.py' (0.29) from
|
|
3
3
|
# revision-control system data, or from the parent directory name of an
|
|
4
4
|
# unpacked source archive. Distribution tarballs contain a pre-generated copy
|
|
5
5
|
# of this file.
|
|
@@ -8,11 +8,11 @@ import json
|
|
|
8
8
|
|
|
9
9
|
version_json = '''
|
|
10
10
|
{
|
|
11
|
-
"date": "
|
|
11
|
+
"date": "2025-01-10T23:53:24+0100",
|
|
12
12
|
"dirty": false,
|
|
13
13
|
"error": null,
|
|
14
|
-
"full-revisionid": "
|
|
15
|
-
"version": "0.9.
|
|
14
|
+
"full-revisionid": "ae3e226fc72a8db2e7e4a847b2c5d5a89faf08b1",
|
|
15
|
+
"version": "0.9.2.dev0"
|
|
16
16
|
}
|
|
17
17
|
''' # END VERSION_JSON
|
|
18
18
|
|
|
@@ -140,8 +140,10 @@ def _codegen_model(model_folder: str, f: ca.Function, library_name: str):
|
|
|
140
140
|
compiler_flags = ['-O2', '-fPIC']
|
|
141
141
|
linker_flags = ['-fPIC']
|
|
142
142
|
else:
|
|
143
|
-
|
|
144
|
-
|
|
143
|
+
# Shut up unused local variable warnings, and use workaround for
|
|
144
|
+
# NaN-constantness bug in recent Windows SDK versions.
|
|
145
|
+
compiler_flags = ["/O2", "/wd4101", "/D_UCRT_NOISY_NAN"]
|
|
146
|
+
linker_flags = ["/DLL"]
|
|
145
147
|
|
|
146
148
|
# Generate C code
|
|
147
149
|
logger.debug("Generating {}".format(library_name))
|