Skip to content

Commit 8b35496

Browse files
boerrebjdietmarw
authored andcommitted
Added f_grid - grid frequency to Data, corrected reference speed for normalization of speed (to p.u.) in Power2Torque and TorqueEquation. Added test case for TorqueEquation in OpenHPLTest
1 parent 6da4f31 commit 8b35496

4 files changed

Lines changed: 39 additions & 6 deletions

File tree

OpenHPL/Data.mo

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ record Data "Provides a data set of most common used settings"
1919
annotation (Dialog(group = "Waterway properties"));
2020
parameter SI.Compressibility beta_total = 1 / (rho*1000^2) "Total compressibility"
2121
annotation (Dialog(group = "Waterway properties"));
22+
parameter SI.Frequency f_grid=50 "Grid frequency" annotation (Dialog(group = "System properties"));
2223
parameter Boolean SteadyState=false "If checked, simulation starts in steady state"
2324
annotation (choices(checkBox = true), Dialog(group="Initialization"));
2425
parameter SI.VolumeFlowRate Vdot_0 = 0 "Initial volume flow rate through the system"

OpenHPL/ElectroMech/BaseClasses/Power2Torque.mo

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ partial model Power2Torque "Converts a power signal to a torque in the rotationa
6767
extent={{-6,-6},{6,6}},
6868
rotation=180,
6969
origin={-50,-40})));
70-
Modelica.Blocks.Math.Gain w_m2pu(k=(p/2)/(2*C.pi*data.f_0))
70+
Modelica.Blocks.Math.Gain w_m2pu(k=(p/2)/(2*C.pi*data.f_grid))
7171
annotation (Placement(transformation(extent={{66,-46},{78,-34}})));
7272
Modelica.Blocks.Nonlinear.Limiter torqueLimit(uMax=Pmax/f_0)
7373
annotation (Placement(transformation(
@@ -101,7 +101,7 @@ partial model Power2Torque "Converts a power signal to a torque in the rotationa
101101
Modelica.Blocks.Interfaces.RealInput f_in if enable_f_in and not enable_nomSpeed
102102
"Speed input of the unit [pu]"
103103
annotation (Placement(transformation(extent={{-20,-20},{20,20}},rotation=90,origin={-80,-120})));
104-
Modelica.Blocks.Math.Gain pu2w_s(k=2*C.pi*data.f_0) if enable_f_in or enable_nomSpeed
104+
Modelica.Blocks.Math.Gain pu2w_s(k=2*C.pi*data.f_grid) if enable_f_in or enable_nomSpeed
105105
annotation (Placement(transformation(extent={{40,-90},{60,-70}})));
106106

107107
equation

OpenHPL/ElectroMech/BaseClasses/TorqueEquation.mo

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ partial model TorqueEquation
4444
Placement(transformation(extent = {{0, 60}, {20, 40}})));
4545
Modelica.Mechanics.Rotational.Components.Fixed fixed annotation(
4646
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(
47+
Modelica.Blocks.Math.Gain w_m2pu(k = (p/2)/(data.f_grid*2*Modelica.Constants.pi)) "Convert from rad/s to pu" annotation(
4848
Placement(transformation(extent = {{66, -46}, {78, -34}})));
4949
Modelica.Blocks.Interfaces.RealOutput f if enable_f "Speed output of the unit [pu]" annotation(
5050
Placement(transformation(extent = {{100, -50}, {120, -30}}), iconTransformation(extent = {{100, -50}, {120, -30}})));
@@ -64,12 +64,12 @@ partial model TorqueEquation
6464
Placement(transformation(extent = {{-10, -80}, {10, -60}})));
6565
Modelica.Blocks.Interfaces.RealInput f_in if enable_f_in and not enable_nomSpeed "Speed input of the unit [pu]" annotation(
6666
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(
67+
Modelica.Blocks.Math.Gain pu2w_s(k = 2*Modelica.Constants.pi*data.f_grid) if enable_f_in or enable_nomSpeed annotation(
6868
Placement(transformation(extent = {{40, -90}, {60, -70}})));
6969
protected
7070
Modelica.Mechanics.Rotational.Sources.Torque torque_transfer annotation(
7171
Placement(transformation(extent = {{-36, -6}, {-24, 6}})));
72-
72+
7373
equation
7474
connect(w, speedSensor.w) annotation(
7575
Line(points = {{110, 40}, {40, 40}, {40, -42}, {10, -42}, {10, -39}}, color = {0, 0, 127}, pattern = LinePattern.Dash));
@@ -105,6 +105,6 @@ equation
105105
Line(points = {{-80, 30}, {-94, 30}, {-94, 0}, {-38, 0}}, color = {0, 0, 127}));
106106
annotation(
107107
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>"));
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>"));
109109

110110
end TorqueEquation;

OpenHPLTest/TorqueEquation.mo

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,36 @@ within OpenHPLTest;
22

33
package TorqueEquation
44
extends Modelica.Icons.ExamplesPackage;
5+
import SI = Modelica.Units.SI;
6+
//
7+
8+
model TorqueElement
9+
extends OpenHPL.Icons.ElectroMech;
10+
extends OpenHPL.ElectroMech.BaseClasses.TorqueEquation;
11+
equation
12+
13+
end TorqueElement;
14+
15+
model TorqueTest
16+
extends Modelica.Icons.Example;
17+
//
18+
parameter SI.Torque shaftTorque0 = 1.e+03;
19+
SI.Torque shaftTorque;
20+
inner OpenHPL.Data data annotation(
21+
Placement(transformation(origin = {-52, 74}, extent = {{-10, -10}, {10, 10}})));
22+
TorqueElement te1(J = 10, f_0 = 0, torque(y = shaftTorque), enable_f = true, p = 10) annotation(
23+
Placement(transformation(origin = {-30, 52}, extent = {{-10, -10}, {10, 10}})));
24+
TorqueElement te2(J = 10, f_0 = 0, torque(y = shaftTorque), enable_f = true, p = 22) annotation(
25+
Placement(transformation(origin = {-30, 24}, extent = {{-10, -10}, {10, 10}})));
26+
equation
27+
if (time > 0.1 and time < 0.4) then
28+
shaftTorque = shaftTorque0;
29+
elseif (time > 0.5 and time < 0.8) then
30+
shaftTorque = -shaftTorque0;
31+
else
32+
shaftTorque = 0.0;
33+
end if;
34+
annotation(
35+
Diagram(coordinateSystem(extent = {{-80, 80}, {-20, 0}})));
36+
end TorqueTest;
537
end TorqueEquation;

0 commit comments

Comments
 (0)