Skip to content

Commit

Permalink
Merge pull request #1374 from RWTH-EBC/issue1368_PumpPolynomialBasedOM
Browse files Browse the repository at this point in the history
Issue1368 pump polynomial based om
  • Loading branch information
KremerMartin authored Oct 13, 2022
2 parents 0afd613 + ef42919 commit 103434f
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 123 deletions.
164 changes: 51 additions & 113 deletions AixLib/Fluid/Movers/PumpsPolynomialBased/Controls/CtrlDpVarN.mo
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,17 @@ model CtrlDpVarN "'dp variable' for PumpSpeedControlled"
Modelica.Blocks.Sources.RealExpression headControl(y=(Hnom - H0)/Qnom*Q.y +
H0) "The given pump head according to controll strategy"
annotation (Placement(transformation(extent={{-80,-24},{-44,-4}})));
parameter Modelica.Blocks.Types.SimpleController controllerTypePID=.Modelica.Blocks.Types.SimpleController.PID
"Type of controller";
Modelica.Blocks.Logical.Switch pumpSpeedSwitch "If false: rpm_Input = 0"
annotation (Placement(transformation(extent={{60,-40},{80,-20}})));
Modelica.Blocks.Sources.Constant zeroSpeed(k=0)
annotation (Placement(transformation(extent={{38,-44},{50,-32}})));
Modelica.Blocks.Routing.RealPassThrough nActPassThrough
"pass through of pump speed signal"
annotation (Placement(transformation(extent={{-74,-42},{-88,-28}})));
Modelica.Blocks.Routing.BooleanPassThrough onOffPassThrough1
annotation (Placement(transformation(extent={{-88,-96},{-74,-82}})));
protected
Modelica.Blocks.Routing.RealPassThrough powerPassThrough annotation (
Placement(transformation(
Expand All @@ -50,108 +61,42 @@ protected
extent={{7,-7},{-7,7}},
rotation=270,
origin={-53,-31})));
public
parameter Modelica.Blocks.Types.SimpleController controllerTypePID=.Modelica.Blocks.Types.SimpleController.PID
"Type of controller";
Modelica.StateGraph.InitialStep Standby(nIn=1, nOut=1)
annotation (Placement(transformation(extent={{-56,48},{-36,68}})));
Modelica.StateGraph.StepWithSignal ActiveState(nIn=1, nOut=1)
annotation (Placement(transformation(extent={{0,48},{20,68}})));
Modelica.StateGraph.TransitionWithSignal pumpOn(enableTimer=false, waitTime=1)
"fires when on"
annotation (Placement(transformation(extent={{-30,48},{-10,68}})));
Modelica.StateGraph.TransitionWithSignal noDemand(waitTime=60, enableTimer=
false)
annotation (Placement(transformation(extent={{24,48},{44,68}})));
Modelica.Blocks.Logical.Switch pumpSpeedSwitch "If false: rpm_Input = 0"
annotation (Placement(transformation(extent={{60,-40},{80,-20}})));
Modelica.Blocks.Sources.Constant zeroSpeed(k=0)
annotation (Placement(transformation(extent={{38,-44},{50,-32}})));
Modelica.Blocks.Logical.Not notOn annotation (Placement(transformation(
extent={{-4,-4},{4,4}},
rotation=90,
origin={34,32})));
Modelica.Blocks.Routing.RealPassThrough nActPassThrough
"pass through of pump speed signal"
annotation (Placement(transformation(extent={{-74,-42},{-88,-28}})));
Modelica.Blocks.Routing.BooleanPassThrough onOffPassThrough1
annotation (Placement(transformation(extent={{-88,-96},{-74,-82}})));
equation
connect(pumpBus.PelMea, powerPassThrough.u) annotation (Line(
points={{0.1,-99.9},{-62,-99.9},{-62,-53},{-72.6,-53}},
color={255,204,51},
thickness=0.5), Text(
string="%first",
index=-1,
extent={{-5,3},{-5,3}}));
connect(powerPassThrough.y, pumpControllerBus.PelMea) annotation (Line(points=
{{-88.7,-53},{-98,-53},{-98,100.1},{0.1,100.1}}, color={0,0,127}));
connect(pumpBus.efficiencyMea, efficiencyPassThrough.u) annotation (Line(
points={{0.1,-99.9},{-62,-99.9},{-62,-71},{-72.6,-71}},
color={255,204,51},
thickness=0.5), Text(
string="%first",
index=-1,
extent={{-3,3},{-3,3}}));
connect(pumpBus.PelMea, powerPassThrough.u) annotation (
Line(points = {{0.1, -99.9}, {-62, -99.9}, {-62, -53}, {-72.6, -53}}, color = {255, 204, 51}, thickness = 0.5),
Text(string = "%first", index = -1, extent = {{-5, 3}, {-5, 3}}));
connect(powerPassThrough.y, pumpControllerBus.PelMea) annotation (
Line(points = {{-88.7, -53}, {-98, -53}, {-98, 100.1}, {0.1, 100.1}}, color = {0, 0, 127}));
connect(pumpBus.efficiencyMea, efficiencyPassThrough.u) annotation (
Line(points = {{0.1, -99.9}, {-62, -99.9}, {-62, -71}, {-72.6, -71}}, color = {255, 204, 51}, thickness = 0.5),
Text(string = "%first", index = -1, extent = {{-3, 3}, {-3, 3}}));
connect(efficiencyPassThrough.y, pumpControllerBus.efficiencyMea) annotation (
Line(points={{-88.7,-71},{-98,-71},{-98,100.1},{0.1,100.1}}, color={0,0,
127}));
connect(PID.y, pumpSpeedSwitch.u1) annotation (Line(points={{15,-14},{38,-14},
{38,-22},{58,-22}}, color={0,0,127}));
connect(pumpBus.vFRcur_m3h, Q.u) annotation (Line(
points={{0,-100},{-2,-100},{-2,-76},{-53,-76},{-53,-39.4}},
color={255,204,51},
thickness=0.5));
connect(pumpBus.dpMea, PID.u_m) annotation (Line(
points={{0.1,-99.9},{4,-99.9},{4,-26}},
color={255,204,51},
thickness=0.5), Text(
string="%first",
index=-1,
extent={{-6,3},{-6,3}}));
connect(headControl.y, PID.u_s)
annotation (Line(points={{-42.2,-14},{-8,-14}}, color={0,0,127}));
connect(Standby.outPort[1],pumpOn. inPort)
annotation (Line(points={{-35.5,58},{-24,58}}, color={0,0,0}));
connect(ActiveState.outPort[1],noDemand. inPort)
annotation (Line(points={{20.5,58},{25.25,58},{30,58}}, color={0,0,0}));
connect(ActiveState.active,pumpSpeedSwitch. u2) annotation (Line(points={{10,47},
{10,8},{52,8},{52,-30},{58,-30}}, color={255,0,255}));
connect(notOn.y,noDemand. condition)
annotation (Line(points={{34,36.4},{34,36.4},{34,46}}, color={255,0,255}));
connect(pumpOn.condition, pumpControllerBus.onSet) annotation (Line(points={{
-20,46},{-98,46},{-98,100.1},{0.1,100.1}}, color={255,0,255}), Text(
string="%second",
index=1,
extent={{6,3},{6,3}}));
connect(pumpSpeedSwitch.y, pumpBus.rpmSet) annotation (Line(points={{81,-30},
{86,-30},{86,-99.9},{0.1,-99.9}}, color={0,0,127}), Text(
string="%second",
index=1,
extent={{6,3},{6,3}}));
connect(zeroSpeed.y,pumpSpeedSwitch. u3)
annotation (Line(points={{50.6,-38},{58,-38}}, color={0,0,127}));
connect(pumpOn.condition,notOn. u) annotation (Line(points={{-20,46},{-20,22},
{34,22},{34,27.2}}, color={255,0,255}));
connect(pumpOn.outPort,ActiveState. inPort[1])
annotation (Line(points={{-18.5,58},{-1,58}}, color={0,0,0}));
connect(noDemand.outPort,Standby. inPort[1]) annotation (Line(points={{35.5,58},
{50,58},{50,80},{-66,80},{-66,58},{-57,58}}, color={0,0,0}));
connect(pumpBus.rpmMea, nActPassThrough.u) annotation (Line(
points={{0.1,-99.9},{-62,-99.9},{-62,-35},{-72.6,-35}},
color={255,204,51},
thickness=0.5), Text(
string="%first",
index=-1,
extent={{-3,3},{-3,3}}));
connect(nActPassThrough.y, pumpControllerBus.rpmMea) annotation (Line(points=
{{-88.7,-35},{-98,-35},{-98,100.1},{0.1,100.1}}, color={0,0,127}));
connect(pumpControllerBus.onSet, onOffPassThrough1.u) annotation (Line(
points={{0.1,100.1},{-98,100.1},{-98,-89},{-89.4,-89}},
color={255,204,51},
thickness=0.5));
connect(onOffPassThrough1.y, pumpBus.onSet) annotation (Line(points={{-73.3,-89},
{-62,-89},{-62,-100},{0.1,-99.9}}, color={255,0,255}));
Line(points = {{-88.7, -71}, {-98, -71}, {-98, 100.1}, {0.1, 100.1}}, color = {0, 0, 127}));
connect(PID.y, pumpSpeedSwitch.u1) annotation (
Line(points = {{15, -14}, {38, -14}, {38, -22}, {58, -22}}, color = {0, 0, 127}));
connect(pumpBus.vFRcur_m3h, Q.u) annotation (
Line(points = {{0, -100}, {-2, -100}, {-2, -76}, {-53, -76}, {-53, -39.4}}, color = {255, 204, 51}, thickness = 0.5));
connect(pumpBus.dpMea, PID.u_m) annotation (
Line(points = {{0.1, -99.9}, {4, -99.9}, {4, -26}}, color = {255, 204, 51}, thickness = 0.5),
Text(string = "%first", index = -1, extent = {{-6, 3}, {-6, 3}}));
connect(headControl.y, PID.u_s) annotation (
Line(points = {{-42.2, -14}, {-8, -14}}, color = {0, 0, 127}));
connect(pumpSpeedSwitch.y, pumpBus.rpmSet) annotation (
Line(points = {{81, -30}, {86, -30}, {86, -99.9}, {0.1, -99.9}}, color = {0, 0, 127}),
Text(string = "%second", index = 1, extent = {{6, 3}, {6, 3}}));
connect(zeroSpeed.y, pumpSpeedSwitch.u3) annotation (
Line(points = {{50.6, -38}, {58, -38}}, color = {0, 0, 127}));
connect(pumpBus.rpmMea, nActPassThrough.u) annotation (
Line(points = {{0.1, -99.9}, {-62, -99.9}, {-62, -35}, {-72.6, -35}}, color = {255, 204, 51}, thickness = 0.5),
Text(string = "%first", index = -1, extent = {{-3, 3}, {-3, 3}}));
connect(nActPassThrough.y, pumpControllerBus.rpmMea) annotation (
Line(points = {{-88.7, -35}, {-98, -35}, {-98, 100.1}, {0.1, 100.1}}, color = {0, 0, 127}));
connect(pumpControllerBus.onSet, onOffPassThrough1.u) annotation (
Line(points = {{0.1, 100.1}, {-98, 100.1}, {-98, -89}, {-89.4, -89}}, color = {255, 204, 51}, thickness = 0.5));
connect(onOffPassThrough1.y, pumpBus.onSet) annotation (
Line(points = {{-73.3, -89}, {-62, -89}, {-62, -100}, {0.1, -99.9}}, color = {255, 0, 255}));
connect(pumpControllerBus.onSet, pumpSpeedSwitch.u2) annotation (
Line(points={{0.1,100.1},{50,100.1},{50,-30},{58,-30}}, color = {255, 0, 255}));
annotation (
Dialog(group="Heating curves"),
choicesAllMatching=true,
Expand All @@ -162,7 +107,11 @@ equation
flow rate and pump head at zero mass flow. Hence p0 = (0, H0). p1 is
the pump's design point. Normally, H0 = 0.5 * Hnom.
</p>
</html>", revisions="<html>
<ul>
<li>2022-10-13 by Martin Kremer: <br/>
Deleted StateGraph-Models due to incompatibility to OpenModelica.
</li>
<li>2019-09-18 by Alexander Kümpel:<br/>
Renaming and bug fixes.
</li>
Expand Down Expand Up @@ -190,17 +139,6 @@ equation
</li>
</ul>
</html>"),
Icon(graphics={
Rectangle(
extent={{-80,50},{76,-8}},
lineColor={0,0,0},
fillColor={254,178,76},
fillPattern=FillPattern.Solid,
lineThickness=1),
Text(
extent={{-70,38},{64,8}},
lineColor={240,59,32},
fillColor={0,216,108},
fillPattern=FillPattern.Solid,
textString="dp_var")}));
Icon(graphics={Rectangle(fillColor = {254, 178, 76}, fillPattern = FillPattern.Solid, lineThickness = 1, extent = {{-80, 50}, {76, -8}}),
Text(lineColor = {240, 59, 32}, extent = {{-70, 38}, {64, 8}}, textString = "dp_var")}));
end CtrlDpVarN;
19 changes: 9 additions & 10 deletions AixLib/Fluid/Movers/PumpsPolynomialBased/PumpHeadControlled.mo
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ model PumpHeadControlled
annotation (Dialog(tab="Nominal design point", group=
"Design point of pump. Used for start value calculation."));


