Buildings.Airflow.Multizone.BaseClasses

Package with base classes for Buildings.Airflow.Multizone

Information

This package contains base classes that are used to construct the models in Buildings.Airflow.Multizone.

Extends from Modelica.Icons.BasesPackage (Icon for packages containing base classes).

Package Content

Name Description
Buildings.Airflow.Multizone.BaseClasses.Door Door Partial door model for bi-directional flow
Buildings.Airflow.Multizone.BaseClasses.DoorDiscretized DoorDiscretized Door model using discretization along height coordinate
Buildings.Airflow.Multizone.BaseClasses.ErrorControl ErrorControl Interface that defines parameters for error control
Buildings.Airflow.Multizone.BaseClasses.PartialOneWayFlowElement PartialOneWayFlowElement Partial model for flow resistance with one-way flow
Buildings.Airflow.Multizone.BaseClasses.PowerLawResistanceParameters PowerLawResistanceParameters Power law resistance parameters
Buildings.Airflow.Multizone.BaseClasses.TwoWayFlowElement TwoWayFlowElement Flow resistance that uses the power law
Buildings.Airflow.Multizone.BaseClasses.TwoWayFlowElementBuoyancy TwoWayFlowElementBuoyancy Flow resistance that uses the power law
Buildings.Airflow.Multizone.BaseClasses.ZonalFlow ZonalFlow Flow across zonal boundaries of a room
Buildings.Airflow.Multizone.BaseClasses.powerLaw powerLaw Power law used in orifice equations
Buildings.Airflow.Multizone.BaseClasses.powerLawFixedM powerLawFixedM Power law used in orifice equations when m is constant
Buildings.Airflow.Multizone.BaseClasses.windPressureLowRise windPressureLowRise Wind pressure coefficient for low-rise buildings
Buildings.Airflow.Multizone.BaseClasses.windPressureProfile windPressureProfile Function for the cubic spline interpolation of a wind pressure profile with given support points and spline derivatives at these support points
Buildings.Airflow.Multizone.BaseClasses.Examples Examples Collection of models that illustrate model use and test models

Buildings.Airflow.Multizone.BaseClasses.Door Buildings.Airflow.Multizone.BaseClasses.Door

Partial door model for bi-directional flow

Buildings.Airflow.Multizone.BaseClasses.Door

Information

This is a partial model for the bi-directional air flow through a door.

Extends from Buildings.Fluid.Interfaces.PartialFourPortInterface (Partial model with four ports and declaration of quantities that are used by many models).

Parameters

TypeNameDefaultDescription
replaceable package Medium1PartialMediumMedium 1 in the component
replaceable package Medium2PartialMediumMedium 2 in the component
replaceable package MediumModelica.Media.Interfaces.Pa...Medium in the component
Nominal condition
MassFlowRatem1_flow_nominal10/3600*1.2Nominal mass flow rate [kg/s]
MassFlowRatem2_flow_nominalm1_flow_nominalNominal mass flow rate [kg/s]
Geometry
LengthwOpe0.9Width of opening [m]
LengthhOpe2.1Height of opening [m]
Assumptions
BooleanallowFlowReversal1true= false to simplify equations, assuming, but not enforcing, no flow reversal for medium 1
BooleanallowFlowReversal2true= false to simplify equations, assuming, but not enforcing, no flow reversal for medium 2
Advanced
MassFlowRatem1_flow_small1E-4*abs(m1_flow_nominal)Small mass flow rate for regularization of zero flow [kg/s]
MassFlowRatem2_flow_small1E-4*abs(m2_flow_nominal)Small mass flow rate for regularization of zero flow [kg/s]
PressureDifferencedp_turbulent0.01Pressure difference where laminar and turbulent flow relation coincide [Pa]
Diagnostics
Booleanshow_Tfalse= true, if actual temperature at port is computed

Connectors

TypeNameDescription
replaceable package Medium1Medium 1 in the component
replaceable package Medium2Medium 2 in the component
FluidPort_aport_a1Fluid connector a1 (positive design flow direction is from port_a1 to port_b1)
FluidPort_bport_b1Fluid connector b1 (positive design flow direction is from port_a1 to port_b1)
FluidPort_aport_a2Fluid connector a2 (positive design flow direction is from port_a2 to port_b2)
FluidPort_bport_b2Fluid connector b2 (positive design flow direction is from port_a2 to port_b2)
replaceable package MediumMedium in the component

Modelica definition

