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

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

Package Content

Name Description
Buildings.Fluid.Sources.Examples.MassFlowSource_WeatherData MassFlowSource_WeatherData Test model for source (sink) with weather bus
Buildings.Fluid.Sources.Examples.Outside Outside Test model for source and sink with outside weather data
Buildings.Fluid.Sources.Examples.Outside_Cp Outside_Cp Test model for source and sink with outside weather data and wind pressure
Buildings.Fluid.Sources.Examples.Outside_CpData Outside_CpData Test model for source and sink with outside weather data and wind pressure using user-defined Cp values
Buildings.Fluid.Sources.Examples.Outside_CpData_Angles Outside_CpData_Angles Test model for source and sink with outside weather data and wind pressure using user-defined Cp values
Buildings.Fluid.Sources.Examples.Outside_CpData_Specification Outside_CpData_Specification Test model for wind pressure profile
Buildings.Fluid.Sources.Examples.Outside_CpLowRise Outside_CpLowRise Test model for source and sink with outside weather data and wind pressure
Buildings.Fluid.Sources.Examples.PropertySource_T PropertySource_T Model that illustrates the use of PropertySource_T
Buildings.Fluid.Sources.Examples.PropertySource_h PropertySource_h Model that illustrates the use of PropertySource_h
Buildings.Fluid.Sources.Examples.TraceSubstancesFlowSource TraceSubstancesFlowSource  

Buildings.Fluid.Sources.Examples.MassFlowSource_WeatherData Buildings.Fluid.Sources.Examples.MassFlowSource_WeatherData

Test model for source (sink) with weather bus

Buildings.Fluid.Sources.Examples.MassFlowSource_WeatherData

Information

This model demonstrates how to connect fluid flow components to a boundary condition that has environmental conditions as obtained from a weather file. The model draws a constant mass flow rate of outside air through its components.

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

Modelica definition

model MassFlowSource_WeatherData "Test model for source (sink) with weather bus" extends Modelica.Icons.Example; package Medium = Buildings.Media.Air "Medium model for air"; Buildings.BoundaryConditions.WeatherData.ReaderTMY3 weaDat(filNam= Modelica.Utilities.Files.loadResource("modelica://Buildings/Resources/weatherdata/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.mos")); Buildings.Fluid.Sources.MassFlowSource_WeatherData sin_with_h( redeclare package Medium = Medium, m_flow=-1, nPorts=1) "Mass flow source model receiving h and X from weather data through weather bus"; Buildings.Fluid.Sources.Outside bou(redeclare package Medium = Medium, nPorts=1) "Model with outside conditions"; Buildings.Fluid.Sensors.RelativeHumidityTwoPort senRelHum(redeclare package Medium = Medium, m_flow_nominal=1, tau=0) "Sensor for relative humidity"; Buildings.Fluid.Sensors.MassFractionTwoPort senMasFra(redeclare package Medium = Medium, m_flow_nominal=1, tau=0) "Sensor for mass fraction of water"; Sensors.TemperatureTwoPort senTem(redeclare package Medium = Medium, m_flow_nominal=1, tau=0) "Temperature sensor"; equation connect(bou.ports[1], senRelHum.port_a); connect(senRelHum.port_b, senMasFra.port_a); connect(senMasFra.port_b, senTem.port_a); connect(senTem.port_b, sin_with_h.ports[1]); connect(weaDat.weaBus, bou.weaBus); connect(weaDat.weaBus, sin_with_h.weaBus); end MassFlowSource_WeatherData;

Buildings.Fluid.Sources.Examples.Outside Buildings.Fluid.Sources.Examples.Outside

Test model for source and sink with outside weather data

Buildings.Fluid.Sources.Examples.Outside

Information

This model demonstrates how to connect fluid flow component to a boundary condition that has environmental conditions as obtained from a weather file. The model draws a constant mass flow rate of outside air through its components.

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

