LBL logo

Buildings.Fluid.HeatExchangers.Examples

Collection of models that illustrate model use and test models

Information

This package contains examples for the use of models that can be found in Buildings.Fluid.HeatExchangers.

Extends from Modelica.Icons.ExamplesPackage (Icon for packages containing runnable examples).

Package Content

NameDescription
Buildings.Fluid.HeatExchangers.Examples.ConstantEffectiveness ConstantEffectiveness Model that demonstrates use of a heat exchanger with constant effectiveness
Buildings.Fluid.HeatExchangers.Examples.HeaterCoolerPrescribed HeaterCoolerPrescribed Model that demonstrates the ideal heater model
Buildings.Fluid.HeatExchangers.Examples.DryEffectivenessNTU DryEffectivenessNTU Model that demonstrates use of a heat exchanger without condensation that uses the epsilon-NTU relation
Buildings.Fluid.HeatExchangers.Examples.DryEffectivenessNTUMassFlow DryEffectivenessNTUMassFlow Model of epsilon-NTU dry coil that tests variable mass flow rates
Buildings.Fluid.HeatExchangers.Examples.DryEffectivenessNTUPControl DryEffectivenessNTUPControl Model that demonstrates use of a heat exchanger without condensation that uses the epsilon-NTU relation with feedback control
Buildings.Fluid.HeatExchangers.Examples.DryCoilCounterFlowMassFlow DryCoilCounterFlowMassFlow Model of a cooling coil that tests variable mass flow rates
Buildings.Fluid.HeatExchangers.Examples.WetCoilCounterFlowMassFlow WetCoilCounterFlowMassFlow Model of a cooling coil that tests variable mass flow rates
Buildings.Fluid.HeatExchangers.Examples.DryCoilCounterFlowPControl DryCoilCounterFlowPControl Model that demonstrates use of a heat exchanger without condensation and with feedback control
Buildings.Fluid.HeatExchangers.Examples.WetCoilCounterFlowPControl WetCoilCounterFlowPControl Model that demonstrates use of a heat exchanger with condensation and with feedback control
Buildings.Fluid.HeatExchangers.Examples.DryCoilDiscretized DryCoilDiscretized Model that demonstrates use of a finite volume model of a heat exchanger without condensation
Buildings.Fluid.HeatExchangers.Examples.WetCoilDiscretized WetCoilDiscretized Model that demonstrates use of a finite volume model of a heat exchanger with condensation
Buildings.Fluid.HeatExchangers.Examples.DryCoilDiscretizedPControl DryCoilDiscretizedPControl Model that demonstrates use of a finite volume model of a heat exchanger without condensation and with feedback control
Buildings.Fluid.HeatExchangers.Examples.WetCoilDiscretizedPControl WetCoilDiscretizedPControl Model that demonstrates use of a finite volume model of a heat exchanger with condensation and feedback control
Buildings.Fluid.HeatExchangers.Examples.BaseClasses BaseClasses Package with base classes for Buildings.Fluid.HeatExchangers.Examples

Buildings.Fluid.HeatExchangers.Examples.ConstantEffectiveness Buildings.Fluid.HeatExchangers.Examples.ConstantEffectiveness

Model that demonstrates use of a heat exchanger with constant effectiveness

Buildings.Fluid.HeatExchangers.Examples.ConstantEffectiveness

Information

Extends from Modelica.Icons.Example (Icon for runnable examples).

Modelica definition

model ConstantEffectiveness 
  "Model that demonstrates use of a heat exchanger with constant effectiveness"
  extends Modelica.Icons.Example;

 package Medium1 = Buildings.Media.ConstantPropertyLiquidWater;
 package Medium2 = Buildings.Media.GasesPTDecoupled.MoistAirUnsaturated;
  Buildings.Fluid.Sources.Boundary_pT sin_2(                       redeclare 
      package Medium = Medium2,
    use_p_in=true,
    nPorts=1,
    T=273.15 + 10,
    X={0.001,0.999});
    Modelica.Blocks.Sources.Ramp PIn(
    height=200,
    duration=60,
    offset=101325,
    startTime=50);
  Buildings.Fluid.Sources.Boundary_pT sou_2(                       redeclare 
      package Medium = Medium2, T=273.15 + 5,
    use_p_in=true,
    use_T_in=true,
    nPorts=1);
    Modelica.Blocks.Sources.Ramp TWat(
    height=10,
    duration=60,
    offset=273.15 + 30,
    startTime=60) "Water temperature";
  Modelica.Blocks.Sources.Constant TDb(k=293.15) "Drybulb temperature";
    Modelica.Blocks.Sources.Constant POut(k=101325);
  Buildings.Fluid.Sources.Boundary_pT sin_1(                       redeclare 
      package Medium = Medium1,
    use_p_in=true,
    nPorts=1,
    p=300000,
    T=273.15 + 25);
  Buildings.Fluid.Sources.Boundary_pT sou_1(
    redeclare package Medium = Medium1,
    p=300000 + 5000,
    T=273.15 + 50,
    use_T_in=true,
    nPorts=1);
  Buildings.Fluid.HeatExchangers.ConstantEffectiveness hex(redeclare package
      Medium1 =
        Medium1, redeclare package Medium2 = Medium2,
    show_T=true,
    m1_flow_nominal=5,
    m2_flow_nominal=5,
    dp1_nominal=500,
    dp2_nominal=10);
  inner Modelica.Fluid.System system(
    p_ambient=300000,
    T_ambient=313.15);
  Modelica.Blocks.Sources.Trapezoid trapezoid(
    amplitude=5000,
    rising=10,
    width=100,
    falling=10,
    period=3600,
    offset=300000);
equation 
  connect(PIn.y,sou_2. p_in);
  connect(TDb.y, sou_2.T_in);
  connect(TWat.y, sou_1.T_in);
  connect(sou_1.ports[1], hex.port_a1);
  connect(hex.port_a2, sou_2.ports[1]);
  connect(POut.y, sin_2.p_in);
  connect(hex.port_b1, sin_1.ports[1]);
  connect(sin_2.ports[1], hex.port_b2);
  connect(trapezoid.y, sin_1.p_in);
end ConstantEffectiveness;

Buildings.Fluid.HeatExchangers.Examples.HeaterCoolerPrescribed Buildings.Fluid.HeatExchangers.Examples.HeaterCoolerPrescribed

Model that demonstrates the ideal heater model

Buildings.Fluid.HeatExchangers.Examples.HeaterCoolerPrescribed

Information

Model that demonstrates the use of an ideal heater. Both heater models are identical, except that one model is configured as a steady-state model, whereas the other is configured as a dynamic model. Both heaters add heat to the medium to track a set-point for the outlet temperature.

Extends from Modelica.Icons.Example (Icon for runnable examples).

Parameters

TypeNameDefaultDescription
MassFlowRatem_flow_nominal3000/1000/20Nominal mass flow rate [kg/s]

Modelica definition

model HeaterCoolerPrescribed 
  "Model that demonstrates the ideal heater model"
  extends Modelica.Icons.Example;

  package Medium = Buildings.Media.GasesConstantDensity.SimpleAir;

  inner Modelica.Fluid.System system(m_flow_start=0, energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState);
  parameter Modelica.SIunits.MassFlowRate m_flow_nominal=
     3000/1000/20 "Nominal mass flow rate";

  Buildings.Fluid.Sources.Boundary_pT sin(
    redeclare package Medium = Medium,
    use_T_in=false,
    p(displayUnit="Pa"),
    T=293.15,
    nPorts=2) "Sink";
  Buildings.Fluid.HeatExchangers.HeaterCoolerPrescribed heaSte(
    redeclare package Medium = Medium,
    m_flow_nominal=m_flow_nominal,
    dp_nominal=6000,
    Q_flow_nominal=3000,
    energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState) 
    "Steady-state model of the heater";
  Buildings.Fluid.Sensors.TemperatureTwoPort senTem1(redeclare package Medium
      = Medium, m_flow_nominal=m_flow_nominal) "Temperature sensor";
  Modelica.Blocks.Sources.TimeTable TSet(table=[0, 273.15 + 20; 120, 273.15 +
        20; 120, 273.15 + 30; 1200, 273.15 + 30]) "Setpoint";
  Buildings.Controls.Continuous.LimPID con1(
    controllerType=Modelica.Blocks.Types.SimpleController.PI,
    Td=1,
    k=1,
    Ti=10) "Controller";
  Buildings.Fluid.HeatExchangers.HeaterCoolerPrescribed heaDyn(
    redeclare package Medium = Medium,
    m_flow_nominal=m_flow_nominal,
    dp_nominal=6000,
    Q_flow_nominal=3000,
    energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyStateInitial) 
    "Dynamic model of the heater";
  Buildings.Fluid.Sensors.TemperatureTwoPort senTem2(redeclare package Medium
      = Medium, m_flow_nominal=m_flow_nominal) "Temperature sensor";
  Buildings.Controls.Continuous.LimPID con2(
    controllerType=Modelica.Blocks.Types.SimpleController.PI,
    Td=1,
    Ti=10,
    k=0.1) "Controller";
  Sources.MassFlowSource_T                 sou(
    redeclare package Medium = Medium,
    use_T_in=false,
    nPorts=2,
    m_flow=2*m_flow_nominal,
    T=293.15) "Source";