partial model Door "Partial door model for bi-directional flow" extends Buildings.Fluid.Interfaces.PartialFourPortInterface( redeclare final package Medium1 = Medium, redeclare final package Medium2 = Medium, final allowFlowReversal1=true, final allowFlowReversal2=true, final m1_flow_nominal=10/3600*1.2, final m2_flow_nominal=m1_flow_nominal, final m1_flow_small=1E-4*abs(m1_flow_nominal), final m2_flow_small=1E-4*abs(m2_flow_nominal)); replaceable package Medium = Modelica.Media.Interfaces.PartialMedium "Medium in the component"; parameter Modelica.Units.SI.Length wOpe=0.9 "Width of opening"; parameter Modelica.Units.SI.Length hOpe=2.1 "Height of opening"; parameter Modelica.Units.SI.PressureDifference dp_turbulent( min=0, displayUnit="Pa") = 0.01 "Pressure difference where laminar and turbulent flow relation coincide"; Modelica.Units.SI.VolumeFlowRate VAB_flow(nominal=0.001) "Volume flow rate from A to B if positive"; Modelica.Units.SI.VolumeFlowRate VBA_flow(nominal=0.001) "Volume flow rate from B to A if positive"; input Modelica.Units.SI.Velocity vAB(nominal=0.01) "Average velocity from A to B"; input Modelica.Units.SI.Velocity vBA(nominal=0.01) "Average velocity from B to A"; protected final parameter Modelica.Units.SI.Area AOpe=wOpe*hOpe "Open aperture area"; constant Real conTP = Buildings.Media.Air.dStp*Modelica.Media.IdealGases.Common.SingleGasesData.Air.R_s "Conversion factor for converting temperature difference to pressure difference"; parameter Medium.ThermodynamicState sta_default=Medium.setState_pTX( T=Medium.T_default, p=Medium.p_default, X=Medium.X_default); parameter Modelica.Units.SI.Density rho_default=Medium.density(sta_default) "Density"; Modelica.Units.SI.VolumeFlowRate VABp_flow(nominal=0.001) "Volume flow rate from A to B if positive due to static pressure difference"; Modelica.Units.SI.MassFlowRate mABt_flow(nominal=0.001) "Mass flow rate from A to B if positive due to buoyancy"; equation // Net flow rate port_a1.m_flow = (rho_default * VABp_flow/2 + mABt_flow); port_b2.m_flow = (rho_default * VABp_flow/2 - mABt_flow); // Average velocity (using the whole orifice area) VAB_flow = (max(port_a1.m_flow, 0) + max(port_b2.m_flow, 0))/rho_default; VBA_flow = (max(port_a2.m_flow, 0) + max(port_b1.m_flow, 0))/rho_default; // Energy balance (no storage, no heat loss/gain) port_a1.h_outflow = inStream(port_b1.h_outflow); port_b1.h_outflow = inStream(port_a1.h_outflow); port_a2.h_outflow = inStream(port_b2.h_outflow); port_b2.h_outflow = inStream(port_a2.h_outflow); // Mass balance (no storage) port_a1.m_flow = -port_b1.m_flow; port_a2.m_flow = -port_b2.m_flow; port_a1.Xi_outflow = inStream(port_b1.Xi_outflow); port_b1.Xi_outflow = inStream(port_a1.Xi_outflow); port_a2.Xi_outflow = inStream(port_b2.Xi_outflow); port_b2.Xi_outflow = inStream(port_a2.Xi_outflow); // Transport of trace substances port_a1.C_outflow = inStream(port_b1.C_outflow); port_b1.C_outflow = inStream(port_a1.C_outflow); port_a2.C_outflow = inStream(port_b2.C_outflow); port_b2.C_outflow = inStream(port_a2.C_outflow); end Door;

Buildings.Airflow.Multizone.BaseClasses.DoorDiscretized Buildings.Airflow.Multizone.BaseClasses.DoorDiscretized

Door model using discretization along height coordinate

Buildings.Airflow.Multizone.BaseClasses.DoorDiscretized

Information

This is a partial model for the bi-directional air flow through a door.

To compute the bi-directional flow, the door is discretize along the height coordinate, and uses an orifice equation to compute the flow for each compartment.

The compartment area dA is a variable, which allows using the model for a door that can be open or closed.

Extends from Buildings.Airflow.Multizone.BaseClasses.TwoWayFlowElementBuoyancy (Flow resistance that uses the power law).

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium in the component
VelocityvZer0.001Minimum velocity to prevent zero flow. Recommended: 0.001 [m/s]
IntegernCom10Number of compartments for the discretization
PressureDifferencedp_turbulent0.01Pressure difference where laminar and turbulent flow relation coincide. Recommended: 0.01 [Pa]
Geometry
LengthwOpe0.9Width of opening [m]
LengthhOpe2.1Height of opening [m]
LengthhA2.7/2Height of reference pressure zone A [m]
LengthhB2.7/2Height of reference pressure zone B [m]
Advanced
Diagnostics
Booleanshow_Tfalse= true, if actual temperature at port is computed
BooleanforceErrorControlOnFlowtrueFlag to force error control on m_flow. Set to true if interested in flow rate

Connectors

TypeNameDescription
FluidPort_aport_a1Fluid connector a1 (positive design flow direction is from port_a1 to port_b1)
FluidPort_bport_b1Fluid connector b1 (positive design flow direction is from port_a1 to port_b1)
FluidPort_aport_a2Fluid connector a2 (positive design flow direction is from port_a2 to port_b2)
FluidPort_bport_b2Fluid connector b2 (positive design flow direction is from port_a2 to port_b2)

Modelica definition

partial model DoorDiscretized "Door model using discretization along height coordinate" extends Buildings.Airflow.Multizone.BaseClasses.TwoWayFlowElementBuoyancy; parameter Integer nCom=10 "Number of compartments for the discretization"; parameter Modelica.Units.SI.PressureDifference dp_turbulent( min=0, displayUnit="Pa") = 0.01 "Pressure difference where laminar and turbulent flow relation coincide. Recommended: 0.01"; Modelica.Units.SI.PressureDifference dpAB[nCom](each nominal=1) "Pressure difference between compartments"; Modelica.Units.SI.Velocity v[nCom](each nominal=0.01) "Velocity in compartment from A to B"; Modelica.Units.SI.Velocity vTop "Velocity at top of opening from A to B"; Modelica.Units.SI.Velocity vBot "Velocity at bottom of opening from A to B"; protected parameter Modelica.Units.SI.Length dh=hOpe/nCom "Height of each compartment"; parameter Medium.ThermodynamicState sta_default=Medium.setState_pTX( T=Medium.T_default, p=Medium.p_default, X=Medium.X_default); parameter Modelica.Units.SI.Density rho_default=Medium.density(sta_default) "Density, used to compute fluid volume"; parameter Real hAg[nCom](each unit="m2/s2")= {Modelica.Constants.g_n*(hA - (i - 0.5)*dh) for i in 1:nCom} "Product g*h_i for each compartment"; parameter Real hBg[nCom](each unit="m2/s2")= {Modelica.Constants.g_n*(hB - (i - 0.5)*dh) for i in 1:nCom} "Product g*h_i for each compartment"; Modelica.Units.SI.AbsolutePressure pA[nCom](each nominal=101325) "Pressure in compartments of room A"; Modelica.Units.SI.AbsolutePressure pB[nCom](each nominal=101325) "Pressure in compartments of room B"; Modelica.Units.SI.VolumeFlowRate dV_flow[nCom] "Volume flow rate through compartment from A to B"; Modelica.Units.SI.VolumeFlowRate dVAB_flow[nCom] "Volume flow rate through compartment from A to B if positive"; Modelica.Units.SI.VolumeFlowRate dVBA_flow[nCom] "Volume flow rate through compartment from B to A if positive"; Modelica.Units.SI.VolumeFlowRate VZerCom_flow=VZer_flow/nCom "Small flow rate for regularization"; Real m(min=0.5, max=1) "Flow exponent, m=0.5 for turbulent, m=1 for laminar"; Real CVal "Flow coefficient for each compartment, C = V_flow/ dp^m"; Modelica.Units.SI.Area dA "Compartment area"; Real gaiFlo[nCom] "Gain to sum up the positive flows and set the negative to zero in a differentiable way"; equation dA = A/nCom; for i in 1:nCom loop // pressure drop in each compartment pA[i] = port_a1.p + rho_a1_inflow*hAg[i]; pB[i] = port_a2.p + rho_a2_inflow*hBg[i]; dpAB[i] = pA[i] - pB[i]; v[i] = dV_flow[i]/dA; // assignment of net volume flows gaiFlo[i] = Buildings.Utilities.Math.Functions.smoothHeaviside(x=dV_flow[i], delta=VZerCom_flow); dVAB_flow[i] = dV_flow[i] * gaiFlo[i]; dVBA_flow[i] = -dV_flow[i] * (1-gaiFlo[i]); end for; // add positive and negative flows VAB_flow = sum(dVAB_flow); VBA_flow = sum(dVBA_flow); vTop = v[nCom]; vBot = v[1]; end DoorDiscretized;

