Buildings.Fluid.Sources

Package with boundary condition models

Information

Package Sources contains generic sources for fluid connectors to define fixed or prescribed ambient conditions.

Extends from Modelica.Icons.SourcesPackage (Icon for packages containing sources).

Package Content

Name Description
Buildings.Fluid.Sources.Boundary_pT Boundary_pT Boundary with prescribed pressure, temperature, composition and trace substances
Buildings.Fluid.Sources.Boundary_ph Boundary_ph Boundary with prescribed pressure, specific enthalpy, composition and trace substances
Buildings.Fluid.Sources.MassFlowSource_T MassFlowSource_T Ideal flow source that produces a prescribed mass flow with prescribed temperature, composition and trace substances
Buildings.Fluid.Sources.MassFlowSource_WeatherData MassFlowSource_WeatherData Ideal flow source that produces a prescribed mass flow with prescribed trace substances, outside specific enthalpy and mass fraction
Buildings.Fluid.Sources.MassFlowSource_h MassFlowSource_h Ideal flow source that produces a prescribed mass flow with prescribed specific enthalpy, composition and trace substances
Buildings.Fluid.Sources.Outside Outside Boundary that takes weather data, and optionally trace substances, as an input
Buildings.Fluid.Sources.Outside_Cp Outside_Cp Boundary that takes weather data, and optionally the wind pressure coefficient and trace substances, as an input
Buildings.Fluid.Sources.Outside_CpLowRise Outside_CpLowRise Boundary that takes weather data as an input and computes wind pressure for low-rise buildings
Buildings.Fluid.Sources.PropertySource_T PropertySource_T Model for overriding fluid properties that flow through the component, using temperature input
Buildings.Fluid.Sources.PropertySource_h PropertySource_h Model for overriding fluid properties that flow through the component, using specific enthalpy input
Buildings.Fluid.Sources.TraceSubstancesFlowSource TraceSubstancesFlowSource Source with mass flow that does not take part in medium mass balance (such as CO2)
Buildings.Fluid.Sources.Examples Examples Collection of models that illustrate model use and test models
Buildings.Fluid.Sources.Validation Validation Collection of validation models
Buildings.Fluid.Sources.BaseClasses BaseClasses Package with base classes for Buildings.Fluid.Sources

Buildings.Fluid.Sources.Boundary_pT Buildings.Fluid.Sources.Boundary_pT

Boundary with prescribed pressure, temperature, composition and trace substances

Buildings.Fluid.Sources.Boundary_pT

Information

Defines prescribed values for boundary conditions:

Typical use and important parameters

If use_p_in is false (default option), the p parameter is used as boundary pressure, and the p_in input connector is disabled; if use_p_in is true, then the p parameter is ignored, and the value provided by the input connector is used instead.

The same applies to the temperature T, composition Xi or X and trace substances C.

Options

Instead of using Xi_in (the independent composition fractions), the advanced tab provides an option for setting all composition fractions using X_in. use_X_in and use_Xi_in cannot be used at the same time.

Parameter verifyInputs can be set to true to enable a check that verifies the validity of the used temperatures and pressures. This removes the corresponding overhead from the model, which is a substantial part of the overhead of this model. See #882 for more information.

Note, that boundary temperature, mass fractions and trace substances have only an effect if the mass flow is from the boundary into the port. If mass is flowing from the port into the boundary, the boundary definitions, with exception of boundary pressure, do not have an effect.

Extends from Buildings.Fluid.Sources.BaseClasses.PartialSource_Xi_C (Partial component source with parameter definitions for Xi and C).

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium in the component
Conditional inputs
Booleanuse_Xi_infalseGet the composition (independent fractions) from the input connector
Booleanuse_C_infalseGet the trace substances from the input connector
Booleanuse_p_infalseGet the pressure from the input connector
Booleanuse_T_infalseGet the temperature from the input connector
Fixed inputs
MassFractionX[Medium.nX]Medium.X_defaultFixed value of composition [kg/kg]
ExtraPropertyC[Medium.nC]fill(0, Medium.nC)Fixed values of trace substances
AbsolutePressurepMedium.p_defaultFixed value of pressure [Pa]
TemperatureTMedium.T_defaultFixed value of temperature [K]
Advanced
BooleanverifyInputsfalseSet to true to stop the simulation with an error if the medium temperature is outside its allowable range
Booleanuse_X_infalseGet the composition (all fractions) from the input connector

Connectors

TypeNameDescription
FluidPorts_bports[nPorts] 
input RealInputX_in[Medium.nX]Prescribed boundary composition [kg/kg]
input RealInputXi_in[Medium.nXi]Prescribed boundary composition [kg/kg]
input RealInputC_in[Medium.nC]Prescribed boundary trace substances
input RealInputp_inPrescribed boundary pressure [Pa]
input RealInputT_inPrescribed boundary temperature [K]

Modelica definition