equation 
  connect(senTem1.T, con1.u_m);
  connect(TSet.y, con1.u_s);
  connect(con1.y, heaSte.u);
  connect(heaSte.port_b, senTem1.port_a);
  connect(senTem2.T, con2.u_m);
  connect(TSet.y, con2.u_s);
  connect(con2.y, heaDyn.u);
  connect(heaDyn.port_b, senTem2.port_a);

  connect(heaSte.port_a, sou.ports[1]);
  connect(sou.ports[2], heaDyn.port_a);
  connect(senTem2.port_b, sin.ports[1]);
  connect(senTem1.port_b, sin.ports[2]);
end HeaterCoolerPrescribed;

Buildings.Fluid.HeatExchangers.Examples.DryEffectivenessNTU Buildings.Fluid.HeatExchangers.Examples.DryEffectivenessNTU

Model that demonstrates use of a heat exchanger without condensation that uses the epsilon-NTU relation

Buildings.Fluid.HeatExchangers.Examples.DryEffectivenessNTU

Information

Extends from Modelica.Icons.Example (Icon for runnable examples).

Parameters

TypeNameDefaultDescription
SpecificHeatCapacitycp1Medium1.specificHeatCapacity...Specific heat capacity of medium 2 [J/(kg.K)]
SpecificHeatCapacitycp2Medium2.specificHeatCapacity...Specific heat capacity of medium 2 [J/(kg.K)]
MassFlowRatem1_flow5Nominal mass flow rate medium 1 [kg/s]
MassFlowRatem2_flowm1_flow*cp1/cp2Nominal mass flow rate medium 2 [kg/s]

Modelica definition

model DryEffectivenessNTU 
  "Model that demonstrates use of a heat exchanger without condensation that uses the epsilon-NTU relation"
  extends Modelica.Icons.Example;

 package Medium1 = Buildings.Media.ConstantPropertyLiquidWater;
 package Medium2 = Buildings.Media.IdealGases.SimpleAir;

 parameter Modelica.SIunits.SpecificHeatCapacity cp1=
 Medium1.specificHeatCapacityCp(
      Medium1.setState_pTX(Medium1.p_default, Medium1.T_default, Medium1.X_default)) 
    "Specific heat capacity of medium 2";
 parameter Modelica.SIunits.SpecificHeatCapacity cp2=
 Medium2.specificHeatCapacityCp(
      Medium2.setState_pTX(Medium2.p_default, Medium2.T_default, Medium2.X_default)) 
    "Specific heat capacity of medium 2";
 parameter Modelica.SIunits.MassFlowRate m1_flow = 5 
    "Nominal mass flow rate medium 1";
 parameter Modelica.SIunits.MassFlowRate m2_flow = m1_flow*cp1/
      cp2 "Nominal mass flow rate medium 2";

  Buildings.Fluid.Sources.Boundary_pT sin_2(                       redeclare 
      package Medium = Medium2,
    use_p_in=true,
    nPorts=5,
    T=273.15 + 10);
    Modelica.Blocks.Sources.Ramp PIn(
    height=200,
    duration=60,
    offset=101325,
    startTime=100);
  Buildings.Fluid.Sources.Boundary_pT sou_2(                       redeclare 
      package Medium = Medium2, T=273.15 + 5,
    use_p_in=true,
    use_T_in=true,
    nPorts=5);
    Modelica.Blocks.Sources.Ramp TWat(
    height=10,
    duration=60,
    offset=273.15 + 30,
    startTime=60) "Water temperature";
  Modelica.Blocks.Sources.Constant TDb(k=293.15) "Drybulb temperature";
    Modelica.Blocks.Sources.Constant POut(k=101325);
  Buildings.Fluid.Sources.Boundary_pT sin_1(                       redeclare 
      package Medium = Medium1,
    use_p_in=true,
    nPorts=5,
    p=300000,
    T=273.15 + 25);
  Buildings.Fluid.Sources.Boundary_pT sou_1(
    redeclare package Medium = Medium1,
    p=300000 + 5000,
    T=273.15 + 50,
    use_T_in=true,
    nPorts=5);
  Buildings.Fluid.HeatExchangers.DryEffectivenessNTU hexPar(
    redeclare package Medium1 = Medium1,
    redeclare package Medium2 = Medium2,
    dp1_nominal=500,
    dp2_nominal=10,
    m1_flow_nominal=m1_flow,
    m2_flow_nominal=m2_flow,
    Q_flow_nominal=m2_flow*cp2*(24 - 20),
    configuration=Buildings.Fluid.Types.HeatExchangerConfiguration.ParallelFlow,
    show_T=true,
    T_a1_nominal=303.15,
    T_a2_nominal=293.15);

  inner Modelica.Fluid.System system(
    p_ambient=300000,
    T_ambient=313.15);
  Buildings.Fluid.HeatExchangers.DryEffectivenessNTU hexCou(
    redeclare package Medium1 = Medium1,
    redeclare package Medium2 = Medium2,
    dp1_nominal=500,
    dp2_nominal=10,
    m1_flow_nominal=m1_flow,
    m2_flow_nominal=m2_flow,
    Q_flow_nominal=m2_flow*cp2*(24 - 20),
    configuration=Buildings.Fluid.Types.HeatExchangerConfiguration.CounterFlow,
    show_T=true,
    T_a1_nominal=303.15,
    T_a2_nominal=293.15);
  Buildings.Fluid.HeatExchangers.DryEffectivenessNTU hexCroC1Mix(
    redeclare package Medium1 = Medium1,
    redeclare package Medium2 = Medium2,
    dp1_nominal=500,
    dp2_nominal=10,
    m1_flow_nominal=m1_flow,
    m2_flow_nominal=m2_flow,
    Q_flow_nominal=m2_flow*cp2*(24 - 20),
    configuration=Buildings.Fluid.Types.HeatExchangerConfiguration.CrossFlowStream1MixedStream2Unmixed,
    show_T=true,
    T_a1_nominal=303.15,
    T_a2_nominal=293.15);
  Buildings.Fluid.HeatExchangers.DryEffectivenessNTU hexCroC1Unm(
    redeclare package Medium1 = Medium1,
    redeclare package Medium2 = Medium2,
    dp1_nominal=500,
    dp2_nominal=10,
    m1_flow_nominal=m1_flow,
    m2_flow_nominal=m2_flow,
    Q_flow_nominal=m2_flow*cp2*(24 - 20),
    configuration=Buildings.Fluid.Types.HeatExchangerConfiguration.CrossFlowStream1UnmixedStream2Mixed,
    show_T=true,
    T_a1_nominal=303.15,
    T_a2_nominal=293.15);
  Buildings.Fluid.HeatExchangers.DryEffectivenessNTU hexCroUnm(
    redeclare package Medium1 = Medium1,
    redeclare package Medium2 = Medium2,
    dp1_nominal=500,
    dp2_nominal=10,
    m1_flow_nominal=m1_flow,
    m2_flow_nominal=m2_flow,
    Q_flow_nominal=m2_flow*cp2*(24 - 20),
    configuration=Buildings.Fluid.Types.HeatExchangerConfiguration.CrossFlowUnmixed,
    show_T=true,
    T_a1_nominal=303.15,
    T_a2_nominal=293.15);
  Modelica.Blocks.Sources.Trapezoid trapezoid(
    amplitude=5000,
    rising=10,
    width=100,
    falling=10,
    period=3600,
    offset=300000);
