Ticket #3632: SwP3v04.mo.flat

File SwP3v04.mo.flat, 49.9 KB (added by anonymous, 9 years ago)
Line 
1"
2function Complex \"Automatically generated record constructor for Complex\"
3  input Real re;
4  input Real im;
5  output Complex res;
6end Complex;
7
8function Complex.'*'.multiply \"Inline before index reduction\" \"Multiply two complex numbers\"
9  input Complex c1 \"Complex number 1\";
10  input Complex c2 \"Complex number 2\";
11  output Complex c3 \"= c1*c2\";
12algorithm
13  c3 := Complex(c1.re * c2.re - c1.im * c2.im, c1.re * c2.im + c1.im * c2.re);
14end Complex.'*'.multiply;
15
16function Complex.'*'.scalarProduct \"Inline before index reduction\" \"Scalar product c1*c2 of two complex vectors\"
17  input Complex[:] c1 \"Vector of Complex numbers 1\";
18  input Complex[size(c1, 1)] c2 \"Vector of Complex numbers 2\";
19  output Complex c3 \"= c1*c2\";
20algorithm
21  c3 := Complex(0.0, 0.0);
22  for i in 1:size(c1, 1) loop
23    c3 := Complex.'+'(c3, Complex.'*'.multiply(c1[i], c2[i]));
24  end for;
25end Complex.'*'.scalarProduct;
26
27function Complex.'+' \"Inline before index reduction\" \"Add two complex numbers\"
28  input Complex c1 \"Complex number 1\";
29  input Complex c2 \"Complex number 2\";
30  output Complex c3 \"= c1 + c2\";
31algorithm
32  c3 := Complex(c1.re + c2.re, c1.im + c2.im);
33end Complex.'+';
34
35function Complex.'-'.negate \"Inline before index reduction\" \"Unary minus (multiply complex number by -1)\"
36  input Complex c1 \"Complex number\";
37  output Complex c2 \"= -c1\";
38algorithm
39  c2 := Complex(-c1.re, -c1.im);
40end Complex.'-'.negate;
41
42function Complex.'-'.subtract \"Inline before index reduction\" \"Subtract two complex numbers\"
43  input Complex c1 \"Complex number 1\";
44  input Complex c2 \"Complex number 2\";
45  output Complex c3 \"= c1 - c2\";
46algorithm
47  c3 := Complex(c1.re - c2.re, c1.im - c2.im);
48end Complex.'-'.subtract;
49
50function Complex.'/' \"Inline before index reduction\" \"Divide two complex numbers\"
51  input Complex c1 \"Complex number 1\";
52  input Complex c2 \"Complex number 2\";
53  output Complex c3 \"= c1/c2\";
54algorithm
55  c3 := Complex((c1.re * c2.re + c1.im * c2.im) / (c2.re ^ 2.0 + c2.im ^ 2.0), (c1.im * c2.re - c1.re * c2.im) / (c2.re ^ 2.0 + c2.im ^ 2.0));
56end Complex.'/';
57
58function Complex.'constructor'.fromReal \"Inline before index reduction\" \"Construct Complex from Real\"
59  input Real re \"Real part of complex number\";
60  input Real im = 0.0 \"Imaginary part of complex number\";
61  output Complex result = Complex(re, im) \"Complex number\";
62end Complex.'constructor'.fromReal;
63
64function ElPower.Electric.Basics.abs
65  input Real u;
66  output Real y;
67algorithm
68  y := if noEvent(u >= 0.0) then u else -u;
69end ElPower.Electric.Basics.abs;
70
71function Modelica.Blocks.Tables.CombiTable1D$asm$Tsat1.getDerTableValue \"Derivative of interpolated 1-dim. table defined by matrix\"
72  input Modelica.Blocks.Types.ExternalCombiTable1D tableID;
73  input Integer icol;
74  input Real u;
75  input Real tableAvailable \"Dummy input to ensure correct sorting of function calls\";
76  input Real der_u;
77  output Real der_y;
78
79  external \"C\" der_y = ModelicaStandardTables_CombiTable1D_getDerValue(tableID, icol, u, der_u);
80end Modelica.Blocks.Tables.CombiTable1D$asm$Tsat1.getDerTableValue;
81
82function Modelica.Blocks.Tables.CombiTable1D$asm$Tsat1.getTableValue \"Interpolate 1-dim. table defined by matrix\"
83  input Modelica.Blocks.Types.ExternalCombiTable1D tableID;
84  input Integer icol;
85  input Real u;
86  input Real tableAvailable \"Dummy input to ensure correct sorting of function calls\";
87  output Real y;
88
89  external \"C\" y = ModelicaStandardTables_CombiTable1D_getValue(tableID, icol, u);
90end Modelica.Blocks.Tables.CombiTable1D$asm$Tsat1.getTableValue;
91
92function Modelica.Blocks.Tables.CombiTable1D$asm$Tsat1.readTableData \"Read table data from ASCII text or MATLAB MAT-file\"
93  input Modelica.Blocks.Types.ExternalCombiTable1D tableID;
94  input Boolean forceRead = false \"= true: Force reading of table data; = false: Only read, if not yet read.\";
95  input Boolean verboseRead \"= true: Print info message; = false: No info message\";
96  output Real readSuccess \"Table read success\";
97
98  external \"C\" readSuccess = ModelicaStandardTables_CombiTable1D_read(tableID, forceRead, verboseRead);
99end Modelica.Blocks.Tables.CombiTable1D$asm$Tsat1.readTableData;
100
101function Modelica.Blocks.Tables.CombiTable1D$asm$Tsat2.getDerTableValue \"Derivative of interpolated 1-dim. table defined by matrix\"
102  input Modelica.Blocks.Types.ExternalCombiTable1D tableID;
103  input Integer icol;
104  input Real u;
105  input Real tableAvailable \"Dummy input to ensure correct sorting of function calls\";
106  input Real der_u;
107  output Real der_y;
108
109  external \"C\" der_y = ModelicaStandardTables_CombiTable1D_getDerValue(tableID, icol, u, der_u);
110end Modelica.Blocks.Tables.CombiTable1D$asm$Tsat2.getDerTableValue;
111
112function Modelica.Blocks.Tables.CombiTable1D$asm$Tsat2.getTableValue \"Interpolate 1-dim. table defined by matrix\"
113  input Modelica.Blocks.Types.ExternalCombiTable1D tableID;
114  input Integer icol;
115  input Real u;
116  input Real tableAvailable \"Dummy input to ensure correct sorting of function calls\";
117  output Real y;
118
119  external \"C\" y = ModelicaStandardTables_CombiTable1D_getValue(tableID, icol, u);
120end Modelica.Blocks.Tables.CombiTable1D$asm$Tsat2.getTableValue;
121
122function Modelica.Blocks.Tables.CombiTable1D$asm$Tsat2.readTableData \"Read table data from ASCII text or MATLAB MAT-file\"
123  input Modelica.Blocks.Types.ExternalCombiTable1D tableID;
124  input Boolean forceRead = false \"= true: Force reading of table data; = false: Only read, if not yet read.\";
125  input Boolean verboseRead \"= true: Print info message; = false: No info message\";
126  output Real readSuccess \"Table read success\";
127
128  external \"C\" readSuccess = ModelicaStandardTables_CombiTable1D_read(tableID, forceRead, verboseRead);
129end Modelica.Blocks.Tables.CombiTable1D$asm$Tsat2.readTableData;
130
131function Modelica.Blocks.Tables.CombiTable1D$asm$TsatM.getDerTableValue \"Derivative of interpolated 1-dim. table defined by matrix\"
132  input Modelica.Blocks.Types.ExternalCombiTable1D tableID;
133  input Integer icol;
134  input Real u;
135  input Real tableAvailable \"Dummy input to ensure correct sorting of function calls\";
136  input Real der_u;
137  output Real der_y;
138
139  external \"C\" der_y = ModelicaStandardTables_CombiTable1D_getDerValue(tableID, icol, u, der_u);
140end Modelica.Blocks.Tables.CombiTable1D$asm$TsatM.getDerTableValue;
141
142function Modelica.Blocks.Tables.CombiTable1D$asm$TsatM.getTableValue \"Interpolate 1-dim. table defined by matrix\"
143  input Modelica.Blocks.Types.ExternalCombiTable1D tableID;
144  input Integer icol;
145  input Real u;
146  input Real tableAvailable \"Dummy input to ensure correct sorting of function calls\";
147  output Real y;
148
149  external \"C\" y = ModelicaStandardTables_CombiTable1D_getValue(tableID, icol, u);
150end Modelica.Blocks.Tables.CombiTable1D$asm$TsatM.getTableValue;
151
152function Modelica.Blocks.Tables.CombiTable1D$asm$TsatM.readTableData \"Read table data from ASCII text or MATLAB MAT-file\"
153  input Modelica.Blocks.Types.ExternalCombiTable1D tableID;
154  input Boolean forceRead = false \"= true: Force reading of table data; = false: Only read, if not yet read.\";
155  input Boolean verboseRead \"= true: Print info message; = false: No info message\";
156  output Real readSuccess \"Table read success\";
157
158  external \"C\" readSuccess = ModelicaStandardTables_CombiTable1D_read(tableID, forceRead, verboseRead);
159end Modelica.Blocks.Tables.CombiTable1D$asm$TsatM.readTableData;
160
161function Modelica.Blocks.Types.ExternalCombiTable1D.constructor \"Initialize 1-dim. table defined by matrix\"
162  input String tableName \"Table name\";
163  input String fileName \"File name\";
164  input Real[:, :] table;
165  input Integer[:] columns;
166  input enumeration(LinearSegments, ContinuousDerivative, ConstantSegments) smoothness;
167  output Modelica.Blocks.Types.ExternalCombiTable1D externalCombiTable1D;
168
169  external \"C\" externalCombiTable1D = ModelicaStandardTables_CombiTable1D_init(tableName, fileName, table, size(table, 1), size(table, 2), columns, size(columns, 1), smoothness);
170end Modelica.Blocks.Types.ExternalCombiTable1D.constructor;
171
172function Modelica.Blocks.Types.ExternalCombiTable1D.destructor \"Terminate 1-dim. table defined by matrix\"
173  input Modelica.Blocks.Types.ExternalCombiTable1D externalCombiTable1D;
174
175  external \"C\" ModelicaStandardTables_CombiTable1D_close(externalCombiTable1D);
176end Modelica.Blocks.Types.ExternalCombiTable1D.destructor;
177
178function Modelica.ComplexMath.'abs' \"Inline before index reduction\" \"Absolute value of complex number\"
179  input Complex c \"Complex number\";
180  output Real result \"= abs(c)\";
181algorithm
182  result := (c.re ^ 2.0 + c.im ^ 2.0) ^ 0.5;
183end Modelica.ComplexMath.'abs';
184
185function Modelica.ComplexMath.arg \"Inline before index reduction\" \"Phase angle of complex number\"
186  input Complex c \"Complex number\";
187  input Real phi0(quantity = \"Angle\", unit = \"rad\", displayUnit = \"deg\") = 0.0 \"Phase angle phi shall be in the range: -pi < phi-phi0 < pi\";
188  output Real phi(quantity = \"Angle\", unit = \"rad\", displayUnit = \"deg\") \"= phase angle of c\";
189algorithm
190  phi := Modelica.Math.atan3(c.im, c.re, phi0);
191end Modelica.ComplexMath.arg;
192
193function Modelica.ComplexMath.conj \"Inline before index reduction\" \"Conjugate of complex number\"
194  input Complex c1 \"Complex number\";
195  output Complex c2 \"= c1.re - j*c1.im\";
196algorithm
197  c2 := Complex(c1.re, -c1.im);
198end Modelica.ComplexMath.conj;
199
200function Modelica.ComplexMath.exp \"Inline before index reduction\" \"Exponential of complex number\"
201  input Complex c1 \"Complex number\";
202  output Complex c2 \"= exp(c1)\";
203algorithm
204  c2 := Complex(exp(c1.re) * cos(c1.im), exp(c1.re) * sin(c1.im));
205end Modelica.ComplexMath.exp;
206
207function Modelica.ComplexMath.imag \"Inline before index reduction\" \"Imaginary part of complex number\"
208  input Complex c \"Complex number\";
209  output Real r \"= c.im\";
210algorithm
211  r := c.im;
212end Modelica.ComplexMath.imag;
213
214function Modelica.ComplexMath.real \"Inline before index reduction\" \"Real part of complex number\"
215  input Complex c \"Complex number\";
216  output Real r \"= c.re\";
217algorithm
218  r := c.re;
219end Modelica.ComplexMath.real;
220
221function Modelica.Math.atan3 \"Four quadrant inverse tangent (select solution that is closest to given angle y0)\"
222  input Real u1;
223  input Real u2;
224  input Real y0(quantity = \"Angle\", unit = \"rad\", displayUnit = \"deg\") = 0.0 \"y shall be in the range: -pi < y-y0 <= pi\";
225  output Real y(quantity = \"Angle\", unit = \"rad\", displayUnit = \"deg\");
226  protected constant Real pi = 3.141592653589793;
227  protected Real w;
228  protected constant Real pi2 = 6.283185307179586;
229algorithm
230  w := atan2(u1, u2);
231  if y0 == 0.0 then
232    y := w;
233  else
234    y := w + 6.283185307179586 * /*Real*/(integer(0.5 + 0.1591549430918953 * (y0 - w)));
235  end if;
236end Modelica.Math.atan3;
237
238function Modelica.Math.tempInterpol1 \"Temporary function for linear interpolation (will be removed)\"
239  input Real u \"input value (first column of table)\";
240  input Real[:, :] table \"table to be interpolated\";
241  input Integer icol \"column of table to be interpolated\";
242  output Real y \"interpolated input value (icol column of table)\";
243  protected Integer i;
244  protected Integer n \"number of rows of table\";
245  protected Real u1;
246  protected Real u2;
247  protected Real y1;
248  protected Real y2;
249algorithm
250  n := size(table, 1);
251  if n <= 1 then
252    y := table[1,icol];
253  else
254    if u <= table[1,1] then
255      i := 1;
256    else
257      i := 2;
258      while i < n and u >= table[i,1] loop
259        i := 1 + i;
260      end while;
261      i := -1 + i;
262    end if;
263    u1 := table[i,1];
264    u2 := table[1 + i,1];
265    y1 := table[i,icol];
266    y2 := table[1 + i,icol];
267    assert(u2 > u1, \"Table index must be increasing\");
268    y := y1 + (y2 - y1) * (u - u1) / (u2 - u1);
269  end if;
270end Modelica.Math.tempInterpol1;
271
272function Modelica.Math.tempInterpol1_der \"Temporary function for linear interpolation (will be removed)\"
273  input Real u \"input value (first column of table)\";
274  input Real[:, :] table \"table to be interpolated\";
275  input Integer icol \"column of table to be interpolated\";
276  input Real du;
277  output Real dy \"interpolated input value (icol column of table)\";
278  protected Integer i;
279  protected Integer n \"number of rows of table\";
280  protected Real u1;
281  protected Real u2;
282  protected Real y1;
283  protected Real y2;
284algorithm
285  n := size(table, 1);
286  if n <= 1 then
287    dy := 0.0;
288  else
289    if u <= table[1,1] then
290      i := 1;
291    else
292      i := 2;
293      while i < n and u >= table[i,1] loop
294        i := 1 + i;
295      end while;
296      i := -1 + i;
297    end if;
298    u1 := table[i,1];
299    u2 := table[1 + i,1];
300    y1 := table[i,icol];
301    y2 := table[1 + i,icol];
302    assert(u2 > u1, \"Table index must be increasing\");
303    dy := (y2 - y1) / (u2 - u1);
304  end if;
305end Modelica.Math.tempInterpol1_der;
306
307function Modelica.SIunits.Conversions.to_deg \"Inline before index reduction\" \"Convert from radian to degree\"
308  input Real radian(quantity = \"Angle\", unit = \"rad\", displayUnit = \"deg\") \"radian value\";
309  output Real degree(quantity = \"Angle\", unit = \"deg\") \"degree value\";
310algorithm
311  degree := 57.29577951308232 * radian;
312end Modelica.SIunits.Conversions.to_deg;
313
314function Modelica.Utilities.Strings.Advanced.skipWhiteSpace \"Scans white space\"
315  input String string;
316  input Integer startIndex(min = 1) = 1;
317  output Integer nextIndex;
318
319  external \"C\" nextIndex = ModelicaStrings_skipWhiteSpace(string, startIndex);
320end Modelica.Utilities.Strings.Advanced.skipWhiteSpace;
321
322function Modelica.Utilities.Strings.isEmpty \"Return true if a string is empty (has only white space characters)\"
323  input String string;
324  output Boolean result \"True, if string is empty\";
325  protected Integer nextIndex;
326  protected Integer len;
327algorithm
328  nextIndex := Modelica.Utilities.Strings.Advanced.skipWhiteSpace(string, 1);
329  len := Modelica.Utilities.Strings.length(string);
330  if len < 1 or nextIndex > len then
331    result := true;
332  else
333    result := false;
334  end if;
335end Modelica.Utilities.Strings.isEmpty;
336
337function Modelica.Utilities.Strings.length \"Returns length of string\"
338  input String string;
339  output Integer result \"Number of characters of string\";
340
341  external \"C\" result = ModelicaStrings_length(string);
342end Modelica.Utilities.Strings.length;
343
344class SwP3v04
345  parameter Real load = 0.877;
346  parameter Real yMaxi = 1.5;
347  Real cycle;
348  Real torque;
349  Real torqueS;
350  input Real dt(start = 0.0);
351  Real meter.u.re \"Real part of complex number\";
352  Real meter.u.im \"Imaginary part of complex number\";
353  Real meter.i.re(start = 0.0) \"Real part of complex number\";
354  Real meter.i.im(start = 0.0) \"Imaginary part of complex number\";
355  Real meter.Pin1.i.re \"Real part of complex number\";
356  Real meter.Pin1.i.im \"Imaginary part of complex number\";
357  Real meter.Pin1.v.re \"Real part of complex number\";
358  Real meter.Pin1.v.im \"Imaginary part of complex number\";
359  Real meter.Pin2.i.re \"Real part of complex number\";
360  Real meter.Pin2.i.im \"Imaginary part of complex number\";
361  Real meter.Pin2.v.re \"Real part of complex number\";
362  Real meter.Pin2.v.im \"Imaginary part of complex number\";
363  Real meter.up.re \"Real part of complex number\";
364  Real meter.up.im(start = 1.0) \"Imaginary part of complex number\";
365  Real meter.Strom;
366  Real meter.Spannung;
367  Real meter.P;
368  Real meter.Q;
369  Real meter.S;
370  Real meter.I.re \"Real part of complex number\";
371  Real meter.I.im \"Imaginary part of complex number\";
372  Real meter.strom \"Betrag Strom\";
373  Real meter.spannung \"Betrag Spannung\";
374  Real meter.p \"Wirkleistung\";
375  Real meter.q \"Blindleistung\";
376  Real meter.s \"Scheinleistung\";
377  Real meter.sComplex.re \"Real part of complex number\";
378  Real meter.sComplex.im \"Imaginary part of complex number\";
379  Real meter.phiU \"Phasenwinkel Spannung U\";
380  Real meter.i2t(start = 0.0, fixed = true) \"i2t Integral\";
381  Real meter.energy(start = 0.0, fixed = true) \"u*i Integral\";
382  Real meter.NULL.i.re \"Real part of complex number\";
383  Real meter.NULL.i.im \"Imaginary part of complex number\";
384  Real meter.NULL.v.re \"Real part of complex number\";
385  Real meter.NULL.v.im \"Imaginary part of complex number\";
386  Real InertiaT.flange_a.phi(quantity = \"Angle\", unit = \"rad\", displayUnit = \"deg\") \"Absolute rotation angle of flange\";
387  Real InertiaT.flange_a.tau(quantity = \"Torque\", unit = \"N.m\") \"Cut torque in the flange\";
388  Real InertiaT.flange_b.phi(quantity = \"Angle\", unit = \"rad\", displayUnit = \"deg\") \"Absolute rotation angle of flange\";
389  Real InertiaT.flange_b.tau(quantity = \"Torque\", unit = \"N.m\") \"Cut torque in the flange\";
390  parameter Real InertiaT.J(quantity = \"MomentOfInertia\", unit = \"kg.m2\", min = 0.0, start = 1.0) = 32.47 \"Moment of inertia\";
391  parameter enumeration(never, avoid, default, prefer, always) InertiaT.stateSelect = StateSelect.default \"Priority to use phi and w as states\";
392  Real InertiaT.phi(quantity = \"Angle\", unit = \"rad\", displayUnit = \"deg\", stateSelect = StateSelect.default) \"Absolute rotation angle of component\";
393  Real InertiaT.w(quantity = \"AngularVelocity\", unit = \"rad/s\", stateSelect = StateSelect.default) \"Absolute angular velocity of component (= der(phi))\";
394  Real InertiaT.a(quantity = \"AngularAcceleration\", unit = \"rad/s2\") \"Absolute angular acceleration of component (= der(w))\";
395  Real shaft.phi_rel(quantity = \"Angle\", unit = \"rad\", displayUnit = \"deg\", start = 0.0, nominal = if shaft.phi_nominal >= 1e-15 then shaft.phi_nominal else 1.0, stateSelect = StateSelect.prefer) \"Relative rotation angle (= flange_b.phi - flange_a.phi)\";
396  Real shaft.w_rel(quantity = \"AngularVelocity\", unit = \"rad/s\", start = 0.0, stateSelect = StateSelect.prefer) \"Relative angular velocity (= der(phi_rel))\";
397  Real shaft.a_rel(quantity = \"AngularAcceleration\", unit = \"rad/s2\", start = 0.0) \"Relative angular acceleration (= der(w_rel))\";
398  Real shaft.tau(quantity = \"Torque\", unit = \"N.m\") \"Torque between flanges (= flange_b.tau)\";
399  Real shaft.flange_a.phi(quantity = \"Angle\", unit = \"rad\", displayUnit = \"deg\") \"Absolute rotation angle of flange\";
400  Real shaft.flange_a.tau(quantity = \"Torque\", unit = \"N.m\") \"Cut torque in the flange\";
401  Real shaft.flange_b.phi(quantity = \"Angle\", unit = \"rad\", displayUnit = \"deg\") \"Absolute rotation angle of flange\";
402  Real shaft.flange_b.tau(quantity = \"Torque\", unit = \"N.m\") \"Cut torque in the flange\";
403  parameter Real shaft.phi_nominal(quantity = \"Angle\", unit = \"rad\", displayUnit = \"rad\", min = 0.0) = 0.0001 \"Nominal value of phi_rel (used for scaling)\";
404  parameter enumeration(never, avoid, default, prefer, always) shaft.stateSelect = StateSelect.prefer \"Priority to use phi_rel and w_rel as states\";
405  parameter Boolean shaft.useHeatPort = false \"=true, if heatPort is enabled\";
406  Real shaft.lossPower(quantity = \"Power\", unit = \"W\") \"Loss power leaving component via heatPort (> 0, if heat is flowing out of component)\";
407  parameter Real shaft.c(quantity = \"RotationalSpringConstant\", unit = \"N.m/rad\", min = 0.0, start = 100000.0) = 52.94 \"Spring constant\";
408  parameter Real shaft.d(quantity = \"RotationalDampingConstant\", unit = \"N.m.s/rad\", min = 0.0, start = 0.0) = 0.0 \"Damping constant\";
409  parameter Real shaft.phi_rel0(quantity = \"Angle\", unit = \"rad\", displayUnit = \"deg\") = 0.0 \"Unstretched spring angle\";
410  protected Real shaft.tau_c(quantity = \"Torque\", unit = \"N.m\") \"Spring torque\";
411  protected Real shaft.tau_d(quantity = \"Torque\", unit = \"N.m\") \"Damping torque\";
412  parameter Boolean asm.SteadyState = true;
413  parameter Boolean asm.InitSpeed = true;
414  Real asm.tau;
415  Real asm.phi(start = 0.0, fixed = true);
416  Real asm.w;
417  Real asm.leistung.re \"Real part of complex number\";
418  Real asm.leistung.im \"Imaginary part of complex number\";
419  Real asm.leistungMech;
420  Real asm.strom;
421  Real asm.spannung;
422  Real asm.deltaP \"Differenz El-Mech\";
423  Real asm.Pin.i.re \"Real part of complex number\";
424  Real asm.Pin.i.im \"Imaginary part of complex number\";
425  Real asm.Pin.v.re \"Real part of complex number\";
426  Real asm.Pin.v.im \"Imaginary part of complex number\";
427  Real asm.Flange_a.phi(quantity = \"Angle\", unit = \"rad\", displayUnit = \"deg\") \"Absolute rotation angle of flange\";
428  Real asm.Flange_a.tau(quantity = \"Torque\", unit = \"N.m\") \"Cut torque in the flange\";
429  Real asm.Flange_b.phi(quantity = \"Angle\", unit = \"rad\", displayUnit = \"deg\") \"Absolute rotation angle of flange\";
430  Real asm.Flange_b.tau(quantity = \"Torque\", unit = \"N.m\") \"Cut torque in the flange\";
431  parameter String asm.projecthome = \"/home/hans/Projekte/Swansea/ShaftStudy/OM/\";
432  parameter Real asm.x1s = 0.1708;
433  parameter Real asm.x2s = 0.1216;
434  parameter Real asm.xh = 3.2;
435  parameter Real asm.r1 = 0.0139;
436  parameter Real asm.r2 = 0.0117;
437  parameter Boolean asm.bSat = false \"table for saturation\";
438  Real asm.u1.re \"Real part of complex number\";
439  Real asm.u1.im(start = 1.0) \"Imaginary part of complex number\";
440  Real asm.i1.re(start = -1.0) \"Real part of complex number\";
441  Real asm.i1.im(start = -0.5) \"Imaginary part of complex number\";
442  Real asm.i2.re(start = 1.0) \"Real part of complex number\";
443  Real asm.i2.im(start = 0.3) \"Imaginary part of complex number\";
444  Real asm.psi1.re(start = 0.0) \"Real part of complex number\";
445  Real asm.psi1.im(start = -1.0) \"Imaginary part of complex number\";
446  Real asm.psi2.re(start = 0.3) \"Real part of complex number\";
447  Real asm.psi2.im(start = -0.9) \"Imaginary part of complex number\";
448  Real asm.psim.re(start = 0.2) \"Real part of complex number\";
449  Real asm.psim.im(start = -0.91) \"Imaginary part of complex number\";
450  Real asm.im.re(start = 0.0) \"Real part of complex number\";
451  Real asm.im.im(start = -0.3) \"Imaginary part of complex number\";
452  Real asm.fdm \"Faktor Saettigung xh\";
453  Real asm.fd1 \"Faktor Saettigung x1\";
454  Real asm.fd2 \"Faktor Saettigung x2\";
455  Real asm.psi1abs;
456  Real asm.psi2abs;
457  Real asm.psimabs;
458  Real asm.i1Abs(start = 1.0);
459  Real asm.i2Abs(start = 1.0);
460  parameter Boolean asm.bXlsat = true \"table for xsat.\";
461  parameter String asm.XlFileName = asm.projecthome + \"xsat.txt\";
462  constant Real asm.J.re = 0.0 \"Real part of complex number\";
463  constant Real asm.J.im = 1.0 \"Imaginary part of complex number\";
464  parameter Integer asm.TsatM.n = 1 \"Number of inputs (= number of outputs)\";
465  Real asm.TsatM.u[1] \"Connector of Real input signals\";
466  Real asm.TsatM.y[1] \"Connector of Real output signals\";
467  parameter Boolean asm.TsatM.tableOnFile = asm.bXlsat \"= true, if table is defined on file or in function usertab\";
468  parameter Real asm.TsatM.table[1,1] = -1.0 \"Table matrix (grid = first column; e.g., table=[0,2])\";
469  parameter Real asm.TsatM.table[1,2] = 1.0 \"Table matrix (grid = first column; e.g., table=[0,2])\";
470  parameter Real asm.TsatM.table[2,1] = 1.0 \"Table matrix (grid = first column; e.g., table=[0,2])\";
471  parameter Real asm.TsatM.table[2,2] = 1.0 \"Table matrix (grid = first column; e.g., table=[0,2])\";
472  parameter Real asm.TsatM.table[3,1] = 20.0 \"Table matrix (grid = first column; e.g., table=[0,2])\";
473  parameter Real asm.TsatM.table[3,2] = 1.0 \"Table matrix (grid = first column; e.g., table=[0,2])\";
474  parameter String asm.TsatM.tableName = \"xh\" \"Table name on file or in function usertab (see docu)\";
475  parameter String asm.TsatM.fileName = asm.XlFileName \"File where matrix is stored\";
476  parameter Boolean asm.TsatM.verboseRead = true \"= true, if info message that file is loading is to be printed\";
477  parameter Integer asm.TsatM.columns[1] = 2 \"Columns of table to be interpolated\";
478  parameter enumeration(LinearSegments, ContinuousDerivative, ConstantSegments) asm.TsatM.smoothness = Modelica.Blocks.Types.Smoothness.LinearSegments \"Smoothness of table interpolation\";
479  protected Modelica.Blocks.Types.ExternalCombiTable1D asm.TsatM.tableID = Modelica.Blocks.Types.ExternalCombiTable1D.constructor(\"xh\", \"/home/hans/Projekte/Swansea/ShaftStudy/OM/xsat.txt\", {{-1.0, 1.0}, {1.0, 1.0}, {20.0, 1.0}}, {2}, Modelica.Blocks.Types.Smoothness.LinearSegments) \"External table object\";
480  protected parameter Real asm.TsatM.tableOnFileRead(fixed = false) \"= 1, if table was successfully read from file\";
481  parameter Integer asm.Tsat1.n = 1 \"Number of inputs (= number of outputs)\";
482  Real asm.Tsat1.u[1] \"Connector of Real input signals\";
483  Real asm.Tsat1.y[1] \"Connector of Real output signals\";
484  parameter Boolean asm.Tsat1.tableOnFile = asm.bXlsat \"= true, if table is defined on file or in function usertab\";
485  parameter Real asm.Tsat1.table[1,1] = -1.0 \"Table matrix (grid = first column; e.g., table=[0,2])\";
486  parameter Real asm.Tsat1.table[1,2] = 1.0 \"Table matrix (grid = first column; e.g., table=[0,2])\";
487  parameter Real asm.Tsat1.table[2,1] = 1.0 \"Table matrix (grid = first column; e.g., table=[0,2])\";
488  parameter Real asm.Tsat1.table[2,2] = 1.0 \"Table matrix (grid = first column; e.g., table=[0,2])\";
489  parameter Real asm.Tsat1.table[3,1] = 20.0 \"Table matrix (grid = first column; e.g., table=[0,2])\";
490  parameter Real asm.Tsat1.table[3,2] = 1.0 \"Table matrix (grid = first column; e.g., table=[0,2])\";
491  parameter String asm.Tsat1.tableName = \"x1\" \"Table name on file or in function usertab (see docu)\";
492  parameter String asm.Tsat1.fileName = asm.XlFileName \"File where matrix is stored\";
493  parameter Boolean asm.Tsat1.verboseRead = true \"= true, if info message that file is loading is to be printed\";
494  parameter Integer asm.Tsat1.columns[1] = 2 \"Columns of table to be interpolated\";
495  parameter enumeration(LinearSegments, ContinuousDerivative, ConstantSegments) asm.Tsat1.smoothness = Modelica.Blocks.Types.Smoothness.LinearSegments \"Smoothness of table interpolation\";
496  protected Modelica.Blocks.Types.ExternalCombiTable1D asm.Tsat1.tableID = Modelica.Blocks.Types.ExternalCombiTable1D.constructor(\"x1\", \"/home/hans/Projekte/Swansea/ShaftStudy/OM/xsat.txt\", {{-1.0, 1.0}, {1.0, 1.0}, {20.0, 1.0}}, {2}, Modelica.Blocks.Types.Smoothness.LinearSegments) \"External table object\";
497  protected parameter Real asm.Tsat1.tableOnFileRead(fixed = false) \"= 1, if table was successfully read from file\";
498  parameter Integer asm.Tsat2.n = 1 \"Number of inputs (= number of outputs)\";
499  Real asm.Tsat2.u[1] \"Connector of Real input signals\";
500  Real asm.Tsat2.y[1] \"Connector of Real output signals\";
501  parameter Boolean asm.Tsat2.tableOnFile = asm.bXlsat \"= true, if table is defined on file or in function usertab\";
502  parameter Real asm.Tsat2.table[1,1] = -1.0 \"Table matrix (grid = first column; e.g., table=[0,2])\";
503  parameter Real asm.Tsat2.table[1,2] = 1.0 \"Table matrix (grid = first column; e.g., table=[0,2])\";
504  parameter Real asm.Tsat2.table[2,1] = 1.0 \"Table matrix (grid = first column; e.g., table=[0,2])\";
505  parameter Real asm.Tsat2.table[2,2] = 1.0 \"Table matrix (grid = first column; e.g., table=[0,2])\";
506  parameter Real asm.Tsat2.table[3,1] = 20.0 \"Table matrix (grid = first column; e.g., table=[0,2])\";
507  parameter Real asm.Tsat2.table[3,2] = 1.0 \"Table matrix (grid = first column; e.g., table=[0,2])\";
508  parameter String asm.Tsat2.tableName = \"x2\" \"Table name on file or in function usertab (see docu)\";
509  parameter String asm.Tsat2.fileName = asm.XlFileName \"File where matrix is stored\";
510  parameter Boolean asm.Tsat2.verboseRead = true \"= true, if info message that file is loading is to be printed\";
511  parameter Integer asm.Tsat2.columns[1] = 2 \"Columns of table to be interpolated\";
512  parameter enumeration(LinearSegments, ContinuousDerivative, ConstantSegments) asm.Tsat2.smoothness = Modelica.Blocks.Types.Smoothness.LinearSegments \"Smoothness of table interpolation\";
513  protected Modelica.Blocks.Types.ExternalCombiTable1D asm.Tsat2.tableID = Modelica.Blocks.Types.ExternalCombiTable1D.constructor(\"x2\", \"/home/hans/Projekte/Swansea/ShaftStudy/OM/xsat.txt\", {{-1.0, 1.0}, {1.0, 1.0}, {20.0, 1.0}}, {2}, Modelica.Blocks.Types.Smoothness.LinearSegments) \"External table object\";
514  protected parameter Real asm.Tsat2.tableOnFileRead(fixed = false) \"= 1, if table was successfully read from file\";
515  parameter Real fixed.phi0(quantity = \"Angle\", unit = \"rad\", displayUnit = \"deg\") = 0.0 \"Fixed offset angle of housing\";
516  Real fixed.flange.phi(quantity = \"Angle\", unit = \"rad\", displayUnit = \"deg\") \"Absolute rotation angle of flange\";
517  Real fixed.flange.tau(quantity = \"Torque\", unit = \"N.m\") \"Cut torque in the flange\";
518  Real Max.y = yMaxi \"Value of Real output\";
519  Real clutch.phi_rel(quantity = \"Angle\", unit = \"rad\", displayUnit = \"deg\", start = 0.0, nominal = if clutch.phi_nominal >= 1e-15 then clutch.phi_nominal else 1.0, stateSelect = StateSelect.prefer) \"Relative rotation angle (= flange_b.phi - flange_a.phi)\";
520  Real clutch.w_rel(quantity = \"AngularVelocity\", unit = \"rad/s\", start = 0.0, stateSelect = StateSelect.prefer) \"Relative angular velocity (= der(phi_rel))\";
521  Real clutch.a_rel(quantity = \"AngularAcceleration\", unit = \"rad/s2\", start = 0.0) \"Relative angular acceleration (= der(w_rel))\";
522  Real clutch.tau(quantity = \"Torque\", unit = \"N.m\") \"Torque between flanges (= flange_b.tau)\";
523  Real clutch.flange_a.phi(quantity = \"Angle\", unit = \"rad\", displayUnit = \"deg\") \"Absolute rotation angle of flange\";
524  Real clutch.flange_a.tau(quantity = \"Torque\", unit = \"N.m\") \"Cut torque in the flange\";
525  Real clutch.flange_b.phi(quantity = \"Angle\", unit = \"rad\", displayUnit = \"deg\") \"Absolute rotation angle of flange\";
526  Real clutch.flange_b.tau(quantity = \"Torque\", unit = \"N.m\") \"Cut torque in the flange\";
527  parameter Real clutch.phi_nominal(quantity = \"Angle\", unit = \"rad\", displayUnit = \"rad\", min = 0.0) = 0.0001 \"Nominal value of phi_rel (used for scaling)\";
528  parameter enumeration(never, avoid, default, prefer, always) clutch.stateSelect = StateSelect.prefer \"Priority to use phi_rel and w_rel as states\";
529  parameter Real clutch.w_small(quantity = \"AngularVelocity\", unit = \"rad/s\") = 10000000000.0 \"Relative angular velocity near to zero if jumps due to a reinit(..) of the velocity can occur (set to low value only if such impulses can occur)\";
530  Real clutch.w_relfric(quantity = \"AngularVelocity\", unit = \"rad/s\") \"Relative angular velocity between frictional surfaces\";
531  Real clutch.a_relfric(quantity = \"AngularAcceleration\", unit = \"rad/s2\") \"Relative angular acceleration between frictional surfaces\";
532  Real clutch.tau0(quantity = \"Torque\", unit = \"N.m\") \"Friction torque for w=0 and forward sliding\";
533  Real clutch.tau0_max(quantity = \"Torque\", unit = \"N.m\") \"Maximum friction torque for w=0 and locked\";
534  Boolean clutch.free \"true, if frictional element is not active\";
535  Real clutch.sa(unit = \"1\") \"Path parameter of friction characteristic tau = f(a_relfric)\";
536  Boolean clutch.startForward(start = false, fixed = true) \"true, if w_rel=0 and start of forward sliding\";
537  Boolean clutch.startBackward(start = false, fixed = true) \"true, if w_rel=0 and start of backward sliding\";
538  Boolean clutch.locked(start = false, fixed = true) \"true, if w_rel=0 and not sliding\";
539  constant Integer clutch.Unknown = 3 \"Value of mode is not known\";
540  constant Integer clutch.Free = 2 \"Element is not active\";
541  constant Integer clutch.Forward = 1 \"w_rel > 0 (forward sliding)\";
542  constant Integer clutch.Stuck = 0 \"w_rel = 0 (forward sliding, locked or backward sliding)\";
543  constant Integer clutch.Backward = -1 \"w_rel < 0 (backward sliding)\";
544  Integer clutch.mode(min = -1, max = 3, start = 0, fixed = true);
545  protected constant Real clutch.unitAngularAcceleration(quantity = \"AngularAcceleration\", unit = \"rad/s2\") = 1.0;
546  protected constant Real clutch.unitTorque(quantity = \"Torque\", unit = \"N.m\") = 1.0;
547  parameter Boolean clutch.useHeatPort = false \"=true, if heatPort is enabled\";
548  Real clutch.lossPower(quantity = \"Power\", unit = \"W\") \"Loss power leaving component via heatPort (> 0, if heat is flowing out of component)\";
549  parameter Real clutch.mue_pos[1,1] = 0.0 \"[w,mue] positive sliding friction coefficient (w_rel>=0)\";
550  parameter Real clutch.mue_pos[1,2] = 0.5 \"[w,mue] positive sliding friction coefficient (w_rel>=0)\";
551  parameter Real clutch.peak(min = 1.0) = 2.0 \"peak*mue_pos[1,2] = maximum value of mue for w_rel==0\";
552  parameter Real clutch.cgeo(min = 0.0) = 1.0 \"Geometry constant containing friction distribution assumption\";
553  parameter Real clutch.fn_max(quantity = \"Force\", unit = \"N\", min = 0.0, start = 1.0) = 2.0 \"Maximum normal force\";
554  Real clutch.mue0 \"Friction coefficient for w=0 and forward sliding\";
555  Real clutch.fn(quantity = \"Force\", unit = \"N\") \"Normal force (fn=fn_max*f_normalized)\";
556  Real clutch.f_normalized \"Normalized force signal 0..1 (normal force = fn_max*f_normalized; clutch is engaged if > 0)\";
557  Real InertiaG.flange_a.phi(quantity = \"Angle\", unit = \"rad\", displayUnit = \"deg\") \"Absolute rotation angle of flange\";
558  Real InertiaG.flange_a.tau(quantity = \"Torque\", unit = \"N.m\") \"Cut torque in the flange\";
559  Real InertiaG.flange_b.phi(quantity = \"Angle\", unit = \"rad\", displayUnit = \"deg\") \"Absolute rotation angle of flange\";
560  Real InertiaG.flange_b.tau(quantity = \"Torque\", unit = \"N.m\") \"Cut torque in the flange\";
561  parameter Real InertiaG.J(quantity = \"MomentOfInertia\", unit = \"kg.m2\", min = 0.0, start = 1.0) = 20.54 \"Moment of inertia\";
562  parameter enumeration(never, avoid, default, prefer, always) InertiaG.stateSelect = StateSelect.default \"Priority to use phi and w as states\";
563  Real InertiaG.phi(quantity = \"Angle\", unit = \"rad\", displayUnit = \"deg\", stateSelect = StateSelect.default) \"Absolute rotation angle of component\";
564  Real InertiaG.w(quantity = \"AngularVelocity\", unit = \"rad/s\", stateSelect = StateSelect.default) \"Absolute angular velocity of component (= der(phi))\";
565  Real InertiaG.a(quantity = \"AngularAcceleration\", unit = \"rad/s2\") \"Absolute angular acceleration of component (= der(w))\";
566  Real Inertia.flange_a.phi(quantity = \"Angle\", unit = \"rad\", displayUnit = \"deg\") \"Absolute rotation angle of flange\";
567  Real Inertia.flange_a.tau(quantity = \"Torque\", unit = \"N.m\") \"Cut torque in the flange\";
568  Real Inertia.flange_b.phi(quantity = \"Angle\", unit = \"rad\", displayUnit = \"deg\") \"Absolute rotation angle of flange\";
569  Real Inertia.flange_b.tau(quantity = \"Torque\", unit = \"N.m\") \"Cut torque in the flange\";
570  parameter Real Inertia.J(quantity = \"MomentOfInertia\", unit = \"kg.m2\", min = 0.0, start = 1.0) = 0.5 \"Moment of inertia\";
571  parameter enumeration(never, avoid, default, prefer, always) Inertia.stateSelect = StateSelect.default \"Priority to use phi and w as states\";
572  Real Inertia.phi(quantity = \"Angle\", unit = \"rad\", displayUnit = \"deg\", stateSelect = StateSelect.default) \"Absolute rotation angle of component\";
573  Real Inertia.w(quantity = \"AngularVelocity\", unit = \"rad/s\", stateSelect = StateSelect.default) \"Absolute angular velocity of component (= der(phi))\";
574  Real Inertia.a(quantity = \"AngularAcceleration\", unit = \"rad/s2\") \"Absolute angular acceleration of component (= der(w))\";
575  parameter Boolean Tconst.useSupport = false \"= true, if support flange enabled, otherwise implicitly grounded\";
576  Real Tconst.flange.phi(quantity = \"Angle\", unit = \"rad\", displayUnit = \"deg\") \"Absolute rotation angle of flange\";
577  Real Tconst.flange.tau(quantity = \"Torque\", unit = \"N.m\") \"Cut torque in the flange\";
578  protected Real Tconst.phi_support(quantity = \"Angle\", unit = \"rad\", displayUnit = \"deg\") \"Absolute angle of support flange\";
579  Real Tconst.tau(unit = \"N.m\") \"Accelerating torque acting at flange (= -flange.tau)\";
580  Real Torque.y = load \"Value of Real output\";
581  parameter Boolean torque1.useSupport = false \"= true, if support flange enabled, otherwise implicitly grounded\";
582  Real torque1.flange.phi(quantity = \"Angle\", unit = \"rad\", displayUnit = \"deg\") \"Absolute rotation angle of flange\";
583  Real torque1.flange.tau(quantity = \"Torque\", unit = \"N.m\") \"Cut torque in the flange\";
584  protected Real torque1.phi_support(quantity = \"Angle\", unit = \"rad\", displayUnit = \"deg\") \"Absolute angle of support flange\";
585  Real torque1.tau(unit = \"N.m\") \"Accelerating torque acting at flange (= -flange.tau)\";
586  Real input1.y = dt \"Value of Real output\";
587  parameter Real wk = 1.0 \"Geschw. Koordinatensystem\";
588  parameter Real Omega = 1.0;
589  parameter Real OMrated = 1.0;
590  parameter Real Ubase = 8164.97;
591  parameter Real Ibase = 2083.21;
592  parameter Real Zbase = 3.91942;
593  parameter Real Sbase = 17009300.0;
594  parameter Real Tbase = 3399840.0;
595  parameter Real Ebase = 283320.0;
596  parameter Real Urated = 10000.0;
597  parameter Real Irated = 1473.05;
598  parameter Real Srated = 25514000.0;
599  parameter Real Speedrpm = 71.66249999999999;
600  parameter Real Speedrad = 7.50448;
601  parameter Integer NoPolepairs = 8;
602  parameter String ProjectHome = \"/home/hans/Projekte/Swansea/ShaftStudy/OM/\";
603  parameter Real Tk = 0.0;
604  Real Energy(start = 0.0);
605  Real voltage;
606  Real phi_relDEG;
607  output Real dtshaft;
608  constant Real rz31.c1 = 0.6666666666666666;
609  constant Real rz31.c2 = 0.3333333333333333;
610  constant Real rz31.c3 = 0.5773502691896258;
611  Real rz31.TR.re \"Real part of complex number\";
612  Real rz31.TR.im \"Imaginary part of complex number\";
613  Real rz31.wt;
614  Real rz31.u[1] \"Spannung\";
615  Real rz31.u[2] \"Spannung\";
616  Real rz31.i[1] \"Strom\";
617  Real rz31.i[2] \"Strom\";
618  Real rz31.dPin.v[1];
619  Real rz31.dPin.v[2];
620  Real rz31.dPin.v[3];
621  Real rz31.dPin.i[1];
622  Real rz31.dPin.i[2];
623  Real rz31.dPin.i[3];
624  Real rz31.Null.v(quantity = \"ElectricPotential\", unit = \"V\") \"Potential at the pin\";
625  Real rz31.Null.i(quantity = \"ElectricCurrent\", unit = \"A\") \"Current flowing into the pin\";
626  Real rz31.cPin.i.re \"Real part of complex number\";
627  Real rz31.cPin.i.im \"Imaginary part of complex number\";
628  Real rz31.cPin.v.re \"Real part of complex number\";
629  Real rz31.cPin.v.im \"Imaginary part of complex number\";
630  Real gnd.p.v(quantity = \"ElectricPotential\", unit = \"V\") \"Potential at the pin\";
631  Real gnd.p.i(quantity = \"ElectricCurrent\", unit = \"A\") \"Current flowing into the pin\";
632  parameter Real spg3var1.phi = 0.0 \"phase\";
633  parameter Real spg3var1.w = 1.0 \"frequency\";
634  constant Real spg3var1.c23 = 2.094395102393195;
635  Real spg3var1.DreiPin.v[1];
636  Real spg3var1.DreiPin.v[2];
637  Real spg3var1.DreiPin.v[3];
638  Real spg3var1.DreiPin.i[1];
639  Real spg3var1.DreiPin.i[2];
640  Real spg3var1.DreiPin.i[3];
641  Real spg3var1.pin.v(quantity = \"ElectricPotential\", unit = \"V\") \"Potential at the pin\";
642  Real spg3var1.pin.i(quantity = \"ElectricCurrent\", unit = \"A\") \"Current flowing into the pin\";
643  Real spg3var1.u1;
644  Real spg3var1.u2;
645  Real spg3var1.u3;
646  Real volts.y = voltage \"Value of Real output\";
647  Real one.y = 1.0 \"Value of Real output\";
648initial equation
649  der(asm.psi1.re) = 0.0;
650  der(asm.psi1.im) = 0.0;
651  der(asm.psi2.re) = 0.0;
652  der(asm.psi2.im) = 0.0;
653  der(InertiaG.w) = 0.0;
654  der(Inertia.w) = 0.0;
655  der(InertiaT.w) = 0.0;
656  shaft.w_rel = 0.0;
657initial algorithm
658  if asm.TsatM.tableOnFile then
659    asm.TsatM.tableOnFileRead := Modelica.Blocks.Tables.CombiTable1D$asm$TsatM.readTableData(asm.TsatM.tableID, false, asm.TsatM.verboseRead);
660  else
661    asm.TsatM.tableOnFileRead := 1.0;
662  end if;
663initial algorithm
664  if asm.Tsat1.tableOnFile then
665    asm.Tsat1.tableOnFileRead := Modelica.Blocks.Tables.CombiTable1D$asm$Tsat1.readTableData(asm.Tsat1.tableID, false, asm.Tsat1.verboseRead);
666  else
667    asm.Tsat1.tableOnFileRead := 1.0;
668  end if;
669initial algorithm
670  if asm.Tsat2.tableOnFile then
671    asm.Tsat2.tableOnFileRead := Modelica.Blocks.Tables.CombiTable1D$asm$Tsat2.readTableData(asm.Tsat2.tableID, false, asm.Tsat2.verboseRead);
672  else
673    asm.Tsat2.tableOnFileRead := 1.0;
674  end if;
675equation
676  meter.up.re = meter.Pin1.v.re;
677  meter.up.im = meter.Pin1.v.im;
678  meter.NULL.v.re = meter.Pin1.v.re;
679  meter.NULL.v.im = meter.Pin1.v.im;
680  meter.u.re = 0.0;
681  meter.u.im = 0.0;
682  meter.strom = Modelica.ComplexMath.'abs'(meter.i);
683  meter.spannung = Modelica.ComplexMath.'abs'(meter.up);
684  meter.s = 1.5 * meter.strom * meter.spannung;
685  meter.sComplex = Complex.'*'.multiply(Complex.'*'.multiply(meter.up, Modelica.ComplexMath.conj(meter.i)), Complex.'constructor'.fromReal(1.5, 0.0));
686  meter.p = Modelica.ComplexMath.real(meter.sComplex);
687  meter.q = Modelica.ComplexMath.imag(meter.sComplex);
688  meter.I = Complex.'*'.multiply(meter.i, Complex.'constructor'.fromReal(Ibase, 0.0));
689  meter.Strom = meter.strom * Irated;
690  meter.Spannung = meter.spannung * Urated;
691  meter.P = meter.p * Sbase;
692  meter.Q = meter.q * Sbase;
693  meter.S = meter.s * Sbase;
694  der(meter.i2t) = 1.5 * meter.strom ^ 2.0;
695  der(meter.energy) = meter.P;
696  meter.phiU = if noEvent(ElPower.Electric.Basics.abs(meter.up.re) < 0.0) then 1e-05 else Modelica.ComplexMath.arg(meter.up, 0.0);
697  meter.i.re = meter.Pin1.i.re;
698  meter.i.im = meter.Pin1.i.im;
699  meter.u = Complex.'-'.subtract(meter.Pin1.v, meter.Pin2.v);
700  Complex.'+'(meter.Pin1.i, meter.Pin2.i) = Complex(0.0, 0.0);
701  InertiaT.phi = InertiaT.flange_a.phi;
702  InertiaT.phi = InertiaT.flange_b.phi;
703  InertiaT.w = der(InertiaT.phi);
704  InertiaT.a = der(InertiaT.w);
705  InertiaT.J * InertiaT.a = InertiaT.flange_a.tau + InertiaT.flange_b.tau;
706  shaft.tau_c = shaft.c * (shaft.phi_rel - shaft.phi_rel0);
707  shaft.tau_d = shaft.d * shaft.w_rel;
708  shaft.tau = shaft.tau_c + shaft.tau_d;
709  shaft.lossPower = shaft.tau_d * shaft.w_rel;
710  shaft.phi_rel = shaft.flange_b.phi - shaft.flange_a.phi;
711  shaft.w_rel = der(shaft.phi_rel);
712  shaft.a_rel = der(shaft.w_rel);
713  shaft.flange_b.tau = shaft.tau;
714  shaft.flange_a.tau = -shaft.tau;
715  assert(asm.TsatM.tableName <> \"NoName\", \"tableOnFile = true and no table name given\");
716  asm.TsatM.y[1] = Modelica.Blocks.Tables.CombiTable1D$asm$TsatM.getTableValue(asm.TsatM.tableID, 1, asm.TsatM.u[1], asm.TsatM.tableOnFileRead);
717  assert(asm.Tsat1.tableName <> \"NoName\", \"tableOnFile = true and no table name given\");
718  asm.Tsat1.y[1] = Modelica.Blocks.Tables.CombiTable1D$asm$Tsat1.getTableValue(asm.Tsat1.tableID, 1, asm.Tsat1.u[1], asm.Tsat1.tableOnFileRead);
719  assert(asm.Tsat2.tableName <> \"NoName\", \"tableOnFile = true and no table name given\");
720  asm.Tsat2.y[1] = Modelica.Blocks.Tables.CombiTable1D$asm$Tsat2.getTableValue(asm.Tsat2.tableID, 1, asm.Tsat2.u[1], asm.Tsat2.tableOnFileRead);
721  asm.i1.re = asm.Pin.i.re;
722  asm.i1.im = asm.Pin.i.im;
723  asm.u1.re = asm.Pin.v.re;
724  asm.u1.im = asm.Pin.v.im;
725  asm.psi1abs = Modelica.ComplexMath.'abs'(asm.psi1);
726  asm.psi2abs = Modelica.ComplexMath.'abs'(asm.psi2);
727  asm.psimabs = Modelica.ComplexMath.'abs'(asm.psim);
728  asm.im = Complex.'+'(asm.i1, asm.i2);
729  Complex.'*'.multiply(asm.psim, Complex.'constructor'.fromReal(asm.fdm, 0.0)) = Complex.'*'.multiply(Complex.'constructor'.fromReal(asm.xh, 0.0), asm.im);
730  asm.psimabs = asm.TsatM.u[1];
731  asm.fdm = asm.TsatM.y[1];
732  asm.i1Abs = Modelica.ComplexMath.'abs'(asm.i1);
733  asm.i1Abs = asm.Tsat1.u[1];
734  asm.fd1 = asm.Tsat1.y[1];
735  asm.i2Abs = Modelica.ComplexMath.'abs'(asm.i2);
736  asm.i2Abs = asm.Tsat2.u[1];
737  asm.fd2 = asm.Tsat2.y[1];
738  asm.psi1 = Complex.'+'(Complex.'*'.multiply(Complex.'constructor'.fromReal(asm.fd1 * asm.x1s, 0.0), asm.i1), asm.psim);
739  asm.psi2 = Complex.'+'(asm.psim, Complex.'*'.multiply(Complex.'constructor'.fromReal(asm.fd2 * asm.x2s, 0.0), asm.i2));
740  asm.u1 = Complex.'+'(Complex.'+'(Complex.'*'.multiply(Complex.'constructor'.fromReal(asm.r1, 0.0), asm.i1), Complex.'/'(Complex(der(asm.psi1.re), der(asm.psi1.im)), Complex(OMrated, 0.0))), Complex.'*'.multiply(Complex.'*'.multiply(Complex.'constructor'.fromReal(wk, 0.0), Complex(0.0, 1.0)), asm.psi1));
741  Complex(0.0, 0.0) = Complex.'+'(Complex.'+'(Complex.'*'.multiply(Complex.'constructor'.fromReal(asm.r2, 0.0), asm.i2), Complex.'/'(Complex(der(asm.psi2.re), der(asm.psi2.im)), Complex(OMrated, 0.0))), Complex.'*'.multiply(Complex.'*'.multiply(Complex.'constructor'.fromReal(wk - asm.w, 0.0), Complex(0.0, 1.0)), asm.psi2));
742  asm.tau = asm.i1.re * asm.psi1.im - asm.i1.im * asm.psi1.re;
743  asm.phi = asm.Flange_a.phi - asm.Flange_b.phi;
744  asm.tau = asm.Flange_a.tau;
745  asm.tau = -asm.Flange_b.tau;
746  asm.w = der(asm.phi);
747  asm.strom = Modelica.ComplexMath.'abs'(asm.Pin.i);
748  asm.spannung = Modelica.ComplexMath.'abs'(asm.Pin.v);
749  asm.leistung = Complex.'*'.multiply(Complex.'*'.multiply(Complex.'constructor'.fromReal(1.5, 0.0), asm.Pin.v), Modelica.ComplexMath.conj(asm.Pin.i));
750  asm.leistungMech = 1.5 * asm.w * asm.tau;
751  asm.deltaP = asm.leistung.re + asm.leistungMech;
752  fixed.flange.phi = fixed.phi0;
753  clutch.mue0 = Modelica.Math.tempInterpol1(0.0, {{clutch.mue_pos[1,1], clutch.mue_pos[1,2]}}, 2);
754  clutch.w_relfric = clutch.w_rel;
755  clutch.a_relfric = clutch.a_rel;
756  clutch.fn = clutch.fn_max * clutch.f_normalized;
757  clutch.free = clutch.fn <= 0.0;
758  clutch.tau0 = clutch.mue0 * clutch.cgeo * clutch.fn;
759  clutch.tau0_max = clutch.peak * clutch.tau0;
760  clutch.tau = if clutch.locked then clutch.sa else if clutch.free then 0.0 else clutch.cgeo * clutch.fn * (if clutch.startForward then Modelica.Math.tempInterpol1(clutch.w_rel, {{clutch.mue_pos[1,1], clutch.mue_pos[1,2]}}, 2) else if clutch.startBackward then -Modelica.Math.tempInterpol1(-clutch.w_rel, {{clutch.mue_pos[1,1], clutch.mue_pos[1,2]}}, 2) else if pre(clutch.mode) == 1 then Modelica.Math.tempInterpol1(clutch.w_rel, {{clutch.mue_pos[1,1], clutch.mue_pos[1,2]}}, 2) else -Modelica.Math.tempInterpol1(-clutch.w_rel, {{clutch.mue_pos[1,1], clutch.mue_pos[1,2]}}, 2));
761  clutch.lossPower = clutch.tau * clutch.w_relfric;
762  clutch.phi_rel = clutch.flange_b.phi - clutch.flange_a.phi;
763  clutch.w_rel = der(clutch.phi_rel);
764  clutch.a_rel = der(clutch.w_rel);
765  clutch.flange_b.tau = clutch.tau;
766  clutch.flange_a.tau = -clutch.tau;
767  clutch.startForward = pre(clutch.mode) == 0 and (clutch.sa > clutch.tau0_max or pre(clutch.startForward) and clutch.sa > clutch.tau0) or pre(clutch.mode) == -1 and clutch.w_relfric > clutch.w_small or initial() and clutch.w_relfric > 0.0;
768  clutch.startBackward = pre(clutch.mode) == 0 and (clutch.sa < (-clutch.tau0_max) or pre(clutch.startBackward) and clutch.sa < (-clutch.tau0)) or pre(clutch.mode) == 1 and clutch.w_relfric < (-clutch.w_small) or initial() and clutch.w_relfric < 0.0;
769  clutch.locked = not clutch.free and not (pre(clutch.mode) == 1 or clutch.startForward or pre(clutch.mode) == -1 or clutch.startBackward);
770  clutch.a_relfric = if clutch.locked then 0.0 else if clutch.free then clutch.sa else if clutch.startForward then clutch.sa - clutch.tau0_max else if clutch.startBackward then clutch.sa + clutch.tau0_max else if pre(clutch.mode) == 1 then clutch.sa - clutch.tau0_max else clutch.sa + clutch.tau0_max;
771  clutch.mode = if clutch.free then 2 else if (pre(clutch.mode) == 1 or pre(clutch.mode) == 2 or clutch.startForward) and clutch.w_relfric > 0.0 then 1 else if (pre(clutch.mode) == -1 or pre(clutch.mode) == 2 or clutch.startBackward) and clutch.w_relfric < 0.0 then -1 else 0;
772  InertiaG.phi = InertiaG.flange_a.phi;
773  InertiaG.phi = InertiaG.flange_b.phi;
774  InertiaG.w = der(InertiaG.phi);
775  InertiaG.a = der(InertiaG.w);
776  InertiaG.J * InertiaG.a = InertiaG.flange_a.tau + InertiaG.flange_b.tau;
777  Inertia.phi = Inertia.flange_a.phi;
778  Inertia.phi = Inertia.flange_b.phi;
779  Inertia.w = der(Inertia.phi);
780  Inertia.a = der(Inertia.w);
781  Inertia.J * Inertia.a = Inertia.flange_a.tau + Inertia.flange_b.tau;
782  Tconst.flange.tau = -Tconst.tau;
783  Tconst.phi_support = 0.0;
784  torque1.flange.tau = -torque1.tau;
785  torque1.phi_support = 0.0;
786  rz31.u[1] = 0.6666666666666666 * rz31.dPin.v[1] + -0.3333333333333333 * rz31.dPin.v[2] + -0.3333333333333333 * rz31.dPin.v[3];
787  rz31.u[2] = 0.5773502691896258 * rz31.dPin.v[2] + -0.5773502691896258 * rz31.dPin.v[3];
788  -rz31.i[1] = 0.6666666666666666 * rz31.dPin.i[1] + -0.3333333333333333 * rz31.dPin.i[2] + -0.3333333333333333 * rz31.dPin.i[3];
789  -rz31.i[2] = 0.5773502691896258 * rz31.dPin.i[2] + -0.5773502691896258 * rz31.dPin.i[3];
790  rz31.wt = wk * time * OMrated;
791  rz31.TR = Modelica.ComplexMath.exp(Complex(0.0, -rz31.wt));
792  rz31.cPin.v = Complex.'*'.multiply(Complex(rz31.u[1], rz31.u[2]), rz31.TR);
793  rz31.cPin.i = Complex.'*'.multiply(Complex(rz31.i[1], rz31.i[2]), rz31.TR);
794  rz31.Null.i = (-rz31.dPin.i[3]) - rz31.dPin.i[1] - rz31.dPin.i[2];
795  rz31.Null.v = rz31.dPin.v[1] + rz31.dPin.v[2] + rz31.dPin.v[3];
796  gnd.p.v = 0.0;
797  spg3var1.DreiPin.v[1] = spg3var1.pin.v + spg3var1.u1 * cos(spg3var1.w * OMrated * time - spg3var1.phi);
798  spg3var1.DreiPin.v[2] = spg3var1.pin.v + spg3var1.u2 * cos(-2.094395102393195 + spg3var1.w * time * OMrated - spg3var1.phi);
799  spg3var1.DreiPin.v[3] = spg3var1.pin.v + spg3var1.u3 * cos(2.094395102393195 + spg3var1.w * OMrated * time - spg3var1.phi);
800  spg3var1.pin.i = spg3var1.DreiPin.i[1] + spg3var1.DreiPin.i[2] + spg3var1.DreiPin.i[3];
801  phi_relDEG = Modelica.SIunits.Conversions.to_deg(clutch.phi_rel) / /*Real*/(NoPolepairs);
802  voltage = if time > Tk then 0.0 else 1.0;
803  der(Energy) = clutch.lossPower;
804  dtshaft = shaft.tau;
805  6.283185307179586 * cycle = time;
806  torque = (-asm.tau) * Tbase;
807  torqueS = (-shaft.tau) * Tbase;
808  meter.Pin1.i.re + asm.Pin.i.re = 0.0;
809  meter.Pin1.i.im + asm.Pin.i.im = 0.0;
810  rz31.cPin.i.re + meter.Pin2.i.re = 0.0;
811  rz31.cPin.i.im + meter.Pin2.i.im = 0.0;
812  meter.NULL.i.re = 0.0;
813  meter.NULL.i.im = 0.0;
814  InertiaT.flange_a.tau + shaft.flange_b.tau = 0.0;
815  Tconst.flange.tau + InertiaT.flange_b.tau = 0.0;
816  shaft.flange_a.tau + Inertia.flange_b.tau = 0.0;
817  InertiaG.flange_a.tau + torque1.flange.tau + asm.Flange_a.tau = 0.0;
818  fixed.flange.tau + asm.Flange_b.tau = 0.0;
819  InertiaG.flange_b.tau + clutch.flange_a.tau = 0.0;
820  clutch.flange_b.tau + Inertia.flange_a.tau = 0.0;
821  rz31.dPin.i[1] + spg3var1.DreiPin.i[1] = 0.0;
822  rz31.dPin.i[2] + spg3var1.DreiPin.i[2] = 0.0;
823  rz31.dPin.i[3] + spg3var1.DreiPin.i[3] = 0.0;
824  rz31.Null.i = 0.0;
825  spg3var1.pin.i + gnd.p.i = 0.0;
826  one.y = spg3var1.u1;
827  spg3var1.u2 = spg3var1.u3;
828  spg3var1.u2 = volts.y;
829  rz31.dPin.v[1] = spg3var1.DreiPin.v[1];
830  rz31.dPin.v[2] = spg3var1.DreiPin.v[2];
831  rz31.dPin.v[3] = spg3var1.DreiPin.v[3];
832  gnd.p.v = spg3var1.pin.v;
833  meter.Pin2.v.re = rz31.cPin.v.re;
834  meter.Pin2.v.im = rz31.cPin.v.im;
835  input1.y = torque1.tau;
836  InertiaG.flange_a.phi = asm.Flange_a.phi;
837  InertiaG.flange_a.phi = torque1.flange.phi;
838  Tconst.tau = Torque.y;
839  InertiaT.flange_b.phi = Tconst.flange.phi;
840  Inertia.flange_a.phi = clutch.flange_b.phi;
841  Inertia.flange_b.phi = shaft.flange_a.phi;
842  InertiaG.flange_b.phi = clutch.flange_a.phi;
843  Max.y = clutch.f_normalized;
844  asm.Flange_b.phi = fixed.flange.phi;
845  asm.Pin.v.re = meter.Pin1.v.re;
846  asm.Pin.v.im = meter.Pin1.v.im;
847  InertiaT.flange_a.phi = shaft.flange_b.phi;
848algorithm
849
850algorithm
851end SwP3v04;
852"