// Parameters
// Parameters
// Initialization
parameter Modelica.Units.SI.Height Hstart=Hnom "
Start value of pump head. Will be used to initialize criticalDamping."
Expand All @@ -49,14 +48,14 @@ model PumpHeadControlled
parameter Modelica.Media.Interfaces.Types.Temperature T_start=Medium.T_default
"Start value of temperature" annotation (Dialog(tab="Initialization", group="Temperature"));

// Dynamics
// Dynamics
parameter Modelica.Fluid.Types.Dynamics energyDynamics=Modelica.Fluid.Types.Dynamics.DynamicFreeInitial
"Type of energy balance: dynamic (3 initialization options) or steady state"
annotation(Evaluate=true, Dialog(tab = "Dynamics", group="Equations"));
parameter Modelica.Fluid.Types.Dynamics massDynamics=energyDynamics
"Type of mass balance: dynamic (3 initialization options) or steady state" annotation(Evaluate=true, Dialog(tab = "Dynamics", group="Equations"));

// Assumptions
// Assumptions
parameter Modelica.Units.SI.Volume V=0 "Volume inside the pump"
annotation (Dialog(tab="Assumptions"), Evaluate=true);

Expand All @@ -66,7 +65,7 @@ model PumpHeadControlled
T=Medium.T_default,
X=Medium.X_default) "Default medium density";