Modelica definition

model Outside "Test model for source and sink with outside weather data" extends Modelica.Icons.Example; package Medium = Buildings.Media.Air "Medium model for air"; Buildings.Fluid.Sources.Outside bou( redeclare package Medium = Medium, nPorts=1) "Model with outside conditions"; Buildings.BoundaryConditions.WeatherData.ReaderTMY3 weaDat(filNam= Modelica.Utilities.Files.loadResource("modelica://Buildings/Resources/weatherdata/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.mos")); Buildings.Fluid.Sources.MassFlowSource_T sin( redeclare package Medium = Medium, m_flow=-1, nPorts=1) "Sink"; Buildings.Fluid.Sensors.TemperatureTwoPort senTem( redeclare package Medium = Medium, m_flow_nominal=1) "Temperature sensor"; Buildings.Fluid.Sensors.RelativeHumidityTwoPort senRelHum( redeclare package Medium = Medium, m_flow_nominal=1) "Sensor for relative humidity"; Buildings.Fluid.Sensors.MassFractionTwoPort senMasFra( redeclare package Medium = Medium, m_flow_nominal=1) "Sensor for mass fraction of water"; equation connect(weaDat.weaBus, bou.weaBus); connect(senTem.port_b, sin.ports[1]); connect(senRelHum.port_a, bou.ports[1]); connect(senRelHum.port_b, senMasFra.port_a); connect(senMasFra.port_b, senTem.port_a); end Outside;

Buildings.Fluid.Sources.Examples.Outside_Cp Buildings.Fluid.Sources.Examples.Outside_Cp

Test model for source and sink with outside weather data and wind pressure

Buildings.Fluid.Sources.Examples.Outside_Cp

Information

This model demonstrates the use of a source for ambient temperature, pressure and species concentration. The models bou1 and bou2 compute the ambient pressure based on the weather file and the wind pressure. The model bou1 uses a parameter for the wind pressure coefficient, whereas bou2 uses the wind pressure coefficient from its input port. The model bouFix does not compute any wind pressure. Adding the wind pressure to the models on the left-hand side induces a mass flow rate through the orifice models ori1 and ori2. Since both source models use the same constant wind pressure coefficient, the mass flow rate through the orifice model is the same. In more realistic applications, the constant source Cp would be replaced by a model that computes a wind pressure coefficient that takes into account the wind direction relative to the building.

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

Modelica definition

model Outside_Cp "Test model for source and sink with outside weather data and wind pressure" extends Modelica.Icons.Example; package Medium = Buildings.Media.Air "Medium model for air"; Buildings.Fluid.Sources.Outside_Cp bou1( redeclare package Medium = Medium, nPorts=1, Cp=0.6) "Model with outside conditions"; Buildings.BoundaryConditions.WeatherData.ReaderTMY3 weaDat( filNam=Modelica.Utilities.Files.loadResource("modelica://Buildings/Resources/weatherdata/USA_CA_San.Francisco.Intl.AP.724940_TMY3.mos")); Buildings.Fluid.Sources.Outside bouFix(redeclare package Medium = Medium, nPorts=2) "Model with outside conditions"; Modelica.Blocks.Sources.Constant Cp(k=0.6) "Constant value for Cp (used to demonstrate input connector)"; Buildings.Airflow.Multizone.Orifice ori1(A=0.1, redeclare package Medium = Medium) "Orifice"; Buildings.Fluid.Sources.Outside_Cp bou2( redeclare package Medium = Medium, nPorts=1, use_Cp_in=true) "Model with outside conditions"; Buildings.Airflow.Multizone.Orifice ori2(A=0.1, redeclare package Medium = Medium) "Orifice"; equation connect(weaDat.weaBus, bou1.weaBus); connect(bou1.ports[1], ori1.port_a); connect(ori1.port_b, bouFix.ports[1]); connect(weaDat.weaBus, bouFix.weaBus); connect(bou2.Cp_in, Cp.y); connect(bou2.ports[1], ori2.port_a); connect(ori2.port_b, bouFix.ports[2]); connect(weaDat.weaBus, bou2.weaBus); end Outside_Cp;