model Boundary_pT "Boundary with prescribed pressure, temperature, composition and trace substances" extends Buildings.Fluid.Sources.BaseClasses.PartialSource_Xi_C; parameter Boolean use_p_in = false "Get the pressure from the input connector"; parameter Medium.AbsolutePressure p = Medium.p_default "Fixed value of pressure"; parameter Boolean use_T_in= false "Get the temperature from the input connector"; parameter Medium.Temperature T = Medium.T_default "Fixed value of temperature"; Modelica.Blocks.Interfaces.RealInput p_in(final unit="Pa") if use_p_in "Prescribed boundary pressure"; Modelica.Blocks.Interfaces.RealInput T_in(final unit="K", displayUnit="degC") if use_T_in "Prescribed boundary temperature"; // Boolean constants to avoid a potential string comparison in an equation section protected constant Boolean checkWaterPressure = Medium.mediumName == "SimpleLiquidWater" "Evaluates to true if the pressure should be checked"; constant Boolean checkAirPressure = Medium.mediumName == "Air" "Evaluates to true if the pressure should be checked"; Modelica.Blocks.Interfaces.RealInput T_in_internal(final unit="K", displayUnit="degC") "Needed to connect to conditional connector"; Modelica.Blocks.Interfaces.RealInput h_internal= Medium.specificEnthalpy(Medium.setState_pTX(p_in_internal, T_in_internal, X_in_internal)) "Internal connector for enthalpy"; initial equation if not use_p_in then if checkWaterPressure then assert(p_in_internal>1e4, "In "+getInstanceName() + ": The parameter value p="+String(p_in_internal)+" is low for water. This is likely an error."); end if; if checkAirPressure then assert(p_in_internal>5e4 and p_in_internal < 1.5e5, "In "+getInstanceName() + ": The parameter value p="+String(p_in_internal)+" is not within a realistic range for air. This is likely an error."); end if; end if; equation if use_p_in then if checkWaterPressure then assert(p_in_internal>1e4, "In "+getInstanceName() + ": The value of p_in="+String(p_in_internal)+" is low for water. This is likely an error."); end if; if checkAirPressure then assert(p_in_internal>5e4 and p_in_internal < 1.5e5, "In "+getInstanceName() + ": The value of p_in="+String(p_in_internal)+" is not within a realistic range for air. This is likely an error."); end if; end if; // Pressure connect(p_in, p_in_internal); if not use_p_in then p_in_internal = p; end if; for i in 1:nPorts loop ports[i].p = p_in_internal; end for; // Temperature connect(T_in, T_in_internal); if not use_T_in then T_in_internal = T; end if; for i in 1:nPorts loop ports[i].h_outflow = h_internal; end for; connect(medium.h, h_internal); end Boundary_pT;

Buildings.Fluid.Sources.Boundary_ph Buildings.Fluid.Sources.Boundary_ph

Boundary with prescribed pressure, specific enthalpy, composition and trace substances

Buildings.Fluid.Sources.Boundary_ph

Information

Defines prescribed values for boundary conditions:

Typical use and important parameters

If use_p_in is false (default option), the p parameter is used as boundary pressure, and the p_in input connector is disabled; if use_p_in is true, then the p parameter is ignored, and the value provided by the input connector is used instead.

The same applies to the specific enthalpy h, composition Xi or X and trace substances C.

Options

Instead of using Xi_in (the independent composition fractions), the advanced tab provides an option for setting all composition fractions using X_in. use_X_in and use_Xi_in cannot be used at the same time.

Parameter verifyInputs can be set to true to enable a check that verifies the validity of the used specific enthalpy and pressures. This removes the corresponding overhead from the model, which is a substantial part of the overhead of this model. See #882 for more information.

Note, that boundary specific enthalpy, mass fractions and trace substances have only an effect if the mass flow is from the boundary into the port. If mass is flowing from the port into the boundary, the boundary definitions, with exception of boundary pressure, do not have an effect.

Extends from Buildings.Fluid.Sources.BaseClasses.PartialSource_Xi_C (Partial component source with parameter definitions for Xi and C).

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium in the component
Conditional inputs
Booleanuse_Xi_infalseGet the composition (independent fractions) from the input connector
Booleanuse_C_infalseGet the trace substances from the input connector
Booleanuse_p_infalseGet the pressure from the input connector
Booleanuse_h_infalseGet the specific enthalpy from the input connector
Fixed inputs
MassFractionX[Medium.nX]Medium.X_defaultFixed value of composition [kg/kg]
ExtraPropertyC[Medium.nC]fill(0, Medium.nC)Fixed values of trace substances
AbsolutePressurepMedium.p_defaultFixed value of pressure [Pa]
SpecificEnthalpyhMedium.h_defaultFixed value of specific enthalpy [J/kg]
Advanced
BooleanverifyInputsfalseSet to true to stop the simulation with an error if the medium temperature is outside its allowable range
Booleanuse_X_infalseGet the composition (all fractions) from the input connector

Connectors

TypeNameDescription
FluidPorts_bports[nPorts] 
input RealInputX_in[Medium.nX]Prescribed boundary composition [kg/kg]
input RealInputXi_in[Medium.nXi]Prescribed boundary composition [kg/kg]
input RealInputC_in[Medium.nC]Prescribed boundary trace substances
input RealInputp_inPrescribed boundary pressure [Pa]
input RealInputh_inPrescribed boundary specific enthalpy [J/kg]

Modelica definition