equation 
  connect(PIn.y,sou_2. p_in);
  connect(TDb.y, sou_2.T_in);
  connect(TWat.y, sou_1.T_in);
  connect(sou_1.ports[1], hexPar.port_a1);
  connect(hexPar.port_a2, sou_2.ports[1]);
  connect(POut.y, sin_2.p_in);
  connect(hexPar.port_b1, sin_1.ports[1]);
  connect(sin_2.ports[1], hexPar.port_b2);
  connect(hexCou.port_a1, sou_1.ports[2]);
  connect(hexCroC1Mix.port_a1, sou_1.ports[3]);
  connect(hexCroC1Unm.port_a1, sou_1.ports[4]);
  connect(hexCou.port_b2, sin_2.ports[2]);
  connect(hexCroC1Mix.port_b2, sin_2.ports[3]);
  connect(hexCroC1Unm.port_b2, sin_2.ports[4]);
  connect(hexCou.port_b1, sin_1.ports[2]);
  connect(hexCroC1Mix.port_b1, sin_1.ports[3]);
  connect(hexCroC1Unm.port_b1, sin_1.ports[4]);
  connect(hexCou.port_a2, sou_2.ports[2]);
  connect(hexCroC1Mix.port_a2, sou_2.ports[3]);
  connect(hexCroC1Unm.port_a2, sou_2.ports[4]);
  connect(hexCroUnm.port_a1, sou_1.ports[5]);
  connect(hexCroUnm.port_b2, sin_2.ports[5]);
  connect(hexCroUnm.port_b1, sin_1.ports[5]);
  connect(hexCroUnm.port_a2, sou_2.ports[5]);
  connect(trapezoid.y, sin_1.p_in);
end DryEffectivenessNTU;

Buildings.Fluid.HeatExchangers.Examples.DryEffectivenessNTUMassFlow Buildings.Fluid.HeatExchangers.Examples.DryEffectivenessNTUMassFlow

Model of epsilon-NTU dry coil that tests variable mass flow rates

Buildings.Fluid.HeatExchangers.Examples.DryEffectivenessNTUMassFlow

Information

Extends from Modelica.Icons.Example (Icon for runnable examples), Buildings.Fluid.HeatExchangers.Examples.BaseClasses.EffectivenessNTUMassFlow (Partial model of epsilon-NTU coil that tests variable mass flow rates).

Parameters

