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

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

Package Content

Name Description
Buildings.Fluid.Interfaces.Examples.ConservationEquation ConservationEquation Model that tests the conservation equation
Buildings.Fluid.Interfaces.Examples.EightPortHeatMassExchanger EightPortHeatMassExchanger EightPortHeatMassExchanger example model
Buildings.Fluid.Interfaces.Examples.FourPortHeatMassExchanger FourPortHeatMassExchanger FourPortHeatMassExchanger example model
Buildings.Fluid.Interfaces.Examples.HeaterCooler_u HeaterCooler_u Model that tests a heat exchanger model with reverse flow
Buildings.Fluid.Interfaces.Examples.Humidifier_u Humidifier_u  
Buildings.Fluid.Interfaces.Examples.PrescribedOutlet PrescribedOutlet Test model for prescribed outlet state
Buildings.Fluid.Interfaces.Examples.PrescribedOutlet_TSetOnly PrescribedOutlet_TSetOnly Test model for prescribed outlet state
Buildings.Fluid.Interfaces.Examples.PrescribedOutlet_Water PrescribedOutlet_Water Test model for prescribed outlet state
Buildings.Fluid.Interfaces.Examples.PrescribedOutlet_X_wSetOnly PrescribedOutlet_X_wSetOnly Test model for prescribed outlet state
Buildings.Fluid.Interfaces.Examples.ReverseFlowHumidifier ReverseFlowHumidifier Model that tests the reverse flow for a humidifier
Buildings.Fluid.Interfaces.Examples.ReverseFlowMassExchanger ReverseFlowMassExchanger Model that tests the reverse flow for a mass exchanger
Buildings.Fluid.Interfaces.Examples.StaticTwoPortConservationEquation StaticTwoPortConservationEquation Model that tests the static two port conservation equation
Buildings.Fluid.Interfaces.Examples.BaseClasses BaseClasses Package with base classes for Buildings.Fluid.Interfaces.Examples

Buildings.Fluid.Interfaces.Examples.ConservationEquation Buildings.Fluid.Interfaces.Examples.ConservationEquation

Model that tests the conservation equation

Buildings.Fluid.Interfaces.Examples.ConservationEquation

Information

Model that tests the conservation equations that are used for the heat and mass balance.

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

Modelica definition

model ConservationEquation "Model that tests the conservation equation" extends Modelica.Icons.Example; package Medium = Buildings.Media.Water "Medium model"; Buildings.Fluid.Interfaces.ConservationEquation dyn( redeclare package Medium = Medium, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial, nPorts=2, fluidVolume=0.01, use_mWat_flow=true) "Dynamic conservation equation"; Buildings.Fluid.Interfaces.StaticTwoPortConservationEquation ste( redeclare package Medium = Medium, m_flow_nominal=0.01, show_T=true, prescribedHeatFlowRate=true, use_mWat_flow=true) "Steady-state conservation equation"; Modelica.Blocks.Sources.Constant mWat_flow(k=0) "Water mass flow rate added to the control volume"; Modelica.Blocks.Sources.TimeTable QSen_flow(startTime=0, table=[ 0,-100; 900,-100; 900,0; 1800,0; 1800,100]) "Sensible heat flow rate added to the control volume"; Buildings.Fluid.Sources.Boundary_pT sin( nPorts=2, use_p_in=false, redeclare package Medium = Medium, p=101325, T=283.15); Buildings.Fluid.FixedResistances.PressureDrop res1( from_dp=true, redeclare package Medium = Medium, m_flow_nominal=0.01, dp_nominal=100) "Flow resistance"; Buildings.Fluid.Sources.MassFlowSource_T bou( nPorts=2, redeclare package Medium = Medium, m_flow=0.01) "Boundary condition for mass flow rate"; Buildings.Fluid.FixedResistances.PressureDrop res2( from_dp=true, redeclare package Medium = Medium, m_flow_nominal=0.01, dp_nominal=100) "Flow resistance"; equation connect(QSen_flow.y, dyn.Q_flow); connect(mWat_flow.y, dyn.mWat_flow); connect(bou.ports[1], dyn.ports[1]); connect(res1.port_b, sin.ports[1]); connect(QSen_flow.y, ste.Q_flow); connect(mWat_flow.y, ste.mWat_flow); connect(res2.port_b, sin.ports[2]); connect(ste.port_a, bou.ports[2]); connect(ste.port_b, res2.port_a); connect(dyn.ports[2], res1.port_a); end ConservationEquation;

Buildings.Fluid.Interfaces.Examples.EightPortHeatMassExchanger Buildings.Fluid.Interfaces.Examples.EightPortHeatMassExchanger

EightPortHeatMassExchanger example model

Buildings.Fluid.Interfaces.Examples.EightPortHeatMassExchanger

Information

This example model demonstrates the use of the EightPortHeatMassExchanger model.

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

Parameters

TypeNameDefaultDescription
MassFlowRatem_flow_nominal1Nominal mass flow rate [kg/s]

Modelica definition

model EightPortHeatMassExchanger "EightPortHeatMassExchanger example model" extends Modelica.Icons.Example; package Medium = Buildings.Media.Water; parameter Modelica.SIunits.MassFlowRate m_flow_nominal=1 "Nominal mass flow rate"; Sources.Boundary_pT sin( redeclare package Medium = Medium, nPorts=4) "Mass flow sink"; Sources.MassFlowSource_T sou2( redeclare package Medium = Medium, use_m_flow_in=true, use_T_in=true, nPorts=1) "Mass flow source"; Sources.MassFlowSource_T sou1( redeclare package Medium = Medium, m_flow=1, nPorts=1, T=283.15) "Mass flow source"; Modelica.Blocks.Sources.Ramp ram_T2( height=10, offset=273.15, duration=5) "Temperature ramp"; Modelica.Blocks.Sources.Ramp ram_m2_flow( height=-2, offset=1, duration=5) "Mass flow rate ramp"; Buildings.Fluid.Interfaces.EightPortHeatMassExchanger eigPor( redeclare package Medium1 = Medium, redeclare package Medium2 = Medium, redeclare package Medium3 = Medium, redeclare package Medium4 = Medium, m1_flow_nominal=m_flow_nominal, m2_flow_nominal=m_flow_nominal, m3_flow_nominal=m_flow_nominal, m4_flow_nominal=m_flow_nominal, dp1_nominal=0, dp2_nominal=0, dp3_nominal=0, dp4_nominal=0, tau1=1, tau2=1, tau3=1, tau4=1, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial) "Eight port heat and mass exchanger"; Sources.MassFlowSource_T sou4( redeclare package Medium = Medium, use_m_flow_in=true, use_T_in=true, nPorts=1) "Mass flow source"; Modelica.Blocks.Sources.Ramp ram_T4( duration=5, height=-10, offset=283.15) "Temperature ramp"; Modelica.Blocks.Sources.Ramp ram_m4_flow( duration=5, height=2, offset=-1) "Mass flow rate ramp"; Sources.MassFlowSource_T sou3( redeclare package Medium = Medium, m_flow=1, nPorts=1, T=303.15) "Mass flow source"; equation connect(ram_m2_flow.y, sou2.m_flow_in); connect(ram_T2.y, sou2.T_in); connect(ram_m4_flow.y, sou4.m_flow_in); connect(ram_T4.y, sou4.T_in); connect(sou2.ports[1], eigPor.port_b2); connect(sou4.ports[1], eigPor.port_b4); connect(sou3.ports[1], eigPor.port_b3); connect(sou1.ports[1], eigPor.port_b1); connect(eigPor.port_a1, sin.ports[1]); connect(eigPor.port_a3, sin.ports[2]); connect(eigPor.port_a2, sin.ports[3]); connect(eigPor.port_a4, sin.ports[4]); end EightPortHeatMassExchanger;