model Boundary_ph "Boundary with prescribed pressure, specific enthalpy, composition and trace substances" extends Buildings.Fluid.Sources.BaseClasses.PartialSource_Xi_C; parameter Boolean use_p_in = false "Get the pressure from the input connector"; parameter Medium.AbsolutePressure p = Medium.p_default "Fixed value of pressure"; parameter Boolean use_h_in= false "Get the specific enthalpy from the input connector"; parameter Medium.SpecificEnthalpy h = Medium.h_default "Fixed value of specific enthalpy"; Modelica.Blocks.Interfaces.RealInput p_in(final unit="Pa") if use_p_in "Prescribed boundary pressure"; Modelica.Blocks.Interfaces.RealInput h_in(final unit="J/kg") if use_h_in "Prescribed boundary specific enthalpy"; // Boolean constants to avoid a potential string comparison in an equation section protected constant Boolean checkWaterPressure = Medium.mediumName == "SimpleLiquidWater" "Evaluates to true if the pressure should be checked"; constant Boolean checkAirPressure = Medium.mediumName == "Air" "Evaluates to true if the pressure should be checked"; Modelica.Blocks.Interfaces.RealInput h_in_internal(final unit="J/kg") "Needed to connect to conditional connector"; initial equation if not use_p_in then if checkWaterPressure then assert(p_in_internal>1e4, "In "+getInstanceName() + ": The parameter value p="+String(p_in_internal)+" is low for water. This is likely an error."); end if; if checkAirPressure then assert(p_in_internal>5e4 and p_in_internal < 1.5e5, "In "+getInstanceName() + ": The parameter value p="+String(p_in_internal)+" is not within a realistic range for air. This is likely an error."); end if; end if; equation if use_p_in then if checkWaterPressure then assert(p_in_internal>1e4, "In "+getInstanceName() + ": The value of p_in="+String(p_in_internal)+" is low for water. This is likely an error."); end if; if checkAirPressure then assert(p_in_internal>5e4 and p_in_internal < 1.5e5, "In "+getInstanceName() + ": The value of p_in="+String(p_in_internal)+" is not within a realistic range for air. This is likely an error."); end if; end if; // Pressure connect(p_in, p_in_internal); if not use_p_in then p_in_internal = p; end if; for i in 1:nPorts loop ports[i].p = p_in_internal; end for; // Enthalpy connect(h_in, h_in_internal); if not use_h_in then h_in_internal = h; end if; for i in 1:nPorts loop ports[i].h_outflow = h_in_internal; end for; connect(medium.h, h_in_internal); end Boundary_ph;

Buildings.Fluid.Sources.MassFlowSource_T Buildings.Fluid.Sources.MassFlowSource_T

Ideal flow source that produces a prescribed mass flow with prescribed temperature, composition and trace substances

Buildings.Fluid.Sources.MassFlowSource_T

Information

Models an ideal flow source, with prescribed values of flow rate, temperature, composition and trace substances:

If use_m_flow_in is false (default option), the m_flow parameter is used as boundary pressure, and the m_flow_in input connector is disabled; if use_m_flow_in is true, then the m_flow parameter is ignored, and the value provided by the input connector is used instead.

The same applies to the temperature T, composition Xi or X and trace substances C.

Options

Instead of using Xi_in (the independent composition fractions), the advanced tab provides an option for setting all composition fractions using X_in. use_X_in and use_Xi_in cannot be used at the same time.

Parameter verifyInputs can be set to true to enable a check that verifies the validity of the used temperature and pressures. This removes the corresponding overhead from the model, which is a substantial part of the overhead of this model. See #882 for more information.

Note, that boundary temperature, mass fractions and trace substances have only an effect if the mass flow is from the boundary into the port. If mass is flowing from the port into the boundary, the boundary definitions, with exception of boundary flow rate, do not have an effect.

Extends from Buildings.Fluid.Sources.BaseClasses.PartialSource_Xi_C (Partial component source with parameter definitions for Xi and C).

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium in the component
Conditional inputs
Booleanuse_Xi_infalseGet the composition (independent fractions) from the input connector
Booleanuse_C_infalseGet the trace substances from the input connector
Booleanuse_m_flow_infalseGet the mass flow rate from the input connector
Booleanuse_T_infalseGet the temperature from the input connector
Fixed inputs
MassFractionX[Medium.nX]Medium.X_defaultFixed value of composition [kg/kg]
ExtraPropertyC[Medium.nC]fill(0, Medium.nC)Fixed values of trace substances
MassFlowRatem_flow0Fixed mass flow rate going out of the fluid port [kg/s]
TemperatureTMedium.T_defaultFixed value of temperature [K]
Advanced
BooleanverifyInputsfalseSet to true to stop the simulation with an error if the medium temperature is outside its allowable range
Booleanuse_X_infalseGet the composition (all fractions) from the input connector

Connectors

TypeNameDescription
FluidPorts_bports[nPorts] 
input RealInputX_in[Medium.nX]Prescribed boundary composition [kg/kg]
input RealInputXi_in[Medium.nXi]Prescribed boundary composition [kg/kg]
input RealInputC_in[Medium.nC]Prescribed boundary trace substances
input RealInputm_flow_inPrescribed mass flow rate [kg/s]
input RealInputT_inPrescribed boundary temperature [K]

Modelica definition

model MassFlowSource_T "Ideal flow source that produces a prescribed mass flow with prescribed temperature, composition and trace substances" extends Buildings.Fluid.Sources.BaseClasses.PartialSource_Xi_C; parameter Boolean use_m_flow_in = false "Get the mass flow rate from the input connector"; parameter Modelica.SIunits.MassFlowRate m_flow = 0 "Fixed mass flow rate going out of the fluid port"; parameter Boolean use_T_in= false "Get the temperature from the input connector"; parameter Medium.Temperature T = Medium.T_default "Fixed value of temperature"; Modelica.Blocks.Interfaces.RealInput m_flow_in(final unit="kg/s") if use_m_flow_in "Prescribed mass flow rate"; Modelica.Blocks.Interfaces.RealInput T_in(final unit="K", displayUnit="degC") if use_T_in "Prescribed boundary temperature"; protected Modelica.Blocks.Interfaces.RealInput m_flow_in_internal(final unit="kg/s") "Needed to connect to conditional connector"; Modelica.Blocks.Interfaces.RealInput T_in_internal(final unit="K", displayUnit="degC") "Needed to connect to conditional connector"; Modelica.Blocks.Interfaces.RealInput h_internal= Medium.specificEnthalpy(Medium.setState_pTX(p_in_internal, T_in_internal, X_in_internal)) "Internal connector for enthalpy"; equation // Mass flow rate connect(m_flow_in, m_flow_in_internal); if not use_m_flow_in then m_flow_in_internal = m_flow; end if; for i in 1:nPorts loop ports[i].p = p_in_internal; end for; sum(ports.m_flow) = -m_flow_in_internal; // Enthalpy connect(T_in, T_in_internal); if not use_T_in then T_in_internal = T; end if; for i in 1:nPorts loop ports[i].h_outflow = h_internal; end for; connect(medium.h, h_internal); end MassFlowSource_T;

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