Buildings.Airflow.Multizone.BaseClasses.ErrorControl

Interface that defines parameters for error control

Information

This is an interface that defines parameters used for error control.

Dymola does error control on state variables, such as temperature, pressure and species concentration. Flow variables such as m_flow are typically not checked during the error control. This can give large errors in flow variables, as long as the error on the volume's state variables that are coupled to the flow variables is small. Obtaining accurate flow variables can be achieved by imposing an error control on the exchanged mass, which can be defined as

  dm/dt = m_flow.

By setting forceErrorControlOnFlow = true, such an equation is imposed by models that extend this class.

Parameters

TypeNameDefaultDescription
Advanced
BooleanforceErrorControlOnFlowtrueFlag to force error control on m_flow. Set to true if interested in flow rate

Modelica definition

model ErrorControl "Interface that defines parameters for error control" parameter Boolean forceErrorControlOnFlow = true "Flag to force error control on m_flow. Set to true if interested in flow rate"; end ErrorControl;

Buildings.Airflow.Multizone.BaseClasses.PartialOneWayFlowElement Buildings.Airflow.Multizone.BaseClasses.PartialOneWayFlowElement

Partial model for flow resistance with one-way flow

Buildings.Airflow.Multizone.BaseClasses.PartialOneWayFlowElement

Information

This partial model is used to model one way flow-elements. It holds the conservation equations and should be extended by definition of one of the following variables:

m_flow = mass flow rate trough the component

or

V_flow = volume flow rate through the component

The flow from A->B is the positive flow. The resulting equation should be in the extends statement, not in the equation section since this model sets both m_flow = V_flow*rho and V_flow = m_flow/rho.

Extends from Buildings.Fluid.Interfaces.PartialTwoPortInterface (Partial model with two ports and declaration of quantities that are used by many models), Buildings.Airflow.Multizone.BaseClasses.ErrorControl (Interface that defines parameters for error control).

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium in the component
Nominal condition
MassFlowRatem_flow_nominal Nominal mass flow rate [kg/s]
Assumptions
BooleanallowFlowReversaltrue= false to simplify equations, assuming, but not enforcing, no flow reversal
Advanced
MassFlowRatem_flow_small1E-4*abs(m_flow_nominal)Small mass flow rate for regularization of zero flow [kg/s]
BooleanforceErrorControlOnFlowtrueFlag to force error control on m_flow. Set to true if interested in flow rate
BooleanuseDefaultPropertiestrueSet to false to use density and viscosity based on actual medium state, rather than using default values
PressureDifferencedp_turbulent0.1Pressure difference where laminar and turbulent flow relation coincide. Recommended = 0.1 [Pa]
Diagnostics
Booleanshow_Tfalse= true, if actual temperature at port is computed

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)

Modelica definition

partial model PartialOneWayFlowElement "Partial model for flow resistance with one-way flow" extends Buildings.Fluid.Interfaces.PartialTwoPortInterface( final allowFlowReversal=true); extends Buildings.Airflow.Multizone.BaseClasses.ErrorControl; constant Boolean homotopyInitialization = true "= true, use homotopy method"; parameter Boolean useDefaultProperties=true "Set to false to use density and viscosity based on actual medium state, rather than using default values"; parameter Modelica.Units.SI.PressureDifference dp_turbulent(min=0, displayUnit="Pa") = 0.1 "Pressure difference where laminar and turbulent flow relation coincide. Recommended = 0.1"; Modelica.Units.SI.VolumeFlowRate V_flow = m_flow/rho "Volume flow rate through the component"; Modelica.Units.SI.Density rho "Fluid density at port_a"; protected parameter Medium.ThermodynamicState sta_default=Medium.setState_pTX( T=Medium.T_default, p=Medium.p_default, X=Medium.X_default) "State of the medium at the medium default properties"; parameter Modelica.Units.SI.Density rho_default=Medium.density(sta_default) "Density at the medium default properties"; parameter Modelica.Units.SI.DynamicViscosity dynVis_default= Medium.dynamicViscosity(sta_default) "Dynamic viscosity at the medium default properties"; Medium.ThermodynamicState sta "State of the medium in the component"; Modelica.Units.SI.DynamicViscosity dynVis "Dynamic viscosity"; Real mExc(quantity="Mass", final unit="kg") "Air mass exchanged (for purpose of error control only)"; initial equation mExc=0; assert(homotopyInitialization, "In " + getInstanceName() + ": The constant homotopyInitialization has been modified from its default value. This constant will be removed in future releases.", level = AssertionLevel.warning); equation if forceErrorControlOnFlow then der(mExc) = port_a.m_flow; else der(mExc) = 0; end if; if useDefaultProperties then sta = sta_default; rho = rho_default; dynVis = dynVis_default; else sta = if homotopyInitialization then Medium.setState_phX( port_a.p, homotopy( actual=actualStream(port_a.h_outflow), simplified=inStream(port_a.h_outflow)), homotopy( actual=actualStream(port_a.Xi_outflow), simplified=inStream(port_a.Xi_outflow))) else Medium.setState_phX( port_a.p, actualStream(port_a.h_outflow), actualStream(port_a.Xi_outflow)); rho = Medium.density(sta); dynVis = Medium.dynamicViscosity(sta); end if; // Isenthalpic state transformation (no storage and no loss of energy) port_a.h_outflow = inStream(port_b.h_outflow); port_b.h_outflow = inStream(port_a.h_outflow); // Mass balance (no storage) port_a.m_flow + port_b.m_flow = 0; // Transport of substances port_a.Xi_outflow = inStream(port_b.Xi_outflow); port_b.Xi_outflow = inStream(port_a.Xi_outflow); port_a.C_outflow = inStream(port_b.C_outflow); port_b.C_outflow = inStream(port_a.C_outflow); m_flow=port_a.m_flow; end PartialOneWayFlowElement;