Buildings.Fluid.Interfaces.Examples.FourPortHeatMassExchanger Buildings.Fluid.Interfaces.Examples.FourPortHeatMassExchanger

FourPortHeatMassExchanger example model

Buildings.Fluid.Interfaces.Examples.FourPortHeatMassExchanger

Information

This example model demonstrates the used of the FourPortHeatMassExchanger model.

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

Parameters

TypeNameDefaultDescription
MassFlowRatem_flow_nominal1Nominal mass flow rate [kg/s]

Modelica definition

model FourPortHeatMassExchanger "FourPortHeatMassExchanger example model" extends Modelica.Icons.Example; package Medium = Buildings.Media.Water; parameter Modelica.SIunits.MassFlowRate m_flow_nominal=1 "Nominal mass flow rate"; Buildings.Fluid.Interfaces.FourPortHeatMassExchanger fouPor( redeclare package Medium1 = Medium, redeclare package Medium2 = Medium, m1_flow_nominal=m_flow_nominal, m2_flow_nominal=m_flow_nominal, dp1_nominal=0, dp2_nominal=0, tau1=1, tau2=1, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial) "Four port heat mass exchanger"; Sources.Boundary_pT sin(nPorts=2, redeclare package Medium = Medium) "Mass flow sink"; Sources.MassFlowSource_T sou1( nPorts=1, redeclare package Medium = Medium, use_m_flow_in=true, use_T_in=true) "Mass flow source"; Sources.MassFlowSource_T sou2( nPorts=1, redeclare package Medium = Medium, m_flow=1, T=283.15) "Mass flow source"; Modelica.Blocks.Sources.Ramp ram_T( height=10, offset=273.15, duration=5) "Temperature ramp"; Modelica.Blocks.Sources.Ramp ram_m_flow( height=-2, offset=1, duration=5) "Mass flow rate ramp"; equation connect(sin.ports[1], fouPor.port_b2); connect(fouPor.port_b1, sin.ports[2]); connect(sou1.ports[1], fouPor.port_a1); connect(sou2.ports[1], fouPor.port_a2); connect(ram_m_flow.y, sou1.m_flow_in); connect(ram_T.y, sou1.T_in); end FourPortHeatMassExchanger;

Buildings.Fluid.Interfaces.Examples.HeaterCooler_u Buildings.Fluid.Interfaces.Examples.HeaterCooler_u

Model that tests a heat exchanger model with reverse flow

Buildings.Fluid.Interfaces.Examples.HeaterCooler_u

Information

Model that tests the basic class that is used for the heater models. It adds and removes heat for forward and reverse flow. The top and bottom models should give similar results, although the sign of the temperature difference over the components differ because of the reverse flow. The model computes differences in results that are expected to be close to each other after the initial transients decayed. All temperature sensors are configured as steady-state sensors to avoid differences in temperature due to the dynamic response of the sensor.

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

Modelica definition