Ideal flow source that produces a prescribed mass flow with prescribed trace substances, outside specific enthalpy and mass fraction

Buildings.Fluid.Sources.MassFlowSource_WeatherData

Information

Models an ideal flow source, with prescribed values of flow rate and trace substances, with temperature and specific enthalpy from outside:

If use_m_flow_in is false (default option), the m_flow parameter is used as boundary flow rate, and the m_flow_in input connector is disabled; if use_m_flow_in is true, then the m_flow parameter is ignored, and the value provided by the input connector is used instead.

The same applies to the trace substances.

The Buildings.Utilities.Psychrometrics.X_pTphi block is used with the input data including pAtm, TDryBul, relHum from weather bus weaBus, to calculate X.

The same applies to the specific enthalpy.

Note, that boundary temperature, mass fractions and trace substances have only an effect if the mass flow is from the boundary into the port. If mass is flowing from the port into the boundary, the boundary definitions, with exception of boundary flow rate, do not have an effect.

Extends from Buildings.Fluid.Sources.BaseClasses.PartialSource (Partial component source with one fluid connector).

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium in the component
Booleanuse_m_flow_infalseGet the mass flow rate from the input connector
Booleanuse_C_infalseGet the trace substances from the input connector
MassFlowRatem_flow0Fixed mass flow rate going out of the fluid port [kg/s]
ExtraPropertyC[Medium.nC]fill(0, Medium.nC)Fixed values of trace substances
Advanced
BooleanverifyInputstrueSet to true to stop the simulation with an error if the medium temperature is outside its allowable range

Connectors

TypeNameDescription
FluidPorts_bports[nPorts] 
input RealInputm_flow_inPrescribed mass flow rate [kg/s]
input RealInputC_in[Medium.nC]Prescribed boundary trace substances
BusweaBusBus with weather data

Modelica definition

model MassFlowSource_WeatherData "Ideal flow source that produces a prescribed mass flow with prescribed trace substances, outside specific enthalpy and mass fraction " extends Buildings.Fluid.Sources.BaseClasses.PartialSource(final verifyInputs=true); parameter Boolean use_m_flow_in = false "Get the mass flow rate from the input connector"; parameter Boolean use_C_in = false "Get the trace substances from the input connector"; parameter Modelica.SIunits.MassFlowRate m_flow = 0 "Fixed mass flow rate going out of the fluid port"; parameter Medium.ExtraProperty C[Medium.nC]( final quantity=Medium.extraPropertiesNames)=fill(0, Medium.nC) "Fixed values of trace substances"; Modelica.Blocks.Interfaces.RealInput m_flow_in(final unit="kg/s") if use_m_flow_in "Prescribed mass flow rate"; Modelica.Blocks.Interfaces.RealInput C_in[Medium.nC]( final quantity=Medium.extraPropertiesNames) if use_C_in "Prescribed boundary trace substances"; Buildings.BoundaryConditions.WeatherData.Bus weaBus "Bus with weather data"; protected Modelica.Blocks.Interfaces.RealOutput TDryBul( final unit="K", displayUnit="degC") "Needed to calculate specific enthalpy"; Modelica.Blocks.Interfaces.RealOutput pAtm( final unit="Pa") "Needed to calculate specific enthalpy"; Modelica.Blocks.Interfaces.RealOutput h_out_internal( final unit="J/kg") "Needed to connect to conditional connector"; final parameter Boolean singleSubstance = (Medium.nX == 1) "True if single substance medium"; Buildings.Utilities.Psychrometrics.X_pTphi x_pTphi if (not singleSubstance) "Block to compute water vapor concentration"; Modelica.Blocks.Interfaces.RealOutput m_flow_in_internal( final unit="kg/s") "Needed to connect to conditional connector"; Modelica.Blocks.Interfaces.RealInput h_in_internal( final unit="J/kg") "Needed to connect to conditional connector"; equation Modelica.Fluid.Utilities.checkBoundary( Medium.mediumName, Medium.substanceNames, Medium.singleState, true, X_in_internal, "MassFlowSourceFromOutside_h"); // Connections and calculation to find specific enthalpy connect(weaBus.pAtm, pAtm); connect(weaBus.TDryBul, TDryBul); h_out_internal = Medium.specificEnthalpy(Medium.setState_pTX( pAtm, TDryBul, X_in_internal)); // Connections to compute species concentration connect(weaBus.pAtm, x_pTphi.p_in); connect(weaBus.TDryBul, x_pTphi.T); connect(weaBus.relHum, x_pTphi.phi); connect(x_pTphi.X, X_in_internal); connect(m_flow_in, m_flow_in_internal); connect(C_in, C_in_internal); connect(h_out_internal, h_in_internal); if singleSubstance then X_in_internal = ones(Medium.nX); end if; if not use_m_flow_in then m_flow_in_internal = m_flow; end if; if not use_C_in then C_in_internal = C; end if; sum(ports.m_flow) = -m_flow_in_internal; connect(medium.h, h_in_internal); connect(medium.Xi, Xi_in_internal); ports.C_outflow = fill(C_in_internal, nPorts); connect(X_in_internal[1:Medium.nXi], Xi_in_internal); if not verifyInputs then h_in_internal = Medium.h_default; p_in_internal = Medium.p_default; X_in_internal = Medium.X_default; TDryBul = Medium.T_default; end if; for i in 1:nPorts loop ports[i].p = p_in_internal; ports[i].h_outflow = h_in_internal; ports[i].Xi_outflow = Xi_in_internal; end for; end MassFlowSource_WeatherData;

