Ticket #6297: LeadLagDynIEEE.mo

File LeadLagDynIEEE.mo, 4.6 KB (added by massimo ceraolo, 4 years ago)
Line 
1model LeadLagDynIEEE "Lag-lead block with non-windup limits according to IEEE 421.5"
2 parameter Modelica.SIunits.Time Tu = 1, Td = 1;
3 parameter Real yMax = 1, yMin = 1;
4 parameter Real K = 1;
5 constant Real One = 1;
6 parameter Real initialOutput(final fixed = false);
7 Modelica.Blocks.Interfaces.RealInput u annotation(
8 Placement(visible = true, transformation(origin = {-120, 0}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {-118, 0}, extent = {{-20, -20}, {20, 20}}, rotation = 0)));
9 Modelica.Blocks.Interfaces.RealOutput y(start = 1) annotation(
10 Placement(visible = true, transformation(origin = {110, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {110, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
11 Modelica.Blocks.Math.Add add(k1 = One, k2 = One) annotation(
12 Placement(visible = true, transformation(origin = {-22, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
13 Modelica.Blocks.Math.Gain gain(k = Tu / Td) annotation(
14 Placement(visible = true, transformation(origin = {18, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
15 Modelica.Blocks.Nonlinear.Limiter limiter(limitsAtInit = true, uMax = yMax, uMin = yMin) annotation(
16 Placement(visible = true, transformation(origin = {50, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
17 Modelica.Blocks.Math.Gain gain1(k = Td / Tu - 1) annotation(
18 Placement(visible = true, transformation(origin = {-62, -32}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
19 Modelica.Blocks.Continuous.Integrator integrator(k = 1 / Tu, initType = Modelica.Blocks.Types.Init.InitialState, y_start = initialOutput) annotation(
20 Placement(transformation(extent = {{0, -56}, {-20, -36}})));
21 Modelica.Blocks.Math.Add add1(k1 = One, k2 = -One) annotation(
22 Placement(visible = true, transformation(origin = {54, -46}, extent = {{10, -10}, {-10, 10}}, rotation = 0)));
23 Modelica.Blocks.Math.Gain gain2(k = K) annotation(
24 Placement(visible = true, transformation(origin = {-78, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
25initial equation
26 initialOutput = y;
27equation
28 connect(y, limiter.y) annotation(
29 Line(points = {{110, 0}, {61, 0}}, color = {0, 0, 127}));
30 connect(gain.u, add.y) annotation(
31 Line(points = {{6, 0}, {-11, 0}}, color = {0, 0, 127}));
32 connect(limiter.u, gain.y) annotation(
33 Line(points = {{38, 0}, {29, 0}}, color = {0, 0, 127}));
34 connect(gain1.y, add.u2) annotation(
35 Line(points = {{-62, -21}, {-62, -6}, {-34, -6}}, color = {0, 0, 127}));
36 connect(add1.u1, limiter.y) annotation(
37 Line(points = {{66, -40}, {84, -40}, {84, 0}, {61, 0}}, color = {0, 0, 127}));
38 connect(add1.y, integrator.u) annotation(
39 Line(points = {{43, -46}, {2, -46}}, color = {0, 0, 127}));
40 connect(integrator.y, add1.u2) annotation(
41 Line(points = {{-21, -46}, {-34, -46}, {-34, -68}, {78, -68}, {78, -52}, {66, -52}}, color = {0, 0, 127}));
42 connect(integrator.y, gain1.u) annotation(
43 Line(points = {{-21, -46}, {-42, -46}, {-42, -56}, {-62, -56}, {-62, -44}}, color = {0, 0, 127}));
44 connect(gain2.u, u) annotation(
45 Line(points = {{-90, 0}, {-120, 0}}, color = {0, 0, 127}));
46 connect(gain2.y, add.u1) annotation(
47 Line(points = {{-67, 0}, {-50, 0}, {-50, 6}, {-34, 6}}, color = {0, 0, 127}));
48 annotation(
49 Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}), graphics = {Line(points = {{-72, -130}, {-12, -130}, {46, 128}, {100, 128}}, color = {0, 0, 0}), Text(extent = {{-128, 142}, {42, 116}}, lineColor = {0, 0, 255}, textString = "%name"), Rectangle(extent = {{-100, 102}, {100, -100}}, lineColor = {0, 0, 127}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Text(lineColor = {0, 0, 127}, extent = {{-68, 20}, {110, 58}}, textString = "1+sTu"), Line(points = {{-46, 2}, {90, 2}}, color = {0, 0, 127}), Text(lineColor = {0, 0, 127}, extent = {{-64, -54}, {108, -18}}, textString = "1+sTd"), Text(lineColor = {0, 0, 127}, extent = {{-92, -16}, {-54, 20}}, textString = "K"), Text(lineColor = {238, 46, 47}, extent = {{4, -90}, {100, -82}}, textString = "IEEE")}),
50 Diagram(coordinateSystem(extent = {{-100, -80}, {100, 20}})),
51 Documentation(info = "<html>
52<p>Nota:</p>
53<p>Le costnati degli Add sono state assegnate attraverso la costante One, invece che lasciarle come valore numerico in modo che esse non saranno visibili nella FMU una volta creata (con Dymola).</p>
54<p>Infatti correttamente Dymola non espone a maschera nella FMU le grandezze internamente assegnate con formule matematiche; sono invece esposti tutti i parametri asegnati in modo numerico.</p>
55</html>"));
56end LeadLagDynIEEE;