Buildings.Fluid.Sources.Examples.Outside_CpData Buildings.Fluid.Sources.Examples.Outside_CpData

Test model for source and sink with outside weather data and wind pressure using user-defined Cp values

Buildings.Fluid.Sources.Examples.Outside_CpData

Information

This model demonstrates the use of a source for ambient conditions that computes the wind pressure on a facade of a building using a user-defined wind pressure profile. Weather data are used for San Francisco, for a period of a week where the wind blows primarily from North-West. The plot shows that the wind pressure on the north- and west-facing facade is positive, whereas it is negative for the south- and east-facing facades.

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

Parameters

TypeNameDefaultDescription
AngleincAngSurNor[:]{0,45,90,135,180,225,270,315...Wind incidence angles [rad]
RealCp[:]{0.4,0.1,-0.3,-0.35,-0.2,-0....Cp values

Modelica definition

model Outside_CpData "Test model for source and sink with outside weather data and wind pressure using user-defined Cp values" extends Modelica.Icons.Example; package Medium = Buildings.Media.Air "Medium model for air"; Buildings.BoundaryConditions.WeatherData.ReaderTMY3 weaDat( filNam=Modelica.Utilities.Files.loadResource("modelica://Buildings/Resources/weatherdata/USA_CA_San.Francisco.Intl.AP.724940_TMY3.mos")); parameter Modelica.Units.SI.Angle incAngSurNor[:]= {0, 45, 90, 135, 180, 225, 270, 315}*2*Modelica.Constants.pi/360 "Wind incidence angles"; parameter Real Cp[:] = {0.4, 0.1, -0.3, -0.35, -0.2, -0.35, -0.3, 0.1} "Cp values"; Buildings.Fluid.Sources.Outside_CpData west( redeclare package Medium = Medium, incAngSurNor=incAngSurNor, Cp=Cp, azi=Buildings.Types.Azimuth.W) "Model with outside conditions"; Buildings.Fluid.Sources.Outside_CpData north( redeclare package Medium = Medium, incAngSurNor=incAngSurNor, Cp=Cp, azi=Buildings.Types.Azimuth.N) "Model with outside conditions"; Buildings.Fluid.Sources.Outside_CpData south( redeclare package Medium = Medium, incAngSurNor=incAngSurNor, Cp=Cp, azi=Buildings.Types.Azimuth.S) "Model with outside conditions"; Buildings.Fluid.Sources.Outside_CpData east( redeclare package Medium = Medium, incAngSurNor=incAngSurNor, Cp=Cp, azi=Buildings.Types.Azimuth.E) "Model with outside conditions"; equation connect(weaDat.weaBus, west.weaBus); connect(weaDat.weaBus, north.weaBus); connect(weaDat.weaBus, south.weaBus); connect(weaDat.weaBus, east.weaBus); end Outside_CpData;

Buildings.Fluid.Sources.Examples.Outside_CpData_Angles Buildings.Fluid.Sources.Examples.Outside_CpData_Angles

Test model for source and sink with outside weather data and wind pressure using user-defined Cp values

Buildings.Fluid.Sources.Examples.Outside_CpData_Angles

Information

This model demonstrates the use of a source for ambient conditions that computes the wind pressure on a facade of a building using a user-defined wind pressure profile.

The model showcases the possibility to use asymmetrical wind pressure profiles. It also shows how Cp,act shifts with regards to the wind direction and azimuth based on the Cp values which are defined relative to the surface normal.

The plot shows Cp,act of each boundary for each wind direction. Notice how the profile is shifted based on the surface azimuth.

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

Parameters

TypeNameDefaultDescription
AngleincAngSurNor[:]{0,45,90,135,180,225,270,315...Wind incidence angles [rad]
RealCpSym[:]{0.4,0.1,-0.3,-0.35,-0.2,-0....Cp values that are symmetric
RealCpAsy[:]{0.4,0.1,-0.3,-0.35,-0.2,-0....Cp values that are asymmetric

Modelica definition

model Outside_CpData_Angles "Test model for source and sink with outside weather data and wind pressure using user-defined Cp values" extends Modelica.Icons.Example; package Medium = Buildings.Media.Air "Medium model for air"; parameter Modelica.Units.SI.Angle incAngSurNor[:]= {0, 45, 90, 135, 180, 225, 270, 315}*2*Modelica.Constants.pi/360 "Wind incidence angles"; parameter Real CpSym[:]={0.4, 0.1, -0.3, -0.35, -0.2, -0.35, -0.3, 0.1} "Cp values that are symmetric"; parameter Real CpAsy[:]={0.4, 0.1, -0.3, -0.35, -0.2, -0.6, -0.9, -0.1} "Cp values that are asymmetric"; Buildings.Fluid.Sources.Outside_CpData symNor( redeclare package Medium = Medium, incAngSurNor=incAngSurNor, Cp=CpSym, azi=Buildings.Types.Azimuth.N) "Model to compute wind pressure on North-facing surface"; Buildings.Fluid.Sources.Outside_CpData asyNor( redeclare package Medium = Medium, incAngSurNor=incAngSurNor, Cp=CpAsy, azi=Buildings.Types.Azimuth.N) "Model to compute wind pressure on North-facing surface"; Buildings.Fluid.Sources.Outside_CpData asyWes( redeclare package Medium = Medium, incAngSurNor=incAngSurNor, Cp=CpAsy, azi=Buildings.Types.Azimuth.W) "Model to compute wind pressure on West-facing surface"; Buildings.Fluid.Sources.Outside_CpData symWes( redeclare package Medium = Medium, incAngSurNor=incAngSurNor, Cp=CpSym, azi=Buildings.Types.Azimuth.W) "Model to compute wind pressure on West-facing surface"; Modelica.Blocks.Sources.Ramp winDir( height=2*Modelica.Constants.pi, duration=10, startTime=5) "Wind direction"; Buildings.BoundaryConditions.WeatherData.ReaderTMY3 weaDat( filNam=Modelica.Utilities.Files.loadResource("modelica://Buildings/Resources/weatherdata/USA_CA_San.Francisco.Intl.AP.724940_TMY3.mos"), winSpeSou=Buildings.BoundaryConditions.Types.DataSource.Parameter, winSpe=1, winDirSou=Buildings.BoundaryConditions.Types.DataSource.Input); equation connect(weaDat.weaBus, symNor.weaBus); connect(weaDat.weaBus, asyNor.weaBus); connect(winDir.y, weaDat.winDir_in); connect(asyWes.weaBus, weaDat.weaBus); connect(symWes.weaBus, weaDat.weaBus); end Outside_CpData_Angles;

Buildings.Fluid.Sources.Examples.Outside_CpData_Specification Buildings.Fluid.Sources.Examples.Outside_CpData_Specification

Test model for wind pressure profile

Buildings.Fluid.Sources.Examples.Outside_CpData_Specification

Information

This model validates the specification of the wind pressure profile in the information section of the model Buildings.Fluid.Sources.Outside_CpData. The surface is configured to be facing North.

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

Modelica definition

model Outside_CpData_Specification "Test model for wind pressure profile" extends Modelica.Icons.Example; package Medium = Buildings.Media.Air "Medium model for air"; Buildings.Fluid.Sources.Outside_CpData nor( redeclare package Medium = Medium, incAngSurNor={0,90,180,315}*2*Modelica.Constants.pi/360, Cp={1,0.2,0.5,0.8}, azi=Buildings.Types.Azimuth.N, Cs=2/1.2) "Model to compute wind pressure on North-facing surface"; Buildings.BoundaryConditions.WeatherData.ReaderTMY3 weaDat( filNam=Modelica.Utilities.Files.loadResource("modelica://Buildings/Resources/weatherdata/USA_CA_San.Francisco.Intl.AP.724940_TMY3.mos"), winSpeSou=Buildings.BoundaryConditions.Types.DataSource.Parameter, winSpe=1, winDirSou=Buildings.BoundaryConditions.Types.DataSource.Input); Modelica.Blocks.Sources.Ramp winDir( height=2*Modelica.Constants.pi, duration=24*3600) "Wind direction"; equation connect(weaDat.winDir_in, winDir.y); connect(weaDat.weaBus, nor.weaBus); end Outside_CpData_Specification;

Buildings.Fluid.Sources.Examples.Outside_CpLowRise Buildings.Fluid.Sources.Examples.Outside_CpLowRise

Test model for source and sink with outside weather data and wind pressure

Buildings.Fluid.Sources.Examples.Outside_CpLowRise

Information

This model demonstrates the use of a source for ambient conditions that computes the wind pressure on a facade of a low-rise building using the equation from Swami and Chandra (1987). Weather data are used for San Francisco, for a period of a week where the wind blows primarily from North-West. The plot shows that the wind pressure on the north- and west-facing facade is positive, whereas it is negative for the south- and east-facing facades.

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

Modelica definition

model Outside_CpLowRise "Test model for source and sink with outside weather data and wind pressure" extends Modelica.Icons.Example; package Medium = Buildings.Media.Air "Medium model for air"; Buildings.Fluid.Sources.Outside_CpLowRise west( redeclare package Medium = Medium, s=5, azi=Buildings.Types.Azimuth.W, Cp0=0.6) "Model with outside conditions"; Buildings.BoundaryConditions.WeatherData.ReaderTMY3 weaDat( filNam=Modelica.Utilities.Files.loadResource("modelica://Buildings/Resources/weatherdata/USA_CA_San.Francisco.Intl.AP.724940_TMY3.mos")); Buildings.Fluid.Sources.Outside_CpLowRise north( redeclare package Medium = Medium, s=1/5, azi=Buildings.Types.Azimuth.N, Cp0=0.6) "Model with outside conditions"; Buildings.Fluid.Sources.Outside_CpLowRise south( redeclare package Medium = Medium, s=1/5, azi=Buildings.Types.Azimuth.S, Cp0=0.6) "Model with outside conditions"; Buildings.Fluid.Sources.Outside_CpLowRise east( redeclare package Medium = Medium, s=5, azi=Buildings.Types.Azimuth.E, Cp0=0.6) "Model with outside conditions"; equation connect(weaDat.weaBus, west.weaBus); connect(weaDat.weaBus, north.weaBus); connect(weaDat.weaBus, south.weaBus); connect(weaDat.weaBus, east.weaBus); end Outside_CpLowRise;

Buildings.Fluid.Sources.Examples.PropertySource_T Buildings.Fluid.Sources.Examples.PropertySource_T

Model that illustrates the use of PropertySource_T

Buildings.Fluid.Sources.Examples.PropertySource_T

Information

Example model that illustrates the use of the Buildings.Fluid.Sources.PropertySource_T model.

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

Modelica definition

model PropertySource_T "Model that illustrates the use of PropertySource_T" extends Modelica.Icons.Example; package Medium = Buildings.Media.Air(extraPropertiesNames={"CO2"}); Buildings.Fluid.Sources.PropertySource_T proSouXi( redeclare package Medium = Medium, use_Xi_in=true) "Property source that prescribes Xi"; Buildings.Fluid.Sources.MassFlowSource_T bouXi( redeclare package Medium = Medium, nPorts=1, use_m_flow_in=true) "Boundary for Xi test"; Buildings.Fluid.Sources.Boundary_ph sin( redeclare package Medium = Medium, nPorts=3) "Sink model"; Buildings.Fluid.Sources.PropertySource_T proSouT( redeclare package Medium = Medium, use_T_in=true) "Property source that prescribes the temperature"; Buildings.Fluid.Sources.PropertySource_T proSouC( redeclare package Medium = Medium, use_C_in=true) "Property source that prescribes C"; Buildings.Fluid.Sources.MassFlowSource_T bouT( redeclare package Medium = Medium, nPorts=1, use_m_flow_in=true) "Boundary for temperature test"; Buildings.Fluid.Sources.MassFlowSource_T bouC( redeclare package Medium = Medium, nPorts=1, use_m_flow_in=true) "Boundary for C test"; Modelica.Blocks.Sources.Constant T(k=Medium.T_default + 1) "Fixed temperature value"; Modelica.Blocks.Sources.Constant Xi(k=0.0123) "Fixed Xi value"; Modelica.Blocks.Sources.Constant C(k=0.1) "Fixed C value"; Modelica.Blocks.Sources.Ramp ramp( height=-2, duration=1, offset=1) "Ramp for mass flow rate"; Buildings.Fluid.Sensors.TemperatureTwoPort senTemT( redeclare package Medium = Medium, m_flow_nominal=1, tau=0) "Temperature sensor for when using temperature input"; Buildings.Fluid.Sensors.TemperatureTwoPort senTemXi( redeclare package Medium = Medium, m_flow_nominal=1, tau=0) "Temperature sensor for when using Xi input"; Buildings.Fluid.Sensors.TemperatureTwoPort senTemC( redeclare package Medium = Medium, m_flow_nominal=1, tau=0) "Temperature sensor for when using C input"; equation connect(bouXi.ports[1], proSouXi.port_a); connect(bouC.ports[1], proSouC.port_a); connect(bouT.ports[1], proSouT.port_a); connect(Xi.y, proSouXi.Xi_in[1]); connect(C.y, proSouC.C_in[1]); connect(bouT.m_flow_in, ramp.y); connect(ramp.y, bouXi.m_flow_in); connect(ramp.y, bouC.m_flow_in); connect(T.y, proSouT.T_in); connect(proSouC.port_b, senTemC.port_a); connect(senTemC.port_b, sin.ports[1]); connect(senTemXi.port_b, sin.ports[2]); connect(senTemT.port_b, sin.ports[3]); connect(proSouT.port_b, senTemT.port_a); connect(proSouXi.port_b, senTemXi.port_a); end PropertySource_T;

Buildings.Fluid.Sources.Examples.PropertySource_h Buildings.Fluid.Sources.Examples.PropertySource_h

Model that illustrates the use of PropertySource_h

Buildings.Fluid.Sources.Examples.PropertySource_h

Information

Example model that illustrates the use of the Buildings.Fluid.Sources.PropertySource_h model.

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

Modelica definition

model PropertySource_h "Model that illustrates the use of PropertySource_h" extends Modelica.Icons.Example; package Medium = Buildings.Media.Air(extraPropertiesNames={"CO2"}); Buildings.Fluid.Sources.PropertySource_h proSouXi( redeclare package Medium = Medium, use_Xi_in=true) "Property source that prescribes Xi"; Buildings.Fluid.Sources.MassFlowSource_h bouXi( redeclare package Medium = Medium, nPorts=1, use_m_flow_in=true) "Boundary for Xi test"; Buildings.Fluid.Sources.Boundary_ph sin( redeclare package Medium = Medium, nPorts=3) "Sink model"; Buildings.Fluid.Sources.PropertySource_h proSouH( redeclare package Medium = Medium, use_h_in=true) "Property source that prescribes the specific enthalpy"; Buildings.Fluid.Sources.PropertySource_h proSouC( redeclare package Medium = Medium, use_C_in=true) "Property source that prescribes C"; Buildings.Fluid.Sources.MassFlowSource_h bouH( redeclare package Medium = Medium, nPorts=1, use_m_flow_in=true) "Boundary for specific enthalpy test"; Buildings.Fluid.Sources.MassFlowSource_h bouC( redeclare package Medium = Medium, nPorts=1, use_m_flow_in=true) "Boundary for C test"; Modelica.Blocks.Sources.Constant h( k=Medium.h_default + 1e3) "Fixed specific enthalpy value"; Modelica.Blocks.Sources.Constant Xi(k=0.0123) "Fixed Xi value"; Modelica.Blocks.Sources.Constant C(k=0.1) "Fixed C value"; Modelica.Blocks.Sources.Ramp ramp( height=-2, duration=1, offset=1) "Ramp for mass flow rate"; equation connect(bouXi.ports[1], proSouXi.port_a); connect(bouC.ports[1], proSouC.port_a); connect(bouH.ports[1], proSouH.port_a); connect(proSouH.port_b, sin.ports[1]); connect(proSouXi.port_b, sin.ports[2]); connect(proSouC.port_b, sin.ports[3]); connect(h.y, proSouH.h_in); connect(Xi.y, proSouXi.Xi_in[1]); connect(C.y, proSouC.C_in[1]); connect(bouH.m_flow_in, ramp.y); connect(ramp.y, bouXi.m_flow_in); connect(ramp.y, bouC.m_flow_in); end PropertySource_h;

Buildings.Fluid.Sources.Examples.TraceSubstancesFlowSource Buildings.Fluid.Sources.Examples.TraceSubstancesFlowSource


Buildings.Fluid.Sources.Examples.TraceSubstancesFlowSource

Information

This model demonstrates the use of trace substances that are added to a volume of air. The source is a step function of 2 kg/s CO2 from t=0 second to t=0.5 second. The sensors C and C1 measure the same concentration that initially increases and then remains constant as there is no flow through the volumes vol and vol1. The sensors C2 and C3 first meaure an increase in concentration, which then decays to zero as there is a mass flow rate with zero CO2 from the source bou to the sink sin.

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

Modelica definition

model TraceSubstancesFlowSource extends Modelica.Icons.Example; package Medium = Buildings.Media.Air(extraPropertiesNames={"CO2"}); MixingVolumes.MixingVolume vol( redeclare package Medium = Medium, V=100, m_flow_nominal=1, nPorts=3, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial) "Mixing volume"; Sources.TraceSubstancesFlowSource sou( redeclare package Medium = Medium, use_m_flow_in=true, nPorts=1); Modelica.Blocks.Sources.Step step( startTime=0.5, height=-2, offset=2); FixedResistances.PressureDrop res( redeclare package Medium = Medium, m_flow_nominal=1, dp_nominal=1) "Resistance, used to check if species are transported between ports"; MixingVolumes.MixingVolume vol1( redeclare package Medium = Medium, V=100, m_flow_nominal=1, nPorts=3, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial) "Mixing volume"; Sources.TraceSubstancesFlowSource sou1( redeclare package Medium = Medium, use_m_flow_in=true, nPorts=1); Buildings.Utilities.Diagnostics.AssertEquality assEqu(threShold=1E-4) "Assert that both volumes have the same concentration"; MixingVolumes.MixingVolume vol2( redeclare package Medium = Medium, p_start=Medium.p_default, V=100, m_flow_nominal=1, nPorts=3, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial) "Mixing volume"; MixingVolumes.MixingVolume vol3( redeclare package Medium = Medium, p_start=Medium.p_default, V=100, m_flow_nominal=1, nPorts=3, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial) "Mixing volume"; Buildings.Utilities.Diagnostics.AssertEquality assEqu1(threShold=1E-4) "Assert that both volumes have the same concentration"; MixingVolumes.MixingVolume vol4( redeclare package Medium = Medium, nPorts=4, p_start=Medium.p_default, V=100, m_flow_nominal=1, energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial) "Mixing volume"; Sources.TraceSubstancesFlowSource sou2( redeclare package Medium = Medium, use_m_flow_in=true, nPorts=1); Buildings.Fluid.Sources.Boundary_pT bou( redeclare package Medium = Medium, p=101325, nPorts=1, T=293.15); Buildings.Fluid.Sources.Boundary_pT sin( redeclare package Medium = Medium, nPorts=2, p=101320, T=293.15) "Sink boundary conditions"; FixedResistances.PressureDrop res1( redeclare package Medium = Medium, m_flow_nominal=1, dp_nominal=1) "Resistance, used to check if species are transported between ports"; FixedResistances.PressureDrop res2( redeclare package Medium = Medium, m_flow_nominal=1, dp_nominal=1) "Resistance, used to check if species are transported between ports"; FixedResistances.PressureDrop res3( redeclare package Medium = Medium, m_flow_nominal=1, dp_nominal=1) "Resistance, used to check if species are transported between ports"; Sensors.TraceSubstances C( redeclare package Medium = Medium, warnAboutOnePortConnection = false) "Trace substance sensor"; Sensors.TraceSubstances C1( redeclare package Medium = Medium, warnAboutOnePortConnection = false) "Trace substance sensor"; Sensors.TraceSubstances C2( redeclare package Medium = Medium, warnAboutOnePortConnection = false) "Trace substance sensor"; Sensors.TraceSubstances C3( redeclare package Medium = Medium, warnAboutOnePortConnection = false) "Trace substance sensor"; FixedResistances.PressureDrop res4( redeclare package Medium = Medium, m_flow_nominal=1, dp_nominal=1) "Resistance, used to check if species are transported between ports"; FixedResistances.PressureDrop res6( redeclare package Medium = Medium, m_flow_nominal=1, dp_nominal=1) "Resistance, used to check if species are transported between ports"; FixedResistances.PressureDrop res5( redeclare package Medium = Medium, m_flow_nominal=1, dp_nominal=1) "Resistance, used to check if species are transported between ports"; FixedResistances.PressureDrop res7( redeclare package Medium = Medium, m_flow_nominal=1, dp_nominal=1) "Resistance, used to check if species are transported between ports"; Buildings.Fluid.Sources.Boundary_pT sin1( redeclare package Medium = Medium, nPorts=2, p=101320, T=293.15) "Sink boundary conditions"; equation connect(res3.port_b, vol4.ports[2]); connect(res1.port_b, sin.ports[1]); connect(res2.port_b, sin.ports[2]); connect(bou.ports[1], res3.port_a); connect(sou1.ports[1], res.port_a); connect(sou2.ports[1], vol4.ports[1]); connect(step.y, sou.m_flow_in); connect(step.y, sou1.m_flow_in); connect(step.y, sou2.m_flow_in); connect(assEqu.u1, C.C); connect(C1.C, assEqu.u2); connect(assEqu1.u1, C2.C); connect(C3.C, assEqu1.u2); connect(sou.ports[1], vol.ports[1]); connect(vol.ports[2], C.port); connect(res.port_b, vol1.ports[1]); connect(vol1.ports[2], C1.port); connect(vol2.ports[1], res1.port_a); connect(vol3.ports[1], res2.port_a); connect(C2.port, vol2.ports[2]); connect(C3.port, vol3.ports[2]); connect(vol4.ports[3], res4.port_a); connect(vol4.ports[4], res6.port_a); connect(res6.port_b, vol3.ports[3]); connect(res4.port_b, vol2.ports[3]); connect(vol.ports[3], res5.port_a); connect(res5.port_b, sin1.ports[1]); connect(vol1.ports[3], res7.port_a); connect(res7.port_b, sin1.ports[2]); end TraceSubstancesFlowSource;