model HeaterCooler_u "Model that tests a heat exchanger model with reverse flow" extends Modelica.Icons.Example; package Medium = Buildings.Media.Water; Buildings.Fluid.HeatExchangers.HeaterCooler_u hea1( redeclare package Medium = Medium, Q_flow_nominal=5000, m_flow_nominal=0.5, dp_nominal=200, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial, massDynamics=Modelica.Fluid.Types.Dynamics.DynamicFreeInitial) "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") = 101735, T=293.15); Buildings.Fluid.FixedResistances.PressureDrop res_11( redeclare package Medium = Medium, dp_nominal=5, m_flow_nominal=0.5); Buildings.Fluid.FixedResistances.PressureDrop 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( height=2, duration=3600, offset=-1, startTime=0) "Control signal"; Buildings.Fluid.HeatExchangers.HeaterCooler_u hea2( redeclare package Medium = Medium, Q_flow_nominal=5000, m_flow_nominal=0.5, dp_nominal=200, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial) "Heater and cooler"; Modelica.Blocks.Math.Gain gain(k=-1); Buildings.Fluid.HeatExchangers.HeaterCooler_u hea3( redeclare package Medium = Medium, Q_flow_nominal=5000, m_flow_nominal=0.5, dp_nominal=200, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial, massDynamics=Modelica.Fluid.Types.Dynamics.DynamicFreeInitial) "Heater and cooler"; Buildings.Fluid.FixedResistances.PressureDrop res_2( redeclare package Medium = Medium, dp_nominal=5, m_flow_nominal=0.5); Buildings.Fluid.FixedResistances.PressureDrop res_3( redeclare package Medium = Medium, dp_nominal=5, m_flow_nominal=0.5); Buildings.Fluid.HeatExchangers.HeaterCooler_u hea4( redeclare package Medium = Medium, Q_flow_nominal=5000, m_flow_nominal=0.5, dp_nominal=200, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial) "Heater and cooler"; Buildings.Fluid.FixedResistances.PressureDrop 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, m_flow_nominal=0.5, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial); Modelica.Blocks.Math.Add che1(k2=-1); Modelica.Blocks.Math.Add che2(k2=-1); Buildings.Fluid.HeatExchangers.HeaterCooler_u hea5( redeclare package Medium = Medium, Q_flow_nominal=5000, m_flow_nominal=0.5, dp_nominal=200, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial, massDynamics=Modelica.Fluid.Types.Dynamics.DynamicFreeInitial) "Heater and cooler"; Buildings.Fluid.FixedResistances.PressureDrop res_1( redeclare package Medium = Medium, dp_nominal=5, m_flow_nominal=0.5); Buildings.Fluid.FixedResistances.PressureDrop res_5( redeclare package Medium = Medium, dp_nominal=5, m_flow_nominal=0.5); Buildings.Fluid.HeatExchangers.HeaterCooler_u hea6( redeclare package Medium = Medium, Q_flow_nominal=5000, m_flow_nominal=0.5, dp_nominal=200, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial) "Heater and cooler"; Buildings.Fluid.HeatExchangers.HeaterCooler_u hea7( redeclare package Medium = Medium, Q_flow_nominal=5000, m_flow_nominal=0.5, dp_nominal=200, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial, massDynamics=Modelica.Fluid.Types.Dynamics.DynamicFreeInitial) "Heater and cooler"; Buildings.Fluid.FixedResistances.PressureDrop res_6( redeclare package Medium = Medium, dp_nominal=5, m_flow_nominal=0.5); Buildings.Fluid.FixedResistances.PressureDrop res_7( redeclare package Medium = Medium, dp_nominal=5, m_flow_nominal=0.5); Buildings.Fluid.HeatExchangers.HeaterCooler_u hea8( redeclare package Medium = Medium, Q_flow_nominal=5000, m_flow_nominal=0.5, dp_nominal=200, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial) "Heater and cooler"; Buildings.Fluid.FixedResistances.PressureDrop 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, m_flow_nominal=0.5, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial); Modelica.Blocks.Math.Add che9(k2=-1); Modelica.Blocks.Math.Add che10(k2=-1); Buildings.Fluid.Sensors.TemperatureTwoPort senTem2a(redeclare package Medium = Medium, m_flow_nominal=0.5, tau=0) "Temperature sensor"; Buildings.Fluid.Sensors.TemperatureTwoPort senTem2b(redeclare package Medium = Medium, m_flow_nominal=0.5, tau=0) "Temperature sensor"; Buildings.Fluid.Sensors.TemperatureTwoPort senTem1a(redeclare package Medium = Medium, m_flow_nominal=0.5, tau=0) "Temperature sensor"; Buildings.Fluid.Sensors.TemperatureTwoPort senTem1b(redeclare package Medium = Medium, m_flow_nominal=0.5, tau=0) "Temperature sensor"; Buildings.Fluid.Sensors.TemperatureTwoPort senTem3a(redeclare package Medium = Medium, m_flow_nominal=0.5, tau=0) "Temperature sensor"; Buildings.Fluid.Sensors.TemperatureTwoPort senTem3b(redeclare package Medium = Medium, m_flow_nominal=0.5, tau=0) "Temperature sensor"; Buildings.Fluid.Sensors.TemperatureTwoPort senTem4a(redeclare package Medium = Medium, m_flow_nominal=0.5, tau=0) "Temperature sensor"; Buildings.Fluid.Sensors.TemperatureTwoPort senTem4b(redeclare package Medium = Medium, m_flow_nominal=0.5, tau=0) "Temperature sensor"; Modelica.Blocks.Math.Add che3(k2=-1); Modelica.Blocks.Math.Add che4(k2=-1); Modelica.Blocks.Math.Add che5(k2=-1); Modelica.Blocks.Math.Add che6(k2=-1); Buildings.Fluid.Sensors.TemperatureTwoPort senTem6b(redeclare package Medium = Medium, m_flow_nominal=0.5, tau=0) "Temperature sensor"; Buildings.Fluid.Sensors.TemperatureTwoPort senTem6a(redeclare package Medium = Medium, m_flow_nominal=0.5, tau=0) "Temperature sensor"; Buildings.Fluid.Sensors.TemperatureTwoPort senTem5b(redeclare package Medium = Medium, m_flow_nominal=0.5, tau=0) "Temperature sensor"; Buildings.Fluid.Sensors.TemperatureTwoPort senTem5a(redeclare package Medium = Medium, m_flow_nominal=0.5, tau=0) "Temperature sensor"; Modelica.Blocks.Math.Add che7(k2=-1); Modelica.Blocks.Math.Add che8(k2=-1); Buildings.Fluid.Sensors.TemperatureTwoPort senTem8b(redeclare package Medium = Medium, m_flow_nominal=0.5, tau=0) "Temperature sensor"; Buildings.Fluid.Sensors.TemperatureTwoPort senTem8a(redeclare package Medium = Medium, m_flow_nominal=0.5, tau=0) "Temperature sensor"; Buildings.Fluid.Sensors.TemperatureTwoPort senTem7b(redeclare package Medium = Medium, m_flow_nominal=0.5, tau=0) "Temperature sensor"; Buildings.Fluid.Sensors.TemperatureTwoPort senTem7a(redeclare package Medium = Medium, m_flow_nominal=0.5, tau=0) "Temperature sensor"; equation connect(POut.y,sin_1. p_in); connect(TDb.y,sou_1. T_in); connect(u.y, hea1.u); connect(gain.y, hea2.u); connect(u.y, gain.u); connect(u.y, hea3.u); connect(gain.y, hea4.u); connect(u.y, hea6.u); connect(u.y, hea8.u); connect(gain.y, hea5.u); connect(gain.y, hea7.u); 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(mix1.ports[1], res_4.port_a); connect(mix2.ports[1], res_8.port_a); connect(senTem1a.T,che1. u1); connect(senTem2a.T,che1. u2); connect(senTem1b.T,che2. u2); connect(senTem2b.T,che2. u1); connect(senTem4a.T,che4. u2); connect(senTem3a.T,che4. u1); connect(senTem4b.T,che3. u1); connect(senTem3b.T,che3. u2); connect(senTem6a.T,che6. u2); connect(senTem5a.T,che6. u1); connect(senTem6b.T,che5. u1); connect(senTem5b.T,che5. u2); connect(senTem8a.T,che8. u2); connect(senTem7a.T,che8. u1); connect(senTem8b.T,che7. u1); connect(senTem7b.T,che7. u2); connect(senTem3a.T,che10. u1); connect(senTem7a.T,che10. u2); connect(senTem2b.T,che9. u1); connect(senTem5b.T,che9. u2); connect(res_12.port_b, senTem2a.port_a); connect(senTem2a.port_b, hea2.port_a); connect(hea2.port_b, senTem2b.port_a); connect(senTem2b.port_b, senTem1b.port_b); connect(hea1.port_b, senTem1b.port_a); connect(res_11.port_b, senTem1a.port_a); connect(senTem1a.port_b, hea1.port_a); connect(res_2.port_b, senTem3a.port_a); connect(senTem3a.port_b, hea3.port_a); connect(hea3.port_b, senTem3b.port_a); connect(senTem3b.port_b, mix1.ports[2]); connect(hea4.port_b, senTem4b.port_a); connect(res_3.port_b, senTem4a.port_a); connect(senTem4a.port_b, hea4.port_a); connect(senTem4b.port_b, res_4.port_b); connect(res_5.port_b, senTem6a.port_a); connect(senTem6a.port_b, hea6.port_a); connect(hea6.port_b, senTem6b.port_a); connect(senTem6b.port_b, senTem5b.port_b); connect(senTem5b.port_a, hea5.port_b); connect(hea5.port_a, senTem5a.port_b); connect(senTem5a.port_a, res_1.port_b); connect(res_7.port_b, senTem8a.port_a); connect(senTem8a.port_b, hea8.port_a); connect(hea8.port_b, senTem8b.port_a); connect(senTem8b.port_b, res_8.port_b); connect(mix2.ports[2], senTem7b.port_b); connect(senTem7b.port_a, hea7.port_b); connect(hea7.port_a, senTem7a.port_b); connect(senTem7a.port_a, res_6.port_b); end HeaterCooler_u;

Buildings.Fluid.Interfaces.Examples.Humidifier_u Buildings.Fluid.Interfaces.Examples.Humidifier_u


Buildings.Fluid.Interfaces.Examples.Humidifier_u

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 computes differences of results that are expected to be close to each other after the initial transients decayed.

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

Parameters

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

Modelica definition

