pymoca 0.11.0.dev3__tar.gz → 0.11.0.dev6__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.
Files changed (50) hide show
  1. {pymoca-0.11.0.dev3 → pymoca-0.11.0.dev6}/MANIFEST.in +0 -1
  2. {pymoca-0.11.0.dev3 → pymoca-0.11.0.dev6}/PKG-INFO +6 -7
  3. {pymoca-0.11.0.dev3 → pymoca-0.11.0.dev6}/README.md +4 -5
  4. {pymoca-0.11.0.dev3 → pymoca-0.11.0.dev6}/pyproject.toml +1 -1
  5. pymoca-0.11.0.dev6/src/pymoca/backends/xml/ModelicaXML/schemas/Equation_Statement_separate.xsd +156 -0
  6. pymoca-0.11.0.dev6/src/pymoca/backends/xml/ModelicaXML/schemas/Expression.xsd +129 -0
  7. pymoca-0.11.0.dev6/src/pymoca/backends/xml/ModelicaXML/schemas/Modelica.xsd +38 -0
  8. pymoca-0.11.0.dev6/src/pymoca/backends/xml/ModelicaXML/schemas/Types.xsd +139 -0
  9. {pymoca-0.11.0.dev3 → pymoca-0.11.0.dev6}/src/pymoca.egg-info/PKG-INFO +6 -7
  10. {pymoca-0.11.0.dev3 → pymoca-0.11.0.dev6}/src/pymoca.egg-info/SOURCES.txt +4 -0
  11. {pymoca-0.11.0.dev3 → pymoca-0.11.0.dev6}/LICENSE +0 -0
  12. {pymoca-0.11.0.dev3 → pymoca-0.11.0.dev6}/doc/.gitignore +0 -0
  13. {pymoca-0.11.0.dev3 → pymoca-0.11.0.dev6}/doc/Makefile +0 -0
  14. {pymoca-0.11.0.dev3 → pymoca-0.11.0.dev6}/doc/make.bat +0 -0
  15. {pymoca-0.11.0.dev3 → pymoca-0.11.0.dev6}/doc/source/modules.rst +0 -0
  16. {pymoca-0.11.0.dev3 → pymoca-0.11.0.dev6}/doc/source/pymoca.generated.rst +0 -0
  17. {pymoca-0.11.0.dev3 → pymoca-0.11.0.dev6}/doc/source/pymoca.rst +0 -0
  18. {pymoca-0.11.0.dev3 → pymoca-0.11.0.dev6}/doc/source/setup.rst +0 -0
  19. {pymoca-0.11.0.dev3 → pymoca-0.11.0.dev6}/setup.cfg +0 -0
  20. {pymoca-0.11.0.dev3 → pymoca-0.11.0.dev6}/src/pymoca/Modelica.g4 +0 -0
  21. {pymoca-0.11.0.dev3 → pymoca-0.11.0.dev6}/src/pymoca/__init__.py +0 -0
  22. {pymoca-0.11.0.dev3 → pymoca-0.11.0.dev6}/src/pymoca/_version.py +0 -0
  23. {pymoca-0.11.0.dev3 → pymoca-0.11.0.dev6}/src/pymoca/ast.py +0 -0
  24. {pymoca-0.11.0.dev3 → pymoca-0.11.0.dev6}/src/pymoca/backends/__init__.py +0 -0
  25. {pymoca-0.11.0.dev3 → pymoca-0.11.0.dev6}/src/pymoca/backends/casadi/__init__.py +0 -0
  26. {pymoca-0.11.0.dev3 → pymoca-0.11.0.dev6}/src/pymoca/backends/casadi/_options.py +0 -0
  27. {pymoca-0.11.0.dev3 → pymoca-0.11.0.dev6}/src/pymoca/backends/casadi/alias_relation.py +0 -0
  28. {pymoca-0.11.0.dev3 → pymoca-0.11.0.dev6}/src/pymoca/backends/casadi/api.py +0 -0
  29. {pymoca-0.11.0.dev3 → pymoca-0.11.0.dev6}/src/pymoca/backends/casadi/generator.py +0 -0
  30. {pymoca-0.11.0.dev3 → pymoca-0.11.0.dev6}/src/pymoca/backends/casadi/model.py +0 -0
  31. {pymoca-0.11.0.dev3 → pymoca-0.11.0.dev6}/src/pymoca/backends/casadi/mtensor.py +0 -0
  32. {pymoca-0.11.0.dev3 → pymoca-0.11.0.dev6}/src/pymoca/backends/sympy/__init__.py +0 -0
  33. {pymoca-0.11.0.dev3 → pymoca-0.11.0.dev6}/src/pymoca/backends/sympy/generator.py +0 -0
  34. {pymoca-0.11.0.dev3 → pymoca-0.11.0.dev6}/src/pymoca/backends/sympy/runtime.py +0 -0
  35. {pymoca-0.11.0.dev3 → pymoca-0.11.0.dev6}/src/pymoca/backends/xml/__init__.py +0 -0
  36. {pymoca-0.11.0.dev3 → pymoca-0.11.0.dev6}/src/pymoca/backends/xml/analysis.py +0 -0
  37. {pymoca-0.11.0.dev3 → pymoca-0.11.0.dev6}/src/pymoca/backends/xml/generator.py +0 -0
  38. {pymoca-0.11.0.dev3 → pymoca-0.11.0.dev6}/src/pymoca/backends/xml/model.py +0 -0
  39. {pymoca-0.11.0.dev3 → pymoca-0.11.0.dev6}/src/pymoca/backends/xml/parser.py +0 -0
  40. {pymoca-0.11.0.dev3 → pymoca-0.11.0.dev6}/src/pymoca/backends/xml/sim_scipy.py +0 -0
  41. {pymoca-0.11.0.dev3 → pymoca-0.11.0.dev6}/src/pymoca/generated/ModelicaLexer.py +0 -0
  42. {pymoca-0.11.0.dev3 → pymoca-0.11.0.dev6}/src/pymoca/generated/ModelicaListener.py +0 -0
  43. {pymoca-0.11.0.dev3 → pymoca-0.11.0.dev6}/src/pymoca/generated/ModelicaParser.py +0 -0
  44. {pymoca-0.11.0.dev3 → pymoca-0.11.0.dev6}/src/pymoca/generated/ModelicaVisitor.py +0 -0
  45. {pymoca-0.11.0.dev3 → pymoca-0.11.0.dev6}/src/pymoca/generated/__init__.py +0 -0
  46. {pymoca-0.11.0.dev3 → pymoca-0.11.0.dev6}/src/pymoca/parser.py +0 -0
  47. {pymoca-0.11.0.dev3 → pymoca-0.11.0.dev6}/src/pymoca/tree.py +0 -0
  48. {pymoca-0.11.0.dev3 → pymoca-0.11.0.dev6}/src/pymoca.egg-info/dependency_links.txt +0 -0
  49. {pymoca-0.11.0.dev3 → pymoca-0.11.0.dev6}/src/pymoca.egg-info/requires.txt +0 -0
  50. {pymoca-0.11.0.dev3 → pymoca-0.11.0.dev6}/src/pymoca.egg-info/top_level.txt +0 -0