TypeNameDefaultDescription
TemperatureT_a1_nominal5 + 273.15[K]
TemperatureT_b1_nominal10 + 273.15[K]
TemperatureT_a2_nominal30 + 273.15[K]
TemperatureT_b2_nominal15 + 273.15[K]
HeatFlowRateQ_flow_nominalm1_flow_nominal*4200*(T_a1_n...Nominal heat transfer [W]
MassFlowRatem1_flow_nominal0.1Nominal mass flow rate medium 1 [kg/s]
MassFlowRatem2_flow_nominalm1_flow_nominal*4200/1000*(T...Nominal mass flow rate medium 2 [kg/s]

Modelica definition

model DryEffectivenessNTUMassFlow 
  "Model of epsilon-NTU dry coil that tests variable mass flow rates"
  extends Modelica.Icons.Example;
  extends Buildings.Fluid.HeatExchangers.Examples.BaseClasses.EffectivenessNTUMassFlow
    (
    sou_1(nPorts=1),
    sin_1(nPorts=1),
    sou_2(nPorts=1),
    sin_2(nPorts=1));

  Buildings.Fluid.HeatExchangers.DryEffectivenessNTU hex(
    redeclare package Medium1 = Medium1,
    redeclare package Medium2 = Medium2,
    m1_flow_nominal=m1_flow_nominal,
    m2_flow_nominal=m2_flow_nominal,
    dp2_nominal(displayUnit="Pa") = 200,
    configuration=Buildings.Fluid.Types.HeatExchangerConfiguration.CounterFlow,
    allowFlowReversal1=true,
    allowFlowReversal2=true,
    dp1_nominal(displayUnit="Pa") = 3000,
    Q_flow_nominal=Q_flow_nominal,
    T_a1_nominal=T_a1_nominal,
    T_a2_nominal=T_a2_nominal,
    show_T=true);

  Buildings.Fluid.Sensors.RelativeHumidityTwoPort senRelHum(
                                                     redeclare package Medium
      = Medium2, m_flow_nominal=m2_flow_nominal,
    initType=Modelica.Blocks.Types.Init.InitialState);
equation 
  connect(sou_1.ports[1], hex.port_a1);
  connect(hex.port_b1, sin_1.ports[1]);
  connect(hex.port_a2, sou_2.ports[1]);
  connect(senRelHum.port_a, hex.port_b2);
  connect(senRelHum.port_b, sin_2.ports[1]);
end DryEffectivenessNTUMassFlow;

Buildings.Fluid.HeatExchangers.Examples.DryEffectivenessNTUPControl Buildings.Fluid.HeatExchangers.Examples.DryEffectivenessNTUPControl

Model that demonstrates use of a heat exchanger without condensation that uses the epsilon-NTU relation with feedback control

Buildings.Fluid.HeatExchangers.Examples.DryEffectivenessNTUPControl

Information

Extends from Modelica.Icons.Example (Icon for runnable examples).

Parameters

TypeNameDefaultDescription
TemperatureT_a1_nominal60 + 273.15Temperature at nominal conditions as port a1 [K]
TemperatureT_b1_nominal50 + 273.15Temperature at nominal conditions as port b1 [K]
TemperatureT_a2_nominal20 + 273.15Temperature at nominal conditions as port a2 [K]
TemperatureT_b2_nominal40 + 273.15Temperature at nominal conditions as port b2 [K]
MassFlowRatem1_flow_nominal5Nominal mass flow rate medium 1 [kg/s]
MassFlowRatem2_flow_nominalm1_flow_nominal*4200/1000*(T...Nominal mass flow rate medium 2 [kg/s]

Modelica definition

model DryEffectivenessNTUPControl 
  "Model that demonstrates use of a heat exchanger without condensation that uses the epsilon-NTU relation with feedback control"
  extends Modelica.Icons.Example;

 package Medium1 = Buildings.Media.ConstantPropertyLiquidWater;
 //package Medium2 = Buildings.Media.PerfectGases.MoistAir;
 //package Medium2 = Buildings.Media.GasesPTDecoupled.MoistAir;
 // package Medium2 = Buildings.Media.GasesPTDecoupled.MoistAirUnsaturated;
 package Medium2 = Buildings.Media.GasesPTDecoupled.SimpleAir;
  parameter Modelica.SIunits.Temperature T_a1_nominal = 60+273.15 
    "Temperature at nominal conditions as port a1";
  parameter Modelica.SIunits.Temperature T_b1_nominal = 50+273.15 
    "Temperature at nominal conditions as port b1";
  parameter Modelica.SIunits.Temperature T_a2_nominal = 20+273.15 
    "Temperature at nominal conditions as port a2";
  parameter Modelica.SIunits.Temperature T_b2_nominal = 40+273.15 
    "Temperature at nominal conditions as port b2";
  parameter Modelica.SIunits.MassFlowRate m1_flow_nominal = 5 
    "Nominal mass flow rate medium 1";
  parameter Modelica.SIunits.MassFlowRate m2_flow_nominal = m1_flow_nominal*4200/1000*(T_a1_nominal-T_b1_nominal)/(T_b2_nominal-T_a2_nominal) 
    "Nominal mass flow rate medium 2";

  Buildings.Fluid.Sources.Boundary_pT sin_2(                       redeclare 
      package Medium = Medium2,
    use_p_in=false,
    p(displayUnit="Pa") = 101325,
    T=303.15,
    nPorts=1);
  Buildings.Fluid.Sources.Boundary_pT sou_2(                       redeclare 
      package Medium = Medium2,
    nPorts=1,
    use_p_in=false,
    use_T_in=false,
    p(displayUnit="Pa") = 101625,
    T=T_a2_nominal);
  Buildings.Fluid.Sources.Boundary_pT sin_1(                       redeclare 
      package Medium = Medium1,
    use_p_in=false,
    p=300000,
    T=293.15,
    nPorts=1);
  Buildings.Fluid.Sources.Boundary_pT sou_1(
    redeclare package Medium = Medium1,
    p=300000 + 9000,
    nPorts=1,
    use_T_in=false,
    T=T_a1_nominal);
  Buildings.Fluid.Sensors.TemperatureTwoPort temSen(redeclare package Medium =
        Medium2, m_flow_nominal=m2_flow_nominal);
  Buildings.Fluid.Actuators.Valves.TwoWayEqualPercentage val(
    redeclare package Medium = Medium1,
    l=0.005,
    m_flow_nominal=m1_flow_nominal,
    dpFixed_nominal=2000 + 3000,
    dpValve_nominal=6000) "Valve model";
  Buildings.Controls.Continuous.LimPID P(
    controllerType=Modelica.Blocks.Types.SimpleController.PI,
    Ti=30,
    k=0.1,
    Td=1);
  Modelica.Blocks.Sources.Pulse     TSet(
    amplitude=5,
    period=3600,
    offset=273.15 + 22) "Setpoint temperature";
  Buildings.Fluid.HeatExchangers.DryEffectivenessNTU hex(
    redeclare package Medium1 = Medium1,
    redeclare package Medium2 = Medium2,
    show_T=true,
    m1_flow_nominal=m1_flow_nominal,
    m2_flow_nominal=m2_flow_nominal,
    Q_flow_nominal=m1_flow_nominal*4200*(T_a1_nominal-T_b1_nominal),
    configuration=Buildings.Fluid.Types.HeatExchangerConfiguration.CounterFlow,
    T_a1_nominal=T_a1_nominal,
    T_a2_nominal=T_a2_nominal,
    dp1_nominal(displayUnit="Pa") = 0,
    dp2_nominal(displayUnit="Pa") = 200 + 100);

  inner Modelica.Fluid.System system;
equation 
  connect(val.port_b, hex.port_a1);
  connect(sou_1.ports[1], val.port_a);
  connect(sou_2.ports[1], hex.port_a2);
  connect(hex.port_b2, temSen.port_a);
  connect(TSet.y, P.u_s);
  connect(temSen.T, P.u_m);
  connect(P.y, val.y);
  connect(hex.port_b1, sin_1.ports[1]);
  connect(temSen.port_b, sin_2.ports[1]);
end DryEffectivenessNTUPControl;

Buildings.Fluid.HeatExchangers.Examples.DryCoilCounterFlowMassFlow Buildings.Fluid.HeatExchangers.Examples.DryCoilCounterFlowMassFlow

Model of a cooling coil that tests variable mass flow rates

Buildings.Fluid.HeatExchangers.Examples.DryCoilCounterFlowMassFlow

Information

Extends from Modelica.Icons.Example (Icon for runnable examples), Buildings.Fluid.HeatExchangers.Examples.BaseClasses.EffectivenessNTUMassFlow (Partial model of epsilon-NTU coil that tests variable mass flow rates).

Parameters

TypeNameDefaultDescription
TemperatureT_a1_nominal5 + 273.15[K]
TemperatureT_b1_nominal10 + 273.15[K]
TemperatureT_a2_nominal30 + 273.15[K]
TemperatureT_b2_nominal15 + 273.15[K]
HeatFlowRateQ_flow_nominalm1_flow_nominal*4200*(T_a1_n...Nominal heat transfer [W]
MassFlowRatem1_flow_nominal0.1Nominal mass flow rate medium 1 [kg/s]
MassFlowRatem2_flow_nominalm1_flow_nominal*4200/1000*(T...Nominal mass flow rate medium 2 [kg/s]

Modelica definition

model DryCoilCounterFlowMassFlow 
  "Model of a cooling coil that tests variable mass flow rates"
  extends Modelica.Icons.Example;
  extends Buildings.Fluid.HeatExchangers.Examples.BaseClasses.EffectivenessNTUMassFlow
    (
    sou_1(nPorts=1),
    sin_1(nPorts=1),
    sou_2(nPorts=1),
    sin_2(nPorts=1));

  DryCoilCounterFlow hex(
    redeclare package Medium1 = Medium1,
    redeclare package Medium2 = Medium2,
    show_T=true,
    m1_flow_nominal=m1_flow_nominal,
    m2_flow_nominal=m2_flow_nominal,
    dp2_nominal(displayUnit="Pa") = 200,
    allowFlowReversal1=true,
    allowFlowReversal2=true,
    dp1_nominal(displayUnit="Pa") = 3000,
    UA_nominal=Q_flow_nominal/Buildings.Fluid.HeatExchangers.BaseClasses.lmtd(
        T_a1_nominal,
        T_b1_nominal,
        T_a2_nominal,
        T_b2_nominal));

  inner Modelica.Fluid.System system;
  Sensors.RelativeHumidityTwoPort senRelHum(         redeclare package Medium
      = Medium2, m_flow_nominal=m2_flow_nominal);
equation 
  connect(sou_1.ports[1], hex.port_a1);
  connect(hex.port_b1, sin_1.ports[1]);
  connect(hex.port_a2, sou_2.ports[1]);
  connect(senRelHum.port_a, hex.port_b2);
  connect(senRelHum.port_b, sin_2.ports[1]);
end DryCoilCounterFlowMassFlow;

Buildings.Fluid.HeatExchangers.Examples.WetCoilCounterFlowMassFlow Buildings.Fluid.HeatExchangers.Examples.WetCoilCounterFlowMassFlow

Model of a cooling coil that tests variable mass flow rates

Buildings.Fluid.HeatExchangers.Examples.WetCoilCounterFlowMassFlow

Information

Extends from Modelica.Icons.Example (Icon for runnable examples), Buildings.Fluid.HeatExchangers.Examples.BaseClasses.EffectivenessNTUMassFlow (Partial model of epsilon-NTU coil that tests variable mass flow rates).

Parameters

TypeNameDefaultDescription
TemperatureT_a1_nominal5 + 273.15[K]
TemperatureT_b1_nominal10 + 273.15[K]
TemperatureT_a2_nominal30 + 273.15[K]
TemperatureT_b2_nominal15 + 273.15[K]
HeatFlowRateQ_flow_nominalm1_flow_nominal*4200*(T_a1_n...Nominal heat transfer [W]
MassFlowRatem1_flow_nominal0.1Nominal mass flow rate medium 1 [kg/s]
MassFlowRatem2_flow_nominalm1_flow_nominal*4200/1000*(T...Nominal mass flow rate medium 2 [kg/s]

Modelica definition

model WetCoilCounterFlowMassFlow 
  "Model of a cooling coil that tests variable mass flow rates"
  extends Modelica.Icons.Example;
  extends Buildings.Fluid.HeatExchangers.Examples.BaseClasses.EffectivenessNTUMassFlow
    (
    sou_1(nPorts=1),
    sin_1(nPorts=1),
    sou_2(nPorts=1),
    sin_2(nPorts=1));

  WetCoilCounterFlow hex(
    redeclare package Medium1 = Medium1,
    redeclare package Medium2 = Medium2,
    m1_flow_nominal=m1_flow_nominal,
    m2_flow_nominal=m2_flow_nominal,
    dp2_nominal(displayUnit="Pa") = 200,
    allowFlowReversal1=true,
    allowFlowReversal2=true,
    dp1_nominal(displayUnit="Pa") = 3000,
    UA_nominal=Q_flow_nominal/Buildings.Fluid.HeatExchangers.BaseClasses.lmtd(
        T_a1_nominal,
        T_b1_nominal,
        T_a2_nominal,
        T_b2_nominal),
    show_T=true);

  inner Modelica.Fluid.System system;
  Sensors.RelativeHumidityTwoPort senRelHum(
    redeclare package Medium = Medium2,
    m_flow_nominal=m2_flow_nominal);
equation 
  connect(sou_1.ports[1], hex.port_a1);
  connect(hex.port_b1, sin_1.ports[1]);
  connect(hex.port_a2, sou_2.ports[1]);
  connect(hex.port_b2, senRelHum.port_a);
  connect(senRelHum.port_b, sin_2.ports[1]);
end WetCoilCounterFlowMassFlow;

Buildings.Fluid.HeatExchangers.Examples.DryCoilCounterFlowPControl Buildings.Fluid.HeatExchangers.Examples.DryCoilCounterFlowPControl

Model that demonstrates use of a heat exchanger without condensation and with feedback control

Buildings.Fluid.HeatExchangers.Examples.DryCoilCounterFlowPControl

Information

Extends from Modelica.Icons.Example (Icon for runnable examples).

Parameters

TypeNameDefaultDescription
TemperatureT_a1_nominal5 + 273.15[K]
TemperatureT_b1_nominal10 + 273.15[K]
TemperatureT_a2_nominal30 + 273.15[K]
TemperatureT_b2_nominal15 + 273.15[K]
MassFlowRatem1_flow_nominal0.1Nominal mass flow rate medium 1 [kg/s]
MassFlowRatem2_flow_nominalm1_flow_nominal*4200/1000*(T...Nominal mass flow rate medium 2 [kg/s]

Modelica definition

model DryCoilCounterFlowPControl 
  "Model that demonstrates use of a heat exchanger without condensation and with feedback control"
  extends Modelica.Icons.Example;
  package Medium1 = Buildings.Media.ConstantPropertyLiquidWater;
  package Medium2 = Buildings.Media.PerfectGases.MoistAirUnsaturated;
  //package Medium2 = Buildings.Media.GasesPTDecoupled.MoistAir;
  //package Medium2 = Buildings.Media.GasesPTDecoupled.MoistAirUnsaturated;
  //package Medium2 = Buildings.Media.GasesConstantDensity.MoistAir;
  parameter Modelica.SIunits.Temperature T_a1_nominal=5 + 273.15;
  parameter Modelica.SIunits.Temperature T_b1_nominal=10 + 273.15;
  parameter Modelica.SIunits.Temperature T_a2_nominal=30 + 273.15;
  parameter Modelica.SIunits.Temperature T_b2_nominal=15 + 273.15;
  parameter Modelica.SIunits.MassFlowRate m1_flow_nominal=0.1 
    "Nominal mass flow rate medium 1";
  parameter Modelica.SIunits.MassFlowRate m2_flow_nominal=m1_flow_nominal*4200/
      1000*(T_a1_nominal - T_b1_nominal)/(T_b2_nominal - T_a2_nominal) 
    "Nominal mass flow rate medium 2";
  Buildings.Fluid.Sources.Boundary_pT sin_2(
    redeclare package Medium = Medium2,
    nPorts=1,
    use_p_in=false,
    p(displayUnit="Pa") = 101325,
    T=303.15);
  Buildings.Fluid.Sources.Boundary_pT sou_2(
    redeclare package Medium = Medium2,
    nPorts=1,
    T=T_a2_nominal,
    X={0.02,1 - 0.02},
    use_T_in=true,
    use_X_in=true,
    p(displayUnit="Pa") = 101325 + 300);
  Buildings.Fluid.Sources.Boundary_pT sin_1(
    redeclare package Medium = Medium1,
    nPorts=1,
    use_p_in=false,
    p=300000,
    T=293.15);
  Buildings.Fluid.Sources.Boundary_pT sou_1(
    redeclare package Medium = Medium1,
    nPorts=1,
    use_T_in=true,
    p=300000 + 12000);
  Fluid.FixedResistances.FixedResistanceDpM res_2(
    from_dp=true,
    redeclare package Medium = Medium2,
    dp_nominal=100,
    m_flow_nominal=m2_flow_nominal);
  Fluid.FixedResistances.FixedResistanceDpM res_1(
    from_dp=true,
    redeclare package Medium = Medium1,
    dp_nominal=3000,
    m_flow_nominal=m1_flow_nominal);
  Buildings.Fluid.Sensors.TemperatureTwoPort temSen(redeclare package Medium =
               Medium2, m_flow_nominal=m2_flow_nominal);
  Buildings.Fluid.Actuators.Valves.TwoWayEqualPercentage val(
    redeclare package Medium = Medium1,
    m_flow_nominal=m1_flow_nominal,
    dpValve_nominal=6000) "Valve model";
  Modelica.Blocks.Sources.TimeTable TSet(table=[0,288.15; 600,288.15; 600,
        298.15; 1200,298.15; 1800,283.15; 2400,283.15; 2400,288.15]) 
    "Setpoint temperature";
  Buildings.Fluid.HeatExchangers.DryCoilCounterFlow hex(
    redeclare package Medium1 = Medium1,
    redeclare package Medium2 = Medium2,
    m1_flow_nominal=m1_flow_nominal,
    m2_flow_nominal=m2_flow_nominal,
    dp2_nominal(displayUnit="Pa") = 200,
    allowFlowReversal1=true,
    allowFlowReversal2=true,
    dp1_nominal(displayUnit="Pa") = 3000,
    UA_nominal=m1_flow_nominal*4200*(T_a1_nominal - T_b1_nominal)/
       Buildings.Fluid.HeatExchangers.BaseClasses.lmtd(
        T_a1_nominal,
        T_b1_nominal,
        T_a2_nominal,
        T_b2_nominal),
    show_T=true);
  inner Modelica.Fluid.System system;
  Modelica.Blocks.Sources.Constant const(k=0.8);
  Buildings.Utilities.Psychrometrics.X_pTphi x_pTphi(use_p_in=false);
  Modelica.Blocks.Sources.Constant const1(k=T_a2_nominal);
  Buildings.Controls.Continuous.LimPID con(
    Td=1,
    reverseAction=true,
    yMin=0,
    controllerType=Modelica.Blocks.Types.SimpleController.PI,
    k=0.1,
    Ti=60) "Controller";
  Modelica.Blocks.Sources.Ramp TWat(
    height=30,
    offset=T_a1_nominal,
    startTime=300,
    duration=2000) "Water temperature, raised to high value at t=3000 s";
equation 
  connect(hex.port_b1, res_1.port_a);
  connect(val.port_b, hex.port_a1);
  connect(sou_1.ports[1], val.port_a);
  connect(sin_1.ports[1], res_1.port_b);
  connect(sin_2.ports[1], res_2.port_b);
  connect(sou_2.ports[1], hex.port_a2);
  connect(temSen.port_b, res_2.port_a);
  connect(x_pTphi.X, sou_2.X_in);
  connect(const.y, x_pTphi.phi);
  connect(const1.y, x_pTphi.T);
  connect(const1.y, sou_2.T_in);
  connect(TSet.y, con.u_s);
  connect(temSen.T, con.u_m);
  connect(TWat.y, sou_1.T_in);
  connect(con.y, val.y);
  connect(temSen.port_a, hex.port_b2);
end DryCoilCounterFlowPControl;

Buildings.Fluid.HeatExchangers.Examples.WetCoilCounterFlowPControl Buildings.Fluid.HeatExchangers.Examples.WetCoilCounterFlowPControl

Model that demonstrates use of a heat exchanger with condensation and with feedback control

Buildings.Fluid.HeatExchangers.Examples.WetCoilCounterFlowPControl

Information

Extends from Modelica.Icons.Example (Icon for runnable examples).

Parameters

TypeNameDefaultDescription
TemperatureT_a1_nominal5 + 273.15[K]
TemperatureT_b1_nominal10 + 273.15[K]
TemperatureT_a2_nominal30 + 273.15[K]
TemperatureT_b2_nominal15 + 273.15[K]
MassFlowRatem1_flow_nominal0.1Nominal mass flow rate medium 1 [kg/s]
MassFlowRatem2_flow_nominalm1_flow_nominal*4200/1000*(T...Nominal mass flow rate medium 2 [kg/s]

Modelica definition

model WetCoilCounterFlowPControl 
  "Model that demonstrates use of a heat exchanger with condensation and with feedback control"
  extends Modelica.Icons.Example;
  package Medium1 = Buildings.Media.ConstantPropertyLiquidWater;
  package Medium2 = Buildings.Media.PerfectGases.MoistAirUnsaturated;
  //package Medium2 = Buildings.Media.GasesPTDecoupled.MoistAir;
  //package Medium2 = Buildings.Media.GasesPTDecoupled.MoistAirUnsaturated;
  //package Medium2 = Buildings.Media.GasesConstantDensity.MoistAir;
  parameter Modelica.SIunits.Temperature T_a1_nominal=5 + 273.15;
  parameter Modelica.SIunits.Temperature T_b1_nominal=10 + 273.15;
  parameter Modelica.SIunits.Temperature T_a2_nominal=30 + 273.15;
  parameter Modelica.SIunits.Temperature T_b2_nominal=15 + 273.15;
  parameter Modelica.SIunits.MassFlowRate m1_flow_nominal=0.1 
    "Nominal mass flow rate medium 1";
  parameter Modelica.SIunits.MassFlowRate m2_flow_nominal=m1_flow_nominal*4200/
      1000*(T_a1_nominal - T_b1_nominal)/(T_b2_nominal - T_a2_nominal) 
    "Nominal mass flow rate medium 2";
  Buildings.Fluid.Sources.Boundary_pT sin_2(
    redeclare package Medium = Medium2,
    nPorts=1,
    use_p_in=false,
    p(displayUnit="Pa") = 101325,
    T=303.15);
  Buildings.Fluid.Sources.Boundary_pT sou_2(
    redeclare package Medium = Medium2,
    nPorts=1,
    T=T_a2_nominal,
    X={0.02,1 - 0.02},
    use_T_in=true,
    use_X_in=true,
    p(displayUnit="Pa") = 101325 + 300);
  Buildings.Fluid.Sources.Boundary_pT sin_1(
    redeclare package Medium = Medium1,
    nPorts=1,
    use_p_in=false,
    p=300000,
    T=293.15);
  Buildings.Fluid.Sources.Boundary_pT sou_1(
    redeclare package Medium = Medium1,
    nPorts=1,
    use_T_in=true,
    p=300000 + 12000);
  Fluid.FixedResistances.FixedResistanceDpM res_2(
    from_dp=true,
    redeclare package Medium = Medium2,
    dp_nominal=100,
    m_flow_nominal=m2_flow_nominal);
  Fluid.FixedResistances.FixedResistanceDpM res_1(
    from_dp=true,
    redeclare package Medium = Medium1,
    dp_nominal=3000,
    m_flow_nominal=m1_flow_nominal);
  Buildings.Fluid.Sensors.TemperatureTwoPort temSen(redeclare package Medium =
               Medium2, m_flow_nominal=m2_flow_nominal);
  Buildings.Fluid.Actuators.Valves.TwoWayEqualPercentage val(
    redeclare package Medium = Medium1,
    m_flow_nominal=m1_flow_nominal,
    dpValve_nominal=6000) "Valve model";
  Modelica.Blocks.Sources.TimeTable TSet(table=[0,288.15; 600,288.15; 600,
        298.15; 1200,298.15; 1800,283.15; 2400,283.15; 2400,288.15]) 
    "Setpoint temperature";
  Buildings.Fluid.HeatExchangers.WetCoilCounterFlow hex(
    redeclare package Medium1 = Medium1,
    redeclare package Medium2 = Medium2,
    m1_flow_nominal=m1_flow_nominal,
    m2_flow_nominal=m2_flow_nominal,
    dp2_nominal(displayUnit="Pa") = 200,
    allowFlowReversal1=true,
    allowFlowReversal2=true,
    dp1_nominal(displayUnit="Pa") = 3000,
    UA_nominal=2*m1_flow_nominal*4200*(T_a1_nominal - T_b1_nominal)/
      Buildings.Fluid.HeatExchangers.BaseClasses.lmtd(
        T_a1_nominal,
        T_b1_nominal,
        T_a2_nominal,
        T_b2_nominal),
    show_T=true);
  inner Modelica.Fluid.System system;
  Modelica.Blocks.Sources.Constant const(k=0.8);
  Buildings.Utilities.Psychrometrics.X_pTphi x_pTphi(use_p_in=false);
  Modelica.Blocks.Sources.Constant const1(k=T_a2_nominal);
  Buildings.Controls.Continuous.LimPID con(
    Td=1,
    reverseAction=true,
    yMin=0,
    controllerType=Modelica.Blocks.Types.SimpleController.PI,
    k=0.1,
    Ti=60) "Controller";
  Modelica.Blocks.Sources.Ramp TWat(
    height=30,
    offset=T_a1_nominal,
    startTime=300,
    duration=2000) "Water temperature, raised to high value at t=3000 s";
equation 
  connect(hex.port_b1, res_1.port_a);
  connect(val.port_b, hex.port_a1);
  connect(sou_1.ports[1], val.port_a);
  connect(sin_1.ports[1], res_1.port_b);
  connect(sin_2.ports[1], res_2.port_b);
  connect(sou_2.ports[1], hex.port_a2);
  connect(hex.port_b2, temSen.port_a);
  connect(temSen.port_b, res_2.port_a);
  connect(x_pTphi.X, sou_2.X_in);
  connect(const.y, x_pTphi.phi);
  connect(const1.y, x_pTphi.T);
  connect(const1.y, sou_2.T_in);
  connect(TSet.y, con.u_s);
  connect(temSen.T, con.u_m);
  connect(TWat.y, sou_1.T_in);
  connect(con.y, val.y);
end WetCoilCounterFlowPControl;

Buildings.Fluid.HeatExchangers.Examples.DryCoilDiscretized Buildings.Fluid.HeatExchangers.Examples.DryCoilDiscretized

Model that demonstrates use of a finite volume model of a heat exchanger without condensation

Buildings.Fluid.HeatExchangers.Examples.DryCoilDiscretized

Information

Extends from Modelica.Icons.Example (Icon for runnable examples).

Parameters

TypeNameDefaultDescription
TemperatureT_a1_nominal60 + 273.15[K]
TemperatureT_b1_nominal40 + 273.15[K]
TemperatureT_a2_nominal5 + 273.15[K]
TemperatureT_b2_nominal20 + 273.15[K]
MassFlowRatem1_flow_nominal5Nominal mass flow rate medium 1 [kg/s]
MassFlowRatem2_flow_nominalm1_flow_nominal*4200/1000*(T...Nominal mass flow rate medium 2 [kg/s]

Modelica definition

model DryCoilDiscretized 
  "Model that demonstrates use of a finite volume model of a heat exchanger without condensation"
  extends Modelica.Icons.Example;

  package Medium1 = Buildings.Media.ConstantPropertyLiquidWater;
  package Medium2 = Buildings.Media.GasesPTDecoupled.MoistAirUnsaturated;

  parameter Modelica.SIunits.Temperature T_a1_nominal = 60+273.15;
  parameter Modelica.SIunits.Temperature T_b1_nominal = 40+273.15;
  parameter Modelica.SIunits.Temperature T_a2_nominal =  5+273.15;
  parameter Modelica.SIunits.Temperature T_b2_nominal = 20+273.15;
  parameter Modelica.SIunits.MassFlowRate m1_flow_nominal = 5 
    "Nominal mass flow rate medium 1";
  parameter Modelica.SIunits.MassFlowRate m2_flow_nominal = m1_flow_nominal*4200/1000*(T_a1_nominal-T_b1_nominal)/(T_b2_nominal-T_a2_nominal) 
    "Nominal mass flow rate medium 2";

  Buildings.Fluid.HeatExchangers.DryCoilDiscretized hex(
    redeclare package Medium1 = Medium1,
    redeclare package Medium2 = Medium2,
    nPipPar=1,
    nPipSeg=3,
    nReg=2,
    m1_flow_nominal=m1_flow_nominal,
    m2_flow_nominal=m2_flow_nominal,
    UA_nominal=m1_flow_nominal*4200*(T_a1_nominal-T_b1_nominal)/
      Buildings.Fluid.HeatExchangers.BaseClasses.lmtd(
        T_a1_nominal,
        T_b1_nominal,
        T_a2_nominal,
        T_b2_nominal),
    dp2_nominal=200,
    dp1_nominal=5000,
    show_T=true);
  Buildings.Fluid.Sources.Boundary_pT sin_2(                       redeclare 
      package Medium = Medium2, T=303.15,
    use_p_in=true,
    nPorts=1);
    Modelica.Blocks.Sources.Ramp PIn(
    offset=101525,
    height=-199,
    duration=60,
    startTime=120);
  Buildings.Fluid.Sources.Boundary_pT sou_2(                       redeclare 
      package Medium = Medium2,
    use_p_in=true,
    use_T_in=true,
    T=283.15,
    nPorts=1);
    Modelica.Blocks.Sources.Ramp TWat(
    duration=60,
    startTime=60,
    height=5,
    offset=273.15 + 60) "Water temperature";
  Modelica.Blocks.Sources.Constant TDb(k=273.15 + 5) "Drybulb temperature";
    Modelica.Blocks.Sources.Constant POut(k=101325);
  Buildings.Fluid.Sources.Boundary_pT sin_1(                       redeclare 
      package Medium = Medium1,
    p=300000,
    T=293.15,
    use_p_in=true,
    nPorts=1);
  Buildings.Fluid.Sources.Boundary_pT sou_1(
    redeclare package Medium = Medium1,
    p=300000 + 5000,
    use_T_in=true,
    T=293.15,
    nPorts=1);
    Modelica.Blocks.Sources.Ramp PSin_1(
    startTime=240,
    offset=300000,
    height=4990,
    duration=60);
  inner Modelica.Fluid.System system;
equation 
  connect(PIn.y,sou_2. p_in);
  connect(TDb.y, sou_2.T_in);
  connect(TWat.y, sou_1.T_in);
  connect(PSin_1.y, sin_1.p_in);
  connect(sou_1.ports[1], hex.port_a1);
  connect(sou_2.ports[1], hex.port_a2);
  connect(POut.y, sin_2.p_in);
  connect(sin_2.ports[1], hex.port_b2);
  connect(hex.port_b1, sin_1.ports[1]);
end DryCoilDiscretized;

Buildings.Fluid.HeatExchangers.Examples.WetCoilDiscretized Buildings.Fluid.HeatExchangers.Examples.WetCoilDiscretized

Model that demonstrates use of a finite volume model of a heat exchanger with condensation

Buildings.Fluid.HeatExchangers.Examples.WetCoilDiscretized

Information

Extends from Modelica.Icons.Example (Icon for runnable examples).

Parameters

TypeNameDefaultDescription
TemperatureT_a1_nominal5 + 273.15[K]
TemperatureT_b1_nominal10 + 273.15[K]
TemperatureT_a2_nominal30 + 273.15[K]
TemperatureT_b2_nominal10 + 273.15[K]
MassFlowRatem1_flow_nominal5Nominal mass flow rate medium 1 [kg/s]
MassFlowRatem2_flow_nominalm1_flow_nominal*4200/1000*(T...Nominal mass flow rate medium 2 [kg/s]

Modelica definition

model WetCoilDiscretized 
  "Model that demonstrates use of a finite volume model of a heat exchanger with condensation"
  extends Modelica.Icons.Example;

  package Medium1 = Buildings.Media.ConstantPropertyLiquidWater;
  package Medium2 = Buildings.Media.GasesPTDecoupled.MoistAirUnsaturated;
  parameter Modelica.SIunits.Temperature T_a1_nominal = 5+273.15;
  parameter Modelica.SIunits.Temperature T_b1_nominal = 10+273.15;
  parameter Modelica.SIunits.Temperature T_a2_nominal = 30+273.15;
  parameter Modelica.SIunits.Temperature T_b2_nominal = 10+273.15;
  parameter Modelica.SIunits.MassFlowRate m1_flow_nominal = 5 
    "Nominal mass flow rate medium 1";
  parameter Modelica.SIunits.MassFlowRate m2_flow_nominal = m1_flow_nominal*4200/1000*(T_a1_nominal-T_b1_nominal)/(T_b2_nominal-T_a2_nominal) 
    "Nominal mass flow rate medium 2";

  Buildings.Fluid.HeatExchangers.WetCoilDiscretized hex(
    redeclare package Medium1 = Medium1,
    redeclare package Medium2 = Medium2,
    m1_flow_nominal=m1_flow_nominal,
    m2_flow_nominal=m2_flow_nominal,
    dp2_nominal(displayUnit="Pa") = 200,
    nPipPar=1,
    nPipSeg=3,
    nReg=2,
    dp1_nominal(displayUnit="Pa") = 5000,
    UA_nominal=m1_flow_nominal*4200*(T_a1_nominal - T_b1_nominal)/
        Buildings.Fluid.HeatExchangers.BaseClasses.lmtd(
        T_a1_nominal,
        T_b1_nominal,
        T_a2_nominal,
        T_b2_nominal),
    show_T=true);
  Buildings.Fluid.Sources.Boundary_pT sin_2(                       redeclare 
      package Medium = Medium2,
    use_p_in=false,
    p=101325,
    T=303.15,
    nPorts=1);
    Modelica.Blocks.Sources.Ramp PIn(
    duration=60,
    height=-200,
    startTime=120,
    offset=101525);
  Buildings.Fluid.Sources.Boundary_pT sou_2(                       redeclare 
      package Medium = Medium2,
    use_p_in=true,
    nPorts=1,
    use_T_in=false,
    T=293.15);
    Modelica.Blocks.Sources.Ramp TWat(
    duration=60,
    height=15,
    offset=273.15 + 5,
    startTime=120) "Water temperature";
  Buildings.Fluid.Sources.Boundary_pT sin_1(                       redeclare 
      package Medium = Medium1,
    p=300000,
    T=293.15,
    use_p_in=true,
    nPorts=1);
  Buildings.Fluid.Sources.Boundary_pT sou_1(
    redeclare package Medium = Medium1,
    p=300000 + 5000,
    use_T_in=true,
    T=293.15,
    nPorts=1);
    Modelica.Blocks.Sources.Ramp PSin_1(
    duration=60,
    height=5000,
    startTime=240,
    offset=300000);
  inner Modelica.Fluid.System system;
equation 
  connect(TWat.y, sou_1.T_in);
  connect(PSin_1.y, sin_1.p_in);
  connect(sou_1.ports[1], hex.port_a1);
  connect(sou_2.ports[1], hex.port_a2);
  connect(PIn.y, sou_2.p_in);
  connect(hex.port_b1, sin_1.ports[1]);
  connect(hex.port_b2, sin_2.ports[1]);
end WetCoilDiscretized;

Buildings.Fluid.HeatExchangers.Examples.DryCoilDiscretizedPControl Buildings.Fluid.HeatExchangers.Examples.DryCoilDiscretizedPControl

Model that demonstrates use of a finite volume model of a heat exchanger without condensation and with feedback control

Buildings.Fluid.HeatExchangers.Examples.DryCoilDiscretizedPControl

Information

Extends from Modelica.Icons.Example (Icon for runnable examples).

Parameters

TypeNameDefaultDescription
TemperatureT_a1_nominal60 + 273.15[K]
TemperatureT_b1_nominal50 + 273.15[K]
TemperatureT_a2_nominal20 + 273.15[K]
TemperatureT_b2_nominal40 + 273.15[K]
MassFlowRatem1_flow_nominal5Nominal mass flow rate medium 1 [kg/s]
MassFlowRatem2_flow_nominalm1_flow_nominal*4200/1000*(T...Nominal mass flow rate medium 2 [kg/s]

Modelica definition

model DryCoilDiscretizedPControl 
  "Model that demonstrates use of a finite volume model of a heat exchanger without condensation and with feedback control"
  extends Modelica.Icons.Example;

 package Medium1 = Buildings.Media.ConstantPropertyLiquidWater;
 //package Medium2 = Buildings.Media.PerfectGases.MoistAir;
 //package Medium2 = Buildings.Media.GasesPTDecoupled.MoistAir;
 // package Medium2 = Buildings.Media.GasesPTDecoupled.MoistAirUnsaturated;
 package Medium2 = Buildings.Media.GasesPTDecoupled.SimpleAir;
  parameter Modelica.SIunits.Temperature T_a1_nominal = 60+273.15;
  parameter Modelica.SIunits.Temperature T_b1_nominal = 50+273.15;
  parameter Modelica.SIunits.Temperature T_a2_nominal = 20+273.15;
  parameter Modelica.SIunits.Temperature T_b2_nominal = 40+273.15;
  parameter Modelica.SIunits.MassFlowRate m1_flow_nominal = 5 
    "Nominal mass flow rate medium 1";
  parameter Modelica.SIunits.MassFlowRate m2_flow_nominal = m1_flow_nominal*4200/1000*(T_a1_nominal-T_b1_nominal)/(T_b2_nominal-T_a2_nominal) 
    "Nominal mass flow rate medium 2";

  Buildings.Fluid.Sources.Boundary_pT sin_2(                       redeclare 
      package Medium = Medium2,
    use_p_in=false,
    p(displayUnit="Pa") = 101325,
    T=303.15,
    nPorts=1);
  Buildings.Fluid.Sources.Boundary_pT sou_2(                       redeclare 
      package Medium = Medium2,
    nPorts=1,
    use_p_in=false,
    use_T_in=false,
    p(displayUnit="Pa") = 101625,
    T=T_a2_nominal);
  Buildings.Fluid.Sources.Boundary_pT sin_1(                       redeclare 
      package Medium = Medium1,
    p=300000,
    T=293.15,
    use_p_in=true,
    nPorts=1);
  Buildings.Fluid.Sources.Boundary_pT sou_1(
    redeclare package Medium = Medium1,
    p=300000 + 9000,
    nPorts=1,
    use_T_in=false,
    T=T_a1_nominal);
    Modelica.Blocks.Sources.Ramp PSin_1(
    duration=60,
    height=5000,
    startTime=240,
    offset=300000);
  Buildings.Fluid.Sensors.TemperatureTwoPort temSen(redeclare package Medium =
        Medium2, m_flow_nominal=m2_flow_nominal);
  Buildings.Fluid.Actuators.Valves.TwoWayEqualPercentage val(
    redeclare package Medium = Medium1,
    l=0.005,
    m_flow_nominal=m1_flow_nominal,
    filteredOpening=false,
    dpFixed_nominal=2000 + 3000,
    dpValve_nominal=6000) "Valve model";
  Modelica.Blocks.Sources.TimeTable TSet(table=[0,298.15; 600,298.15; 600,
        303.15; 1200,303.15; 1800,298.15; 2400,298.15; 2400,304.15]) 
    "Setpoint temperature";
  Buildings.Fluid.HeatExchangers.DryCoilDiscretized hex(
    redeclare package Medium1 = Medium1,
    redeclare package Medium2 = Medium2,
    show_T=true,
    nPipPar=1,
    nPipSeg=3,
    nReg=4,
    m1_flow_nominal=m1_flow_nominal,
    m2_flow_nominal=m2_flow_nominal,
    UA_nominal=m1_flow_nominal*4200*(T_a1_nominal-T_b1_nominal)/
      Buildings.Fluid.HeatExchangers.BaseClasses.lmtd(
        T_a1_nominal,
        T_b1_nominal,
        T_a2_nominal,
        T_b2_nominal),
    dp1_nominal(displayUnit="Pa") = 0,
    dp2_nominal(displayUnit="Pa") = 300);
  Buildings.Fluid.Actuators.Motors.IdealMotor mot(tOpe=60) "Motor model";
  inner Modelica.Fluid.System system;
  Buildings.Controls.Continuous.LimPID con(
    k=1,
    Ti=60,
    controllerType=Modelica.Blocks.Types.SimpleController.P,
    Td=60) "Controller";
equation 
  connect(PSin_1.y, sin_1.p_in);
  connect(val.port_b, hex.port_a1);
  connect(sou_1.ports[1], val.port_a);
  connect(sou_2.ports[1], hex.port_a2);
  connect(mot.y, val.y);
  connect(hex.port_b2, temSen.port_a);
  connect(TSet.y, con.u_s);
  connect(temSen.T, con.u_m);
  connect(con.y, mot.u);
  connect(hex.port_b1, sin_1.ports[1]);
  connect(temSen.port_b, sin_2.ports[1]);
end DryCoilDiscretizedPControl;

Buildings.Fluid.HeatExchangers.Examples.WetCoilDiscretizedPControl Buildings.Fluid.HeatExchangers.Examples.WetCoilDiscretizedPControl

Model that demonstrates use of a finite volume model of a heat exchanger with condensation and feedback control

Buildings.Fluid.HeatExchangers.Examples.WetCoilDiscretizedPControl

Information

Extends from Modelica.Icons.Example (Icon for runnable examples).

Parameters

TypeNameDefaultDescription
TemperatureT_a1_nominal5 + 273.15[K]
TemperatureT_b1_nominal10 + 273.15[K]
TemperatureT_a2_nominal30 + 273.15[K]
TemperatureT_b2_nominal10 + 273.15[K]
MassFlowRatem1_flow_nominal5Nominal mass flow rate medium 1 [kg/s]
MassFlowRatem2_flow_nominalm1_flow_nominal*4200/1000*(T...Nominal mass flow rate medium 2 [kg/s]

Modelica definition

model WetCoilDiscretizedPControl 
  "Model that demonstrates use of a finite volume model of a heat exchanger with condensation and feedback control"
  extends Modelica.Icons.Example;

  package Medium1 = Buildings.Media.ConstantPropertyLiquidWater;
  package Medium2 = Buildings.Media.GasesConstantDensity.MoistAirUnsaturated;

  parameter Modelica.SIunits.Temperature T_a1_nominal = 5+273.15;
  parameter Modelica.SIunits.Temperature T_b1_nominal = 10+273.15;
  parameter Modelica.SIunits.Temperature T_a2_nominal = 30+273.15;
  parameter Modelica.SIunits.Temperature T_b2_nominal = 10+273.15;
  parameter Modelica.SIunits.MassFlowRate m1_flow_nominal = 5 
    "Nominal mass flow rate medium 1";
  parameter Modelica.SIunits.MassFlowRate m2_flow_nominal = m1_flow_nominal*4200/1000*(T_a1_nominal-T_b1_nominal)/(T_b2_nominal-T_a2_nominal) 
    "Nominal mass flow rate medium 2";

 Buildings.Fluid.Sources.Boundary_pT sin_2(                       redeclare 
      package Medium = Medium2,
    use_p_in=false,
    p=101325,
    T=303.15,
    nPorts=1);
  Buildings.Fluid.Sources.Boundary_pT sou_2(                       redeclare 
      package Medium = Medium2,
    nPorts=1,
    use_p_in=false,
    use_T_in=true,
    p(displayUnit="Pa") = 101525,
    T=293.15);
  Buildings.Fluid.Sources.Boundary_pT sin_1(                       redeclare 
      package Medium = Medium1,
    p=300000,
    T=293.15,
    use_p_in=true,
    nPorts=1);
  Buildings.Fluid.Sources.Boundary_pT sou_1(
    redeclare package Medium = Medium1,
    nPorts=1,
    use_T_in=true,
    p=300000 + 7000,
    T=278.15);
    Modelica.Blocks.Sources.Ramp PSin(
    duration=60,
    height=5000,
    startTime=240,
    offset=300000);
  Buildings.Fluid.Sensors.TemperatureTwoPort temSen(redeclare package Medium =
        Medium2, m_flow_nominal=m2_flow_nominal);
  Buildings.Fluid.Actuators.Valves.TwoWayLinear val(
    redeclare package Medium = Medium1,
    m_flow_nominal=m1_flow_nominal,
    filteredOpening=false,
    dpFixed_nominal=2000,
    dpValve_nominal=5000);
  Modelica.Blocks.Sources.TimeTable TSet(table=[0,293.15; 600,293.15; 600,
        288.15; 1200,288.15; 1800,288.15; 2400,295.15; 2400,295.15]) 
    "Setpoint temperature";
  Buildings.Fluid.HeatExchangers.WetCoilDiscretized hex(
    redeclare package Medium1 = Medium1,
    redeclare package Medium2 = Medium2,
    show_T=true,
    nPipPar=1,
    nPipSeg=3,
    nReg=4,
    m1_flow_nominal=m1_flow_nominal,
    m2_flow_nominal=m2_flow_nominal,
    UA_nominal=m1_flow_nominal*4200*(T_a1_nominal-T_b1_nominal)/
     Buildings.Fluid.HeatExchangers.BaseClasses.lmtd(
        T_a1_nominal,
        T_b1_nominal,
        T_a2_nominal,
        T_b2_nominal),
    dp2_nominal(displayUnit="Pa") = 200,
    dp1_nominal(displayUnit="Pa") = 0);
  inner Modelica.Fluid.System system;
  Modelica.Blocks.Sources.Step TSou_2(
    startTime=3000,
    offset=T_a2_nominal,
    height=-3);
  Modelica.Blocks.Sources.Step TSou_1(
    startTime=3000,
    height=10,
    offset=T_a1_nominal);
  Buildings.Controls.Continuous.LimPID con(
    k=1,
    Ti=60,
    controllerType=Modelica.Blocks.Types.SimpleController.P,
    Td=60,
    reverseAction=true) "Controller";
  Buildings.Fluid.Actuators.Motors.IdealMotor mot(tOpe=60) "Motor model";
equation 
  connect(PSin.y, sin_1.p_in);
  connect(sou_2.ports[1], hex.port_a2);
  connect(hex.port_b2, temSen.port_a);
  connect(val.port_b, hex.port_a1);
  connect(sou_1.ports[1], val.port_a);
  connect(TSou_2.y, sou_2.T_in);
  connect(TSou_1.y, sou_1.T_in);
  connect(TSet.y, con.u_s);
  connect(temSen.T, con.u_m);
  connect(con.y, mot.u);
  connect(mot.y, val.y);
  connect(sin_2.ports[1], temSen.port_b);
  connect(hex.port_b1, sin_1.ports[1]);
end WetCoilDiscretizedPControl;

Automatically generated Wed Feb 12 08:16:30 2014.