Buildings.Airflow.Multizone.BaseClasses.PowerLawResistanceParameters

Power law resistance parameters

Information

Parameters that are required for the components that implement a power law resistance.

Parameters

TypeNameDefaultDescription
Realm Flow exponent, m=0.5 for turbulent, m=1 for laminar

Modelica definition

model PowerLawResistanceParameters "Power law resistance parameters" parameter Real m(min=0.5, max=1) "Flow exponent, m=0.5 for turbulent, m=1 for laminar"; protected constant Real gamma(min=1) = 1.5 "Normalized flow rate where dphi(0)/dpi intersects phi(1)"; parameter Real a = gamma "Polynomial coefficient for regularized implementation of flow resistance"; parameter Real b = 1/8*m^2 - 3*gamma - 3/2*m + 35.0/8 "Polynomial coefficient for regularized implementation of flow resistance"; parameter Real c = -1/4*m^2 + 3*gamma + 5/2*m - 21.0/4 "Polynomial coefficient for regularized implementation of flow resistance"; parameter Real d = 1/8*m^2 - gamma - m + 15.0/8 "Polynomial coefficient for regularized implementation of flow resistance"; end PowerLawResistanceParameters;

Buildings.Airflow.Multizone.BaseClasses.TwoWayFlowElement Buildings.Airflow.Multizone.BaseClasses.TwoWayFlowElement

Flow resistance that uses the power law

Buildings.Airflow.Multizone.BaseClasses.TwoWayFlowElement

Information

This is a partial model for models that describe the bi-directional air flow through large openings.

Models that extend this model need to compute mAB_flow and mBA_flow, or alternatively VAB_flow and VBA_flow, and the face area area. The face area is a variable to allow this partial model to be used for doors that can be open or closed as a function of an input signal.

Extends from Buildings.Fluid.Interfaces.PartialFourPortInterface (Partial model with four ports and declaration of quantities that are used by many models), Buildings.Airflow.Multizone.BaseClasses.ErrorControl (Interface that defines parameters for error control).

Parameters

TypeNameDefaultDescription
replaceable package Medium1PartialMediumMedium 1 in the component
replaceable package Medium2PartialMediumMedium 2 in the component
replaceable package MediumModelica.Media.Interfaces.Pa...Medium in the component
VelocityvZer0.001Minimum velocity to prevent zero flow. Recommended: 0.001 [m/s]
Nominal condition
MassFlowRatem1_flow_nominal10/3600*1.2Nominal mass flow rate [kg/s]
MassFlowRatem2_flow_nominalm1_flow_nominalNominal mass flow rate [kg/s]
Assumptions
BooleanallowFlowReversal1true= false to simplify equations, assuming, but not enforcing, no flow reversal for medium 1
BooleanallowFlowReversal2true= false to simplify equations, assuming, but not enforcing, no flow reversal for medium 2
Advanced
MassFlowRatem1_flow_small1E-4*abs(m1_flow_nominal)Small mass flow rate for regularization of zero flow [kg/s]
MassFlowRatem2_flow_small1E-4*abs(m2_flow_nominal)Small mass flow rate for regularization of zero flow [kg/s]
BooleanforceErrorControlOnFlowtrueFlag to force error control on m_flow. Set to true if interested in flow rate
Diagnostics
Booleanshow_Tfalse= true, if actual temperature at port is computed

Connectors

TypeNameDescription
replaceable package Medium1Medium 1 in the component
replaceable package Medium2Medium 2 in the component
FluidPort_aport_a1Fluid connector a1 (positive design flow direction is from port_a1 to port_b1)
FluidPort_bport_b1Fluid connector b1 (positive design flow direction is from port_a1 to port_b1)
FluidPort_aport_a2Fluid connector a2 (positive design flow direction is from port_a2 to port_b2)
FluidPort_bport_b2Fluid connector b2 (positive design flow direction is from port_a2 to port_b2)
replaceable package MediumMedium in the component

Modelica definition

