Description: "Package with boundary condition models"

- Home > Modelica

## 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
--- | ---
Boundary_pT | Boundary with prescribed pressure, temperature, composition and trace substances
Boundary_ph | Boundary with prescribed pressure, specific enthalpy, composition and trace substances
FixedBoundary | Boundary source component
MassFlowSource_T | Ideal flow source that produces a prescribed mass flow with prescribed temperature, mass fraction and trace substances
MassFlowSource_h | Ideal flow source that produces a prescribed mass flow with prescribed specific enthalpy, mass fraction and trace substances
Outside | Boundary that takes weather data, and optionally trace substances, as an input
Outside_Cp | Boundary that takes weather data, and optionally the wind pressure coefficient and trace substances, as an input
Outside_CpLowRise | Boundary that takes weather data as an input and computes wind pressure for low-rise buildings
TraceSubstancesFlowSource | Source with mass flow that does not take part in medium mass balance (such as CO2)
Examples | Collection of models that illustrate model use and test models
BaseClasses | Package with base classes for Buildings.Fluid.Sources

## Buildings.Fluid.Sources.Boundary_pT

Boundary with prescribed pressure, temperature, composition and trace substances

### Information

Defines prescribed values for boundary conditions:

- Prescribed boundary pressure.
- Prescribed boundary temperature.
- Boundary composition (only for multi-substance or trace-substance flow).

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, composition and trace substances.

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 Modelica.Fluid.Sources.BaseClasses.PartialSource (Partial component source with one fluid connector).

### Parameters

Type | Name | Default | Description
--- | --- | --- | ---
replaceable package Medium | PartialMedium | Medium model within the source
Boolean | use_p_in | false | Get the pressure from the input connector
Boolean | use_T_in | false | Get the temperature from the input connector
Boolean | use_X_in | false | Get the composition from the input connector
Boolean | use_C_in | false | Get the trace substances from the input connector
AbsolutePressure | p | Medium.p_default | Fixed value of pressure [Pa]
Temperature | T | Medium.T_default | Fixed value of temperature [K]
MassFraction | X[Medium.nX] | Medium.X_default | Fixed value of composition [kg/kg]
ExtraProperty | C[Medium.nC] | fill(0, Medium.nC) | Fixed values of trace substances

### Connectors

Type | Name | Description
--- | --- | ---
FluidPorts_b | ports[nPorts] |
input RealInput | p_in | Prescribed boundary pressure
input RealInput | T_in | Prescribed boundary temperature
input RealInput | X_in[Medium.nX] | Prescribed boundary composition
input RealInput | C_in[Medium.nC] | Prescribed boundary trace substances

### Modelica definition

model Boundary_pT "Boundary with prescribed pressure, temperature, composition and trace substances" extends Modelica.Fluid.Sources.BaseClasses.PartialSource; parameter Boolean use_p_in = false "Get the pressure from the input connector"; parameter Boolean use_T_in= false "Get the temperature from the input connector"; parameter Boolean use_X_in = false "Get the composition from the input connector"; parameter Boolean use_C_in = false "Get the trace substances from the input connector"; parameter Medium.AbsolutePressure p = Medium.p_default "Fixed value of pressure"; parameter Medium.Temperature T = Medium.T_default "Fixed value of temperature"; parameter Medium.MassFraction X[Medium.nX] = Medium.X_default "Fixed value of composition"; parameter Medium.ExtraProperty C[Medium.nC]( quantity=Medium.extraPropertiesNames)=fill(0, Medium.nC) "Fixed values of trace substances"; Modelica.Blocks.Interfaces.RealInput p_in if use_p_in "Prescribed boundary pressure"; Modelica.Blocks.Interfaces.RealInput T_in if use_T_in "Prescribed boundary temperature"; Modelica.Blocks.Interfaces.RealInput X_in[Medium.nX] if use_X_in "Prescribed boundary composition"; Modelica.Blocks.Interfaces.RealInput C_in[Medium.nC] if use_C_in "Prescribed boundary trace substances"; protected Modelica.Blocks.Interfaces.RealInput p_in_internal "Needed to connect to conditional connector"; Modelica.Blocks.Interfaces.RealInput T_in_internal "Needed to connect to conditional connector"; Modelica.Blocks.Interfaces.RealInput X_in_internal[Medium.nX] "Needed to connect to conditional connector"; Modelica.Blocks.Interfaces.RealInput C_in_internal[Medium.nC] "Needed to connect to conditional connector"; equation Modelica.Fluid.Utilities.checkBoundary(Medium.mediumName, Medium.substanceNames, Medium.singleState, true, X_in_internal, "Boundary_pT"); connect(p_in, p_in_internal); connect(T_in, T_in_internal); connect(X_in, X_in_internal); connect(C_in, C_in_internal); if not use_p_in then p_in_internal = p; end if; if not use_T_in then T_in_internal = T; end if; if not use_X_in then X_in_internal = X; end if; if not use_C_in then C_in_internal = C; end if; medium.p = p_in_internal; medium.T = T_in_internal; medium.Xi = X_in_internal[1:Medium.nXi]; ports.C_outflow = fill(C_in_internal, nPorts); end Boundary_pT;