Buildings.Fluid.Sources.MassFlowSource_h Buildings.Fluid.Sources.MassFlowSource_h

Ideal flow source that produces a prescribed mass flow with prescribed specific enthalpy, composition and trace substances

Buildings.Fluid.Sources.MassFlowSource_h

Information

Models an ideal flow source, with prescribed values of flow rate, specific enthalpy, composition and trace substances:

If use_m_flow_in is false (default option), the m_flow parameter is used as boundary pressure, and the m_flow_in input connector is disabled; if use_m_flow_in is true, then the m_flow parameter is ignored, and the value provided by the input connector is used instead.

The same applies to the specific enthalpy h, composition Xi or X and trace substances C.

Options

Instead of using Xi_in (the independent composition fractions), the advanced tab provides an option for setting all composition fractions using X_in. use_X_in and use_Xi_in cannot be used at the same time.

Parameter verifyInputs can be set to true to enable a check that verifies the validity of the used specific enthalpy and pressures. This removes the corresponding overhead from the model, which is a substantial part of the overhead of this model. See #882 for more information.

Note, that boundary specific enthalpy, mass fractions and trace substances have only an effect if the mass flow is from the boundary into the port. If mass is flowing from the port into the boundary, the boundary definitions, with exception of boundary flow rate, do not have an effect.

Extends from Buildings.Fluid.Sources.BaseClasses.PartialSource_Xi_C (Partial component source with parameter definitions for Xi and C).

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium in the component
Conditional inputs
Booleanuse_Xi_infalseGet the composition (independent fractions) from the input connector
Booleanuse_C_infalseGet the trace substances from the input connector
Booleanuse_m_flow_infalseGet the mass flow rate from the input connector
Booleanuse_h_infalseGet the specific enthalpy from the input connector
Fixed inputs
MassFractionX[Medium.nX]Medium.X_defaultFixed value of composition [kg/kg]
ExtraPropertyC[Medium.nC]fill(0, Medium.nC)Fixed values of trace substances
MassFlowRatem_flow0Fixed mass flow rate going out of the fluid port [kg/s]
SpecificEnthalpyhMedium.h_defaultFixed value of specific enthalpy [J/kg]
Advanced
BooleanverifyInputsfalseSet to true to stop the simulation with an error if the medium temperature is outside its allowable range
Booleanuse_X_infalseGet the composition (all fractions) from the input connector

Connectors

TypeNameDescription
FluidPorts_bports[nPorts] 
input RealInputX_in[Medium.nX]Prescribed boundary composition [kg/kg]
input RealInputXi_in[Medium.nXi]Prescribed boundary composition [kg/kg]
input RealInputC_in[Medium.nC]Prescribed boundary trace substances
input RealInputm_flow_inPrescribed mass flow rate [kg/s]
input RealInputh_inPrescribed boundary specific enthalpy [J/kg]

Modelica definition

model MassFlowSource_h "Ideal flow source that produces a prescribed mass flow with prescribed specific enthalpy, composition and trace substances" extends Buildings.Fluid.Sources.BaseClasses.PartialSource_Xi_C; parameter Boolean use_m_flow_in = false "Get the mass flow rate from the input connector"; parameter Modelica.SIunits.MassFlowRate m_flow = 0 "Fixed mass flow rate going out of the fluid port"; parameter Boolean use_h_in= false "Get the specific enthalpy from the input connector"; parameter Medium.SpecificEnthalpy h = Medium.h_default "Fixed value of specific enthalpy"; Modelica.Blocks.Interfaces.RealInput m_flow_in(final unit="kg/s") if use_m_flow_in "Prescribed mass flow rate"; Modelica.Blocks.Interfaces.RealInput h_in(final unit="J/kg") if use_h_in "Prescribed boundary specific enthalpy"; protected Modelica.Blocks.Interfaces.RealInput m_flow_in_internal(final unit="kg/s") "Needed to connect to conditional connector"; Modelica.Blocks.Interfaces.RealInput h_in_internal(final unit="J/kg") "Needed to connect to conditional connector"; equation // Mass flow rate connect(m_flow_in, m_flow_in_internal); if not use_m_flow_in then m_flow_in_internal = m_flow; end if; for i in 1:nPorts loop ports[i].p = p_in_internal; end for; sum(ports.m_flow) = -m_flow_in_internal; // Enthalpy connect(h_in, h_in_internal); if not use_h_in then h_in_internal = h; end if; for i in 1:nPorts loop ports[i].h_outflow = h_in_internal; end for; connect(medium.h, h_in_internal); end MassFlowSource_h;

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

Boundary that takes weather data, and optionally trace substances, as an input

Buildings.Fluid.Sources.Outside

Information

This model describes boundary conditions for pressure, enthalpy, and species concentration that can be obtained from weather data.

To use this model, connect weather data from Buildings.BoundaryConditions.WeatherData.ReaderTMY3 to the port weaBus of this model. This will cause the medium of this model to be at the pressure that is obtained from the weather file, and any flow that leaves this model to be at the temperature and humidity that are obtained from the weather data.

If the parameter use_C_in is false (default option), the C parameter is used as the trace substance for flow that leaves the component, and the C_in input connector is disabled; if use_C_in is true, then the C parameter is ignored, and the value provided by the input connector is used instead.

Note that boundary temperature, mass fractions and trace substances have only an effect if the mass flow is from the boundary into the port. If mass is flowing from the port into the boundary, the boundary definitions, with exception of boundary pressure, do not have an effect.

Extends from Buildings.Fluid.Sources.BaseClasses.Outside (Boundary that takes weather data, and optionally trace substances, as an input).

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium in the component
Booleanuse_C_infalseGet the trace substances from the input connector
ExtraPropertyC[Medium.nC]fill(0, Medium.nC)Fixed values of trace substances

