|
| 1 | +within OpenHPL.ElectroMech.BaseClasses; |
| 2 | + |
| 3 | +partial model TorqueEquation |
| 4 | + outer OpenHPL.Data data "Using standard class with global parameters"; |
| 5 | + // |
| 6 | + parameter Boolean useH = false "If checked, calculate the inertia from a given H value" annotation( |
| 7 | + Dialog(group = "Mechanical"), |
| 8 | + choices(checkBox = true)); |
| 9 | + parameter SI.Power Pmax = 100e6 "Maximum rated power (for torque limiting and H calculation)" annotation( |
| 10 | + Dialog(group = "Mechanical")); |
| 11 | + parameter SI.Time H = 2.75 "Inertia constant H, typical 2s (high-head hydro) to 6s (gas or low-head hydro) production units" annotation( |
| 12 | + Dialog(group = "Mechanical", enable = useH)); |
| 13 | + parameter SI.MomentOfInertia J = 2e5 "Moment of inertia of the unit (GD2/4)" annotation( |
| 14 | + Dialog(group = "Mechanical", enable = not useH)); |
| 15 | + parameter Integer p(min = 2) = 12 "Number of poles for mechanical speed calculation (Not pole pairs!)" annotation( |
| 16 | + Dialog(group = "Mechanical"), |
| 17 | + choices(choice = 2 "2,[3000|3600] rpm", choice = 4 "4,[1500|1800] rpm", choice = 6 "6,[1000|1200] rpm", choice = 8 "8,[750|900] rpm", choice = 10 "10,[600|720] rpm", choice = 12 "12,[500|600] rpm", choice = 14 "14,[429|514] rpm", choice = 16 "16,[375|450] rpm", choice = 18 "18,[333|400] rpm", choice = 20 "20,[300|360] rpm", choice = 22 "22,[273|327] rpm", choice = 24 "24,[250|300] rpm", choice = 26 "26,[231|277] rpm", choice = 28 "28,[214|257] rpm", choice = 30 "30,[200|240] rpm", choice = 28 "32,[187.5|225] rpm")); |
| 18 | + parameter SI.Power Ploss = 0 "Friction losses of the unit at nominal speed" annotation( |
| 19 | + Dialog(group = "Mechanical")); |
| 20 | + parameter SI.PerUnit f_0 = 1 "Initial speed of the unit" annotation( |
| 21 | + Dialog(group = "Initialization")); |
| 22 | + parameter Boolean enable_nomSpeed = false "If checked, unit runs at fixed speed f_0" annotation( |
| 23 | + choices(checkBox = true), |
| 24 | + Dialog(group = "Initialization", enable = not fixed_iniSpeed and not enable_f_in)); |
| 25 | + parameter Boolean fixed_iniSpeed = false "If checked, unit initialises with fixed speed. |
| 26 | + When connecting several units mechanically only one can be fixed." annotation( |
| 27 | + choices(checkBox = true), |
| 28 | + Dialog(group = "Initialization", enable = not enable_nomSpeed and not enable_f_in)); |
| 29 | + parameter Boolean enable_f_in = false "If checked, get a connector for speed input" annotation( |
| 30 | + choices(checkBox = true), |
| 31 | + Dialog(group = "Inputs", tab = "I/O", enable = not fixed_iniSpeed and not enable_nomSpeed)); |
| 32 | + parameter Boolean enable_w = false "If checked, get a connector for angular velocity output" annotation( |
| 33 | + choices(checkBox = true), |
| 34 | + Dialog(group = "Outputs", tab = "I/O")); |
| 35 | + parameter Boolean enable_f = false "If checked, get a connector for speed output" annotation( |
| 36 | + choices(checkBox = true), |
| 37 | + Dialog(group = "Outputs", tab = "I/O")); |
| 38 | + |
| 39 | + Modelica.Mechanics.Rotational.Sensors.SpeedSensor speedSensor annotation( |
| 40 | + Placement(transformation(origin = {10, -28}, extent = {{10, -10}, {-10, 10}}, rotation = 90))); |
| 41 | + Modelica.Mechanics.Rotational.Components.Inertia inertia(J = if useH then 2*H*Pmax/f_0^2 else J, w(start = f_0*2*Modelica.Constants.pi*data.f_0/(p/2), fixed = not enable_nomSpeed and not enable_f_in and fixed_iniSpeed)) annotation( |
| 42 | + Placement(transformation(extent = {{-20, -10}, {0, 10}}))); |
| 43 | + Modelica.Electrical.Machines.Losses.Friction friction(frictionParameters(PRef = Ploss, wRef = data.f_0*4*C.pi/p)) annotation( |
| 44 | + Placement(transformation(extent = {{0, 60}, {20, 40}}))); |
| 45 | + Modelica.Mechanics.Rotational.Components.Fixed fixed annotation( |
| 46 | + Placement(transformation(extent = {{20, 50}, {40, 70}}))); |
| 47 | + Modelica.Blocks.Math.Gain w_m2pu(k = (p/2)/(2*Modelica.Constants.pi*data.f_0)) annotation( |
| 48 | + Placement(transformation(extent = {{66, -46}, {78, -34}}))); |
| 49 | + Modelica.Blocks.Interfaces.RealOutput f if enable_f "Speed output of the unit [pu]" annotation( |
| 50 | + Placement(transformation(extent = {{100, -50}, {120, -30}}), iconTransformation(extent = {{100, -50}, {120, -30}}))); |
| 51 | + Modelica.Blocks.Interfaces.RealOutput w(unit = "rad/s") if enable_w "Mechanical angular velocity output of the unit [rad/s]" annotation( |
| 52 | + Placement(transformation(extent = {{100, 30}, {120, 50}}), iconTransformation(extent = {{100, 30}, {120, 50}}))); |
| 53 | + Modelica.Mechanics.Rotational.Interfaces.Flange_b flange "Flange of right shaft" annotation( |
| 54 | + Placement(transformation(extent = {{40, -10}, {60, 10}}), iconTransformation(extent = {{-10, -10}, {10, 10}}))); |
| 55 | + Modelica.Blocks.Sources.RealExpression torque annotation( |
| 56 | + Placement(transformation(extent = {{-60, 20}, {-80, 40}}))); |
| 57 | + Modelica.Mechanics.Rotational.Sensors.PowerSensor frictionLoss annotation( |
| 58 | + Placement(transformation(extent = {{10, -10}, {-10, 10}}, rotation = 270, origin = {10, 20}))); |
| 59 | + Modelica.Mechanics.Rotational.Sources.Speed setSpeed if enable_nomSpeed or enable_f_in annotation( |
| 60 | + Placement(transformation(extent = {{76, -6}, {64, 6}}))); |
| 61 | + Modelica.Mechanics.Rotational.Components.IdealGear toSysSpeed(ratio = 2/p) "Converts to system speed based on p = 2" annotation( |
| 62 | + Placement(transformation(extent = {{24, -6}, {36, 6}}))); |
| 63 | + Modelica.Blocks.Sources.RealExpression nominalSpeed(y = f_0) if enable_nomSpeed annotation( |
| 64 | + Placement(transformation(extent = {{-10, -80}, {10, -60}}))); |
| 65 | + Modelica.Blocks.Interfaces.RealInput f_in if enable_f_in and not enable_nomSpeed "Speed input of the unit [pu]" annotation( |
| 66 | + Placement(transformation(extent = {{-20, -20}, {20, 20}}, rotation = 90, origin = {-80, -120}))); |
| 67 | + Modelica.Blocks.Math.Gain pu2w_s(k = 2*Modelica.Constants.pi*data.f_0) if enable_f_in or enable_nomSpeed annotation( |
| 68 | + Placement(transformation(extent = {{40, -90}, {60, -70}}))); |
| 69 | + protected |
| 70 | + Modelica.Mechanics.Rotational.Sources.Torque torque_transfer annotation( |
| 71 | + Placement(transformation(extent = {{-36, -6}, {-24, 6}}))); |
| 72 | + |
| 73 | +equation |
| 74 | + connect(w, speedSensor.w) annotation( |
| 75 | + Line(points = {{110, 40}, {40, 40}, {40, -42}, {10, -42}, {10, -39}}, color = {0, 0, 127}, pattern = LinePattern.Dash)); |
| 76 | + connect(w_m2pu.u, speedSensor.w) annotation( |
| 77 | + Line(points = {{64.8, -40}, {64.8, -42}, {10, -42}, {10, -39}}, color = {0, 0, 127})); |
| 78 | + connect(f, w_m2pu.y) annotation( |
| 79 | + Line(points = {{110, -40}, {78.6, -40}}, color = {0, 0, 127}, pattern = LinePattern.Dash)); |
| 80 | + connect(inertia.flange_b, speedSensor.flange) annotation( |
| 81 | + Line(points = {{0, 0}, {0, -2}, {10, -2}, {10, -18}})); |
| 82 | + connect(friction.support, fixed.flange) annotation( |
| 83 | + Line(points = {{10, 60}, {10, 70}, {30, 70}, {30, 60}}, color = {0, 0, 0})); |
| 84 | + connect(torque_transfer.flange, inertia.flange_a) annotation( |
| 85 | + Line(points = {{-24, 0}, {-20, 0}}, color = {0, 0, 0})); |
| 86 | + connect(w, w) annotation( |
| 87 | + Line(points = {{110, 40}, {105, 40}, {105, 40}, {110, 40}}, color = {0, 0, 127})); |
| 88 | + connect(frictionLoss.flange_a, inertia.flange_b) annotation( |
| 89 | + Line(points = {{10, 10}, {10, 0}, {0, 0}}, color = {0, 0, 0})); |
| 90 | + connect(frictionLoss.flange_b, friction.flange) annotation( |
| 91 | + Line(points = {{10, 30}, {10, 40}}, color = {0, 0, 0})); |
| 92 | + connect(setSpeed.flange, flange) annotation( |
| 93 | + Line(points = {{64, 0}, {50, 0}}, color = {0, 0, 0}, pattern = LinePattern.Dash)); |
| 94 | + connect(flange, toSysSpeed.flange_b) annotation( |
| 95 | + Line(points = {{50, 0}, {36, 0}}, color = {0, 0, 0})); |
| 96 | + connect(toSysSpeed.flange_a, inertia.flange_b) annotation( |
| 97 | + Line(points = {{24, 0}, {0, 0}}, color = {0, 0, 0})); |
| 98 | + connect(setSpeed.w_ref, pu2w_s.y) annotation( |
| 99 | + Line(points = {{77.2, 0}, {88, 0}, {88, -80}, {61, -80}}, color = {0, 0, 127}, pattern = LinePattern.Dash)); |
| 100 | + connect(pu2w_s.u, f_in) annotation( |
| 101 | + Line(points = {{38, -80}, {28, -80}, {28, -90}, {-80, -90}, {-80, -120}}, color = {0, 0, 127}, pattern = LinePattern.Dash)); |
| 102 | + connect(nominalSpeed.y, pu2w_s.u) annotation( |
| 103 | + Line(points = {{11, -70}, {28, -70}, {28, -80}, {38, -80}}, color = {0, 0, 127}, pattern = LinePattern.Dash)); |
| 104 | + connect(torque.y, torque_transfer.tau) annotation( |
| 105 | + Line(points = {{-80, 30}, {-94, 30}, {-94, 0}, {-38, 0}}, color = {0, 0, 127})); |
| 106 | + annotation( |
| 107 | + Icon(graphics = {Text(visible = enable_w, extent = {{80, 50}, {100, 30}}, textColor = {0, 0, 0}, textString = "w"), Text(visible = enable_f, extent = {{80, -30}, {100, -50}}, textColor = {0, 0, 0}, textString = "f"), Text(visible = enable_f_in, extent = {{-100, -70}, {-60, -90}}, textColor = {0, 0, 0}, textString = "f_in")}), |
| 108 | +Documentation(info = "<html><head></head><body><p>Abstract (partial) base class for including the torque equation:<br> $$ J\frac{d\omega}{dt}=T $$ <br>In the future this base class can replace <font face=\"Courier\">Power2Torque</font> in the turbine models to avoid the issue at zero speed. This class is also better suited for fundamental or mechanistic turbine models.</p></body></html>")); |
| 109 | + |
| 110 | +end TorqueEquation; |
0 commit comments