@@ -1,7 +1,6 @@
1
1
  include LICENSE
2
2
  include README.md
3
3
  recursive-include doc *
4
- recursive-include java *
5
4
  include src/pymoca/_version.py
6
5
  include src/pymoca/Modelica.g4
7
6
  include src/pymoca/backends/xml/ModelicaXML/schemas/*.xsd
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pymoca
3
- Version: 0.11.0.dev3
4
- Summary: A python/modelica based simulation environment.
3
+ Version: 0.11.0.dev6
4
+ Summary: A Modelica to computer algebra system (CAS) translator.
5
5
  Author: Pymoca Contributors
6
6
  Maintainer-email: Jack Vreeken <jack@vreeken.me>, Kent Rutan <gs1150e@icloud.com>
7
7
  License: Copyright (c) 2016-2021, James Goppert and the Pymoca contributors.
@@ -76,8 +76,7 @@ Requires-Dist: control<=0.10.0,>=0.9.3.post2; extra == "examples"
76
76
  Provides-Extra: all
77
77
  Requires-Dist: pymoca[casadi,examples,lxml,sympy]; extra == "all"
78
78
 
79
- # <img alt="Pymoca" src="branding/icons/pymocalogo.svg" height="60">
80
-
79
+ # <img alt="Pymoca" src="https://raw.githubusercontent.com/pymoca/pymoca/refs/heads/master/branding/icons/pymocalogo.svg" height="60">
81
80
  A Modelica to computer algebra system (CAS) translator written in Python.
82
81
 
83
82
  [![CI](https://github.com/pymoca/pymoca/workflows/CI/badge.svg)](https://github.com/pymoca/pymoca/actions?query=workflow%3ACI)
@@ -109,7 +108,7 @@ pip install "pymoca[all]" # All of the above
109
108
 
110
109
  Pymoca reads and understands Modelica code (`pymoca.parser`) and provides access to an internal representation of the code called an Abstract Syntax Tree or AST (`pymoca.ast`). The AST is further processed to generate output in various formats (`pymoca.backends`). The `pymoca.tree` module provides functionality to transform the AST into a form that can be more easily used by the backends to generate the target output. In particular, `pymoca.tree` provides classes and functions to convert a hierarchical, object-oriented Modelica model of connected components into a "flat" system of equations and associated variables, parameters, and constants. Pymoca error checking is not always complete or easy to understand, so it is better to develop the Modelica code with other tools and then use Pymoca for translation.
111
110
 
112
- The [test suite](test) contains examples showing how to use Pymoca and the subset of Modelica that it currently supports.
111
+ The [test suite](https://github.com/pymoca/pymoca/tree/master/test) contains examples showing how to use Pymoca and the subset of Modelica that it currently supports.
113
112
 
114
113
  Here is an example using a simple spring and damper model from the test suite:
115
114
 
@@ -144,8 +143,8 @@ print(casadi_model)
144
143
 
145
144
  Some more interesting examples are in Jupyter notebooks:
146
145
 
147
- * [Casadi Example](test/notebooks/Casadi.ipynb)
148
- * [Sympy Example](test/notebooks/Spring.ipynb)
146
+ * [Casadi Example](https://github.com/pymoca/pymoca/blob/master/test/notebooks/Casadi.ipynb)
147
+ * [Sympy Example](https://github.com/pymoca/pymoca/blob/master/test/notebooks/Spring.ipynb)
149
148
 
150
149
  ## Roadmap
151
150
 
@@ -1,5 +1,4 @@
1
- # <img alt="Pymoca" src="branding/icons/pymocalogo.svg" height="60">
2
-
1
+ # <img alt="Pymoca" src="https://raw.githubusercontent.com/pymoca/pymoca/refs/heads/master/branding/icons/pymocalogo.svg" height="60">
3
2
  A Modelica to computer algebra system (CAS) translator written in Python.
4
3
 
5
4
  [![CI](https://github.com/pymoca/pymoca/workflows/CI/badge.svg)](https://github.com/pymoca/pymoca/actions?query=workflow%3ACI)
@@ -31,7 +30,7 @@ pip install "pymoca[all]" # All of the above
31
30
 
32
31
  Pymoca reads and understands Modelica code (`pymoca.parser`) and provides access to an internal representation of the code called an Abstract Syntax Tree or AST (`pymoca.ast`). The AST is further processed to generate output in various formats (`pymoca.backends`). The `pymoca.tree` module provides functionality to transform the AST into a form that can be more easily used by the backends to generate the target output. In particular, `pymoca.tree` provides classes and functions to convert a hierarchical, object-oriented Modelica model of connected components into a "flat" system of equations and associated variables, parameters, and constants. Pymoca error checking is not always complete or easy to understand, so it is better to develop the Modelica code with other tools and then use Pymoca for translation.
33
32
 
34
- The [test suite](test) contains examples showing how to use Pymoca and the subset of Modelica that it currently supports.
33
+ The [test suite](https://github.com/pymoca/pymoca/tree/master/test) contains examples showing how to use Pymoca and the subset of Modelica that it currently supports.
35
34
 
36
35
  Here is an example using a simple spring and damper model from the test suite:
37
36
 
@@ -66,8 +65,8 @@ print(casadi_model)
66
65
 
67
66
  Some more interesting examples are in Jupyter notebooks:
68
67
 
69
- * [Casadi Example](test/notebooks/Casadi.ipynb)
70
- * [Sympy Example](test/notebooks/Spring.ipynb)
68
+ * [Casadi Example](https://github.com/pymoca/pymoca/blob/master/test/notebooks/Casadi.ipynb)
69
+ * [Sympy Example](https://github.com/pymoca/pymoca/blob/master/test/notebooks/Spring.ipynb)
71
70
 
72
71
  ## Roadmap
73
72
 
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
6
6
  name = "pymoca"
7
7
  dynamic = ["version"]
8
8
  license = { file = "LICENSE" }
9
- description = "A python/modelica based simulation environment."
9
+ description = "A Modelica to computer algebra system (CAS) translator."
10
10
  keywords = ["modelica", "simulation", "compiler"]
11
11
  readme = "README.md"
12
12
  authors = [{ name = "Pymoca Contributors" }]
@@ -0,0 +1,156 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
3
+ <xs:include schemaLocation="Expression.xsd"/>
4
+ <xs:simpleType name="SectionKind">
5
+ <xs:restriction base="xs:normalizedString">
6
+ <xs:enumeration value="parameter"/>
7
+ <xs:enumeration value="initial"/>
8
+ <xs:enumeration value="default"/>
9
+ </xs:restriction>
10
+ </xs:simpleType>
11
+ <xs:complexType name="EquationSection">
12
+ <xs:sequence>
13
+ <xs:group ref="Equation" minOccurs="0" maxOccurs="unbounded"/>
14
+ </xs:sequence>
15
+ <xs:attribute name="kind" type="SectionKind" use="optional" default="default"/>
16
+ </xs:complexType>
17
+ <xs:complexType name="AlgorithmSection">
18
+ <xs:sequence>
19
+ <xs:group ref="Statement" minOccurs="0" maxOccurs="unbounded"/>
20
+ </xs:sequence>
21
+ <xs:attribute name="kind" type="SectionKind" use="optional" default="default"/>
22
+ </xs:complexType>
23
+ <xs:complexType name="AnnotationType">
24
+ <xs:group ref="Arguments"/>
25
+ </xs:complexType>
26
+ <!-- - - - - - - - - - - - - - - - - - - - - Equations - - - - - - - - - - - - - - - - - - - -->
27
+ <xs:complexType name="Equations">
28
+ <xs:sequence>
29
+ <xs:group ref="Equation" minOccurs="0" maxOccurs="unbounded"/>
30
+ </xs:sequence>
31
+ </xs:complexType>
32
+ <xs:group name="Equation">
33
+ <xs:choice>
34
+ <xs:element name="equal" type="TwoExpressions"/>
35
+ <xs:element name="connect" type="TwoExpressions"/>
36
+ <xs:element name="if" type="IfEquation"/>
37
+ <xs:element name="for" type="ForEquation"/>
38
+ <xs:element name="when" type="WhenEquation"/>
39
+ <xs:element name="operator" type="OperatorEqStmt"/>
40
+ <xs:element name="apply" type="FunctionEqStmt"/>
41
+ </xs:choice>
42
+ </xs:group>
43
+ <xs:complexType name="TwoExpressions">
44
+ <xs:sequence>
45
+ <xs:group ref="Expression" minOccurs="2" maxOccurs="2"/>
46
+ <xs:element name="annotation" type="AnnotationType" minOccurs="0"/>
47
+ </xs:sequence>
48
+ </xs:complexType>
49
+ <xs:complexType name="IfEquation">
50
+ <xs:sequence>
51
+ <xs:group ref="EqBranch" maxOccurs="unbounded"/>
52
+ <xs:element name="else" type="Equations" minOccurs="0"/>
53
+ <xs:element name="annotation" type="AnnotationType" minOccurs="0"/>
54
+ </xs:sequence>
55
+ </xs:complexType>
56
+ <xs:complexType name="WhenEquation">
57
+ <xs:sequence>
58
+ <xs:group ref="EqBranch" maxOccurs="unbounded"/>
59
+ <xs:element name="annotation" type="AnnotationType" minOccurs="0"/>
60
+ </xs:sequence>
61
+ </xs:complexType>
62
+ <xs:group name="EqBranch">
63
+ <xs:sequence>
64
+ <xs:element name="cond" type="ExpressionType"/>
65
+ <xs:element name="then" type="Equations"/>
66
+ </xs:sequence>
67
+ </xs:group>
68
+ <xs:complexType name="ForEquation">
69
+ <xs:sequence>
70
+ <xs:element name="index" type="NamedExpressionType" maxOccurs="unbounded"/>
71
+ <xs:element name="loop" type="Equations"/>
72
+ <xs:element name="annotation" type="AnnotationType" minOccurs="0"/>
73
+ </xs:sequence>
74
+ </xs:complexType>
75
+ <xs:complexType name="FunctionEqStmt">
76
+ <xs:complexContent>
77
+ <xs:extension base="FunctionApplication">
78
+ <xs:sequence>
79
+ <xs:element name="annotation" type="AnnotationType" minOccurs="0"/>
80
+ </xs:sequence>
81
+ </xs:extension>
82
+ </xs:complexContent>
83
+ </xs:complexType>
84
+ <xs:complexType name="OperatorEqStmt">
85
+ <xs:complexContent>
86
+ <xs:extension base="OperatorApplication">
87
+ <xs:sequence>
88
+ <xs:element name="annotation" type="AnnotationType" minOccurs="0"/>
89
+ </xs:sequence>
90
+ </xs:extension>
91
+ </xs:complexContent>
92
+ </xs:complexType>
93
+ <!-- - - - - - - - - - - - - - - - - - - - - Statements - - - - - - - - - - - - - - - - - - - -->
94
+ <xs:complexType name="Statements">
95
+ <xs:sequence>
96
+ <xs:group ref="Statement" minOccurs="0" maxOccurs="unbounded"/>
97
+ </xs:sequence>
98
+ </xs:complexType>
99
+ <xs:group name="Statement">
100
+ <xs:choice>
101
+ <xs:element name="assign" type="Assignment"/>
102
+ <xs:element name="if" type="IfStatement"/>
103
+ <xs:element name="for" type="ForStatement"/>
104
+ <xs:element name="while" type="WhileStatement"/>
105
+ <xs:element name="when" type="WhenStatement"/>
106
+ <xs:element name="break" type="EmptyStatement"/>
107
+ <xs:element name="return" type="EmptyStatement"/>
108
+ <xs:element name="operator" type="OperatorEqStmt"/>
109
+ <xs:element name="apply" type="FunctionEqStmt"/>
110
+ </xs:choice>
111
+ </xs:group>
112
+ <xs:complexType name="Assignment">
113
+ <xs:sequence>
114
+ <xs:element name="to" type="LValueType"/>
115
+ <xs:element name="from" type="ExpressionType"/>
116
+ <xs:element name="annotation" type="AnnotationType" minOccurs="0"/>
117
+ </xs:sequence>
118
+ </xs:complexType>
119
+ <xs:complexType name="IfStatement">
120
+ <xs:sequence>
121
+ <xs:group ref="StmtBranch" maxOccurs="unbounded"/>
122
+ <xs:element name="else" type="Statements" minOccurs="0"/>
123
+ <xs:element name="annotation" type="AnnotationType" minOccurs="0"/>
124
+ </xs:sequence>
125
+ </xs:complexType>
126
+ <xs:complexType name="WhileStatement">
127
+ <xs:sequence>
128
+ <xs:group ref="StmtBranch"/>
129
+ <xs:element name="annotation" type="AnnotationType" minOccurs="0"/>
130
+ </xs:sequence>
131
+ </xs:complexType>
132
+ <xs:complexType name="WhenStatement">
133
+ <xs:sequence>
134
+ <xs:group ref="StmtBranch" maxOccurs="unbounded"/>
135
+ <xs:element name="annotation" type="AnnotationType" minOccurs="0"/>
136
+ </xs:sequence>
137
+ </xs:complexType>
138
+ <xs:group name="StmtBranch">
139
+ <xs:sequence>
140
+ <xs:element name="cond" type="ExpressionType"/>
141
+ <xs:element name="then" type="Statements"/>
142
+ </xs:sequence>
143
+ </xs:group>
144
+ <xs:complexType name="ForStatement">
145
+ <xs:sequence>
146
+ <xs:element name="index" type="NamedExpressionType" maxOccurs="unbounded"/>
147
+ <xs:element name="loop" type="Statements"/>
148
+ <xs:element name="annotation" type="AnnotationType" minOccurs="0"/>
149
+ </xs:sequence>
150
+ </xs:complexType>
151
+ <xs:complexType name="EmptyStatement">
152
+ <xs:sequence>
153
+ <xs:element name="annotation" type="AnnotationType" minOccurs="0"/>
154
+ </xs:sequence>
155
+ </xs:complexType>
156
+ </xs:schema>
@@ -0,0 +1,129 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
3
+ <!-- - - - - - - - - - - - - - - - - - - - - Support types - - - - - - - - - - - - - - - - - - - - -->
4
+ <xs:simpleType name="Name">
5
+ <xs:restriction base="xs:token"/>
6
+ </xs:simpleType>
7
+ <!-- - - - - - - - - - - - - - - - - - - - - Expressions - - - - - - - - - - - - - - - - - - - - -->
8
+ <xs:complexType name="ExpressionType">
9
+ <xs:group ref="Expression"/>
10
+ </xs:complexType>
11
+ <xs:complexType name="NamedExpressionType">
12
+ <xs:group ref="Expression"/>
13
+ <xs:attribute name="name" type="Name" use="required"/>
14
+ </xs:complexType>
15
+ <xs:complexType name="LValueType">
16
+ <xs:group ref="LValue"/>
17
+ </xs:complexType>
18
+ <xs:group name="MaybeExpression">
19
+ <xs:choice>
20
+ <xs:group ref="Expression"/>
21
+ <xs:element name="nothing" type="Empty"/>
22
+ </xs:choice>
23
+ </xs:group>
24
+ <xs:group name="Expression">
25
+ <xs:choice>
26
+ <xs:group ref="Literal"/>
27
+ <xs:element name="if" type="IfExpression"/>
28
+ <xs:element name="apply" type="FunctionApplication"/>
29
+ <xs:element name="operator" type="OperatorApplication"/>
30
+ <xs:group ref="LValue"/>
31
+ </xs:choice>
32
+ </xs:group>
33
+ <xs:group name="LValue">
34
+ <xs:choice>
35
+ <xs:group ref="QualifiedReference"/>
36
+ <xs:element name="tuple" type="MaybeExpressions"/>
37
+ </xs:choice>
38
+ </xs:group>
39
+ <xs:group name="QualifiedReference">
40
+ <xs:choice>
41
+ <xs:group ref="TopReference"/>
42
+ <xs:element name="reference" type="Reference"/>
43
+ </xs:choice>
44
+ </xs:group>
45
+ <xs:group name="TopReference">
46
+ <xs:choice>
47
+ <xs:element name="builtin" type="Named"/>
48
+ <xs:element name="local" type="Named"/>
49
+ <xs:element name="global" type="Named"/>
50
+ </xs:choice>
51
+ </xs:group>
52
+ <xs:complexType name="Named">
53
+ <xs:attribute name="name" type="Name" use="required"/>
54
+ </xs:complexType>
55
+ <xs:complexType name="Reference">
56
+ <xs:sequence>
57
+ <xs:group ref="Expression"/>
58
+ <xs:choice maxOccurs="unbounded">
59
+ <xs:element name="member" type="Named"/>
60
+ <xs:element name="subscripts" type="Expressions"/>
61
+ </xs:choice>
62
+ </xs:sequence>
63
+ </xs:complexType>
64
+ <xs:group name="Literal">
65
+ <xs:choice>
66
+ <xs:element name="real">
67
+ <xs:complexType>
68
+ <xs:attribute name="value" type="xs:double" use="required"/>
69
+ </xs:complexType>
70
+ </xs:element>
71
+ <xs:element name="integer">
72
+ <xs:complexType>
73
+ <xs:attribute name="value" type="xs:integer" use="required"/>
74
+ </xs:complexType>
75
+ </xs:element>
76
+ <xs:group ref="Boolean"/>
77
+ <xs:element name="string">
78
+ <xs:complexType>
79
+ <xs:attribute name="value" type="xs:string" use="required"/>
80
+ </xs:complexType>
81
+ </xs:element>
82
+ </xs:choice>
83
+ </xs:group>
84
+ <xs:group name="Boolean">
85
+ <xs:choice>
86
+ <xs:element name="true" type="Empty"/>
87
+ <xs:element name="false" type="Empty"/>
88
+ </xs:choice>
89
+ </xs:group>
90
+ <xs:complexType name="Empty"/>
91
+ <xs:complexType name="FunctionApplication">
92
+ <xs:sequence>
93
+ <xs:element name="function" type="ExpressionType" minOccurs="0"/>
94
+ <xs:group ref="Arguments"/>
95
+ </xs:sequence>
96
+ <xs:attribute name="builtin" type="Name"/>
97
+ </xs:complexType>
98
+ <xs:complexType name="OperatorApplication">
99
+ <xs:group ref="Expression" minOccurs="0" maxOccurs="unbounded"/>
100
+ <xs:attribute name="name" type="Name" use="required"/>
101
+ </xs:complexType>
102
+ <xs:complexType name="Expressions">
103
+ <xs:group ref="Expression" minOccurs="0" maxOccurs="unbounded"/>
104
+ </xs:complexType>
105
+ <xs:complexType name="MaybeExpressions">
106
+ <xs:group ref="MaybeExpression" minOccurs="0" maxOccurs="unbounded"/>
107
+ </xs:complexType>
108
+ <xs:group name="Arguments">
109
+ <xs:sequence>
110
+ <xs:group ref="Expression" minOccurs="0" maxOccurs="unbounded"/>
111
+ <xs:element name="item" type="NamedExpressionType" minOccurs="0" maxOccurs="unbounded"/>
112
+ </xs:sequence>
113
+ </xs:group>
114
+ <xs:complexType name="ArgumentsType">
115
+ <xs:group ref="Arguments"/>
116
+ </xs:complexType>
117
+ <xs:complexType name="IfExpression">
118
+ <xs:sequence>
119
+ <xs:group ref="ExprBranch" maxOccurs="unbounded"/>
120
+ <xs:element name="else" type="ExpressionType"/>
121
+ </xs:sequence>
122
+ </xs:complexType>
123
+ <xs:group name="ExprBranch">
124
+ <xs:sequence>
125
+ <xs:element name="cond" type="ExpressionType"/>
126
+ <xs:element name="then" type="ExpressionType"/>
127
+ </xs:sequence>
128
+ </xs:group>
129
+ </xs:schema>
@@ -0,0 +1,38 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
3
+ <xs:include schemaLocation="Expression.xsd"/>
4
+ <xs:include schemaLocation="Equation_Statement_separate.xsd"/>
5
+ <xs:include schemaLocation="Types.xsd"/>
6
+ <xs:element name="modelica">
7
+ <xs:complexType>
8
+ <xs:sequence>
9
+ <xs:element name="declarations" minOccurs="0">
10
+ <xs:annotation>
11
+ <xs:documentation>Collects all top level declarations except the main one</xs:documentation>
12
+ </xs:annotation>
13
+ <xs:complexType>
14
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
15
+ <!-- All allowable kinds of top level declarations go here -->
16
+ <xs:element name="classDefinition" type="ClassDefinition"/>
17
+ </xs:choice>
18
+ </xs:complexType>
19
+ </xs:element>
20
+ <xs:element name="classDefinition" type="ClassDefinition" minOccurs="0">
21
+ <xs:annotation>
22
+ <xs:documentation>Main class definition, if there is one</xs:documentation>
23
+ </xs:annotation>
24
+ </xs:element>
25
+ </xs:sequence>
26
+ <xs:attribute name="format" use="required">
27
+ <xs:annotation>
28
+ <xs:documentation>Version number of the Modelica XML format used</xs:documentation>
29
+ </xs:annotation>
30
+ <xs:simpleType>
31
+ <xs:restriction base="xs:string">
32
+ <xs:enumeration value="1.0"/>
33
+ </xs:restriction>
34
+ </xs:simpleType>
35
+ </xs:attribute>
36
+ </xs:complexType>
37
+ </xs:element>
38
+ </xs:schema>
@@ -0,0 +1,139 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
3
+ <xs:include schemaLocation="Expression.xsd"/>
4
+ <xs:include schemaLocation="Equation_Statement_separate.xsd"/>
5
+ <xs:complexType name="ElementClass">
6
+ <xs:sequence>
7
+ <xs:group ref="Class"/>
8
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
9
+ <xs:element name="dimension" type="ExpressionType"/>
10
+ <xs:element name="modifier" type="ArgumentsType"/>
11
+ </xs:choice>
12
+ <xs:element name="annotation" type="AnnotationType" minOccurs="0"/>
13
+ </xs:sequence>
14
+ <xs:attribute name="visibility" default="public">
15
+ <xs:simpleType>
16
+ <xs:restriction base="xs:string"/>
17
+ </xs:simpleType>
18
+ </xs:attribute>
19
+ <xs:attribute name="comment" type="xs:string" use="optional"/>
20
+ <xs:attributeGroup ref="TypePrefixes"/>
21
+ </xs:complexType>
22
+ <xs:group name="Class">
23
+ <xs:choice>
24
+ <xs:group ref="QualifiedReference"/>
25
+ <xs:element name="enumeration" type="Enumeration"/>
26
+ <xs:element name="class" type="ClassContents"/>
27
+ </xs:choice>
28
+ </xs:group>
29
+ <xs:complexType name="Enumeration">
30
+ <xs:sequence minOccurs="0" maxOccurs="unbounded">
31
+ <xs:element name="item">
32
+ <xs:annotation>
33
+ <xs:documentation>First Item has value=1, Second Item has value = 2, etc.</xs:documentation>
34
+ </xs:annotation>
35
+ <xs:complexType>
36
+ <xs:attribute name="name" type="Name" use="required"/>
37
+ <xs:attribute name="description" type="xs:string"/>
38
+ </xs:complexType>
39
+ </xs:element>
40
+ </xs:sequence>
41
+ <!-- <xs:attribute name="quantity" type="xs:normalizedString"/> -->
42
+ </xs:complexType>
43
+ <xs:complexType name="ClassContents">
44
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
45
+ <xs:group ref="Declaration"/>
46
+ <xs:element name="equation" type="EquationSection"/>
47
+ <xs:element name="algorithm" type="AlgorithmSection"/>
48
+ </xs:choice>
49
+ <xs:attribute name="kind" type="ClassKind" use="required"/>
50
+ <xs:attribute name="partial" type="xs:boolean" default="false"/>
51
+ <xs:attribute name="purity" type="Purity" default="default"/>
52
+ </xs:complexType>
53
+ <xs:group name="Declaration">
54
+ <xs:choice>
55
+ <xs:element name="extends" type="ElementClass"/>
56
+ <xs:element name="classDefinition" type="ClassDefinition"/>
57
+ <xs:element name="component" type="Component"/>
58
+ </xs:choice>
59
+ </xs:group>
60
+ <xs:complexType name="ClassDefinition">
61
+ <xs:complexContent>
62
+ <xs:extension base="ElementClass">
63
+ <xs:attributeGroup ref="DeclarationPrefixes"/>
64
+ <xs:attribute name="name" type="Name" use="required"/>
65
+ </xs:extension>
66
+ </xs:complexContent>
67
+ </xs:complexType>
68
+ <xs:complexType name="Component">
69
+ <xs:complexContent>
70
+ <xs:extension base="ElementClass">
71
+ <xs:sequence>
72
+ <xs:element name="bindingExpression" type="ExpressionType" minOccurs="0"/>
73
+ <xs:element name="conditional" type="ExpressionType" minOccurs="0"/>
74
+ </xs:sequence>
75
+ <xs:attributeGroup ref="DeclarationPrefixes"/>
76
+ <xs:attribute name="name" type="Name" use="required"/>
77
+ </xs:extension>
78
+ </xs:complexContent>
79
+ </xs:complexType>
80
+ <xs:simpleType name="ClassKind">
81
+ <xs:restriction base="xs:normalizedString">
82
+ <xs:enumeration value="class"/>
83
+ <xs:enumeration value="model"/>
84
+ <xs:enumeration value="record"/>
85
+ <xs:enumeration value="operator record"/>
86
+ <xs:enumeration value="block"/>
87
+ <xs:enumeration value="expandable connector"/>
88
+ <xs:enumeration value="connector"/>
89
+ <xs:enumeration value="package"/>
90
+ <xs:enumeration value="function"/>
91
+ <xs:enumeration value="operator function"/>
92
+ <xs:enumeration value="operator"/>
93
+ </xs:restriction>
94
+ </xs:simpleType>
95
+ <xs:simpleType name="Purity">
96
+ <xs:restriction base="xs:normalizedString">
97
+ <xs:enumeration value="default"/>
98
+ <xs:enumeration value="pure"/>
99
+ <xs:enumeration value="impure"/>
100
+ </xs:restriction>
101
+ </xs:simpleType>
102
+ <xs:attributeGroup name="TypePrefixes">
103
+ <xs:attribute name="variability" default="continuous">
104
+ <xs:simpleType>
105
+ <xs:restriction base="xs:string">
106
+ <xs:enumeration value="constant"/>
107
+ <xs:enumeration value="parameter"/>
108
+ <xs:enumeration value="discrete"/>
109
+ <xs:enumeration value="continuous"/>
110
+ </xs:restriction>
111
+ </xs:simpleType>
112
+ </xs:attribute>
113
+ <xs:attribute name="causality" default="internal">
114
+ <xs:simpleType>
115
+ <xs:restriction base="xs:string">
116
+ <xs:enumeration value="input"/>
117
+ <xs:enumeration value="output"/>
118
+ <xs:enumeration value="internal"/>
119
+ <xs:enumeration value="none"/>
120
+ </xs:restriction>
121
+ </xs:simpleType>
122
+ </xs:attribute>
123
+ <xs:attribute name="flow" default="none">
124
+ <xs:simpleType>
125
+ <xs:restriction base="xs:string">
126
+ <xs:enumeration value="flow"/>
127
+ <xs:enumeration value="stream"/>
128
+ <xs:enumeration value="none"/>
129
+ </xs:restriction>
130
+ </xs:simpleType>
131
+ </xs:attribute>
132
+ </xs:attributeGroup>
133
+ <xs:attributeGroup name="DeclarationPrefixes">
134
+ <xs:attribute name="final" type="xs:boolean" default="false"/>
135
+ <xs:attribute name="inner" type="xs:boolean" default="false"/>
136
+ <xs:attribute name="outer" type="xs:boolean" default="false"/>
137
+ <xs:attribute name="replaceable" type="xs:boolean" default="false"/>
138
+ </xs:attributeGroup>
139
+ </xs:schema>
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pymoca
3
- Version: 0.11.0.dev3
4
- Summary: A python/modelica based simulation environment.
3
+ Version: 0.11.0.dev6
4
+ Summary: A Modelica to computer algebra system (CAS) translator.
5
5
  Author: Pymoca Contributors
6
6
  Maintainer-email: Jack Vreeken <jack@vreeken.me>, Kent Rutan <gs1150e@icloud.com>
7
7
  License: Copyright (c) 2016-2021, James Goppert and the Pymoca contributors.
@@ -76,8 +76,7 @@ Requires-Dist: control<=0.10.0,>=0.9.3.post2; extra == "examples"
76
76
  Provides-Extra: all
77
77
  Requires-Dist: pymoca[casadi,examples,lxml,sympy]; extra == "all"
78
78
 
79
- # <img alt="Pymoca" src="branding/icons/pymocalogo.svg" height="60">
80
-
79
+ # <img alt="Pymoca" src="https://raw.githubusercontent.com/pymoca/pymoca/refs/heads/master/branding/icons/pymocalogo.svg" height="60">
81
80
  A Modelica to computer algebra system (CAS) translator written in Python.
82
81
 
83
82
  [![CI](https://github.com/pymoca/pymoca/workflows/CI/badge.svg)](https://github.com/pymoca/pymoca/actions?query=workflow%3ACI)
@@ -109,7 +108,7 @@ pip install "pymoca[all]" # All of the above
109
108
 
110
109
  Pymoca reads and understands Modelica code (`pymoca.parser`) and provides access to an internal representation of the code called an Abstract Syntax Tree or AST (`pymoca.ast`). The AST is further processed to generate output in various formats (`pymoca.backends`). The `pymoca.tree` module provides functionality to transform the AST into a form that can be more easily used by the backends to generate the target output. In particular, `pymoca.tree` provides classes and functions to convert a hierarchical, object-oriented Modelica model of connected components into a "flat" system of equations and associated variables, parameters, and constants. Pymoca error checking is not always complete or easy to understand, so it is better to develop the Modelica code with other tools and then use Pymoca for translation.
111
110
 
112
- The [test suite](test) contains examples showing how to use Pymoca and the subset of Modelica that it currently supports.
111
+ The [test suite](https://github.com/pymoca/pymoca/tree/master/test) contains examples showing how to use Pymoca and the subset of Modelica that it currently supports.
113
112
 
114
113
  Here is an example using a simple spring and damper model from the test suite:
115
114
 
@@ -144,8 +143,8 @@ print(casadi_model)
144
143
 
145
144
  Some more interesting examples are in Jupyter notebooks:
146
145
 
147
- * [Casadi Example](test/notebooks/Casadi.ipynb)
148
- * [Sympy Example](test/notebooks/Spring.ipynb)
146
+ * [Casadi Example](https://github.com/pymoca/pymoca/blob/master/test/notebooks/Casadi.ipynb)
147
+ * [Sympy Example](https://github.com/pymoca/pymoca/blob/master/test/notebooks/Spring.ipynb)
149
148
 
150
149
  ## Roadmap
151
150
 
@@ -38,6 +38,10 @@ src/pymoca/backends/xml/generator.py
38
38
  src/pymoca/backends/xml/model.py
39
39
  src/pymoca/backends/xml/parser.py
40
40
  src/pymoca/backends/xml/sim_scipy.py
41
+ src/pymoca/backends/xml/ModelicaXML/schemas/Equation_Statement_separate.xsd
42
+ src/pymoca/backends/xml/ModelicaXML/schemas/Expression.xsd
43
+ src/pymoca/backends/xml/ModelicaXML/schemas/Modelica.xsd
44
+ src/pymoca/backends/xml/ModelicaXML/schemas/Types.xsd
41
45
  src/pymoca/generated/ModelicaLexer.py
42
46
  src/pymoca/generated/ModelicaListener.py
43
47
  src/pymoca/generated/ModelicaParser.py
File without changes
File without changes
File without changes
File without changes