model Humidifier_u extends Modelica.Icons.Example; package Medium = Buildings.Media.Air; parameter Modelica.SIunits.MassFlowRate mWat_flow_nominal = 0.001 "Nominal water mass flow rate"; Humidifier hea1(redeclare package Medium = Medium, m_flow_nominal=0.5, mWat_flow_nominal=mWat_flow_nominal, dp_nominal=50, show_T=true, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial, massDynamics=Modelica.Fluid.Types.Dynamics.DynamicFreeInitial) "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.PressureDrop res_11( redeclare package Medium = Medium, dp_nominal=5, m_flow_nominal=0.5); Buildings.Fluid.FixedResistances.PressureDrop 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=3600, startTime=0, height=1, offset=0) "Control signal"; Humidifier hea2( redeclare package Medium = Medium, m_flow_nominal=0.5, mWat_flow_nominal=mWat_flow_nominal, dp_nominal=50, show_T=true, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial) "Heater and cooler"; Modelica.Blocks.Math.Gain gain(k=-1); Humidifier hea3( redeclare package Medium = Medium, m_flow_nominal=0.5, mWat_flow_nominal=mWat_flow_nominal, dp_nominal=50, show_T=true, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial, massDynamics=Modelica.Fluid.Types.Dynamics.DynamicFreeInitial) "Heater and cooler"; Buildings.Fluid.FixedResistances.PressureDrop res_2( redeclare package Medium = Medium, dp_nominal=5, m_flow_nominal=0.5); Buildings.Fluid.FixedResistances.PressureDrop res_3( redeclare package Medium = Medium, dp_nominal=5, m_flow_nominal=0.5); Humidifier hea4( redeclare package Medium = Medium, m_flow_nominal=0.5, mWat_flow_nominal=mWat_flow_nominal, dp_nominal=50, show_T=true, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial) "Heater and cooler"; Buildings.Fluid.FixedResistances.PressureDrop 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, m_flow_nominal=0.5, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial); Modelica.Blocks.Math.Add che1(k2=-1); Modelica.Blocks.Sources.RealExpression y1(y=hea2.staB.T); Modelica.Blocks.Sources.RealExpression y2(y=hea1.staB.T); Modelica.Blocks.Math.Add che2(k2=-1); Modelica.Blocks.Sources.RealExpression y3(y=hea2.staA.T); Modelica.Blocks.Sources.RealExpression y4(y=hea1.staA.T); Modelica.Blocks.Math.Add che3(k2=-1); Modelica.Blocks.Sources.RealExpression y5(y=hea4.staB.T); Modelica.Blocks.Sources.RealExpression y6(y=hea3.staB.T); Modelica.Blocks.Math.Add che4(k2=-1); Modelica.Blocks.Sources.RealExpression y7(y=hea4.staA.T); Modelica.Blocks.Sources.RealExpression y8(y=hea3.staA.T); Humidifier hea5(redeclare package Medium = Medium, m_flow_nominal=0.5, mWat_flow_nominal=mWat_flow_nominal, dp_nominal=50, show_T=true, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial, massDynamics=Modelica.Fluid.Types.Dynamics.DynamicFreeInitial) "Heater and cooler"; Buildings.Fluid.FixedResistances.PressureDrop res_1( redeclare package Medium = Medium, dp_nominal=5, m_flow_nominal=0.5); Buildings.Fluid.FixedResistances.PressureDrop res_5( redeclare package Medium = Medium, dp_nominal=5, m_flow_nominal=0.5); Humidifier hea6( redeclare package Medium = Medium, m_flow_nominal=0.5, mWat_flow_nominal=mWat_flow_nominal, dp_nominal=50, show_T=true, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial) "Heater and cooler"; Humidifier hea7(redeclare package Medium = Medium, m_flow_nominal=0.5, mWat_flow_nominal=mWat_flow_nominal, dp_nominal=50, show_T=true, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial, massDynamics=Modelica.Fluid.Types.Dynamics.DynamicFreeInitial) "Heater and cooler"; Buildings.Fluid.FixedResistances.PressureDrop res_6( redeclare package Medium = Medium, dp_nominal=5, m_flow_nominal=0.5); Buildings.Fluid.FixedResistances.PressureDrop res_7( redeclare package Medium = Medium, dp_nominal=5, m_flow_nominal=0.5); Humidifier hea8( redeclare package Medium = Medium, m_flow_nominal=0.5, mWat_flow_nominal=mWat_flow_nominal, dp_nominal=50, show_T=true, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial) "Heater and cooler"; Buildings.Fluid.FixedResistances.PressureDrop 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, m_flow_nominal=0.5, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial); Modelica.Blocks.Math.Add che5(k2=-1); Modelica.Blocks.Sources.RealExpression y9(y=hea6.staB.T); Modelica.Blocks.Sources.RealExpression y10( y=hea5.staB.T); Modelica.Blocks.Math.Add che6(k2=-1); Modelica.Blocks.Sources.RealExpression y11( y=hea6.staA.T); Modelica.Blocks.Sources.RealExpression y12( y=hea5.staA.T); Modelica.Blocks.Math.Add che7(k2=-1); Modelica.Blocks.Sources.RealExpression y13( y=hea8.staB.T); Modelica.Blocks.Sources.RealExpression y14( y=hea7.staB.T); Modelica.Blocks.Math.Add che8(k2=-1); Modelica.Blocks.Sources.RealExpression y15( y=hea8.staA.T); Modelica.Blocks.Sources.RealExpression y16( y=hea7.staA.T); Modelica.Blocks.Math.Add che9(k2=-1); Modelica.Blocks.Sources.RealExpression y17(y=hea2.staB.T); Modelica.Blocks.Sources.RealExpression y18(y=hea5.staB.T); Modelica.Blocks.Math.Add che10(k2=-1); Modelica.Blocks.Sources.RealExpression y19(y=hea4.staA.T); Modelica.Blocks.Sources.RealExpression y20(y=hea7.staA.T); Modelica.Blocks.Math.Add che11(k2=-1); Modelica.Blocks.Sources.RealExpression y21(y=hea2.staB.X[1]); Modelica.Blocks.Sources.RealExpression y22(y=hea1.staB.X[1]); Modelica.Blocks.Math.Add che12(k2=-1); Modelica.Blocks.Sources.RealExpression y23( y=hea2.staA.X[1]); Modelica.Blocks.Sources.RealExpression y24( y=hea1.staA.X[1]); Modelica.Blocks.Math.Add che13(k2=-1); Modelica.Blocks.Sources.RealExpression y25( y=hea4.staB.X[1]); Modelica.Blocks.Sources.RealExpression y26( y=hea3.staB.X[1]); Modelica.Blocks.Math.Add che14(k2=-1); Modelica.Blocks.Sources.RealExpression y27( y=hea4.staA.X[1]); Modelica.Blocks.Sources.RealExpression y28( y=hea3.staA.X[1]); Modelica.Blocks.Math.Add che15(k2=-1); Modelica.Blocks.Sources.RealExpression y29( y=hea6.staB.X[1]); Modelica.Blocks.Sources.RealExpression y30( y=hea5.staB.X[1]); Modelica.Blocks.Math.Add che16(k2=-1); Modelica.Blocks.Sources.RealExpression y31( y=hea6.staA.X[1]); Modelica.Blocks.Sources.RealExpression y32( y=hea5.staA.X[1]); Modelica.Blocks.Math.Add che17(k2=-1); Modelica.Blocks.Sources.RealExpression y33( y=hea8.staB.X[1]); Modelica.Blocks.Sources.RealExpression y34( y=hea7.staB.X[1]); Modelica.Blocks.Math.Add che18(k2=-1); Modelica.Blocks.Sources.RealExpression y35( y=hea8.staA.X[1]); Modelica.Blocks.Sources.RealExpression y36( y=hea7.staA.X[1]); Modelica.Blocks.Math.Add che19(k2=-1); Modelica.Blocks.Sources.RealExpression y37(y=hea2.staB.X[1]); Modelica.Blocks.Sources.RealExpression y38(y=hea5.staB.X[1]); Modelica.Blocks.Math.Add che20(k2=-1); Modelica.Blocks.Sources.RealExpression y39(y=hea4.staA.X[1]); Modelica.Blocks.Sources.RealExpression y40(y=hea7.staA.X[1]); protected model Humidifier "Model for humidifier that adds a variable for the thermodynamic states at its ports" extends Buildings.Fluid.Humidifiers.Humidifier_u; Medium.ThermodynamicState staA= Medium.setState_phX(port_a.p, actualStream(port_a.h_outflow), actualStream(port_a.Xi_outflow)) "Thermodynamic state in port a"; Medium.ThermodynamicState staB= Medium.setState_phX(port_b.p, actualStream(port_b.h_outflow), actualStream(port_b.Xi_outflow)) "Thermodynamic state in port b"; end Humidifier; 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,che1. u1); connect(y2.y,che1. u2); connect(y3.y,che2. u1); connect(y4.y,che2. u2); connect(y5.y,che3. u1); connect(y6.y,che3. u2); connect(y7.y,che4. u1); connect(y8.y,che4. 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,che5. u1); connect(y10.y,che5. u2); connect(y11.y,che6. u1); connect(y12.y,che6. u2); connect(y13.y,che7. u1); connect(y14.y,che7. u2); connect(y15.y,che8. u1); connect(y16.y,che8. u2); connect(y17.y,che9. u1); connect(y18.y,che9. u2); connect(y19.y,che10. u1); connect(y20.y,che10. u2); connect(u.y, hea6.u); connect(u.y, hea8.u); connect(gain.y, hea5.u); connect(gain.y, hea7.u); connect(y21.y,che11. u1); connect(y22.y,che11. u2); connect(y23.y,che12. u1); connect(y24.y,che12. u2); connect(y25.y,che13. u1); connect(y26.y,che13. u2); connect(y27.y,che14. u1); connect(y28.y,che14. u2); connect(y29.y,che15. u1); connect(y30.y,che15. u2); connect(y31.y,che16. u1); connect(y32.y,che16. u2); connect(y33.y,che17. u1); connect(y34.y,che17. u2); connect(y35.y,che18. u1); connect(y36.y,che18. u2); connect(y37.y,che19. u1); connect(y38.y,che19. u2); connect(y39.y,che20. u1); connect(y40.y,che20. 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 Humidifier_u;