// Power and Efficiency
// Power and Efficiency
parameter Boolean calculatePower=true "calc. power consumption?" annotation (
Dialog(tab="General", group="Power and Efficiency"));
parameter Boolean calculateEfficiency=false
Expand All @@ -83,7 +82,7 @@ model PumpHeadControlled
group="Power and Efficiency",
enable=calculate_Efficiency), choicesAllMatching=true);

// Variables
// Variables
Modelica.Units.SI.Pressure dp_pump "Pressure increase";
Modelica.Blocks.Interfaces.RealOutput head(
quantity="Length",
Expand All @@ -102,7 +101,7 @@ model PumpHeadControlled
annotation (Placement(transformation(extent={{-100,35},{-80,55}})));

Modelica.Blocks.Tables.CombiTable1Dv maxMinTable(
columns={2,3},
columns={2,3}, extrapolation = Modelica.Blocks.Types.Extrapolation.HoldLastPoint,
table=pumpParam.maxMinHeight,
tableName="NoName",
tableOnFile=false)
Expand Down Expand Up @@ -137,9 +136,9 @@ protected
annotation (Placement(transformation(extent={{-71,-76},{-51,-56}})));
Modelica.Blocks.Continuous.CriticalDamping
criticalDamping(
y_start=Hstart,

f=1/5,
initType=Modelica.Blocks.Types.Init.InitialOutput)
initType=Modelica.Blocks.Types.Init.InitialOutput, n = 1,y_start=Hstart)
annotation (Placement(transformation(extent={{50,-20},{70,0}})));
public
Modelica.Blocks.Logical.Switch onOff
Expand Down Expand Up @@ -177,7 +176,7 @@ equation

head = criticalDamping.y "safe head after limiting and other checks.";
dp_pump = head * rho_default * Modelica.Constants.g_n;
//Calculate power and Efficiency
//Calculate power and Efficiency
if pumpBus.onSet and head >
AixLib.Fluid.Movers.PumpsPolynomialBased.BaseClasses.polynomial2D(
pumpParam.cHQN,
Expand Down

0 comments on commit 103434f

Please sign in to comment.