Skip to content

Commit

Permalink
Merge pull request #991 from RWTH-EBC/issue799_improveSimpleConsumer
Browse files Browse the repository at this point in the history
#799 plugFlowPipe removed in simple consumer
  • Loading branch information
A. Kuempel authored Sep 14, 2020
2 parents 66ee075 + ef627ff commit e46531c
Showing 1 changed file with 29 additions and 55 deletions.
84 changes: 29 additions & 55 deletions AixLib/Systems/HydraulicModules/SimpleConsumer.mo
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
within AixLib.Systems.HydraulicModules;
within AixLib.Systems.HydraulicModules;
model SimpleConsumer "Simple Consumer"
extends AixLib.Fluid.Interfaces.PartialTwoPort;
import SI=Modelica.SIunits;

parameter Real kA(unit="W/K")=1 "Heat transfer coefficient times area [W/K]" annotation (Dialog(enable = functionality=="T_fixed" or functionality=="T_input"));
parameter SI.Length dPipe= 0.032 "Pipe diameter";
parameter SI.Length len = 1.0 "Average total pipe length";
parameter SI.Temperature T_fixed = 293.15
"Ambient temperature for convection" annotation (Dialog(enable = functionality=="T_fixed"));
parameter SI.HeatCapacity capacity=1 "Capacity of the material";
Expand All @@ -29,66 +27,41 @@ model SimpleConsumer "Simple Consumer"
final T_start=T_start,
final allowFlowReversal=allowFlowReversal,
final m_flow_nominal=m_flow_nominal,
nPorts=2,
redeclare package Medium = Medium) annotation (Placement(transformation(
redeclare package Medium = Medium,
nPorts=2) annotation (Placement(transformation(
extent={{-10,10},{10,-10}},
rotation=180,
origin={0,10})));
Modelica.Thermal.HeatTransfer.Components.HeatCapacitor heatCapacitor(
T(start=T_start, fixed=true), C=capacity)
annotation (Placement(transformation(
origin={28,34},
origin={44,40},
extent={{-10,10},{10,-10}},
rotation=90)));
Modelica.Thermal.HeatTransfer.Components.Convection convection if
functionality == "T_input" or functionality == "T_fixed"
annotation (Placement(transformation(
origin={10,54},
origin={10,70},
extent={{-10,-10},{10,10}},
rotation=90)));
Modelica.Thermal.HeatTransfer.Sources.PrescribedTemperature
prescribedTemperature if functionality == "T_input" or functionality == "T_fixed"
annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=180,
origin={42,70})));
origin={40,80})));
Modelica.Blocks.Sources.RealExpression realExpression(y=kA) if functionality == "T_input"
or functionality == "T_fixed" annotation (
Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=0,
origin={-30,54})));
Fluid.FixedResistances.PlugFlowPipe pipe1(
final allowFlowReversal=allowFlowReversal,
final dh=dPipe,
final v_nominal=1.5,
final m_flow_nominal=m_flow_nominal,
final T_start_in=T_start,
final T_start_out=T_start,
final length=len/2,
final dIns=0.01,
final kIns=0.028,
nPorts=1,
redeclare package Medium = Medium) annotation (Placement(transformation(extent={{-60,-10},
{-40,10}})));
Fluid.FixedResistances.PlugFlowPipe pipe2(
allowFlowReversal=allowFlowReversal,
final dh=dPipe,
final v_nominal=1.5,
final m_flow_nominal=m_flow_nominal,
T_start_in=T_start,
T_start_out=T_start,
final length=len/2,
final dIns=0.01,
final kIns=0.028,
redeclare package Medium = Medium,
nPorts=1) annotation (Placement(transformation(extent={{40,-10},{60,10}})));
origin={-30,78})));
Modelica.Blocks.Sources.RealExpression realExpression1(y=T_fixed) if
functionality == "T_fixed" annotation (
Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=180,
origin={90,70})));
origin={90,80})));
Modelica.Blocks.Interfaces.RealInput T if functionality == "T_input"
annotation (Placement(transformation(
extent={{-20,-20},{20,20}},
Expand All @@ -101,7 +74,7 @@ model SimpleConsumer "Simple Consumer"
functionality == "Q_flow_input" or functionality == "Q_flow_fixed"
annotation (Placement(transformation(extent={{-10,-10},{10,10}},
rotation=270,
origin={-60,50})));
origin={-62,58})));
Modelica.Blocks.Sources.RealExpression realExpression2(y=Q_flow_fixed) if
functionality == "Q_flow_fixed" annotation (
Placement(transformation(
Expand All @@ -118,40 +91,37 @@ model SimpleConsumer "Simple Consumer"
origin={-60,100})));
equation
connect(volume.heatPort,heatCapacitor. port) annotation (Line(points={{10,10},
{10,34},{18,34}}, color={191,0,0},
{10,40},{34,40}}, color={191,0,0},
pattern=LinePattern.Dash));
connect(heatCapacitor.port,convection. solid) annotation (Line(points={{18,34},
{10,34},{10,44}}, color={191,0,0}));
connect(heatCapacitor.port,convection. solid) annotation (Line(points={{34,40},
{10,40},{10,60}}, color={191,0,0}));
connect(convection.fluid,prescribedTemperature. port)
annotation (Line(points={{10,64},{10,70},{32,70}},
color={191,0,0},
annotation (Line(points={{10,80},{30,80}}, color={191,0,0},
pattern=LinePattern.Dash));
connect(realExpression.y,convection. Gc)
annotation (Line(points={{-19,54},{0,54}}, color={0,0,127}));
annotation (Line(points={{-19,78},{-10,78},{-10,70},{0,70}},
color={0,0,127}));
connect(realExpression1.y, prescribedTemperature.T)
annotation (Line(points={{79,70},{54,70}}, color={0,0,127},
annotation (Line(points={{79,80},{52,80}}, color={0,0,127},
pattern=LinePattern.Dash));
connect(pipe1.ports_b[1], volume.ports[1]) annotation (Line(points={{-40,0},{
2,0}}, color={0,127,255}));
connect(volume.ports[2], pipe2.port_a) annotation (Line(points={{-2,0},{40,0}},
color={0,127,255}));
connect(pipe1.port_a, port_a)
annotation (Line(points={{-60,0},{-100,0}}, color={0,127,255}));
connect(pipe2.ports_b[1], port_b)
annotation (Line(points={{60,0},{100,0}}, color={0,127,255}));
connect(prescribedTemperature.T, T)
annotation (Line(points={{54,70},{60,70},{60,120}}, color={0,0,127},
annotation (Line(points={{52,80},{60,80},{60,120}}, color={0,0,127},
pattern=LinePattern.Dash));
connect(prescribedHeatFlow.Q_flow, realExpression2.y)
annotation (Line(points={{-60,60},{-60,80},{-79,80}},
annotation (Line(points={{-62,68},{-62,80},{-79,80}},
color={0,0,127},
pattern=LinePattern.Dash));
connect(prescribedHeatFlow.Q_flow, Q_flow)
annotation (Line(points={{-60,60},{-60,120}}, color={0,0,127},
annotation (Line(points={{-62,68},{-62,94},{-60,94},{-60,120}},
color={0,0,127},
pattern=LinePattern.Dash));
connect(prescribedHeatFlow.port, heatCapacitor.port)
annotation (Line(points={{-60,40},{-60,34},{18,34}}, color={191,0,0},
annotation (Line(points={{-62,48},{-62,40},{34,40}}, color={191,0,0},
pattern=LinePattern.Dash));
connect(port_a, volume.ports[1])
annotation (Line(points={{-100,0},{2,0}}, color={0,127,255}));
connect(volume.ports[2], port_b)
annotation (Line(points={{-2,0},{100,0}}, color={0,127,255}));
annotation (
Icon(coordinateSystem(preserveAspectRatio=false), graphics={
Ellipse(
Expand Down Expand Up @@ -179,7 +149,11 @@ equation
possible to choose between these options with the parameter
\"functionality\".
</p>
</html>", revisions="<html>
<ul>
<li>August 31, 2020, by Alexander Kümpel:<br/>
Remove pipes
</li>
<li>October 31, 2019, by Alexander Kümpel:<br/>
Add more options
</li>
Expand Down

0 comments on commit e46531c

Please sign in to comment.