Buildings.Fluid.Interfaces.Examples.PrescribedOutlet Buildings.Fluid.Interfaces.Examples.PrescribedOutlet

Test model for prescribed outlet state

Buildings.Fluid.Interfaces.Examples.PrescribedOutlet

Information

Model that demonstrates Buildings.Fluid.Interfaces.PrescribedOutlet with mass fraction setpoint.

Extends from Modelica.Icons.Example (Icon for runnable examples), Buildings.Fluid.Interfaces.Examples.BaseClasses.PrescribedOutletState (Test model for prescribed outlet state).

Parameters

TypeNameDefaultDescription
replaceable package MediumAirMedium model
MassFlowRatem_flow_nominal0.1Nominal mass flow rate [kg/s]

Modelica definition

model PrescribedOutlet "Test model for prescribed outlet state" extends Modelica.Icons.Example; extends Buildings.Fluid.Interfaces.Examples.BaseClasses.PrescribedOutletState; equation connect(setHeaHigPow.y[1], heaHigPow.TSet); connect(setHeaHigPow.y[2], heaHigPow.X_wSet); connect(setCooLimPow.y[1], cooLimPow.TSet); connect(setCooLimPow.y[2], cooLimPow.X_wSet); connect(setHeaCooUnl.y[1], heaCooUnl.TSet); connect(setHeaCooUnl.y[2], heaCooUnl.X_wSet); connect(setHeaCooUnl.y[1], steSta.TSet); connect(setHeaCooUnl.y[2], steSta.X_wSet); end PrescribedOutlet;

Buildings.Fluid.Interfaces.Examples.PrescribedOutlet_TSetOnly Buildings.Fluid.Interfaces.Examples.PrescribedOutlet_TSetOnly

Test model for prescribed outlet state

Buildings.Fluid.Interfaces.Examples.PrescribedOutlet_TSetOnly

Information

Model that demonstrates Buildings.Fluid.Interfaces.PrescribedOutlet with temperature setpoint.

Extends from Modelica.Icons.Example (Icon for runnable examples), Buildings.Fluid.Interfaces.Examples.BaseClasses.PrescribedOutletState (Test model for prescribed outlet state).

Parameters

TypeNameDefaultDescription
replaceable package MediumAirMedium model
MassFlowRatem_flow_nominal0.1Nominal mass flow rate [kg/s]

Modelica definition

model PrescribedOutlet_TSetOnly "Test model for prescribed outlet state" extends Modelica.Icons.Example; extends Buildings.Fluid.Interfaces.Examples.BaseClasses.PrescribedOutletState ( steSta(use_X_wSet=false), heaHigPow(use_X_wSet=false), cooLimPow(use_X_wSet=false), heaCooUnl(use_X_wSet=false)); equation connect(setHeaHigPow.y[1], heaHigPow.TSet); connect(setCooLimPow.y[1], cooLimPow.TSet); connect(setHeaCooUnl.y[1], heaCooUnl.TSet); connect(setHeaCooUnl.y[1], steSta.TSet); end PrescribedOutlet_TSetOnly;

Buildings.Fluid.Interfaces.Examples.PrescribedOutlet_Water Buildings.Fluid.Interfaces.Examples.PrescribedOutlet_Water

Test model for prescribed outlet state

Buildings.Fluid.Interfaces.Examples.PrescribedOutlet_Water

Information

Model that demonstrates Buildings.Fluid.Interfaces.PrescribedOutlet with temperature setpoint and water as the medium.

Extends from Modelica.Icons.Example (Icon for runnable examples), Buildings.Fluid.Interfaces.Examples.BaseClasses.PrescribedOutletState (Test model for prescribed outlet state).

Parameters

TypeNameDefaultDescription
replaceable package MediumAirMedium model
MassFlowRatem_flow_nominal0.1Nominal mass flow rate [kg/s]

Connectors

TypeNameDescription
replaceable package MediumMedium model

Modelica definition

model PrescribedOutlet_Water "Test model for prescribed outlet state" extends Modelica.Icons.Example; extends Buildings.Fluid.Interfaces.Examples.BaseClasses.PrescribedOutletState ( redeclare package Medium = Buildings.Media.Water, steSta(use_X_wSet=false), heaHigPow(use_X_wSet=false), cooLimPow(use_X_wSet=false), heaCooUnl(use_X_wSet=false)); equation connect(setHeaHigPow.y[1], heaHigPow.TSet); connect(setCooLimPow.y[1], cooLimPow.TSet); connect(setHeaCooUnl.y[1], heaCooUnl.TSet); connect(setHeaCooUnl.y[1], steSta.TSet); end PrescribedOutlet_Water;

Buildings.Fluid.Interfaces.Examples.PrescribedOutlet_X_wSetOnly Buildings.Fluid.Interfaces.Examples.PrescribedOutlet_X_wSetOnly

