Skip to content

Commit

Permalink
Ref #9: Finished renaming the ports
Browse files Browse the repository at this point in the history
None of the experimental test models in `Tests` will work since they were not updated. Not much point in wasting time to do that now. Rather look at those models and fix them when needed.
  • Loading branch information
dietmarw committed Nov 20, 2019
1 parent b08e3fa commit bc6919f
Show file tree
Hide file tree
Showing 21 changed files with 225 additions and 257 deletions.
8 changes: 4 additions & 4 deletions OpenHPL/ElectroMech/Turbines/Francis.mo
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,14 @@ equation
dp_v = 0.5 * Const.rho * (V_dot ^ 2 * (A_0 ^ 2 - A_v ^ 2 * sin_a1 ^ 2) / (A_0 ^ 2 * A_v ^ 2 * sin_a1 ^ 2) + k_fv) * Reduction;
else
V_dot = m_dot / (Const.rho * (1 + Const.beta * (p_r1 - Const.p_a)));
dp_v = 0.5 * Const.rho * (1 + Const.beta * (p.p - Const.p_a)) * (V_dot ^ 2 * (A_0 ^ 2 - A_v ^ 2 * sin_a1 ^ 2) / (A_0 ^ 2 * A_v ^ 2 * sin_a1 ^ 2) + k_fv) * Reduction;
dp_v = 0.5 * Const.rho * (1 + Const.beta * (i.p - Const.p_a)) * (V_dot ^ 2 * (A_0 ^ 2 - A_v ^ 2 * sin_a1 ^ 2) / (A_0 ^ 2 * A_v ^ 2 * sin_a1 ^ 2) + k_fv) * Reduction;
end if;
//// condition for guide vane pressure drop (does not work well, better to skip guide vane pressure drop)
if dp_v_condition == true then
p_r1 = p.p - dp_v;
p_r1 = i.p - dp_v;
dp_tr = dp_r + dp_v;
else
p_r1 = p.p;
p_r1 = i.p;
dp_tr = dp_r;
end if;
//// define areas
Expand Down Expand Up @@ -201,7 +201,7 @@ equation
//// turbine efficiency
coef = W_s_dot / W_t_dot;
//// conectors
p_tr2 = n.p;
p_tr2 = o.p;
//// output mechanical power
P_out = W_s_dot;
annotation (
Expand Down
6 changes: 3 additions & 3 deletions OpenHPL/ElectroMech/Turbines/Pelton.mo
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ equation
if CompElas == false then
V_dot = m_dot / Const.rho;
else
V_dot = m_dot / (Const.rho * (1 + Const.beta * (p.p - Const.p_a)));
V_dot = m_dot / (Const.rho * (1 + Const.beta * (i.p - Const.p_a)));
end if;
//// nuzzel pressure drop
dp_n = 0.5 * m_dot * (V_dot * (1 / A_1 ^ 2 - 1 / A_0 ^ 2) + k_f);
Expand All @@ -42,9 +42,9 @@ equation
dp_tr * V_dot = W_s_dot;
dp_tr = p_tr1 - p_tr2;
//// connectors pressures
p_tr1 = p.p;
p_tr1 = i.p;
// + dp_n;
p_tr2 = n.p;
p_tr2 = o.p;
//// output mechanical power
P_out = W_s_dot;
annotation (
Expand Down
20 changes: 10 additions & 10 deletions OpenHPL/ElectroMech/Turbines/Turbine.mo
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ model Turbine "Simple turbine model"
parameter Boolean WaterCompress = false "If checked the water is compressible in the penstock" annotation (
choices(checkBox = true));
//// variables
Modelica.SIunits.Pressure p_tr1 "Inlet pressure", dp "Turbine pressure drop", p_tr2 "Outlet pressure";
Modelica.SIunits.Pressure p_i_tr "Inlet pressure", dp "Turbine pressure drop", p_o_tr "Outlet pressure";
//Modelica.SIunits.Area A_d = D_o ^ 2 * pi / 4, A_p = D_i ^ 2 * pi / 4;
Modelica.SIunits.EnergyFlowRate K_tr1_dot "Kinetic energy";
Modelica.SIunits.EnergyFlowRate K_i_tr_dot "Kinetic energy";
Modelica.SIunits.VolumeFlowRate V_dot "Flow rate";
Real C_v_ "Guide vane 'valve capacity'";
output Modelica.SIunits.EnergyFlowRate W_s_dot "Shaft power";
Expand All @@ -40,28 +40,28 @@ model Turbine "Simple turbine model"
Modelica.Blocks.Tables.CombiTable1D look_up_table(table = lookup_table);
equation
//// checking water compressibility
V_dot = if WaterCompress then m_dot / (Const.rho * (1 + Const.beta * (p.p - Const.p_a))) else m_dot / Const.rho;
V_dot = if WaterCompress then m_dot / (Const.rho * (1 + Const.beta * (i.p - Const.p_a))) else m_dot / Const.rho;
//// define turbine efficiency
look_up_table.u[1] = u_t;
//// define guide vane 'valve capacity' base on the turbine nominal parameters
C_v_ = if ValveCapacity then C_v else V_dot_n/sqrt(H_n*Const.g*Const.rho/Const.p_a)/u_n;
//// turbine valve equation for pressure drop
dp = V_dot ^ 2 * Const.p_a / (C_v_ * u_t) ^ 2;
dp = p_tr1 - p_tr2;
dp = p_i_tr - p_o_tr;
//// turbine energy balance
K_tr1_dot = dp * V_dot;
K_i_tr_dot = dp * V_dot;
if ConstEfficiency == true then
W_s_dot = theta_h * K_tr1_dot;
W_s_dot = theta_h * K_i_tr_dot;
else
W_s_dot = look_up_table.y[1] * K_tr1_dot;
W_s_dot = look_up_table.y[1] * K_i_tr_dot;
end if;
//// turbine pressures
p_tr1 = p.p;
p_tr2 = n.p;
p_i_tr = i.p;
p_o_tr = o.p;
//// output mechanical power
P_out = W_s_dot;
//// for temperature variation, not finished...
//n.T = p.T;
//i.T = o.T;
////
annotation (
Documentation(info= "<html><p>
Expand Down
12 changes: 6 additions & 6 deletions OpenHPL/Examples/HPDetailed.mo
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@ model HPDetailed "Model of waterway of the HP system with detailed model for the
equation
connect(control.y, turbine.u_t) annotation (
Line(points={{11,84},{18,84},{18,54}}, color = {0, 0, 127}));
connect(discharge.n, tail.n) annotation (
connect(discharge.o, tail.o) annotation (
Line(points={{58,40},{70,40},{70,46},{80,46}}, color = {28, 108, 200}));
connect(turbine.n, discharge.p) annotation (
connect(turbine.o, discharge.i) annotation (
Line(points={{28,42},{34,42},{34,40},{38,40}}, color = {28, 108, 200}));
connect(turbine.p, penstockKP.n) annotation (
connect(turbine.i, penstockKP.o) annotation (
Line(points={{8,42},{4,42},{4,54},{0,54}}, color = {28, 108, 200}));
connect(surgeTank.n, penstockKP.p) annotation (
connect(surgeTank.o, penstockKP.i) annotation (
Line(points={{-22,70},{-20,70},{-20,54}}, color = {28, 108, 200}));
connect(intake.n, surgeTank.p) annotation (
connect(intake.o, surgeTank.i) annotation (
Line(points={{-52,64},{-46,64},{-46,70},{-42,70}}, color = {28, 108, 200}));
connect(reservoir.n, intake.p) annotation (
connect(reservoir.o, intake.i) annotation (
Line(points={{-82,66},{-76,66},{-76,64},{-72,64}}, color = {28, 108, 200}));
annotation (
experiment(StopTime = 2000, StartTime = 0, Tolerance = 0.0001, Interval = 0.4));
Expand Down
16 changes: 8 additions & 8 deletions OpenHPL/Examples/HPDetailed_Francis.mo
Original file line number Diff line number Diff line change
Expand Up @@ -60,23 +60,23 @@ model HPDetailed_Francis "Model of the HP system with Francis turbine and simpli
extent={{-10,-10},{10,10}},
rotation=0)));
equation
connect(penstockKP.n, turbine.p) annotation (
connect(penstockKP.o, turbine.i) annotation (
Line(points = {{-2, 48}, {-2, 48}, {-2, 36}, {18, 36}, {18, 36}}, color = {28, 108, 200}));
connect(surgeTank.n, penstockKP.p) annotation (
connect(surgeTank.o, penstockKP.i) annotation (
Line(points = {{-26, 66}, {-22, 66}, {-22, 48}, {-22, 48}}, color = {28, 108, 200}));
connect(generator.w_out, turbine.w_in) annotation (
Line(points={{35.2,20},{32,20},{32,30},{16,30}}, color = {0, 0, 127}));
Line(points={{41.2,15.2},{32,15.2},{32,28},{16,28}}, color = {0, 0, 127}));
connect(turbine.P_out, generator.P_in) annotation (
Line(points={{28,25},{22,25},{22,20},{20.8,20}}, color = {0, 0, 127}));
connect(reservoir.n, intake.p) annotation (
Line(points={{28,25},{22,25},{22,22.4},{28,22.4}}, color = {0, 0, 127}));
connect(reservoir.o, intake.i) annotation (
Line(points={{-80,60},{-76,60}}, color = {28, 108, 200}));
connect(surgeTank.p, intake.n) annotation (
connect(surgeTank.i, intake.o) annotation (
Line(points={{-46,66},{-48,66},{-48,60},{-56,60}}, color = {28, 108, 200}));
connect(turbine.n, discharge.p) annotation (
connect(turbine.o, discharge.i) annotation (
Line(points={{38,36},{48,36},{48,40},{54,40}}, color = {28, 108, 200}));
connect(control.y, turbine.u_t) annotation (
Line(points={{21,84},{28,84},{28,48}}, color = {0, 0, 127}));
connect(tail.n, discharge.n) annotation (
connect(tail.o, discharge.o) annotation (
Line(points={{84,44},{84,41.95},{80,41.95},{80,40},{74,40}}, color = {28, 108, 200}));
annotation (
experiment(StopTime = 2000, StartTime = 0, Tolerance = 0.0001, Interval = 0.4),
Expand Down
12 changes: 6 additions & 6 deletions OpenHPL/Examples/HPDetailed_generator.mo
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,21 @@ model HPDetailed_generator "Model of waterway and aggregate of the HP system wit
Placement(visible = true, transformation(extent = {{-22, 0}, {-2, 20}}, rotation = 0)));
ElectroMech.Generators.SimpleGen generator annotation (Placement(visible=true, transformation(extent={{8,0},{28,20}}, rotation=0)));
equation
connect(turbine.p, penstockKP.n) annotation (
connect(turbine.i, penstockKP.o) annotation (
Line(points={{10,42},{4,42},{4,54},{0,54}}, color = {28, 108, 200}));
connect(turbine.n, discharge.p) annotation (
connect(turbine.o, discharge.i) annotation (
Line(points={{30,42},{34,42},{34,40},{38,40}}, color = {28, 108, 200}));
connect(control.y, turbine.u_t) annotation (
Line(points={{11,84},{20,84},{20,54}}, color = {0, 0, 127}));
connect(turbine.P_out,generator. P_in) annotation (
Line(points={{20,31},{20,25.5},{18,25.5},{18,22}}, color = {0, 0, 127}));
connect(discharge.n, tail.n) annotation (
connect(discharge.o, tail.o) annotation (
Line(points={{58,40},{70,40},{70,46},{80,46}}, color = {28, 108, 200}));
connect(surgeTank.n, penstockKP.p) annotation (
connect(surgeTank.o, penstockKP.i) annotation (
Line(points={{-22,70},{-20,70},{-20,54}}, color = {28, 108, 200}));
connect(intake.n, surgeTank.p) annotation (
connect(intake.o, surgeTank.i) annotation (
Line(points={{-52,64},{-46,64},{-46,70},{-42,70}}, color = {28, 108, 200}));
connect(reservoir.n, intake.p) annotation (
connect(reservoir.o, intake.i) annotation (
Line(points={{-82,66},{-76,66},{-76,64},{-72,64}}, color = {28, 108, 200}));
connect(load.y,generator. u) annotation (
Line(points = {{-1, 10}, {-1, 10}, {8, 10}}, color = {0, 0, 127}));
Expand Down
12 changes: 6 additions & 6 deletions OpenHPL/Examples/HPSimple.mo
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,19 @@ model HPSimple "Model of waterway of the HP system with simplified models for co
inner OpenHPL.Constants Const annotation (
Placement(visible = true, transformation(origin={-90,90}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
connect(turbine.n, discharge.p) annotation (
connect(turbine.o, discharge.i) annotation (
Line(points={{40,10},{44,10},{44,0},{50,0}}, color = {28, 108, 200}));
connect(control.y, turbine.u_t) annotation (
Line(points={{1,70},{30,70},{30,22}}, color = {0, 0, 127}));
connect(penstock.n, turbine.p) annotation (
connect(penstock.o, turbine.i) annotation (
Line(points={{10,30},{14.95,30},{14.95,10},{20,10}}, color = {28, 108, 200}));
connect(reservoir.n, intake.p) annotation (
connect(reservoir.o, intake.i) annotation (
Line(points={{-80,30},{-70,30}}, color = {28, 108, 200}));
connect(intake.n, surgeTank.p) annotation (
connect(intake.o, surgeTank.i) annotation (
Line(points={{-50,30},{-40,30}}, color = {28, 108, 200}));
connect(surgeTank.n, penstock.p) annotation (
connect(surgeTank.o, penstock.i) annotation (
Line(points={{-20,30},{-10,30}}, color = {28, 108, 200}));
connect(discharge.n, tail.n) annotation (Line(points={{70,0},{80,0}}, color={28,108,200}));
connect(discharge.o, tail.o) annotation (Line(points={{70,0},{80,0}}, color={28,108,200}));
annotation (
experiment(StopTime = 2000, StartTime = 0, Tolerance = 0.0001, Interval = 0.4));
end HPSimple;
16 changes: 8 additions & 8 deletions OpenHPL/Examples/HPSimple_Francis.mo
Original file line number Diff line number Diff line change
Expand Up @@ -57,27 +57,27 @@ model HPSimple_Francis "Model of the HP system with Francis turbine and simplifi
rotation=0)));
inner OpenHPL.Constants Const(V_0 = 4.54) annotation (
Placement(visible = true, transformation(origin = {-90, 92}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Waterway.Fitting fitting(D_1=3, D_2=1.63) annotation (Placement(transformation(extent={{-4,20},{16,40}})));
Waterway.Fitting fitting(D_i=3, D_o=1.63, fit_type = OpenHPL.Functions.Fitting.FittingType.SquareReduction) annotation (Placement(transformation(extent={{-4,20},{16,40}})));
equation
connect(generator.w_out, turbine.w_in) annotation (
Line(points={{16.8,3.2},{12,3.2},{12,24},{18,24}}, color = {0, 0, 127}));
connect(turbine.P_out, generator.P_in) annotation (
Line(points={{30,21},{30,10.4}}, color = {0, 0, 127}));
connect(reservoir.n, intake.p) annotation (
connect(reservoir.o, intake.i) annotation (
Line(points={{-82,62},{-78,62},{-78,62},{-76,62}}, color = {28, 108, 200}));
connect(surgeTank.p, intake.n) annotation (
connect(surgeTank.i, intake.o) annotation (
Line(points={{-46,66},{-48,66},{-48,62},{-56,62}}, color = {28, 108, 200}));
connect(surgeTank.n, penstock.p) annotation (
connect(surgeTank.o, penstock.i) annotation (
Line(points={{-26,66},{-16.95,66},{-16.95,58},{-10,58}}, color = {28, 108, 200}));
connect(turbine.n, discharge.p) annotation (
connect(turbine.o, discharge.i) annotation (
Line(points={{40,32},{48,32},{48,40},{54,40}}, color = {28, 108, 200}));
connect(control.y, turbine.u_t) annotation (
Line(points={{21,84},{30,84},{30,44}}, color = {0, 0, 127}));
connect(turbine.p, fitting.n) annotation (
connect(turbine.i, fitting.o) annotation (
Line(points={{20,32},{20,30},{16,30}}, color = {28, 108, 200}));
connect(tail.n, discharge.n) annotation (
connect(tail.o, discharge.o) annotation (
Line(points={{84,44},{84,41.95},{80,41.95},{80,40},{74,40}}, color = {28, 108, 200}));
connect(penstock.n, fitting.p) annotation (
connect(penstock.o, fitting.i) annotation (
Line(points={{-10,38},{-6,38},{-6,30},{-4,30}}, color = {28, 108, 200}));
annotation (
experiment(StopTime = 2000, StartTime = 0, Tolerance = 0.0001, Interval = 0.4));
Expand Down
20 changes: 8 additions & 12 deletions OpenHPL/Examples/HPSimple_Francis_GridGen.mo
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ model HPSimple_Francis_GridGen "Synergy with OpenIPSL library(generator)"
origin={-80,-50},
extent={{-10,-10},{10,10}},
rotation=0)));
OpenHPL.Waterway.Pipe intake(H=23) annotation (Placement(visible=true, transformation(extent={{-64,-60},{-44,-40}},
OpenHPL.Waterway.Pipe intake(H=23) annotation (Placement(visible=true, transformation(extent={{-60,-60},{-40,-40}},
rotation=0)));
OpenHPL.Waterway.Pipe discharge(L=600, H=0.5) annotation (Placement(visible=true, transformation(extent={{48,-60},{68,-40}},
rotation=0)));
Expand All @@ -23,7 +23,7 @@ model HPSimple_Francis_GridGen "Synergy with OpenIPSL library(generator)"
extent={{-10,-10},{10,10}},
rotation=0)));
OpenHPL.Waterway.SurgeTank surgeTank(h_0=70.939) annotation (Placement(visible=true, transformation(
origin={-26,-50},
origin={-24,-50},
extent={{-10,-10},{10,10}},
rotation=0)));
OpenHPL.ElectroMech.Turbines.Francis turbine(
Expand Down Expand Up @@ -86,14 +86,6 @@ equation
Line(points = {{31, -72}, {32, -72}, {32, -62}}, color = {0, 0, 127}));
connect(governor.P_ref, power.y) annotation (
Line(points = {{8, -68}, {4.4, -68}, {4.4, -72}, {-1.2, -72}}, color = {0, 0, 127}));
connect(surgeTank.n, penstock.p) annotation (
Line(points={{-16,-50},{-6,-50}}, color = {28, 108, 200}));
connect(surgeTank.p, intake.n) annotation (
Line(points={{-36,-50},{-44,-50}}, color = {28, 108, 200}));
connect(penstock.n, turbine.p) annotation (
Line(points={{14,-50},{22,-50}}, color = {28, 108, 200}));
connect(reservoir.n, intake.p) annotation (
Line(points={{-70,-50},{-64,-50}}, color = {28, 108, 200}));
connect(fpu_to_fSI.u, wpu_to_wSI.u) annotation (Line(points={{-57.2,-90},{-94,-90},{-94,30},{-48,30},{-48,20},{-52.8,20}}, color={0,0,127}));
connect(order2_1.w, wpu_to_wSI.u) annotation (Line(points={{-19,9},{-14,9},{-14,20},{-52.8,20}}, color={0,0,127}));
connect(PSI_to_Ppu.u, turbine.P_out) annotation (
Expand All @@ -104,8 +96,12 @@ equation
Line(points={{-42,5},{-46,5},{-46,14},{-38,14},{-38,11}}, color = {0, 0, 127}));
connect(wpu_to_wSI.y, turbine.w_in) annotation (Line(points={{-66.6,20},{-80,20},{-80,-32},{16,-32},{16,-42},{20,-42}}, color={0,0,127}));
connect(order2_1.p, bus1.p) annotation (Line(points={{-20,0},{0,0}}, color={0,0,255}));
connect(discharge.n, tail.n) annotation (Line(points={{68,-50},{74,-50}}, color={28,108,200}));
connect(turbine.n, discharge.p) annotation (Line(points={{42,-50},{48,-50}}, color={28,108,200}));
connect(discharge.o, tail.o) annotation (Line(points={{68,-50},{74,-50}}, color={28,108,200}));
connect(turbine.o, discharge.i) annotation (Line(points={{42,-50},{48,-50}}, color={28,108,200}));
connect(turbine.i, penstock.o) annotation (Line(points={{22,-50},{14,-50}}, color={28,108,200}));
connect(penstock.i, surgeTank.o) annotation (Line(points={{-6,-50},{-14,-50}}, color={28,108,200}));
connect(surgeTank.i, intake.o) annotation (Line(points={{-34,-50},{-40,-50}}, color={28,108,200}));
connect(intake.i, reservoir.o) annotation (Line(points={{-60,-50},{-70,-50}}, color={28,108,200}));
annotation (
experiment(StopTime = 2000, StartTime = 0, Tolerance = 0.0001, Interval = 0.4));
end HPSimple_Francis_GridGen;
Loading

0 comments on commit bc6919f

Please sign in to comment.