-
Notifications
You must be signed in to change notification settings - Fork 298
/
DAEDumpTV.mo
1513 lines (1230 loc) · 41.1 KB
/
DAEDumpTV.mo
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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
interface package DAEDumpTV
// Susan can't handle cyclic includes of templates, so this is a bit of a hack
// to allow DAEDumpTpl to dump expressions without actually including
// ExpressionDumpTpl.
package ExpressionDumpTpl
function dumpExp
input Tpl.Text in_txt;
input DAE.Exp in_a_exp;
input String in_a_stringDelimiter;
output Tpl.Text out_txt;
end dumpExp;
end ExpressionDumpTpl;
package ClassInf
function getStateName
input State inState;
output Absyn.Path outPath;
end getStateName;
uniontype State "- Machine states, the string contains the classname."
record UNKNOWN
Absyn.Path path;
end UNKNOWN;
record OPTIMIZATION
Absyn.Path path;
end OPTIMIZATION;
record MODEL
Absyn.Path path;
end MODEL;
record RECORD
Absyn.Path path;
end RECORD;
record BLOCK
Absyn.Path path;
end BLOCK;
record CONNECTOR
Absyn.Path path;
Boolean isExpandable;
end CONNECTOR;
record TYPE
Absyn.Path path;
end TYPE;
record PACKAGE
Absyn.Path path;
end PACKAGE;
record FUNCTION
Absyn.Path path;
Boolean isImpure;
end FUNCTION;
record ENUMERATION
Absyn.Path path;
end ENUMERATION;
record HAS_RESTRICTIONS
Absyn.Path path;
Boolean hasEquations;
Boolean hasAlgorithms;
Boolean hasConstraints;
end HAS_RESTRICTIONS;
record TYPE_INTEGER
Absyn.Path path;
end TYPE_INTEGER;
record TYPE_REAL
Absyn.Path path;
end TYPE_REAL;
record TYPE_STRING
Absyn.Path path;
end TYPE_STRING;
record TYPE_BOOL
Absyn.Path path;
end TYPE_BOOL;
record TYPE_ENUM
Absyn.Path path;
end TYPE_ENUM;
record EXTERNAL_OBJ
Absyn.Path path;
end EXTERNAL_OBJ;
/* MetaModelica extension */
record META_TUPLE
Absyn.Path path;
end META_TUPLE;
record META_LIST
Absyn.Path path;
end META_LIST;
record META_OPTION
Absyn.Path path;
end META_OPTION;
record META_RECORD
Absyn.Path path;
end META_RECORD;
record META_UNIONTYPE
Absyn.Path path;
end META_UNIONTYPE;
record META_ARRAY
Absyn.Path path;
end META_ARRAY;
record META_POLYMORPHIC
Absyn.Path path;
end META_POLYMORPHIC;
/*---------------------*/
end State;
end ClassInf;
package Config
function showAnnotations
output Boolean outShowAnnotations;
end showAnnotations;
function showStructuralAnnotations
output Boolean outShowAnnotations;
end showStructuralAnnotations;
function showStartOrigin
output Boolean show;
end showStartOrigin;
end Config;
package Absyn
type Ident = String;
uniontype Path
record QUALIFIED
Ident name;
Path path;
end QUALIFIED;
record IDENT
Ident name;
end IDENT;
record FULLYQUALIFIED
Path path;
end FULLYQUALIFIED;
end Path;
uniontype Direction
record INPUT end INPUT;
record OUTPUT end OUTPUT;
record BIDIR end BIDIR;
record INPUT_OUTPUT end INPUT_OUTPUT;
end Direction;
end Absyn;
package SCode
uniontype Visibility
record PUBLIC end PUBLIC;
record PROTECTED end PROTECTED;
end Visibility;
uniontype Variability
record VAR end VAR;
record DISCRETE end DISCRETE;
record PARAM end PARAM;
record CONST end CONST;
end Variability;
uniontype Comment
record COMMENT
Option<Annotation> annotation_;
Option<String> comment;
end COMMENT;
end Comment;
uniontype Annotation
record ANNOTATION
Mod modification;
end ANNOTATION;
end Annotation;
end SCode;
package DAEDump
uniontype compWithSplitElements
record COMP_WITH_SPLIT
String name;
splitElements spltElems;
Option<SCode.Comment> comment;
end COMP_WITH_SPLIT;
end compWithSplitElements;
uniontype splitElements
record SPLIT_ELEMENTS
list<DAE.Element> v;
list<DAE.Element> ie;
list<DAE.Element> ia;
list<DAE.Element> e;
list<DAE.Element> a;
list<DAE.Element> co;
list<DAE.Element> o;
list<DAE.Element> ca;
list<compWithSplitElements> sm;
end SPLIT_ELEMENTS;
end splitElements;
uniontype functionList
record FUNCTION_LIST
list<DAE.Function> funcs;
end FUNCTION_LIST;
end functionList;
function filterStructuralMods
input SCode.Mod mod;
output SCode.Mod outMod;
end filterStructuralMods;
end DAEDump;
package DAE
type Ident = String;
type InstDims = list<Dimension>;
type Dimensions = list<Dimension>;
uniontype DAElist
record DAE
list<Element> elementLst;
end DAE;
end DAElist;
/* AVLTree for functions */
type AvlKey = Absyn.Path;
type AvlValue = Option<Function>;
type FunctionTree = AvlTree;
uniontype AvlTree "The binary tree data structure"
record AVLTREENODE
Option<AvlTreeValue> value "Value" ;
Integer height "heigth of tree, used for balancing";
Option<AvlTree> left "left subtree" ;
Option<AvlTree> right "right subtree" ;
end AVLTREENODE;
end AvlTree;
uniontype AvlTreeValue "Each node in the binary tree can have a value associated with it."
record AVLTREEVALUE
AvlKey key "Key" ;
AvlValue value "Value" ;
end AVLTREEVALUE;
end AvlTreeValue;
uniontype ElementSource "gives information about the origin of the element"
record SOURCE
SourceInfo info "the line and column numbers of the equations and algorithms this element came from";
list<Absyn.Within> partOfLst "the model(s) this element came from";
list<Option<ComponentRef>> instanceOptLst "the instance(s) this element is part of";
list<Option<tuple<ComponentRef, ComponentRef>>> connectEquationOptLst "this element came from this connect(s)";
list<Absyn.Path> typeLst "the classes where the type(s) of the element is defined";
list<SymbolicOperation> operations "the symbolic operations used to end up with the final state of the element";
list<SCode.Comment> comment;
end SOURCE;
end ElementSource;
uniontype Element
record VAR
ComponentRef componentRef " The variable name";
VarKind kind "varible kind: variable, constant, parameter, discrete etc." ;
VarDirection direction "input, output or bidir" ;
VarParallelism parallelism "parglobal, parlocal, or non_parallel";
VarVisibility protection "if protected or public";
Type ty "Full type information required";
Option<Exp> binding "Binding expression e.g. for parameters ; value of start attribute";
InstDims dims "dimensions";
Flow flowPrefix "Flow of connector variable. Needed for unconnected flow variables" ;
Stream streamPrefix "Stream variables in connectors" ;
ElementSource source "the origins of the component/equation/algorithm";
Option<VariableAttributes> variableAttributesOption;
Option<SCode.Comment> comment;
Absyn.InnerOuter innerOuter "inner/outer required to 'change' outer references";
end VAR;
record DEFINE "A solved equation"
ComponentRef componentRef;
Exp exp;
ElementSource source "the origin of the component/equation/algorithm";
end DEFINE;
record INITIALDEFINE " A solved initial equation"
ComponentRef componentRef;
Exp exp;
ElementSource source "the origin of the component/equation/algorithm";
end INITIALDEFINE;
record EQUATION "Scalar equation"
Exp exp;
Exp scalar;
ElementSource source "the origin of the component/equation/algorithm";
end EQUATION;
record EQUEQUATION "effort variable equality"
ComponentRef cr1;
ComponentRef cr2;
ElementSource source "the origin of the component/equation/algorithm";
end EQUEQUATION;
record ARRAY_EQUATION " an array equation"
Dimensions dimension "dimension sizes" ;
Exp exp;
Exp array;
ElementSource source "the origin of the component/equation/algorithm";
end ARRAY_EQUATION;
record INITIAL_ARRAY_EQUATION "An initial array equation"
Dimensions dimension "dimension sizes";
Exp exp;
Exp array;
ElementSource source "the origin of the component/equation/algorithm";
end INITIAL_ARRAY_EQUATION;
record CONNECT_EQUATION "a connect equation"
Element lhsElement;
Connect.Face lhsFace;
Element rhsElement;
Connect.Face rhsFace;
ElementSource source "the origin of the component/equation/algorithm";
end CONNECT_EQUATION;
record COMPLEX_EQUATION "an equation of complex type, e.g. record = func(..)"
Exp lhs;
Exp rhs;
ElementSource source "the origin of the component/equation/algorithm";
end COMPLEX_EQUATION;
record INITIAL_COMPLEX_EQUATION "an initial equation of complex type, e.g. record = func(..)"
Exp lhs;
Exp rhs;
ElementSource source "the origin of the component/equation/algorithm";
end INITIAL_COMPLEX_EQUATION;
record WHEN_EQUATION " a when equation"
Exp condition "Condition" ;
list<Element> equations "Equations" ;
Option<Element> elsewhen_ "Elsewhen should be of type WHEN_EQUATION" ;
ElementSource source "the origin of the component/equation/algorithm";
end WHEN_EQUATION;
record INITIAL_FOR_EQUATION " a for-equation"
Type type_ "this is the type of the iterator";
Boolean iterIsArray "True if the iterator has an array type, otherwise false.";
Ident iter "the iterator variable";
Integer index "the index of the iterator variable, to make it unique; used by the new inst";
Exp range "range for the loop";
list<Element> equations "Equations" ;
ElementSource source "the origin of the component/equation/algorithm" ;
end INITIAL_FOR_EQUATION;
record FOR_EQUATION " a for-equation"
Type type_ "this is the type of the iterator";
Boolean iterIsArray "True if the iterator has an array type, otherwise false.";
Ident iter "the iterator variable";
Integer index "the index of the iterator variable, to make it unique; used by the new inst";
Exp range "range for the loop";
list<Element> equations "Equations" ;
ElementSource source "the origin of the component/equation/algorithm" ;
end FOR_EQUATION;
record IF_EQUATION " an if-equation"
list<Exp> condition1 "Condition" ;
list<list<Element>> equations2 "Equations of true branch" ;
list<Element> equations3 "Equations of false branch" ;
ElementSource source "the origin of the component/equation/algorithm";
end IF_EQUATION;
record INITIAL_IF_EQUATION "An initial if-equation"
list<Exp> condition1 "Condition" ;
list<list<Element>> equations2 "Equations of true branch" ;
list<Element> equations3 "Equations of false branch" ;
ElementSource source "the origin of the component/equation/algorithm";
end INITIAL_IF_EQUATION;
record INITIALEQUATION " An initial equaton"
Exp exp1;
Exp exp2;
ElementSource source "the origin of the component/equation/algorithm";
end INITIALEQUATION;
record ALGORITHM " An algorithm section"
Algorithm algorithm_;
ElementSource source "the origin of the component/equation/algorithm";
end ALGORITHM;
record INITIALALGORITHM " An initial algorithm section"
Algorithm algorithm_;
ElementSource source "the origin of the component/equation/algorithm";
end INITIALALGORITHM;
record COMP
Ident ident;
list<Element> dAElist "a component with subelements, normally only used at top level.";
ElementSource source "the origin of the component/equation/algorithm"; // we might not this here.
Option<SCode.Comment> comment;
end COMP;
record EXTOBJECTCLASS "The 'class' of an external object"
Absyn.Path path "className of external object";
ElementSource source "the origin of the component/equation/algorithm";
end EXTOBJECTCLASS;
record ASSERT " The Modelica builtin assert"
Exp condition;
Exp message;
Exp level;
ElementSource source "the origin of the component/equation/algorithm";
end ASSERT;
record INITIAL_ASSERT " The Modelica builtin assert"
Exp condition;
Exp message;
Exp level;
ElementSource source "the origin of the component/equation/algorithm";
end INITIAL_ASSERT;
record TERMINATE " The Modelica builtin terminate(msg)"
Exp message;
ElementSource source "the origin of the component/equation/algorithm";
end TERMINATE;
record INITIAL_TERMINATE " The Modelica builtin terminate(msg)"
Exp message;
ElementSource source "the origin of the component/equation/algorithm";
end INITIAL_TERMINATE;
record REINIT " reinit operator for reinitialization of states"
ComponentRef componentRef;
Exp exp;
ElementSource source "the origin of the component/equation/algorithm";
end REINIT;
record NORETCALL "call with no return value, i.e. no equation.
Typically sideeffect call of external function but also
Connections.* i.e. Connections.root(...) functions."
Exp exp;
ElementSource source "the origin of the component/equation/algorithm";
end NORETCALL;
record INITIAL_NORETCALL "call with no return value, i.e. no equation.
Typically sideeffect call of external function but also
Connections.* i.e. Connections.root(...) functions."
Exp exp;
ElementSource source "the origin of the component/equation/algorithm" ;
end INITIAL_NORETCALL;
record CONSTRAINT " constraint section"
Constraint constraints;
ElementSource source "the origin of the component/equation/algorithm";
end CONSTRAINT;
record COMMENT
SCode.Comment cmt;
end COMMENT;
end Element;
uniontype Algorithm "The `Algorithm\' type corresponds to a whole algorithm section.
It is simple a list of algorithm statements."
record ALGORITHM_STMTS
list<Statement> statementLst;
end ALGORITHM_STMTS;
end Algorithm;
uniontype Statement
record STMT_ASSIGN
Exp exp1;
Exp exp;
ElementSource source;
end STMT_ASSIGN;
record STMT_TUPLE_ASSIGN
list<Exp> expExpLst;
Exp exp;
ElementSource source;
end STMT_TUPLE_ASSIGN;
record STMT_ASSIGN_ARR
Exp lhs;
Exp exp;
ElementSource source;
end STMT_ASSIGN_ARR;
record STMT_IF
Exp exp;
list<Statement> statementLst;
Else else_;
ElementSource source;
end STMT_IF;
record STMT_FOR
Boolean iterIsArray;
Ident iter;
Exp range;
list<Statement> statementLst;
ElementSource source;
end STMT_FOR;
record STMT_PARFOR
Boolean iterIsArray;
Ident iter;
Exp range;
list<Statement> statementLst;
ElementSource source;
end STMT_PARFOR;
record STMT_WHILE
Exp exp;
list<Statement> statementLst;
ElementSource source;
end STMT_WHILE;
record STMT_WHEN
Exp exp;
list<Statement> statementLst;
Option<Statement> elseWhen;
list<Integer> helpVarIndices;
ElementSource source;
end STMT_WHEN;
record STMT_ASSERT
Exp cond;
Exp msg;
Exp level;
ElementSource source;
end STMT_ASSERT;
record STMT_TERMINATE
Exp msg;
ElementSource source;
end STMT_TERMINATE;
record STMT_REINIT
Exp var;
Exp value;
ElementSource source;
end STMT_REINIT;
record STMT_NORETCALL
Exp exp;
ElementSource source;
end STMT_NORETCALL;
record STMT_RETURN
ElementSource source;
end STMT_RETURN;
record STMT_CONTINUE
ElementSource source;
end STMT_CONTINUE;
record STMT_BREAK
ElementSource source;
end STMT_BREAK;
record STMT_FAILURE
list<Statement> body;
ElementSource source;
end STMT_FAILURE;
end Statement;
uniontype Else "An if statements can one or more `elseif\' branches and an
optional `else\' branch."
record NOELSE end NOELSE;
record ELSEIF
Exp exp;
list<Statement> statementLst;
Else else_;
end ELSEIF;
record ELSE
list<Statement> statementLst;
end ELSE;
end Else;
uniontype Operator "Operators which are overloaded in the abstract syntax are here
made type-specific. The integer addition operator (`ADD(INT)\')
and the real addition operator (`ADD(REAL)\') are two distinct
operators."
record ADD
Type ty;
end ADD;
record SUB
Type ty;
end SUB;
record MUL
Type ty;
end MUL;
record DIV
Type ty;
end DIV;
record POW
Type ty;
end POW;
record UMINUS
Type ty;
end UMINUS;
record UMINUS_ARR
Type ty;
end UMINUS_ARR;
record ADD_ARR
Type ty;
end ADD_ARR;
record SUB_ARR
Type ty;
end SUB_ARR;
record MUL_ARR
Type ty;
end MUL_ARR;
record DIV_ARR
Type ty;
end DIV_ARR;
record MUL_ARRAY_SCALAR " {a,b,c} * s"
Type ty "type of the array" ;
end MUL_ARRAY_SCALAR;
record ADD_ARRAY_SCALAR " {a,b,c} .+ s"
Type ty "type of the array";
end ADD_ARRAY_SCALAR;
record SUB_SCALAR_ARRAY "s .- {a,b,c}"
Type ty "type of the array" ;
end SUB_SCALAR_ARRAY;
record MUL_SCALAR_PRODUCT " {a,b,c} * {c,d,e} => a*c+b*d+c*e"
Type ty "type of the array" ;
end MUL_SCALAR_PRODUCT;
record MUL_MATRIX_PRODUCT "M1 * M2, matrix dot product"
Type ty "{{..},..} {{..},{..}}" ;
end MUL_MATRIX_PRODUCT;
record DIV_ARRAY_SCALAR "{a, b} / c"
Type ty "type of the array";
end DIV_ARRAY_SCALAR;
record DIV_SCALAR_ARRAY "c / {a,b}"
Type ty "type of the array" ;
end DIV_SCALAR_ARRAY;
record POW_ARRAY_SCALAR
Type ty "type of the array" ;
end POW_ARRAY_SCALAR;
record POW_SCALAR_ARRAY
Type ty "type of the array" ;
end POW_SCALAR_ARRAY;
record POW_ARR "Power of a matrix: {{1,2,3},{4,5.0,6},{7,8,9}}^2"
Type ty "type of the array";
end POW_ARR;
record POW_ARR2 "elementwise power of arrays: {1,2,3}.^{3,2,1}"
Type ty "type of the array";
end POW_ARR2;
record AND
Type ty;
end AND;
record OR
Type ty;
end OR;
record NOT
Type ty;
end NOT;
record LESS
Type ty;
end LESS;
record LESSEQ
Type ty;
end LESSEQ;
record GREATER
Type ty;
end GREATER;
record GREATEREQ
Type ty;
end GREATEREQ;
record EQUAL
Type ty;
end EQUAL;
record NEQUAL
Type ty;
end NEQUAL;
record USERDEFINED
Absyn.Path fqName "The FQ name of the overloaded operator function" ;
end USERDEFINED;
end Operator;
uniontype ExternalDecl
record EXTERNALDECL
String name;
list<ExtArg> args;
ExtArg returnArg;
String language;
Option<SCode.Annotation> ann;
end EXTERNALDECL;
end ExternalDecl;
uniontype ExtArg
record EXTARG
ComponentRef componentRef;
Attributes attributes;
Type type_;
end EXTARG;
record EXTARGEXP
Exp exp;
Type type_;
end EXTARGEXP;
record EXTARGSIZE
ComponentRef componentRef;
Attributes attributes;
Type type_;
Exp exp;
end EXTARGSIZE;
record NOEXTARG end NOEXTARG;
end ExtArg;
uniontype Var "- Variables"
record TYPES_VAR
Ident name "name";
Attributes attributes "attributes";
Type ty "type" ;
Binding binding "equation modification";
Option<Const> constOfForIteratorRange "the constant-ness of the range if this is a for iterator, NONE() if is NOT a for iterator";
end TYPES_VAR;
end Var;
uniontype Attributes "- Attributes"
record ATTR
ConnectorType connectorType "flow, stream or unspecified";
SCode.Parallelism parallelism "parallelism";
SCode.Variability variability "variability" ;
Absyn.Direction direction "direction" ;
Absyn.InnerOuter innerOuter "inner, outer, inner outer or unspecified";
SCode.Visibility visibility "public, protected";
end ATTR;
end Attributes;
uniontype ComponentRef "- Component references
CREF_QUAL(...) is used for qualified component names, e.g. a.b.c
CREF_IDENT(..) is used for non-qualifed component names, e.g. x"
record CREF_QUAL
Ident ident;
Type identType "type of the identifier, without considering the subscripts";
list<Subscript> subscriptLst;
ComponentRef componentRef;
end CREF_QUAL;
record CREF_IDENT
Ident ident;
Type identType "type of the identifier, without considering the subscripts";
list<Subscript> subscriptLst;
end CREF_IDENT;
record WILD end WILD;
end ComponentRef;
uniontype Subscript "The `Subscript\' and `ComponentRef\' datatypes are simple
translations of the corresponding types in the `Absyn\' module."
record WHOLEDIM "a{:,1}" end WHOLEDIM;
record SLICE
Exp exp "a{1:3,1}, a{1:2:10,2}" ;
end SLICE;
record INDEX
Exp exp "a[i+1]" ;
end INDEX;
record WHOLE_NONEXP "Used for non-expanded arrays. Should probably be combined with WHOLEDIM
into one case with Option<Exp> argument."
Exp exp;
end WHOLE_NONEXP;
end Subscript;
uniontype VarKind
record VARIABLE "variable" end VARIABLE;
record DISCRETE "discrete" end DISCRETE;
record PARAM "parameter" end PARAM;
record CONST "constant" end CONST;
end VarKind;
uniontype ConnectorType "The type of a connector element."
record POTENTIAL end POTENTIAL;
record FLOW end FLOW;
record STREAM
Option<ComponentRef> associatedFlow;
end STREAM;
record NON_CONNECTOR end NON_CONNECTOR;
end ConnectorType;
uniontype VarDirection
record INPUT "input" end INPUT;
record OUTPUT "output" end OUTPUT;
record BIDIR "neither input or output" end BIDIR;
end VarDirection;
uniontype VarParallelism
record PARGLOBAL "Global variables for CUDA and OpenCL" end PARGLOBAL;
record PARLOCAL "Shared for CUDA and local for OpenCL" end PARLOCAL;
record NON_PARALLEL "Non parallel/Normal variables" end NON_PARALLEL;
end VarParallelism;
uniontype StateSelect
record NEVER end NEVER;
record AVOID end AVOID;
record DEFAULT end DEFAULT;
record PREFER end PREFER;
record ALWAYS end ALWAYS;
end StateSelect;
uniontype Uncertainty
record GIVEN end GIVEN;
record SOUGHT end SOUGHT;
record REFINE end REFINE;
record PROPAGATE end PROPAGATE;
end Uncertainty;
uniontype Distribution
record DISTRIBUTION
Exp name;
Exp params;
Exp paramNames;
end DISTRIBUTION;
end Distribution;
uniontype VariableAttributes
record VAR_ATTR_REAL
Option<Exp> quantity "quantity";
Option<Exp> unit "unit";
Option<Exp> displayUnit "displayUnit";
Option<Exp> min;
Option<Exp> max;
Option<Exp> start "start value";
Option<Exp> fixed "fixed - true: default for parameter/constant, false - default for other variables";
Option<Exp> nominal "nominal";
Option<StateSelect> stateSelectOption;
Option<Uncertainty> uncertainOption;
Option<Distribution> distributionOption;
Option<Exp> equationBound;
Option<Boolean> isProtected;
Option<Boolean> finalPrefix;
Option<Exp> startOrigin "where did start=X came from? NONE()|SOME(DAE.SCONST binding|type|undefined)";
end VAR_ATTR_REAL;
record VAR_ATTR_INT
Option<Exp> quantity "quantity";
Option<Exp> min;
Option<Exp> max;
Option<Exp> start "start value";
Option<Exp> fixed "fixed - true: default for parameter/constant, false - default for other variables";
Option<Uncertainty> uncertainOption;
Option<Distribution> distributionOption;
Option<Exp> equationBound;
Option<Boolean> isProtected; // ,eb,ip
Option<Boolean> finalPrefix;
Option<Exp> startOrigin "where did start=X came from? NONE()|SOME(DAE.SCONST binding|type|undefined)";
end VAR_ATTR_INT;
record VAR_ATTR_BOOL
Option<Exp> quantity "quantity";
Option<Exp> start "start value";
Option<Exp> fixed "fixed - true: default for parameter/constant, false - default for other variables";
Option<Exp> equationBound;
Option<Boolean> isProtected;
Option<Boolean> finalPrefix;
Option<Exp> startOrigin "where did start=X came from? NONE()|SOME(DAE.SCONST binding|type|undefined)";
end VAR_ATTR_BOOL;
record VAR_ATTR_STRING
Option<Exp> quantity "quantity";
Option<Exp> start "start value";
Option<Exp> equationBound;
Option<Boolean> isProtected;
Option<Boolean> finalPrefix;
Option<Exp> startOrigin "where did start=X came from? NONE()|SOME(DAE.SCONST binding|type|undefined)";
end VAR_ATTR_STRING;
record VAR_ATTR_ENUMERATION
Option<Exp> quantity "quantity";
Option<Exp> min;
Option<Exp> max;
Option<Exp> start "start";
Option<Exp> fixed "fixed - true: default for parameter/constant, false - default for other variables";
Option<Exp> equationBound;
Option<Boolean> isProtected;
Option<Boolean> finalPrefix;
Option<Exp> startOrigin "where did start=X came from? NONE()|SOME(DAE.SCONST binding|type|undefined)";
end VAR_ATTR_ENUMERATION;
end VariableAttributes;
uniontype VarVisibility
record PUBLIC "public variables" end PUBLIC;
record PROTECTED "protected variables" end PROTECTED;
end VarVisibility;
uniontype Function
record FUNCTION " A Modelica function"
Absyn.Path path;
list<FunctionDefinition> functions "contains the body and an optional function derivative mapping";
Type type_;
Boolean partialPrefix "MetaModelica extension";
Boolean isImpure;
InlineType inlineType;
ElementSource source "the origin of the component/equation/algorithm";
Option<SCode.Comment> comment;
end FUNCTION;
record RECORD_CONSTRUCTOR "A Modelica record constructor. The function can be generated from the Path and Type alone."
Absyn.Path path;
Type type_;
ElementSource source "the origin of the component/equation/algorithm";
end RECORD_CONSTRUCTOR;
end Function;
uniontype FunctionDefinition
record FUNCTION_DEF "Normal function body"
list<Element> body;
end FUNCTION_DEF;
record FUNCTION_EXT "Normal external function declaration"
list<Element> body;
ExternalDecl externalDecl;
end FUNCTION_EXT;
record FUNCTION_DER_MAPPER "Contains derivatives for function"
Absyn.Path derivedFunction "Function that is derived";
Absyn.Path derivativeFunction "Path to derivative function";
Integer derivativeOrder "in case a function have multiple derivatives, include all";
list<tuple<Integer,derivativeCond>> conditionRefs;
Option<Absyn.Path> defaultDerivative "if conditions fails, use default derivative if exists";
list<Absyn.Path> lowerOrderDerivatives;
end FUNCTION_DER_MAPPER;
record FUNCTION_INVERSE "A function inverse declaration"
ComponentRef inputParam "The input parameter the inverse is for";
Exp inverseCall "The inverse function call";
end FUNCTION_INVERSE;