Test model for prescribed outlet state

Buildings.Fluid.Interfaces.Examples.PrescribedOutlet_X_wSetOnly

Information

Model that demonstrates Buildings.Fluid.Interfaces.PrescribedOutlet with mass fraction setpoint.

Extends from Modelica.Icons.Example (Icon for runnable examples), Buildings.Fluid.Interfaces.Examples.BaseClasses.PrescribedOutletState (Test model for prescribed outlet state).

Parameters

TypeNameDefaultDescription
replaceable package MediumAirMedium model
MassFlowRatem_flow_nominal0.1Nominal mass flow rate [kg/s]

Modelica definition

model PrescribedOutlet_X_wSetOnly "Test model for prescribed outlet state" extends Modelica.Icons.Example; extends Buildings.Fluid.Interfaces.Examples.BaseClasses.PrescribedOutletState ( heaHigPow(use_TSet=false), cooLimPow(use_TSet=false), heaCooUnl(use_TSet=false), steSta(use_TSet=false)); equation connect(setHeaHigPow.y[2], heaHigPow.X_wSet); connect(setCooLimPow.y[2], cooLimPow.X_wSet); connect(setHeaCooUnl.y[2], heaCooUnl.X_wSet); connect(setHeaCooUnl.y[2], steSta.X_wSet); end PrescribedOutlet_X_wSetOnly;

Buildings.Fluid.Interfaces.Examples.ReverseFlowHumidifier Buildings.Fluid.Interfaces.Examples.ReverseFlowHumidifier

Model that tests the reverse flow for a humidifier

Buildings.Fluid.Interfaces.Examples.ReverseFlowHumidifier

Information

This model tests whether the results for a humidifer are identical for forward flow and reverse flow.

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

Modelica definition

model ReverseFlowHumidifier "Model that tests the reverse flow for a humidifier" extends Modelica.Icons.Example; package Medium = Buildings.Media.Air; Modelica.Blocks.Math.Add cheTem(k2=-1) "Check whether the outputs of the forward flow and reverse flow model are identical"; Modelica.Blocks.Math.Add cheEnt(k2=-1) "Check whether the outputs of the forward flow and reverse flow model are identical"; Modelica.Blocks.Math.Add cheMas(k2=-1) "Check whether the outputs of the forward flow and reverse flow model are identical"; Buildings.Fluid.Humidifiers.Humidifier_u humBac( redeclare package Medium = Medium, dp_nominal=0, m_flow(start=1), m_flow_nominal=1, mWat_flow_nominal=0.1, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial) "Humidifier with backward flow"; Buildings.Fluid.Humidifiers.Humidifier_u humFor( redeclare package Medium = Medium, dp_nominal=0, m_flow(start=1), m_flow_nominal=1, mWat_flow_nominal=0.1, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial) "Humidifier with forward flow"; Modelica.Blocks.Sources.Constant u2(k=0.01) "Control input"; Modelica.Fluid.Sources.MassFlowSource_T source1( redeclare package Medium = Medium, use_m_flow_in=false, use_T_in=false, use_X_in=false, T(displayUnit="K") = 323.15, X={0.01,0.99}, nPorts=1, m_flow=0.5) "Fluid source"; Buildings.Fluid.Sources.Boundary_pT sink1( redeclare package Medium = Medium, nPorts=2) "Fluid sink"; Sensors.SpecificEnthalpy senEnt1(redeclare package Medium = Medium) "Specific enthalpy sensor"; Sensors.Temperature senTem1(redeclare package Medium = Medium) "Temperature sensor"; Sensors.MassFraction senMas1(redeclare package Medium = Medium) "Mass fraction sensor"; Sensors.Temperature senTem2(redeclare package Medium = Medium) "Temperature sensor"; Sensors.SpecificEnthalpy senEnt2(redeclare package Medium = Medium) "Specific enthalpy sensor"; Sensors.MassFraction senMas2(redeclare package Medium = Medium) "Mass fraction sensor"; FixedResistances.PressureDrop res1( redeclare package Medium = Medium, m_flow_nominal=1, from_dp=true, linearized=false, dp_nominal=1000) "Fixed resistance"; FixedResistances.PressureDrop res2( redeclare package Medium = Medium, m_flow_nominal=1, from_dp=true, linearized=false, dp_nominal=1000) "Fixed resistance"; Modelica.Fluid.Sources.MassFlowSource_T source2( redeclare package Medium = Medium, use_m_flow_in=false, use_T_in=false, use_X_in=false, T(displayUnit="K") = 323.15, X={0.01,0.99}, nPorts=1, m_flow=0.5) "Fluid source"; equation connect(u2.y, humFor.u); connect(u2.y, humBac.u); connect(humFor.port_b, senTem1.port); connect(humFor.port_b, senEnt1.port); connect(humFor.port_b, senMas1.port); connect(humBac.port_a, senTem2.port); connect(humBac.port_a, senEnt2.port); connect(humBac.port_a, senMas2.port); connect(humFor.port_b, res1.port_a); connect(res1.port_b, sink1.ports[1]); connect(humBac.port_a, res2.port_a); connect(res2.port_b, sink1.ports[2]); connect(senTem1.T,cheTem. u1); connect(senEnt1.h_out,cheEnt. u1); connect(senMas1.X,cheMas. u1); connect(senTem2.T,cheTem. u2); connect(senEnt2.h_out,cheEnt. u2); connect(senMas2.X,cheMas. u2); connect(humFor.port_a, source1.ports[1]); connect(source2.ports[1], humBac.port_b); end ReverseFlowHumidifier;

Buildings.Fluid.Interfaces.Examples.ReverseFlowMassExchanger Buildings.Fluid.Interfaces.Examples.ReverseFlowMassExchanger

Model that tests the reverse flow for a mass exchanger

Buildings.Fluid.Interfaces.Examples.ReverseFlowMassExchanger

Information

This model tests whether the results for a mass exchanger are identical for forward flow and reverse flow.

Note that if the latent heat transfer effectiveness is non-zero, then the results will differ. The reason is that the maximum capacity stream is computed using the mass flow rates at port_a1 and port_a2. For reverse flow, they are not equal if moisture is added to the mass flow rate. Using an average mass flow rate in computing the heat and moisture transfer would lead to identical results, but it would introduce additional nonlinear equations that need to be solved. Therefore, the model uses the mass flow rates at port_a1 and port_a2.

Note: This problem fails to translate in Dymola 2012 due to an error in Dymola's support of stream connector. This bug will be corrected in future versions of Dymola.

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

Modelica definition

