Buildings.Fluid.MassExchangers.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.MassExchangers.

Extends from Buildings.BaseClasses.BaseIconExamples (Icon for Examples packages).

Package Content

NameDescription
ConstantEffectiveness  
HumidifierPrescribed  


Buildings.Fluid.MassExchangers.Examples.ConstantEffectiveness

Buildings.Fluid.MassExchangers.Examples.ConstantEffectiveness

Modelica definition

model ConstantEffectiveness
  import Buildings;

 package Medium1 = Buildings.Media.PerfectGases.MoistAirUnsaturated;
 package Medium2 = Buildings.Media.PerfectGases.MoistAirUnsaturated;

  Buildings.Fluid.Sources.Boundary_pT sin_2(                       redeclare 
      package Medium = Medium2, T=273.15 + 10,
    use_p_in=true,
    nPorts=1);
    Modelica.Blocks.Sources.Ramp PIn(
    height=200,
    duration=60,
    offset=101330);
  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,
    T=273.15 + 30,
    X={0.012,1 - 0.012},
    use_p_in=true,
    p=300000,
    nPorts=1);
  Buildings.Fluid.Sources.Boundary_pT sou_1(
    redeclare package Medium = Medium1,
    T=273.15 + 50,
    X={0.012,1 - 0.012},
    use_T_in=true,
    p=100000,
    nPorts=1);
    Modelica.Blocks.Sources.Ramp PSin_1(
    duration=60,
    startTime=240,
    height=100,
    offset=1E5 - 110);
  Buildings.Fluid.MassExchangers.ConstantEffectiveness hex(redeclare package
      Medium1 =
        Medium1, redeclare package Medium2 = Medium2,
    m1_flow(start=5),
    m2_flow(start=5),
    m1_flow_nominal=5,
    m2_flow_nominal=5,
    dp1_nominal=100,
    dp2_nominal=100);
  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(hex.port_a2, sou_2.ports[1]);
  connect(POut.y, sin_2.p_in);
  connect(hex.port_b1, sin_1.ports[1]);
  connect(hex.port_b2, sin_2.ports[1]);
end ConstantEffectiveness;

Buildings.Fluid.MassExchangers.Examples.HumidifierPrescribed

Buildings.Fluid.MassExchangers.Examples.HumidifierPrescribed

Information


Model that tests the basic class that is used for the humidifier model. It adds and removes water for forward and reverse flow. The top and bottom models should give similar results, although the sign of the humidity difference over the components differ because of the reverse flow. The model uses assert statements that will be triggered if results that are expected to be close to each other differ by more than a prescribed threshold.

Parameters

TypeNameDefaultDescription
MassFlowRatemWat0_flow0.001Nominal water mass flow rate [kg/s]

Modelica definition