partial model TwoWayFlowElement "Flow resistance that uses the power law" extends Buildings.Fluid.Interfaces.PartialFourPortInterface( redeclare final package Medium1 = Medium, redeclare final package Medium2 = Medium, final allowFlowReversal1=true, final allowFlowReversal2=true, final m1_flow_nominal=10/3600*1.2, final m2_flow_nominal=m1_flow_nominal, final m1_flow_small=1E-4*abs(m1_flow_nominal), final m2_flow_small=1E-4*abs(m2_flow_nominal)); extends Buildings.Airflow.Multizone.BaseClasses.ErrorControl; replaceable package Medium = Modelica.Media.Interfaces.PartialMedium "Medium in the component"; parameter Modelica.Units.SI.Velocity vZer=0.001 "Minimum velocity to prevent zero flow. Recommended: 0.001"; Modelica.Units.SI.VolumeFlowRate VAB_flow(nominal=0.001) "Volume flow rate from A to B if positive"; Modelica.Units.SI.VolumeFlowRate VBA_flow(nominal=0.001) "Volume flow rate from B to A if positive"; Modelica.Units.SI.MassFlowRate mAB_flow(nominal=0.001) "Mass flow rate from A to B if positive"; Modelica.Units.SI.MassFlowRate mBA_flow(nominal=0.001) "Mass flow rate from B to A if positive"; Modelica.Units.SI.Velocity vAB(nominal=0.01) "Average velocity from A to B"; Modelica.Units.SI.Velocity vBA(nominal=0.01) "Average velocity from B to A"; Modelica.Units.SI.Density rho_a1_inflow "Density of air flowing in from port_a1"; Modelica.Units.SI.Density rho_a2_inflow "Density of air flowing in from port_a2"; Modelica.Units.SI.Area A "Face area"; protected Modelica.Units.SI.VolumeFlowRate VZer_flow(fixed=false) "Minimum net volume flow rate to prevent zero flow"; Modelica.Units.SI.Mass mExcAB(start=0, fixed=true) "Air mass exchanged (for purpose of error control only)"; Modelica.Units.SI.Mass mExcBA(start=0, fixed=true) "Air mass exchanged (for purpose of error control only)"; Medium.MassFraction Xi_a1_inflow[Medium1.nXi] "Mass fraction of medium that flows in at port a1"; Medium.MassFraction Xi_a2_inflow[Medium2.nXi] "Mass fraction of medium that flows in at port a2"; equation // enforcing error control on both direction rather than on the sum only // gives higher robustness. The reason may be that for bi-directional flow, // (VAB_flow - VBA_flow) may be close to zero. if forceErrorControlOnFlow then der(mExcAB) = mAB_flow; der(mExcBA) = mBA_flow; else der(mExcAB) = 0; der(mExcBA) = 0; end if; // Compute the density of the inflowing media. // Note that Modelica.Media.Air.SimpleAir does not contain moisture, // and hence we check for Medium?.nXi == 0. // We first compute temperature and then invoke a density function that // takes temperature as an argument. Simply calling a density function // of a medium that takes enthalpy as an argument would be dangerous // as different media can have different datum for the enthalpy. Xi_a1_inflow = inStream(port_a1.Xi_outflow); rho_a1_inflow = Buildings.Utilities.Psychrometrics.Functions.density_pTX( p=port_a1.p, T=Medium1.temperature(state_a1_inflow), X_w=if Medium1.nXi == 0 then 0 else Xi_a1_inflow[1]); Xi_a2_inflow = inStream(port_a2.Xi_outflow); rho_a2_inflow = Buildings.Utilities.Psychrometrics.Functions.density_pTX( p=port_a2.p, T=Medium2.temperature(state_a2_inflow), X_w=if Medium2.nXi == 0 then 0 else Xi_a2_inflow[1]); VZer_flow = vZer*A; mAB_flow = rho_a1_inflow*VAB_flow; mBA_flow = rho_a2_inflow*VBA_flow; // Average velocity (using the whole orifice area) vAB = VAB_flow/A; vBA = VBA_flow/A; port_a1.m_flow = mAB_flow; port_a2.m_flow = mBA_flow; // Energy balance (no storage, no heat loss/gain) port_a1.h_outflow = inStream(port_b1.h_outflow); port_b1.h_outflow = inStream(port_a1.h_outflow); port_a2.h_outflow = inStream(port_b2.h_outflow); port_b2.h_outflow = inStream(port_a2.h_outflow); // Mass balance (no storage) port_a1.m_flow = -port_b1.m_flow; port_a2.m_flow = -port_b2.m_flow; port_a1.Xi_outflow = inStream(port_b1.Xi_outflow); port_b1.Xi_outflow = inStream(port_a1.Xi_outflow); port_a2.Xi_outflow = inStream(port_b2.Xi_outflow); port_b2.Xi_outflow = inStream(port_a2.Xi_outflow); // Transport of trace substances port_a1.C_outflow = inStream(port_b1.C_outflow); port_b1.C_outflow = inStream(port_a1.C_outflow); port_a2.C_outflow = inStream(port_b2.C_outflow); port_b2.C_outflow = inStream(port_a2.C_outflow); end TwoWayFlowElement;

Buildings.Airflow.Multizone.BaseClasses.TwoWayFlowElementBuoyancy Buildings.Airflow.Multizone.BaseClasses.TwoWayFlowElementBuoyancy

Flow resistance that uses the power law

Buildings.Airflow.Multizone.BaseClasses.TwoWayFlowElementBuoyancy

Information

This is a partial model for models that describe the bi-directional air flow through large openings.

Models that extend this model need to compute mAB_flow and mBA_flow, or alternatively VAB_flow and VBA_flow, and the face area area. The face area is a variable to allow this partial model to be used for doors that can be open or closed as a function of an input signal.

Extends from Buildings.Airflow.Multizone.BaseClasses.TwoWayFlowElement (Flow resistance that uses the power law).

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium in the component
VelocityvZer0.001Minimum velocity to prevent zero flow. Recommended: 0.001 [m/s]
Geometry
LengthwOpe0.9Width of opening [m]
LengthhOpe2.1Height of opening [m]
LengthhA2.7/2Height of reference pressure zone A [m]
LengthhB2.7/2Height of reference pressure zone B [m]
Advanced
Diagnostics
Booleanshow_Tfalse= true, if actual temperature at port is computed
BooleanforceErrorControlOnFlowtrueFlag to force error control on m_flow. Set to true if interested in flow rate

Connectors

TypeNameDescription
FluidPort_aport_a1Fluid connector a1 (positive design flow direction is from port_a1 to port_b1)
FluidPort_bport_b1Fluid connector b1 (positive design flow direction is from port_a1 to port_b1)
FluidPort_aport_a2Fluid connector a2 (positive design flow direction is from port_a2 to port_b2)
FluidPort_bport_b2Fluid connector b2 (positive design flow direction is from port_a2 to port_b2)