## Buildings.Fluid.Sources.Boundary_ph

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

### Information

Defines prescribed values for boundary conditions:

- Prescribed boundary pressure.
- Prescribed boundary temperature.
- Boundary composition (only for multi-substance or trace-substance flow).

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, composition and trace substances.

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 Modelica.Fluid.Sources.BaseClasses.PartialSource (Partial component source with one fluid connector).

### Parameters

Type | Name | Default | Description
--- | --- | --- | ---
replaceable package Medium | PartialMedium | Medium model within the source
Boolean | use_p_in | false | Get the pressure from the input connector
Boolean | use_h_in | false | Get the specific enthalpy from the input connector
Boolean | use_X_in | false | Get the composition from the input connector
Boolean | use_C_in | false | Get the trace substances from the input connector
AbsolutePressure | p | Medium.p_default | Fixed value of pressure [Pa]
SpecificEnthalpy | h | Medium.h_default | Fixed value of specific enthalpy [J/kg]
MassFraction | X[Medium.nX] | Medium.X_default | Fixed value of composition [kg/kg]
ExtraProperty | C[Medium.nC] | fill(0, Medium.nC) | Fixed values of trace substances

### Connectors

Type | Name | Description
--- | --- | ---
FluidPorts_b | ports[nPorts] |
input RealInput | p_in | Prescribed boundary pressure
input RealInput | h_in | Prescribed boundary specific enthalpy
input RealInput | X_in[Medium.nX] | Prescribed boundary composition
input RealInput | C_in[Medium.nC] | Prescribed boundary trace substances

### Modelica definition

model Boundary_ph "Boundary with prescribed pressure, specific enthalpy, composition and trace substances" extends Modelica.Fluid.Sources.BaseClasses.PartialSource; parameter Boolean use_p_in = false "Get the pressure from the input connector"; parameter Boolean use_h_in= false "Get the specific enthalpy from the input connector"; parameter Boolean use_X_in = false "Get the composition from the input connector"; parameter Boolean use_C_in = false "Get the trace substances from the input connector"; parameter Medium.AbsolutePressure p = Medium.p_default "Fixed value of pressure"; parameter Medium.SpecificEnthalpy h = Medium.h_default "Fixed value of specific enthalpy"; parameter Medium.MassFraction X[Medium.nX] = Medium.X_default "Fixed value of composition"; parameter Medium.ExtraProperty C[Medium.nC]( quantity=Medium.extraPropertiesNames)=fill(0, Medium.nC) "Fixed values of trace substances"; Modelica.Blocks.Interfaces.RealInput p_in if use_p_in "Prescribed boundary pressure"; Modelica.Blocks.Interfaces.RealInput h_in if use_h_in "Prescribed boundary specific enthalpy"; Modelica.Blocks.Interfaces.RealInput X_in[Medium.nX] if use_X_in "Prescribed boundary composition"; Modelica.Blocks.Interfaces.RealInput C_in[Medium.nC] if use_C_in "Prescribed boundary trace substances"; protected Modelica.Blocks.Interfaces.RealInput p_in_internal "Needed to connect to conditional connector"; Modelica.Blocks.Interfaces.RealInput h_in_internal "Needed to connect to conditional connector"; Modelica.Blocks.Interfaces.RealInput X_in_internal[Medium.nX] "Needed to connect to conditional connector"; Modelica.Blocks.Interfaces.RealInput C_in_internal[Medium.nC] "Needed to connect to conditional connector"; equation Modelica.Fluid.Utilities.checkBoundary(Medium.mediumName, Medium.substanceNames, Medium.singleState, true, X_in_internal, "Boundary_ph"); connect(p_in, p_in_internal); connect(h_in, h_in_internal); connect(X_in, X_in_internal); connect(C_in, C_in_internal); if not use_p_in then p_in_internal = p; end if; if not use_h_in then h_in_internal = h; end if; if not use_X_in then X_in_internal = X; end if; if not use_C_in then C_in_internal = C; end if; medium.p = p_in_internal; medium.h = h_in_internal; medium.Xi = X_in_internal[1:Medium.nXi]; ports.C_outflow = fill(C_in_internal, nPorts); end Boundary_ph;