model HumidifierPrescribed
  import Buildings;

 package Medium = Buildings.Media.PerfectGases.MoistAirUnsaturated;
 parameter Modelica.SIunits.MassFlowRate mWat0_flow = 0.001 
    "Nominal water mass flow rate";
  Buildings.Fluid.MassExchangers.HumidifierPrescribed hea1(redeclare package
      Medium =
        Medium,
    m_flow_nominal=0.5,
    mWat0_flow=mWat0_flow,
    dp_nominal=50,
    show_T=true) "Heater and cooler";
  Modelica.Blocks.Sources.Constant TDb(k=293.15) "Drybulb temperature";
  Buildings.Fluid.Sources.Boundary_pT sou_1(
    redeclare package Medium = Medium,
    use_T_in=true,
    nPorts=4,
    p(displayUnit="Pa") = 101435,
    T=293.15);
    Buildings.Fluid.FixedResistances.FixedResistanceDpM res_11(
    redeclare package Medium = Medium,
    dp_nominal=5,
    m_flow_nominal=0.5);
    Buildings.Fluid.FixedResistances.FixedResistanceDpM res_12(
    redeclare package Medium = Medium,
    dp_nominal=5,
    m_flow_nominal=0.5);
  Buildings.Fluid.Sources.Boundary_pT sin_1(                       redeclare 
      package Medium = Medium,
    use_p_in=true,
    T=288.15,
    nPorts=4);
    Modelica.Blocks.Sources.Constant POut(k=101325);
    Modelica.Blocks.Sources.Ramp u(
    duration=1,
    startTime=0,
    height=1,
    offset=0) "Control signal";
  Buildings.Fluid.MassExchangers.HumidifierPrescribed hea2(
                                                 redeclare package Medium =
        Medium,
    m_flow_nominal=0.5,
    mWat0_flow=mWat0_flow,
    dp_nominal=50,
    show_T=true) "Heater and cooler";
  Modelica.Blocks.Math.Gain gain(k=-1);
  Buildings.Fluid.MassExchangers.HumidifierPrescribed hea3(redeclare package
      Medium =
        Medium,
    m_flow_nominal=0.5,
    mWat0_flow=mWat0_flow,
    dp_nominal=50,
    show_T=true) "Heater and cooler";
    Buildings.Fluid.FixedResistances.FixedResistanceDpM res_2(
    redeclare package Medium = Medium,
    dp_nominal=5,
    m_flow_nominal=0.5);
    Buildings.Fluid.FixedResistances.FixedResistanceDpM res_3(
    redeclare package Medium = Medium,
    dp_nominal=5,
    m_flow_nominal=0.5);
  Buildings.Fluid.MassExchangers.HumidifierPrescribed hea4(
                                                 redeclare package Medium =
        Medium,
    m_flow_nominal=0.5,
    mWat0_flow=mWat0_flow,
    dp_nominal=50,
    show_T=true) "Heater and cooler";
    Buildings.Fluid.FixedResistances.FixedResistanceDpM res_4(
    redeclare package Medium = Medium,
    dp_nominal=5,
    m_flow_nominal=0.5);
  Buildings.Fluid.MixingVolumes.MixingVolume mix1(
                                           redeclare package Medium = Medium, V=
       0.000001,
    nPorts=2);
  Buildings.Utilities.Diagnostics.AssertEquality ass1(                startTime=
        0.3, threShold=0.05);
  Modelica.Blocks.Sources.RealExpression y1(y=hea2.sta_b.T);
  Modelica.Blocks.Sources.RealExpression y2(y=hea1.sta_b.T);
  Buildings.Utilities.Diagnostics.AssertEquality ass2(                startTime=
        0.3, threShold=0.05);
  Modelica.Blocks.Sources.RealExpression y3(y=hea2.sta_a.T);
  Modelica.Blocks.Sources.RealExpression y4(y=hea1.sta_a.T);
  Buildings.Utilities.Diagnostics.AssertEquality ass3(                startTime=
        0.3, threShold=0.05);
  Modelica.Blocks.Sources.RealExpression y5(y=hea4.sta_b.T);
  Modelica.Blocks.Sources.RealExpression y6(y=hea3.sta_b.T);
  Buildings.Utilities.Diagnostics.AssertEquality ass4(                startTime=
        0.3, threShold=0.05);
  Modelica.Blocks.Sources.RealExpression y7(y=hea4.sta_a.T);
  Modelica.Blocks.Sources.RealExpression y8(y=hea3.sta_a.T);
  Buildings.Fluid.MassExchangers.HumidifierPrescribed hea5(redeclare package
      Medium =
        Medium,
    m_flow_nominal=0.5,
    mWat0_flow=mWat0_flow,
    dp_nominal=50,
    show_T=true) "Heater and cooler";
    Buildings.Fluid.FixedResistances.FixedResistanceDpM res_1(
    redeclare package Medium = Medium,
    dp_nominal=5,
    m_flow_nominal=0.5);
    Buildings.Fluid.FixedResistances.FixedResistanceDpM res_5(
    redeclare package Medium = Medium,
    dp_nominal=5,
    m_flow_nominal=0.5);
  Buildings.Fluid.MassExchangers.HumidifierPrescribed hea6(
                                                 redeclare package Medium =
        Medium,
    m_flow_nominal=0.5,
    mWat0_flow=mWat0_flow,
    dp_nominal=50,
    show_T=true) "Heater and cooler";
  Buildings.Fluid.MassExchangers.HumidifierPrescribed hea7(redeclare package
      Medium =
        Medium,
    m_flow_nominal=0.5,
    mWat0_flow=mWat0_flow,
    dp_nominal=50,
    show_T=true) "Heater and cooler";
    Buildings.Fluid.FixedResistances.FixedResistanceDpM res_6(
    redeclare package Medium = Medium,
    dp_nominal=5,
    m_flow_nominal=0.5);
    Buildings.Fluid.FixedResistances.FixedResistanceDpM res_7(
    redeclare package Medium = Medium,
    dp_nominal=5,
    m_flow_nominal=0.5);
  Buildings.Fluid.MassExchangers.HumidifierPrescribed hea8(
                                                 redeclare package Medium =
        Medium,
    m_flow_nominal=0.5,
    mWat0_flow=mWat0_flow,
    dp_nominal=50,
    show_T=true) "Heater and cooler";
    Buildings.Fluid.FixedResistances.FixedResistanceDpM res_8(
    redeclare package Medium = Medium,
    dp_nominal=5,
    m_flow_nominal=0.5);
  Buildings.Fluid.MixingVolumes.MixingVolume mix2(
                                           redeclare package Medium = Medium, V=
       0.000001,
    nPorts=2);
  Buildings.Utilities.Diagnostics.AssertEquality ass5(                startTime=
        0.3, threShold=0.05);
  Modelica.Blocks.Sources.RealExpression y9(y=hea6.sta_b.T);
  Modelica.Blocks.Sources.RealExpression y10(
                                            y=hea5.sta_b.T);
  Buildings.Utilities.Diagnostics.AssertEquality ass6(                startTime=
        0.3, threShold=0.05);
  Modelica.Blocks.Sources.RealExpression y11(
                                            y=hea6.sta_a.T);
  Modelica.Blocks.Sources.RealExpression y12(
                                            y=hea5.sta_a.T);
  Buildings.Utilities.Diagnostics.AssertEquality ass7(                startTime=
        0.3, threShold=0.05);
  Modelica.Blocks.Sources.RealExpression y13(
                                            y=hea8.sta_b.T);
  Modelica.Blocks.Sources.RealExpression y14(
                                            y=hea7.sta_b.T);
  Buildings.Utilities.Diagnostics.AssertEquality ass8(                startTime=
        0.3, threShold=0.05);
  Modelica.Blocks.Sources.RealExpression y15(
                                            y=hea8.sta_a.T);
  Modelica.Blocks.Sources.RealExpression y16(
                                            y=hea7.sta_a.T);
  Buildings.Utilities.Diagnostics.AssertEquality ass9(                startTime=
        0.3, threShold=0.05);
  Modelica.Blocks.Sources.RealExpression y17(y=hea2.sta_b.T);
  Modelica.Blocks.Sources.RealExpression y18(y=hea5.sta_b.T);
  Buildings.Utilities.Diagnostics.AssertEquality ass10(                startTime=
        0.3, threShold=0.05);
  Modelica.Blocks.Sources.RealExpression y19(y=hea4.sta_a.T);
  Modelica.Blocks.Sources.RealExpression y20(y=hea7.sta_a.T);
  Buildings.Utilities.Diagnostics.AssertEquality ass11(threShold=1E-2, startTime=
        0.3);
  Modelica.Blocks.Sources.RealExpression y21(y=hea2.sta_b.X[1]);
  Modelica.Blocks.Sources.RealExpression y22(y=hea1.sta_b.X[1]);
  Buildings.Utilities.Diagnostics.AssertEquality ass12(threShold=1E-2, startTime=
        0.3);
  Modelica.Blocks.Sources.RealExpression y23(
                                            y=hea2.sta_a.X[1]);
  Modelica.Blocks.Sources.RealExpression y24(
                                            y=hea1.sta_a.X[1]);
  Buildings.Utilities.Diagnostics.AssertEquality ass13(threShold=1E-2, startTime=
        0.3);
  Modelica.Blocks.Sources.RealExpression y25(
                                            y=hea4.sta_b.X[1]);
  Modelica.Blocks.Sources.RealExpression y26(
                                            y=hea3.sta_b.X[1]);
  Buildings.Utilities.Diagnostics.AssertEquality ass14(threShold=1E-2, startTime=
        0.3);
  Modelica.Blocks.Sources.RealExpression y27(
                                            y=hea4.sta_a.X[1]);
  Modelica.Blocks.Sources.RealExpression y28(
                                            y=hea3.sta_a.X[1]);
  Buildings.Utilities.Diagnostics.AssertEquality ass15(threShold=1E-2, startTime=
        0.3);
  Modelica.Blocks.Sources.RealExpression y29(
                                            y=hea6.sta_b.X[1]);
  Modelica.Blocks.Sources.RealExpression y30(
                                            y=hea5.sta_b.X[1]);
  Buildings.Utilities.Diagnostics.AssertEquality ass16(threShold=1E-2, startTime=
        0.3);
  Modelica.Blocks.Sources.RealExpression y31(
                                            y=hea6.sta_a.X[1]);
  Modelica.Blocks.Sources.RealExpression y32(
                                            y=hea5.sta_a.X[1]);
  Buildings.Utilities.Diagnostics.AssertEquality ass17(threShold=1E-2, startTime=
        0.3);
  Modelica.Blocks.Sources.RealExpression y33(
                                            y=hea8.sta_b.X[1]);
  Modelica.Blocks.Sources.RealExpression y34(
                                            y=hea7.sta_b.X[1]);
  Buildings.Utilities.Diagnostics.AssertEquality ass18(threShold=1E-2, startTime=
        0.3);
  Modelica.Blocks.Sources.RealExpression y35(
                                            y=hea8.sta_a.X[1]);
  Modelica.Blocks.Sources.RealExpression y36(
                                            y=hea7.sta_a.X[1]);
  Buildings.Utilities.Diagnostics.AssertEquality ass19(threShold=1E-2, startTime=
        0.3);
  Modelica.Blocks.Sources.RealExpression y37(y=hea2.sta_b.X[1]);
  Modelica.Blocks.Sources.RealExpression y38(y=hea5.sta_b.X[1]);
  Buildings.Utilities.Diagnostics.AssertEquality ass20(threShold=1E-2, startTime=
        0.3);
  Modelica.Blocks.Sources.RealExpression y39(y=hea4.sta_a.X[1]);
  Modelica.Blocks.Sources.RealExpression y40(y=hea7.sta_a.X[1]);
  inner Modelica.Fluid.System system;
