-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgeneric.base.msl
More file actions
216 lines (179 loc) · 6.32 KB
/
generic.base.msl
File metadata and controls
216 lines (179 loc) · 6.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
// -----------------------------------------------------------------------
// HEMMIS - Ghent University, BIOMATH - Université Laval, modelEAU
// Implementation: Hans Vangheluwe, Peter Vanrolleghem, Henk Vanhooren,
// Jurgen Meirlaen,Frederik Decouttere, Youri Amerlinck
// Frederik De Laender, Ludiwine Clouzot.
// Description: MSL-USER/Generic/Base definitions
// --------------------------------------------------
#ifndef GENERIC_BASE
#define GENERIC_BASE
// Contains generic declarations for the modelling of
// dynamic (DAE based) physical systems.
//
// Builtin types are the only types for which
// an empty signature is allowed.
// During bootstrapping, the builtin type names
// are loaded into the outermost type namespace.
// The semantics of these types is given implicitly.
//
// Builtin atomic types
//
TYPE Generic "builtin: type variable";
// The Generic type is a "type variable". It will unify with any
// other type; any type is a sub-type of Generic which implies any
// object can be an instance of type Generic.
TYPE Integer "builtin: positive and negative Natural Numbers";
TYPE Real "builtin: Real numbers";
TYPE Char "builtin: ASCII character";
TYPE String
"builtin: Char* (implemented as atomic type for efficiency reasons)";
TYPE Bottom "builtin: bottom type" = ENUM {null};
// The Bottom type is a sub-type of any other type.
// By virtue of this, "null", the only object of
// type Bottom, can be used to denote an unassigned value
// for objects of any type.
TYPE Boolean "builtin: Logic type" = ENUM {True, False};
//
// Builtin composite types
//
TYPE TypeDeclarationType
"builtin: type of TYPE declaration statement";
TYPE ClassDeclarationType
"builtin: type of CLASS declaration statement";
TYPE ObjectDeclarationType
"builtin: type of OBJ declaration statement";
TYPE DeclarationType
"type of a declaration (TYPE, CLASS, or OBJ) statement"
= UNION {TypeDeclarationType, ClassDeclarationType, ObjectDeclarationType};
TYPE ExpressionType
"builtin: type of expressions";
TYPE EquationType
"builtin: type of equations";
TYPE GenericIntervalType
"
Generic Interval. Only meaningful if used
to specialise with endpoints of a type for which
an order relation is defined.
"
= RECORD
{
lowerBound: Generic;
upperBound: Generic;
lowerIncluded: Boolean;
upperIncluded: Boolean;
};
TYPE RealIntervalType "Interval of real numbers"
SUBSUMES GenericIntervalType =
RECORD
{
lowerBound: Real; // Real is sub-type of Generic
upperBound: Real; // Real is sub-type of Generic
lowerIncluded: Boolean;
upperIncluded: Boolean;
};
//
// type declarations for physical systems
//
TYPE UnitType
"The type of physical units. For the time being, a string"
= String;
TYPE QuantityType
"The different physical quantities. For the time being, string"
= String;
TYPE CausalityType
" Causality of entities:
CIN: input (cause) only
COUT: output (consequence) only
CINOUT: input and output (cause and consequence) are allowed
"
= ENUM {CIN, COUT, CINOUT};
TYPE PhysicalNatureType
"The nature of physical variables
FIELD is used (in the physicalDAE context) to denote
parameters and constants
"
= ENUM {ACROSS, THROUGH, FIELD};
TYPE PhysicalQuantityType
"The type of any physical quantity"
=
RECORD
{
quantity : QuantityType;
unit : UnitType;
interval : RealIntervalType;
value : Real;
causality : CausalityType;
nature : PhysicalNatureType;
};
//
// Formalism independent model stuff
//
TYPE InterfaceDeclarationType
"declarations within an interface" = DeclarationType;
TYPE ParameterDeclarationType
"declarations within parameter section" = DeclarationType;
TYPE ModelDeclarationType
"declarations within sub_models section" = DeclarationType;
TYPE CouplingStatementType
"parameter coupling and connect() statements" = EquationType;
TYPE GenericModelType
"The signature of the generic part of any (whatever the formalism) model"
=
RECORD
{
comments : String;
interface : SET_OF (InterfaceDeclarationType);
// declared objects must be interfaces
parameters : SET_OF (ParameterDeclarationType);
// declared objects must be parameters
};
TYPE DAEModelType
"The signature of a Differential Algebraic Equation (DAE) model
within DAEModelType models, connect() has the following
(flattening) semantics:
quantity and unit are checked for equality
equations are generated to equal (=) all algebraic and state variables
all other labels are ignored
"
EXTENDS GenericModelType WITH
RECORD
{
independent : SET_OF (ObjectDeclarationType); // independent variable (time)
state : SET_OF (PhysicalQuantityType); // variables
// those variables occurring in
// DERIV(v, [t]) statements are
// derived state variables
initial : SET_OF (EquationType);
equations : SET_OF (EquationType);
terminal : SET_OF (EquationType);
};
TYPE PhysicalDAEModelType
"within physicalDAEModelType models, connect() has the
following
(flattening) semantics:
quantity and unit are checked for equality
quantity and unit are checked for equality
equations are generated to equal (=) all across variables
equations are generated to sum all through variables to zero
all other labels are ignored
"
EXTENDS GenericModelType WITH
RECORD
{
independent : SET_OF (ObjectDeclarationType); // independent variable (time)
state : SET_OF (PhysicalQuantityType); // variables
// those variables occurring in
// DERIV(v, [t]) statements are
// derived state variables
initial : SET_OF (EquationType);
equations : SET_OF (EquationType);
terminal : SET_OF (EquationType);
};
TYPE CoupledModelType "The signature of a coupled (network) model"
EXTENDS GenericModelType WITH
RECORD
{
sub_models : SET_OF (ModelDeclarationType);
coupling : SET_OF (CouplingStatementType);
};
#endif