model ReverseFlowMassExchanger "Model that tests the reverse flow for a mass exchanger" extends Modelica.Icons.Example; package Medium = Buildings.Media.Air; Modelica.Blocks.Math.Add cheTem(k2=-1) "Check whether the outputs of the forward flow and reverse flow model are identical"; Modelica.Blocks.Math.Add cheEnt(k2=-1) "Check whether the outputs of the forward flow and reverse flow model are identical"; Modelica.Blocks.Math.Add cheMas(k2=-1) "Check whether the outputs of the forward flow and reverse flow model are identical"; Modelica.Fluid.Sources.MassFlowSource_T source2( m_flow=1, redeclare package Medium = Medium, use_m_flow_in=false, use_T_in=false, use_X_in=false, nPorts=1, T(displayUnit="degC") = 303.15, X={0.02,0.98}); Buildings.Fluid.MassExchangers.ConstantEffectiveness masExcFor( redeclare package Medium1 = Medium, redeclare package Medium2 = Medium, m1_flow_nominal=1, m2_flow_nominal=1, dp1_nominal=0, dp2_nominal=0, epsL=0) "Mass exchanger with forward flow"; Buildings.Fluid.MassExchangers.ConstantEffectiveness masExcRev( redeclare package Medium1 = Medium, redeclare package Medium2 = Medium, m1_flow_nominal=1, m2_flow_nominal=1, dp1_nominal=0, dp2_nominal=0, epsL=0) "Mass exchanger with reverse flow"; Buildings.Fluid.Sources.Boundary_pT sink2( redeclare package Medium = Medium, nPorts=2) "Fluid sink"; FixedResistances.PressureDrop res3( redeclare package Medium = Medium, m_flow_nominal=1, from_dp=true, linearized=false, dp_nominal=1000) "Fixed resistance"; FixedResistances.PressureDrop res4( redeclare package Medium = Medium, m_flow_nominal=1, from_dp=true, linearized=false, dp_nominal=1000) "Fixed resistance"; Sensors.SpecificEnthalpy senEnt3(redeclare package Medium = Medium); Sensors.Temperature senTem3(redeclare package Medium = Medium); Sensors.MassFraction senMas3(redeclare package Medium = Medium); Sensors.SpecificEnthalpy senEnt4(redeclare package Medium = Medium); Sensors.Temperature senTem4(redeclare package Medium = Medium); Sensors.MassFraction senMas4(redeclare package Medium = Medium); Modelica.Blocks.Math.Add cheTem1(k2=-1) "Check whether the outputs of the forward flow and reverse flow model are identical"; Modelica.Blocks.Math.Add cheEnt1(k2=-1) "Check whether the outputs of the forward flow and reverse flow model are identical"; Modelica.Blocks.Math.Add cheMas1(k2=-1) "Check whether the outputs of the forward flow and reverse flow model are identical"; Modelica.Fluid.Sources.MassFlowSource_T source3( m_flow=1, redeclare package Medium = Medium, use_m_flow_in=false, use_T_in=false, use_X_in=false, X={0.01,0.99}, nPorts=1, T(displayUnit="degC") = 293.15); Modelica.Fluid.Sources.MassFlowSource_T source4( m_flow=1, redeclare package Medium = Medium, use_m_flow_in=false, use_T_in=false, use_X_in=false, nPorts=1, T(displayUnit="degC") = 303.15, X={0.02,0.98}); Modelica.Fluid.Sources.MassFlowSource_T source1( m_flow=1, redeclare package Medium = Medium, use_m_flow_in=false, use_T_in=false, use_X_in=false, X={0.01,0.99}, nPorts=1, T(displayUnit="degC") = 293.15); Sources.Boundary_pT sink1( redeclare package Medium = Medium, nPorts=2) "Fluid sink"; Sensors.SpecificEnthalpy senEnt1(redeclare package Medium = Medium); Sensors.Temperature senTem1(redeclare package Medium = Medium); Sensors.MassFraction senMas1(redeclare package Medium = Medium); Sensors.Temperature senTem2(redeclare package Medium = Medium); Sensors.SpecificEnthalpy senEnt2(redeclare package Medium = Medium); Sensors.MassFraction senMas2(redeclare package Medium = Medium); FixedResistances.PressureDrop res1( redeclare package Medium = Medium, m_flow_nominal=1, from_dp=true, linearized=false, dp_nominal=1000) "Fixed resistance"; FixedResistances.PressureDrop res2( redeclare package Medium = Medium, m_flow_nominal=1, from_dp=true, linearized=false, dp_nominal=1000) "Fixed resistance"; equation connect(res1.port_b, sink1.ports[1]); connect(res2.port_b, sink1.ports[2]); connect(senTem1.T,cheTem. u1); connect(senEnt1.h_out,cheEnt. u1); connect(senMas1.X,cheMas. u1); connect(senTem2.T,cheTem. u2); connect(senEnt2.h_out,cheEnt. u2); connect(senMas2.X,cheMas. u2); connect(masExcFor.port_b1, res1.port_a); connect(masExcFor.port_a1, source1.ports[1]); connect(masExcRev.port_a1, res2.port_a); connect(source2.ports[1], masExcFor.port_a2); connect(masExcRev.port_a1, senTem2.port); connect(masExcRev.port_a1, senEnt2.port); connect(masExcRev.port_a1, senMas2.port); connect(masExcFor.port_b1, senTem1.port); connect(masExcFor.port_b1, senEnt1.port); connect(masExcFor.port_b1, senMas1.port); connect(masExcFor.port_b2, res3.port_a); connect(masExcRev.port_a2, res4.port_a); connect(res3.port_b, sink2.ports[1]); connect(res4.port_b, sink2.ports[2]); connect(senTem3.T,cheTem1. u1); connect(senTem4.T,cheTem1. u2); connect(senEnt3.h_out,cheEnt1. u1); connect(senEnt4.h_out,cheEnt1. u2); connect(senMas3.X,cheMas1. u1); connect(senMas4.X,cheMas1. u2); connect(masExcFor.port_b2, senTem3.port); connect(masExcFor.port_b2, senEnt3.port); connect(masExcFor.port_b2, senMas3.port); connect(masExcRev.port_a2, senTem4.port); connect(masExcRev.port_a2, senEnt4.port); connect(masExcRev.port_a2, senMas4.port); connect(source3.ports[1], masExcRev.port_b1); connect(source4.ports[1], masExcRev.port_b2); end ReverseFlowMassExchanger;

Buildings.Fluid.Interfaces.Examples.StaticTwoPortConservationEquation Buildings.Fluid.Interfaces.Examples.StaticTwoPortConservationEquation

Model that tests the static two port conservation equation

Buildings.Fluid.Interfaces.Examples.StaticTwoPortConservationEquation

Information

Model that tests the conservation equations that are used for the heat and mass balance. The instances have either water or air, and either allow or prohibit flow reversal. This example tests the implementation of the steady-state balance.

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

Modelica definition