equation 
  connect(POut.y,sin_1. p_in);
  connect(TDb.y,sou_1. T_in);
  connect(res_11.port_b, hea1.port_a);
  connect(u.y, hea1.u);
  connect(gain.y, hea2.u);
  connect(u.y, gain.u);
  connect(res_12.port_b, hea2.port_a);
  connect(res_2.port_b, hea3.port_a);
  connect(u.y, hea3.u);
  connect(gain.y, hea4.u);
  connect(res_3.port_b, hea4.port_a);
  connect(hea4.port_b, res_4.port_b);
  connect(hea1.port_b, hea2.port_b);
  connect(y1.y, ass1.u1);
  connect(y2.y, ass1.u2);
  connect(y3.y, ass2.u1);
  connect(y4.y, ass2.u2);
  connect(y5.y, ass3.u1);
  connect(y6.y, ass3.u2);
  connect(y7.y, ass4.u1);
  connect(y8.y, ass4.u2);
  connect(res_1.port_b, hea5.port_a);
  connect(res_5.port_b, hea6.port_a);
  connect(res_6.port_b,hea7. port_a);
  connect(res_7.port_b,hea8. port_a);
  connect(hea8.port_b,res_8. port_b);
  connect(hea5.port_b,hea6. port_b);
  connect(y9.y,ass5. u1);
  connect(y10.y, ass5.u2);
  connect(y11.y, ass6.u1);
  connect(y12.y, ass6.u2);
  connect(y13.y, ass7.u1);
  connect(y14.y, ass7.u2);
  connect(y15.y, ass8.u1);
  connect(y16.y, ass8.u2);
  connect(y17.y,ass9. u1);
  connect(y18.y,ass9. u2);
  connect(y19.y, ass10.u1);
  connect(y20.y, ass10.u2);
  connect(u.y, hea6.u);
  connect(u.y, hea8.u);
  connect(gain.y, hea5.u);
  connect(gain.y, hea7.u);
  connect(y21.y, ass11.u1);
  connect(y22.y, ass11.u2);
  connect(y23.y, ass12.u1);
  connect(y24.y, ass12.u2);
  connect(y25.y, ass13.u1);
  connect(y26.y, ass13.u2);
  connect(y27.y, ass14.u1);
  connect(y28.y, ass14.u2);
  connect(y29.y, ass15.u1);
  connect(y30.y, ass15.u2);
  connect(y31.y, ass16.u1);
  connect(y32.y, ass16.u2);
  connect(y33.y, ass17.u1);
  connect(y34.y, ass17.u2);
  connect(y35.y, ass18.u1);
  connect(y36.y, ass18.u2);
  connect(y37.y, ass19.u1);
  connect(y38.y, ass19.u2);
  connect(y39.y, ass20.u1);
  connect(y40.y, ass20.u2);
  connect(sin_1.ports[1], res_12.port_a);
  connect(sin_1.ports[2], res_3.port_a);
  connect(sou_1.ports[1], res_11.port_a);
  connect(sou_1.ports[2], res_2.port_a);
  connect(sin_1.ports[3], res_1.port_a);
  connect(sin_1.ports[4], res_6.port_a);
  connect(sou_1.ports[3], res_5.port_a);
  connect(sou_1.ports[4], res_7.port_a);
  connect(hea3.port_b, mix1.ports[1]);
  connect(mix1.ports[2], res_4.port_a);
  connect(hea7.port_b, mix2.ports[1]);
  connect(mix2.ports[2], res_8.port_a);
end HumidifierPrescribed;

HTML-documentation generated by Dymola Thu Jun 24 16:54:48 2010.