Ticket #4250: FoldingiIssue .mo

File FoldingiIssue .mo, 15.1 KB (added by ceraolo, 8 years ago)
Line 
1within ;
2package FoldingIssue
3  // €
4
5  package SubPkg
6
7    block NotFoldingModel "Constant U/f ratio plus U0"
8      import Modelica.Constants.pi;
9      parameter Modelica.SIunits.Voltage Ubase(start = 400) "Base phase-to-phase RMS voltage";
10      parameter Modelica.SIunits.AngularVelocity WeBase(start = 314.15) "Base electric frequency";
11      parameter Modelica.SIunits.AngularVelocity WeMax(start = 314.15) "Maximum Electric frequency";
12      parameter Integer pp(min = 1, start = 2) "number of pole pairs (Integer)";
13      Modelica.Blocks.Interfaces.RealInput Wm annotation(Placement(transformation(extent = {{-180, 40}, {-140, 80}}), iconTransformation(extent = {{-13, -13}, {13, 13}}, rotation = 90, origin = {63, -113})));
14      Modelica.Blocks.Interfaces.RealOutput U[3] annotation(Placement(transformation(extent = {{140, 50}, {160, 70}}), iconTransformation(extent = {{100, 30}, {120, 50}})));
15    protected
16      Modelica.Blocks.Math.Gain PolePairsG(k = pp) annotation(Placement(transformation(extent = {{-130, 50}, {-110, 70}})));
17    public
18      Modelica.Blocks.Interfaces.RealInput DWe annotation(Placement(transformation(extent = {{-180, -40}, {-140, 0}}), iconTransformation(extent = {{-13, -13}, {13, 13}}, rotation = 90, origin = {-59, -113})));
19    protected
20      Modelica.Blocks.Nonlinear.Limiter limiter1(uMin = 0, uMax = Ubase) annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 90, origin = {100, -28})));
21    protected
22      Modelica.Blocks.Math.Add add annotation(Placement(transformation(extent = {{-100, 40}, {-80, 60}})));
23      Modelica.Blocks.Nonlinear.Limiter limiter(uMin = 0, uMax = WeMax) annotation(Placement(transformation(extent = {{-72, 40}, {-52, 60}})));
24      Modelica.Blocks.Math.Add add1[3] annotation(Placement(transformation(extent = {{40, 60}, {60, 80}})));
25      Modelica.Blocks.Math.Sin sin[3] annotation(Placement(transformation(extent = {{74, 60}, {94, 80}})));
26      Modelica.Blocks.Continuous.Integrator integrator annotation(Placement(transformation(extent = {{-32, 60}, {-12, 80}})));
27      Modelica.Blocks.Routing.Replicator replicator(nout = 3) annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 90, origin = {100, 30})));
28      Modelica.Blocks.Math.Product product[3] annotation(Placement(transformation(extent = {{112, 50}, {132, 70}})));
29      Modelica.Blocks.Math.Gain ToPeak(k = sqrt(2 / 3)) annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 90, origin = {100, 0})));
30      Modelica.Blocks.Sources.Constant phase[3](k = 2 * pi / 3 * {0, -1, 1}) annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 90, origin = {30, 30})));
31      Modelica.Blocks.Routing.Replicator replicator1(nout = 3) annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 0, origin = {10, 70})));
32    public
33      Modelica.Blocks.Interfaces.RealOutput Wel annotation(Placement(transformation(extent = {{140, -70}, {160, -50}}), iconTransformation(extent = {{100, -50}, {120, -30}})));
34      Modelica.Blocks.Sources.RealExpression amplitude(y = alBreak.y + (Ubase - alBreak.y) * Wel / WeBase) annotation(Placement(transformation(extent = {{32, -56}, {86, -34}})));
35    public
36      Modelica.Blocks.Interfaces.RealInput U0 annotation(Placement(transformation(extent = {{-180, -100}, {-140, -60}}), iconTransformation(extent = {{-126, -12}, {-100, 14}})));
37      Modelica.Blocks.Continuous.FirstOrder alBreak(T = 0.01) annotation(Placement(transformation(extent = {{-128, -90}, {-108, -70}})));
38    equation
39      connect(add.u1, PolePairsG.y) annotation(Line(points = {{-102, 56}, {-102, 60}, {-109, 60}}, color = {0, 0, 127}, smooth = Smooth.None));
40      connect(limiter.u, add.y) annotation(Line(points = {{-74, 50}, {-79, 50}}, color = {0, 0, 127}, smooth = Smooth.None));
41      connect(sin.u, add1.y) annotation(Line(points = {{72, 70}, {61, 70}}, color = {0, 0, 127}, smooth = Smooth.None));
42      connect(integrator.u, limiter.y) annotation(Line(points = {{-34, 70}, {-34, 50}, {-51, 50}}, color = {0, 0, 127}, smooth = Smooth.None));
43      connect(product.y, U) annotation(Line(points = {{133, 60}, {150, 60}}, color = {0, 0, 127}, smooth = Smooth.None));
44      connect(product.u2, replicator.y) annotation(Line(points = {{110, 54}, {100, 54}, {100, 41}}, color = {0, 0, 127}, smooth = Smooth.None));
45      connect(ToPeak.y, replicator.u) annotation(Line(points = {{100, 11}, {100, 18}}, color = {0, 0, 127}, smooth = Smooth.None));
46      connect(sin.y, product.u1) annotation(Line(points = {{95, 70}, {102, 70}, {102, 66}, {110, 66}}, color = {0, 0, 127}, smooth = Smooth.None));
47      connect(add1.u1, replicator1.y) annotation(Line(points = {{38, 76}, {30, 76}, {30, 70}, {21, 70}}, color = {0, 0, 127}, smooth = Smooth.None));
48      connect(add1.u2, phase.y) annotation(Line(points = {{38, 64}, {30, 64}, {30, 41}}, color = {0, 0, 127}, smooth = Smooth.None));
49      connect(Wel, limiter.y) annotation(Line(points = {{150, -60}, {-42, -60}, {-42, 50}, {-51, 50}}, color = {0, 0, 127}, smooth = Smooth.None));
50      connect(Wel, Wel) annotation(Line(points = {{150, -60}, {150, -60}}, color = {0, 0, 127}, smooth = Smooth.None));
51      connect(PolePairsG.u, Wm) annotation(Line(points = {{-132, 60}, {-160, 60}}, color = {0, 0, 127}, smooth = Smooth.None));
52      connect(replicator1.u, integrator.y) annotation(Line(points = {{-2, 70}, {-11, 70}}, color = {0, 0, 127}, smooth = Smooth.None));
53      connect(DWe, add.u2) annotation(Line(points = {{-160, -20}, {-102, -20}, {-102, 44}}, color = {0, 0, 127}, smooth = Smooth.None));
54      connect(ToPeak.u, limiter1.y) annotation(Line(points = {{100, -12}, {100, -17}}, color = {0, 0, 127}, smooth = Smooth.None));
55      connect(amplitude.y, limiter1.u) annotation(Line(points = {{88.7, -45}, {90, -44}, {100, -44}, {100, -40}}, color = {0, 0, 127}, smooth = Smooth.None));
56      connect(U0, alBreak.u) annotation(Line(points = {{-160, -80}, {-146, -80}, {-130, -80}}, color = {0, 0, 127}));
57      annotation(Diagram(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics = {Text(extent = {{-11, 3}, {11, -3}}, lineColor = {0, 0, 255}, textString = "Omega", origin = {-47, 1}, rotation = 90)}), Icon(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 127}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Line(points = {{-40, -50}, {-40, 76}}, color = {0, 0, 127}, smooth = Smooth.None), Line(points = {{-48, 66}, {-40, 78}, {-34, 66}}, color = {0, 0, 127}, smooth = Smooth.None), Line(points = {{-54, -42}, {90, -42}}, color = {0, 0, 127}, smooth = Smooth.None), Line(points = {{-7, -6}, {1, 6}, {7, -6}}, color = {0, 0, 127}, smooth = Smooth.None, origin = {87, -42}, rotation = 270), Line(points = {{-46, -28}, {24, 40}, {76, 40}}, color = {0, 0, 127}, smooth = Smooth.None), Line(points = {{-47, -23}, {-31, -23}}, color = {0, 0, 127}, smooth = Smooth.None), Text(extent = {{-82, -6}, {-51, -34}}, lineColor = {0, 0, 127}, textString = "Uo"), Text(extent = {{-84, 54}, {-48, 26}}, lineColor = {0, 0, 127}, textString = "Un"), Line(points = {{-47, 39}, {-31, 39}}, color = {0, 0, 127}, smooth = Smooth.None), Text(extent = {{9, -47}, {52, -78}}, lineColor = {0, 0, 127}, textString = "Wn"), Line(points = {{26, -14}, {26, -46}, {26, -36}}, color = {0, 0, 127}, smooth = Smooth.None), Text(extent = {{-100, 144}, {98, 106}}, lineColor = {0, 0, 255}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, textString = "%name")}), Documentation(info = "<html>
58<p>This class produces a three-phase voltage system to variable-frequency control of an asynchronous motor.</p>
59<p>The output voltages constitute a three-phase system of quasi-sinusoidal shapes, created according to the following equations:</p>
60<p>Wel=Wmecc*PolePairs+DeltaWel</p>
61<p>U=U0+(Un-U0)*(Wel)/Wnom</p>
62<p>where:</p>
63<p><ul>
64<li>U0, Un U, are initial, nominal actual voltage amplitudes</li>
65<li>Wmecc, Wel are machine (mechanical) and supply (electrical) angular speeds</li>
66<li>PolePairs are the number of machine pole pairs</li>
67<li>DeltaWel is an input variable and depends on the desired torque</li>
68</ul></p>
69</html>"));
70    end NotFoldingModel;
71
72    block FoldingModel "Follows upper fig. 12.15 from FEPE Book"
73    import Modelica.Constants.pi;
74      parameter Modelica.SIunits.Resistance Rr(start = 0.04) "Rotor resistance";
75      parameter Modelica.SIunits.Resistance Rs(start = 0.03) "Stator resistance";
76      parameter Modelica.SIunits.Voltage Ubase(start = 400) "Base phase-to-phase RMS voltage";
77      parameter Modelica.SIunits.Current Imax(start = 150) "Maximum value of rms current";
78      parameter Modelica.SIunits.AngularVelocity WeBase(start = 314.16) "Base electric frequency";
79      parameter Modelica.SIunits.Inductance Lstray(start = 0.2036 / WeBase) "Combined stray inductance";
80      parameter Modelica.SIunits.AngularVelocity WmMax(start = 314.16) "Maximum Electric frequency";
81      parameter Integer pp(min = 1, start = 2) "number of pole pairs (Integer)";
82      //La seguente keyword final consente fra l'altro di far scomparire questi parametri dalla maschera.
83      final parameter Real Kw(fixed = true) = Ubase / sqrt(3) / (WeBase / pp) "Ratio U/Wmecc";
84    public
85      Modelica.Blocks.Interfaces.RealInput Wm annotation(
86        Placement(transformation(extent = {{-160, -80}, {-120, -40}}), iconTransformation(extent = {{-13, -13}, {13, 13}}, rotation = 90, origin = {1, -113})));
87      Modelica.Blocks.Interfaces.RealOutput Ustar annotation(
88        Placement(transformation(extent = {{120, -50}, {140, -30}}), iconTransformation(extent = {{100, -70}, {120, -50}})));
89      Modelica.Blocks.Interfaces.RealInput Tstar annotation(
90        Placement(transformation(extent = {{-160, 40}, {-120, 80}}), iconTransformation(extent = {{-13, -13}, {13, 13}}, rotation = 0, origin = {-113, -1})));
91    protected
92      Modelica.Blocks.Math.Add add annotation(
93        Placement(transformation(extent = {{-100, -26}, {-80, -6}})));
94      Modelica.Blocks.Nonlinear.Limiter limWm(uMax = WmMax, uMin = Ubase / sqrt(3) / 10) annotation(
95        Placement(transformation(extent = {{-54, -26}, {-34, -6}})));
96    public
97      Modelica.Blocks.Interfaces.RealOutput Westar annotation(
98        Placement(transformation(extent = {{120, 50}, {140, 70}}), iconTransformation(extent = {{100, 50}, {120, 70}})));
99      TorqueToDW torqueToDW(Rr = Rr, pp = pp, Kw = Kw, Lstray = Lstray) annotation(
100        Placement(transformation(extent = {{-100, 50}, {-80, 70}})));
101      Modelica.Blocks.Math.Gain gain(k = pp) annotation(
102        Placement(transformation(extent = {{62, 50}, {82, 70}})));
103      Modelica.Blocks.Math.Add add1(k1 = Rs, k2 = Kw) annotation(
104        Placement(transformation(extent = {{40, -10}, {60, 10}})));
105      DWToI dWToI(Rr = Rr, pp = pp, Kw = Kw, Imax = Imax, Lstray = Lstray) annotation(
106        Placement(transformation(extent = {{-12, 20}, {8, 40}})));
107      Modelica.Blocks.Math.Gain gain1(k = Kw) annotation(
108        Placement(transformation(extent = {{34, -42}, {54, -22}})));
109    protected
110      Modelica.Blocks.Nonlinear.Limiter limU(uMin = 0, uMax = Ubase / sqrt(3)) annotation(
111        Placement(transformation(extent = {{76, -10}, {96, 10}})));
112    equation
113      connect(limWm.u, add.y) annotation(
114        Line(points = {{-56, -16}, {-79, -16}}, color = {0, 0, 127}, smooth = Smooth.None));
115      connect(Tstar, torqueToDW.u) annotation(
116        Line(points = {{-140, 60}, {-102, 60}}, color = {0, 0, 127}));
117      connect(torqueToDW.y, add.u1) annotation(
118        Line(points = {{-79, 60}, {-79, 60}, {-60, 60}, {-60, 40}, {-102, 40}, {-102, -10}}, color = {0, 0, 127}));
119      connect(add.u2, Wm) annotation(
120        Line(points = {{-102, -22}, {-110, -22}, {-110, -60}, {-140, -60}}, color = {0, 0, 127}));
121      connect(dWToI.u, add.u1) annotation(
122        Line(points = {{-14, 30}, {-14, 30}, {-40, 30}, {-102, 30}, {-102, -10}}, color = {0, 0, 127}));
123      connect(dWToI.y, add1.u1) annotation(
124        Line(points = {{9, 30}, {9, 28}, {34, 28}, {34, 6}, {38, 6}}, color = {0, 0, 127}));
125      connect(Westar, gain.y) annotation(
126        Line(points = {{130, 60}, {106, 60}, {83, 60}}, color = {0, 0, 127}));
127      connect(gain.u, limWm.y) annotation(
128        Line(points = {{60, 60}, {50, 60}, {20, 60}, {20, -16}, {-33, -16}}, color = {0, 0, 127}));
129      connect(add1.u2, limWm.y) annotation(
130        Line(points = {{38, -6}, {-4, -6}, {-4, -16}, {-33, -16}}, color = {0, 0, 127}));
131      connect(gain1.u, limWm.y) annotation(
132        Line(points = {{32, -32}, {20, -32}, {20, -16}, {-33, -16}}, color = {0, 0, 127}));
133      connect(add1.y, limU.u) annotation(
134        Line(points = {{61, 0}, {74, 0}}, color = {0, 0, 127}));
135      connect(limU.y, Ustar) annotation(
136        Line(points = {{97, 0}, {102, 0}, {102, -40}, {130, -40}}, color = {0, 0, 127}));
137      annotation(
138        Diagram(coordinateSystem(preserveAspectRatio = false, extent = {{-120, -80}, {120, 80}})),
139        Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 127}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Line(points = {{-40, -50}, {-40, 76}}, color = {0, 0, 127}, smooth = Smooth.None), Line(points = {{-48, 66}, {-40, 78}, {-34, 66}}, color = {0, 0, 127}, smooth = Smooth.None), Line(points = {{-54, -42}, {90, -42}}, color = {0, 0, 127}, smooth = Smooth.None), Line(points = {{-7, -6}, {1, 6}, {7, -6}}, color = {0, 0, 127}, smooth = Smooth.None, origin = {87, -42}, rotation = 270), Line(points = {{-46, -28}, {24, 40}, {76, 40}}, color = {0, 0, 127}, smooth = Smooth.None), Line(points = {{-47, -23}, {-31, -23}}, color = {0, 0, 127}, smooth = Smooth.None), Text(extent = {{-82, -6}, {-51, -34}}, lineColor = {0, 0, 127}, textString = "Uo"), Text(extent = {{-84, 54}, {-48, 26}}, lineColor = {0, 0, 127}, textString = "Un"), Line(points = {{-47, 39}, {-31, 39}}, color = {0, 0, 127}, smooth = Smooth.None), Text(extent = {{9, -47}, {52, -78}}, lineColor = {0, 0, 127}, textString = "Wn"), Line(points = {{26, -14}, {26, -46}, {26, -36}}, color = {0, 0, 127}, smooth = Smooth.None), Text(extent = {{-100, 144}, {98, 106}}, lineColor = {0, 0, 255}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, textString = "%name")}),
140        Documentation(info = "<html>
141<p>This class produces a three-phase voltage system to variable-frequency control of an asynchronous motor.</p>
142<p>The output voltages constitute a three-phase system of quasi-sinusoidal shapes, created according to the following equations:</p>
143<p>Wel=Wmecc*PolePairs+DeltaWel</p>
144<p>U=U0+(Un-U0)*(Wel)/Wnom</p>
145<p>where:</p>
146<p><ul>
147<li>U0, Un U, are initial, nominal actual voltage amplitudes</li>
148<li>Wmecc, Wel are machine (mechanical) and supply (electrical) angular speeds</li>
149<li>PolePairs are the number of machine pole pairs</li>
150<li>DeltaWel is an input variable and depends on the desired torque</li>
151</ul></p>
152</html>"));
153    end FoldingModel;
154  end SubPkg;
155  annotation(uses(Modelica(version = "3.2.1")));
156end FoldingIssue;