Modelica definition

partial model TwoWayFlowElementBuoyancy "Flow resistance that uses the power law" extends Buildings.Airflow.Multizone.BaseClasses.TwoWayFlowElement; parameter Modelica.Units.SI.Length wOpe=0.9 "Width of opening"; parameter Modelica.Units.SI.Length hOpe=2.1 "Height of opening"; parameter Modelica.Units.SI.Length hA=2.7/2 "Height of reference pressure zone A"; parameter Modelica.Units.SI.Length hB=2.7/2 "Height of reference pressure zone B"; end TwoWayFlowElementBuoyancy;

Buildings.Airflow.Multizone.BaseClasses.ZonalFlow Buildings.Airflow.Multizone.BaseClasses.ZonalFlow

Flow across zonal boundaries of a room

Buildings.Airflow.Multizone.BaseClasses.ZonalFlow

Information

This is a partial model for computing the air exchange between volumes. Models that extend this model need to provide an equation for port_a1.m_flow and port_a2.m_flow.

Extends from Buildings.Fluid.Interfaces.PartialFourPortInterface (Partial model with four ports and declaration of quantities that are used by many models).

Parameters

TypeNameDefaultDescription
replaceable package Medium1PartialMediumMedium 1 in the component
replaceable package Medium2PartialMediumMedium 2 in the component
replaceable package MediumModelica.Media.Interfaces.Pa...Medium in the component
Nominal condition
MassFlowRatem1_flow_nominal10/3600*1.2Nominal mass flow rate [kg/s]
MassFlowRatem2_flow_nominalm1_flow_nominalNominal mass flow rate [kg/s]
Assumptions
BooleanallowFlowReversal1false= false to simplify equations, assuming, but not enforcing, no flow reversal for medium 1
BooleanallowFlowReversal2false= false to simplify equations, assuming, but not enforcing, no flow reversal for medium 2
Advanced
MassFlowRatem1_flow_small1E-4*abs(m1_flow_nominal)Small mass flow rate for regularization of zero flow [kg/s]
MassFlowRatem2_flow_small1E-4*abs(m2_flow_nominal)Small mass flow rate for regularization of zero flow [kg/s]
Diagnostics
Booleanshow_Tfalse= true, if actual temperature at port is computed

Connectors

TypeNameDescription
replaceable package Medium1Medium 1 in the component
replaceable package Medium2Medium 2 in the component
FluidPort_aport_a1Fluid connector a1 (positive design flow direction is from port_a1 to port_b1)
FluidPort_bport_b1Fluid connector b1 (positive design flow direction is from port_a1 to port_b1)
FluidPort_aport_a2Fluid connector a2 (positive design flow direction is from port_a2 to port_b2)
FluidPort_bport_b2Fluid connector b2 (positive design flow direction is from port_a2 to port_b2)
replaceable package MediumMedium in the component

Modelica definition

partial model ZonalFlow "Flow across zonal boundaries of a room" extends Buildings.Fluid.Interfaces.PartialFourPortInterface( redeclare final package Medium1 = Medium, redeclare final package Medium2 = Medium, final allowFlowReversal1 = false, final allowFlowReversal2 = false, final m1_flow_nominal = 10/3600*1.2, final m2_flow_nominal = m1_flow_nominal, final m1_flow_small=1E-4*abs(m1_flow_nominal), final m2_flow_small=1E-4*abs(m2_flow_nominal)); replaceable package Medium = Modelica.Media.Interfaces.PartialMedium "Medium in the component"; equation // Energy balance (no storage, no heat loss/gain) port_a1.h_outflow = inStream(port_b1.h_outflow); port_b1.h_outflow = inStream(port_a1.h_outflow); port_a2.h_outflow = inStream(port_b2.h_outflow); port_b2.h_outflow = inStream(port_a2.h_outflow); // Mass balance (no storage) port_a1.m_flow = -port_b1.m_flow; port_a2.m_flow = -port_b2.m_flow; port_a1.Xi_outflow = inStream(port_b1.Xi_outflow); port_b1.Xi_outflow = inStream(port_a1.Xi_outflow); port_a2.Xi_outflow = inStream(port_b2.Xi_outflow); port_b2.Xi_outflow = inStream(port_a2.Xi_outflow); // Transport of trace substances port_a1.C_outflow = inStream(port_b1.C_outflow); port_b1.C_outflow = inStream(port_a1.C_outflow); port_a2.C_outflow = inStream(port_b2.C_outflow); port_b2.C_outflow = inStream(port_a2.C_outflow); end ZonalFlow;

Buildings.Airflow.Multizone.BaseClasses.powerLaw Buildings.Airflow.Multizone.BaseClasses.powerLaw

Power law used in orifice equations

Information

This model describes the mass flow rate and pressure difference relation of an orifice in the form

V̇ = C sign(Δp) |Δp|m

where is the volume flow rate, C > 0 is a flow coefficient Δ p is the pressure drop and m ∈ [0.5, 1] is a flow coefficient. The equation is regularized for |Δp| < Δpt, where Δpt is a parameter. For turbulent flow, set m=1 ⁄ 2 and for laminar flow, set m=1.

The model is used for the interzonal air flow models.

Implementation

For |Δp| < Δpt, the equation is regularized so that it is twice continuously differentiable in Δp, and that it has an infinite number of continuous derivatives in m and in k.

If m is not a function of time, then a, b, c and d can be pre-computed. In this situation, use Buildings.Airflow.Multizone.BaseClasses.powerLawFixedM, which allows to compute these values outside of this function, for example as parameters of a model.

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
RealC Flow coefficient, C = V_flow/ dp^m
PressureDifferencedp Pressure difference [Pa]
Realm Flow exponent, m=0.5 for turbulent, m=1 for laminar
PressureDifferencedp_turbulent0.001Pressure difference where regularization starts [Pa]

Outputs