## Buildings.Fluid.Sources.FixedBoundary

Boundary source component

### Information

This model defines constant values for boundary conditions:

- Boundary pressure or boundary density.
- Boundary temperature or boundary specific enthalpy.
- Boundary composition (only for multi-substance or trace-substance flow).

Note, that boundary temperature, density, 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 Modelica.Fluid.Sources.BaseClasses.PartialSource (Partial component source with one fluid connector).

### Parameters

Type | Name | Default | Description
--- | --- | --- | ---
replaceable package Medium | PartialMedium | Medium model within the source
Boundary pressure or Boundary density
Boolean | use_p | true | select p or d
AbsolutePressure | p | Medium.p_default | Boundary pressure [Pa]
Density | d | Medium.density_pTX(Medium.p_... | Boundary density [kg/m3]
Boundary temperature or Boundary specific enthalpy
Boolean | use_T | true | select T or h
Temperature | T | Medium.T_default | Boundary temperature [K]
SpecificEnthalpy | h | Medium.h_default | Boundary specific enthalpy [J/kg]
Only for multi-substance flow
MassFraction | X[Medium.nX] | Medium.X_default | Boundary mass fractions m_i/m [kg/kg]
Only for trace-substance flow
ExtraProperty | C[Medium.nC] | fill(0, Medium.nC) | Boundary trace substances

### Connectors

Type | Name | Description
--- | --- | ---
FluidPorts_b | ports[nPorts] |

### Modelica definition

model FixedBoundary "Boundary source component" extends Modelica.Fluid.Sources.BaseClasses.PartialSource; parameter Boolean use_p=true "select p or d"; parameter Medium.AbsolutePressure p=Medium.p_default "Boundary pressure"; parameter Medium.Density d=Medium.density_pTX(Medium.p_default, Medium.T_default, Medium.X_default) "Boundary density"; parameter Boolean use_T=true "select T or h"; parameter Medium.Temperature T=Medium.T_default "Boundary temperature"; parameter Medium.SpecificEnthalpy h=Medium.h_default "Boundary specific enthalpy"; parameter Medium.MassFraction X[Medium.nX]( quantity=Medium.substanceNames)=Medium.X_default "Boundary mass fractions m_i/m"; parameter Medium.ExtraProperty C[Medium.nC]( quantity=Medium.extraPropertiesNames)=fill(0, Medium.nC) "Boundary trace substances"; equation Modelica.Fluid.Utilities.checkBoundary(Medium.mediumName, Medium.substanceNames, Medium.singleState, use_p, X, "FixedBoundary"); if use_p or Medium.singleState then medium.p = p; else medium.d = d; end if; if use_T then medium.T = T; else medium.h = h; end if; medium.Xi = X[1:Medium.nXi]; ports.C_outflow = fill(C, nPorts); end FixedBoundary;

## Buildings.Fluid.Sources.MassFlowSource_T

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

### Information

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

- Prescribed mass flow rate.
- Prescribed temperature.
- Boundary composition (only for multi-substance or trace-substance flow).

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, composition and trace substances.

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 Modelica.Fluid.Sources.BaseClasses.PartialSource (Partial component source with one fluid connector).

### Parameters

Type | Name | Default | Description
--- | --- | --- | ---
replaceable package Medium | PartialMedium | Medium model within the source
Boolean | use_m_flow_in | false | Get the mass flow rate from the input connector
Boolean | use_T_in | false | Get the temperature from the input connector
Boolean | use_X_in | false | Get the composition from the input connector
Boolean | use_C_in | false | Get the trace substances from the input connector
MassFlowRate | m_flow | 0 | Fixed mass flow rate going out of the fluid port [kg/s]
Temperature | T | Medium.T_default | Fixed value of temperature [K]
MassFraction | X[Medium.nX] | Medium.X_default | Fixed value of composition [kg/kg]
ExtraProperty | C[Medium.nC] | fill(0, Medium.nC) | Fixed values of trace substances

### Connectors

Type | Name | Description
--- | --- | ---
FluidPorts_b | ports[nPorts] |
input RealInput | m_flow_in | Prescribed mass flow rate
input RealInput | T_in | Prescribed fluid temperature
input RealInput | X_in[Medium.nX] | Prescribed fluid composition
input RealInput | C_in[Medium.nC] | Prescribed boundary trace substances

### Modelica definition

model MassFlowSource_T "Ideal flow source that produces a prescribed mass flow with prescribed temperature, mass fraction and trace substances" extends Modelica.Fluid.Sources.BaseClasses.PartialSource; parameter Boolean use_m_flow_in = false "Get the mass flow rate from the input connector"; parameter Boolean use_T_in= false "Get the temperature from the input connector"; parameter Boolean use_X_in = false "Get the composition 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.Temperature T = Medium.T_default "Fixed value of temperature"; parameter Medium.MassFraction X[Medium.nX] = Medium.X_default "Fixed value of composition"; parameter Medium.ExtraProperty C[Medium.nC]( quantity=Medium.extraPropertiesNames)=fill(0, Medium.nC) "Fixed values of trace substances"; Modelica.Blocks.Interfaces.RealInput m_flow_in if use_m_flow_in "Prescribed mass flow rate"; Modelica.Blocks.Interfaces.RealInput T_in if use_T_in "Prescribed fluid temperature"; Modelica.Blocks.Interfaces.RealInput X_in[Medium.nX] if use_X_in "Prescribed fluid composition"; Modelica.Blocks.Interfaces.RealInput C_in[Medium.nC] if use_C_in "Prescribed boundary trace substances"; protected Modelica.Blocks.Interfaces.RealInput m_flow_in_internal "Needed to connect to conditional connector"; Modelica.Blocks.Interfaces.RealInput T_in_internal "Needed to connect to conditional connector"; Modelica.Blocks.Interfaces.RealInput X_in_internal[Medium.nX] "Needed to connect to conditional connector"; Modelica.Blocks.Interfaces.RealInput C_in_internal[Medium.nC] "Needed to connect to conditional connector"; equation Modelica.Fluid.Utilities.checkBoundary( Medium.mediumName, Medium.substanceNames, Medium.singleState, true, X_in_internal, "MassFlowSource_T"); connect(m_flow_in, m_flow_in_internal); connect(T_in, T_in_internal); connect(X_in, X_in_internal); connect(C_in, C_in_internal); if not use_m_flow_in then m_flow_in_internal = m_flow; end if; if not use_T_in then T_in_internal = T; end if; if not use_X_in then X_in_internal = X; end if; if not use_C_in then C_in_internal = C; end if; sum(ports.m_flow) = -m_flow_in_internal; medium.T = T_in_internal; medium.Xi = X_in_internal[1:Medium.nXi]; ports.C_outflow = fill(C_in_internal, nPorts); end MassFlowSource_T;

## Buildings.Fluid.Sources.MassFlowSource_h

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

### Information

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

- Prescribed mass flow rate.
- Prescribed specific enthalpy.
- Boundary composition (only for multi-substance or trace-substance flow).

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, composition and trace substances.

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 Modelica.Fluid.Sources.BaseClasses.PartialSource (Partial component source with one fluid connector).

### Parameters

Type | Name | Default | Description
--- | --- | --- | ---
replaceable package Medium | PartialMedium | Medium model within the source
Boolean | use_m_flow_in | false | Get the mass flow rate from the input connector
Boolean | use_h_in | false | Get the specific enthalpy from the input connector
Boolean | use_X_in | false | Get the composition from the input connector
Boolean | use_C_in | false | Get the trace substances from the input connector
MassFlowRate | m_flow | 0 | Fixed mass flow rate going out of the fluid port [kg/s]
SpecificEnthalpy | h | Medium.h_default | Fixed value of specific enthalpy [J/kg]
MassFraction | X[Medium.nX] | Medium.X_default | Fixed value of composition [kg/kg]
ExtraProperty | C[Medium.nC] | fill(0, Medium.nC) | Fixed values of trace substances

### Connectors

Type | Name | Description
--- | --- | ---
FluidPorts_b | ports[nPorts] |
input RealInput | m_flow_in | Prescribed mass flow rate
input RealInput | h_in | Prescribed fluid specific enthalpy
input RealInput | X_in[Medium.nX] | Prescribed fluid composition
input RealInput | C_in[Medium.nC] | Prescribed boundary trace substances

### Modelica definition

model MassFlowSource_h "Ideal flow source that produces a prescribed mass flow with prescribed specific enthalpy, mass fraction and trace substances" extends Modelica.Fluid.Sources.BaseClasses.PartialSource; parameter Boolean use_m_flow_in = false "Get the mass flow rate from the input connector"; parameter Boolean use_h_in= false "Get the specific enthalpy from the input connector"; parameter Boolean use_X_in = false "Get the composition 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.SpecificEnthalpy h = Medium.h_default "Fixed value of specific enthalpy"; parameter Medium.MassFraction X[Medium.nX] = Medium.X_default "Fixed value of composition"; parameter Medium.ExtraProperty C[Medium.nC]( quantity=Medium.extraPropertiesNames)=fill(0, Medium.nC) "Fixed values of trace substances"; Modelica.Blocks.Interfaces.RealInput m_flow_in if use_m_flow_in "Prescribed mass flow rate"; Modelica.Blocks.Interfaces.RealInput h_in if use_h_in "Prescribed fluid specific enthalpy"; Modelica.Blocks.Interfaces.RealInput X_in[Medium.nX] if use_X_in "Prescribed fluid composition"; Modelica.Blocks.Interfaces.RealInput C_in[Medium.nC] if use_C_in "Prescribed boundary trace substances"; protected Modelica.Blocks.Interfaces.RealInput m_flow_in_internal "Needed to connect to conditional connector"; Modelica.Blocks.Interfaces.RealInput h_in_internal "Needed to connect to conditional connector"; Modelica.Blocks.Interfaces.RealInput X_in_internal[Medium.nX] "Needed to connect to conditional connector"; Modelica.Blocks.Interfaces.RealInput C_in_internal[Medium.nC] "Needed to connect to conditional connector"; equation Modelica.Fluid.Utilities.checkBoundary( Medium.mediumName, Medium.substanceNames, Medium.singleState, true, X_in_internal, "MassFlowSource_h"); connect(m_flow_in, m_flow_in_internal); connect(h_in, h_in_internal); connect(X_in, X_in_internal); connect(C_in, C_in_internal); if not use_m_flow_in then m_flow_in_internal = m_flow; end if; if not use_h_in then h_in_internal = h; end if; if not use_X_in then X_in_internal = X; end if; if not use_C_in then C_in_internal = C; end if; sum(ports.m_flow) = -m_flow_in_internal; medium.h = h_in_internal; medium.Xi = X_in_internal[1:Medium.nXi]; ports.C_outflow = fill(C_in_internal, nPorts); end MassFlowSource_h;

## Buildings.Fluid.Sources.Outside

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

### 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

Type | Name | Default | Description
--- | --- | --- | ---
replaceable package Medium | PartialMedium | Medium model within the source
Boolean | use_C_in | false | Get the trace substances from the input connector
ExtraProperty | C[Medium.nC] | fill(0, Medium.nC) | Fixed values of trace substances

### Connectors

Type | Name | Description
--- | --- | ---
FluidPorts_b | ports[nPorts] |
input RealInput | C_in[Medium.nC] | Prescribed boundary trace substances
Bus | weaBus | Bus 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

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

### 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

Type | Name | Default | Description
--- | --- | --- | ---
replaceable package Medium | PartialMedium | Medium model within the source
Boolean | use_C_in | false | Get the trace substances from the input connector
ExtraProperty | C[Medium.nC] | fill(0, Medium.nC) | Fixed values of trace substances
Boolean | use_Cp_in | false | Get the wind pressure coefficient from the input connector
Real | Cp | 0.6 | Fixed value of wind pressure coefficient

### Connectors

Type | Name | Description
--- | --- | ---
FluidPorts_b | ports[nPorts] |
input RealInput | C_in[Medium.nC] | Prescribed boundary trace substances
Bus | weaBus | Bus with weather data
input RealInput | Cp_in | Prescribed 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*medium.d*vWin*vWin; 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

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

### 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

- Muthusamy V. Swami and Subrato Chandra. Procedures for Calculating Natural Ventilation Airflow Rates in Buildings. Florida Solar Energy Center, FSEC-CR-163-86. March, 1987. Cape Canaveral, Florida.
- Andrew K. Persily and Elizabeth M. Ivy. Input Data for Multizone Airflow and IAQ Analysis. NIST, NISTIR 6585. January, 2001. Gaithersburg, MD.

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

### Parameters

Type | Name | Default | Description
--- | --- | --- | ---
replaceable package Medium | PartialMedium | Medium model within the source
Boolean | use_C_in | false | Get the trace substances from the input connector
ExtraProperty | C[Medium.nC] | fill(0, Medium.nC) | Fixed values of trace substances
Real | Cp0 | 0.6 | Wind pressure coefficient for wind normal to wall
Real | s |  | Side ratio, s=length of this wall/length of adjacent wall
Angle | azi |  | Surface azimuth (South:0, West:pi/2) [rad]

### Connectors

Type | Name | Description
--- | --- | ---
FluidPorts_b | ports[nPorts] |
input RealInput | C_in[Medium.nC] | Prescribed boundary trace substances
Bus | weaBus | Bus 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) = 0.6 "Wind pressure coefficient for wind normal to wall"; parameter Real s(min=0) "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 "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, 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"; final parameter Real G = Modelica.Math.log(s) "Natural logarithm of side ratio"; Modelica.Blocks.Interfaces.RealInput winDir(unit="rad") "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"; equation alpha = winDir-surOut; CpAct = Buildings.Airflow.Multizone.BaseClasses.windPressureLowRise( Cp0=Cp0, incAng=alpha, G=G); pWin = 0.5*CpAct*medium.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.TraceSubstancesFlowSource

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