model StaticTwoPortConservationEquation "Model that tests the static two port conservation equation" extends Modelica.Icons.Example; package MediumW = Buildings.Media.Water "Medium model"; package MediumA = Buildings.Media.Air "Medium model"; Modelica.Blocks.Sources.Constant mWat_flow(k=0) "Water mass flow rate added to the control volume"; Modelica.Blocks.Sources.TimeTable QSen_flow(startTime=0, table=[ 0,-100; 900,-100; 900,0; 1800,0; 1800,100]) "Sensible heat flow rate added to the control volume"; SubModel modWatRev( redeclare package Medium = MediumW, allowFlowReversal=true, use_mWat_flow = false) "Submodel for energy and mass balance"; SubModel modWatNoRev( redeclare package Medium = MediumW, allowFlowReversal=false, use_mWat_flow = false) "Submodel for energy and mass balance"; SubModel modAirRev( redeclare package Medium = MediumA, allowFlowReversal=true, use_mWat_flow = true) "Submodel for energy and mass balance"; SubModel modAirNoRev( redeclare package Medium = MediumA, allowFlowReversal=false, use_mWat_flow = true) "Submodel for energy and mass balance"; equation connect(QSen_flow.y, modWatRev.Q_flow); connect(mWat_flow.y, modWatRev.mWat_flow); protected model SubModel replaceable package Medium = Modelica.Media.Interfaces.PartialMedium "Medium model"; Sources.MassFlowSource_T bou( nPorts=1, redeclare package Medium = Medium, m_flow=0.01) "Boundary condition for mass flow rate"; Buildings.Fluid.Interfaces.StaticTwoPortConservationEquation conEqn( redeclare package Medium = Medium, m_flow_nominal=0.01, show_T=true, allowFlowReversal=allowFlowReversal, use_mWat_flow=use_mWat_flow, prescribedHeatFlowRate=true) "Steady-state conservation equation"; Buildings.Fluid.Sources.Boundary_pT sin( use_p_in=false, redeclare package Medium = Medium, nPorts=1, p=101325, T=283.15) "Sink"; Modelica.Blocks.Interfaces.RealInput Q_flow(unit="W"); Modelica.Blocks.Interfaces.RealInput mWat_flow(unit="kg/s"); parameter Boolean use_mWat_flow "Set to true to enable exchange of moisture"; parameter Boolean allowFlowReversal=true "= false to simplify equations, assuming, but not enforcing, no flow reversal"; equation connect(conEqn.port_b, sin.ports[1]); connect(conEqn.port_a, bou.ports[1]); connect(Q_flow, conEqn.Q_flow); connect(mWat_flow, conEqn.mWat_flow); end SubModel; equation connect(QSen_flow.y, modWatNoRev.Q_flow); connect(mWat_flow.y, modWatNoRev.mWat_flow); connect(QSen_flow.y, modAirRev.Q_flow); connect(mWat_flow.y, modAirRev.mWat_flow); connect(QSen_flow.y, modAirNoRev.Q_flow); connect(mWat_flow.y, modAirNoRev.mWat_flow); end StaticTwoPortConservationEquation;

Buildings.Fluid.Interfaces.Examples.Humidifier_u.Humidifier Buildings.Fluid.Interfaces.Examples.Humidifier_u.Humidifier

Model for humidifier that adds a variable for the thermodynamic states at its ports

Buildings.Fluid.Interfaces.Examples.Humidifier_u.Humidifier

Information

Extends from Buildings.Fluid.Humidifiers.Humidifier_u (Ideal humidifier or dehumidifier with prescribed water mass flow rate addition or subtraction).

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialCondensingGasesMedium in the component
MassFlowRatemWat_flow_nominal Water mass flow rate at u=1, positive for humidification [kg/s]
Nominal condition
MassFlowRatem_flow_nominal Nominal mass flow rate [kg/s]
PressureDifferencedp_nominal Pressure difference [Pa]
Assumptions
BooleanallowFlowReversaltrue= false to simplify equations, assuming, but not enforcing, no flow reversal
Advanced
MassFlowRatem_flow_small1E-4*abs(m_flow_nominal)Small mass flow rate for regularization of zero flow [kg/s]
BooleanhomotopyInitializationtrue= true, use homotopy method
Diagnostics
Booleanshow_Tfalse= true, if actual temperature at port is computed
Flow resistance
Booleanfrom_dpfalse= true, use m_flow = f(dp) else dp = f(m_flow)
BooleanlinearizeFlowResistancefalse= true, use linear relation between m_flow and dp for any flow rate
RealdeltaM0.1Fraction of nominal flow rate where flow transitions to laminar
Dynamics
Nominal condition
Timetau30Time constant at nominal flow (if energyDynamics <> SteadyState) [s]
Equations
DynamicsenergyDynamicsModelica.Fluid.Types.Dynamic...Type of energy balance: dynamic (3 initialization options) or steady state
DynamicsmassDynamicsenergyDynamicsType of mass balance: dynamic (3 initialization options) or steady state
Initialization
AbsolutePressurep_startMedium.p_defaultStart value of pressure [Pa]
TemperatureT_startMedium.T_defaultStart value of temperature [K]
MassFractionX_start[Medium.nX]Medium.X_defaultStart value of mass fractions m_i/m [kg/kg]
ExtraPropertyC_start[Medium.nC]fill(0, Medium.nC)Start value of trace substances

Connectors

TypeNameDescription
FluidPort_aport_aFluid connector a (positive design flow direction is from port_a to port_b)
FluidPort_bport_bFluid connector b (positive design flow direction is from port_a to port_b)
input RealInputuControl input [1]
output RealOutputmWat_flowWater added to the fluid [kg/s]
HeatPort_aheatPortHeat port for total heat exchange with the control volume

Modelica definition

model Humidifier "Model for humidifier that adds a variable for the thermodynamic states at its ports" extends Buildings.Fluid.Humidifiers.Humidifier_u; Medium.ThermodynamicState staA= Medium.setState_phX(port_a.p, actualStream(port_a.h_outflow), actualStream(port_a.Xi_outflow)) "Thermodynamic state in port a"; Medium.ThermodynamicState staB= Medium.setState_phX(port_b.p, actualStream(port_b.h_outflow), actualStream(port_b.Xi_outflow)) "Thermodynamic state in port b"; end Humidifier;

Buildings.Fluid.Interfaces.Examples.StaticTwoPortConservationEquation.SubModel Buildings.Fluid.Interfaces.Examples.StaticTwoPortConservationEquation.SubModel


Buildings.Fluid.Interfaces.Examples.StaticTwoPortConservationEquation.SubModel

Parameters

TypeNameDefaultDescription
replaceable package MediumModelica.Media.Interfaces.Pa...Medium model
Booleanuse_mWat_flow Set to true to enable exchange of moisture
BooleanallowFlowReversaltrue= false to simplify equations, assuming, but not enforcing, no flow reversal

Connectors

TypeNameDescription
replaceable package MediumMedium model
input RealInputQ_flow[W]
input RealInputmWat_flow[kg/s]

Modelica definition

model SubModel replaceable package Medium = Modelica.Media.Interfaces.PartialMedium "Medium model"; Sources.MassFlowSource_T bou( nPorts=1, redeclare package Medium = Medium, m_flow=0.01) "Boundary condition for mass flow rate"; Buildings.Fluid.Interfaces.StaticTwoPortConservationEquation conEqn( redeclare package Medium = Medium, m_flow_nominal=0.01, show_T=true, allowFlowReversal=allowFlowReversal, use_mWat_flow=use_mWat_flow, prescribedHeatFlowRate=true) "Steady-state conservation equation"; Buildings.Fluid.Sources.Boundary_pT sin( use_p_in=false, redeclare package Medium = Medium, nPorts=1, p=101325, T=283.15) "Sink"; Modelica.Blocks.Interfaces.RealInput Q_flow(unit="W"); Modelica.Blocks.Interfaces.RealInput mWat_flow(unit="kg/s"); parameter Boolean use_mWat_flow "Set to true to enable exchange of moisture"; parameter Boolean allowFlowReversal=true "= false to simplify equations, assuming, but not enforcing, no flow reversal"; equation connect(conEqn.port_b, sin.ports[1]); connect(conEqn.port_a, bou.ports[1]); connect(Q_flow, conEqn.Q_flow); connect(mWat_flow, conEqn.mWat_flow); end SubModel;