TypeNameDescription
VolumeFlowRateV_flowVolume flow rate [m3/s]

Modelica definition

function powerLaw "Power law used in orifice equations" extends Modelica.Icons.Function; input Real C "Flow coefficient, C = V_flow/ dp^m"; input Modelica.Units.SI.PressureDifference dp(displayUnit="Pa") "Pressure difference"; input Real m(min=0.5, max=1) "Flow exponent, m=0.5 for turbulent, m=1 for laminar"; input Modelica.Units.SI.PressureDifference dp_turbulent( min=0, displayUnit="Pa") = 0.001 "Pressure difference where regularization starts"; output Modelica.Units.SI.VolumeFlowRate V_flow "Volume flow rate"; protected constant Real gamma(min=1) = 1.5 "Normalized flow rate where dphi(0)/dpi intersects phi(1)"; Real a "Polynomial coefficient for regularized implementation of flow resistance"; Real b "Polynomial coefficient for regularized implementation of flow resistance"; Real c "Polynomial coefficient for regularized implementation of flow resistance"; Real d "Polynomial coefficient for regularized implementation of flow resistance"; Real pi "Normalized pressure"; Real pi2 "Square of normalized pressure"; algorithm if (dp >= dp_turbulent) then V_flow :=C *dp^m; elseif (dp <= -dp_turbulent) then V_flow :=-C*(-dp)^m; else a := gamma; b := 1/8*m^2 - 3*gamma - 3/2*m + 35.0/8; c := -1/4*m^2 + 3*gamma + 5/2*m - 21.0/4; d := 1/8*m^2 - gamma - m + 15.0/8; pi := dp/dp_turbulent; pi2 := pi*pi; V_flow :=C *dp_turbulent^m * pi * ( a + pi2 * ( b + pi2 * ( c + pi2 * d))); end if; end powerLaw;

Buildings.Airflow.Multizone.BaseClasses.powerLawFixedM Buildings.Airflow.Multizone.BaseClasses.powerLawFixedM

Power law used in orifice equations when m is constant

Information

This model describes the mass flow rate and pressure difference relation of an orifice in the form

V̇ = C sign(Δp) |Δp|m

where is the volume flow rate, C > 0 is a flow coefficient Δ p is the pressure drop and m ∈ [0.5, 1] is a flow coefficient. The equation is regularized for |Δp| < Δpt, where Δpt is a parameter. For turbulent flow, set m=1 ⁄ 2 and for laminar flow, set m=1.

The model is used for the interzonal air flow models. It is identical to Buildings.Airflow.Multizone.BaseClasses.powerLaw but it requires the polynomial coefficients as an input. This allows a more efficient simulation if m and therefore also a, b, c and d are constant.

Implementation

For |Δp| < Δpt, the equation is regularized so that it is twice continuously differentiable in Δp, and that it has an infinite number of continuous derivatives in m and in k.

If m, and therefore also a, b, c and d, change with time, then it is more convenient and efficient to use Buildings.Airflow.Multizone.BaseClasses.powerLaw.

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
RealC Flow coefficient, C = V_flow/ dp^m
PressureDifferencedp Pressure difference [Pa]
Realm Flow exponent, m=0.5 for turbulent, m=1 for laminar
Reala Polynomial coefficient
Realb Polynomial coefficient
Realc Polynomial coefficient
Reald Polynomial coefficient
PressureDifferencedp_turbulent0.001Pressure difference where regularization starts [Pa]

Outputs

TypeNameDescription
VolumeFlowRateV_flowVolume flow rate [m3/s]

Modelica definition

function powerLawFixedM "Power law used in orifice equations when m is constant" extends Modelica.Icons.Function; input Real C "Flow coefficient, C = V_flow/ dp^m"; input Modelica.Units.SI.PressureDifference dp(displayUnit="Pa") "Pressure difference"; input Real m(min=0.5, max=1) "Flow exponent, m=0.5 for turbulent, m=1 for laminar"; input Real a "Polynomial coefficient"; input Real b "Polynomial coefficient"; input Real c "Polynomial coefficient"; input Real d "Polynomial coefficient"; input Modelica.Units.SI.PressureDifference dp_turbulent(min=0) = 0.001 "Pressure difference where regularization starts"; output Modelica.Units.SI.VolumeFlowRate V_flow "Volume flow rate"; protected constant Real gamma(min=1) = 1.5 "Normalized flow rate where dphi(0)/dpi intersects phi(1)"; Real pi "Normalized pressure"; Real pi2 "Square of normalized pressure"; algorithm if (dp >= dp_turbulent) then V_flow :=C *dp^m; elseif (dp <= -dp_turbulent) then V_flow :=-C*(-dp)^m; else pi := dp/dp_turbulent; pi2 := pi*pi; V_flow :=C *dp_turbulent^m * pi * ( a + pi2 * ( b + pi2 * ( c + pi2 * d))); end if; end powerLawFixedM;

Buildings.Airflow.Multizone.BaseClasses.windPressureLowRise Buildings.Airflow.Multizone.BaseClasses.windPressureLowRise

Wind pressure coefficient for low-rise buildings

Information

This function computes the wind pressure coefficient for low-rise buildings with rectangular shape. The correlation is the data fit from Swami and Chandra (1987), who fitted a function to various wind pressure coefficients from the literature. The same correlation is also implemented in CONTAM (Persily and Ivy, 2001).

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