### 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.

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.

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

### Parameters

Type | Name | Default | Description
--- | --- | --- | ---
replaceable package Medium | PartialMedium | Medium model within the source
String | substanceName | "CO2" | Name of trace substance
Boolean | use_m_flow_in | false | Get the trace substance mass flow rate from the input connector
MassFlowRate | m_flow | 0 | Fixed mass flow rate going out of the fluid port [kg/s]

### Connectors

Type | Name | Description
--- | --- | ---
FluidPorts_b | ports[nPorts] |
input RealInput | m_flow_in | Prescribed mass flow rate for extra property

### Modelica definition

model TraceSubstancesFlowSource "Source with mass flow that does not take part in medium mass balance (such as CO2)" extends Modelica.Fluid.Sources.BaseClasses.PartialSource(nPorts=1); 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 if use_m_flow_in "Prescribed mass flow rate for extra property"; protected Modelica.Blocks.Interfaces.RealInput m_flow_in_internal "Needed to connect to conditional connector"; parameter Medium.ExtraProperty C_in_internal[Medium.nC]( each fixed=false, quantity=Medium.extraPropertiesNames) "Boundary trace substances"; initial algorithm for i in 1:Medium.nC loop if ( Modelica.Utilities.Strings.isEqual(string1=Medium.extraPropertiesNames[i], string2=substanceName, caseSensitive=false)) then C_in_internal[i] := 1; else C_in_internal[i] := 0; end if; end for; assert(sum(C_in_internal) > 1E-4, "Trace substance '" + substanceName + "' is not present in medium '" + Medium.mediumName + "'.\n" + "Check source parameter and medium model."); equation 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."); sum(ports.m_flow) = -m_flow_in_internal; medium.T = Medium.T_default; medium.Xi = Medium.X_default[1:Medium.nXi]; ports.C_outflow = fill(C_in_internal, nPorts); end TraceSubstancesFlowSource;