Ticket #5972: DiagviewIssue.mo

File DiagviewIssue.mo, 8.8 KB (added by massimo ceraolo, 6 years ago)
Line 
1package DiagviewIssue
2 model M
3 extends PartialM;
4 import Modelica.Constants.*;
5 // parameter Modelica.SIunits.Mass vMass = 1300;
6 // parameter Modelica.SIunits.AngularVelocity wIceStart = 167;
7 // rad/s
8 Modelica.Blocks.Continuous.Integrator tokgFuel(k = 1 / 3.6e6) annotation(
9 Placement(visible = true, transformation(origin = {28, -70}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
10 Modelica.Blocks.Math.Product product1 annotation(
11 Placement(visible = true, transformation(origin = {28, -40}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
12 equation
13 connect(tokW.y, product1.u2) annotation(
14 Line(points = {{-18, -29}, {-18, -29}, {-18, -36}, {10, -36}, {10, -20}, {22, -20}, {22, -28}, {22, -28}}, color = {0, 0, 127}));
15 connect(product1.u1, toGramsPerkWh.y) annotation(
16 Line(points = {{34, -28}, {34, -20}, {42, -20}, {42, -13}}, color = {0, 0, 127}));
17 connect(tokgFuel.u, product1.y) annotation(
18 Line(points = {{28, -58}, {28, -51}, {28, -51}}, color = {0, 0, 127}));
19 annotation(
20 Diagram(coordinateSystem(preserveAspectRatio = false, initialScale = 0.1, extent = {{-100, -100}, {100, 100}})),
21 experiment(StopTime = 200, __Dymola_NumberOfIntervals = 1000, __Dymola_Algorithm = "Lsodar"),
22 __Dymola_experimentSetupOutput,
23 Documentation(info = "<html>
24 <p><b><span style=\"font-family: MS Shell Dlg 2;\">Simple map-based ICE model for power-split power trains - with connector</span></b> </p>
25 <p><span style=\"font-family: MS Shell Dlg 2;\">This is a &QUOT;connector&QUOT; version of MBiceP.</span></p>
26 <p><span style=\"font-family: MS Shell Dlg 2;\">For a general descritiption see the info of MBiceP.</span></p>
27 <p><span style=\"font-family: MS Shell Dlg 2;\">Signals connected to the connector:</span></p>
28 <p><span style=\"font-family: MS Shell Dlg 2;\">- icePowRef (input) is the power request (W). Negative values are internally converted to zero</span></p>
29 <p><span style=\"font-family: MS Shell Dlg 2;\">- iceW (output) is the measured ICE speed (rad/s)</span></p>
30 <p><span style=\"font-family: MS Shell Dlg 2;\">- icePowDel (output) delivered power (W)</span></p>
31 </html>"),
32 Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = false, initialScale = 0.1, grid = {2, 2})),
33 uses(Modelica(version = "3.2.2")));
34 end M;
35
36 model PartialM
37 import Modelica.Constants.*;
38 parameter Real contrGain(unit = "N.m/W") = 0.1 "Proportional controller gain";
39 parameter Real wIceStart(unit = "rad/s") = 167;
40 parameter Modelica.SIunits.MomentOfInertia iceJ = 0.5 "ICE moment of Inertia";
41 // rad/s
42 Modelica.Mechanics.Rotational.Components.Inertia inertia(w(fixed = true, start = wIceStart, displayUnit = "rpm"), J = iceJ) annotation(
43 Placement(visible = true, transformation(extent = {{30, 42}, {50, 62}}, rotation = 0)));
44 Modelica.Mechanics.Rotational.Sources.Torque iceTau annotation(
45 Placement(visible = true, transformation(extent = {{4, 42}, {24, 62}}, rotation = 0)));
46 Modelica.Mechanics.Rotational.Sensors.PowerSensor Pice annotation(
47 Placement(transformation(extent = {{66, 62}, {86, 42}})));
48 Modelica.Mechanics.Rotational.Sensors.SpeedSensor w annotation(
49 Placement(visible = true, transformation(origin = {58, 36}, extent = {{-10, -10}, {10, 10}}, rotation = 270)));
50 Modelica.Blocks.Math.Product toPowW annotation(
51 Placement(visible = true, transformation(origin = {-18, 10}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
52 Modelica.Blocks.Math.Feedback feedback annotation(
53 Placement(transformation(extent = {{-90, 62}, {-70, 42}})));
54 Modelica.Blocks.Math.Gain gain(k = contrGain) annotation(
55 Placement(visible = true, transformation(extent = {{-62, 42}, {-42, 62}}, rotation = 0)));
56 Modelica.Mechanics.Rotational.Interfaces.Flange_a flange_a annotation(
57 Placement(transformation(extent = {{90, -10}, {110, 10}}), iconTransformation(extent = {{90, -10}, {110, 10}})));
58 Modelica.Blocks.Tables.CombiTable2D toGramsPerkWh(table = specificCons) annotation(
59 Placement(transformation(extent = {{-10, 10}, {10, -10}}, rotation = -90, origin = {42, -2})));
60 Modelica.Blocks.Math.Gain tokW(k = 0.001) annotation(
61 Placement(visible = true, transformation(origin = {-18, -18}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
62 Modelica.Blocks.Nonlinear.Limiter limiter1(uMax = 1e99, uMin = 0) annotation(
63 Placement(visible = true, transformation(origin = {-22, 52}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
64 protected
65 parameter Real specificCons[:, :] = [0.0, 100, 200, 300, 400, 500; 10, 630, 580, 550, 580, 630; 20, 430, 420, 400, 400, 450; 30, 320, 325, 330, 340, 350; 40, 285, 285, 288, 290, 300; 50, 270, 265, 265, 270, 275; 60, 255, 248, 250, 255, 258; 70, 245, 237, 238, 243, 246; 80, 245, 230, 233, 237, 240; 90, 235, 230, 228, 233, 235] "curve of ice specific consumption (g/kWh)";
66 equation
67 connect(toPowW.y, tokW.u) annotation(
68 Line(points = {{-18, -1}, {-18, -6}}, color = {0, 0, 127}));
69 connect(toPowW.u2, iceTau.tau) annotation(
70 Line(points = {{-24, 22}, {-24, 32}, {-6, 32}, {-6, 52}, {2, 52}}, color = {0, 0, 127}));
71 connect(iceTau.tau, limiter1.y) annotation(
72 Line(points = {{2, 52}, {-10, 52}, {-10, 52}, {-11, 52}}, color = {0, 0, 127}));
73 connect(limiter1.u, gain.y) annotation(
74 Line(points = {{-34, 52}, {-42, 52}, {-42, 52}, {-41, 52}}, color = {0, 0, 127}));
75 connect(toGramsPerkWh.u1, iceTau.tau) annotation(
76 Line(points = {{36, 10}, {36, 32}, {-6, 32}, {-6, 52}, {2, 52}}, color = {0, 0, 127}));
77 connect(iceTau.flange, inertia.flange_a) annotation(
78 Line(points = {{24, 52}, {30, 52}}));
79 connect(w.flange, inertia.flange_b) annotation(
80 Line(points = {{58, 46}, {58, 52}, {50, 52}}));
81 connect(Pice.flange_a, inertia.flange_b) annotation(
82 Line(points = {{66, 52}, {50, 52}}));
83 connect(toGramsPerkWh.u2, w.w) annotation(
84 Line(points = {{48, 10}, {48, 20}, {58, 20}, {58, 25}}, color = {0, 0, 127}));
85 connect(toPowW.u1, w.w) annotation(
86 Line(points = {{-12, 22}, {-12, 25}, {58, 25}}, color = {0, 0, 127}));
87 connect(gain.u, feedback.y) annotation(
88 Line(points = {{-64, 52}, {-71, 52}}, color = {0, 0, 127}));
89 connect(Pice.flange_b, flange_a) annotation(
90 Line(points = {{86, 52}, {94, 52}, {94, 0}, {100, 0}}, color = {0, 0, 0}, smooth = Smooth.None));
91 connect(feedback.u2, Pice.power) annotation(
92 Line(points = {{-80, 60}, {-80, 72}, {68, 72}, {68, 63}}, color = {0, 0, 127}, smooth = Smooth.None));
93 annotation(
94 Documentation(info = "<html>
95 <p><b><span style=\"font-family: MS Shell Dlg 2;\">Simple map-based ICE model for power-split power trains - with connector</b> </span></p>
96 <p><span style=\"font-family: MS Shell Dlg 2;\">This is a &QUOT;connector&QUOT; version of MBice.</span></p>
97 <p><span style=\"font-family: MS Shell Dlg 2;\">For a general descritiption see the info of MBice.</span></p>
98 <p><span style=\"font-family: MS Shell Dlg 2;\">Signals connected to the connector:</span></p>
99 <p><span style=\"font-family: MS Shell Dlg 2;\">- icePowRef (input) is the power request (W). Negative values are internally converted to zero</span></p>
100 <p><span style=\"font-family: MS Shell Dlg 2;\">- iceW (output) is the measured ICE speed (rad/s)</span></p>
101 <p><span style=\"font-family: MS Shell Dlg 2;\">- icePowDel (output) delivered power (W)</span></p>
102 </html>"),
103 Icon(coordinateSystem(preserveAspectRatio = false, initialScale = 0.1), graphics = {Rectangle(fillColor = {192, 192, 192}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-24, 48}, {76, -44}}), Rectangle(fillColor = {192, 192, 192}, fillPattern = FillPattern.HorizontalCylinder, extent = {{76, 10}, {100, -10}}), Text(origin = {-2, 0}, extent = {{-140, -52}, {140, -86}}, textString = "J=%J"), Rectangle(extent = {{-100, 62}, {100, -100}}), Text(origin = {0, 10}, lineColor = {0, 0, 255}, extent = {{-140, 100}, {140, 60}}, textString = "%name"), Rectangle(extent = {{-90, 48}, {-32, -46}}), Rectangle(fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid, extent = {{-90, 2}, {-32, -20}}), Line(points = {{-60, 36}, {-60, 12}}), Polygon(points = {{-60, 46}, {-66, 36}, {-54, 36}, {-60, 46}}), Polygon(points = {{-60, 4}, {-66, 14}, {-54, 14}, {-60, 4}}), Rectangle(fillColor = {135, 135, 135}, fillPattern = FillPattern.Solid, extent = {{-64, -20}, {-54, -40}})}),
104 uses(Modelica(version = "3.2.2")),
105 Diagram(coordinateSystem(extent = {{-100, -80}, {100, 80}}, preserveAspectRatio = false, initialScale = 0.1, grid = {2, 2}), graphics = {Text(extent = {{-90, 20}, {-46, -16}}, textString = "follows the power
106 reference \nand computes consumption")}));
107 end PartialM;
108 annotation(
109 Diagram(coordinateSystem(extent = {{-100, -80}, {100, 80}})));
110end DiagviewIssue;