Connectors

TypeNameDescription
FluidPorts_bports[nPorts] 
input RealInputC_in[Medium.nC]Prescribed boundary trace substances
BusweaBusBus with weather data

Modelica definition

model Outside "Boundary that takes weather data, and optionally trace substances, as an input" extends Buildings.Fluid.Sources.BaseClasses.Outside; equation connect(weaBus.pAtm, p_in_internal); connect(weaBus.TDryBul, T_in_internal); end Outside;

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

Boundary that takes weather data, and optionally the wind pressure coefficient and trace substances, as an input

Buildings.Fluid.Sources.Outside_Cp

Information

This model describes boundary conditions for pressure, enthalpy, and species concentration that can be obtained from weather data. The model is identical to Buildings.Fluid.Sources.Outside, except that it allows adding the wind pressure to the pressure at the fluid port ports.

The pressure p at the port ports is computed as

p = pw + Cp 1 ⁄ 2 v2 ρ

where pw is the atmospheric pressure from the weather bus, Cp is the wind pressure coefficient, v is the wind speed from the weather bus, and ρ is the fluid density. If use_Cp_in=true, then the wind pressure coefficient is obtained from the input connector Cp_in. Otherwise, it is set to the parameter Cp.

Extends from Buildings.Fluid.Sources.BaseClasses.Outside (Boundary that takes weather data, and optionally trace substances, as an input).

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium in the component
Booleanuse_C_infalseGet the trace substances from the input connector
ExtraPropertyC[Medium.nC]fill(0, Medium.nC)Fixed values of trace substances
Booleanuse_Cp_infalseGet the wind pressure coefficient from the input connector
RealCp0.6Fixed value of wind pressure coefficient

Connectors

TypeNameDescription
FluidPorts_bports[nPorts] 
input RealInputC_in[Medium.nC]Prescribed boundary trace substances
BusweaBusBus with weather data
input RealInputCp_inPrescribed wind pressure coefficient [1]

Modelica definition

model Outside_Cp "Boundary that takes weather data, and optionally the wind pressure coefficient and trace substances, as an input" extends Buildings.Fluid.Sources.BaseClasses.Outside; parameter Boolean use_Cp_in= false "Get the wind pressure coefficient from the input connector"; parameter Real Cp = 0.6 "Fixed value of wind pressure coefficient"; Modelica.Blocks.Interfaces.RealInput Cp_in(unit="1") if use_Cp_in "Prescribed wind pressure coefficient"; Modelica.SIunits.Pressure pWin(displayUnit="Pa") "Change in pressure due to wind force"; protected Modelica.Blocks.Interfaces.RealInput Cp_in_internal(unit="1") "Needed to connect to conditional connector"; Modelica.Blocks.Interfaces.RealInput pWea(min=0, nominal=1E5, unit="Pa") "Pressure from weather bus"; Modelica.Blocks.Interfaces.RealInput vWin(unit="m/s") "Wind speed from weather bus"; Modelica.Blocks.Interfaces.RealOutput pTot(min=0, nominal=1E5, unit="Pa") "Sum of atmospheric pressure and wind pressure"; equation connect(Cp_in, Cp_in_internal); if not use_Cp_in then Cp_in_internal = Cp; end if; pWin = 0.5*Cp_in_internal*vWin*vWin *Medium.density(Medium.setState_pTX( p=pWea, T=T_in_internal, X=Medium.X_default)); pTot = pWea + pWin; connect(weaBus.winSpe, vWin); connect(weaBus.pAtm, pWea); connect(p_in_internal, pTot); connect(weaBus.TDryBul, T_in_internal); end Outside_Cp;

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

Boundary that takes weather data as an input and computes wind pressure for low-rise buildings

Buildings.Fluid.Sources.Outside_CpLowRise

Information

This model describes boundary conditions for pressure, enthalpy, and species concentration that can be obtained from weather data. The model is identical to Buildings.Fluid.Sources.Outside, except that it adds the wind pressure to the pressure at the fluid port ports. The correlation that is used to compute the wind pressure is based on Swami and Chandra (1987) and valid for low-rise buildings with rectangular shape. The same correlation is also implemented in CONTAM (Persily and Ivy, 2001). For other buildings, the model Buildings.Fluid.Sources.Outside_Cp should be used that takes the wind pressure coefficient as an input or parameter.

The wind pressure coefficient is computed based on the side ratio of the walls, which is defined as

s = x ⁄ y

where x is the length of the wall that will be connected to this model, and y is the length of the adjacent wall. The wind direction is computed relative to the azimuth of this surface, which is equal to the parameter azi. The surface azimuth is defined in Buildings.Types.Azimuth. For example, if an exterior wall is South oriented, i.e., its outside-facing surface is towards South, use Buildings.Types.Azimuth.S.

Based on the surface azimuth, the wind direction and the side ratio of the walls, the model computes how much the wind pressure is attenuated compared to the reference wind pressure Cp0. The reference wind pressure Cp0 is a user-defined parameter, and must be equal to the wind pressure at zero wind incidence angle. Swami and Chandra (1987) recommend Cp0 = 0.6 for all low-rise buildings as this represents the average of various values reported in the literature. The computation of the actual wind pressure coefficient Cp is explained in the function Buildings.Airflow.Multizone.BaseClasses.windPressureLowRise that is called by this model.

The pressure p at the port ports is computed as

p = pw + Cp 1 ⁄ 2 v2 ρ,

where pw is the atmospheric pressure from the weather bus, v is the wind speed from the weather bus, and ρ is the fluid density.

References

