| 1 | package wbEHPTlib "Electric and Hybrid Power train library Rev March 2017"
|
|---|
| 2 | package SupportModels "Useful addtional models"
|
|---|
| 3 | extends Modelica.Icons.Package;
|
|---|
| 4 | // extends EHPowerTrain.Icons.SupportIcon;
|
|---|
| 5 |
|
|---|
| 6 | package MapBasedRelated
|
|---|
| 7 | model InertiaTq "Inertia with added torque"
|
|---|
| 8 | import SI = Modelica.SIunits;
|
|---|
| 9 | Modelica.Mechanics.Rotational.Interfaces.Flange_a flange_a "Left flange of shaft" annotation(
|
|---|
| 10 | Placement(transformation(extent = {{-110, -10}, {-90, 10}}, rotation = 0)));
|
|---|
| 11 | Modelica.Mechanics.Rotational.Interfaces.Flange_b flange_b "Right flange of shaft" annotation(
|
|---|
| 12 | Placement(transformation(extent = {{90, -10}, {110, 10}}, rotation = 0)));
|
|---|
| 13 | parameter SI.Inertia J(min = 0, start = 1) "Moment of inertia";
|
|---|
| 14 | parameter StateSelect stateSelect = StateSelect.default "Priority to use phi and w as states" annotation(
|
|---|
| 15 | HideResult = true,
|
|---|
| 16 | Dialog(tab = "Advanced"));
|
|---|
| 17 | SI.Angle phi(stateSelect = stateSelect) "Absolute rotation angle of component" annotation(
|
|---|
| 18 | Dialog(group = "Initialization", showStartAttribute = true));
|
|---|
| 19 | SI.AngularVelocity w(stateSelect = stateSelect) "Absolute angular velocity of component (= der(phi))" annotation(
|
|---|
| 20 | Dialog(group = "Initialization", showStartAttribute = true));
|
|---|
| 21 | SI.AngularAcceleration a "Absolute angular acceleration of component (= der(w))" annotation(
|
|---|
| 22 | Dialog(group = "Initialization", showStartAttribute = true));
|
|---|
| 23 | Modelica.Blocks.Interfaces.RealInput tau annotation(
|
|---|
| 24 | Placement(transformation(extent = {{-20.5, -20}, {20.5, 20}}, rotation = 90, origin = {-54.5, -100})));
|
|---|
| 25 | equation
|
|---|
| 26 | phi = flange_a.phi;
|
|---|
| 27 | phi = flange_b.phi;
|
|---|
| 28 | w = der(phi);
|
|---|
| 29 | a = der(w);
|
|---|
| 30 | J * a = flange_a.tau + flange_b.tau + tau;
|
|---|
| 31 | annotation(
|
|---|
| 32 | Documentation(info = "<html>
|
|---|
| 33 | <p>
|
|---|
| 34 | Rotational component with <b>inertia</b> and two rigidly connected flanges.
|
|---|
| 35 | </p>
|
|---|
| 36 |
|
|---|
| 37 | </HTML>
|
|---|
| 38 | "),
|
|---|
| 39 | Icon(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}, grid = {2, 2}), graphics = {Rectangle(extent = {{-100, 10}, {-50, -10}}, lineColor = {0, 0, 0}, fillPattern = FillPattern.HorizontalCylinder, fillColor = {192, 192, 192}), Rectangle(extent = {{50, 10}, {100, -10}}, lineColor = {0, 0, 0}, fillPattern = FillPattern.HorizontalCylinder, fillColor = {192, 192, 192}), Line(points = {{-80, -25}, {-60, -25}}, color = {0, 0, 0}), Line(points = {{60, -25}, {80, -25}}, color = {0, 0, 0}), Line(points = {{-70, -25}, {-70, -70}}, color = {0, 0, 0}), Line(points = {{70, -25}, {70, -70}}, color = {0, 0, 0}), Line(points = {{-80, 25}, {-60, 25}}, color = {0, 0, 0}), Line(points = {{60, 25}, {80, 25}}, color = {0, 0, 0}), Line(points = {{-70, 45}, {-70, 25}}, color = {0, 0, 0}), Line(points = {{70, 45}, {70, 25}}, color = {0, 0, 0}), Line(points = {{-70, -70}, {70, -70}}, color = {0, 0, 0}), Rectangle(extent = {{-50, 50}, {50, -50}}, lineColor = {0, 0, 0}, fillPattern = FillPattern.HorizontalCylinder, fillColor = {192, 192, 192}), Text(extent = {{-150, 100}, {150, 60}}, textString = "%name", lineColor = {0, 0, 255}), Text(extent = {{-150, -80}, {150, -120}}, lineColor = {0, 0, 0}, textString = "J=%J")}),
|
|---|
| 40 | Diagram(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}, grid = {2, 2}), graphics));
|
|---|
| 41 | end InertiaTq;
|
|---|
| 42 |
|
|---|
| 43 | block EfficiencyT "Determines the electric power from the mechanical considering efficiency map"
|
|---|
| 44 | parameter Boolean mapsOnFile = false;
|
|---|
| 45 | parameter Modelica.SIunits.Torque tauMax(start = 400) "Maximum machine torque";
|
|---|
| 46 | parameter Modelica.SIunits.Power powMax(start = 22000) "Maximum drive power";
|
|---|
| 47 | parameter Modelica.SIunits.AngularVelocity wMax(start = 650) "Maximum machine speed";
|
|---|
| 48 | parameter String mapsFileName = "NoName" "File where matrix is stored" annotation(
|
|---|
| 49 | Dialog(enable = mapsOnFile, loadSelector(filter = "Text files (*.txt)", caption = "Open file in which required tables are")));
|
|---|
| 50 | parameter String effTableName = "noName" "name of the on-file maximum torque as a function of speed" annotation(
|
|---|
| 51 | Dialog(enable = mapsOnFile));
|
|---|
| 52 | parameter Real effTable[:, :] = [0.00, 0.00, 0.25, 0.50, 0.75, 1.00; 0.00, 0.75, 0.80, 0.81, 0.82, 0.83; 0.25, 0.76, 0.81, 0.82, 0.83, 0.84; 0.50, 0.77, 0.82, 0.83, 0.84, 0.85; 0.75, 0.78, 0.83, 0.84, 0.85, 0.87; 1.00, 0.80, 0.84, 0.85, 0.86, 0.88] annotation(
|
|---|
| 53 | Dialog(enable = not mapsOnFile));
|
|---|
| 54 | //the name is passed because a file can contain efficiency tables for
|
|---|
| 55 | //different submodels, e.g. genEfficiency for generator and motEfficiency for motor.
|
|---|
| 56 | Modelica.Blocks.Tables.CombiTable2D effTable_(tableOnFile = mapsOnFile, smoothness = Modelica.Blocks.Types.Smoothness.LinearSegments, fileName = mapsFileName, tableName = effTableName, table = effTable) "normalised efficiency" annotation(
|
|---|
| 57 | Placement(transformation(extent = {{-14, -14}, {14, 14}}, rotation = 0, origin = {18, -18})));
|
|---|
| 58 | Modelica.Blocks.Interfaces.RealInput w annotation(
|
|---|
| 59 | Placement(transformation(extent = {{-140, -60}, {-100, -20}}), iconTransformation(extent = {{-140, -60}, {-100, -20}})));
|
|---|
| 60 | Modelica.Blocks.Interfaces.RealInput tau annotation(
|
|---|
| 61 | Placement(transformation(extent = {{-140, 20}, {-100, 60}}), iconTransformation(extent = {{-140, 20}, {-100, 60}})));
|
|---|
| 62 | Modelica.Blocks.Interfaces.RealOutput elePow annotation(
|
|---|
| 63 | Placement(transformation(extent = {{96, -10}, {116, 10}})));
|
|---|
| 64 | Modelica.Blocks.Math.Abs abs1 annotation(
|
|---|
| 65 | Placement(transformation(extent = {{-76, -50}, {-56, -30}})));
|
|---|
| 66 | Modelica.Blocks.Math.Abs abs2 annotation(
|
|---|
| 67 | Placement(transformation(extent = {{-80, 40}, {-60, 60}})));
|
|---|
| 68 | Modelica.Blocks.Math.Gain normalizeTau(k = 1 / tauMax) annotation(
|
|---|
| 69 | Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 0, origin = {-36, 50})));
|
|---|
| 70 | wbEHPTlib.SupportModels.MapBasedRelated.Pel applyEta annotation(
|
|---|
| 71 | Placement(transformation(extent = {{60, -10}, {84, 12}})));
|
|---|
| 72 | Modelica.Blocks.Math.Product PMOT annotation(
|
|---|
| 73 | Placement(transformation(extent = {{-72, 0}, {-52, 20}})));
|
|---|
| 74 | Modelica.Blocks.Math.Gain normalizeSpeed(k = 1 / wMax) annotation(
|
|---|
| 75 | Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 0, origin = {-34, -40})));
|
|---|
| 76 | equation
|
|---|
| 77 | connect(tau, abs2.u) annotation(
|
|---|
| 78 | Line(points = {{-120, 40}, {-94, 40}, {-94, 50}, {-82, 50}}, color = {0, 0, 127}, smooth = Smooth.None));
|
|---|
| 79 | connect(w, abs1.u) annotation(
|
|---|
| 80 | Line(points = {{-120, -40}, {-78, -40}}, color = {0, 0, 127}, smooth = Smooth.None));
|
|---|
| 81 | connect(abs2.y, normalizeTau.u) annotation(
|
|---|
| 82 | Line(points = {{-59, 50}, {-48, 50}}, color = {0, 0, 127}, smooth = Smooth.None));
|
|---|
| 83 | connect(normalizeTau.y, effTable_.u1) annotation(
|
|---|
| 84 | Line(points = {{-25, 50}, {-7.7, 50}, {-7.7, -9.6}, {1.2, -9.6}}, color = {0, 0, 127}, smooth = Smooth.None));
|
|---|
| 85 | connect(applyEta.Pel, elePow) annotation(
|
|---|
| 86 | Line(points = {{85.2, 1}, {92.48, 1}, {92.48, 0}, {106, 0}}, color = {0, 0, 127}, smooth = Smooth.None));
|
|---|
| 87 | connect(effTable_.y, applyEta.eta) annotation(
|
|---|
| 88 | Line(points = {{33.4, -18}, {46, -18}, {46, -5.6}, {57.6, -5.6}}, color = {0, 0, 127}, smooth = Smooth.None));
|
|---|
| 89 | connect(PMOT.u1, tau) annotation(
|
|---|
| 90 | Line(points = {{-74, 16}, {-84, 16}, {-84, 40}, {-120, 40}}, color = {0, 0, 127}, smooth = Smooth.None));
|
|---|
| 91 | connect(PMOT.u2, w) annotation(
|
|---|
| 92 | Line(points = {{-74, 4}, {-84, 4}, {-84, -40}, {-120, -40}}, color = {0, 0, 127}, smooth = Smooth.None));
|
|---|
| 93 | connect(PMOT.y, applyEta.P) annotation(
|
|---|
| 94 | Line(points = {{-51, 10}, {42, 10}, {42, 7.6}, {57.6, 7.6}}, color = {0, 0, 127}, smooth = Smooth.None));
|
|---|
| 95 | connect(abs1.y, normalizeSpeed.u) annotation(
|
|---|
| 96 | Line(points = {{-55, -40}, {-46, -40}}, color = {0, 0, 127}, smooth = Smooth.None));
|
|---|
| 97 | connect(normalizeSpeed.y, effTable_.u2) annotation(
|
|---|
| 98 | Line(points = {{-23, -40}, {-10, -40}, {-10, -26.4}, {1.2, -26.4}}, color = {0, 0, 127}, smooth = Smooth.None));
|
|---|
| 99 | annotation(
|
|---|
| 100 | Diagram(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -80}, {100, 80}})),
|
|---|
| 101 | Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 72}, {100, -72}}, lineColor = {0, 0, 0}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Line(points = {{-74, -54}, {-74, 58}}, color = {0, 0, 0}, smooth = Smooth.None), Line(points = {{-82, -48}, {78, -48}}, color = {0, 0, 0}, smooth = Smooth.None), Line(points = {{-74, 38}, {-24, 38}, {-4, 12}, {28, -8}, {60, -22}, {62, -48}}, color = {0, 0, 0}, smooth = Smooth.None), Polygon(points = {{-20, 14}, {-40, 24}, {-56, -4}, {-38, -36}, {12, -38}, {26, -28}, {22, -20}, {8, -6}, {-8, 4}, {-20, 14}}, lineColor = {0, 0, 0}, smooth = Smooth.None, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Polygon(points = {{-28, 4}, {-38, 2}, {-32, -20}, {0, -32}, {10, -28}, {12, -20}, {-28, 4}}, lineColor = {0, 0, 0}, smooth = Smooth.None, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Text(extent = {{-102, 118}, {100, 78}}, lineColor = {0, 0, 255}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, textString = "%name"), Text(extent = {{26, 46}, {76, 4}}, lineColor = {0, 0, 0}, textString = "T")}),
|
|---|
| 102 | Documentation(info = "<html>
|
|---|
| 103 | <p>This block computes the machine and inverter losses from the mechanical input quantities and determines the power to be drawn from the electric circuit. The "drawn" power can be also a negative numer, meaning that themachine is actually delivering electric power.</p>
|
|---|
| 104 | <p>The given efficiency map is intended as being built with torques being ratios of actual torques to tauMax and speeds being ratios of w to wMax. In case the user uses, in the given efficiency map, torques in Nm and speeds in rad/s, the block can be used selecting tauTmax=1, wMax=1.</p>
|
|---|
| 105 | <p>The choice of having normalised efficiency computation allows simulations of machines different in sizes and similar in characteristics to be repeated without having to rebuild the efficiency maps. </p>
|
|---|
| 106 | <p>Torques are written in the first matrix column, speeds on the first row.</p>
|
|---|
| 107 | </html>"));
|
|---|
| 108 | end EfficiencyT;
|
|---|
| 109 |
|
|---|
| 110 | block EfficiencyLF "Determines the electric from the mechanical power considering loss with a formula"
|
|---|
| 111 | import wbEHPTlib;
|
|---|
| 112 | parameter Modelica.SIunits.Torque tauMax(start = 400) "Maximum machine torque(Nm)";
|
|---|
| 113 | parameter Modelica.SIunits.Power powMax(start = 22000) "Maximum drive power";
|
|---|
| 114 | parameter Modelica.SIunits.AngularVelocity wMax(start = 650) "Maximum machine speed(rad/s)";
|
|---|
| 115 | parameter Real effTable[:, :] = [0.00, 0.00, 0.25, 0.50, 0.75, 1.00; 0.00, 0.75, 0.80, 0.81, 0.82, 0.83; 0.25, 0.76, 0.81, 0.82, 0.83, 0.84; 0.50, 0.77, 0.82, 0.83, 0.84, 0.85; 0.75, 0.78, 0.83, 0.84, 0.85, 0.87; 1.00, 0.80, 0.84, 0.85, 0.86, 0.88];
|
|---|
| 116 | Modelica.Blocks.Interfaces.RealInput w annotation(
|
|---|
| 117 | Placement(transformation(extent = {{-140, -60}, {-100, -20}}), iconTransformation(extent = {{-140, -60}, {-100, -20}})));
|
|---|
| 118 | Modelica.Blocks.Interfaces.RealInput tau annotation(
|
|---|
| 119 | Placement(transformation(extent = {{-140, 20}, {-100, 60}}), iconTransformation(extent = {{-140, 20}, {-100, 60}})));
|
|---|
| 120 | Modelica.Blocks.Interfaces.RealOutput elePow annotation(
|
|---|
| 121 | Placement(transformation(extent = {{96, -10}, {116, 10}})));
|
|---|
| 122 | Modelica.Blocks.Math.Abs abs1 annotation(
|
|---|
| 123 | Placement(transformation(extent = {{-76, -50}, {-56, -30}})));
|
|---|
| 124 | Modelica.Blocks.Math.Abs abs2 annotation(
|
|---|
| 125 | Placement(transformation(extent = {{-80, 40}, {-60, 60}})));
|
|---|
| 126 | Modelica.Blocks.Math.Gain normalizeTau(k = 1 / tauMax) annotation(
|
|---|
| 127 | Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 0, origin = {-36, 50})));
|
|---|
| 128 | Modelica.Blocks.Math.Gain normalizeSpeed(k = 1 / wMax) annotation(
|
|---|
| 129 | Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 0, origin = {-34, -40})));
|
|---|
| 130 | wbEHPTlib.SupportModels.MapBasedRelated.AddLossesWT addLosses annotation(
|
|---|
| 131 | Placement(transformation(extent = {{10, -10}, {30, 10}})));
|
|---|
| 132 | equation
|
|---|
| 133 | connect(tau, abs2.u) annotation(
|
|---|
| 134 | Line(points = {{-120, 40}, {-94, 40}, {-94, 50}, {-82, 50}}, color = {0, 0, 127}, smooth = Smooth.None));
|
|---|
| 135 | connect(w, abs1.u) annotation(
|
|---|
| 136 | Line(points = {{-120, -40}, {-78, -40}}, color = {0, 0, 127}, smooth = Smooth.None));
|
|---|
| 137 | connect(abs2.y, normalizeTau.u) annotation(
|
|---|
| 138 | Line(points = {{-59, 50}, {-48, 50}}, color = {0, 0, 127}, smooth = Smooth.None));
|
|---|
| 139 | connect(abs1.y, normalizeSpeed.u) annotation(
|
|---|
| 140 | Line(points = {{-55, -40}, {-46, -40}}, color = {0, 0, 127}, smooth = Smooth.None));
|
|---|
| 141 | connect(addLosses.T, normalizeTau.y) annotation(
|
|---|
| 142 | Line(points = {{8.2, 6}, {-18, 6}, {-18, 50}, {-25, 50}}, color = {0, 0, 127}));
|
|---|
| 143 | connect(addLosses.W, normalizeSpeed.y) annotation(
|
|---|
| 144 | Line(points = {{8.2, -6}, {-18, -6}, {-18, -40}, {-23, -40}}, color = {0, 0, 127}));
|
|---|
| 145 | connect(addLosses.y, elePow) annotation(
|
|---|
| 146 | Line(points = {{30.6, 0}, {30.6, 0}, {106, 0}}, color = {0, 0, 127}));
|
|---|
| 147 | annotation(
|
|---|
| 148 | Diagram(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -80}, {100, 80}})),
|
|---|
| 149 | Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 72}, {100, -72}}, lineColor = {0, 0, 0}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Line(points = {{-74, -54}, {-74, 58}}, color = {0, 0, 0}, smooth = Smooth.None), Line(points = {{-82, -48}, {78, -48}}, color = {0, 0, 0}, smooth = Smooth.None), Line(points = {{-74, 38}, {-24, 38}, {-4, 12}, {28, -8}, {60, -22}, {62, -48}}, color = {0, 0, 0}, smooth = Smooth.None), Polygon(points = {{-20, 14}, {-40, 24}, {-56, -4}, {-38, -36}, {12, -38}, {26, -28}, {22, -20}, {8, -6}, {-8, 4}, {-20, 14}}, lineColor = {0, 0, 0}, smooth = Smooth.None, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Polygon(points = {{-28, 4}, {-38, 2}, {-32, -20}, {0, -32}, {10, -28}, {12, -20}, {-28, 4}}, lineColor = {0, 0, 0}, smooth = Smooth.None, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Text(extent = {{-102, 118}, {100, 78}}, lineColor = {0, 0, 255}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, textString = "%name"), Text(extent = {{26, 46}, {76, 4}}, lineColor = {0, 0, 0}, textString = "L")}),
|
|---|
| 150 | Documentation(info = "<html>
|
|---|
| 151 | <p>This block computes the machine and inverter losses from the mechanical input quantities and determines the power to be drawn from the electric circuit. The "drawn" power can be also a negative numer, meaning that the machine is actually delivering electric power.</p>
|
|---|
| 152 | <p>The signs ot T and W must be such that their product is positive when mechanical power exits from the machine (electric motor operation)</p>
|
|---|
| 153 | </html>"));
|
|---|
| 154 | end EfficiencyLF;
|
|---|
| 155 |
|
|---|
| 156 | block EffiPlot "Utility to plot efficiencies from an effTable"
|
|---|
| 157 | import wbEHPTlib;
|
|---|
| 158 | parameter Real tauMax(start = 400) "Maximum machine torque(Nm)";
|
|---|
| 159 | parameter Real powMax(start = 22000) "Maximum drive power";
|
|---|
| 160 | parameter Real wMax(start = 650) "Maximum machine speed(rad/s)";
|
|---|
| 161 | parameter Real effTable[:, :] = [0.00, 0.00, 0.25, 0.50, 0.75, 1.00; 0.00, 0.75, 0.80, 0.81, 0.82, 0.83; 0.25, 0.76, 0.81, 0.82, 0.83, 0.84; 0.50, 0.77, 0.82, 0.83, 0.84, 0.85; 0.75, 0.78, 0.83, 0.84, 0.85, 0.87; 1.00, 0.80, 0.84, 0.85, 0.86, 0.88];
|
|---|
| 162 | Real tau[size(effs, 1)];
|
|---|
| 163 | Real effs[:] = {0.75, 0.775, 0.8, 0.825, 0.85, 0.875};
|
|---|
| 164 | Modelica.Blocks.Tables.CombiTable2D effTable_[size(effs, 1)](each tableOnFile = false, each smoothness = Modelica.Blocks.Types.Smoothness.LinearSegments, each table = effTable) "normalised efficiency" annotation(
|
|---|
| 165 | Placement(transformation(extent = {{-14, -14}, {14, 14}}, rotation = 0, origin = {-2, 0})));
|
|---|
| 166 | equation
|
|---|
| 167 | for i in 1:size(effs, 1) loop
|
|---|
| 168 | effTable_[i].y = effs[i];
|
|---|
| 169 | effTable_[i].u1 = time;
|
|---|
| 170 | effTable_[i].u2 = tau[i];
|
|---|
| 171 | end for;
|
|---|
| 172 | annotation(
|
|---|
| 173 | Diagram(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -80}, {100, 80}})),
|
|---|
| 174 | Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 72}, {100, -72}}, lineColor = {0, 0, 0}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Line(points = {{-74, -54}, {-74, 58}}, color = {0, 0, 0}, smooth = Smooth.None), Line(points = {{-82, -48}, {78, -48}}, color = {0, 0, 0}, smooth = Smooth.None), Line(points = {{-74, 38}, {-24, 38}, {-4, 12}, {28, -8}, {60, -22}, {62, -48}}, color = {0, 0, 0}, smooth = Smooth.None), Polygon(points = {{-20, 14}, {-40, 24}, {-56, -4}, {-38, -36}, {12, -38}, {26, -28}, {22, -20}, {8, -6}, {-8, 4}, {-20, 14}}, lineColor = {0, 0, 0}, smooth = Smooth.None, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Polygon(points = {{-28, 4}, {-38, 2}, {-32, -20}, {0, -32}, {10, -28}, {12, -20}, {-28, 4}}, lineColor = {0, 0, 0}, smooth = Smooth.None, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Text(extent = {{-102, 118}, {100, 78}}, lineColor = {0, 0, 255}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, textString = "%name"), Text(extent = {{26, 46}, {76, 4}}, lineColor = {0, 0, 0}, textString = "M")}),
|
|---|
| 175 | Documentation(info = "<html>
|
|---|
| 176 | <p>This block computes the machine and inverter losses from the mechanical input quantities and determines the power to be drawn from the electric circuit. The "drawn" power can be also a negative numer, meaning that themachine is actually delivering electric power.</p>
|
|---|
| 177 | <p>The given efficiency map is intended as being built with torques being ratios of actual torques to tauMax and speeds being ratios of w to wMax. In case the user uses, in the given efficiency map, torques in Nm and speeds in rad/s, the block can be used selecting tauTmax=1, wMax=1.</p>
|
|---|
| 178 | <p>The choice of having normalised efficiency computation allows simulations of machines different in sizes and similar in characteristics to be repeated without having to rebuild the efficiency maps. </p>
|
|---|
| 179 | <p>Torques are written in the first matrix column, speeds on the first row.</p>
|
|---|
| 180 | </html>"));
|
|---|
| 181 | end EffiPlot;
|
|---|
| 182 |
|
|---|
| 183 | block EffiPlot2 "Utility to plot efficiencies from an effTable"
|
|---|
| 184 | import wbEHPTlib;
|
|---|
| 185 | parameter Modelica.SIunits.Torque tauMax(start = 400) "Maximum machine torque(Nm)";
|
|---|
| 186 | parameter Modelica.SIunits.Power powMax(start = 22000) "Maximum drive power";
|
|---|
| 187 | parameter Modelica.SIunits.AngularVelocity wMax(start = 650) "Maximum machine speed(rad/s)";
|
|---|
| 188 |
|
|---|
| 189 | function eff
|
|---|
| 190 | input Real A, bT, bS, bP;
|
|---|
| 191 | input Real tq "input torque";
|
|---|
| 192 | input Real sp "input speed";
|
|---|
| 193 | output Real eff;
|
|---|
| 194 | protected
|
|---|
| 195 | Real pLoss;
|
|---|
| 196 | algorithm
|
|---|
| 197 | pLoss := A + bT * tq ^ 2 + bS * sp ^ 2 + bP * (tq * sp) ^ 2;
|
|---|
| 198 | eff := tq * sp / (tq * sp + pLoss);
|
|---|
| 199 | end eff;
|
|---|
| 200 |
|
|---|
| 201 | function lossFun
|
|---|
| 202 | input Real A, bT, bS, bP;
|
|---|
| 203 | input Real tq "input torque";
|
|---|
| 204 | input Real sp "input speed";
|
|---|
| 205 | output Real pLoss;
|
|---|
| 206 | algorithm
|
|---|
| 207 | pLoss := A + bT * tq ^ 2 + bS * sp ^ 2 + bP * (tq * sp) ^ 2;
|
|---|
| 208 | end lossFun;
|
|---|
| 209 |
|
|---|
| 210 | Real tauE[size(effs, 1)];
|
|---|
| 211 | Real tauL[size(loss, 1)];
|
|---|
| 212 | Real loss[:] = {0.02, 0.04, 0.06, 0.08};
|
|---|
| 213 | Real effs[:] = {0.75, 0.8, 0.85, 0.9};
|
|---|
| 214 | equation
|
|---|
| 215 | for i in 1:size(effs, 1) loop
|
|---|
| 216 | effs[i] = eff(0.0005, 0.02, 0.01, 0.025, tauE[i], time);
|
|---|
| 217 | end for;
|
|---|
| 218 | for i in 1:size(loss, 1) loop
|
|---|
| 219 | loss[i] = lossFun(0.0005, 0.02, 0.01, 0.025, tauL[i], time);
|
|---|
| 220 | end for;
|
|---|
| 221 | annotation(
|
|---|
| 222 | Diagram(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -80}, {100, 80}})),
|
|---|
| 223 | Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 72}, {100, -72}}, lineColor = {0, 0, 0}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Line(points = {{-74, -54}, {-74, 58}}, color = {0, 0, 0}, smooth = Smooth.None), Line(points = {{-82, -48}, {78, -48}}, color = {0, 0, 0}, smooth = Smooth.None), Line(points = {{-74, 38}, {-24, 38}, {-4, 12}, {28, -8}, {60, -22}, {62, -48}}, color = {0, 0, 0}, smooth = Smooth.None), Polygon(points = {{-20, 14}, {-40, 24}, {-56, -4}, {-38, -36}, {12, -38}, {26, -28}, {22, -20}, {8, -6}, {-8, 4}, {-20, 14}}, lineColor = {0, 0, 0}, smooth = Smooth.None, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Polygon(points = {{-28, 4}, {-38, 2}, {-32, -20}, {0, -32}, {10, -28}, {12, -20}, {-28, 4}}, lineColor = {0, 0, 0}, smooth = Smooth.None, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Text(extent = {{-102, 118}, {100, 78}}, lineColor = {0, 0, 255}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, textString = "%name"), Text(extent = {{26, 46}, {76, 4}}, lineColor = {0, 0, 0}, textString = "M")}),
|
|---|
| 224 | Documentation(info = "<html>
|
|---|
| 225 | <p>Questo modello di ausilio cerca di riprodurre i contour descritti nel file Efficiency.docx.</p>
|
|---|
| 226 | <p>Nella versione presente ha due difetti fondamentali:</p>
|
|---|
| 227 | <p>1) non riesce a descrivere curve polidrome a differenza di contour. Questo è critico in quanto le curve di efficienza sono proprio di questo tipo.</p>
|
|---|
| 228 | <p>2) non riesce a gestire i casi in cui per un certo vaore della velocità non si trova la coppia che da una data perdita. Se ad es. le perdite si cercano a partire da 0.02 dappiako da ecciciency.docx che ha curva delle perdite ha tangente verticale per velocità pari a 1.4, ed infatti il modello proposto deve rimanere con 0.02 al di sotto di 1.4, altrimenti non converge.</p>
|
|---|
| 229 | </html>"),
|
|---|
| 230 | experiment(StartTime = 0.1, StopTime = 1.35));
|
|---|
| 231 | end EffiPlot2;
|
|---|
| 232 |
|
|---|
| 233 | block AddLossesWT "adds drive losses function of W and T"
|
|---|
| 234 | parameter Real A = 0.006 "fixed p.u. losses";
|
|---|
| 235 | parameter Real bT(unit = "J/(N2.m2)") = 0.1 "torque losses coefficient";
|
|---|
| 236 | parameter Real bW(unit = "J/(rad2.s2)") = 0.1 "speed losses coefficient";
|
|---|
| 237 | parameter Real bP(unit = "J/W2") = 0.07 "power losses coefficient";
|
|---|
| 238 | Modelica.SIunits.Energy losses;
|
|---|
| 239 | Modelica.Blocks.Interfaces.RealInput W annotation(
|
|---|
| 240 | Placement(transformation(extent = {{-138, -80}, {-98, -40}})));
|
|---|
| 241 | Modelica.Blocks.Interfaces.RealOutput y annotation(
|
|---|
| 242 | Placement(transformation(extent = {{96, -10}, {116, 10}})));
|
|---|
| 243 | Modelica.Blocks.Interfaces.RealInput T annotation(
|
|---|
| 244 | Placement(transformation(extent = {{-138, 40}, {-98, 80}})));
|
|---|
| 245 | equation
|
|---|
| 246 | losses = A + bT * T ^ 2 + bW * W ^ 2 + bP * (T * W) ^ 2;
|
|---|
| 247 | y = T * W + losses;
|
|---|
| 248 | annotation(
|
|---|
| 249 | Diagram(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}})),
|
|---|
| 250 | 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), Polygon(points = {{-20, -22}, {20, -22}, {20, -60}, {40, -60}, {0, -100}, {-40, -60}, {-20, -60}, {-20, -22}}, lineColor = {0, 0, 0}, smooth = Smooth.None, fillColor = {255, 0, 0}, fillPattern = FillPattern.Solid), Text(extent = {{-100, 75}, {100, 35}}, lineColor = {0, 0, 127}, fillColor = {255, 0, 0}, fillPattern = FillPattern.Solid, textString = "%name"), Text(extent = {{-70, 10}, {74, -16}}, lineColor = {0, 0, 0}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, textString = "W-T")}));
|
|---|
| 251 | end AddLossesWT;
|
|---|
| 252 |
|
|---|
| 253 | model ConstPg "Constant Power DC Load"
|
|---|
| 254 | parameter Real vNom = 100;
|
|---|
| 255 | parameter Modelica.SIunits.Time Ti = 0.01 "inner PI follower integral time constant";
|
|---|
| 256 | Real v "DC voltage";
|
|---|
| 257 | Modelica.Blocks.Math.Feedback feedback1 annotation(
|
|---|
| 258 | Placement(visible = true, transformation(origin = {56, -44}, extent = {{-10, -10}, {10, 10}}, rotation = 180)));
|
|---|
| 259 | Modelica.Electrical.Analog.Interfaces.PositivePin pin_p annotation(
|
|---|
| 260 | Placement(visible = true, transformation(extent = {{-108, 58}, {-88, 78}}, rotation = 0), iconTransformation(extent = {{-10, 90}, {10, 110}}, rotation = 0)));
|
|---|
| 261 | Modelica.Electrical.Analog.Interfaces.NegativePin pin_n annotation(
|
|---|
| 262 | Placement(visible = true, transformation(extent = {{-108, -74}, {-88, -54}}, rotation = 0), iconTransformation(extent = {{-10, -108}, {10, -88}}, rotation = 0)));
|
|---|
| 263 | Modelica.Blocks.Interfaces.RealInput Pref "Reference power" annotation(
|
|---|
| 264 | Placement(visible = true, transformation(origin = {100, -44}, extent = {{-18, -18}, {18, 18}}, rotation = 180), iconTransformation(origin = {82, 0}, extent = {{-18, -18}, {18, 18}}, rotation = 180)));
|
|---|
| 265 | Modelica.Electrical.Analog.Sensors.PowerSensor pSensor annotation(
|
|---|
| 266 | Placement(visible = true, transformation(extent = {{-82, 58}, {-62, 78}}, rotation = 0)));
|
|---|
| 267 | Modelica.Electrical.Analog.Basic.VariableConductor varCond annotation(
|
|---|
| 268 | Placement(visible = true, transformation(origin = {-50, 0}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
|
|---|
| 269 | Modelica.Blocks.Continuous.Integrator integrator1(k = 1 / vNom ^ 2 / Ti) annotation(
|
|---|
| 270 | Placement(visible = true, transformation(origin = {-2, -44}, extent = {{10, -10}, {-10, 10}}, rotation = 0)));
|
|---|
| 271 | equation
|
|---|
| 272 | connect(integrator1.u, feedback1.y) annotation(
|
|---|
| 273 | Line(points = {{10, -44}, {47, -44}}, color = {0, 0, 127}));
|
|---|
| 274 | connect(integrator1.y, varCond.G) annotation(
|
|---|
| 275 | Line(points = {{-13, -44}, {-28, -44}, {-28, 0}, {-39, 0}}, color = {0, 0, 127}));
|
|---|
| 276 | connect(feedback1.u2, pSensor.power) annotation(
|
|---|
| 277 | Line(points = {{56, -36}, {56, 42}, {-80, 42}, {-80, 57}}, color = {0, 0, 127}));
|
|---|
| 278 | connect(varCond.n, pin_n) annotation(
|
|---|
| 279 | Line(points = {{-50, -10}, {-50, -10}, {-50, -64}, {-98, -64}, {-98, -64}}, color = {0, 0, 255}));
|
|---|
| 280 | connect(varCond.p, pSensor.nc) annotation(
|
|---|
| 281 | Line(points = {{-50, 10}, {-50, 10}, {-50, 68}, {-62, 68}, {-62, 68}}, color = {0, 0, 255}));
|
|---|
| 282 | connect(pSensor.pv, pSensor.pc) annotation(
|
|---|
| 283 | Line(points = {{-72, 78}, {-82, 78}, {-82, 68}}, color = {0, 0, 255}));
|
|---|
| 284 | connect(pSensor.pc, pin_p) annotation(
|
|---|
| 285 | Line(points = {{-82, 68}, {-98, 68}}, color = {0, 0, 255}));
|
|---|
| 286 | connect(pSensor.nv, pin_n) annotation(
|
|---|
| 287 | Line(points = {{-72, 58}, {-72, -64}, {-98, -64}}, color = {0, 0, 255}));
|
|---|
| 288 | connect(feedback1.u1, Pref) annotation(
|
|---|
| 289 | Line(points = {{64, -44}, {100, -44}}, color = {0, 0, 127}));
|
|---|
| 290 | v = pin_p.v - pin_n.v;
|
|---|
| 291 | annotation(
|
|---|
| 292 | Diagram(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics),
|
|---|
| 293 | Icon(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics = {Line(points = {{-4, 0}, {70, 0}}, color = {0, 0, 0}, smooth = Smooth.None), Line(points = {{0, 94}, {0, -88}, {-2, -90}}, color = {0, 0, 255}, smooth = Smooth.None), Rectangle(extent = {{-28, 68}, {28, -52}}, lineColor = {0, 0, 255}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Text(extent = {{42, 58}, {78, 22}}, lineColor = {255, 0, 0}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, textString = "P")}),
|
|---|
| 294 | Documentation(info = "<html>
|
|---|
| 295 | <p>Questo componente simula, mediante inseguimento di un riferimento esterno, un carico a potenza costante.</p>
|
|---|
| 296 | <p>I parametri k e T sono i parametri del regolatore PI che insegue l'input. TIpicamente si potrà utilizzare k=1 e T di un ordine di grandezza più piccolo delle costanti di tempo del segnale di ingresso di potenza</p>
|
|---|
| 297 | </html>"));
|
|---|
| 298 | end ConstPg;
|
|---|
| 299 |
|
|---|
| 300 | block LimTau "Torque limiter"
|
|---|
| 301 | Modelica.Blocks.Interfaces.RealInput w annotation(
|
|---|
| 302 | Placement(transformation(extent = {{-140, -20}, {-100, 20}}), iconTransformation(extent = {{-140, -20}, {-100, 20}})));
|
|---|
| 303 | Modelica.Blocks.Interfaces.RealOutput yH annotation(
|
|---|
| 304 | Placement(transformation(extent = {{100, 50}, {120, 70}})));
|
|---|
| 305 | parameter Modelica.SIunits.Power powMax = 50000 "Maximum mechanical power";
|
|---|
| 306 | parameter Modelica.SIunits.Torque tauMax = 400 "Maximum torque ";
|
|---|
| 307 | parameter Modelica.SIunits.AngularVelocity wMax(min = powMax / tauMax) = 1500 "Maximum speed";
|
|---|
| 308 | Integer state "=0 below base speed; =1 before wMax; =2 in w limit, =3 above wMax";
|
|---|
| 309 | //0 or 1 if tauMax or powMax is delivered; =2 or 3 if w>wMax
|
|---|
| 310 | protected
|
|---|
| 311 | parameter Real alpha = 0.10 "fraction of wMax over which the torque is to be brought to zero";
|
|---|
| 312 | public
|
|---|
| 313 | Modelica.Blocks.Interfaces.RealOutput yL annotation(
|
|---|
| 314 | Placement(transformation(extent = {{100, -70}, {120, -50}})));
|
|---|
| 315 | algorithm
|
|---|
| 316 | if w < powMax / tauMax then
|
|---|
| 317 | state := 0;
|
|---|
| 318 | yH := tauMax;
|
|---|
| 319 | else
|
|---|
| 320 | state := 1;
|
|---|
| 321 | yH := powMax / w;
|
|---|
| 322 | end if;
|
|---|
| 323 | //over wMax the torque max is to be rapidly brought to zero
|
|---|
| 324 | if w > wMax then
|
|---|
| 325 | if w < (1 + alpha) * wMax then
|
|---|
| 326 | state := 2;
|
|---|
| 327 | yH := powMax / wMax * (1 - (w - wMax) / (alpha * wMax));
|
|---|
| 328 | else
|
|---|
| 329 | state := 3;
|
|---|
| 330 | yH := 0;
|
|---|
| 331 | end if;
|
|---|
| 332 | end if;
|
|---|
| 333 | yL := -yH;
|
|---|
| 334 | annotation(
|
|---|
| 335 | Diagram(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}})),
|
|---|
| 336 | Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Text(extent = {{-98, 126}, {96, 90}}, lineColor = {0, 0, 255}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, textString = "%name
|
|---|
| 337 | "), Rectangle(fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, extent = {{-100, 90}, {100, -88}}), Line(points = {{-72, 80}, {-72, -80}}, arrow = {Arrow.Filled, Arrow.None}, arrowSize = 2), Text(lineColor = {0, 0, 255}, extent = {{-98, 54}, {-84, 48}}, textString = "T"), Line(points = {{92, -2}, {-74, -2}}, arrow = {Arrow.Filled, Arrow.None}, arrowSize = 2), Text(lineColor = {0, 0, 255}, extent = {{72, -22}, {86, -28}}, textString = "W"), Line(points = {{-72, 54}, {-12, 54}, {-2, 40}, {16, 26}, {30, 18}, {44, 14}}), Line(points = {{-72, -58}, {-12, -58}, {-2, -44}, {16, -30}, {30, -22}, {42, -18}})}),
|
|---|
| 338 | Documentation(info = "<html>
|
|---|
| 339 | <p>Gives the maximum output torque as a function of the input speed.</p>
|
|---|
| 340 | <p>When w<wMax the output is Tmax if Tmax*w<Pnom, othersise it is Pnom/w</p>
|
|---|
| 341 | <p>But if w is over wMax Tmax is rapidly falling to zero (reaches zero when speed overcomes wMax by 10%).</p>
|
|---|
| 342 | <p>Torques and powers are in SI units</p>
|
|---|
| 343 | </html>"));
|
|---|
| 344 | end LimTau;
|
|---|
| 345 |
|
|---|
| 346 | block Pel "Outputs a power signal computed from the given efficiency and input power"
|
|---|
| 347 | Modelica.Blocks.Interfaces.RealInput eta "efficiency" annotation(
|
|---|
| 348 | Placement(transformation(extent = {{-140, -80}, {-100, -40}}), iconTransformation(extent = {{-140, -80}, {-100, -40}})));
|
|---|
| 349 | Modelica.Blocks.Interfaces.RealInput P "Delivered Mechanical Power" annotation(
|
|---|
| 350 | Placement(transformation(extent = {{-140, 40}, {-100, 80}}), iconTransformation(extent = {{-140, 40}, {-100, 80}})));
|
|---|
| 351 | Modelica.Blocks.Interfaces.RealOutput Pel "Absorbed Electrical power" annotation(
|
|---|
| 352 | Placement(transformation(extent = {{100, -10}, {120, 10}})));
|
|---|
| 353 | algorithm
|
|---|
| 354 | if noEvent(P <= 0) then
|
|---|
| 355 | Pel := P * eta;
|
|---|
| 356 | else
|
|---|
| 357 | Pel := P / eta;
|
|---|
| 358 | end if;
|
|---|
| 359 | annotation(
|
|---|
| 360 | Icon(graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 127}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Text(extent = {{-78, 82}, {70, -92}}, lineColor = {0, 0, 127}, fillColor = {170, 255, 255}, fillPattern = FillPattern.Solid, textString = "Pmecc
|
|---|
| 361 | to
|
|---|
| 362 | Pel")}),
|
|---|
| 363 | Diagram(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics),
|
|---|
| 364 | Documentation(info = "<html>
|
|---|
| 365 | <pre><span style=\"font-family: Courier New,courier;\">Outputs a power signal computed from the given efficiency and input power</span></pre>
|
|---|
| 366 | </html>"));
|
|---|
| 367 | end Pel;
|
|---|
| 368 | end MapBasedRelated;
|
|---|
| 369 |
|
|---|
| 370 | package Miscellaneous
|
|---|
| 371 | block Greater "Output y is true, if input u1 is greater than input u2"
|
|---|
| 372 | extends PartialBooleanComparison;
|
|---|
| 373 | equation
|
|---|
| 374 | y = u1 > u2;
|
|---|
| 375 | annotation(
|
|---|
| 376 | Icon(coordinateSystem(preserveAspectRatio = false, initialScale = 0.1), graphics = {Ellipse(lineColor = {0, 0, 127}, extent = {{32, 10}, {52, -10}}, endAngle = 360), Line(points = {{-100, -80}, {42, -80}, {42, 0}}, color = {0, 0, 127}), Line(points = {{-54, 22}, {-8, 2}, {-54, -18}}, thickness = 0.5), Text(origin = {-20, 133}, lineColor = {0, 0, 255}, extent = {{-96, 25}, {122, -19}}, textString = "%name")}),
|
|---|
| 377 | Documentation(info = "<html>
|
|---|
| 378 | <p>
|
|---|
| 379 | The output is <b>true</b> if Real input u1 is greater than
|
|---|
| 380 | Real input u2, otherwise the output is <b>false</b>.
|
|---|
| 381 | </p>
|
|---|
| 382 | </html>"));
|
|---|
| 383 | end Greater;
|
|---|
| 384 |
|
|---|
| 385 | partial block PartialBooleanComparison "Partial block with 2 Real input and 1 Boolean output signal (the result of a comparison of the two Real inputs)"
|
|---|
| 386 | Modelica.Blocks.Interfaces.RealInput u1 "Connector of first Real input signal" annotation(
|
|---|
| 387 | Placement(transformation(extent = {{-140, -20}, {-100, 20}})));
|
|---|
| 388 | Modelica.Blocks.Interfaces.RealInput u2 "Connector of second Real input signal" annotation(
|
|---|
| 389 | Placement(transformation(extent = {{-140, -100}, {-100, -60}})));
|
|---|
| 390 | Modelica.Blocks.Interfaces.BooleanOutput y "Connector of Boolean output signal" annotation(
|
|---|
| 391 | Placement(transformation(extent = {{100, -10}, {120, 10}})));
|
|---|
| 392 | annotation(
|
|---|
| 393 | Icon(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, lineThickness = 0.5, fillColor = {210, 210, 210}, fillPattern = FillPattern.Solid, borderPattern = BorderPattern.Raised), Ellipse(extent = {{73, 7}, {87, -7}}, lineColor = DynamicSelect({235, 235, 235}, if y > 0.5 then {0, 255, 0} else {235, 235, 235}), fillColor = DynamicSelect({235, 235, 235}, if y > 0.5 then {0, 255, 0} else {235, 235, 235}), fillPattern = FillPattern.Solid), Ellipse(extent = {{32, 10}, {52, -10}}, lineColor = {0, 0, 127}), Line(points = {{-100, -80}, {42, -80}, {42, 0}}, color = {0, 0, 127})}),
|
|---|
| 394 | Documentation(info = "<html>
|
|---|
| 395 | <p>
|
|---|
| 396 | Block has two continuous Real input and one continuous Boolean output signal
|
|---|
| 397 | as a result of the comparison of the two input signals. The block
|
|---|
| 398 | has a 3D icon (e.g., used in Blocks.Logical library).
|
|---|
| 399 | </p>
|
|---|
| 400 | </html>"));
|
|---|
| 401 | end PartialBooleanComparison;
|
|---|
| 402 |
|
|---|
| 403 | model DragForce "Vehicle rolling and aerodinamical drag force"
|
|---|
| 404 | import Modelica.Constants.g_n;
|
|---|
| 405 | extends Modelica.Mechanics.Translational.Interfaces.PartialElementaryOneFlangeAndSupport2;
|
|---|
| 406 | extends Modelica.Mechanics.Translational.Interfaces.PartialFriction;
|
|---|
| 407 | Modelica.SIunits.Force f "Total drag force";
|
|---|
| 408 | Modelica.SIunits.Velocity v "vehicle velocity";
|
|---|
| 409 | Modelica.SIunits.Acceleration a "Absolute acceleration of flange";
|
|---|
| 410 | Real Sign;
|
|---|
| 411 | parameter Modelica.SIunits.Mass m "vehicle mass";
|
|---|
| 412 | parameter Modelica.SIunits.Density rho = 1.226 "air density";
|
|---|
| 413 | parameter Modelica.SIunits.Area S "vehicle cross area";
|
|---|
| 414 | parameter Real fc(start = 0.01) "rolling friction coefficient";
|
|---|
| 415 | parameter Real Cx "aerodinamic drag coefficient";
|
|---|
| 416 | protected
|
|---|
| 417 | parameter Real A = fc * m * g_n;
|
|---|
| 418 | parameter Real B = 1 / 2 * rho * S * Cx;
|
|---|
| 419 | equation
|
|---|
| 420 | // s = flange.s;
|
|---|
| 421 | v = der(s);
|
|---|
| 422 | a = der(v);
|
|---|
| 423 | // Le seguenti definizioni seguono l'ordine e le richieste del modello "PartialFriction" di
|
|---|
| 424 | // Modelica.Mechanics.Translational.Interfaces"
|
|---|
| 425 | v_relfric = v;
|
|---|
| 426 | a_relfric = a;
|
|---|
| 427 | f0 = A "force at 0 speed 0 but with slip";
|
|---|
| 428 | f0_max = A "max force at 0 speed without slip";
|
|---|
| 429 | free = false "in principle should become true whenthe wheel loose contact with road";
|
|---|
| 430 | // Now the computation of f, and its attribution to the flange:
|
|---|
| 431 | flange.f - f = 0;
|
|---|
| 432 | // friction force
|
|---|
| 433 | if v > 0 then
|
|---|
| 434 | Sign = 1;
|
|---|
| 435 | else
|
|---|
| 436 | Sign = -1;
|
|---|
| 437 | end if;
|
|---|
| 438 | //The following equation equates dragForce to the force applied when looocked)true, otherwise term A.
|
|---|
| 439 | f - B * v ^ 2 * Sign = if locked then sa * unitForce else f0 * (if startForward then Modelica.Math.tempInterpol1(v, [0, 1], 2) else if startBackward then -Modelica.Math.tempInterpol1(-v, [0, 1], 2) else if pre(mode) == Forward then Modelica.Math.tempInterpol1(v, [0, 1], 2) else -Modelica.Math.tempInterpol1(-v, [0, 1], 2));
|
|---|
| 440 | annotation(
|
|---|
| 441 | Documentation(info = "<html>
|
|---|
| 442 | <p>This component models the total (rolling and aerodynamic) vehicle drag resistance: </p>
|
|---|
| 443 | <p>F=fc*m*g+(1/2)*rho*Cx*S*v^2 </p>
|
|---|
| 444 | <p>It models reliably the stuck phase. Based on Modelica-Intrerfaces.PartialFriction model </p>
|
|---|
| 445 | </html>"),
|
|---|
| 446 | Icon(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(points = {{-98, 10}, {22, 10}, {22, 41}, {92, 0}, {22, -41}, {22, -10}, {-98, -10}, {-98, 10}}, lineColor = {0, 127, 0}, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid), Line(points = {{-42, -50}, {87, -50}}, color = {0, 0, 0}), Polygon(points = {{-72, -50}, {-41, -40}, {-41, -60}, {-72, -50}}, lineColor = {0, 0, 0}, fillColor = {128, 128, 128}, fillPattern = FillPattern.Solid), Line(points = {{-90, -90}, {-70, -88}, {-50, -82}, {-30, -72}, {-10, -58}, {10, -40}, {30, -18}, {50, 8}, {70, 38}, {90, 72}, {110, 110}}, color = {0, 0, 255}, thickness = 0.5), Text(extent = {{-82, 90}, {80, 50}}, lineColor = {0, 0, 255}, textString = "%name")}),
|
|---|
| 447 | Diagram(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics));
|
|---|
| 448 | end DragForce;
|
|---|
| 449 |
|
|---|
| 450 | block PropDriver "Simple Proportional controller driver"
|
|---|
| 451 | parameter String CycleFileName = "cycleName.txt" "Drive Cycle Name ex: \"sort1.txt\"";
|
|---|
| 452 | parameter Real k "Controller gain";
|
|---|
| 453 | parameter Real yMax = 1.e6 "Max output value (absolute)";
|
|---|
| 454 | parameter Modelica.Blocks.Types.Extrapolation extrapolation = Modelica.Blocks.Types.Extrapolation.LastTwoPoints "Extrapolation of data outside the definition range";
|
|---|
| 455 | Modelica.Blocks.Interfaces.RealInput V annotation(
|
|---|
| 456 | Placement(visible = true, transformation(origin = {0, -66}, extent = {{-14, -14}, {14, 14}}, rotation = 90), iconTransformation(origin = {0, -112}, extent = {{-12, -12}, {12, 12}}, rotation = 90)));
|
|---|
| 457 | Modelica.Blocks.Math.UnitConversions.From_kmh from_kmh annotation(
|
|---|
| 458 | Placement(visible = true, transformation(extent = {{-42, -10}, {-22, 10}}, rotation = 0)));
|
|---|
| 459 | Modelica.Blocks.Sources.CombiTimeTable driveCyc(columns = {2}, extrapolation = extrapolation, fileName = CycleFileName, tableName = "Cycle", tableOnFile = true) annotation(
|
|---|
| 460 | Placement(visible = true, transformation(extent = {{-80, -10}, {-60, 10}}, rotation = 0)));
|
|---|
| 461 | Modelica.Blocks.Math.Feedback feedback annotation(
|
|---|
| 462 | Placement(visible = true, transformation(extent = {{-10, -10}, {10, 10}}, rotation = 0)));
|
|---|
| 463 | Modelica.Blocks.Math.Gain gain(k = k) annotation(
|
|---|
| 464 | Placement(visible = true, transformation(extent = {{14, -10}, {34, 10}}, rotation = 0)));
|
|---|
| 465 | Modelica.Blocks.Nonlinear.Limiter limAcc(uMax = yMax, uMin = 0) annotation(
|
|---|
| 466 | Placement(visible = true, transformation(origin = {2, 40}, extent = {{52, -10}, {72, 10}}, rotation = 0)));
|
|---|
| 467 | Modelica.Blocks.Nonlinear.Limiter limBrak(uMax = 0, uMin = -yMax) annotation(
|
|---|
| 468 | Placement(visible = true, transformation(origin = {0, -40}, extent = {{52, -10}, {72, 10}}, rotation = 0)));
|
|---|
| 469 | Modelica.Blocks.Interfaces.RealOutput tauRef(unit = "N.m") annotation(
|
|---|
| 470 | Placement(visible = true, transformation(extent = {{100, -10}, {120, 10}}, rotation = 0), iconTransformation(extent = {{100, -10}, {120, 10}}, rotation = 0)));
|
|---|
| 471 | Modelica.Blocks.Interfaces.RealOutput accelTau annotation(
|
|---|
| 472 | Placement(visible = true, transformation(origin = {110, 40}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(extent = {{100, 52}, {120, 72}}, rotation = 0)));
|
|---|
| 473 | Modelica.Blocks.Interfaces.RealOutput brakeTau annotation(
|
|---|
| 474 | Placement(visible = true, transformation(origin = {110, -40}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(extent = {{100, -70}, {120, -50}}, rotation = 0)));
|
|---|
| 475 | equation
|
|---|
| 476 | connect(V, feedback.u2) annotation(
|
|---|
| 477 | Line(points = {{0, -66}, {0, -66}, {0, -8}, {0, -8}}, color = {0, 0, 127}));
|
|---|
| 478 | connect(from_kmh.u, driveCyc.y[1]) annotation(
|
|---|
| 479 | Line(points = {{-44, 0}, {-59, 0}}, color = {0, 0, 127}));
|
|---|
| 480 | connect(from_kmh.y, feedback.u1) annotation(
|
|---|
| 481 | Line(points = {{-21, 0}, {-8, 0}}, color = {0, 0, 127}));
|
|---|
| 482 | connect(feedback.y, gain.u) annotation(
|
|---|
| 483 | Line(points = {{9, 0}, {12, 0}}, color = {0, 0, 127}));
|
|---|
| 484 | connect(limBrak.y, brakeTau) annotation(
|
|---|
| 485 | Line(points = {{73, -40}, {104, -40}, {104, -40}, {110, -40}}, color = {0, 0, 127}));
|
|---|
| 486 | connect(limAcc.y, accelTau) annotation(
|
|---|
| 487 | Line(points = {{75, 40}, {102, 40}, {102, 40}, {110, 40}}, color = {0, 0, 127}));
|
|---|
| 488 | connect(limBrak.u, gain.y) annotation(
|
|---|
| 489 | Line(points = {{50, -40}, {40, -40}, {40, 0}, {35, 0}, {35, 0}}, color = {0, 0, 127}));
|
|---|
| 490 | connect(limAcc.u, gain.y) annotation(
|
|---|
| 491 | Line(points = {{52, 40}, {40, 40}, {40, 0}, {35, 0}, {35, 0}}, color = {0, 0, 127}));
|
|---|
| 492 | connect(gain.y, tauRef) annotation(
|
|---|
| 493 | Line(points = {{35, 0}, {110, 0}, {110, 0}}, color = {0, 0, 127}));
|
|---|
| 494 | annotation(
|
|---|
| 495 | Documentation(info = "<html><head></head><body><p>Simple driver model.</p><p>It reads a reference cycle from a file then controls speed with a simple proportional feedback law.</p>
|
|---|
| 496 | </body></html>"),
|
|---|
| 497 | Icon(coordinateSystem(preserveAspectRatio = false, initialScale = 0.1), graphics = {Rectangle(fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, extent = {{-100, 100}, {100, -100}}), Ellipse(fillColor = {255, 213, 170}, fillPattern = FillPattern.Solid, extent = {{-23, 22}, {-12, -4}}, endAngle = 360), Text(origin = {2, -0.1894}, lineColor = {0, 0, 255}, extent = {{-104, 142.189}, {98, 104}}, textString = "%name"), Polygon(fillColor = {215, 215, 215}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-22, -60}, {-42, -88}, {-16, -88}, {16, -88}, {-22, -60}}), Polygon(fillColor = {135, 135, 135}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-32, 40}, {-62, -52}, {-30, -52}, {-30, -52}, {-32, 40}}, smooth = Smooth.Bezier), Polygon(fillColor = {135, 135, 135}, pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-68, -36}, {-14, -90}, {10, -50}, {0, -50}, {-68, -36}}, smooth = Smooth.Bezier), Polygon(fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid, points = {{-22, 10}, {-30, 6}, {-40, -48}, {2, -46}, {2, -34}, {0, 2}, {-22, 10}}, smooth = Smooth.Bezier), Ellipse(fillColor = {255, 213, 170}, fillPattern = FillPattern.Solid, extent = {{-30, 44}, {-3, 10}}, endAngle = 360), Polygon(pattern = LinePattern.None, fillPattern = FillPattern.Solid, points = {{-38, 34}, {-16, 50}, {-2, 36}, {4, 36}, {6, 36}, {-38, 34}}, smooth = Smooth.Bezier), Polygon(fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid, points = {{30, -44}, {-32, -28}, {-36, -44}, {-24, -58}, {30, -44}}, smooth = Smooth.Bezier), Polygon(fillPattern = FillPattern.Solid, points = {{42, -70}, {36, -84}, {48, -78}, {52, -72}, {50, -68}, {42, -70}}, smooth = Smooth.Bezier), Line(points = {{48, -14}, {26, 0}, {26, 0}}, thickness = 0.5), Line(points = {{20, -10}, {34, 10}, {34, 10}}, thickness = 0.5), Polygon(fillColor = {255, 213, 170}, fillPattern = FillPattern.Solid, points = {{28, 4}, {32, 8}, {28, 2}, {34, 6}, {30, 2}, {34, 4}, {30, 0}, {26, 2}, {34, 0}, {26, 0}, {26, 2}, {28, 4}, {28, 4}, {26, 2}, {26, 2}, {26, 2}, {28, 8}, {28, 6}, {28, 4}}, smooth = Smooth.Bezier), Polygon(fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid, points = {{-18, 0}, {28, 6}, {26, -2}, {-16, -16}, {-20, -16}, {-24, -6}, {-18, 0}}, smooth = Smooth.Bezier), Polygon(fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid, points = {{72, -6}, {48, -6}, {36, -26}, {58, -86}, {72, -86}, {72, -6}}), Polygon(fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid, points = {{49, -94}, {17, -40}, {7, -44}, {-1, -50}, {49, -94}}, smooth = Smooth.Bezier), Line(points = {{-7, 31}, {-3, 29}}), Line(points = {{-9, 18}, {-5, 18}}), Line(points = {{-7, 31}, {-3, 31}}), Text(lineColor = {238, 46, 47}, extent = {{-100, 90}, {100, 58}}, textString = "%CycleFileName")}),
|
|---|
| 498 | Diagram(coordinateSystem(extent = {{-100, -60}, {100, 60}}, preserveAspectRatio = false, initialScale = 0.1, grid = {2, 2})));
|
|---|
| 499 | end PropDriver;
|
|---|
| 500 |
|
|---|
| 501 | model Batt1 "Battery model based on one R-C block in its electric circuit"
|
|---|
| 502 | parameter Modelica.SIunits.ElectricCharge QCellNom(min = 0) = 10 * 3600.0 "Nominal electric charge" annotation(
|
|---|
| 503 | Dialog(tab = "Cell data"));
|
|---|
| 504 | parameter Modelica.SIunits.Voltage ECellMin(min = 0) = 3.3 "Minimum open source voltage" annotation(
|
|---|
| 505 | Dialog(tab = "Cell data"));
|
|---|
| 506 | parameter Modelica.SIunits.Voltage ECellMax(min = 0.0001) = 4.15 "Maximum open source voltage" annotation(
|
|---|
| 507 | Dialog(tab = "Cell data"));
|
|---|
| 508 | parameter Real SOCMin(min = 0, max = 1) = 0 "Minimum state of charge" annotation(
|
|---|
| 509 | Dialog(group = "SOC parameters"));
|
|---|
| 510 | parameter Real SOCMax(min = 0, max = 1) = 1 "Maximum state of charge" annotation(
|
|---|
| 511 | Dialog(group = "SOC parameters"));
|
|---|
| 512 | parameter Real SOCInit(min = 0, max = 1) = 0.5 "Initial state of charge" annotation(
|
|---|
| 513 | Dialog(group = "SOC parameters"));
|
|---|
| 514 | parameter Modelica.SIunits.Current ICellMax(min = 0) = 10 * QCellNom / 3600.0 "Maximum admissible current" annotation(
|
|---|
| 515 | Dialog(tab = "Cell data"));
|
|---|
| 516 | parameter Modelica.SIunits.Resistance R0Cell(min = 0) = 0.05 * ECellMax / ICellMax "Serial resistance \"R0\"" annotation(
|
|---|
| 517 | Dialog(tab = "Cell data", group = "Electric circuit parameters"));
|
|---|
| 518 | parameter Modelica.SIunits.Resistance R1Cell(min = 0) = R0Cell "Serial resistance \"R1\"" annotation(
|
|---|
| 519 | Dialog(tab = "Cell data", group = "Electric circuit parameters"));
|
|---|
| 520 | parameter Modelica.SIunits.Capacitance C1Cell(min = 0) = 60 / R1Cell "Capacitance in parallel with R1" annotation(
|
|---|
| 521 | Dialog(tab = "Cell data", group = "Electric circuit parameters"));
|
|---|
| 522 | parameter Real efficiency(min = 0, max = 0.9999) = 0.85 "Overall charging/discharging energy efficiency" annotation(
|
|---|
| 523 | Dialog(group = "Parameters related to losses"));
|
|---|
| 524 | parameter Modelica.SIunits.Current iCellEfficiency(min = 0) = 0.5 * ICellMax "Charging/discharging current the efficiency refers to" annotation(
|
|---|
| 525 | Dialog(group = "Parameters related to losses"));
|
|---|
| 526 | parameter Integer ns = 1 "Number of serial connected cells per string" annotation(
|
|---|
| 527 | Dialog(tab = "Battery pack data", group = "Size of the package"));
|
|---|
| 528 | parameter Integer np = 1 "Number of parallel connected strings" annotation(
|
|---|
| 529 | Dialog(tab = "Battery pack data", group = "Size of the package"));
|
|---|
| 530 | Modelica.SIunits.Voltage Ubat(start = EBatteryMin + SOCInit * (EBatteryMax - EBatteryMin), fixed = true);
|
|---|
| 531 | Modelica.SIunits.Power powerLoss;
|
|---|
| 532 | Modelica.Electrical.Analog.Basic.Capacitor cBattery(final C = CBattery) annotation(
|
|---|
| 533 | Placement(transformation(origin = {-60, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 270)));
|
|---|
| 534 | Modelica.Electrical.Analog.Basic.Resistor R0(final R = R0Battery) annotation(
|
|---|
| 535 | Placement(transformation(origin = {20, 60}, extent = {{-10, -10}, {10, 10}}, rotation = 180)));
|
|---|
| 536 | Modelica.Electrical.Analog.Sources.SignalCurrent Ip annotation(
|
|---|
| 537 | Placement(transformation(origin = {-6, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 270)));
|
|---|
| 538 | Modelica.Electrical.Analog.Interfaces.Pin p annotation(
|
|---|
| 539 | Placement(transformation(extent = {{90, 50}, {110, 70}}), iconTransformation(extent = {{90, 50}, {110, 70}})));
|
|---|
| 540 | Modelica.Electrical.Analog.Interfaces.NegativePin n annotation(
|
|---|
| 541 | Placement(transformation(extent = {{90, -70}, {110, -50}}), iconTransformation(extent = {{91, -70}, {111, -50}})));
|
|---|
| 542 | Modelica.Electrical.Analog.Basic.Resistor R1(final R = R1Battery) annotation(
|
|---|
| 543 | Placement(transformation(origin = {-37, 74}, extent = {{-10, -10}, {10, 10}}, rotation = 180)));
|
|---|
| 544 | Modelica.Electrical.Analog.Basic.Capacitor C1(C = C1Battery) annotation(
|
|---|
| 545 | Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 180, origin = {-37, 50})));
|
|---|
| 546 | Modelica.Blocks.Interfaces.RealOutput SOC annotation(
|
|---|
| 547 | Placement(visible = true, transformation(origin = {-90, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 180), iconTransformation(origin = {-110, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 180)));
|
|---|
| 548 | Modelica.Electrical.Analog.Basic.Capacitor cDummy(C = C1Battery / 10000) annotation(
|
|---|
| 549 | Placement(visible = true, transformation(origin = {88, 0}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
|
|---|
| 550 | protected
|
|---|
| 551 | parameter Real efficiencyMax = (EBatteryMin + EBatteryMax - 2 * Rtot * iCellEfficiency) / (EBatteryMin + EBatteryMax + 2 * Rtot * iCellEfficiency);
|
|---|
| 552 | parameter Modelica.SIunits.Capacitance C = QCellNom / (ECellMax - ECellMin) "Cell capacitance";
|
|---|
| 553 | // determine fraction of drain current with respect to the total package current
|
|---|
| 554 | parameter Real k = ((1 - efficiency) * (EBatteryMax + EBatteryMin) - 2 * (1 + efficiency) * Rtot * iCellEfficiency) / ((1 + efficiency) * (EBatteryMax + EBatteryMin) - 2 * (1 - efficiency) * Rtot * iCellEfficiency);
|
|---|
| 555 | parameter Modelica.SIunits.Current IBatteryMax = ICellMax * np "Maximum battery current";
|
|---|
| 556 | parameter Modelica.SIunits.Voltage EBatteryMin = ECellMin * ns "Minimum battery voltage";
|
|---|
| 557 | parameter Modelica.SIunits.Voltage EBatteryMax = ECellMax * ns "Maximum battery voltage";
|
|---|
| 558 | parameter Modelica.SIunits.ElectricCharge QBatteryNominal = QCellNom * np "Battery admissible electric charge";
|
|---|
| 559 | parameter Modelica.SIunits.Capacitance CBattery = C * np / ns "Battery capacitance";
|
|---|
| 560 | parameter Modelica.SIunits.Resistance R0Battery = R0Cell * ns / np "Serial inner resistance R0 of cell package";
|
|---|
| 561 | parameter Modelica.SIunits.Resistance R1Battery = R1Cell * ns / np "Serial inner resistance R1 of cell package";
|
|---|
| 562 | parameter Modelica.SIunits.Resistance Rtot = R0Battery + R1Battery;
|
|---|
| 563 | parameter Modelica.SIunits.Capacitance C1Battery = C1Cell * np / ns "Battery series inner capacitance C1";
|
|---|
| 564 | protected
|
|---|
| 565 | Modelica.SIunits.Voltage ECell "Cell e.m.f.";
|
|---|
| 566 | Modelica.SIunits.Current iCellStray "Cell stray current";
|
|---|
| 567 | Modelica.SIunits.Voltage EBattery(start = EBatteryMin + SOCInit * (EBatteryMax - EBatteryMin), fixed = true) "Battery e.m.f.";
|
|---|
| 568 | Modelica.SIunits.Current iBatteryStray "Cell parasitic current";
|
|---|
| 569 | Modelica.Electrical.Analog.Sensors.CurrentSensor currentSensor annotation(
|
|---|
| 570 | Placement(transformation(extent = {{60, 50}, {80, 70}}, rotation = 0)));
|
|---|
| 571 | Modelica.Blocks.Math.Gain gain(k = k) annotation(
|
|---|
| 572 | Placement(transformation(origin = {52, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 180)));
|
|---|
| 573 | Modelica.Blocks.Math.Abs abs1 annotation(
|
|---|
| 574 | Placement(transformation(extent = {{34, -10}, {14, 10}}, rotation = 0)));
|
|---|
| 575 | equation
|
|---|
| 576 | connect(cDummy.n, n) annotation(
|
|---|
| 577 | Line(points = {{88, -10}, {88, -10}, {88, -60}, {100, -60}, {100, -60}}, color = {0, 0, 255}));
|
|---|
| 578 | connect(cDummy.p, currentSensor.n) annotation(
|
|---|
| 579 | Line(points = {{88, 10}, {88, 10}, {88, 60}, {80, 60}, {80, 60}}, color = {0, 0, 255}));
|
|---|
| 580 | assert(SOCMin >= 0, "SOCMin must be greater than, or equal to 0");
|
|---|
| 581 | assert(SOCMax <= 1, "SOCMax must be smaller than, or equal to 1");
|
|---|
| 582 | assert(efficiency <= efficiencyMax, "Overall charging/discharging energy efficiency is too big with respect to the actual serial resistance (EfficiencyMax =" + String(efficiencyMax) + ")");
|
|---|
| 583 | assert(SOCMin < SOCMax, "SOCMax(=" + String(SOCMax) + ") must be greater than SOCMin(=" + String(SOCMin) + ")");
|
|---|
| 584 | assert(SOCInit >= SOCMin, "SOCInit(=" + String(SOCInit) + ") must be greater than, or equal to SOCMin(=" + String(SOCMin) + ")");
|
|---|
| 585 | assert(SOCInit <= SOCMax, "SOCInit(=" + String(SOCInit) + ") must be smaller than, or equal to SOCMax(=" + String(SOCMax) + ")");
|
|---|
| 586 | iBatteryStray = Ip.i;
|
|---|
| 587 | iCellStray = iBatteryStray / np;
|
|---|
| 588 | EBattery = cBattery.v;
|
|---|
| 589 | //Solo per dare maggiore chiarezza all'utente con un nome significativo
|
|---|
| 590 | Ubat = p.v - n.v;
|
|---|
| 591 | powerLoss = R0.LossPower + R1.LossPower + Ip.v * Ip.i;
|
|---|
| 592 | ECell = EBattery / ns;
|
|---|
| 593 | assert(abs(p.i / np) < ICellMax, "Battery cell current i=" + String(abs(p.i / np)) + "\n exceeds max admissable ICellMax (=" + String(ICellMax) + "A)");
|
|---|
| 594 | SOC = (EBattery - EBatteryMin) / (EBatteryMax - EBatteryMin);
|
|---|
| 595 | //*(SOCMax-SOCMin)+SOCMin);
|
|---|
| 596 | assert(SOC <= SOCMax, "Battery is fully charged: State of charge reached maximum limit (=" + String(SOCMax) + ")");
|
|---|
| 597 | assert(SOCMin <= SOC, "Battery is fully discharged: State of charge reached minimum limit (=" + String(SOCMin) + ")");
|
|---|
| 598 | connect(R0.p, currentSensor.p) annotation(
|
|---|
| 599 | Line(points = {{30, 60}, {60, 60}}, color = {0, 0, 255}));
|
|---|
| 600 | connect(Ip.p, R0.n) annotation(
|
|---|
| 601 | Line(points = {{-6, 10}, {-6, 60}, {10, 60}}, color = {0, 0, 255}));
|
|---|
| 602 | connect(currentSensor.i, gain.u) annotation(
|
|---|
| 603 | Line(points = {{70, 50}, {70, -1.46958e-015}, {64, -1.46958e-015}}, color = {0, 0, 127}));
|
|---|
| 604 | connect(abs1.u, gain.y) annotation(
|
|---|
| 605 | Line(points = {{36, 0}, {39.5, 0}, {39.5, 1.34711e-015}, {41, 1.34711e-015}}, color = {0, 0, 127}));
|
|---|
| 606 | connect(abs1.y, Ip.i) annotation(
|
|---|
| 607 | Line(points = {{13, 0}, {7, 0}, {7, -1.28588e-015}, {1, -1.28588e-015}}, color = {0, 0, 127}));
|
|---|
| 608 | connect(currentSensor.n, p) annotation(
|
|---|
| 609 | Line(points = {{80, 60}, {80, 60}, {100, 60}}, color = {0, 0, 255}));
|
|---|
| 610 | connect(Ip.n, n) annotation(
|
|---|
| 611 | Line(points = {{-6, -10}, {-6, -60}, {100, -60}}, color = {0, 0, 255}));
|
|---|
| 612 | connect(n, cBattery.n) annotation(
|
|---|
| 613 | Line(points = {{100, -60}, {-60, -60}, {-60, -10}}, color = {0, 0, 255}));
|
|---|
| 614 | connect(R1.n, cBattery.p) annotation(
|
|---|
| 615 | Line(points = {{-47, 74}, {-60, 74}, {-60, 10}}, color = {0, 0, 255}, smooth = Smooth.None));
|
|---|
| 616 | connect(C1.n, cBattery.p) annotation(
|
|---|
| 617 | Line(points = {{-47, 50}, {-60, 50}, {-60, 10}}, color = {0, 0, 255}, smooth = Smooth.None));
|
|---|
| 618 | connect(R1.p, C1.p) annotation(
|
|---|
| 619 | Line(points = {{-27, 74}, {-18, 74}, {-18, 50}, {-27, 50}}, color = {0, 0, 255}, smooth = Smooth.None));
|
|---|
| 620 | connect(R1.p, R0.n) annotation(
|
|---|
| 621 | Line(points = {{-27, 74}, {-18, 74}, {-18, 60}, {10, 60}}, color = {0, 0, 255}, smooth = Smooth.None));
|
|---|
| 622 | annotation(
|
|---|
| 623 | Documentation(info = "<html>
|
|---|
| 624 | <p>Battery model with non-unity coulombic efficiency. </p>
|
|---|
| 625 | <p>The main cell branch contains an e.m.f. that is linearly increasing with SOC, simulated through an equivalent capacitor, the resistance R0 and a parallel R-C couple. </p>
|
|---|
| 626 | <p>The full battery is composed by np rows in parallel, each of them containing ns cells in series.</p>
|
|---|
| 627 | </html>", revisions = "<html><table border=\"1\" rules=\"groups\">
|
|---|
| 628 | <thead>
|
|---|
| 629 | <tr><td>Version</td> <td>Date</td> <td>Comment</td></tr>
|
|---|
| 630 | </thead>
|
|---|
| 631 | <tbody>
|
|---|
| 632 | <tr><td>1.0.0</td> <td>2006-01-12</td> <td> </td></tr>
|
|---|
| 633 | <tr><td>1.0.3</td> <td>2006-08-31</td> <td> Improved assert statements </td></tr>
|
|---|
| 634 | <tr><td>1.0.6</td> <td>2007-05-14</td> <td> The documentation changed slightly </td></tr>
|
|---|
| 635 | </tbody>
|
|---|
| 636 | </table>
|
|---|
| 637 | </html>"),
|
|---|
| 638 | Diagram(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}, grid = {2, 2}), graphics),
|
|---|
| 639 | Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2, 2}), graphics = {Rectangle(lineColor = {95, 95, 95}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, extent = {{-100, 100}, {78, -100}}), Line(origin = {2, -2}, points = {{-92, 7}, {-56, 7}}, color = {0, 0, 255}), Rectangle(lineColor = {0, 0, 255}, fillColor = {0, 0, 255}, fillPattern = FillPattern.Solid, extent = {{-82, -3}, {-65, -10}}), Line(points = {{-73, 63}, {98, 64}}, color = {0, 0, 255}), Rectangle(lineColor = {0, 0, 255}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, extent = {{38, 69}, {68, 57}}), Rectangle(lineColor = {0, 0, 255}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, extent = {{-37.5, 68}, {-6.5, 56}}), Line(points = {{-19.5, 49}, {-19.5, 32}}, color = {0, 0, 255}), Line(points = {{-54.5, 63}, {-54.5, 41}, {-25.5, 41}}, color = {0, 0, 255}), Line(points = {{9.5, 62}, {9.5, 40}, {-19.5, 40}}, color = {0, 0, 255}), Line(points = {{-73, 63}, {-73, 5}}, color = {0, 0, 255}), Line(points = {{-73, -6}, {-73, -60}, {96, -60}}, color = {0, 0, 255}), Line(points = {{26, 63}, {26, -61}}, color = {0, 0, 255}), Line(points = {{-25.5, 49}, {-25.5, 32}}, color = {0, 0, 255}), Polygon(lineColor = {0, 0, 255}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, points = {{26, 22}, {14, 4}, {26, -14}, {38, 4}, {26, 22}}), Line(points = {{20, 4}, {32, 4}}, color = {0, 0, 255}), Polygon(lineColor = {0, 0, 255}, points = {{22, -20}, {30, -20}, {26, -32}, {22, -20}}), Text(lineColor = {0, 0, 255}, extent = {{-100, 150}, {100, 110}}, textString = "%name")}));
|
|---|
| 640 | end Batt1;
|
|---|
| 641 |
|
|---|
| 642 | model Batt1Conn "Battery model based on Batt0 but with electric dynamics order = 1"
|
|---|
| 643 | Real powDeliv "battery power (positive when delivered)";
|
|---|
| 644 | Real SOC "State Of Charge";
|
|---|
| 645 | parameter Modelica.SIunits.ElectricCharge QCellNom(min = 0) = 10 * 3.6e3 "Nominal admissible electric charge per cell" annotation(
|
|---|
| 646 | Dialog(tab = "Cell data"));
|
|---|
| 647 | parameter Modelica.SIunits.Voltage ECellMin(min = 0) = 3.3 "Minimum open source voltage per cell" annotation(
|
|---|
| 648 | Dialog(tab = "Cell data"));
|
|---|
| 649 | parameter Modelica.SIunits.Voltage ECellMax(min = 0.0001) = 4.15 "Maximum open source voltage per cell" annotation(
|
|---|
| 650 | Dialog(tab = "Cell data"));
|
|---|
| 651 | parameter Real SOCMin(min = 0, max = 1) = 0 "Minimum state of charge" annotation(
|
|---|
| 652 | Dialog(group = "SOC parameters"));
|
|---|
| 653 | parameter Real SOCMax(min = 0, max = 1) = 1 "Maximum state of charge" annotation(
|
|---|
| 654 | Dialog(group = "SOC parameters"));
|
|---|
| 655 | parameter Real SOCInit(min = 0, max = 1) = 0.5 "Initial state of charge" annotation(
|
|---|
| 656 | Dialog(group = "SOC parameters"));
|
|---|
| 657 | parameter Modelica.SIunits.Current ICellMax(min = 0) = 10 * QCellNom / 3.6e3 "Maximum admissible current" annotation(
|
|---|
| 658 | Dialog(tab = "Cell data"));
|
|---|
| 659 | parameter Modelica.SIunits.Resistance R0Cell(min = 0) = 0.05 * ECellMax / ICellMax "Series resistance \"R0\"" annotation(
|
|---|
| 660 | Dialog(tab = "Cell data", group = "Electric circuit parameters"));
|
|---|
| 661 | parameter Modelica.SIunits.Resistance R1Cell(min = 0) = R0Cell "Series resistance \"R1\"" annotation(
|
|---|
| 662 | Dialog(tab = "Cell data", group = "Electric circuit parameters"));
|
|---|
| 663 | parameter Modelica.SIunits.Capacitance C1Cell(min = 0) = 60 / R1Cell "Capacitance in parallel with R1" annotation(
|
|---|
| 664 | Dialog(tab = "Cell data", group = "Electric circuit parameters"));
|
|---|
| 665 | parameter Real efficiency(min = 0, max = 0.9999) = 0.85 "Overall charging/discharging energy efficiency" annotation(
|
|---|
| 666 | Dialog(group = "Parameters related to losses"));
|
|---|
| 667 | parameter Modelica.SIunits.Current iCellEfficiency(min = 0) = 0.5 * ICellMax "Cell charging/discharging current the efficiency refers to" annotation(
|
|---|
| 668 | Dialog(group = "Parameters related to losses"));
|
|---|
| 669 | parameter Integer ns = 1 "Number of serial connected cells" annotation(
|
|---|
| 670 | Dialog(tab = "Battery Pack data", group = "Size of the package"));
|
|---|
| 671 | parameter Integer np = 1 "Number of parallel connected cells" annotation(
|
|---|
| 672 | Dialog(tab = "Battery Pack data", group = "Size of the package"));
|
|---|
| 673 | // determine fraction of drain current with respect to the total package current
|
|---|
| 674 | Modelica.Electrical.Analog.Basic.Capacitor cBattery(final C = CBattery) annotation(
|
|---|
| 675 | Placement(transformation(origin = {-60, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 270)));
|
|---|
| 676 | Modelica.Electrical.Analog.Basic.Resistor R0(final R = R0Battery) annotation(
|
|---|
| 677 | Placement(transformation(origin = {20, 60}, extent = {{-10, -10}, {10, 10}}, rotation = 180)));
|
|---|
| 678 | Modelica.Electrical.Analog.Sources.SignalCurrent Ip annotation(
|
|---|
| 679 | Placement(transformation(origin = {-6, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 270)));
|
|---|
| 680 | Modelica.Electrical.Analog.Interfaces.Pin p annotation(
|
|---|
| 681 | Placement(transformation(extent = {{90, 50}, {110, 70}}), iconTransformation(extent = {{90, 52}, {110, 72}})));
|
|---|
| 682 | Modelica.Electrical.Analog.Interfaces.NegativePin n annotation(
|
|---|
| 683 | Placement(transformation(extent = {{90, -70}, {110, -50}}), iconTransformation(extent = {{91, -70}, {111, -50}})));
|
|---|
| 684 | Modelica.Electrical.Analog.Basic.Capacitor C1(C = C1Battery) annotation(
|
|---|
| 685 | Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 180, origin = {-37, 50})));
|
|---|
| 686 | wbEHPTlib.SupportModels.ConnectorRelated.Conn conn annotation(
|
|---|
| 687 | Placement(transformation(extent = {{-20, -20}, {20, 20}}, rotation = 90, origin = {-100, -2})));
|
|---|
| 688 | Modelica.Blocks.Sources.RealExpression SOCs(y = SOC) annotation(
|
|---|
| 689 | Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = -90, origin = {-80, 30})));
|
|---|
| 690 | Modelica.Blocks.Sources.RealExpression outPow(y = (p.v - n.v) * n.i) annotation(
|
|---|
| 691 | Placement(transformation(extent = {{10, -10}, {-10, 10}}, rotation = -90, origin = {-80, -26})));
|
|---|
| 692 | Modelica.Electrical.Analog.Basic.Resistor R1(final R = R1Battery) annotation(
|
|---|
| 693 | Placement(visible = true, transformation(origin = {-37, 72}, extent = {{-10, -10}, {10, 10}}, rotation = 180)));
|
|---|
| 694 | protected
|
|---|
| 695 | parameter Real k = ((1 - efficiency) * (eBattMax + eBattMin) - 2 * (1 + efficiency) * Rtot * iCellEfficiency) / ((1 + efficiency) * (eBattMax + eBattMin) - 2 * (1 - efficiency) * Rtot * iCellEfficiency);
|
|---|
| 696 | parameter Real efficiencyMax = (eBattMin + eBattMax - 2 * Rtot * iCellEfficiency) / (eBattMin + eBattMax + 2 * Rtot * iCellEfficiency);
|
|---|
| 697 | final parameter Modelica.SIunits.Capacitance C = QCellNom / (ECellMax - ECellMin) "Cell capacitance";
|
|---|
| 698 | parameter Modelica.SIunits.Current IBatteryMax = ICellMax * np "Maximum battery current";
|
|---|
| 699 | parameter Modelica.SIunits.Voltage eBattMin = ECellMin * ns "Minimum battery voltage";
|
|---|
| 700 | parameter Modelica.SIunits.Voltage eBattMax = ECellMax * ns "Maximum battery voltage";
|
|---|
| 701 | parameter Modelica.SIunits.ElectricCharge QBatteryNominal = QCellNom * np "Battery admissible electric charge";
|
|---|
| 702 | parameter Modelica.SIunits.Capacitance CBattery = C * np / ns "Battery capacitance";
|
|---|
| 703 | parameter Modelica.SIunits.Resistance R0Battery = R0Cell * ns / np "Series inner resistance R0 of cell package";
|
|---|
| 704 | parameter Modelica.SIunits.Resistance R1Battery = R1Cell * ns / np "Series inner resistance R1 of cell package";
|
|---|
| 705 | parameter Modelica.SIunits.Resistance Rtot = R0Battery + R1Battery;
|
|---|
| 706 | parameter Modelica.SIunits.Capacitance C1Battery = C1Cell * np / ns "Battery series inner capacitance C1";
|
|---|
| 707 | Modelica.SIunits.Voltage ECell "Cell e.m.f.";
|
|---|
| 708 | Modelica.SIunits.Current iCellStray "Cell stray current";
|
|---|
| 709 | Modelica.SIunits.Voltage eBatt(start = eBattMin + SOCInit * (eBattMax - eBattMin), fixed = true) "Battery e.m.f.";
|
|---|
| 710 | Modelica.SIunits.Current iBatteryStray "Cell parasitic current";
|
|---|
| 711 | Modelica.Electrical.Analog.Sensors.CurrentSensor currentSensor annotation(
|
|---|
| 712 | Placement(transformation(extent = {{70, 50}, {90, 70}}, rotation = 0)));
|
|---|
| 713 | Modelica.Blocks.Math.Gain gain(k = k) annotation(
|
|---|
| 714 | Placement(transformation(origin = {60, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 180)));
|
|---|
| 715 | Modelica.Blocks.Math.Abs abs1 annotation(
|
|---|
| 716 | Placement(transformation(extent = {{34, -10}, {14, 10}}, rotation = 0)));
|
|---|
| 717 | equation
|
|---|
| 718 | connect(R1.p, R0.n) annotation(
|
|---|
| 719 | Line(points = {{-27, 72}, {-18, 72}, {-18, 60}, {10, 60}}, color = {0, 0, 255}));
|
|---|
| 720 | connect(R1.p, C1.p) annotation(
|
|---|
| 721 | Line(points = {{-27, 72}, {-18, 72}, {-18, 50}, {-27, 50}}, color = {0, 0, 255}));
|
|---|
| 722 | connect(R1.n, cBattery.p) annotation(
|
|---|
| 723 | Line(points = {{-47, 72}, {-60, 72}, {-60, 10}}, color = {0, 0, 255}));
|
|---|
| 724 | assert(SOCMin >= 0, "SOCMin must be greater than, or equal to 0");
|
|---|
| 725 | assert(SOCMax <= 1, "SOCMax must be smaller than, or equal to 1");
|
|---|
| 726 | assert(efficiency <= efficiencyMax, "Overall charging/discharging energy efficiency is too big with respect to the actual serial resistance (EfficiencyMax =" + String(efficiencyMax) + ")");
|
|---|
| 727 | assert(SOCMin < SOCMax, "SOCMax(=" + String(SOCMax) + ") must be greater than SOCMin(=" + String(SOCMin) + ")");
|
|---|
| 728 | assert(SOCInit >= SOCMin, "SOCInit(=" + String(SOCInit) + ") must be greater than, or equal to SOCMin(=" + String(SOCMin) + ")");
|
|---|
| 729 | assert(SOCInit <= SOCMax, "SOCInit(=" + String(SOCInit) + ") must be smaller than, or equal to SOCMax(=" + String(SOCMax) + ")");
|
|---|
| 730 | iBatteryStray = Ip.i;
|
|---|
| 731 | iCellStray = iBatteryStray / np;
|
|---|
| 732 | eBatt = cBattery.v;
|
|---|
| 733 | //Solo per dare maggiore chiarezza all'utente con un nome significativo
|
|---|
| 734 | ECell = eBatt / ns;
|
|---|
| 735 | powDeliv = (p.v - n.v) * n.i;
|
|---|
| 736 | assert(abs(p.i / np) < ICellMax, "Battery cell current i=" + String(abs(p.i / np)) + "\n exceeds max admissable ICellMax (=" + String(ICellMax) + "A)");
|
|---|
| 737 | SOC = (eBatt - eBattMin) / (eBattMax - eBattMin);
|
|---|
| 738 | //*(SOCMax-SOCMin)+SOCMin);
|
|---|
| 739 | assert(SOC <= SOCMax, "Battery is fully charged: State of charge reached maximum limit (=" + String(SOCMax) + ")");
|
|---|
| 740 | assert(SOCMin <= SOC, "Battery is fully discharged: State of charge reached minimum limit (=" + String(SOCMin) + ")");
|
|---|
| 741 | connect(R0.p, currentSensor.p) annotation(
|
|---|
| 742 | Line(points = {{30, 60}, {70, 60}}, color = {0, 0, 255}));
|
|---|
| 743 | connect(Ip.p, R0.n) annotation(
|
|---|
| 744 | Line(points = {{-6, 10}, {-6, 60}, {10, 60}}, color = {0, 0, 255}));
|
|---|
| 745 | connect(currentSensor.i, gain.u) annotation(
|
|---|
| 746 | Line(points = {{80, 50}, {80, -1.46958e-015}, {72, -1.46958e-015}}, color = {0, 0, 127}));
|
|---|
| 747 | connect(abs1.u, gain.y) annotation(
|
|---|
| 748 | Line(points = {{36, 0}, {39.5, 0}, {39.5, 1.33227e-015}, {49, 1.33227e-015}}, color = {0, 0, 127}));
|
|---|
| 749 | connect(abs1.y, Ip.i) annotation(
|
|---|
| 750 | Line(points = {{13, 0}, {7, 0}, {7, -1.28588e-015}, {1, -1.28588e-015}}, color = {0, 0, 127}));
|
|---|
| 751 | connect(currentSensor.n, p) annotation(
|
|---|
| 752 | Line(points = {{90, 60}, {90, 60}, {100, 60}}, color = {0, 0, 255}));
|
|---|
| 753 | connect(Ip.n, n) annotation(
|
|---|
| 754 | Line(points = {{-6, -10}, {-6, -60}, {100, -60}}, color = {0, 0, 255}));
|
|---|
| 755 | connect(n, cBattery.n) annotation(
|
|---|
| 756 | Line(points = {{100, -60}, {-60, -60}, {-60, -10}}, color = {0, 0, 255}));
|
|---|
| 757 | connect(C1.n, cBattery.p) annotation(
|
|---|
| 758 | Line(points = {{-47, 50}, {-60, 50}, {-60, 10}}, color = {0, 0, 255}, smooth = Smooth.None));
|
|---|
| 759 | connect(conn.batSOC, SOCs.y) annotation(
|
|---|
| 760 | Line(points = {{-100, -2}, {-100, 8.5}, {-80, 8.5}, {-80, 19}}, color = {255, 204, 51}, thickness = 0.5, smooth = Smooth.None),
|
|---|
| 761 | Text(string = "%first", index = -1, extent = {{-6, 3}, {-6, 3}}));
|
|---|
| 762 | connect(outPow.y, conn.batPowDel) annotation(
|
|---|
| 763 | Line(points = {{-80, -15}, {-80, -2}, {-100, -2}}, color = {0, 0, 127}, smooth = Smooth.None),
|
|---|
| 764 | Text(string = "%second", index = 1, extent = {{6, 3}, {6, 3}}));
|
|---|
| 765 | annotation(
|
|---|
| 766 | Documentation(info = "<html>
|
|---|
| 767 | <p>Battery model with non-unity coulombic efficiency. </p>
|
|---|
| 768 | <p>The main cell branch contains an e.m.f. that is linearly increasing with SOC, simulated through an equivalent capacitor, the resistance R0 and a parallel R-C couple. </p>
|
|---|
| 769 | <p>The full battery is composed by np rows in parallel, each of them containing ns cells in series.</p>
|
|---|
| 770 | <p>It interfaces with monitoring systems tohrough an expandable connector. Output signals:</p>
|
|---|
| 771 | <p>- state-of-charge "batSOC"</p>
|
|---|
| 772 | <p>- outputted power "batPowDel".</p>
|
|---|
| 773 | </html>", revisions = "<html><table border=\"1\" rules=\"groups\">
|
|---|
| 774 | <thead>
|
|---|
| 775 | <tr><td>Version</td> <td>Date</td> <td>Comment</td></tr>
|
|---|
| 776 | </thead>
|
|---|
| 777 | <tbody>
|
|---|
| 778 | <tr><td>1.0.0</td> <td>2006-01-12</td> <td> </td></tr>
|
|---|
| 779 | <tr><td>1.0.3</td> <td>2006-08-31</td> <td> Improved assert statements </td></tr>
|
|---|
| 780 | <tr><td>1.0.6</td> <td>2007-05-14</td> <td> The documentation changed slightly </td></tr>
|
|---|
| 781 | </tbody>
|
|---|
| 782 | </table>
|
|---|
| 783 | </html>"),
|
|---|
| 784 | Diagram(coordinateSystem(extent = {{-100, -80}, {100, 80}}, preserveAspectRatio = false, initialScale = 0.1, grid = {2, 2}), graphics),
|
|---|
| 785 | Icon(coordinateSystem(extent = {{-100, -80}, {100, 80}}, preserveAspectRatio = false, initialScale = 0.1, grid = {2, 2}), graphics = {Rectangle(lineColor = {95, 95, 95}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, extent = {{-100, 80}, {80, -82}}), Line(points = {{-92, 6}, {-52, 6}}, color = {0, 0, 255}), Rectangle(lineColor = {0, 0, 255}, fillColor = {0, 0, 255}, fillPattern = FillPattern.Solid, extent = {{-82, -3}, {-65, -10}}), Line(points = {{-73, 63}, {98, 64}}, color = {0, 0, 255}), Rectangle(lineColor = {0, 0, 255}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, extent = {{38, 69}, {68, 57}}), Rectangle(lineColor = {0, 0, 255}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, extent = {{-37.5, 68}, {-6.5, 56}}), Line(points = {{-19.5, 49}, {-19.5, 32}}, color = {0, 0, 255}), Line(points = {{-54.5, 63}, {-54.5, 41}, {-25.5, 41}}, color = {0, 0, 255}), Line(points = {{9.5, 62}, {9.5, 40}, {-19.5, 40}}, color = {0, 0, 255}), Line(points = {{-73, 63}, {-73, 5}}, color = {0, 0, 255}), Line(points = {{-73, -6}, {-73, -60}, {96, -60}}, color = {0, 0, 255}), Line(points = {{26, 63}, {26, -61}}, color = {0, 0, 255}), Line(points = {{-25.5, 49}, {-25.5, 32}}, color = {0, 0, 255}), Polygon(lineColor = {0, 0, 255}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, points = {{26, 22}, {14, 4}, {26, -14}, {38, 4}, {26, 22}}), Line(points = {{20, 4}, {32, 4}}, color = {0, 0, 255}), Polygon(lineColor = {0, 0, 255}, points = {{22, -20}, {30, -20}, {26, -32}, {22, -20}}), Text(origin = {-4, -22}, lineColor = {0, 0, 255}, extent = {{-100, 150}, {100, 110}}, textString = "%name")}));
|
|---|
| 786 | end Batt1Conn;
|
|---|
| 787 |
|
|---|
| 788 | model DragForceAngle "Vehicle rolling and aerodinamical drag force"
|
|---|
| 789 | import Modelica.Constants.g_n;
|
|---|
| 790 | extends Modelica.Mechanics.Translational.Interfaces.PartialElementaryOneFlangeAndSupport2;
|
|---|
| 791 | extends Modelica.Mechanics.Translational.Interfaces.PartialFriction;
|
|---|
| 792 | parameter Modelica.SIunits.Mass m "vehicle mass";
|
|---|
| 793 | parameter Modelica.SIunits.Density rho(start = 1.226) "air density";
|
|---|
| 794 | parameter Modelica.SIunits.Area S "vehicle cross area";
|
|---|
| 795 | parameter Real fc(start = 0.01) "rolling friction coefficient";
|
|---|
| 796 | parameter Real Cx "aerodinamic drag coefficient";
|
|---|
| 797 | Modelica.SIunits.Force dragForce "Total drag force";
|
|---|
| 798 | Modelica.SIunits.Velocity v "vehicle velocity";
|
|---|
| 799 | Modelica.SIunits.Acceleration a "Absolute acceleration of flange";
|
|---|
| 800 | parameter String DataFileName = "DataName.txt" "Name of file with angles function of s (rad) ex: \"Angle.txt\"";
|
|---|
| 801 | final parameter Real A = fc * m * g_n;
|
|---|
| 802 | final parameter Real A1 = m * g_n;
|
|---|
| 803 | final parameter Real B = 1 / 2 * rho * S * Cx;
|
|---|
| 804 | final parameter Real mu[:, 2] = [0, 1];
|
|---|
| 805 | Real angle = sToAngle.y[1], Sign;
|
|---|
| 806 | Modelica.SIunits.Length altimetry;
|
|---|
| 807 | Real debug = dragForce - B * v ^ 2 * Sign;
|
|---|
| 808 | // Constant auxiliary variable
|
|---|
| 809 | Modelica.Blocks.Tables.CombiTable1Ds sToAngle(tableOnFile = true, fileName = DataFileName, tableName = "Angle") annotation(
|
|---|
| 810 | Placement(transformation(extent = {{28, -10}, {8, 10}})));
|
|---|
| 811 | equation
|
|---|
| 812 | der(altimetry) = v * sin(sToAngle.y[1]);
|
|---|
| 813 | // Let us connect the table which determines angles:
|
|---|
| 814 | sToAngle.u = flange.s;
|
|---|
| 815 | // s = flange.s;
|
|---|
| 816 | v = der(s);
|
|---|
| 817 | a = der(v);
|
|---|
| 818 | // Le seguenti definizioni seguono l'ordine e le richieste del modello "PartialFriction" di
|
|---|
| 819 | // Modelica.Mechanics.Translational.Interfaces"
|
|---|
| 820 | v_relfric = v;
|
|---|
| 821 | a_relfric = a;
|
|---|
| 822 | f0 = A * cos(angle) + A1 * sin(angle) "Friction force for v_relfric=0 and forward sliding";
|
|---|
| 823 | f0_max = A "Maximum friction force for v_relfric=0 and locked";
|
|---|
| 824 | free = false "true when there is not wheel-road contact (never!)";
|
|---|
| 825 | // Ora il calcolo di dragForce, e la sua attribuzione alla flangia:
|
|---|
| 826 | flange.f - dragForce = 0;
|
|---|
| 827 | // friction force
|
|---|
| 828 | if v > 0 then
|
|---|
| 829 | Sign = 1;
|
|---|
| 830 | else
|
|---|
| 831 | Sign = -1;
|
|---|
| 832 | end if;
|
|---|
| 833 | //La seguente equzione uguaglia la dragForce alla forza applicata se siamo in locked, altrimenti al termine A
|
|---|
| 834 | dragForce - B * v ^ 2 * Sign = if locked then sa * unitForce else f0 * (if startForward then Modelica.Math.Vectors.interpolate(mu[:, 1], mu[:, 2], v) else if startBackward then -Modelica.Math.Vectors.interpolate(mu[:, 1], mu[:, 2], -v) else if pre(mode) == Forward then Modelica.Math.Vectors.interpolate(mu[:, 1], mu[:, 2], v) else -Modelica.Math.Vectors.interpolate(mu[:, 1], mu[:, 2], -v));
|
|---|
| 835 | annotation(
|
|---|
| 836 | Documentation(info = "<html>
|
|---|
| 837 | <p>This component modesl the total (rolling and aerodynamic vehicle drag resistance: </p>
|
|---|
| 838 | <p>F=fc*m*g+(1/2)*rho*Cx*S*v^2</p>
|
|---|
| 839 | <p>It models reliably the stuck phase. Based on Modelica-Intrerfaces.PartialFriction model</p>
|
|---|
| 840 | </html>"),
|
|---|
| 841 | Icon(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(points = {{-98, 10}, {22, 10}, {22, 41}, {92, 0}, {22, -41}, {22, -10}, {-98, -10}, {-98, 10}}, lineColor = {0, 127, 0}, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid), Line(points = {{-90, -90}, {-70, -88}, {-50, -82}, {-30, -72}, {-10, -58}, {10, -40}, {30, -18}, {50, 8}, {70, 38}, {90, 72}}, color = {0, 0, 255}, thickness = 0.5), Text(extent = {{-82, 90}, {80, 50}}, lineColor = {0, 0, 255}, textString = "%name"), Line(points = {{32, 48}, {-62, -38}, {64, -40}}, color = {238, 46, 47}, thickness = 0.5), Polygon(points = {{-20, 0}, {-8, -10}, {0, -26}, {2, -38}, {-62, -38}, {-20, 0}}, lineColor = {238, 46, 47}, fillColor = {128, 128, 128}, fillPattern = FillPattern.Solid)}),
|
|---|
| 842 | Diagram(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 60}}), graphics = {Text(extent = {{-58, -30}, {68, -48}}, lineColor = {0, 0, 0}, lineThickness = 0.5, fillColor = {128, 128, 128}, fillPattern = FillPattern.Solid, textString = "Connections of sToAngle made internally")}));
|
|---|
| 843 | end DragForceAngle;
|
|---|
| 844 | end Miscellaneous;
|
|---|
| 845 |
|
|---|
| 846 | package ConnectorRelated
|
|---|
| 847 | model ToConnIceTauRef "Signal adaptor to send iceTauRef to a connector"
|
|---|
| 848 | Modelica.Blocks.Interfaces.RealInput u annotation(
|
|---|
| 849 | Placement(transformation(extent = {{-94, -20}, {-54, 20}}), iconTransformation(extent = {{-94, -20}, {-54, 20}})));
|
|---|
| 850 | Conn conn annotation(
|
|---|
| 851 | Placement(transformation(extent = {{-20, -20}, {20, 20}}, rotation = -90, origin = {60, 0}), iconTransformation(extent = {{-20, -20}, {20, 20}}, rotation = -90, origin = {60, 0})));
|
|---|
| 852 | equation
|
|---|
| 853 | connect(u, conn.iceTauRef) annotation(
|
|---|
| 854 | Line(points = {{-74, 0}, {60, 0}}, color = {0, 0, 127}, smooth = Smooth.None),
|
|---|
| 855 | Text(string = "%second", index = 1, extent = {{6, 3}, {6, 3}}));
|
|---|
| 856 | annotation(
|
|---|
| 857 | Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-60, -60}, {60, 60}}), graphics = {Rectangle(extent = {{-60, 40}, {60, -40}}, lineColor = {0, 0, 0}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Line(points = {{-38, 0}, {30, 0}}, color = {0, 0, 0}, smooth = Smooth.None), Polygon(points = {{42, 0}, {22, 8}, {22, -8}, {42, 0}}, lineColor = {0, 0, 0}, smooth = Smooth.None, fillColor = {0, 0, 0}, fillPattern = FillPattern.Solid)}),
|
|---|
| 858 | Diagram(coordinateSystem(preserveAspectRatio = false, extent = {{-60, -60}, {60, 60}}), graphics),
|
|---|
| 859 | Documentation(info = "<html>
|
|---|
| 860 | <p><span style=\"font-family: MS Shell Dlg 2;\">Adapter for an input signal into "iceTauRef" signal in the library connector.</span></p>
|
|---|
| 861 | </html>"));
|
|---|
| 862 | end ToConnIceTauRef;
|
|---|
| 863 |
|
|---|
| 864 | model ToConnGenTauRef "Signal adaptor to send genTauRef to a connector"
|
|---|
| 865 | Modelica.Blocks.Interfaces.RealInput u annotation(
|
|---|
| 866 | Placement(transformation(extent = {{-90, -20}, {-50, 20}}), iconTransformation(extent = {{-90, -20}, {-50, 20}})));
|
|---|
| 867 | Conn conn annotation(
|
|---|
| 868 | Placement(transformation(extent = {{-20, -20}, {20, 20}}, rotation = -90, origin = {58, 0}), iconTransformation(extent = {{-20, -20}, {20, 20}}, rotation = -90, origin = {58, 0})));
|
|---|
| 869 | equation
|
|---|
| 870 | connect(u, conn.genTauRef) annotation(
|
|---|
| 871 | Line(points = {{-70, 0}, {58, 0}}, color = {0, 0, 127}, smooth = Smooth.None),
|
|---|
| 872 | Text(string = "%second", index = 1, extent = {{6, 3}, {6, 3}}));
|
|---|
| 873 | annotation(
|
|---|
| 874 | Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-60, -60}, {60, 60}}), graphics = {Rectangle(extent = {{-60, 40}, {60, -40}}, lineColor = {0, 0, 0}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Line(points = {{-40, 0}, {32, 0}}, color = {0, 0, 0}, smooth = Smooth.None), Polygon(points = {{42, 0}, {22, 8}, {22, -8}, {42, 0}}, lineColor = {0, 0, 0}, smooth = Smooth.None, fillColor = {0, 0, 0}, fillPattern = FillPattern.Solid)}),
|
|---|
| 875 | Diagram(coordinateSystem(preserveAspectRatio = false, extent = {{-60, -60}, {60, 60}}), graphics),
|
|---|
| 876 | Documentation(info = "<html>
|
|---|
| 877 | <p><span style=\"font-family: MS Shell Dlg 2;\">Adapter for an input signal into "genTauRef" signal in the library connector.</span></p>
|
|---|
| 878 | </html>"));
|
|---|
| 879 | end ToConnGenTauRef;
|
|---|
| 880 |
|
|---|
| 881 | model ToConnIcePowRef "Signal adaptor to send icePowRef to a connector"
|
|---|
| 882 | Modelica.Blocks.Interfaces.RealInput u annotation(
|
|---|
| 883 | Placement(transformation(extent = {{-94, -20}, {-54, 20}}), iconTransformation(extent = {{-94, -20}, {-54, 20}})));
|
|---|
| 884 | Conn conn annotation(
|
|---|
| 885 | Placement(transformation(extent = {{-20, -20}, {20, 20}}, rotation = -90, origin = {60, 0}), iconTransformation(extent = {{-20, -20}, {20, 20}}, rotation = -90, origin = {60, 0})));
|
|---|
| 886 | equation
|
|---|
| 887 | connect(u, conn.icePowRef) annotation(
|
|---|
| 888 | Line(points = {{-74, 0}, {60, 0}, {60, 0}}, color = {0, 0, 127}),
|
|---|
| 889 | Text(string = "%second", index = 1, extent = {{6, 3}, {6, 3}}));
|
|---|
| 890 | annotation(
|
|---|
| 891 | Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-60, -60}, {60, 60}}), graphics = {Rectangle(extent = {{-60, 40}, {60, -40}}, lineColor = {0, 0, 0}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Line(points = {{-38, 0}, {30, 0}}, color = {0, 0, 0}, smooth = Smooth.None), Polygon(points = {{42, 0}, {22, 8}, {22, -8}, {42, 0}}, lineColor = {0, 0, 0}, smooth = Smooth.None, fillColor = {0, 0, 0}, fillPattern = FillPattern.Solid)}),
|
|---|
| 892 | Diagram(coordinateSystem(preserveAspectRatio = false, extent = {{-60, -60}, {60, 60}})),
|
|---|
| 893 | Documentation(info = "<html>
|
|---|
| 894 | <p><span style=\"font-family: MS Shell Dlg 2;\">Adapter for an input signal into "icePowRef" signal in the library connector.</span></p>
|
|---|
| 895 | </html>"));
|
|---|
| 896 | end ToConnIcePowRef;
|
|---|
| 897 |
|
|---|
| 898 | expandable connector Conn "Control bus that is adapted to the signals connected to it"
|
|---|
| 899 | extends Modelica.Icons.SignalBus;
|
|---|
| 900 | annotation(
|
|---|
| 901 | Diagram(graphics));
|
|---|
| 902 | end Conn;
|
|---|
| 903 | end ConnectorRelated;
|
|---|
| 904 | annotation(
|
|---|
| 905 | Icon(graphics = {Ellipse(extent = {{-36, 40}, {40, -36}}, lineColor = {0, 0, 0}), Line(points = {{4, 82}, {-6, 82}, {-10, 72}, {-24, 68}, {-34, 78}, {-46, 70}, {-42, 58}, {-54, 46}, {-66, 50}, {-74, 36}, {-66, 30}, {-68, 16}, {-78, 12}, {-78, 2}}, color = {0, 0, 0}, smooth = Smooth.None), Line(points = {{4, -78}, {-6, -78}, {-10, -68}, {-24, -64}, {-34, -74}, {-46, -66}, {-42, -54}, {-54, -42}, {-66, -46}, {-74, -32}, {-66, -26}, {-68, -12}, {-78, -8}, {-78, 2}}, color = {0, 0, 0}, smooth = Smooth.None), Line(points = {{2, -78}, {12, -78}, {16, -68}, {30, -64}, {40, -74}, {52, -66}, {48, -54}, {60, -42}, {72, -46}, {80, -32}, {72, -26}, {74, -12}, {84, -8}, {84, 2}}, color = {0, 0, 0}, smooth = Smooth.None), Line(points = {{2, 82}, {12, 82}, {16, 72}, {30, 68}, {40, 78}, {52, 70}, {48, 58}, {60, 46}, {72, 50}, {80, 36}, {72, 30}, {74, 16}, {84, 12}, {84, 2}}, color = {0, 0, 0}, smooth = Smooth.None)}));
|
|---|
| 906 | end SupportModels;
|
|---|
| 907 |
|
|---|
| 908 | //Symbol to force Dymola to use UTF: €
|
|---|
| 909 | //package Propulsion
|
|---|
| 910 | extends Modelica.Icons.Package;
|
|---|
| 911 | //end Propulsion;
|
|---|
| 912 |
|
|---|
| 913 | package MapBased "Contains map-based models of Internal combustion engines and electric drives"
|
|---|
| 914 | extends Modelica.Icons.Package;
|
|---|
| 915 |
|
|---|
| 916 | class Information
|
|---|
| 917 | extends Modelica.Icons.Information;
|
|---|
| 918 | annotation(
|
|---|
| 919 | Documentation(info = "<html>
|
|---|
| 920 | <p>The map-based folder contains simple model whose only dynamics is due to their mechanical inertia.</p>
|
|---|
| 921 | <p>The ice model, since implements an Internal Combustion Engine, can just deliver (never absorb) power, while the other two ("oneFlange" and "twoFlange") simulate electric drive trains, i.e. the assembly of an electric machine and the corresponding AC/DC converter, and therefore can absorb or deliver power.</p>
|
|---|
| 922 | <p>The input torque of the ice model is in Newton-metres, while in the other cases it is normalised: it is between -1 and +1, where -1 means maximum available torque to be absorbed, +1 to be delivered.</p>
|
|---|
| 923 | <p>Some of the models have a special "Conn" version that allows interfacing with the exterior by means of an expandable connector.</p>
|
|---|
| 924 | <p>Note that usage of expandable connectors requires to give special names to the connector's variables, and therefore the models are more specific than their Modelica.Blocks.Connectors counterparts. Therefore here the models have receives specifi names such as "PsdGenConn" as a replacement of OneFlange: this is aone flance component to which we added a connector and spfcific signal names.</p>
|
|---|
| 925 | <p><br><u>Names and meaning </u>of the pre-defined quantities circulating through the connection bus in the model versions having "Conn" in their names.</p>
|
|---|
| 926 | <p>The detailed meaning of different quantities are to be read in the corresponding Table in the accompanying document "webBookCeraolo" in its section PSD-HEV.</p>
|
|---|
| 927 | </html>"),
|
|---|
| 928 | uses(Modelica(version = "3.2.1")));
|
|---|
| 929 | end Information;
|
|---|
| 930 |
|
|---|
| 931 | model IceT "Simple map-based ice model with connector"
|
|---|
| 932 | import Modelica.Constants.*;
|
|---|
| 933 | extends Partial.PartialIce;
|
|---|
| 934 | parameter Modelica.SIunits.AngularVelocity wIceStart = 167;
|
|---|
| 935 | // rad/s
|
|---|
| 936 | Modelica.Blocks.Interfaces.RealInput tauRef "torque request (positive when motor)" annotation(
|
|---|
| 937 | Placement(transformation(extent = {{-20, -20}, {20, 20}}, rotation = 90, origin = {-60, -100}), iconTransformation(extent = {{-20, -20}, {20, 20}}, rotation = 90, origin = {-60, -100})));
|
|---|
| 938 | Modelica.Blocks.Interfaces.RealOutput fuelCons "Fuel consumption (g/h)" annotation(
|
|---|
| 939 | Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = -90, origin = {60, -90})));
|
|---|
| 940 | Modelica.Blocks.Nonlinear.Limiter limiter(uMin = 0, uMax = 1e99) annotation(
|
|---|
| 941 | Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 90, origin = {-60, -16})));
|
|---|
| 942 | Modelica.Blocks.Math.Min min annotation(
|
|---|
| 943 | Placement(transformation(extent = {{-48, 50}, {-28, 70}})));
|
|---|
| 944 | equation
|
|---|
| 945 | connect(toG_perHour.y, fuelCons) annotation(
|
|---|
| 946 | Line(points = {{30, -61}, {30, -61}, {26, -61}, {60, -61}, {60, -90}}, color = {0, 0, 127}, smooth = Smooth.None));
|
|---|
| 947 | connect(limiter.u, tauRef) annotation(
|
|---|
| 948 | Line(points = {{-60, -28}, {-60, -100}}, color = {0, 0, 127}, smooth = Smooth.None));
|
|---|
| 949 | connect(min.u1, toLimTau.y[1]) annotation(
|
|---|
| 950 | Line(points = {{-50, 66}, {-58, 66}, {-61, 66}}, color = {0, 0, 127}));
|
|---|
| 951 | connect(min.u2, limiter.y) annotation(
|
|---|
| 952 | Line(points = {{-50, 54}, {-60, 54}, {-60, -5}}, color = {0, 0, 127}));
|
|---|
| 953 | connect(min.y, Tice.tau) annotation(
|
|---|
| 954 | Line(points = {{-27, 60}, {-21.5, 60}, {-14, 60}}, color = {0, 0, 127}));
|
|---|
| 955 | annotation(
|
|---|
| 956 | Diagram(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -80}, {100, 80}})),
|
|---|
| 957 | experiment(StopTime = 200, __Dymola_NumberOfIntervals = 1000, __Dymola_Algorithm = "Lsodar"),
|
|---|
| 958 | __Dymola_experimentSetupOutput,
|
|---|
| 959 | Documentation(info = "<html>
|
|---|
| 960 | <p>This model belongs to the map-based models of power train components.</p>
|
|---|
| 961 | <p>It models an Internal Combustion Engine, neglecting any dynamics except that related with its rotor inertia.</p>
|
|---|
| 962 | <p>The input signal is the torque request (Nm). </p>
|
|---|
| 963 | <p>The generated torque is the minimum between this signal (negative values are transformed to 0) and the maximum deliverable torque at the actual engine speed, defined by means of a table.</p>
|
|---|
| 964 | <p>From the generated torque and speed the fuel consumption is computed.</p>
|
|---|
| 965 | <p>Compare ICE input tau and internal Tice.tau.</p>
|
|---|
| 966 | </html>"),
|
|---|
| 967 | Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = false, initialScale = 0.1, grid = {2, 2}), graphics = {Text(extent = {{-100, -44}, {-22, -72}}, lineColor = {0, 0, 127}, textString = "Nm")}));
|
|---|
| 968 | end IceT;
|
|---|
| 969 |
|
|---|
| 970 | model IceT01 "Simple map-based ice model with connector"
|
|---|
| 971 | import Modelica.Constants.*;
|
|---|
| 972 | extends Partial.PartialIce(toLimTau(table = maxIceTau, tableOnFile = tablesOnFile, tableName = "maxIceTau", fileName = mapsFileName), toSpecCons(tableOnFile = tablesOnFile, fileName = mapsFileName, tableName = "specificCons"));
|
|---|
| 973 | parameter Modelica.SIunits.AngularVelocity wIceStart = 167;
|
|---|
| 974 | Modelica.Blocks.Interfaces.RealInput nTauRef "normalized torque request" annotation(
|
|---|
| 975 | Placement(transformation(extent = {{-20, -20}, {20, 20}}, rotation = 90, origin = {-60, -100}), iconTransformation(extent = {{-20, -20}, {20, 20}}, rotation = 90, origin = {-60, -100})));
|
|---|
| 976 | Modelica.Blocks.Interfaces.RealOutput fuelCons "Fuel consumption (g/h)" annotation(
|
|---|
| 977 | Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = -90, origin = {60, -90})));
|
|---|
| 978 | Modelica.Blocks.Nonlinear.Limiter limiter(uMin = 0, uMax = 1) annotation(
|
|---|
| 979 | Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 90, origin = {-60, -16})));
|
|---|
| 980 | Modelica.Blocks.Math.Product product annotation(
|
|---|
| 981 | Placement(transformation(extent = {{-48, 50}, {-28, 70}})));
|
|---|
| 982 | equation
|
|---|
| 983 | connect(toG_perHour.y, fuelCons) annotation(
|
|---|
| 984 | Line(points = {{30, -61}, {30, -62}, {30, -62}, {30, -62}, {30, -70}, {60, -70}, {60, -90}}, color = {0, 0, 127}, smooth = Smooth.None));
|
|---|
| 985 | connect(limiter.u, nTauRef) annotation(
|
|---|
| 986 | Line(points = {{-60, -28}, {-60, -100}}, color = {0, 0, 127}, smooth = Smooth.None));
|
|---|
| 987 | connect(Tice.tau, product.y) annotation(
|
|---|
| 988 | Line(points = {{-14, 60}, {-27, 60}}, color = {0, 0, 127}));
|
|---|
| 989 | connect(product.u2, limiter.y) annotation(
|
|---|
| 990 | Line(points = {{-50, 54}, {-60, 54}, {-60, 52}, {-60, -5}}, color = {0, 0, 127}));
|
|---|
| 991 | connect(product.u1, toLimTau.y[1]) annotation(
|
|---|
| 992 | Line(points = {{-50, 66}, {-58, 66}, {-58, 66}, {-61, 66}}, color = {0, 0, 127}));
|
|---|
| 993 | annotation(
|
|---|
| 994 | Diagram(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -80}, {100, 80}})),
|
|---|
| 995 | experiment(StopTime = 200, __Dymola_NumberOfIntervals = 1000, __Dymola_Algorithm = "Lsodar"),
|
|---|
| 996 | __Dymola_experimentSetupOutput,
|
|---|
| 997 | Documentation(info = "<html>
|
|---|
| 998 | <p>This model belongs to the map-based models of power train components.</p>
|
|---|
| 999 | <p>It models an Internal Combustion Engine, neglecting any dynamics except that related with its rotor inertia.</p>
|
|---|
| 1000 | <p>The input signal is a normalised request (0..1). </p>
|
|---|
| 1001 | <p>The generated torque is the product of the maximum deliverable torque at the actual engine speed, defined by means of a table, and the normalised input signal</p>
|
|---|
| 1002 | <p>From the generated torque and speed the fuel consumption is computed.</p>
|
|---|
| 1003 | </html>"),
|
|---|
| 1004 | Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = false, initialScale = 0.1, grid = {2, 2}), graphics = {Text(extent = {{-100, -40}, {-20, -70}}, lineColor = {0, 0, 127}, textString = "0..1")}));
|
|---|
| 1005 | end IceT01;
|
|---|
| 1006 |
|
|---|
| 1007 | model OneFlange "Simple map-based model of an electric drive"
|
|---|
| 1008 | extends Partial.PartialOneFlange;
|
|---|
| 1009 | Modelica.Blocks.Interfaces.RealInput tauRef "(positive when motor peration)" annotation(
|
|---|
| 1010 | Placement(visible = true, transformation(origin = {-118, -66}, extent = {{-18, -18}, {18, 18}}, rotation = 0), iconTransformation(origin = {-114, 0}, extent = {{-20, -20}, {20, 20}}, rotation = 0)));
|
|---|
| 1011 | equation
|
|---|
| 1012 | connect(variableLimiter.u, tauRef) annotation(
|
|---|
| 1013 | Line(points = {{-2, 30}, {14, 30}, {14, -66}, {-118, -66}}, color = {0, 0, 127}));
|
|---|
| 1014 | annotation(
|
|---|
| 1015 | Documentation(info = "<html>
|
|---|
| 1016 | <p>This is a model that models an electric drive: electornic converter + electric machine.</p>
|
|---|
| 1017 | <p>The only model dynamics is its inertia. </p>
|
|---|
| 1018 | <p>The input signal is a torque request (Nm). The requested torque is applied to a mechanical inertia. </p>
|
|---|
| 1019 | <p>The maximum available torque is internally computed considering a direct torque maximum (tauMax) and a power maximum (powMax) </p>
|
|---|
| 1020 | <p>The model then computes the inner losses and absorbs the total power from the DC input.</p>
|
|---|
| 1021 | <p>Note that to evaluate the inner losses the model uses an efficiency map (i.e. a table), in which torques are ratios of actual torques to tauMax and speeds are ratios of w to wMax. Because of this wMax must be supplied as a parameter.</p>
|
|---|
| 1022 | </html>"),
|
|---|
| 1023 | Diagram(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = false, initialScale = 0.1)),
|
|---|
| 1024 | Icon(coordinateSystem(extent = {{-100, -80}, {100, 100}}, preserveAspectRatio = false, initialScale = 0.1)));
|
|---|
| 1025 | end OneFlange;
|
|---|
| 1026 |
|
|---|
| 1027 | model TwoFlange "Simple map-based two-flange electric drive model"
|
|---|
| 1028 | extends Partial.PartialTwoFlange;
|
|---|
| 1029 | Modelica.Blocks.Interfaces.RealInput tauRef annotation(
|
|---|
| 1030 | Placement(transformation(extent = {{-20, -20}, {20, 20}}, rotation = 90, origin = {0, -114}), iconTransformation(extent = {{-20, -20}, {20, 20}}, rotation = 90, origin = {0, -92})));
|
|---|
| 1031 | equation
|
|---|
| 1032 | connect(tauRef, limTau.tau) annotation(
|
|---|
| 1033 | Line(points = {{0, -114}, {0, -114}, {0, -60}, {0, -58}, {-60, -58}, {-60, -9.6}, {-54.2, -9.6}}, color = {0, 0, 127}));
|
|---|
| 1034 | annotation(
|
|---|
| 1035 | Diagram(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}})),
|
|---|
| 1036 | Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = false, initialScale = 0.1, grid = {2, 2}), graphics = {Rectangle(fillColor = {192, 192, 192}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-100, 10}, {-66, -10}}), Rectangle(fillColor = {192, 192, 192}, fillPattern = FillPattern.HorizontalCylinder, extent = {{66, 8}, {100, -12}}), Rectangle(origin = {-25, 2}, extent = {{-75, 74}, {125, -74}}), Line(origin = {20, -2}, points = {{-60, 94}, {-60, 76}}, color = {0, 0, 255}), Line(origin = {-20, -2}, points = {{60, 94}, {60, 76}}, color = {0, 0, 255})}),
|
|---|
| 1037 | Documentation(info = "<html>
|
|---|
| 1038 | <p>This is a model that models an electric drive: electornic converter + electric machine.</p>
|
|---|
| 1039 | <p>The only model dynamics is its inertia. </p>
|
|---|
| 1040 | <p>The input signal is a torque request (Nm). The requested torque is applied to a mechanical inertia. </p>
|
|---|
| 1041 | <p><span style=\"font-family: MS Shell Dlg 2;\">The model receives from the input connector the torque request and tries to "deliver" it. Delivering means adding a torque to the system so that the torque exiting from flange B equals the one entering from flange A plus the one requested from the input connector.</span></p>
|
|---|
| 1042 | <p><span style=\"font-family: MS Shell Dlg 2;\">This simulates a two-flange electrical machine, where the added torque is the torque produced by the machine magnetic field stator-rotor interaction.</span></p>
|
|---|
| 1043 | <p><span style=\"font-family: MS Shell Dlg 2;\">However, before delivering the requested torque, the model limits it considering the maximum deliverable torque and power. In addition, it computes and considers inner losses as determined by means of a map. </span></p>
|
|---|
| 1044 | <p><span style=\"font-family: MS Shell Dlg 2;\">The maximum available torque is internally computed considering a direct torque maximum (tauMax) and a power maximum (powMax) </span></p>
|
|---|
| 1045 | <p><span style=\"font-family: MS Shell Dlg 2;\">The requested torque is applied to a mechancal inertia. The inertia is interfaced by means of two flanges with the exterior.</span></p>
|
|---|
| 1046 | <p><span style=\"font-family: MS Shell Dlg 2;\">The model then computes the inner losses and absorbs the total power from the DC input.</span></p>
|
|---|
| 1047 | </html>"));
|
|---|
| 1048 | end TwoFlange;
|
|---|
| 1049 |
|
|---|
| 1050 | model TwoFlangeConn "Simple map-based two-flange electric drive model"
|
|---|
| 1051 | import wbEHPTlib;
|
|---|
| 1052 | extends wbEHPTlib.MapBased.Partial.PartialTwoFlange;
|
|---|
| 1053 | SupportModels.ConnectorRelated.Conn conn1 annotation(
|
|---|
| 1054 | Placement(visible = true, transformation(extent = {{-112, -58}, {-72, -98}}, rotation = 0), iconTransformation(extent = {{-112, -58}, {-72, -98}}, rotation = 0)));
|
|---|
| 1055 | equation
|
|---|
| 1056 | connect(outBPow_.power, conn1.motPowDelB) annotation(
|
|---|
| 1057 | Line(points = {{64, 39}, {64, -78}, {-92, -78}, {-92, -78}}, color = {0, 0, 127}, smooth = Smooth.None),
|
|---|
| 1058 | Text(string = "%second", index = 1, extent = {{6, 3}, {6, 3}}));
|
|---|
| 1059 | connect(speedRing.w, conn1.motW) annotation(
|
|---|
| 1060 | Line(points = {{-80, 29}, {-86, 29}, {-86, 28}, {-92, 28}, {-92, -78}}, color = {0, 0, 127}, smooth = Smooth.None),
|
|---|
| 1061 | Text(string = "%second", index = 1, extent = {{6, 3}, {6, 3}}));
|
|---|
| 1062 | connect(add.y, conn1.motPowDelAB) annotation(
|
|---|
| 1063 | Line(points = {{32, -1}, {32, -22}, {78, -22}, {78, -78}, {-92, -78}}, color = {0, 0, 127}, smooth = Smooth.None),
|
|---|
| 1064 | Text(string = "%second", index = 1, extent = {{6, 3}, {6, 3}}));
|
|---|
| 1065 | connect(torqueLimiter.u, conn1.motTauRef) annotation(
|
|---|
| 1066 | Line(points = {{-18, 2}, {-26, 2}, {-26, -56}, {-92, -56}, {-92, -78}}, color = {0, 0, 127}),
|
|---|
| 1067 | Text(string = "%second", index = 1, extent = {{6, 3}, {6, 3}}));
|
|---|
| 1068 | annotation(
|
|---|
| 1069 | Diagram(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}})),
|
|---|
| 1070 | Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = false, initialScale = 0.1, grid = {2, 2}), graphics = {Rectangle(fillColor = {192, 192, 192}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-100, 10}, {-66, -10}}), Rectangle(fillColor = {192, 192, 192}, fillPattern = FillPattern.HorizontalCylinder, extent = {{66, 8}, {100, -12}}), Rectangle(origin = {-25, 2}, extent = {{-75, 74}, {125, -74}}), Line(origin = {20, -2}, points = {{-60, 94}, {-60, 76}}, color = {0, 0, 255}), Line(origin = {-20, -2}, points = {{60, 94}, {60, 76}}, color = {0, 0, 255})}),
|
|---|
| 1071 | Documentation(info = "<html>
|
|---|
| 1072 | <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>
|
|---|
| 1073 | <p><span style=\"font-family: MS Shell Dlg 2;\">This is a "connector" version of MBice.</span></p>
|
|---|
| 1074 | <p><span style=\"font-family: MS Shell Dlg 2;\">For a general descritiption see the info of MBice.</span></p>
|
|---|
| 1075 | <p><span style=\"font-family: MS Shell Dlg 2;\">Signals connected to the connector:</span></p>
|
|---|
| 1076 | <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>
|
|---|
| 1077 | <p><span style=\"font-family: MS Shell Dlg 2;\">- iceW (output) is the measured ICE speed (rad/s)</span></p>
|
|---|
| 1078 | <p><span style=\"font-family: MS Shell Dlg 2;\">- icePowDel (output) delivered power (W)</span></p>
|
|---|
| 1079 | </html>"));
|
|---|
| 1080 | end TwoFlangeConn;
|
|---|
| 1081 |
|
|---|
| 1082 | model Genset "GenSet GMS+GEN+SEngine"
|
|---|
| 1083 | import Modelica.Constants.inf;
|
|---|
| 1084 | import Modelica.Constants.pi;
|
|---|
| 1085 | parameter Modelica.SIunits.Time OptiTime "Time parameter of the PI OptiSpeed controller";
|
|---|
| 1086 | parameter String mapsFileName = "maps.txt" "Name of the file containing data maps (names: maxIceTau, specificCons, optiSpeed)";
|
|---|
| 1087 | parameter Modelica.SIunits.AngularVelocity wIceStart = 167;
|
|---|
| 1088 | parameter Modelica.SIunits.AngularVelocity maxGenW = 1e6;
|
|---|
| 1089 | parameter Modelica.SIunits.Torque maxTau = 200 "Max mechanical torque";
|
|---|
| 1090 | parameter Modelica.SIunits.Power maxPow = 20e3 "Max mechanical power";
|
|---|
| 1091 | Modelica.Mechanics.Rotational.Sensors.SpeedSensor speedSensor annotation(
|
|---|
| 1092 | Placement(transformation(extent = {{-8, -8}, {8, 8}}, rotation = 180, origin = {-24, -20})));
|
|---|
| 1093 | Modelica.Mechanics.Rotational.Sensors.PowerSensor IcePow annotation(
|
|---|
| 1094 | Placement(transformation(extent = {{24, -2}, {42, 16}})));
|
|---|
| 1095 | Modelica.Blocks.Interfaces.RealInput powRef(unit = "W") "Reference genset power" annotation(
|
|---|
| 1096 | Placement(transformation(extent = {{15, -15}, {-15, 15}}, rotation = 90, origin = {61, 115})));
|
|---|
| 1097 | Modelica.Electrical.Analog.Interfaces.PositivePin pin_p annotation(
|
|---|
| 1098 | Placement(transformation(extent = {{90, 50}, {110, 70}})));
|
|---|
| 1099 | Modelica.Electrical.Analog.Interfaces.NegativePin pin_n annotation(
|
|---|
| 1100 | Placement(transformation(extent = {{92, -70}, {112, -50}})));
|
|---|
| 1101 | Modelica.Blocks.Nonlinear.Limiter limiter(uMax = inf, uMin = 0) annotation(
|
|---|
| 1102 | Placement(transformation(extent = {{10, -10}, {-10, 10}}, rotation = 90, origin = {-80, 54})));
|
|---|
| 1103 | ECUs.GMS myGMS(mapsFileName = mapsFileName) annotation(
|
|---|
| 1104 | Placement(transformation(extent = {{-70, 10}, {-50, 30}})));
|
|---|
| 1105 | OneFlange gen(wMax = maxGenW, mapsFileName = mapsFileName, mapsOnFile = true, powMax = maxPow, tauMax = maxTau, effTableName = "gensetDriveEffTable") annotation(
|
|---|
| 1106 | Placement(transformation(extent = {{68, 16}, {48, -4}})));
|
|---|
| 1107 | IceT01 mBiceT(tablesOnFile = true, mapsFileName = mapsFileName, wIceStart = wIceStart) annotation(
|
|---|
| 1108 | Placement(transformation(extent = {{-34, -2}, {-14, 18}})));
|
|---|
| 1109 | Modelica.Blocks.Math.Gain gain(k = -1) annotation(
|
|---|
| 1110 | Placement(transformation(extent = {{-14, 30}, {6, 50}})));
|
|---|
| 1111 | Modelica.Blocks.Math.Gain gain1(k = 1) annotation(
|
|---|
| 1112 | Placement(visible = true, transformation(origin = {-60, -8}, extent = {{-6, -6}, {6, 6}}, rotation = 90)));
|
|---|
| 1113 | Modelica.Blocks.Continuous.Integrator toGrams(k = 1 / 3600) annotation(
|
|---|
| 1114 | Placement(transformation(extent = {{18, -42}, {38, -22}})));
|
|---|
| 1115 | equation
|
|---|
| 1116 | connect(gain1.u, speedSensor.w) annotation(
|
|---|
| 1117 | Line(points = {{-60, -15.2}, {-60, -20}, {-32.8, -20}}, color = {0, 0, 127}));
|
|---|
| 1118 | connect(myGMS.Wmecc, gain1.y) annotation(
|
|---|
| 1119 | Line(points = {{-59.9, 8.5}, {-60, 8.5}, {-60, -1.4}}, color = {0, 0, 127}));
|
|---|
| 1120 | connect(limiter.u, powRef) annotation(
|
|---|
| 1121 | Line(points = {{-80, 66}, {-80, 80}, {61, 80}, {61, 115}}, color = {0, 0, 127}, smooth = Smooth.None));
|
|---|
| 1122 | connect(limiter.y, myGMS.pRef) annotation(
|
|---|
| 1123 | Line(points = {{-80, 43}, {-80, 20}, {-72, 20}}, color = {0, 0, 127}, smooth = Smooth.None));
|
|---|
| 1124 | connect(IcePow.flange_b, gen.flange_a) annotation(
|
|---|
| 1125 | Line(points = {{42, 7}, {46, 7}, {46, 7.11111}, {48, 7.11111}}, color = {0, 0, 0}));
|
|---|
| 1126 | connect(gen.pin_n, pin_p) annotation(
|
|---|
| 1127 | Line(points = {{68, 11.5556}, {80, 11.5556}, {80, 60}, {100, 60}}, color = {0, 0, 255}));
|
|---|
| 1128 | connect(gen.pin_p, pin_n) annotation(
|
|---|
| 1129 | Line(points = {{68, 2.66667}, {78, 2.66667}, {78, -60}, {102, -60}}, color = {0, 0, 255}));
|
|---|
| 1130 | connect(mBiceT.nTauRef, myGMS.throttle) annotation(
|
|---|
| 1131 | Line(points = {{-30, -2}, {-30, -6}, {-49, -6}, {-49, 14}}, color = {0, 0, 127}));
|
|---|
| 1132 | connect(IcePow.flange_a, mBiceT.flange_a) annotation(
|
|---|
| 1133 | Line(points = {{24, 7}, {6, 7}, {6, 10}, {-14, 10}}, color = {0, 0, 0}));
|
|---|
| 1134 | connect(speedSensor.flange, mBiceT.flange_a) annotation(
|
|---|
| 1135 | Line(points = {{-16, -20}, {-6, -20}, {-6, 10}, {-14, 10}}, color = {0, 0, 0}));
|
|---|
| 1136 | connect(gain.u, myGMS.tRef) annotation(
|
|---|
| 1137 | Line(points = {{-16, 40}, {-40, 40}, {-40, 26}, {-49, 26}}, color = {0, 0, 127}));
|
|---|
| 1138 | connect(gain.y, gen.tauRef) annotation(
|
|---|
| 1139 | Line(points = {{7, 40}, {69.4, 40}, {69.4, 7.11111}}, color = {0, 0, 127}));
|
|---|
| 1140 | connect(toGrams.u, mBiceT.fuelCons) annotation(
|
|---|
| 1141 | Line(points = {{16, -32}, {12, -32}, {8, -32}, {8, -6}, {-18, -6}, {-18, -1}}, color = {0, 0, 127}));
|
|---|
| 1142 | annotation(
|
|---|
| 1143 | Diagram(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -60}, {100, 100}})),
|
|---|
| 1144 | experiment(StopTime = 20, Interval = 0.01),
|
|---|
| 1145 | experimentSetupOutput,
|
|---|
| 1146 | Icon(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Text(extent = {{-98, 94}, {78, 68}}, lineColor = {0, 0, 255}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, textString = "%name"), Rectangle(fillColor = {192, 192, 192}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-20, 0}, {26, -14}}), Rectangle(fillColor = {192, 192, 192}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-44, 30}, {-14, -44}}), Line(points = {{-72, 30}, {-72, 6}}), Polygon(points = {{-72, -2}, {-78, 8}, {-66, 8}, {-72, -2}}), Rectangle(extent = {{-96, 38}, {-50, -48}}), Rectangle(fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid, extent = {{-96, -6}, {-50, -24}}), Rectangle(fillColor = {135, 135, 135}, fillPattern = FillPattern.Solid, extent = {{-78, -24}, {-68, -44}}), Polygon(points = {{-72, 34}, {-78, 24}, {-66, 24}, {-72, 34}}), Rectangle(fillColor = {192, 192, 192}, fillPattern = FillPattern.HorizontalCylinder, extent = {{6, 30}, {62, -44}}), Line(points = {{94, 60}, {74, 60}, {74, 18}, {62, 18}}, color = {0, 0, 255}), Line(points = {{100, -60}, {74, -60}, {74, -28}, {62, -28}}, color = {0, 0, 255})}),
|
|---|
| 1147 | Documentation(info = "<html>
|
|---|
| 1148 | <p>Generator set containing Internal Combustion Engine, Electric generator (with DC output), and the related control.</p>
|
|---|
| 1149 | <p>The control logic tends to deliver at the DC port the input power, using the optimal generator speed.</p>
|
|---|
| 1150 | </html>"));
|
|---|
| 1151 | end Genset;
|
|---|
| 1152 |
|
|---|
| 1153 | model GensetOO "GenSet GMS+GEN+SEngine with On/Off"
|
|---|
| 1154 | import Modelica.Constants.inf;
|
|---|
| 1155 | import Modelica.Constants.pi;
|
|---|
| 1156 | parameter Real gsRatio = 2 "IdealGear speed reduction factor";
|
|---|
| 1157 | parameter Boolean mapsOnFile = false;
|
|---|
| 1158 | parameter String mapsFileName = "maps.txt" "Name of the file containing data maps (names: maxIceTau, specificCons, optiSpeed)";
|
|---|
| 1159 | parameter Modelica.SIunits.Torque iceTauMaxReq = 1e4 "Maximum torque ems requests from ICE";
|
|---|
| 1160 | parameter Modelica.SIunits.Torque maxGensetTau = 200 "Max mechanical torque";
|
|---|
| 1161 | parameter Modelica.SIunits.Power maxPow = 20e3 "Max mechanical power";
|
|---|
| 1162 | parameter Modelica.SIunits.AngularVelocity maxGenW = 1e6;
|
|---|
| 1163 | parameter Real maxIceTau[:, :] = [0, 80; 100, 80; 350, 95; 500, 95] "First column: speed, 2nd column: torque" annotation(
|
|---|
| 1164 | Dialog(enable = not mapsOnFile));
|
|---|
| 1165 | parameter Real specConsumption[:, :] = [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] "first row: speed, 1st column: torque, body: sp. consumption" annotation(
|
|---|
| 1166 | Dialog(enable = not mapsOnFile));
|
|---|
| 1167 | parameter Real optiTable[:, :] = [0, 800; 20000, 850; 40000, 1100; 60000, 1250; 80000, 1280; 100000, 1340; 120000, 1400; 140000, 1650; 160000, 2130] "first row: speed, 1st column: torque, body: sp. consumption" annotation(
|
|---|
| 1168 | Dialog(enable = not mapsOnFile));
|
|---|
| 1169 | parameter Modelica.SIunits.AngularVelocity wIceStart = 300;
|
|---|
| 1170 | Modelica.Mechanics.Rotational.Sensors.SpeedSensor speedSensor annotation(
|
|---|
| 1171 | Placement(visible = true, transformation(origin = {-26, -40}, extent = {{-8, -8}, {8, 8}}, rotation = 180)));
|
|---|
| 1172 | Modelica.Mechanics.Rotational.Components.IdealGear idealGear(ratio = gsRatio) annotation(
|
|---|
| 1173 | Placement(visible = true, transformation(extent = {{0, -18}, {18, 0}}, rotation = 0)));
|
|---|
| 1174 | Modelica.Blocks.Interfaces.BooleanInput ON "when true engine is ON" annotation(
|
|---|
| 1175 | Placement(visible = true, transformation(origin = {-55, 69}, extent = {{15, -15}, {-15, 15}}, rotation = 90), iconTransformation(origin = {-60, 116}, extent = {{15, -15}, {-15, 15}}, rotation = 90)));
|
|---|
| 1176 | Modelica.Mechanics.Rotational.Sensors.PowerSensor IcePow annotation(
|
|---|
| 1177 | Placement(visible = true, transformation(extent = {{22, -18}, {40, 0}}, rotation = 0)));
|
|---|
| 1178 | Modelica.Blocks.Interfaces.RealInput powRef(unit = "W") "Reference genset power" annotation(
|
|---|
| 1179 | Placement(visible = true, transformation(origin = {59, 71}, extent = {{15, -15}, {-15, 15}}, rotation = 90), iconTransformation(extent = {{15, -15}, {-15, 15}}, rotation = 90, origin = {60, 116})));
|
|---|
| 1180 | Modelica.Electrical.Analog.Interfaces.PositivePin pin_p annotation(
|
|---|
| 1181 | Placement(visible = true, transformation(extent = {{88, 30}, {108, 50}}, rotation = 0), iconTransformation(extent = {{90, 50}, {110, 70}}, rotation = 0)));
|
|---|
| 1182 | Modelica.Electrical.Analog.Interfaces.NegativePin pin_n annotation(
|
|---|
| 1183 | Placement(visible = true, transformation(extent = {{88, -50}, {108, -30}}, rotation = 0), iconTransformation(extent = {{92, -70}, {112, -50}}, rotation = 0)));
|
|---|
| 1184 | Modelica.Blocks.Nonlinear.Limiter limiter(uMax = inf, uMin = 0) annotation(
|
|---|
| 1185 | Placement(visible = true, transformation(origin = {-82, 36}, extent = {{10, -10}, {-10, 10}}, rotation = 90)));
|
|---|
| 1186 | ECUs.GMSoo gms(tauMax = iceTauMaxReq, mapsFileName = mapsFileName, throttlePerWerr = 0.1, tablesOnFile = true) annotation(
|
|---|
| 1187 | Placement(visible = true, transformation(extent = {{-72, -10}, {-52, 10}}, rotation = 0)));
|
|---|
| 1188 | OneFlange gen(wMax = maxGenW, mapsFileName = mapsFileName, mapsOnFile = true, powMax = maxPow, tauMax = maxGensetTau, effTableName = "gensetDriveEffTable") annotation(
|
|---|
| 1189 | Placement(visible = true, transformation(extent = {{68, 2}, {48, -18}}, rotation = 0)));
|
|---|
| 1190 | IceT01 mbIce(wIceStart = wIceStart, mapsFileName = mapsFileName, iceJ = 10, tablesOnFile = true) annotation(
|
|---|
| 1191 | Placement(visible = true, transformation(extent = {{-36, -22}, {-16, -2}}, rotation = 0)));
|
|---|
| 1192 | Modelica.Blocks.Math.Gain revGain(k = -0.9 * gsRatio) annotation(
|
|---|
| 1193 | Placement(visible = true, transformation(extent = {{-10, 10}, {10, 30}}, rotation = 0)));
|
|---|
| 1194 | Modelica.Blocks.Continuous.Integrator toGrams(k = 1 / 3600) annotation(
|
|---|
| 1195 | Placement(transformation(extent = {{18, -48}, {38, -28}})));
|
|---|
| 1196 | equation
|
|---|
| 1197 | connect(revGain.y, gen.tauRef) annotation(
|
|---|
| 1198 | Line(points = {{11, 20}, {69.4, 20}, {69.4, -6.88889}}, color = {0, 0, 127}));
|
|---|
| 1199 | connect(gen.pin_p, pin_n) annotation(
|
|---|
| 1200 | Line(points = {{68, -11.3333}, {76, -11.3333}, {76, -40}, {98, -40}}, color = {0, 0, 255}));
|
|---|
| 1201 | connect(gen.pin_n, pin_p) annotation(
|
|---|
| 1202 | Line(points = {{68, -2.44444}, {78, -2.44444}, {78, 40}, {98, 40}}, color = {0, 0, 255}));
|
|---|
| 1203 | connect(IcePow.flange_b, gen.flange_a) annotation(
|
|---|
| 1204 | Line(points = {{40, -9}, {44, -9}, {44, -8.88889}, {45.875, -8.88889}, {45.875, -6.88889}, {48, -6.88889}}));
|
|---|
| 1205 | connect(IcePow.flange_a, idealGear.flange_b) annotation(
|
|---|
| 1206 | Line(points = {{22, -9}, {18, -9}}));
|
|---|
| 1207 | connect(revGain.u, gms.tRef) annotation(
|
|---|
| 1208 | Line(points = {{-12, 20}, {-38, 20}, {-38, 6}, {-51, 6}}, color = {0, 0, 127}));
|
|---|
| 1209 | connect(mbIce.flange_a, idealGear.flange_a) annotation(
|
|---|
| 1210 | Line(points = {{-16, -10}, {-12, -10}, {-6, -10}, {-6, -9}, {0, -9}}));
|
|---|
| 1211 | connect(mbIce.nTauRef, gms.throttle) annotation(
|
|---|
| 1212 | Line(points = {{-32, -22}, {-32, -26}, {-51, -26}, {-51, -6}}, color = {0, 0, 127}));
|
|---|
| 1213 | connect(ON, gms.on) annotation(
|
|---|
| 1214 | Line(points = {{-55, 69}, {-55, 18}, {-73.8, 18}, {-73.8, 6}}, color = {255, 0, 255}));
|
|---|
| 1215 | connect(limiter.y, gms.pRef) annotation(
|
|---|
| 1216 | Line(points = {{-82, 25}, {-82, 0}, {-74, 0}}, color = {0, 0, 127}));
|
|---|
| 1217 | connect(speedSensor.w, gms.Wmecc) annotation(
|
|---|
| 1218 | Line(points = {{-34.8, -40}, {-61.9, -40}, {-61.9, -11.5}}, color = {0, 0, 127}));
|
|---|
| 1219 | connect(limiter.u, powRef) annotation(
|
|---|
| 1220 | Line(points = {{-82, 48}, {-82, 52}, {59, 52}, {59, 71}}, color = {0, 0, 127}));
|
|---|
| 1221 | connect(speedSensor.flange, idealGear.flange_a) annotation(
|
|---|
| 1222 | Line(points = {{-18, -40}, {-6, -40}, {-6, -9}, {0, -9}}));
|
|---|
| 1223 | connect(toGrams.u, mbIce.fuelCons) annotation(
|
|---|
| 1224 | Line(points = {{16, -38}, {2, -38}, {2, -30}, {-20, -30}, {-20, -21}}, color = {0, 0, 127}));
|
|---|
| 1225 | annotation(
|
|---|
| 1226 | Diagram(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -60}, {100, 60}})),
|
|---|
| 1227 | experiment(StopTime = 20, Interval = 0.01),
|
|---|
| 1228 | experimentSetupOutput,
|
|---|
| 1229 | Icon(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Text(extent = {{-98, 94}, {78, 68}}, lineColor = {0, 0, 255}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, textString = "%name"), Rectangle(fillColor = {192, 192, 192}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-20, 0}, {26, -14}}), Rectangle(fillColor = {192, 192, 192}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-44, 30}, {-14, -44}}), Line(points = {{-72, 30}, {-72, 6}}), Polygon(points = {{-72, -2}, {-78, 8}, {-66, 8}, {-72, -2}}), Rectangle(extent = {{-96, 38}, {-50, -48}}), Rectangle(fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid, extent = {{-96, -6}, {-50, -24}}), Rectangle(fillColor = {135, 135, 135}, fillPattern = FillPattern.Solid, extent = {{-78, -24}, {-68, -44}}), Polygon(points = {{-72, 34}, {-78, 24}, {-66, 24}, {-72, 34}}), Rectangle(fillColor = {192, 192, 192}, fillPattern = FillPattern.HorizontalCylinder, extent = {{6, 30}, {62, -44}}), Line(points = {{94, 60}, {74, 60}, {74, 18}, {62, 18}}, color = {0, 0, 255}), Line(points = {{100, -60}, {74, -60}, {74, -28}, {62, -28}}, color = {0, 0, 255})}),
|
|---|
| 1230 | Documentation(info = "<html>
|
|---|
| 1231 | <p>Generator set containing Internal Combustion Engine, Electric generator (with DC output), and the related control.</p>
|
|---|
| 1232 | <p>The control logic tends to deliver at the DC port the input power, using the optimal generator speed.</p>
|
|---|
| 1233 | <p>In addition, it switches ON or OFF depending on the input boolean control signal.</p>
|
|---|
| 1234 | </html>"),
|
|---|
| 1235 | __OpenModelica_commandLineOptions = "");
|
|---|
| 1236 | end GensetOO;
|
|---|
| 1237 |
|
|---|
| 1238 | model IceConnPOO "Simple map-based ice model with connector; follows power request with ON-OFF"
|
|---|
| 1239 | extends Partial.PartialIceP(toGramsPerkWh(fileName = mapsFileName));
|
|---|
| 1240 | import Modelica.Constants.*;
|
|---|
| 1241 | // rad/s
|
|---|
| 1242 | parameter String mapsFileName = "maps.txt" "Name of the file containing data maps (names: maxIceTau, specificCons, optiSpeed)";
|
|---|
| 1243 | SupportModels.ConnectorRelated.Conn conn annotation(
|
|---|
| 1244 | Placement(visible = true, transformation(extent = {{-20, -78}, {20, -118}}, rotation = 0), iconTransformation(extent = {{-20, -78}, {20, -118}}, rotation = 0)));
|
|---|
| 1245 | Modelica.Blocks.Continuous.Integrator tokgFuel(k = 1 / 3.6e6) annotation(
|
|---|
| 1246 | Placement(visible = true, transformation(origin = {38, -76}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
|
|---|
| 1247 | Modelica.Blocks.Logical.Switch switch1 annotation(
|
|---|
| 1248 | Placement(visible = true, transformation(origin = {2, -46}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
|
|---|
| 1249 | Modelica.Blocks.Sources.Constant zero(k = 0) annotation(
|
|---|
| 1250 | Placement(visible = true, transformation(extent = {{-46, -74}, {-26, -54}}, rotation = 0)));
|
|---|
| 1251 | Modelica.Blocks.Math.Product toG_perHour annotation(
|
|---|
| 1252 | Placement(visible = true, transformation(origin = {38, -42}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
|
|---|
| 1253 | equation
|
|---|
| 1254 | connect(toG_perHour.u1, toGramsPerkWh.y) annotation(
|
|---|
| 1255 | Line(points = {{44, -30}, {42, -30}, {42, -13}, {42, -13}}, color = {0, 0, 127}));
|
|---|
| 1256 | connect(switch1.y, toG_perHour.u2) annotation(
|
|---|
| 1257 | Line(points = {{13, -46}, {20, -46}, {20, -22}, {32, -22}, {32, -30}, {32, -30}}, color = {0, 0, 127}));
|
|---|
| 1258 | connect(toG_perHour.y, tokgFuel.u) annotation(
|
|---|
| 1259 | Line(points = {{38, -53}, {38, -53}, {38, -64}, {38, -64}}, color = {0, 0, 127}));
|
|---|
| 1260 | connect(tokW.y, switch1.u1) annotation(
|
|---|
| 1261 | Line(points = {{-18, -29}, {-18, -29}, {-18, -38}, {-10, -38}, {-10, -38}}, color = {0, 0, 127}));
|
|---|
| 1262 | connect(switch1.u3, zero.y) annotation(
|
|---|
| 1263 | Line(points = {{-10, -54}, {-18.5, -54}, {-18.5, -64}, {-25, -64}}, color = {0, 0, 127}));
|
|---|
| 1264 | connect(switch1.u2, conn.iceON) annotation(
|
|---|
| 1265 | Line(points = {{-10, -46}, {-60, -46}, {-60, -82}, {0, -82}, {0, -98}}, color = {255, 0, 255}));
|
|---|
| 1266 | connect(feedback.u1, conn.icePowRef) annotation(
|
|---|
| 1267 | Line(points = {{-88, 52}, {-88, 52}, {-88, -98}, {0, -98}}, color = {0, 0, 127}),
|
|---|
| 1268 | Text(string = "%second", index = 1, extent = {{6, 3}, {6, 3}}));
|
|---|
| 1269 | connect(Pice.power, conn.icePowDel) annotation(
|
|---|
| 1270 | Line(points = {{68, 63}, {68, 63}, {68, 6}, {78, 6}, {78, -98}, {0, -98}}, color = {0, 0, 127}),
|
|---|
| 1271 | Text(string = "%second", index = 1, extent = {{6, 3}, {6, 3}}));
|
|---|
| 1272 | connect(w.w, conn.iceW) annotation(
|
|---|
| 1273 | Line(points = {{58, 25}, {58, 25}, {58, 6}, {58, -98}, {0, -98}}, color = {0, 0, 127}),
|
|---|
| 1274 | Text(string = "%second", index = 1, extent = {{6, 3}, {6, 3}}));
|
|---|
| 1275 | annotation(
|
|---|
| 1276 | Diagram(coordinateSystem(preserveAspectRatio = false, initialScale = 0.1, extent = {{-100, -100}, {100, 100}})),
|
|---|
| 1277 | experiment(StopTime = 200, __Dymola_NumberOfIntervals = 1000, __Dymola_Algorithm = "Lsodar"),
|
|---|
| 1278 | __Dymola_experimentSetupOutput,
|
|---|
| 1279 | Documentation(info = "<html>
|
|---|
| 1280 | <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>
|
|---|
| 1281 | <p><span style=\"font-family: MS Shell Dlg 2;\">This is an evolution of IceConnP: ON/OFF control is added though an hysteresis block. </span></p>
|
|---|
| 1282 | <p><span style=\"font-family: MS Shell Dlg 2;\">For its general operation see the description of IceConnP.</span></p>
|
|---|
| 1283 | </html>"),
|
|---|
| 1284 | Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = false, initialScale = 0.1, grid = {2, 2}), graphics = {Text(origin = {34, -1}, lineColor = {255, 255, 255}, extent = {{32, -19}, {-48, 29}}, textString = "OO")}));
|
|---|
| 1285 | end IceConnPOO;
|
|---|
| 1286 |
|
|---|
| 1287 | model OneFlangeConn "Simple map-based one-flange electric drive"
|
|---|
| 1288 | extends Partial.PartialOneFlange;
|
|---|
| 1289 | SupportModels.ConnectorRelated.Conn conn annotation(
|
|---|
| 1290 | Placement(visible = true, transformation(extent = {{-18, -62}, {22, -102}}, rotation = 0), iconTransformation(extent = {{80, -58}, {120, -98}}, rotation = 0)));
|
|---|
| 1291 | Modelica.Blocks.Sources.RealExpression mechPow(y = powSensor.power) annotation(
|
|---|
| 1292 | Placement(transformation(extent = {{38, -56}, {18, -36}})));
|
|---|
| 1293 | equation
|
|---|
| 1294 | connect(wSensor.w, conn.genW) annotation(
|
|---|
| 1295 | Line(points = {{78, 35.2}, {78, -72}, {2, -72}, {2, -82}}, color = {0, 0, 127}, smooth = Smooth.None),
|
|---|
| 1296 | Text(string = "%second", index = 1, extent = {{6, 3}, {6, 3}}));
|
|---|
| 1297 | connect(mechPow.y, conn.genPowDel) annotation(
|
|---|
| 1298 | Line(points = {{17, -46}, {2, -46}, {2, -82}}, color = {0, 0, 127}),
|
|---|
| 1299 | Text(string = "%second", index = 1, extent = {{-6, 3}, {-6, 3}}, horizontalAlignment = TextAlignment.Right));
|
|---|
| 1300 | connect(variableLimiter.u, conn.genTauRef) annotation(
|
|---|
| 1301 | Line(points = {{-2, 30}, {6, 30}, {6, -32}, {2, -32}, {2, -82}}, color = {0, 0, 127}),
|
|---|
| 1302 | Text(string = "%second", index = 1, extent = {{6, 3}, {6, 3}}, horizontalAlignment = TextAlignment.Left));
|
|---|
| 1303 | annotation(
|
|---|
| 1304 | Diagram(coordinateSystem(preserveAspectRatio = false, initialScale = 0.1, grid = {2, 2})),
|
|---|
| 1305 | Icon(coordinateSystem(preserveAspectRatio = false, initialScale = 0.1, grid = {2, 2})),
|
|---|
| 1306 | Documentation(info = "<html>
|
|---|
| 1307 | <p>The input signal is interpreted as a <u>normalised</u> torque request (0 means null torque, 1 maximum availabile torque).</p>
|
|---|
| 1308 | <p>The maximum available torque is internally computed considering a direct torque maximum (tauMax) and a power maximum (powMax) </p>
|
|---|
| 1309 | <p>The requested torque is applied to a mechancal inertia. The inertia is interfaced by means ot two flanges with the exterior.</p>
|
|---|
| 1310 | <p>The model then computes the inner losses and absorbs the total power from the DC input.</p>
|
|---|
| 1311 | <p><br><u>Signals connected to the bus connecto</u>r (the names are chosen from the examples FullVehicles.PSecu1 and PSecu2 where the one-flange machine is called "gen"):</p>
|
|---|
| 1312 | <p>- genTauRef (input) is the torque request (Nm)</p>
|
|---|
| 1313 | <p>- genPowDel (output) is the delivered mechanical power (W)</p>
|
|---|
| 1314 | <p>- genTauLim (output) maximum available torque at the given machine rotational speed (Nm)</p>
|
|---|
| 1315 | </html>"));
|
|---|
| 1316 | end OneFlangeConn;
|
|---|
| 1317 |
|
|---|
| 1318 | package Partial
|
|---|
| 1319 | partial model PartialTwoFlange "Simple map-based two-flange electric drive model"
|
|---|
| 1320 | parameter Modelica.SIunits.Power powMax = 50000 "Maximum Mechanical drive power";
|
|---|
| 1321 | parameter Modelica.SIunits.Torque tauMax = 400 "Maximum drive Torque";
|
|---|
| 1322 | parameter Modelica.SIunits.AngularVelocity wMax = 650 "Maximum drive speed";
|
|---|
| 1323 | parameter Modelica.SIunits.MomentOfInertia J = 0.59 "Moment of Inertia";
|
|---|
| 1324 | parameter Boolean mapsOnFile = false "= true, if tables are taken from a txt file";
|
|---|
| 1325 | parameter String mapsFileName = "noName" "File where matrix is stored" annotation(
|
|---|
| 1326 | Dialog(enable = mapsOnFile, loadSelector(filter = "Text files (*.txt)", caption = "Open file in which required tables are")));
|
|---|
| 1327 | parameter String effTableName = "noName" "Name of the on-file maximum torque as a function of speed" annotation(
|
|---|
| 1328 | Dialog(enable = mapsOnFile));
|
|---|
| 1329 | parameter Real effTable[:, :] = [0,0,1;0,1,1;1,1,1] annotation(
|
|---|
| 1330 | Dialog(enable = not mapsOnFile));
|
|---|
| 1331 | SupportModels.MapBasedRelated.LimTau limTau(tauMax = tauMax, wMax = wMax, powMax = powMax) annotation(
|
|---|
| 1332 | Placement(transformation(extent = {{-58, -8}, {-36, 14}})));
|
|---|
| 1333 | SupportModels.MapBasedRelated.InertiaTq inertia(w(displayUnit = "rad/s", start = 0), J = J) annotation(
|
|---|
| 1334 | Placement(transformation(extent = {{8, 40}, {28, 60}})));
|
|---|
| 1335 | Modelica.Mechanics.Rotational.Sensors.SpeedSensor speedRing annotation(
|
|---|
| 1336 | Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 270, origin = {-80, 40})));
|
|---|
| 1337 | SupportModels.MapBasedRelated.EfficiencyT effMap(tauMax = tauMax, wMax = wMax, powMax = powMax, mapsOnFile = mapsOnFile, mapsFileName = mapsFileName, effTableName = effTableName, effTable = effTable) annotation(
|
|---|
| 1338 | Placement(transformation(extent = {{20, -46}, {40, -26}})));
|
|---|
| 1339 | SupportModels.MapBasedRelated.ConstPg constPDC annotation(
|
|---|
| 1340 | Placement(transformation(extent = {{-10, 10}, {10, -10}}, rotation = -90, origin = {0, 100})));
|
|---|
| 1341 | Modelica.Mechanics.Rotational.Sensors.PowerSensor outBPow_ annotation(
|
|---|
| 1342 | Placement(transformation(extent = {{62, 40}, {82, 60}})));
|
|---|
| 1343 | Modelica.Mechanics.Rotational.Sensors.PowerSensor outAPow_ annotation(
|
|---|
| 1344 | Placement(transformation(extent = {{-18, 40}, {-38, 60}})));
|
|---|
| 1345 | Modelica.Blocks.Math.Add add annotation(
|
|---|
| 1346 | Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = -90, origin = {32, 10})));
|
|---|
| 1347 | Modelica.Mechanics.Rotational.Interfaces.Flange_b flange_b "Right flange of shaft" annotation(
|
|---|
| 1348 | Placement(visible = true, transformation(extent = {{90, 40}, {110, 60}}, rotation = 0), iconTransformation(extent = {{90, -12}, {110, 8}}, rotation = 0)));
|
|---|
| 1349 | Modelica.Mechanics.Rotational.Interfaces.Flange_a flange_a "Left flange of shaft" annotation(
|
|---|
| 1350 | Placement(visible = true, transformation(extent = {{-110, 40}, {-90, 60}}, rotation = 0), iconTransformation(extent = {{-110, -10}, {-90, 10}}, rotation = 0)));
|
|---|
| 1351 | Modelica.Electrical.Analog.Interfaces.PositivePin pin_p annotation(
|
|---|
| 1352 | Placement(visible = true, transformation(extent = {{-70, 90}, {-50, 110}}, rotation = 0), iconTransformation(extent = {{-50, 88}, {-30, 108}}, rotation = 0)));
|
|---|
| 1353 | Modelica.Electrical.Analog.Interfaces.NegativePin pin_n annotation(
|
|---|
| 1354 | Placement(visible = true, transformation(extent = {{30, 90}, {50, 110}}, rotation = 0), iconTransformation(extent = {{30, 90}, {50, 110}}, rotation = 0)));
|
|---|
| 1355 | Modelica.Blocks.Nonlinear.VariableLimiter torqueLimiter annotation(
|
|---|
| 1356 | Placement(transformation(extent = {{-16, -8}, {4, 12}})));
|
|---|
| 1357 | equation
|
|---|
| 1358 | connect(flange_a, speedRing.flange) annotation(
|
|---|
| 1359 | Line(points = {{-100, 50}, {-80, 50}}, color = {0, 0, 0}, smooth = Smooth.None));
|
|---|
| 1360 | connect(effMap.w, speedRing.w) annotation(
|
|---|
| 1361 | Line(points = {{18, -40}, {-80, -40}, {-80, 29}}, color = {0, 0, 127}, smooth = Smooth.None));
|
|---|
| 1362 | connect(pin_p, constPDC.pin_p) annotation(
|
|---|
| 1363 | Line(points = {{-60, 100}, {-10, 100}}, color = {0, 0, 255}, smooth = Smooth.None));
|
|---|
| 1364 | connect(pin_n, constPDC.pin_n) annotation(
|
|---|
| 1365 | Line(points = {{40, 100}, {9.8, 100}}, color = {0, 0, 255}, smooth = Smooth.None));
|
|---|
| 1366 | connect(effMap.elePow, constPDC.Pref) annotation(
|
|---|
| 1367 | Line(points = {{40.6, -36}, {52, -36}, {52, 80}, {0, 80}, {0, 91.8}}, color = {0, 0, 127}, smooth = Smooth.None));
|
|---|
| 1368 | connect(flange_b, outBPow_.flange_b) annotation(
|
|---|
| 1369 | Line(points = {{100, 50}, {82, 50}}, color = {0, 0, 0}, smooth = Smooth.None));
|
|---|
| 1370 | connect(inertia.flange_b, outBPow_.flange_a) annotation(
|
|---|
| 1371 | Line(points = {{28, 50}, {62, 50}}, color = {0, 0, 0}, smooth = Smooth.None));
|
|---|
| 1372 | connect(inertia.flange_a, outAPow_.flange_a) annotation(
|
|---|
| 1373 | Line(points = {{8, 50}, {-18, 50}}, color = {0, 0, 0}, smooth = Smooth.None));
|
|---|
| 1374 | connect(outAPow_.flange_b, speedRing.flange) annotation(
|
|---|
| 1375 | Line(points = {{-38, 50}, {-80, 50}}, color = {0, 0, 0}, smooth = Smooth.None));
|
|---|
| 1376 | connect(add.u1, outBPow_.power) annotation(
|
|---|
| 1377 | Line(points = {{38, 22}, {38, 28}, {64, 28}, {64, 39}}, color = {0, 0, 127}, smooth = Smooth.None));
|
|---|
| 1378 | connect(add.u2, outAPow_.power) annotation(
|
|---|
| 1379 | Line(points = {{26, 22}, {26, 28}, {-20, 28}, {-20, 39}}, color = {0, 0, 127}, smooth = Smooth.None));
|
|---|
| 1380 | connect(torqueLimiter.limit1, limTau.yH) annotation(
|
|---|
| 1381 | Line(points = {{-18, 10}, {-28, 10}, {-28, 9.6}, {-34.9, 9.6}}, color = {0, 0, 127}));
|
|---|
| 1382 | connect(torqueLimiter.limit2, limTau.yL) annotation(
|
|---|
| 1383 | Line(points = {{-18, -6}, {-28, -6}, {-28, -3.6}, {-34.9, -3.6}}, color = {0, 0, 127}));
|
|---|
| 1384 | connect(torqueLimiter.y, inertia.tau) annotation(
|
|---|
| 1385 | Line(points = {{5, 2}, {12.55, 2}, {12.55, 40}}, color = {0, 0, 127}));
|
|---|
| 1386 | connect(effMap.tau, torqueLimiter.y) annotation(
|
|---|
| 1387 | Line(points = {{18, -32}, {12, -32}, {12, 2}, {5, 2}}, color = {0, 0, 127}));
|
|---|
| 1388 | connect(limTau.w, speedRing.w) annotation(
|
|---|
| 1389 | Line(points = {{-60.2, 3}, {-80, 3}, {-80, 29}}, color = {0, 0, 127}));
|
|---|
| 1390 | annotation(
|
|---|
| 1391 | Diagram(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}})),
|
|---|
| 1392 | Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = false, initialScale = 0.1, grid = {2, 2}), graphics = {Rectangle(origin = {-25, 2}, extent = {{-75, 74}, {125, -74}}, lineColor = {0, 0, 0}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Text(origin = {4, -6}, lineColor = {0, 0, 255}, extent = {{-110, 84}, {100, 44}}, textString = "%name"), Rectangle(fillColor = {192, 192, 192}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-64, 38}, {64, -42}}), Rectangle(fillColor = {192, 192, 192}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-100, 10}, {-64, -10}}), Rectangle(fillColor = {192, 192, 192}, fillPattern = FillPattern.HorizontalCylinder, extent = {{64, 8}, {100, -12}}), Line(origin = {20, 0}, points = {{-60, 94}, {-60, 76}}, color = {0, 0, 255}), Line(origin = {-20, 0}, points = {{60, 94}, {60, 76}}, color = {0, 0, 255}), Rectangle(fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, extent = {{-58, 14}, {58, -18}}), Text(origin = {-0.07637, 48.3161}, extent = {{-51.9236, -36.3161}, {48.0764, -66.3161}}, textString = "J=%J")}),
|
|---|
| 1393 | Documentation(info = "<html>
|
|---|
| 1394 | <p>This model receives from the connector the torque request (variable MotTauInt) and trieds to deliver it.</p>
|
|---|
| 1395 | <p>Howeve,r before delivering the requested torque, the model limits it considering the maximum deliverable torque and power. In addition it computes and considers inner losses as determined by means of a map. </p>
|
|---|
| 1396 | </html>"));
|
|---|
| 1397 | end PartialTwoFlange;
|
|---|
| 1398 |
|
|---|
| 1399 | partial model PartialIce "Simple map-based Internal Combustion Engine model"
|
|---|
| 1400 | import Modelica.Constants.*;
|
|---|
| 1401 | parameter Modelica.SIunits.AngularVelocity wIceStart = 167;
|
|---|
| 1402 | // rad/s
|
|---|
| 1403 | parameter Modelica.SIunits.MomentOfInertia iceJ = 0.5 "ICE moment of inertia";
|
|---|
| 1404 | parameter Boolean tablesOnFile = false "= true, if tables are got from a file";
|
|---|
| 1405 | parameter String mapsFileName = "NoName" "File where matrix is stored" annotation(
|
|---|
| 1406 | Dialog(enable = tablesOnFile, loadSelector(filter = "Text files (*.txt)", caption = "Open file in which required tables are")));
|
|---|
| 1407 | parameter Real maxIceTau[:, :] = [0, 80; 100, 80; 350, 95; 500, 95] "First column: speed (rad/s); first column: maximum ICE torque (Nm)" annotation(
|
|---|
| 1408 | Dialog(enable = not tablesOnFile));
|
|---|
| 1409 | Modelica.Mechanics.Rotational.Sensors.SpeedSensor w annotation(
|
|---|
| 1410 | Placement(visible = true, transformation(origin = {52, 44}, extent = {{-10, -10}, {10, 10}}, rotation = 270)));
|
|---|
| 1411 | Modelica.Mechanics.Rotational.Interfaces.Flange_a flange_a annotation(
|
|---|
| 1412 | Placement(visible = true, transformation(extent = {{90, 10}, {110, 30}}, rotation = 0), iconTransformation(extent = {{90, 10}, {110, 30}}, rotation = 0)));
|
|---|
| 1413 | Modelica.Mechanics.Rotational.Sensors.PowerSensor icePow annotation(
|
|---|
| 1414 | Placement(visible = true, transformation(extent = {{66, 50}, {86, 70}}, rotation = 0)));
|
|---|
| 1415 | Modelica.Mechanics.Rotational.Sources.Torque Tice annotation(
|
|---|
| 1416 | Placement(visible = true, transformation(extent = {{-12, 50}, {8, 70}}, rotation = 0)));
|
|---|
| 1417 | Modelica.Mechanics.Rotational.Components.Inertia ICE(w(fixed = true, start = wIceStart, displayUnit = "rpm"), J = iceJ) annotation(
|
|---|
| 1418 | Placement(visible = true, transformation(extent = {{16, 50}, {36, 70}}, rotation = 0)));
|
|---|
| 1419 | Modelica.Blocks.Math.Product toPowW annotation(
|
|---|
| 1420 | Placement(visible = true, transformation(origin = {0, 12}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
|
|---|
| 1421 | Modelica.Blocks.Math.Product toG_perHour annotation(
|
|---|
| 1422 | Placement(visible = true, transformation(origin = {30, -50}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
|
|---|
| 1423 | // Modelica.Blocks.Continuous.Integrator toGrams(k = 1 / 3600000.0)
|
|---|
| 1424 | // annotation(Placement(visible = true, transformation(origin = {26, -44},
|
|---|
| 1425 | //extent = {{-10, -10}, {10, 10}}, rotation = 270)));
|
|---|
| 1426 | Modelica.Blocks.Tables.CombiTable1D toLimTau(table = maxIceTau) annotation(
|
|---|
| 1427 | Placement(visible = true, transformation(origin = {-72, 66}, extent = {{10, -10}, {-10, 10}}, rotation = 180)));
|
|---|
| 1428 | Modelica.Blocks.Sources.RealExpression rotorW(y = w.w) annotation(
|
|---|
| 1429 | Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 90, origin = {-88, 36})));
|
|---|
| 1430 | Modelica.Blocks.Math.Gain tokW(k = 1e-3) annotation(
|
|---|
| 1431 | Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = -90, origin = {0, -18})));
|
|---|
| 1432 | Modelica.Blocks.Tables.CombiTable2D toSpecCons(tableOnFile = true, fileName = "PSDmaps.txt", tableName = "specificCons") annotation(
|
|---|
| 1433 | Placement(transformation(extent = {{-10, 10}, {10, -10}}, rotation = -90, origin = {40, 0})));
|
|---|
| 1434 | equation
|
|---|
| 1435 | connect(toPowW.u1, w.w) annotation(
|
|---|
| 1436 | Line(points = {{6, 24}, {6, 33}, {52, 33}}, color = {0, 0, 127}));
|
|---|
| 1437 | connect(w.flange, ICE.flange_b) annotation(
|
|---|
| 1438 | Line(points = {{52, 54}, {52, 60}, {36, 60}}));
|
|---|
| 1439 | connect(icePow.flange_a, ICE.flange_b) annotation(
|
|---|
| 1440 | Line(points = {{66, 60}, {36, 60}}));
|
|---|
| 1441 | connect(Tice.flange, ICE.flange_a) annotation(
|
|---|
| 1442 | Line(points = {{8, 60}, {16, 60}}));
|
|---|
| 1443 | connect(icePow.flange_b, flange_a) annotation(
|
|---|
| 1444 | Line(points = {{86, 60}, {94, 60}, {94, 20}, {100, 20}}));
|
|---|
| 1445 | connect(toLimTau.u[1], rotorW.y) annotation(
|
|---|
| 1446 | Line(points = {{-84, 66}, {-88, 66}, {-88, 47}}, color = {0, 0, 127}, smooth = Smooth.None));
|
|---|
| 1447 | connect(toPowW.y, tokW.u) annotation(
|
|---|
| 1448 | Line(points = {{-2.22045e-015, 1}, {-2.22045e-015, -2}, {2.22045e-015, -2}, {2.22045e-015, -6}}, color = {0, 0, 127}, smooth = Smooth.None));
|
|---|
| 1449 | connect(toSpecCons.y, toG_perHour.u1) annotation(
|
|---|
| 1450 | Line(points = {{40, -11}, {40, -24}, {36, -24}, {36, -38}}, color = {0, 0, 127}));
|
|---|
| 1451 | connect(toG_perHour.u2, tokW.y) annotation(
|
|---|
| 1452 | Line(points = {{24, -38}, {24, -32}, {0, -32}, {0, -29}}, color = {0, 0, 127}));
|
|---|
| 1453 | connect(toSpecCons.u2, w.w) annotation(
|
|---|
| 1454 | Line(points = {{46, 12}, {46, 28}, {52, 28}, {52, 33}}, color = {0, 0, 127}));
|
|---|
| 1455 | connect(toSpecCons.u1, Tice.tau) annotation(
|
|---|
| 1456 | Line(points = {{34, 12}, {34, 12}, {34, 38}, {34, 42}, {-22, 42}, {-22, 60}, {-14, 60}}, color = {0, 0, 127}));
|
|---|
| 1457 | connect(toPowW.u2, Tice.tau) annotation(
|
|---|
| 1458 | Line(points = {{-6, 24}, {-6, 42}, {-22, 42}, {-22, 60}, {-14, 60}}, color = {0, 0, 127}));
|
|---|
| 1459 | annotation(
|
|---|
| 1460 | Diagram(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -80}, {100, 80}})),
|
|---|
| 1461 | experiment(StopTime = 200, __Dymola_NumberOfIntervals = 1000, __Dymola_Algorithm = "Lsodar"),
|
|---|
| 1462 | __Dymola_experimentSetupOutput,
|
|---|
| 1463 | Documentation(info = "<html>
|
|---|
| 1464 | <h4>Basic map-based ICE model.</h4>
|
|---|
| 1465 | <p>It receives as input the reference torque as a fracton of the maximum deliverable torque at a given speed. It can be approximately thought as a signal proportional to the vehicle's accelerator pedal position.</p>
|
|---|
| 1466 | <p>The generated torque is the minimum between this signal and the maximum deliverable torque at the actual engine speed (defined by means of a table).</p>
|
|---|
| 1467 | <p>From the generated torque and speed the fuel consumption is computed.</p>
|
|---|
| 1468 | <p>The used maxTorque (toLimTau) and specific fuel consumption (toSpecCons) maps are inspired to public data related to the Toyota Prius' engine </p>
|
|---|
| 1469 | </html>"),
|
|---|
| 1470 | Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = false, initialScale = 0.1, grid = {2, 2}), graphics = {Rectangle(extent = {{-100, 80}, {100, -80}}, lineColor = {0, 0, 0}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Rectangle(fillColor = {192, 192, 192}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-24, 68}, {76, -24}}), Rectangle(fillColor = {192, 192, 192}, fillPattern = FillPattern.HorizontalCylinder, extent = {{76, 30}, {100, 10}}), Text(origin = {0, 30}, lineColor = {0, 0, 255}, extent = {{-140, 100}, {140, 60}}, textString = "%name"), Rectangle(extent = {{-90, 68}, {-32, -26}}), Rectangle(fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid, extent = {{-90, 22}, {-32, 0}}), Line(points = {{-60, 56}, {-60, 32}}), Polygon(points = {{-60, 66}, {-66, 56}, {-54, 56}, {-60, 66}}), Polygon(points = {{-60, 24}, {-66, 34}, {-54, 34}, {-60, 24}}), Rectangle(fillColor = {135, 135, 135}, fillPattern = FillPattern.Solid, extent = {{-64, 0}, {-54, -20}})}));
|
|---|
| 1471 | end PartialIce;
|
|---|
| 1472 |
|
|---|
| 1473 | partial model PartialOneFlange2 "Partial map-based one-Flange electric drive model"
|
|---|
| 1474 | parameter Real powMax = 22000 "Maximum drive power (W)";
|
|---|
| 1475 | parameter Real tauMax = 80 "Maximum drive torque (Nm)";
|
|---|
| 1476 | parameter Real wMax(min = powMax / tauMax) = 3000 "Maximum drive speed (rad/s)";
|
|---|
| 1477 | parameter Real J = 0.25 "Rotor's moment of inertia (kg.m^2)";
|
|---|
| 1478 | parameter String mapsFileName "maps.txtName of the txt file where models' maps are stored";
|
|---|
| 1479 | parameter String effMapName "Name of the efficiency map in mapsFileName";
|
|---|
| 1480 | //the name is passed because a file can contain efficiency tables for
|
|---|
| 1481 | //different submodels, e.g. genEfficiency for generator and motEfficiency for motor.
|
|---|
| 1482 | Modelica.Mechanics.Rotational.Interfaces.Flange_a flange_a "Left flange of shaft" annotation(
|
|---|
| 1483 | Placement(transformation(extent = {{90, -10}, {110, 10}}, rotation = 0), iconTransformation(extent = {{90, -10}, {110, 10}})));
|
|---|
| 1484 | Modelica.Mechanics.Rotational.Sensors.SpeedSensor wSensor annotation(
|
|---|
| 1485 | Placement(visible = true, transformation(origin = {80, -2}, extent = {{8, -8}, {-8, 8}}, rotation = 90)));
|
|---|
| 1486 | Modelica.Blocks.Math.Abs abs1 annotation(
|
|---|
| 1487 | Placement(transformation(extent = {{60, -30}, {40, -10}})));
|
|---|
| 1488 | SupportModels.MapBasedRelated.TauLim limTau(tauMax = tauMax, powMax = powMax) annotation(
|
|---|
| 1489 | Placement(transformation(extent = {{6, -32}, {-14, -10}})));
|
|---|
| 1490 | SupportModels.MapBasedRelated.EfficiencyT toElePow(tauMax = tauMax, wMax = wMax, powMax = powMax, mapsFileName = mapsFileName, effMapName = effMapName) annotation(
|
|---|
| 1491 | Placement(transformation(extent = {{10, -10}, {-10, 10}}, rotation = 0, origin = {-40, -54})));
|
|---|
| 1492 | Modelica.Electrical.Analog.Interfaces.PositivePin pin_p annotation(
|
|---|
| 1493 | Placement(visible = true, transformation(extent = {{-110, 50}, {-90, 70}}, rotation = 0), iconTransformation(extent = {{-110, 50}, {-90, 70}}, rotation = 0)));
|
|---|
| 1494 | Modelica.Electrical.Analog.Interfaces.NegativePin pin_n annotation(
|
|---|
| 1495 | Placement(visible = true, transformation(origin = {-100, -58}, extent = {{10, -10}, {-10, 10}}, rotation = 0), iconTransformation(origin = {-100, -58}, extent = {{10, -10}, {-10, 10}}, rotation = 0)));
|
|---|
| 1496 | Modelica.Mechanics.Rotational.Components.Inertia inertia(J = J) annotation(
|
|---|
| 1497 | Placement(transformation(extent = {{22, 10}, {42, 30}})));
|
|---|
| 1498 | Modelica.Mechanics.Rotational.Sources.Torque torque annotation(
|
|---|
| 1499 | Placement(transformation(extent = {{-16, 10}, {4, 30}})));
|
|---|
| 1500 | Modelica.Blocks.Math.Gain gain(k = 1) annotation(
|
|---|
| 1501 | Placement(transformation(extent = {{10, -10}, {-10, 10}}, rotation = 0, origin = {-64, 0})));
|
|---|
| 1502 | Modelica.Mechanics.Rotational.Sensors.PowerSensor powSensor annotation(
|
|---|
| 1503 | Placement(transformation(extent = {{50, 10}, {70, 30}})));
|
|---|
| 1504 | SupportModels.MapBasedRelated.ConstPg constPg annotation(
|
|---|
| 1505 | Placement(transformation(extent = {{-98, -10}, {-78, 10}})));
|
|---|
| 1506 | equation
|
|---|
| 1507 | connect(abs1.u, wSensor.w) annotation(
|
|---|
| 1508 | Line(points = {{62, -20}, {80, -20}, {80, -10.8}}, color = {0, 0, 127}));
|
|---|
| 1509 | connect(toElePow.w, wSensor.w) annotation(
|
|---|
| 1510 | Line(points = {{-28, -58}, {80, -58}, {80, -10.8}}, color = {0, 0, 127}));
|
|---|
| 1511 | connect(wSensor.flange, powSensor.flange_b) annotation(
|
|---|
| 1512 | Line(points = {{80, 6}, {80, 6}, {80, 20}, {70, 20}, {70, 20}}));
|
|---|
| 1513 | connect(toElePow.elePow, gain.u) annotation(
|
|---|
| 1514 | Line(points = {{-50.6, -54}, {-58.6, -54}, {-58.6, -26}, {-44, -26}, {-44, 0}, {-52, 0}}, color = {0, 0, 127}));
|
|---|
| 1515 | assert(wMax >= powMax / tauMax, "\n****\n" + "PARAMETER VERIFICATION ERROR:\nwMax must be not lower than powMax/tauMax" + "\n***\n");
|
|---|
| 1516 | connect(limTau.w, abs1.y) annotation(
|
|---|
| 1517 | Line(points = {{8, -14.4}, {28, -14.4}, {28, -20}, {39, -20}}, color = {0, 0, 127}, smooth = Smooth.None));
|
|---|
| 1518 | connect(powSensor.flange_b, flange_a) annotation(
|
|---|
| 1519 | Line(points = {{70, 20}, {94, 20}, {94, 0}, {100, 0}}, color = {0, 0, 0}, smooth = Smooth.None));
|
|---|
| 1520 | connect(inertia.flange_a, torque.flange) annotation(
|
|---|
| 1521 | Line(points = {{22, 20}, {4, 20}}, color = {0, 0, 0}, smooth = Smooth.None));
|
|---|
| 1522 | connect(inertia.flange_b, powSensor.flange_a) annotation(
|
|---|
| 1523 | Line(points = {{42, 20}, {50, 20}}, color = {0, 0, 0}, smooth = Smooth.None));
|
|---|
| 1524 | connect(limTau.y, torque.tau) annotation(
|
|---|
| 1525 | Line(points = {{-15, -21}, {-34, -21}, {-34, 20}, {-18, 20}}, color = {0, 0, 127}));
|
|---|
| 1526 | connect(toElePow.tau, torque.tau) annotation(
|
|---|
| 1527 | Line(points = {{-28, -50}, {-20, -50}, {-20, -32}, {-34, -32}, {-34, 20}, {-18, 20}}, color = {0, 0, 127}));
|
|---|
| 1528 | connect(gain.y, constPg.Pref) annotation(
|
|---|
| 1529 | Line(points = {{-75, 0}, {-79.8, 0}}, color = {0, 0, 127}));
|
|---|
| 1530 | connect(constPg.pin_p, pin_p) annotation(
|
|---|
| 1531 | Line(points = {{-88, 10}, {-88, 60}, {-100, 60}}, color = {0, 0, 255}));
|
|---|
| 1532 | connect(constPg.pin_n, pin_n) annotation(
|
|---|
| 1533 | Line(points = {{-88, -9.8}, {-88, -9.8}, {-88, -58}, {-100, -58}}, color = {0, 0, 255}));
|
|---|
| 1534 | annotation(
|
|---|
| 1535 | Diagram(coordinateSystem(preserveAspectRatio = false, initialScale = 0.1)),
|
|---|
| 1536 | Icon(coordinateSystem(preserveAspectRatio = false, initialScale = 0.1), graphics = {Rectangle(fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, extent = {{-100, 80}, {100, -80}}), Rectangle(fillColor = {192, 192, 192}, fillPattern = FillPattern.HorizontalCylinder, extent = {{56, 10}, {100, -10}}), Rectangle(fillColor = {192, 192, 192}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-72, 50}, {58, -46}}), Line(origin = {2, 122}, rotation = 90, points = {{-72, 62}, {-60, 62}, {-60, 96}}, color = {0, 0, 255}), Text(origin = {-14.9415, 30}, lineColor = {0, 0, 255}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, extent = {{-79.0585, 98}, {112.936, 60}}, textString = "%name"), Line(origin = {-138, -16}, rotation = 90, points = {{-42, -48}, {-42, -76}, {-30, -76}}, color = {0, 0, 255}), Rectangle(fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, extent = {{-66, 14}, {50, -14}}), Text(origin = {-9.8571, 49.1}, extent = {{-54.1429, -35.1}, {61.8571, -61.1}}, textString = "J=%J")}),
|
|---|
| 1537 | Documentation(info = "<html>
|
|---|
| 1538 | <p>One-flange electric drive.</p>
|
|---|
| 1539 | <p>The input signal is the requested normalised torque (1 means nominal torque)</p>
|
|---|
| 1540 | </html>"));
|
|---|
| 1541 | end PartialOneFlange2;
|
|---|
| 1542 |
|
|---|
| 1543 | model PartialIceP "Simple map-based ice model with connector and Power request"
|
|---|
| 1544 | import Modelica.Constants.*;
|
|---|
| 1545 | parameter Real contrGain = 0.1 "Proportional controller gain (Nm/W)";
|
|---|
| 1546 | parameter Real wIceStart = 167;
|
|---|
| 1547 | parameter Real iceJ = 0.5 "ICE moment of Inertia (kg.m^2)";
|
|---|
| 1548 | // rad/s
|
|---|
| 1549 | Modelica.Mechanics.Rotational.Components.Inertia inertia(w(fixed = true, start = wIceStart, displayUnit = "rpm"), J = iceJ) annotation(
|
|---|
| 1550 | Placement(visible = true, transformation(extent = {{30, 42}, {50, 62}}, rotation = 0)));
|
|---|
| 1551 | Modelica.Mechanics.Rotational.Sources.Torque iceTau annotation(
|
|---|
| 1552 | Placement(visible = true, transformation(extent = {{4, 42}, {24, 62}}, rotation = 0)));
|
|---|
| 1553 | Modelica.Mechanics.Rotational.Sensors.PowerSensor Pice annotation(
|
|---|
| 1554 | Placement(transformation(extent = {{66, 62}, {86, 42}})));
|
|---|
| 1555 | Modelica.Mechanics.Rotational.Sensors.SpeedSensor w annotation(
|
|---|
| 1556 | Placement(visible = true, transformation(origin = {58, 36}, extent = {{-10, -10}, {10, 10}}, rotation = 270)));
|
|---|
| 1557 | Modelica.Blocks.Math.Product toPowW annotation(
|
|---|
| 1558 | Placement(visible = true, transformation(origin = {-18, 10}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
|
|---|
| 1559 | Modelica.Blocks.Math.Feedback feedback annotation(
|
|---|
| 1560 | Placement(transformation(extent = {{-90, 62}, {-70, 42}})));
|
|---|
| 1561 | Modelica.Blocks.Math.Gain gain(k = contrGain) annotation(
|
|---|
| 1562 | Placement(visible = true, transformation(extent = {{-62, 42}, {-42, 62}}, rotation = 0)));
|
|---|
| 1563 | Modelica.Mechanics.Rotational.Interfaces.Flange_a flange_a annotation(
|
|---|
| 1564 | Placement(transformation(extent = {{90, -10}, {110, 10}}), iconTransformation(extent = {{90, -10}, {110, 10}})));
|
|---|
| 1565 | Modelica.Blocks.Tables.CombiTable2D toGramsPerkWh(fileName = "PSDmaps.txt", tableName = "iceSpecificCons", tableOnFile = true) annotation(
|
|---|
| 1566 | Placement(transformation(extent = {{-10, 10}, {10, -10}}, rotation = -90, origin = {42, -2})));
|
|---|
| 1567 | Modelica.Blocks.Math.Gain tokW(k = 0.001) annotation(
|
|---|
| 1568 | Placement(visible = true, transformation(origin = {-18, -18}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
|
|---|
| 1569 | Modelica.Blocks.Nonlinear.Limiter limiter1(uMax = 1e99, uMin = 0) annotation(
|
|---|
| 1570 | Placement(visible = true, transformation(origin = {-22, 52}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
|
|---|
| 1571 | equation
|
|---|
| 1572 | connect(toPowW.y, tokW.u) annotation(
|
|---|
| 1573 | Line(points = {{-18, -1}, {-18, -6}}, color = {0, 0, 127}));
|
|---|
| 1574 | connect(toPowW.u2, iceTau.tau) annotation(
|
|---|
| 1575 | Line(points = {{-24, 22}, {-24, 32}, {-6, 32}, {-6, 52}, {2, 52}}, color = {0, 0, 127}));
|
|---|
| 1576 | connect(iceTau.tau, limiter1.y) annotation(
|
|---|
| 1577 | Line(points = {{2, 52}, {-10, 52}, {-10, 52}, {-11, 52}}, color = {0, 0, 127}));
|
|---|
| 1578 | connect(limiter1.u, gain.y) annotation(
|
|---|
| 1579 | Line(points = {{-34, 52}, {-42, 52}, {-42, 52}, {-41, 52}}, color = {0, 0, 127}));
|
|---|
| 1580 | connect(toGramsPerkWh.u1, iceTau.tau) annotation(
|
|---|
| 1581 | Line(points = {{36, 10}, {36, 32}, {-6, 32}, {-6, 52}, {2, 52}}, color = {0, 0, 127}));
|
|---|
| 1582 | connect(iceTau.flange, inertia.flange_a) annotation(
|
|---|
| 1583 | Line(points = {{24, 52}, {30, 52}}));
|
|---|
| 1584 | connect(w.flange, inertia.flange_b) annotation(
|
|---|
| 1585 | Line(points = {{58, 46}, {58, 52}, {50, 52}}));
|
|---|
| 1586 | connect(Pice.flange_a, inertia.flange_b) annotation(
|
|---|
| 1587 | Line(points = {{66, 52}, {50, 52}}));
|
|---|
| 1588 | connect(toGramsPerkWh.u2, w.w) annotation(
|
|---|
| 1589 | Line(points = {{48, 10}, {48, 20}, {58, 20}, {58, 25}}, color = {0, 0, 127}));
|
|---|
| 1590 | connect(toPowW.u1, w.w) annotation(
|
|---|
| 1591 | Line(points = {{-12, 22}, {-12, 25}, {58, 25}}, color = {0, 0, 127}));
|
|---|
| 1592 | connect(gain.u, feedback.y) annotation(
|
|---|
| 1593 | Line(points = {{-64, 52}, {-71, 52}}, color = {0, 0, 127}));
|
|---|
| 1594 | connect(Pice.flange_b, flange_a) annotation(
|
|---|
| 1595 | Line(points = {{86, 52}, {94, 52}, {94, 0}, {100, 0}}, color = {0, 0, 0}, smooth = Smooth.None));
|
|---|
| 1596 | connect(feedback.u2, Pice.power) annotation(
|
|---|
| 1597 | Line(points = {{-80, 60}, {-80, 72}, {68, 72}, {68, 63}}, color = {0, 0, 127}, smooth = Smooth.None));
|
|---|
| 1598 | annotation(
|
|---|
| 1599 | Documentation(info = "<html>
|
|---|
| 1600 | <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>
|
|---|
| 1601 | <p><span style=\"font-family: MS Shell Dlg 2;\">This is a "connector" version of MBice.</span></p>
|
|---|
| 1602 | <p><span style=\"font-family: MS Shell Dlg 2;\">For a general descritiption see the info of MBice.</span></p>
|
|---|
| 1603 | <p><span style=\"font-family: MS Shell Dlg 2;\">Signals connected to the connector:</span></p>
|
|---|
| 1604 | <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>
|
|---|
| 1605 | <p><span style=\"font-family: MS Shell Dlg 2;\">- iceW (output) is the measured ICE speed (rad/s)</span></p>
|
|---|
| 1606 | <p><span style=\"font-family: MS Shell Dlg 2;\">- icePowDel (output) delivered power (W)</span></p>
|
|---|
| 1607 | </html>"),
|
|---|
| 1608 | 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}})}),
|
|---|
| 1609 | 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
|
|---|
| 1610 | reference \nand computes consumption")}));
|
|---|
| 1611 | end PartialIceP;
|
|---|
| 1612 |
|
|---|
| 1613 | partial model PartialOneFlange "Partial map-based one-Flange electric drive model"
|
|---|
| 1614 | parameter Modelica.SIunits.Power powMax = 22000 "Maximum drive power";
|
|---|
| 1615 | parameter Modelica.SIunits.Torque tauMax = 80 "Maximum drive torque";
|
|---|
| 1616 | parameter Modelica.SIunits.Voltage uDcNom = 100 "nominal DC voltage";
|
|---|
| 1617 | parameter Modelica.SIunits.AngularVelocity wMax(min = powMax / tauMax) = 3000 "Maximum drive speed";
|
|---|
| 1618 | parameter Modelica.SIunits.MomentOfInertia J = 0.25 "Rotor's moment of inertia";
|
|---|
| 1619 | parameter Boolean mapsOnFile = false "= true, if tables are taken from a txt file";
|
|---|
| 1620 | parameter String mapsFileName = "noName" "File where matrix is stored" annotation(
|
|---|
| 1621 | Dialog(enable = mapsOnFile, loadSelector(filter = "Text files (*.txt)", caption = "Open file in which required tables are")));
|
|---|
| 1622 | parameter String effTableName = "noName" "Name of the on-file maximum torque as a function of speed" annotation(
|
|---|
| 1623 | Dialog(enable = mapsOnFile));
|
|---|
| 1624 | parameter Real effTable[:, :] = [0,0,1; 0,1,1; 1,1,1] annotation(
|
|---|
| 1625 | Dialog(enable = not mapsOnFile));
|
|---|
| 1626 | Modelica.Mechanics.Rotational.Interfaces.Flange_a flange_a "Left flange of shaft" annotation(
|
|---|
| 1627 | Placement(transformation(extent = {{88, 50}, {108, 70}}, rotation = 0), iconTransformation(extent = {{90, -10}, {110, 10}})));
|
|---|
| 1628 | Modelica.Mechanics.Rotational.Sensors.SpeedSensor wSensor annotation(
|
|---|
| 1629 | Placement(transformation(extent = {{8, -8}, {-8, 8}}, rotation = 90, origin = {78, 44})));
|
|---|
| 1630 | SupportModels.MapBasedRelated.LimTau limTau(tauMax = tauMax, wMax = wMax, powMax = powMax) annotation(
|
|---|
| 1631 | Placement(transformation(extent = {{40, 18}, {20, 42}})));
|
|---|
| 1632 | SupportModels.MapBasedRelated.EfficiencyT toElePow(mapsOnFile = mapsOnFile, tauMax = tauMax, powMax = powMax, wMax = wMax, mapsFileName = mapsFileName, effTableName = effTableName, effTable = effTable) annotation(
|
|---|
| 1633 | Placement(transformation(extent = {{-6, -28}, {-26, -8}})));
|
|---|
| 1634 | Modelica.Electrical.Analog.Interfaces.PositivePin pin_p annotation(
|
|---|
| 1635 | Placement(transformation(extent = {{-110, 30}, {-90, 50}}), iconTransformation(extent = {{-110, 30}, {-90, 50}})));
|
|---|
| 1636 | Modelica.Electrical.Analog.Interfaces.NegativePin pin_n annotation(
|
|---|
| 1637 | Placement(transformation(extent = {{-110, -50}, {-90, -30}}), iconTransformation(extent = {{-110, -50}, {-90, -30}})));
|
|---|
| 1638 | SupportModels.MapBasedRelated.ConstPg constPDC(vNom = uDcNom) annotation(
|
|---|
| 1639 | Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 0, origin = {-100, 0})));
|
|---|
| 1640 | Modelica.Mechanics.Rotational.Components.Inertia inertia(J = J) annotation(
|
|---|
| 1641 | Placement(transformation(extent = {{22, 50}, {42, 70}})));
|
|---|
| 1642 | Modelica.Mechanics.Rotational.Sources.Torque torque annotation(
|
|---|
| 1643 | Placement(transformation(extent = {{-16, 50}, {4, 70}})));
|
|---|
| 1644 | Modelica.Blocks.Math.Gain gain(k = 1) annotation(
|
|---|
| 1645 | Placement(transformation(extent = {{-64, -10}, {-84, 10}})));
|
|---|
| 1646 | Modelica.Mechanics.Rotational.Sensors.PowerSensor powSensor annotation(
|
|---|
| 1647 | Placement(transformation(extent = {{50, 50}, {70, 70}})));
|
|---|
| 1648 | Modelica.Blocks.Nonlinear.VariableLimiter variableLimiter annotation(
|
|---|
| 1649 | Placement(transformation(extent = {{-4, 20}, {-24, 40}})));
|
|---|
| 1650 | equation
|
|---|
| 1651 | assert(wMax >= powMax / tauMax, "\n****\n" + "PARAMETER VERIFICATION ERROR:\nwMax must be not lower than powMax/tauMax" + "\n***\n");
|
|---|
| 1652 | connect(toElePow.w, wSensor.w) annotation(
|
|---|
| 1653 | Line(points = {{-4, -22}, {78, -22}, {78, 35.2}}, color = {0, 0, 127}, smooth = Smooth.None));
|
|---|
| 1654 | connect(pin_p, constPDC.pin_p) annotation(
|
|---|
| 1655 | Line(points = {{-100, 40}, {-100, 10}}, color = {0, 0, 255}, smooth = Smooth.None));
|
|---|
| 1656 | connect(pin_n, constPDC.pin_n) annotation(
|
|---|
| 1657 | Line(points = {{-100, -40}, {-100, -9.8}}, color = {0, 0, 255}, smooth = Smooth.None));
|
|---|
| 1658 | connect(constPDC.Pref, gain.y) annotation(
|
|---|
| 1659 | Line(points = {{-91.8, 0}, {-85, 0}}, color = {0, 0, 127}, smooth = Smooth.None));
|
|---|
| 1660 | connect(powSensor.flange_b, flange_a) annotation(
|
|---|
| 1661 | Line(points = {{70, 60}, {98, 60}}, color = {0, 0, 0}, smooth = Smooth.None));
|
|---|
| 1662 | connect(wSensor.flange, flange_a) annotation(
|
|---|
| 1663 | Line(points = {{78, 52}, {78, 60}, {98, 60}}, color = {0, 0, 0}, smooth = Smooth.None));
|
|---|
| 1664 | connect(toElePow.elePow, gain.u) annotation(
|
|---|
| 1665 | Line(points = {{-26.6, -18}, {-46, -18}, {-46, 0}, {-62, 0}}, color = {0, 0, 127}, smooth = Smooth.None));
|
|---|
| 1666 | connect(inertia.flange_a, torque.flange) annotation(
|
|---|
| 1667 | Line(points = {{22, 60}, {4, 60}}, color = {0, 0, 0}, smooth = Smooth.None));
|
|---|
| 1668 | connect(inertia.flange_b, powSensor.flange_a) annotation(
|
|---|
| 1669 | Line(points = {{42, 60}, {50, 60}}, color = {0, 0, 0}, smooth = Smooth.None));
|
|---|
| 1670 | connect(variableLimiter.limit1, limTau.yH) annotation(
|
|---|
| 1671 | Line(points = {{-2, 38}, {19, 38}, {19, 37.2}}, color = {0, 0, 127}));
|
|---|
| 1672 | connect(variableLimiter.limit2, limTau.yL) annotation(
|
|---|
| 1673 | Line(points = {{-2, 22}, {10, 22}, {10, 22.8}, {19, 22.8}}, color = {0, 0, 127}));
|
|---|
| 1674 | connect(variableLimiter.y, torque.tau) annotation(
|
|---|
| 1675 | Line(points = {{-25, 30}, {-36, 30}, {-36, 60}, {-18, 60}}, color = {0, 0, 127}));
|
|---|
| 1676 | connect(toElePow.tau, torque.tau) annotation(
|
|---|
| 1677 | Line(points = {{-4, -14}, {2, -14}, {2, 12}, {-36, 12}, {-36, 60}, {-18, 60}}, color = {0, 0, 127}));
|
|---|
| 1678 | connect(limTau.w, wSensor.w) annotation(
|
|---|
| 1679 | Line(points = {{42, 30}, {78, 30}, {78, 35.2}}, color = {0, 0, 127}));
|
|---|
| 1680 | annotation(
|
|---|
| 1681 | Diagram(coordinateSystem(extent = {{-100, -80}, {100, 80}}, preserveAspectRatio = false, initialScale = 0.1, grid = {2, 2})),
|
|---|
| 1682 | Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = false, initialScale = 0.1, grid = {2, 2}), graphics = {Rectangle(extent = {{-70, 80}, {100, -80}}, lineColor = {0, 0, 0}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Line(points = {{62, -7}, {82, -7}}), Rectangle(fillColor = {192, 192, 192}, fillPattern = FillPattern.HorizontalCylinder, extent = {{52, 10}, {100, -10}}), Line(points = {{-98, 40}, {-70, 40}}, color = {0, 0, 255}), Line(points = {{-92, -40}, {-70, -40}}, color = {0, 0, 255}), Text(origin = {0, 20}, lineColor = {0, 0, 255}, extent = {{-70, 98}, {100, 60}}, textString = "%name", fillPattern = FillPattern.Solid, fillColor = {255, 255, 255}), Rectangle(fillColor = {192, 192, 192}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-56, 48}, {76, -48}}), Rectangle(fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, extent = {{-48, 14}, {66, -14}}), Text(origin = {6.1429, 47.1}, extent = {{-54.1429, -35.1}, {61.8571, -61.1}}, textString = "J=%J")}),
|
|---|
| 1683 | Documentation(info = "<html>
|
|---|
| 1684 | <p>One-flange electric drive.</p>
|
|---|
| 1685 | <p>The input signal is the requested normalised torque (1 means nominal torque)</p>
|
|---|
| 1686 | </html>"));
|
|---|
| 1687 | end PartialOneFlange;
|
|---|
| 1688 |
|
|---|
| 1689 |
|
|---|
| 1690 | partial model PartialMBice "Simple map-based Internal Combustion Engine model"
|
|---|
| 1691 | import Modelica.Constants.*;
|
|---|
| 1692 | parameter Modelica.SIunits.AngularVelocity wIceStart = 167;
|
|---|
| 1693 | parameter Modelica.SIunits.MomentOfInertia iceJ = 0.5 "ICE moment of inertia";
|
|---|
| 1694 | parameter Boolean mapsOnFile = false "= true, if tables are taken from a txt file";
|
|---|
| 1695 | parameter String mapsFileName = "NoName" "File where matrix is stored" annotation(
|
|---|
| 1696 | Dialog(enable = mapsOnFile, loadSelector(filter = "Text files (*.txt)", caption = "Open file in which required tables are")));
|
|---|
| 1697 | parameter String maxTauName = "noName" "name of the on-file maximum torque as a function of speed" annotation(
|
|---|
| 1698 | Dialog(enable = mapsOnFile));
|
|---|
| 1699 | parameter String specConsName = "noName" "name of the on-file specific consumption variable" annotation(
|
|---|
| 1700 | Dialog(enable = mapsOnFile));
|
|---|
| 1701 | parameter Real maxIceTau[:, :] = [0, 80; 100, 80; 350, 95; 500, 95] "First column speed, second column maximum ice torque" annotation(
|
|---|
| 1702 | Dialog(enable = not mapsOnFile));
|
|---|
| 1703 | parameter Real specificConsTab[:, :](unit = "g/(kW.h)") = [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] "ICE specific consumption map. First column torque, first row speed" annotation(
|
|---|
| 1704 | Dialog(enable = not mapsOnFile));
|
|---|
| 1705 | Modelica.Mechanics.Rotational.Sensors.SpeedSensor w annotation(
|
|---|
| 1706 | Placement(visible = true, transformation(origin = {52, 44}, extent = {{-10, -10}, {10, 10}}, rotation = 270)));
|
|---|
| 1707 | Modelica.Mechanics.Rotational.Interfaces.Flange_a flange_a annotation(
|
|---|
| 1708 | Placement(visible = true, transformation(extent = {{90, 10}, {110, 30}}, rotation = 0), iconTransformation(extent = {{90, 10}, {110, 30}}, rotation = 0)));
|
|---|
| 1709 | Modelica.Mechanics.Rotational.Sensors.PowerSensor icePow annotation(
|
|---|
| 1710 | Placement(visible = true, transformation(extent = {{66, 50}, {86, 70}}, rotation = 0)));
|
|---|
| 1711 | Modelica.Mechanics.Rotational.Sources.Torque Tice annotation(
|
|---|
| 1712 | Placement(visible = true, transformation(extent = {{-12, 50}, {8, 70}}, rotation = 0)));
|
|---|
| 1713 | Modelica.Mechanics.Rotational.Components.Inertia ICE(w(fixed = true, start = wIceStart, displayUnit = "rpm"), J = iceJ) annotation(
|
|---|
| 1714 | Placement(visible = true, transformation(extent = {{16, 50}, {36, 70}}, rotation = 0)));
|
|---|
| 1715 | Modelica.Blocks.Math.Product toPow0 annotation(
|
|---|
| 1716 | Placement(visible = true, transformation(origin = {0, 12}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
|
|---|
| 1717 | Modelica.Blocks.Math.Product toG_perHour annotation(
|
|---|
| 1718 | Placement(visible = true, transformation(origin = {30, -50}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
|
|---|
| 1719 | // Modelica.Blocks.Continuous.Integrator toGrams(k = 1 / 3600000.0)
|
|---|
| 1720 | // annotation(Placement(visible = true, transformation(origin = {26, -44},
|
|---|
| 1721 | //extent = {{-10, -10}, {10, 10}}, rotation = 270)));
|
|---|
| 1722 | Modelica.Blocks.Tables.CombiTable1D toLimTau(tableOnFile = mapsOnFile, table = maxIceTau, tableName = maxTauName, fileName = mapsFileName) annotation(
|
|---|
| 1723 | Placement(visible = true, transformation(origin = {-72, 66}, extent = {{10, -10}, {-10, 10}}, rotation = 180)));
|
|---|
| 1724 | Modelica.Blocks.Sources.RealExpression rotorW(y = w.w) annotation(
|
|---|
| 1725 | Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 90, origin = {-88, 36})));
|
|---|
| 1726 | Modelica.Blocks.Math.Gain tokW(k = 1e-3) annotation(
|
|---|
| 1727 | Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = -90, origin = {0, -18})));
|
|---|
| 1728 | Modelica.Blocks.Tables.CombiTable2D toSpecCons(tableOnFile = mapsOnFile, table = specificConsTab, tableName = specConsName, fileName = mapsFileName) annotation(
|
|---|
| 1729 | Placement(transformation(extent = {{-10, 10}, {10, -10}}, rotation = -90, origin = {40, 0})));
|
|---|
| 1730 | equation
|
|---|
| 1731 | connect(toPow0.u1, w.w) annotation(
|
|---|
| 1732 | Line(points = {{6, 24}, {6, 33}, {52, 33}}, color = {0, 0, 127}));
|
|---|
| 1733 | connect(w.flange, ICE.flange_b) annotation(
|
|---|
| 1734 | Line(points = {{52, 54}, {52, 60}, {36, 60}}));
|
|---|
| 1735 | connect(icePow.flange_a, ICE.flange_b) annotation(
|
|---|
| 1736 | Line(points = {{66, 60}, {36, 60}}));
|
|---|
| 1737 | connect(Tice.flange, ICE.flange_a) annotation(
|
|---|
| 1738 | Line(points = {{8, 60}, {16, 60}}));
|
|---|
| 1739 | connect(icePow.flange_b, flange_a) annotation(
|
|---|
| 1740 | Line(points = {{86, 60}, {94, 60}, {94, 20}, {100, 20}}));
|
|---|
| 1741 | connect(toLimTau.u[1], rotorW.y) annotation(
|
|---|
| 1742 | Line(points = {{-84, 66}, {-88, 66}, {-88, 47}}, color = {0, 0, 127}, smooth = Smooth.None));
|
|---|
| 1743 | connect(toPow0.y, tokW.u) annotation(
|
|---|
| 1744 | Line(points = {{-2.22045e-015, 1}, {-2.22045e-015, -2}, {2.22045e-015, -2}, {2.22045e-015, -6}}, color = {0, 0, 127}, smooth = Smooth.None));
|
|---|
| 1745 | connect(toSpecCons.y, toG_perHour.u1) annotation(
|
|---|
| 1746 | Line(points = {{40, -11}, {40, -24}, {36, -24}, {36, -38}}, color = {0, 0, 127}));
|
|---|
| 1747 | connect(toG_perHour.u2, tokW.y) annotation(
|
|---|
| 1748 | Line(points = {{24, -38}, {24, -32}, {0, -32}, {0, -29}}, color = {0, 0, 127}));
|
|---|
| 1749 | connect(toSpecCons.u2, w.w) annotation(
|
|---|
| 1750 | Line(points = {{46, 12}, {46, 28}, {52, 28}, {52, 33}}, color = {0, 0, 127}));
|
|---|
| 1751 | annotation(
|
|---|
| 1752 | Diagram(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -80}, {100, 80}})),
|
|---|
| 1753 | experiment(StopTime = 200, __Dymola_NumberOfIntervals = 1000, __Dymola_Algorithm = "Lsodar"),
|
|---|
| 1754 | __Dymola_experimentSetupOutput,
|
|---|
| 1755 | Documentation(info = "<html>
|
|---|
| 1756 | <h4>Basic map-based ICE model.</h4>
|
|---|
| 1757 | <p>It receives as input the reference torque as a fracton of the maximum deliverable torque at a given speed. It can be approximately thought as a signal proportional to the accelerator position oF the vehicle.</p>
|
|---|
| 1758 | <p>The generated torque is the minimum between this signal and the maximum deliverable torque at the actual engine speed (defined by means of a table).</p>
|
|---|
| 1759 | <p>From the generated torque and speed the fuel consumption is computed.</p>
|
|---|
| 1760 | <p>The used maxTorque (toLimTau) and specific fuel consumption (toSpecCons) maps are inspired to public data related to the Toyota Prius' engine </p>
|
|---|
| 1761 | </html>"),
|
|---|
| 1762 | Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = false, initialScale = 0.1, grid = {2, 2}), graphics = {Rectangle(extent = {{-100, 80}, {100, -80}}, lineColor = {0, 0, 0}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Rectangle(fillColor = {192, 192, 192}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-24, 68}, {76, -24}}), Rectangle(fillColor = {192, 192, 192}, fillPattern = FillPattern.HorizontalCylinder, extent = {{76, 30}, {100, 10}}), Text(origin = {0, 30}, lineColor = {0, 0, 255}, extent = {{-140, 100}, {140, 60}}, textString = "%name"), Rectangle(extent = {{-90, 68}, {-32, -26}}), Rectangle(fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid, extent = {{-90, 22}, {-32, 0}}), Line(points = {{-60, 56}, {-60, 32}}), Polygon(points = {{-60, 66}, {-66, 56}, {-54, 56}, {-60, 66}}), Polygon(points = {{-60, 24}, {-66, 34}, {-54, 34}, {-60, 24}}), Rectangle(fillColor = {135, 135, 135}, fillPattern = FillPattern.Solid, extent = {{-64, 0}, {-54, -20}})}));
|
|---|
| 1763 | end PartialMBice;
|
|---|
| 1764 |
|
|---|
| 1765 | partial model PartialMBiceP "Simple map-based ice model with connector and Power request"
|
|---|
| 1766 | import Modelica.Constants.*;
|
|---|
| 1767 | parameter Real contrGain(unit = "N.m/W") = 0.1 "Proportional controller gain ";
|
|---|
| 1768 | parameter Modelica.SIunits.AngularVelocity wIceStart = 167;
|
|---|
| 1769 | parameter Modelica.SIunits.MomentOfInertia iceJ = 0.5 "ICE moment of Inertia";
|
|---|
| 1770 | parameter Boolean mapsOnFile = false "= true, if tables are taken from a txt file";
|
|---|
| 1771 | parameter String mapsFileName = "NoName" "File where matrix is stored" annotation(
|
|---|
| 1772 | Dialog(enable = mapsOnFile, loadSelector(filter = "Text files (*.txt)", caption = "Open file in which required tables are")));
|
|---|
| 1773 | parameter String specConsName = "noName" "name of the on-file specific consumption variable" annotation(
|
|---|
| 1774 | Dialog(enable = mapsOnFile));
|
|---|
| 1775 | parameter Real specificCons[:, :](each unit = "g/(kW.h)") = [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] "ICE specific consumption map. First column torque, first row speed" annotation(
|
|---|
| 1776 | Dialog(enable = not mapsOnFile));
|
|---|
| 1777 | Modelica.Mechanics.Rotational.Components.Inertia ICE(w(fixed = true, start = wIceStart, displayUnit = "rpm"), J = iceJ) annotation(
|
|---|
| 1778 | Placement(transformation(extent = {{20, 42}, {40, 62}})));
|
|---|
| 1779 | Modelica.Mechanics.Rotational.Sources.Torque iceTau annotation(
|
|---|
| 1780 | Placement(transformation(extent = {{-12, 42}, {8, 62}})));
|
|---|
| 1781 | Modelica.Mechanics.Rotational.Sensors.PowerSensor Pice annotation(
|
|---|
| 1782 | Placement(transformation(extent = {{66, 62}, {86, 42}})));
|
|---|
| 1783 | Modelica.Mechanics.Rotational.Sensors.SpeedSensor w annotation(
|
|---|
| 1784 | Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 270, origin = {52, 36})));
|
|---|
| 1785 | Modelica.Blocks.Math.Product toPow0 annotation(
|
|---|
| 1786 | Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = -90, origin = {2, 6})));
|
|---|
| 1787 | Modelica.Blocks.Math.Product toG_perHour annotation(
|
|---|
| 1788 | Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = -90, origin = {24, -50})));
|
|---|
| 1789 | Modelica.Blocks.Math.Feedback feedback annotation(
|
|---|
| 1790 | Placement(transformation(extent = {{-90, 62}, {-70, 42}})));
|
|---|
| 1791 | Modelica.Blocks.Math.Gain gain(k = contrGain) annotation(
|
|---|
| 1792 | Placement(transformation(extent = {{-58, 42}, {-38, 62}})));
|
|---|
| 1793 | Modelica.Mechanics.Rotational.Interfaces.Flange_a flange_a annotation(
|
|---|
| 1794 | Placement(transformation(extent = {{90, -10}, {110, 10}}), iconTransformation(extent = {{90, -10}, {110, 10}})));
|
|---|
| 1795 | Modelica.Blocks.Tables.CombiTable2D toSpecCons(table = specificCons, tableOnFile = mapsOnFile, tableName = specConsName, fileName = mapsFileName) annotation(
|
|---|
| 1796 | Placement(transformation(extent = {{-10, 10}, {10, -10}}, rotation = -90, origin = {42, -2})));
|
|---|
| 1797 | Modelica.Blocks.Math.Gain tokW(k = 1e-3) annotation(
|
|---|
| 1798 | Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = -90, origin = {2, -24})));
|
|---|
| 1799 | equation
|
|---|
| 1800 | connect(iceTau.flange, ICE.flange_a) annotation(
|
|---|
| 1801 | Line(points = {{8, 52}, {20, 52}}, color = {0, 0, 0}, smooth = Smooth.None));
|
|---|
| 1802 | connect(Pice.flange_a, ICE.flange_b) annotation(
|
|---|
| 1803 | Line(points = {{66, 52}, {40, 52}}, color = {0, 0, 0}, smooth = Smooth.None));
|
|---|
| 1804 | connect(Pice.flange_b, flange_a) annotation(
|
|---|
| 1805 | Line(points = {{86, 52}, {94, 52}, {94, 0}, {100, 0}}, color = {0, 0, 0}, smooth = Smooth.None));
|
|---|
| 1806 | connect(w.flange, ICE.flange_b) annotation(
|
|---|
| 1807 | Line(points = {{52, 46}, {52, 52}, {40, 52}}, color = {0, 0, 0}, smooth = Smooth.None));
|
|---|
| 1808 | connect(toPow0.u1, w.w) annotation(
|
|---|
| 1809 | Line(points = {{8, 18}, {8, 25}, {52, 25}}, color = {0, 0, 127}, smooth = Smooth.None));
|
|---|
| 1810 | connect(toPow0.u2, iceTau.tau) annotation(
|
|---|
| 1811 | Line(points = {{-4, 18}, {-4, 22}, {-28, 22}, {-28, 52}, {-14, 52}}, color = {0, 0, 127}, smooth = Smooth.None));
|
|---|
| 1812 | connect(feedback.u2, Pice.power) annotation(
|
|---|
| 1813 | Line(points = {{-80, 60}, {-80, 72}, {68, 72}, {68, 63}}, color = {0, 0, 127}, smooth = Smooth.None));
|
|---|
| 1814 | connect(gain.y, iceTau.tau) annotation(
|
|---|
| 1815 | Line(points = {{-37, 52}, {-14, 52}}, color = {0, 0, 127}, smooth = Smooth.None));
|
|---|
| 1816 | connect(gain.u, feedback.y) annotation(
|
|---|
| 1817 | Line(points = {{-60, 52}, {-71, 52}}, color = {0, 0, 127}, smooth = Smooth.None));
|
|---|
| 1818 | connect(toSpecCons.y, toG_perHour.u1) annotation(
|
|---|
| 1819 | Line(points = {{42, -13}, {42, -20}, {30, -20}, {30, -38}}, color = {0, 0, 127}));
|
|---|
| 1820 | connect(toSpecCons.u2, w.w) annotation(
|
|---|
| 1821 | Line(points = {{48, 10}, {48, 10}, {48, 16}, {48, 20}, {50, 20}, {52, 20}, {52, 25}}, color = {0, 0, 127}));
|
|---|
| 1822 | connect(toSpecCons.u1, iceTau.tau) annotation(
|
|---|
| 1823 | Line(points = {{36, 10}, {36, 32}, {-28, 32}, {-28, 52}, {-14, 52}}, color = {0, 0, 127}));
|
|---|
| 1824 | connect(tokW.u, toPow0.y) annotation(
|
|---|
| 1825 | Line(points = {{2, -12}, {2, -5}}, color = {0, 0, 127}));
|
|---|
| 1826 | connect(tokW.y, toG_perHour.u2) annotation(
|
|---|
| 1827 | Line(points = {{2, -35}, {10, -35}, {10, -34}, {18, -34}, {18, -38}}, color = {0, 0, 127}));
|
|---|
| 1828 | annotation(
|
|---|
| 1829 | Diagram(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -80}, {100, 80}}, initialScale = 0.1), graphics = {Text(extent = {{-78, 6}, {-38, -16}}, lineColor = {0, 0, 0}, textString = "follows the power
|
|---|
| 1830 | reference and
|
|---|
| 1831 | computes consumption")}),
|
|---|
| 1832 | experiment(StopTime = 200, __Dymola_NumberOfIntervals = 1000, __Dymola_Algorithm = "Lsodar"),
|
|---|
| 1833 | __Dymola_experimentSetupOutput,
|
|---|
| 1834 | Documentation(info = "<html>
|
|---|
| 1835 | <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>
|
|---|
| 1836 | <p><span style=\"font-family: MS Shell Dlg 2;\">This is a "connector" version of MBice.</span></p>
|
|---|
| 1837 | <p><span style=\"font-family: MS Shell Dlg 2;\">For a general descritiption see the info of MBice.</span></p>
|
|---|
| 1838 | <p><span style=\"font-family: MS Shell Dlg 2;\">Signals connected to the connector:</span></p>
|
|---|
| 1839 | <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>
|
|---|
| 1840 | <p><span style=\"font-family: MS Shell Dlg 2;\">- iceW (output) is the measured ICE speed (rad/s)</span></p>
|
|---|
| 1841 | <p><span style=\"font-family: MS Shell Dlg 2;\">- icePowDel (output) delivered power (W)</span></p>
|
|---|
| 1842 | </html>"),
|
|---|
| 1843 | Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = false, initialScale = 0.1, grid = {2, 2}), 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, -90}}, 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}})}));
|
|---|
| 1844 | end PartialMBiceP;
|
|---|
| 1845 |
|
|---|
| 1846 | model IceConnP "Simple map-based ice model with connector; follows power request"
|
|---|
| 1847 | extends Partial.PartialMBiceP;
|
|---|
| 1848 | import Modelica.Constants.*;
|
|---|
| 1849 | parameter Modelica.SIunits.AngularVelocity wIceStart = 167;
|
|---|
| 1850 | SupportModels.ConnectorRelated.Conn conn annotation(
|
|---|
| 1851 | Placement(visible = true, transformation(extent = {{-20, -82}, {20, -122}}, rotation = 0), iconTransformation(extent = {{-20, -82}, {20, -122}}, rotation = 0)));
|
|---|
| 1852 | equation
|
|---|
| 1853 | connect(feedback.u1, conn.icePowRef) annotation(
|
|---|
| 1854 | Line(points = {{-88, 52}, {-88, 52}, {-88, -102}, {0, -102}}, color = {0, 0, 127}),
|
|---|
| 1855 | Text(string = "%second", index = 1, extent = {{6, 3}, {6, 3}}));
|
|---|
| 1856 | connect(Pice.power, conn.icePowDel) annotation(
|
|---|
| 1857 | Line(points = {{68, 63}, {68, 63}, {68, 6}, {78, 6}, {78, -102}, {0, -102}}, color = {0, 0, 127}),
|
|---|
| 1858 | Text(string = "%second", index = 1, extent = {{6, 3}, {6, 3}}));
|
|---|
| 1859 | connect(w.w, conn.iceW) annotation(
|
|---|
| 1860 | Line(points = {{52, 25}, {58, 25}, {58, 6}, {58, -102}, {0, -102}}, color = {0, 0, 127}),
|
|---|
| 1861 | Text(string = "%second", index = 1, extent = {{6, 3}, {6, 3}}));
|
|---|
| 1862 | connect(toG_perHour.y, conn.iceGramsPerHour) annotation(
|
|---|
| 1863 | Line(points = {{24, -61}, {22, -61}, {22, -84}, {0, -84}, {0, -102}, {0, -102}}, color = {0, 0, 127}),
|
|---|
| 1864 | Text(string = "%second", index = 1, extent = {{6, 3}, {6, 3}}));
|
|---|
| 1865 | annotation(
|
|---|
| 1866 | Diagram(coordinateSystem(preserveAspectRatio = false, initialScale = 0.1)),
|
|---|
| 1867 | experiment(StopTime = 200, __Dymola_NumberOfIntervals = 1000, __Dymola_Algorithm = "Lsodar"),
|
|---|
| 1868 | __Dymola_experimentSetupOutput,
|
|---|
| 1869 | Documentation(info = "<html>
|
|---|
| 1870 | <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>
|
|---|
| 1871 | <p><span style=\"font-family: MS Shell Dlg 2;\">This is a "connector" version of MBiceP.</span></p>
|
|---|
| 1872 | <p><span style=\"font-family: MS Shell Dlg 2;\">For a general descritiption see the info of MBiceP.</span></p>
|
|---|
| 1873 | <p><span style=\"font-family: MS Shell Dlg 2;\">Signals connected to the connector:</span></p>
|
|---|
| 1874 | <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>
|
|---|
| 1875 | <p><span style=\"font-family: MS Shell Dlg 2;\">- iceW (output) is the measured ICE speed (rad/s)</span></p>
|
|---|
| 1876 | <p><span style=\"font-family: MS Shell Dlg 2;\">- icePowDel (output) delivered power (W)</span></p>
|
|---|
| 1877 | </html>"),
|
|---|
| 1878 | Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = false, initialScale = 0.1, grid = {2, 2})));
|
|---|
| 1879 | end IceConnP;
|
|---|
| 1880 | end Partial;
|
|---|
| 1881 |
|
|---|
| 1882 | model GensetImGm "GenSet GMS+GEN+SEngine"
|
|---|
| 1883 | import Modelica.Constants.inf;
|
|---|
| 1884 | import Modelica.Constants.pi;
|
|---|
| 1885 | parameter Modelica.SIunits.Time OptiTime "Time parameter of the PI OptiSpeed controller";
|
|---|
| 1886 | parameter String mapsFileName = "maps.txt" "Name of the file containing data maps (names: maxIceTau, specificCons, optiSpeed)";
|
|---|
| 1887 | parameter Modelica.SIunits.AngularVelocity wIceStart = 167;
|
|---|
| 1888 | parameter Modelica.SIunits.AngularVelocity wGenMax;
|
|---|
| 1889 | parameter Modelica.SIunits.Torque maxTau = 200 "Max mechanical torque";
|
|---|
| 1890 | parameter Modelica.SIunits.Power maxPow = 20e3 "Max mechanical power";
|
|---|
| 1891 | Modelica.Mechanics.Rotational.Sensors.SpeedSensor speedSensor annotation(
|
|---|
| 1892 | Placement(transformation(extent = {{-8, -8}, {8, 8}}, rotation = 180, origin = {-24, -20})));
|
|---|
| 1893 | Modelica.Mechanics.Rotational.Sensors.PowerSensor IcePow annotation(
|
|---|
| 1894 | Placement(transformation(extent = {{24, -2}, {42, 16}})));
|
|---|
| 1895 | Modelica.Blocks.Interfaces.RealInput powRef(unit = "W") "Reference genset power" annotation(
|
|---|
| 1896 | Placement(transformation(extent = {{15, -15}, {-15, 15}}, rotation = 90, origin = {61, 115})));
|
|---|
| 1897 | Modelica.Electrical.Analog.Interfaces.PositivePin pin_p annotation(
|
|---|
| 1898 | Placement(transformation(extent = {{90, 50}, {110, 70}})));
|
|---|
| 1899 | Modelica.Electrical.Analog.Interfaces.NegativePin pin_n annotation(
|
|---|
| 1900 | Placement(transformation(extent = {{92, -70}, {112, -50}})));
|
|---|
| 1901 | Modelica.Blocks.Nonlinear.Limiter limiter(uMax = inf, uMin = 0) annotation(
|
|---|
| 1902 | Placement(transformation(extent = {{10, -10}, {-10, 10}}, rotation = 90, origin = {-80, 54})));
|
|---|
| 1903 | SHEV.PowerTrain.Gensets.GMS0 myGMS(mapsFileName = mapsFileName) annotation(
|
|---|
| 1904 | Placement(transformation(extent = {{-70, 10}, {-50, 30}})));
|
|---|
| 1905 | EHPowerTrain.MapBased.MBOneFlange gen(wMax = wGenMax, mapsFileName = mapsFileName, mapsOnFile = true, powMax = maxPow, tauMax = maxTau, effTableName = "gensetDriveEffTable") annotation(
|
|---|
| 1906 | Placement(transformation(extent = {{68, 16}, {48, -4}})));
|
|---|
| 1907 | EHPowerTrain.MapBased.MBiceT01 mBiceT(mapsFileName = mapsFileName, wIceStart = wIceStart, mapsOnFile = true, maxTauName = "maxIceTau", specConsName = "specificCons") annotation(
|
|---|
| 1908 | Placement(transformation(extent = {{-34, -2}, {-14, 18}})));
|
|---|
| 1909 | Modelica.Blocks.Math.Gain gain(k = -1) annotation(
|
|---|
| 1910 | Placement(transformation(extent = {{-14, 30}, {6, 50}})));
|
|---|
| 1911 | Modelica.Blocks.Math.Gain gain1(k = 1) annotation(
|
|---|
| 1912 | Placement(visible = true, transformation(origin = {-60, -8}, extent = {{-6, -6}, {6, 6}}, rotation = 90)));
|
|---|
| 1913 | Modelica.Blocks.Continuous.Integrator toGrams(k = 1 / 3600) annotation(
|
|---|
| 1914 | Placement(transformation(extent = {{18, -42}, {38, -22}})));
|
|---|
| 1915 | equation
|
|---|
| 1916 | connect(gain1.u, speedSensor.w) annotation(
|
|---|
| 1917 | Line(points = {{-60, -15.2}, {-60, -20}, {-32.8, -20}}, color = {0, 0, 127}));
|
|---|
| 1918 | connect(myGMS.Wmecc, gain1.y) annotation(
|
|---|
| 1919 | Line(points = {{-59.9, 8.5}, {-60, 8.5}, {-60, -1.4}}, color = {0, 0, 127}));
|
|---|
| 1920 | connect(limiter.u, powRef) annotation(
|
|---|
| 1921 | Line(points = {{-80, 66}, {-80, 80}, {61, 80}, {61, 115}}, color = {0, 0, 127}, smooth = Smooth.None));
|
|---|
| 1922 | connect(limiter.y, myGMS.pRef) annotation(
|
|---|
| 1923 | Line(points = {{-80, 43}, {-80, 20}, {-72, 20}}, color = {0, 0, 127}, smooth = Smooth.None));
|
|---|
| 1924 | connect(IcePow.flange_b, gen.flange_a) annotation(
|
|---|
| 1925 | Line(points = {{42, 7}, {46, 7}, {46, 6}, {48, 6}}, color = {0, 0, 0}));
|
|---|
| 1926 | connect(gen.pin_n, pin_p) annotation(
|
|---|
| 1927 | Line(points = {{68, 10}, {80, 10}, {80, 60}, {100, 60}}, color = {0, 0, 255}));
|
|---|
| 1928 | connect(gen.pin_p, pin_n) annotation(
|
|---|
| 1929 | Line(points = {{68, 2}, {78, 2}, {78, -60}, {102, -60}}, color = {0, 0, 255}));
|
|---|
| 1930 | connect(mBiceT.nTauRef, myGMS.throttle) annotation(
|
|---|
| 1931 | Line(points = {{-30, -2}, {-30, -6}, {-49, -6}, {-49, 14}}, color = {0, 0, 127}));
|
|---|
| 1932 | connect(IcePow.flange_a, mBiceT.flange_a) annotation(
|
|---|
| 1933 | Line(points = {{24, 7}, {6, 7}, {6, 10}, {-14, 10}}, color = {0, 0, 0}));
|
|---|
| 1934 | connect(speedSensor.flange, mBiceT.flange_a) annotation(
|
|---|
| 1935 | Line(points = {{-16, -20}, {-6, -20}, {-6, 10}, {-14, 10}}, color = {0, 0, 0}));
|
|---|
| 1936 | connect(gain.u, myGMS.tRef) annotation(
|
|---|
| 1937 | Line(points = {{-16, 40}, {-40, 40}, {-40, 26}, {-49, 26}}, color = {0, 0, 127}));
|
|---|
| 1938 | connect(gain.y, gen.tauRef) annotation(
|
|---|
| 1939 | Line(points = {{7, 40}, {49, 40}, {49, 14.6}}, color = {0, 0, 127}));
|
|---|
| 1940 | connect(toGrams.u, mBiceT.fuelCons) annotation(
|
|---|
| 1941 | Line(points = {{16, -32}, {12, -32}, {8, -32}, {8, -6}, {-18, -6}, {-18, -1}}, color = {0, 0, 127}));
|
|---|
| 1942 | annotation(
|
|---|
| 1943 | Diagram(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -60}, {100, 100}})),
|
|---|
| 1944 | experiment(StopTime = 20, Interval = 0.01),
|
|---|
| 1945 | experimentSetupOutput,
|
|---|
| 1946 | Icon(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Text(extent = {{-98, 94}, {78, 68}}, lineColor = {0, 0, 255}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, textString = "%name"), Rectangle(fillColor = {192, 192, 192}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-20, 0}, {26, -14}}), Rectangle(fillColor = {192, 192, 192}, fillPattern = FillPattern.HorizontalCylinder, extent = {{-44, 30}, {-14, -44}}), Line(points = {{-72, 30}, {-72, 6}}), Polygon(points = {{-72, -2}, {-78, 8}, {-66, 8}, {-72, -2}}), Rectangle(extent = {{-96, 38}, {-50, -48}}), Rectangle(fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid, extent = {{-96, -6}, {-50, -24}}), Rectangle(fillColor = {135, 135, 135}, fillPattern = FillPattern.Solid, extent = {{-78, -24}, {-68, -44}}), Polygon(points = {{-72, 34}, {-78, 24}, {-66, 24}, {-72, 34}}), Rectangle(fillColor = {192, 192, 192}, fillPattern = FillPattern.HorizontalCylinder, extent = {{6, 30}, {62, -44}}), Line(points = {{94, 60}, {74, 60}, {74, 18}, {62, 18}}, color = {0, 0, 255}), Line(points = {{100, -60}, {74, -60}, {74, -28}, {62, -28}}, color = {0, 0, 255})}),
|
|---|
| 1947 | Documentation(info = "<html>
|
|---|
| 1948 | <p>Convertitore primario con ICE e generatore</p>
|
|---|
| 1949 |
|
|---|
| 1950 | </html>"));
|
|---|
| 1951 | end GensetImGm;
|
|---|
| 1952 | annotation(
|
|---|
| 1953 | Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Line(points = {{-80, -84}, {-80, 68}}, color = {0, 0, 0}, smooth = Smooth.None), Line(points = {{-88, -80}, {78, -80}}, color = {0, 0, 0}, smooth = Smooth.None), Polygon(points = {{94, -80}, {78, -74}, {78, -86}, {94, -80}}, lineColor = {0, 0, 0}, smooth = Smooth.None), Polygon(points = {{8, 0}, {-8, 6}, {-8, -6}, {8, 0}}, lineColor = {0, 0, 0}, smooth = Smooth.None, origin = {-80, 76}, rotation = 90), Line(points = {{-84, 40}, {-14, 40}}, color = {0, 0, 0}, smooth = Smooth.None), Line(points = {{-14, 40}, {-4, 2}, {22, -32}, {62, -44}, {62, -80}}, color = {0, 0, 0}, smooth = Smooth.None)}));
|
|---|
| 1954 | end MapBased;
|
|---|
| 1955 |
|
|---|
| 1956 | package Icons
|
|---|
| 1957 | model EcuIcon
|
|---|
| 1958 | SupportModels.ConnectorRelated.Conn conn1 annotation(
|
|---|
| 1959 | Placement(visible = true, transformation(extent = {{-20, 78}, {20, 118}}, rotation = 0), iconTransformation(extent = {{-20, 80}, {20, 120}}, rotation = 0)));
|
|---|
| 1960 | Modelica.Blocks.Interfaces.RealInput motTauInt annotation(
|
|---|
| 1961 | Placement(visible = true, transformation(extent = {{-140, -20}, {-100, 20}}, rotation = 0), iconTransformation(extent = {{-140, -20}, {-100, 20}}, rotation = 0)));
|
|---|
| 1962 | annotation(
|
|---|
| 1963 | Icon(graphics = {Rectangle(extent = {{-100, 100}, {100, -100}}, lineColor = {0, 0, 0}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Polygon(points = {{-4, -40}, {74, 16}, {74, -6}, {-4, -62}, {-4, -40}}, lineColor = {95, 95, 95}, fillColor = {175, 175, 175}, fillPattern = FillPattern.Solid), Polygon(points = {{8, -38}, {28, -48}, {20, -54}, {0, -44}, {8, -38}}, lineColor = {0, 0, 255}, fillColor = {255, 255, 0}, fillPattern = FillPattern.Solid), Polygon(points = {{20, -54}, {28, -48}, {32, -56}, {24, -62}, {20, -54}}, lineColor = {0, 0, 255}, fillColor = {255, 255, 0}, fillPattern = FillPattern.Solid), Polygon(points = {{24, -62}, {32, -56}, {32, -78}, {24, -84}, {24, -62}}, lineColor = {0, 0, 255}, fillColor = {255, 255, 127}, fillPattern = FillPattern.Solid), Polygon(points = {{0, -44}, {20, -54}, {24, -62}, {24, -84}, {22, -84}, {22, -62}, {20, -58}, {0, -48}, {0, -44}}, lineColor = {0, 0, 255}, fillColor = {191, 191, 0}, fillPattern = FillPattern.Solid), Polygon(points = {{-14, 40}, {-18, 32}, {-10, 38}, {-8, 44}, {-14, 40}}, lineColor = {128, 128, 128}, fillColor = {128, 128, 128}, fillPattern = FillPattern.Solid), Polygon(points = {{-18, 32}, {-10, 38}, {-10, 14}, {-18, 8}, {-18, 32}}, lineColor = {0, 0, 255}, fillColor = {255, 255, 127}, fillPattern = FillPattern.Solid), Polygon(points = {{-20, 10}, {-20, 32}, {-16, 40}, {4, 30}, {4, 26}, {-16, 36}, {-18, 32}, {-18, 8}, {-20, 10}}, lineColor = {0, 0, 255}, fillColor = {191, 191, 0}, fillPattern = FillPattern.Solid), Polygon(points = {{-8, 46}, {12, 36}, {4, 30}, {-16, 40}, {-8, 46}}, lineColor = {0, 0, 255}, fillColor = {255, 255, 0}, fillPattern = FillPattern.Solid), Polygon(points = {{28, -22}, {48, -32}, {40, -38}, {20, -28}, {28, -22}}, lineColor = {0, 0, 255}, fillColor = {255, 255, 0}, fillPattern = FillPattern.Solid), Polygon(points = {{40, -38}, {48, -32}, {52, -40}, {44, -46}, {40, -38}}, lineColor = {0, 0, 255}, fillColor = {255, 255, 0}, fillPattern = FillPattern.Solid), Polygon(points = {{44, -46}, {52, -40}, {52, -62}, {44, -68}, {44, -46}}, lineColor = {0, 0, 255}, fillColor = {255, 255, 127}, fillPattern = FillPattern.Solid), Polygon(points = {{20, -28}, {40, -38}, {44, -46}, {44, -68}, {42, -68}, {42, -46}, {40, -42}, {20, -32}, {20, -28}}, lineColor = {0, 0, 255}, fillColor = {191, 191, 0}, fillPattern = FillPattern.Solid), Polygon(points = {{48, -8}, {68, -18}, {60, -24}, {40, -14}, {48, -8}}, lineColor = {0, 0, 255}, fillColor = {255, 255, 0}, fillPattern = FillPattern.Solid), Polygon(points = {{60, -24}, {68, -18}, {72, -26}, {64, -32}, {60, -24}}, lineColor = {0, 0, 255}, fillColor = {255, 255, 0}, fillPattern = FillPattern.Solid), Polygon(points = {{64, -32}, {72, -26}, {72, -48}, {64, -54}, {64, -32}}, lineColor = {0, 0, 255}, fillColor = {255, 255, 127}, fillPattern = FillPattern.Solid), Polygon(points = {{40, -14}, {60, -24}, {64, -32}, {64, -54}, {62, -54}, {62, -32}, {60, -28}, {40, -18}, {40, -14}}, lineColor = {0, 0, 255}, fillColor = {191, 191, 0}, fillPattern = FillPattern.Solid), Polygon(points = {{68, 6}, {88, -4}, {80, -10}, {60, 0}, {68, 6}}, lineColor = {0, 0, 255}, fillColor = {255, 255, 0}, fillPattern = FillPattern.Solid), Polygon(points = {{80, -10}, {88, -4}, {92, -12}, {84, -18}, {80, -10}}, lineColor = {0, 0, 255}, fillColor = {255, 255, 0}, fillPattern = FillPattern.Solid), Polygon(points = {{84, -18}, {92, -12}, {92, -34}, {84, -40}, {84, -18}}, lineColor = {0, 0, 255}, fillColor = {255, 255, 127}, fillPattern = FillPattern.Solid), Polygon(points = {{60, 0}, {80, -10}, {84, -18}, {84, -40}, {82, -40}, {82, -18}, {80, -14}, {60, -4}, {60, 0}}, lineColor = {0, 0, 255}, fillColor = {191, 191, 0}, fillPattern = FillPattern.Solid), Polygon(points = {{-34, 26}, {-38, 18}, {-30, 24}, {-28, 30}, {-34, 26}}, lineColor = {128, 128, 128}, fillColor = {128, 128, 128}, fillPattern = FillPattern.Solid), Polygon(points = {{-38, 18}, {-30, 24}, {-30, 0}, {-38, -6}, {-38, 18}}, lineColor = {0, 0, 255}, fillColor = {255, 255, 127}, fillPattern = FillPattern.Solid), Polygon(points = {{-40, -4}, {-40, 18}, {-36, 26}, {-16, 16}, {-16, 12}, {-36, 22}, {-38, 18}, {-38, -6}, {-40, -4}}, lineColor = {0, 0, 255}, fillColor = {191, 191, 0}, fillPattern = FillPattern.Solid), Polygon(points = {{-28, 32}, {-8, 22}, {-16, 16}, {-36, 26}, {-28, 32}}, lineColor = {0, 0, 255}, fillColor = {255, 255, 0}, fillPattern = FillPattern.Solid), Polygon(points = {{-54, 12}, {-58, 4}, {-50, 10}, {-48, 16}, {-54, 12}}, lineColor = {128, 128, 128}, fillColor = {128, 128, 128}, fillPattern = FillPattern.Solid), Polygon(points = {{-58, 4}, {-50, 10}, {-50, -14}, {-58, -20}, {-58, 4}}, lineColor = {0, 0, 255}, fillColor = {255, 255, 127}, fillPattern = FillPattern.Solid), Polygon(points = {{-60, -18}, {-60, 4}, {-56, 12}, {-36, 2}, {-36, -2}, {-56, 8}, {-58, 4}, {-58, -20}, {-60, -18}}, lineColor = {0, 0, 255}, fillColor = {191, 191, 0}, fillPattern = FillPattern.Solid), Polygon(points = {{-48, 18}, {-28, 8}, {-36, 2}, {-56, 12}, {-48, 18}}, lineColor = {0, 0, 255}, fillColor = {255, 255, 0}, fillPattern = FillPattern.Solid), Polygon(points = {{-74, -4}, {-78, -12}, {-70, -6}, {-68, 0}, {-74, -4}}, lineColor = {128, 128, 128}, fillColor = {128, 128, 128}, fillPattern = FillPattern.Solid), Polygon(points = {{-78, -12}, {-70, -6}, {-70, -30}, {-78, -36}, {-78, -12}}, lineColor = {0, 0, 255}, fillColor = {255, 255, 127}, fillPattern = FillPattern.Solid), Polygon(points = {{-80, -34}, {-80, -12}, {-76, -4}, {-56, -14}, {-56, -18}, {-76, -8}, {-78, -12}, {-78, -36}, {-80, -34}}, lineColor = {0, 0, 255}, fillColor = {191, 191, 0}, fillPattern = FillPattern.Solid), Polygon(points = {{-68, 2}, {-48, -8}, {-56, -14}, {-76, -4}, {-68, 2}}, lineColor = {0, 0, 255}, fillColor = {255, 255, 0}, fillPattern = FillPattern.Solid), Polygon(points = {{-64, -8}, {-4, -40}, {-4, -62}, {-64, -30}, {-64, -8}}, lineColor = {95, 95, 95}, fillColor = {75, 75, 75}, fillPattern = FillPattern.Solid), Polygon(points = {{-64, -8}, {-4, -40}, {74, 16}, {14, 48}, {-64, -8}}, lineColor = {95, 95, 95}, fillColor = {160, 160, 164}, fillPattern = FillPattern.Solid), Text(origin = {-1, -42}, lineColor = {0, 0, 255}, extent = {{-119, -64}, {119, -104}}, textString = "%name"), Rectangle(extent = {{-98, 92}, {98, 62}}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, pattern = LinePattern.None)}),
|
|---|
| 1964 | Diagram(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics));
|
|---|
| 1965 | end EcuIcon;
|
|---|
| 1966 |
|
|---|
| 1967 | model SupportIcon
|
|---|
| 1968 | annotation(
|
|---|
| 1969 | Icon(graphics = {Ellipse(extent = {{-38, 38}, {38, -38}}, lineColor = {0, 0, 0}), Line(points = {{2, 80}, {-8, 80}, {-12, 70}, {-26, 66}, {-36, 76}, {-48, 68}, {-44, 56}, {-56, 44}, {-68, 48}, {-76, 34}, {-68, 28}, {-70, 14}, {-80, 10}, {-80, 0}}, color = {0, 0, 0}, smooth = Smooth.None), Line(points = {{2, -80}, {-8, -80}, {-12, -70}, {-26, -66}, {-36, -76}, {-48, -68}, {-44, -56}, {-56, -44}, {-68, -48}, {-76, -34}, {-68, -28}, {-70, -14}, {-80, -10}, {-80, 0}}, color = {0, 0, 0}, smooth = Smooth.None), Line(points = {{0, -80}, {10, -80}, {14, -70}, {28, -66}, {38, -76}, {50, -68}, {46, -56}, {58, -44}, {70, -48}, {78, -34}, {70, -28}, {72, -14}, {82, -10}, {82, 0}}, color = {0, 0, 0}, smooth = Smooth.None), Line(points = {{0, 80}, {10, 80}, {14, 70}, {28, 66}, {38, 76}, {50, 68}, {46, 56}, {58, 44}, {70, 48}, {78, 34}, {70, 28}, {72, 14}, {82, 10}, {82, 0}}, color = {0, 0, 0}, smooth = Smooth.None)}));
|
|---|
| 1970 | end SupportIcon;
|
|---|
| 1971 | end Icons;
|
|---|
| 1972 | annotation(
|
|---|
| 1973 | uses(Modelica(version = "3.2.2"), Complex(version = "3.2.2")),
|
|---|
| 1974 | Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100, -100}, {100, 100}}), graphics = {Polygon(points = {{-60, 16}, {78, 16}, {94, 0}, {96, -16}, {-98, -16}, {-90, 0}, {-76, 12}, {-60, 16}}, lineColor = {0, 0, 0}, smooth = Smooth.None, fillColor = {0, 0, 255}, fillPattern = FillPattern.Solid), Ellipse(extent = {{-70, -4}, {-30, -40}}, lineColor = {95, 95, 95}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Ellipse(extent = {{34, -6}, {74, -42}}, lineColor = {95, 95, 95}, fillColor = {95, 95, 95}, fillPattern = FillPattern.Solid), Polygon(points = {{-54, 16}, {-18, 46}, {46, 46}, {74, 16}, {-54, 16}}, lineColor = {0, 0, 0}, smooth = Smooth.None, fillColor = {0, 0, 255}, fillPattern = FillPattern.Solid), Ellipse(extent = {{-86, -6}, {-92, 4}}, lineColor = {0, 0, 0}, fillColor = {255, 255, 0}, fillPattern = FillPattern.Solid), Ellipse(extent = {{98, -10}, {92, -4}}, lineColor = {0, 0, 0}, fillColor = {255, 0, 0}, fillPattern = FillPattern.Solid), Polygon(points = {{-46, 20}, {-20, 42}, {16, 42}, {14, 20}, {-46, 20}}, lineColor = {0, 0, 0}, smooth = Smooth.None, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Polygon(points = {{22, 42}, {42, 42}, {60, 20}, {20, 20}, {22, 42}}, lineColor = {0, 0, 0}, smooth = Smooth.None, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid), Ellipse(extent = {{-60, -12}, {-40, -30}}, lineColor = {95, 95, 95}, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid), Ellipse(extent = {{44, -14}, {64, -32}}, lineColor = {95, 95, 95}, fillColor = {215, 215, 215}, fillPattern = FillPattern.Solid)}),
|
|---|
| 1975 | Documentation(info = "<html>
|
|---|
| 1976 | <p>Library containing models of components, subsystems and full vehicle examples for simulation of electric and Hybrid vehicular power trains.</p>
|
|---|
| 1977 | <p>A general description of the library composition and on how to use it effectively is in the compaion paper:</p>
|
|---|
| 1978 | <p>M. Ceraolo "Modelica Electric and hybrid power trains library" submitted for publication at the 11th International Modelica Conference, 2015, September 21-23, Palais des congrès de Versailles, 23-23 September, France</p>
|
|---|
| 1979 | </html>"));
|
|---|
| 1980 | end wbEHPTlib;
|
|---|