G = ln(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 as shown in the figure below.

Definition of the aspect ratio.

Based on the wind incidence angle α 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, i.e., α = 0. 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 attenuation factor is

Cp ⁄ Cp0 = ln(1.248 - 0.703 sin(α ⁄ 2) - 1.175 sin2(α) - 0.131 sin3(2 α G) + 0.769 cos(α ⁄ 2) +0.071 G2 * sin2(α ⁄ 2) + 0.717 cos2(α ⁄ 2)),

where Cp is the wind pressure coefficient for the current angle of incidence.

This function is used in Buildings.Fluid.Sources.Outside_CpLowRise which can be used directly with components of this package.

References

Implementation

Symmetry requires that the first derivative of the wind pressure coefficient with respect to the incidence angle is zero for incidence angles of zero and π. However, the correlation of Swami and Chandra has non-zero derivatives at these values. In this implementation, the original function is therefore slightly modified for incidence angles between 0 and 5 degree, and between 175 and 180 degree. This leads to a model that is differentiable in the incidence angle, which generally leads to better numeric performance.

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
RealCp0 Wind pressure coefficient for normal wind incidence angle
Anglealpha Wind incidence angle (0: normal to wall) [rad]
RealG Natural logarithm of side ratio

Outputs

TypeNameDescription
RealCpWind pressure coefficient

Modelica definition

function windPressureLowRise "Wind pressure coefficient for low-rise buildings" extends Modelica.Icons.Function; input Real Cp0 "Wind pressure coefficient for normal wind incidence angle"; input Modelica.Units.SI.Angle alpha "Wind incidence angle (0: normal to wall)"; input Real G "Natural logarithm of side ratio"; output Real Cp "Wind pressure coefficient"; protected constant Modelica.Units.SI.Angle pi2=2*Modelica.Constants.pi; constant Modelica.Units.SI.Angle aRDel=5*Modelica.Constants.pi/180 "Lower bound where transition occurs"; constant Modelica.Units.SI.Angle aRDel2=aRDel/2 "Half-width of transition interval"; constant Modelica.Units.SI.Angle aRMax=175*Modelica.Constants.pi/180 "Upper bound where transition occurs"; Real a180 = Modelica.Math.log(1.248 - 0.703 + 0.131*Modelica.Math.sin(2*Modelica.Constants.pi*G)^3 + 0.071*G^2) "Attenuation factor at 180 degree incidence angle"; Modelica.Units.SI.Angle aR "alpha, restricted to 0...pi"; Modelica.Units.SI.Angle incAng2 "0.5*wind incidence angle"; Real sinA2 "=sin(alpha/2)"; Real cosA2 "=cos(alpha/2)"; Real a "Attenuation factor"; algorithm // Restrict incAng to [0...pi] // Change sign to positive aR :=if alpha < 0 then -alpha else alpha; // Constrain to [0...2*pi] if aR > pi2 then aR := aR - integer(aR/pi2)*pi2; end if; // Constrain to [0...pi] if aR > Modelica.Constants.pi then aR := pi2-aR; end if; // Evaluate eqn. 2-1 from FSEC-CR-163-86 incAng2 :=aR/2; sinA2 :=Modelica.Math.sin(incAng2); cosA2 :=Modelica.Math.cos(incAng2); // Implementation of the wind pressure coefficient that is once // continuously differentiable for all incidence angles if aR < aRDel then Cp :=Cp0*Buildings.Utilities.Math.Functions.regStep( y1=Modelica.Math.log(1.248 - 0.703*sinA2 - 1.175*Modelica.Math.sin(aR)^2 + 0.131*Modelica.Math.sin(2*aR*G)^3 + 0.769*cosA2 + 0.071*G^2*sinA2^2 + 0.717*cosA2^2), y2=1, x=aR - aRDel2, x_small=aRDel2); elseif aR > aRMax then Cp :=Cp0*Buildings.Utilities.Math.Functions.regStep( y1=a180, y2=Modelica.Math.log(1.248 - 0.703*sinA2 - 1.175*Modelica.Math.sin(aR)^2 + 0.131*Modelica.Math.sin(2*aR*G)^3 + 0.769*cosA2 + 0.071*G^2*sinA2^2 + 0.717*cosA2^2), x=aR + aRDel2 - Modelica.Constants.pi, x_small=aRDel2); else Cp :=Cp0*Modelica.Math.log(1.248 - 0.703*sinA2 - 1.175*Modelica.Math.sin(aR)^2 + 0.131*Modelica.Math.sin(2*aR*G)^3 + 0.769*cosA2 + 0.071*G^2*sinA2^2 + 0.717*cosA2^2); end if; end windPressureLowRise;

Buildings.Airflow.Multizone.BaseClasses.windPressureProfile Buildings.Airflow.Multizone.BaseClasses.windPressureProfile

Function for the cubic spline interpolation of a wind pressure profile with given support points and spline derivatives at these support points

Information

This function computes the wind pressure coefficients Cp from a user-defined table data. The same functionality is also implemented in CONTAM.

This function is used in Buildings.Fluid.Sources.Outside_CpData.

References

Extends from Modelica.Icons.Function (Icon for functions).

Inputs

TypeNameDefaultDescription
Anglealpha Wind incidence angle [rad]
RealincAngTab[:] Tabulated points for angle
RealCpTab[size(incAngTab, 1)] Tabulated points for Cp
Reald[size(incAngTab, 1)] Derivative values at tabulated points

Outputs

TypeNameDescription
RealCpActActual Cp value for given incidence angle alpha

Modelica definition

function windPressureProfile "Function for the cubic spline interpolation of a wind pressure profile with given support points and spline derivatives at these support points" extends Modelica.Icons.Function; input Modelica.Units.SI.Angle alpha "Wind incidence angle"; input Real incAngTab[:] "Tabulated points for angle"; input Real CpTab[size(incAngTab, 1)] "Tabulated points for Cp"; input Real[size(incAngTab, 1)] d "Derivative values at tabulated points"; output Real CpAct "Actual Cp value for given incidence angle alpha"; protected Integer i "Integer to select data interval"; Real aR "u, restricted to 0...2*pi"; algorithm // Change sign to positive and constrain to [0...2*pi] aR :=mod(alpha, 2*Modelica.Constants.pi); i := 1; for j in 1:size(incAngTab, 1) - 1 loop if aR > incAngTab[j] then i := j; end if; end for; // Interpolate the data CpAct :=Buildings.Utilities.Math.Functions.cubicHermiteLinearExtrapolation( x=aR, x1=incAngTab[i], x2=incAngTab[i + 1], y1=CpTab[i], y2=CpTab[i + 1], y1d=d[i], y2d=d[i + 1]); end windPressureProfile;