Extends from Buildings.Fluid.Sources.BaseClasses.Outside (Boundary that takes weather data, and optionally trace substances, as an input).

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium in the component
Booleanuse_C_infalseGet the trace substances from the input connector
ExtraPropertyC[Medium.nC]fill(0, Medium.nC)Fixed values of trace substances
RealCp00.6Wind pressure coefficient for wind normal to wall [1]
Realss(final min=0, final unit="1")Side ratio, s=length of this wall/length of adjacent wall [1]
Angleazi Surface azimuth (South:0, West:pi/2) [rad]

Connectors

TypeNameDescription
FluidPorts_bports[nPorts] 
input RealInputC_in[Medium.nC]Prescribed boundary trace substances
BusweaBusBus with weather data

Modelica definition

model Outside_CpLowRise "Boundary that takes weather data as an input and computes wind pressure for low-rise buildings" extends Buildings.Fluid.Sources.BaseClasses.Outside; parameter Real Cp0(min=0, max=1, final unit="1") = 0.6 "Wind pressure coefficient for wind normal to wall"; parameter Real s(final min=0, final unit="1") "Side ratio, s=length of this wall/length of adjacent wall"; parameter Modelica.SIunits.Angle azi "Surface azimuth (South:0, West:pi/2)"; Modelica.SIunits.Angle alpha "Wind incidence angle (0: normal to wall)"; Real CpAct(min=0, final unit="1") "Actual wind pressure coefficient"; Modelica.SIunits.Pressure pWin(displayUnit="Pa") "Change in pressure due to wind force"; protected Modelica.Blocks.Interfaces.RealInput pWea(min=0, nominal=1E5, final unit="Pa") "Pressure from weather bus"; Modelica.Blocks.Interfaces.RealInput vWin(final unit="m/s") "Wind speed from weather bus"; Modelica.Blocks.Interfaces.RealOutput pTot(min=0, nominal=1E5, final unit="Pa") "Sum of atmospheric pressure and wind pressure"; final parameter Real G = Modelica.Math.log(s) "Natural logarithm of side ratio"; Modelica.Blocks.Interfaces.RealInput winDir(final unit="rad", displayUnit="deg") "Wind direction from weather bus"; Modelica.SIunits.Angle surOut = azi-Modelica.Constants.pi "Angle of surface that is used to compute angle of attack of wind"; Modelica.Blocks.Interfaces.RealInput d = Medium.density( Medium.setState_pTX(p_in_internal, T_in_internal, X_in_internal)); equation alpha = winDir-surOut; CpAct = Buildings.Airflow.Multizone.BaseClasses.windPressureLowRise( Cp0=Cp0, incAng=alpha, G=G); pWin = 0.5*CpAct*d*vWin*vWin; pTot = pWea + pWin; connect(weaBus.winDir, winDir); connect(weaBus.winSpe, vWin); connect(weaBus.pAtm, pWea); connect(p_in_internal, pTot); connect(weaBus.TDryBul, T_in_internal); end Outside_CpLowRise;

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

Model for overriding fluid properties that flow through the component, using temperature input

Buildings.Fluid.Sources.PropertySource_T

Information

Model that changes the properties, but not the mass flow rate, of the fluid that passes through it.

If allowFlowReversal=true, then the properties are changed for both flow directions, i.e., from port_a to port_b and from port_b to port_a.

Typical use and important parameters

The fluid properties h, Xi and C are only modified when the corresponding boolean parameter use_T_in, use_Xi_in or use_C_in is set to true.

Dynamics

This model has no dynamics.

Extends from Buildings.Fluid.Sources.BaseClasses.PartialPropertySource (Partial model for overriding fluid properties that flow through the component).

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium in the component
Inputs
Booleanuse_T_infalseSet to true to get the leaving fluid temperature from the input connector
Booleanuse_Xi_infalseSet to true to get the composition from the input connector
Booleanuse_C_infalseSet to true to get the trace substances from the input connector
Assumptions
BooleanallowFlowReversaltrue= false to simplify equations, assuming, but not enforcing, no flow reversal

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 RealInputXi_in[Medium.nXi]Prescribed values for composition
input RealInputC_in[Medium.nC]Prescribed values for trace substances
input RealInputT_inPrescribed value for leaving fluid temperature

Modelica definition

model PropertySource_T "Model for overriding fluid properties that flow through the component, using temperature input" // The parameter declaration is before 'extends', // since this affects the parameter order in the parameters window. parameter Boolean use_T_in= false "Set to true to get the leaving fluid temperature from the input connector"; extends Buildings.Fluid.Sources.BaseClasses.PartialPropertySource; Modelica.Blocks.Interfaces.RealInput T_in if use_T_in "Prescribed value for leaving fluid temperature"; protected Modelica.Blocks.Interfaces.RealOutput T_in_internal(unit="K") "Internal connector for leaving fluid temperature"; Modelica.Blocks.Interfaces.RealOutput h_T_a= Medium.specificEnthalpy( Medium.setState_pTX(port_a.p, T_in_internal, port_a.Xi_outflow)) if use_T_in "Conditional connector for enthalpy leaving port a"; Modelica.Blocks.Interfaces.RealOutput h_T_b= Medium.specificEnthalpy( Medium.setState_pTX(port_b.p, T_in_internal, port_b.Xi_outflow)) if use_T_in "Conditional connector for enthalpy leaving port b"; equation connect(h_internal_a, h_T_a); connect(h_internal_b, h_T_b); if use_T_in then connect(T_in_internal, T_in); else T_in_internal = 293.15; connect(h_internal_a, h_in_b); connect(h_internal_b, h_in_a); end if; end PropertySource_T;

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

Model for overriding fluid properties that flow through the component, using specific enthalpy input

Buildings.Fluid.Sources.PropertySource_h

Information

Model that changes the properties, but not the mass flow rate, of the fluid that passes through it.

