partial model Example1
extends Modelica.Icons.Example;
package Medium =
Modelica.Media.Water.ConstantPropertyLiquidWater;
parameter Real m_flow_nominal=0.1 ;
Annex60.Fluid.Sources.Boundary_pT bou(
redeclare package Medium = Medium,
nPorts=1) ;
Fluid.Movers.FlowControlled_m_flow pump(
redeclare package Medium = Medium,
m_flow_nominal=m_flow_nominal,
filteredSpeed=false,
allowFlowReversal=allowFlowReversal.k,
energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
nominalValuesDefineDefaultPressureCurve=true)
;
Annex60.Fluid.HeatExchangers.HeaterCooler_T hea(
redeclare package Medium = Medium,
dp_nominal=1000,
Q_flow_maxHeat=1000,
Q_flow_maxCool=0,
m_flow_nominal=m_flow_nominal,
energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
allowFlowReversal=allowFlowReversal.k) ;
Modelica.Blocks.Sources.Pulse pulse(period=1000) ;
Modelica.Blocks.Math.Gain gain(k=m_flow_nominal) ;
Annex60.Fluid.Actuators.Valves.ThreeWayLinear val(
redeclare package Medium = Medium,
m_flow_nominal=m_flow_nominal,
dpValve_nominal=1000,
l={0.002,0.002},
energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState,
filteredOpening=false,
portFlowDirection_1=
if allowFlowReversal.k
then Modelica.Fluid.Types.PortFlowDirection.Bidirectional
else Modelica.Fluid.Types.PortFlowDirection.Entering,
portFlowDirection_2=
if allowFlowReversal.k
then Modelica.Fluid.Types.PortFlowDirection.Bidirectional
else Modelica.Fluid.Types.PortFlowDirection.Leaving,
portFlowDirection_3=
if allowFlowReversal.k
then Modelica.Fluid.Types.PortFlowDirection.Bidirectional
else Modelica.Fluid.Types.PortFlowDirection.Entering)
;
Modelica.Blocks.Sources.Constant const(k=0.5) ;
Modelica.Blocks.Sources.BooleanConstant allowFlowReversal(k=true)
;
Annex60.Fluid.FixedResistances.PressureDrop[nRes.k] res(
redeclare package Medium = Medium,
each allowFlowReversal=allowFlowReversal.k,
each m_flow_nominal=m_flow_nominal,
each dp_nominal=1000,
each from_dp=from_dp.k) ;
Modelica.Blocks.Sources.IntegerConstant nRes(k=20)
;
Modelica.Blocks.Sources.BooleanConstant from_dp(k=false)
;
equation
connect(bou.ports[1],hea. port_a);
connect(pulse.y,hea. TSet);
connect(pump.m_flow_in, gain.y);
connect(gain.u,pulse. y);
connect(hea.port_b,val. port_1);
connect(val.port_2, pump.port_a);
connect(const.y,val. y);
connect(val.port_3,hea. port_a);
for i
in 1:nRes.k
loop
connect(pump.port_b, res[i].port_a);
end for;
end Example1;