-
Notifications
You must be signed in to change notification settings - Fork 297
/
testBug5673.mos
158 lines (146 loc) · 4.74 KB
/
testBug5673.mos
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
// name: testBug5673
// keywords: FMI 2.0 export
// status: correct
// teardown_command: rm -rf binaries sources modelDescription.xml modelDescription.tmp.xml Bug5673.xml
// cflags: -d=-newInst
loadString("
package aliasCheck
model test1
Real a, b=1;
equation
a=b;
end test1;
model test2
parameter Real b=1;
Real a;
equation
a=b;
end test2;
end aliasCheck;
");
translateModel(aliasCheck.test1);
getErrorString();
// read only the modelVariables from xml
system("sed -n \"/<ModelVariables>/,/<\\/ModelVariables>/p\" aliasCheck.test1_init.xml >Bug5673.xml"); getErrorString();
readFile("Bug5673.xml"); getErrorString();
translateModel(aliasCheck.test2);
getErrorString();
// read only the modelVariables from xml
system("sed -n \"/<ModelVariables>/,/<\\/ModelVariables>/p\" aliasCheck.test2_init.xml >Bug5673.xml"); getErrorString();
readFile("Bug5673.xml"); getErrorString();
buildModelFMU(aliasCheck.test2,version="2.0", fileNamePrefix="aliasCheck.test2");
getErrorString();
// unzip to console, quiet, extra quiet
system("unzip -cqq aliasCheck.test2.fmu modelDescription.xml > modelDescription.tmp.xml"); getErrorString();
system("sed -n \"/<ModelVariables>/,/<\\/ModelVariables>/p\" modelDescription.tmp.xml > Bug5673.xml"); getErrorString();
readFile("Bug5673.xml"); getErrorString();
system("sed -n \"/<ModelStructure>/,/<\\/ModelStructure>/p\" modelDescription.tmp.xml > Bug5673.xml"); getErrorString();
readFile("Bug5673.xml"); getErrorString();
// Result:
// true
// true
// ""
// 0
// ""
// " <ModelVariables>
//
// <ScalarVariable
// name = \"b\"
// valueReference = \"1000\"
// variability = \"continuous\" isDiscrete = \"false\"
// causality = \"local\" isValueChangeable = \"false\"
// alias = \"noAlias\"
// classIndex = \"0\" classType = \"rAlg\"
// isProtected = \"false\" hideResult = \"\" isEncrypted = \"false\" initNonlinear = \"false\"
// fileName = \"<interactive>\" startLine = \"5\" startColumn = \"2\" endLine = \"5\" endColumn = \"13\" fileWritable = \"true\">
// <Real fixed=\"true\" useNominal=\"false\" />
// </ScalarVariable>
// <ScalarVariable
// name = \"a\"
// valueReference = \"1001\"
// variability = \"continuous\" isDiscrete = \"false\"
// causality = \"local\" isValueChangeable = \"false\"
// alias = \"alias\" aliasVariable=\"b\" aliasVariableId=\"0\"
// classIndex = \"0\" classType = \"rAli\"
// isProtected = \"false\" hideResult = \"\" isEncrypted = \"false\" initNonlinear = \"false\"
// fileName = \"<interactive>\" startLine = \"5\" startColumn = \"2\" endLine = \"5\" endColumn = \"13\" fileWritable = \"true\">
// <Real fixed=\"false\" useNominal=\"false\" />
// </ScalarVariable>
//
//
//
// </ModelVariables>
// "
// ""
// true
// ""
// 0
// ""
// " <ModelVariables>
//
// <ScalarVariable
// name = \"a\"
// valueReference = \"1000\"
// variability = \"parameter\" isDiscrete = \"true\"
// causality = \"calculatedParameter\" isValueChangeable = \"false\"
// alias = \"noAlias\"
// classIndex = \"0\" classType = \"rPar\"
// isProtected = \"false\" hideResult = \"\" isEncrypted = \"false\" initNonlinear = \"false\"
// fileName = \"<interactive>\" startLine = \"12\" startColumn = \"3\" endLine = \"12\" endColumn = \"9\" fileWritable = \"true\">
// <Real fixed=\"true\" useNominal=\"false\" />
// </ScalarVariable>
// <ScalarVariable
// name = \"b\"
// valueReference = \"1001\"
// variability = \"parameter\" isDiscrete = \"true\"
// causality = \"parameter\" isValueChangeable = \"true\"
// alias = \"noAlias\"
// classIndex = \"1\" classType = \"rPar\"
// isProtected = \"false\" hideResult = \"\" isEncrypted = \"false\" initNonlinear = \"false\"
// fileName = \"<interactive>\" startLine = \"11\" startColumn = \"3\" endLine = \"11\" endColumn = \"21\" fileWritable = \"true\">
// <Real start=\"1.0\" fixed=\"true\" useNominal=\"false\" />
// </ScalarVariable>
//
//
//
// </ModelVariables>
// "
// ""
// "aliasCheck.test2.fmu"
// ""
// 0
// ""
// 0
// ""
// " <ModelVariables>
// <!-- Index of variable = \"1\" -->
// <ScalarVariable
// name=\"a\"
// valueReference=\"0\"
// variability=\"fixed\"
// causality=\"calculatedParameter\"
// >
// <Real/>
// </ScalarVariable>
// <!-- Index of variable = \"2\" -->
// <ScalarVariable
// name=\"b\"
// valueReference=\"1\"
// variability=\"fixed\"
// causality=\"parameter\"
// >
// <Real start=\"1.0\"/>
// </ScalarVariable>
// </ModelVariables>
// "
// ""
// 0
// ""
// " <ModelStructure>
// <InitialUnknowns>
// <Unknown index=\"1\" dependencies=\"2\" dependenciesKind=\"dependent\" />
// </InitialUnknowns>
// </ModelStructure>
// "
// ""
// endResult