If allowFlowReversal=true, then the properties are changed for both flow directions, i.e., from port_a to port_b and from port_b to port_a.

Typical use and important parameters

The fluid properties h, Xi and C are only modified when the corresponding boolean parameter use_h_in, use_Xi_in or use_C_in is set to true.

Dynamics

This model has no dynamics.

Extends from Buildings.Fluid.Sources.BaseClasses.PartialPropertySource (Partial model for overriding fluid properties that flow through the component).

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium in the component
Inputs
Booleanuse_h_infalseSet to true to get the specific enthalpy from the input connector
Booleanuse_Xi_infalseSet to true to get the composition from the input connector
Booleanuse_C_infalseSet to true to get the trace substances from the input connector
Assumptions
BooleanallowFlowReversaltrue= false to simplify equations, assuming, but not enforcing, no flow reversal

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 RealInputXi_in[Medium.nXi]Prescribed values for composition
input RealInputC_in[Medium.nC]Prescribed values for trace substances
input RealInputh_inPrescribed value for leaving specific enthalpy

Modelica definition

model PropertySource_h "Model for overriding fluid properties that flow through the component, using specific enthalpy input" // The parameter declaration is before 'extends', // since this affects the parameter order in the parameters window. parameter Boolean use_h_in= false "Set to true to get the specific enthalpy from the input connector"; extends Buildings.Fluid.Sources.BaseClasses.PartialPropertySource; Modelica.Blocks.Interfaces.RealInput h_in if use_h_in "Prescribed value for leaving specific enthalpy"; equation connect(h_internal_a, h_in); connect(h_internal_b, h_in); if not (use_h_in) then connect(h_internal_a,h_in_b); connect(h_internal_b,h_in_a); end if; end PropertySource_h;

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

Source with mass flow that does not take part in medium mass balance (such as CO2)

Buildings.Fluid.Sources.TraceSubstancesFlowSource

Information

This model can be used to inject trace substances into a system. The model adds a mass flow rate to its port with a trace substance concentration of 1.

Typical use and important parameters

A typical use of this model is to add carbon dioxide to room air, since the carbon dioxide concentration is typically so small that it need not be added to the room mass balance, and since the mass flow rate can be made small compared to the room volume if the medium that leaves this component has a carbon dioxide concentration of 1. The parameter substanceName must be set to the name of the substance that is injected into the fluid.

Note however that mixing volumes from the package Buildings.Fluid.MixingVolumes allow to directly add a trace substance mass flow rate, which is more efficient than using this model.

Parameters

TypeNameDefaultDescription
replaceable package MediumBuildings.Media.Air (extraPr...Medium in the component
StringsubstanceName"CO2"Name of trace substance
Booleanuse_m_flow_infalseGet the trace substance mass flow rate from the input connector
MassFlowRatem_flow0Fixed mass flow rate going out of the fluid port [kg/s]

Connectors

TypeNameDescription
replaceable package MediumMedium in the component
input RealInputm_flow_inPrescribed mass flow rate for extra property [kg/s]
FluidPorts_bports[nPorts]Connector for fluid ports

Modelica definition

model TraceSubstancesFlowSource "Source with mass flow that does not take part in medium mass balance (such as CO2)" replaceable package Medium = Buildings.Media.Air(extraPropertiesNames={"CO2"}) "Medium in the component"; parameter Integer nPorts=0 "Number of ports"; parameter String substanceName = "CO2" "Name of trace substance"; parameter Boolean use_m_flow_in = false "Get the trace substance mass flow rate from the input connector"; parameter Modelica.SIunits.MassFlowRate m_flow = 0 "Fixed mass flow rate going out of the fluid port"; Modelica.Blocks.Interfaces.RealInput m_flow_in(final unit="kg/s") if use_m_flow_in "Prescribed mass flow rate for extra property"; Modelica.Fluid.Interfaces.FluidPorts_b ports[nPorts]( redeclare each package Medium = Medium) "Connector for fluid ports"; protected parameter Medium.ExtraProperty C_in_internal[Medium.nC]( final quantity=Medium.extraPropertiesNames)= {if (Modelica.Utilities.Strings.isEqual(string1=Medium.extraPropertiesNames[i], string2=substanceName, caseSensitive=false)) then 1 else 0 for i in 1:Medium.nC} "Boundary trace substances"; Modelica.Blocks.Interfaces.RealInput m_flow_in_internal(final unit="kg/s") "Needed to connect to conditional connector"; Modelica.SIunits.SpecificEnthalpy h_default= Medium.specificEnthalpy(Medium.setState_pTX( Medium.p_default, Medium.T_default, Medium.X_default)) "Enthalpy of outstreaming medium"; initial equation assert(sum(C_in_internal) > 1E-4, "Trace substance '" + substanceName + "' is not present in medium '" + Medium.mediumName + "'.\n" + "Check source parameter and medium model."); // Only one connection allowed to a port to avoid unwanted ideal mixing for i in 1:nPorts loop assert(cardinality(ports[i]) <= 1," Each ports[i] of boundary shall at most be connected to one component. If two or more connections are present, ideal mixing takes place in these connections, which is usually not the intention of the modeller. Increase nPorts to add an additional port. "); end for; equation sum(ports.m_flow) = -m_flow_in_internal; connect(m_flow_in, m_flow_in_internal); if not use_m_flow_in then m_flow_in_internal = m_flow; end if; assert(m_flow_in_internal >= 0, "Reverse flow for species source is not yet implemented."); for i in 2:nPorts loop ports[1].p = ports[i].p; end for; ports.C_outflow = fill(C_in_internal, nPorts); ports.h_outflow = fill(h_default, nPorts); ports.Xi_outflow = fill(Medium.X_default[1:Medium.nXi], nPorts); end TraceSubstancesFlowSource;