forked from OpenModelica/OMLibraries
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Modelica 3.2.2.patch
287 lines (277 loc) · 10.6 KB
/
Modelica 3.2.2.patch
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
diff -u -x .svn -x .git -x Library -r git/Modelica/Modelica/Blocks/Sources.mo "build/Modelica 3.2.2/Blocks/Sources.mo"
--- git/Modelica/Modelica/Blocks/Sources.mo 2019-04-03 15:41:38.510814890 +0200
+++ build/Modelica 3.2.2/Blocks/Sources.mo 2019-04-03 15:42:05.922782318 +0200
@@ -2379,7 +2379,8 @@
input Modelica.Blocks.Types.ExternalCombiTimeTable tableID;
input Real timeIn;
input Real tableAvailable
- "Dummy input to ensure correct sorting of function calls";
+ "Dummy input to ensure correct sorting of function calls" annotation(
+ __OpenModelica_UnusedVariable = true);
output Real nextTimeEvent "Next time event in table";
external"C" nextTimeEvent = ModelicaStandardTables_CombiTimeTable_nextTimeEvent(tableID, timeIn)
annotation (Library={"ModelicaStandardTables", "ModelicaMatIO", "zlib"});
diff -u -x .svn -x .git -x Library -r git/Modelica/Modelica/Blocks/Tables.mo "build/Modelica 3.2.2/Blocks/Tables.mo"
--- git/Modelica/Modelica/Blocks/Tables.mo 2019-04-03 15:41:38.518814880 +0200
+++ build/Modelica 3.2.2/Blocks/Tables.mo 2019-04-03 15:42:04.238784129 +0200
@@ -59,7 +59,8 @@
input Integer icol;
input Real u;
input Real tableAvailable
- "Dummy input to ensure correct sorting of function calls";
+ "Dummy input to ensure correct sorting of function calls" annotation(
+ __OpenModelica_UnusedVariable = true);
output Real y;
external"C" y = ModelicaStandardTables_CombiTable1D_getValue(tableID, icol, u)
annotation (Library={"ModelicaStandardTables", "ModelicaMatIO", "zlib"});
@@ -73,7 +74,8 @@
input Integer icol;
input Real u;
input Real tableAvailable
- "Dummy input to ensure correct sorting of function calls";
+ "Dummy input to ensure correct sorting of function calls" annotation(
+ __OpenModelica_UnusedVariable = true);
output Real y;
external"C" y = ModelicaStandardTables_CombiTable1D_getValue(tableID, icol, u)
annotation (Library={"ModelicaStandardTables", "ModelicaMatIO", "zlib"});
@@ -86,7 +88,8 @@
input Integer icol;
input Real u;
input Real tableAvailable
- "Dummy input to ensure correct sorting of function calls";
+ "Dummy input to ensure correct sorting of function calls" annotation(
+ __OpenModelica_UnusedVariable = true);
input Real der_u;
output Real der_y;
external"C" der_y = ModelicaStandardTables_CombiTable1D_getDerValue(tableID, icol, u, der_u)
@@ -376,7 +379,8 @@
input Integer icol;
input Real u;
input Real tableAvailable
- "Dummy input to ensure correct sorting of function calls";
+ "Dummy input to ensure correct sorting of function calls" annotation(
+ __OpenModelica_UnusedVariable = true);
output Real y;
external"C" y = ModelicaStandardTables_CombiTable1D_getValue(tableID, icol, u)
annotation (Library={"ModelicaStandardTables", "ModelicaMatIO", "zlib"});
@@ -390,7 +394,8 @@
input Integer icol;
input Real u;
input Real tableAvailable
- "Dummy input to ensure correct sorting of function calls";
+ "Dummy input to ensure correct sorting of function calls" annotation(
+ __OpenModelica_UnusedVariable = true);
output Real y;
external"C" y = ModelicaStandardTables_CombiTable1D_getValue(tableID, icol, u)
annotation (Library={"ModelicaStandardTables", "ModelicaMatIO", "zlib"});
@@ -403,7 +408,8 @@
input Integer icol;
input Real u;
input Real tableAvailable
- "Dummy input to ensure correct sorting of function calls";
+ "Dummy input to ensure correct sorting of function calls" annotation(
+ __OpenModelica_UnusedVariable = true);
input Real der_u;
output Real der_y;
external"C" der_y = ModelicaStandardTables_CombiTable1D_getDerValue(tableID, icol, u, der_u)
@@ -688,7 +694,8 @@
input Real u1;
input Real u2;
input Real tableAvailable
- "Dummy input to ensure correct sorting of function calls";
+ "Dummy input to ensure correct sorting of function calls" annotation(
+ __OpenModelica_UnusedVariable = true);
output Real y;
external"C" y = ModelicaStandardTables_CombiTable2D_getValue(tableID, u1, u2)
annotation (Library={"ModelicaStandardTables", "ModelicaMatIO", "zlib"});
@@ -702,7 +709,8 @@
input Real u1;
input Real u2;
input Real tableAvailable
- "Dummy input to ensure correct sorting of function calls";
+ "Dummy input to ensure correct sorting of function calls" annotation(
+ __OpenModelica_UnusedVariable = true);
output Real y;
external"C" y = ModelicaStandardTables_CombiTable2D_getValue(tableID, u1, u2)
annotation (Library={"ModelicaStandardTables", "ModelicaMatIO", "zlib"});
@@ -715,7 +723,8 @@
input Real u1;
input Real u2;
input Real tableAvailable
- "Dummy input to ensure correct sorting of function calls";
+ "Dummy input to ensure correct sorting of function calls" annotation(
+ __OpenModelica_UnusedVariable = true);
input Real der_u1;
input Real der_u2;
output Real der_y;
diff -u -x .svn -x .git -x Library -r git/Modelica/Modelica/Magnetic/QuasiStatic/FundamentalWave.mo "build/Modelica 3.2.2/Magnetic/QuasiStatic/FundamentalWave.mo"
--- git/Modelica/Modelica/Magnetic/QuasiStatic/FundamentalWave.mo 2019-04-03 15:41:39.194813996 +0200
+++ build/Modelica 3.2.2/Magnetic/QuasiStatic/FundamentalWave.mo 2019-04-03 15:42:10.938777067 +0200
@@ -1135,7 +1135,8 @@
fillColor={255,255,170},
fillPattern=FillPattern.Solid,
textStyle={TextStyle.Bold},
- textString="%m phase transient")}));
+ textString="%m phase transient")}),
+ __OpenModelica_simulationFlags(nls = "newton"));
end IMC_YD;
model IMC_Transformer "Induction machine with squirrel cage starting with transformer"
@@ -1418,7 +1419,8 @@
fillColor={255,255,170},
fillPattern=FillPattern.Solid,
textStyle={TextStyle.Bold},
- textString="%m phase transient")}));
+ textString="%m phase transient")}),
+ __OpenModelica_simulationFlags(nls = "newton"));
end IMC_Transformer;
model IMC_Conveyor "Induction machine with squirrel cage and inverter driving a conveyor"
diff -u -x .svn -x .git -x Library -r git/Modelica/Modelica/Math/package.mo "build/Modelica 3.2.2/Math/package.mo"
--- git/Modelica/Modelica/Math/package.mo 2019-04-03 15:41:39.202813985 +0200
+++ build/Modelica 3.2.2/Math/package.mo 2019-04-03 15:41:57.126792048 +0200
@@ -13225,9 +13225,67 @@
annotation (Documentation(info="<html>
-</html>"));
+</html>"),
+derivative(zeroDerivative=table,zeroDerivative=icol)=tempInterpol1_der);
end tempInterpol1;
+function tempInterpol1_der
+ "Temporary function for linear interpolation (will be removed)"
+ input Real u "input value (first column of table)";
+ input Real table[:, :] "table to be interpolated";
+ input Integer icol "column of table to be interpolated";
+ input Real du;
+ output Real dy "interpolated input value (icol column of table)";
+protected
+ Integer i;
+ Integer n "number of rows of table";
+ Real u1;
+ Real u2;
+ Real y1;
+ Real y2;
+algorithm
+ n := size(table, 1);
+
+ if n <= 1 then
+ dy := 0;
+
+ else
+ // Search interval
+
+ if u <= table[1, 1] then
+ i := 1;
+
+ else
+ i := 2;
+ // Supports duplicate table[i, 1] values
+ // in the interior to allow discontinuities.
+ // Interior means that
+ // if table[i, 1] = table[i+1, 1] we require i>1 and i+1<n
+
+ while i < n and u >= table[i, 1] loop
+ i := i + 1;
+
+ end while;
+ i := i - 1;
+
+ end if;
+
+ // Get interpolation data
+ u1 := table[i, 1];
+ u2 := table[i + 1, 1];
+ y1 := table[i, icol];
+ y2 := table[i + 1, icol];
+
+ assert(u2 > u1, "Table index must be increasing");
+ // Interpolate
+ dy := (y2 - y1)/(u2 - u1);
+
+ end if;
+
+ annotation (Documentation(info="<html>
+
+</html>"));
+end tempInterpol1_der;
function tempInterpol2
"Temporary function for vectorized linear interpolation (will be removed)"
@@ -13287,9 +13345,74 @@
annotation (Documentation(info="<html>
-</html>"));
+</html>"),
+derivative(zeroDerivative=table,zeroDerivative=icol)=tempInterpol2_der);
end tempInterpol2;
+function tempInterpol2_der
+ "Temporary function for vectorized linear interpolation (will be removed)"
+ extends Modelica.Icons.Function;
+ extends Modelica.Icons.ObsoleteModel;
+
+ input Real u "input value (first column of table)";
+ input Real table[:, :] "table to be interpolated";
+ input Integer icol[:] "column(s) of table to be interpolated";
+ input Real du "input value (first column of table)";
+ output Real dy[1, size(icol, 1)]
+ "interpolated input value(s) (column(s) icol of table)";
+protected
+ Integer i;
+ Integer n "number of rows of table";
+ Real u1;
+ Real u2;
+ Real y1[1, size(icol, 1)];
+ Real y2[1, size(icol, 1)];
+algorithm
+ n := size(table, 1);
+
+ if n <= 1 then
+ dy := zeros(1, size(icol,1));
+
+ else
+ // Search interval
+
+ if u <= table[1, 1] then
+ i := 1;
+
+ else
+ i := 2;
+ // Supports duplicate table[i, 1] values
+ // in the interior to allow discontinuities.
+ // Interior means that
+ // if table[i, 1] = table[i+1, 1] we require i>1 and i+1<n
+
+ while i < n and u >= table[i, 1] loop
+ i := i + 1;
+
+ end while;
+ i := i - 1;
+
+ end if;
+
+ // Get interpolation data
+ u1 := table[i, 1];
+ u2 := table[i + 1, 1];
+ y1 := transpose([table[i, icol]]);
+ y2 := transpose([table[i + 1, icol]]);
+
+ assert(u2 > u1, "Table index must be increasing");
+ // Interpolate
+ dy := (y2 - y1)/(u2 - u1);
+
+ end if;
+
+ annotation (Documentation(info="<html>
+
+</html>")
+);
+end tempInterpol2_der;
+
+
annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},
{100,100}}), graphics={Line(points={{-80,0},{-68.7,34.2},{-61.5,53.1},
diff -u -x .svn -x .git -x Library -r git/Modelica/Modelica/Math/package.order "build/Modelica 3.2.2/Math/package.order"
--- git/Modelica/Modelica/Math/package.order 2019-04-03 15:41:39.210813974 +0200
+++ build/Modelica 3.2.2/Math/package.order 2019-04-03 15:41:57.126792048 +0200
@@ -29,4 +29,6 @@
baseIcon2
wrapAngle
tempInterpol1
+tempInterpol1_der
tempInterpol2
+tempInterpol2_der