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.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.PowerLawResistance PowerLawResistance Flow resistance that uses the power law
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.Examples Examples Collection of models that illustrate model use and test models

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
BooleanforceErrorControlOnFlowtrueFlag to force error control on m_flow. Set to true if interested in flow rate
replaceable package MediumPartialMedium 
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]
Orifice characteristics
RealCD0.65Discharge coefficient
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
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.SIunits.PressureDifference dp_turbulent(min=0) = 0.01 "Pressure difference where laminar and turbulent flow relation coincide. Recommended: 0.01"; parameter Real CD=0.65 "|Orifice characteristics|Discharge coefficient"; Modelica.SIunits.PressureDifference dpAB[nCom](each nominal=1) "Pressure difference between compartments"; Modelica.SIunits.Velocity v[nCom](each nominal=0.01) "Velocity in compartment from A to B"; Modelica.SIunits.Velocity vTop "Velocity at top of opening from A to B"; Modelica.SIunits.Velocity vBot "Velocity at bottom of opening from A to B"; protected parameter Modelica.SIunits.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.SIunits.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.SIunits.AbsolutePressure pA[nCom](each nominal=101325) "Pressure in compartments of room A"; Modelica.SIunits.AbsolutePressure pB[nCom](each nominal=101325) "Pressure in compartments of room B"; Modelica.SIunits.VolumeFlowRate dV_flow[nCom] "Volume flow rate through compartment from A to B"; Modelica.SIunits.VolumeFlowRate dVAB_flow[nCom] "Volume flow rate through compartment from A to B if positive"; Modelica.SIunits.VolumeFlowRate dVBA_flow[nCom] "Volume flow rate through compartment from B to A if positive"; Modelica.SIunits.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 kVal "Flow coefficient for each compartment, k = V_flow/ dp^m"; Modelica.SIunits.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 enforceErrorControlOnFlow = true, such an equation is imposed by models that extend this class.

Parameters

TypeNameDefaultDescription
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.PowerLawResistance Buildings.Airflow.Multizone.BaseClasses.PowerLawResistance

Flow resistance that uses the power law

Buildings.Airflow.Multizone.BaseClasses.PowerLawResistance

Information

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

    V_flow = k * dp^m,

where k is a variable and m a parameter. For turbulent flow, set m=1/2 and for laminar flow, set m=1.

The model is used as a base for the interzonal air flow models.

Extends from Buildings.Fluid.Interfaces.PartialTwoPortInterface (Partial model transporting fluid between two ports without storing mass or energy), Buildings.Airflow.Multizone.BaseClasses.ErrorControl (Interface that defines parameters for error control).

Parameters

TypeNameDefaultDescription
replaceable package MediumPartialMediumMedium in the component
BooleanforceErrorControlOnFlowtrueFlag to force error control on m_flow. Set to true if interested in flow rate
Realm Flow exponent, m=0.5 for turbulent, m=1 for laminar
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]
LengthlWetsqrt(A)Wetted perimeter used for Reynolds number calculation [m]
Nominal condition
MassFlowRatem_flow_nominalrho_default*k*dp_turbulentNominal mass flow rate [kg/s]
Orifice characteristics
AreaA Area of orifice [m2]
Assumptions
BooleanallowFlowReversaltrue= false to simplify equations, assuming, but not enforcing, no flow reversal
Advanced
MassFlowRatem_flow_small1E-4*abs(m_flow_nominal)Small mass flow rate for regularization of zero flow [kg/s]
BooleanhomotopyInitializationtrue= true, use homotopy method
Diagnostics
Booleanshow_Tfalse= true, if actual temperature at port is computed

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 PowerLawResistance "Flow resistance that uses the power law" extends Buildings.Fluid.Interfaces.PartialTwoPortInterface( final m_flow_nominal=rho_default*k*dp_turbulent); extends Buildings.Airflow.Multizone.BaseClasses.ErrorControl; parameter Modelica.SIunits.Area A "|Orifice characteristics|Area of orifice"; parameter Real m(min=0.5, max=1) "Flow exponent, m=0.5 for turbulent, m=1 for laminar"; parameter Boolean useDefaultProperties=true "Set to false to use density and viscosity based on actual medium state, rather than using default values"; parameter Modelica.SIunits.PressureDifference dp_turbulent(min=0, displayUnit="Pa") = 0.1 "Pressure difference where laminar and turbulent flow relation coincide. Recommended = 0.1"; parameter Modelica.SIunits.Length lWet=sqrt(A) "Wetted perimeter used for Reynolds number calculation"; parameter Boolean homotopyInitialization = true "= true, use homotopy method"; Modelica.SIunits.VolumeFlowRate V_flow "Volume flow rate through the component"; Modelica.SIunits.Velocity v(nominal=1) "Average velocity"; Modelica.SIunits.Density rho "Fluid density at port_a"; Real Re "Reynolds number"; protected constant Real gamma(min=1) = 1.5 "Normalized flow rate where dphi(0)/dpi intersects phi(1)"; parameter Real k "Flow coefficient, k = V_flow/ dp^m"; 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.SIunits.Density rho_default=Medium.density(sta_default) "Density at the medium default properties"; parameter Modelica.SIunits.DynamicViscosity dynVis_default= Medium.dynamicViscosity(sta_default) "Dynamic viscosity at the medium default properties"; 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"; Medium.ThermodynamicState sta "State of the medium in the component"; Modelica.SIunits.DynamicViscosity dynVis "Dynamic viscosity"; Real mExc(quantity="Mass", final unit="kg") "Air mass exchanged (for purpose of error control only)"; initial equation mExc=0; 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; V_flow = Buildings.Airflow.Multizone.BaseClasses.powerLawFixedM( k=k, dp=dp, m=m, a=a, b=b, c=c, d=d, dp_turbulent=dp_turbulent); port_a.m_flow = rho*V_flow; v = V_flow/A; Re = v*lWet*rho/dynVis; // 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); end PowerLawResistance;

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 transporting fluid between two ports without storing mass or energy), 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
BooleanforceErrorControlOnFlowtrueFlag to force error control on m_flow. Set to true if interested in flow rate
replaceable package MediumModelica.Media.Interfaces.Pa... 
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
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 Medium 

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=false, final allowFlowReversal2=false, final m1_flow_nominal=10/3600*1.2, final m2_flow_nominal=m1_flow_nominal); extends Buildings.Airflow.Multizone.BaseClasses.ErrorControl; replaceable package Medium = Modelica.Media.Interfaces.PartialMedium; parameter Modelica.SIunits.Velocity vZer=0.001 "Minimum velocity to prevent zero flow. Recommended: 0.001"; Modelica.SIunits.VolumeFlowRate VAB_flow(nominal=0.001) "Volume flow rate from A to B if positive"; Modelica.SIunits.VolumeFlowRate VBA_flow(nominal=0.001) "Volume flow rate from B to A if positive"; Modelica.SIunits.MassFlowRate mAB_flow(nominal=0.001) "Mass flow rate from A to B if positive"; Modelica.SIunits.MassFlowRate mBA_flow(nominal=0.001) "Mass flow rate from B to A if positive"; Modelica.SIunits.Velocity vAB(nominal=0.01) "Average velocity from A to B"; Modelica.SIunits.Velocity vBA(nominal=0.01) "Average velocity from B to A"; Modelica.SIunits.Density rho_a1_inflow "Density of air flowing in from port_a1"; Modelica.SIunits.Density rho_a2_inflow "Density of air flowing in from port_a2"; Modelica.SIunits.Area A "Face area"; protected Modelica.SIunits.VolumeFlowRate VZer_flow(fixed=false) "Minimum net volume flow rate to prevent zero flow"; Modelica.SIunits.Mass mExcAB(start=0, fixed=true) "Air mass exchanged (for purpose of error control only)"; Modelica.SIunits.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
BooleanforceErrorControlOnFlowtrueFlag to force error control on m_flow. Set to true if interested in flow rate
replaceable package MediumPartialMedium 
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
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
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.SIunits.Length wOpe=0.9 "|Geometry|Width of opening"; parameter Modelica.SIunits.Length hOpe=2.1 "|Geometry|Height of opening"; parameter Modelica.SIunits.Length hA=2.7/2 "|Geometry|Height of reference pressure zone A"; parameter Modelica.SIunits.Length hB=2.7/2 "|Geometry|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 transporting fluid between two ports without storing mass or energy).

Parameters

TypeNameDefaultDescription
replaceable package Medium1PartialMediumMedium 1 in the component
replaceable package Medium2PartialMediumMedium 2 in the component
replaceable package MediumModelica.Media.Interfaces.Pa... 
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 Medium 

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); replaceable package Medium = Modelica.Media.Interfaces.PartialMedium; 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

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 = k sign(Δp) |Δp|m

where V is the volume flow rate, k > 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.

Inputs

TypeNameDefaultDescription
Realk Flow coefficient, k = 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" input Real k "Flow coefficient, k = V_flow/ dp^m"; input Modelica.SIunits.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.SIunits.PressureDifference dp_turbulent(min=0, displayUnit="Pa")=0.001 "Pressure difference where regularization starts"; output Modelica.SIunits.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 := k*dp^m; elseif (dp <= -dp_turbulent) then V_flow :=-k*(-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 := k*dp_turbulent^m * pi * ( a + pi2 * ( b + pi2 * ( c + pi2 * d))); end if; end powerLaw;

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 = k sign(Δp) |Δp|m

where V is the volume flow rate, k > 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.

Inputs

TypeNameDefaultDescription
Realk Flow coefficient, k = 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" input Real k "Flow coefficient, k = V_flow/ dp^m"; input Modelica.SIunits.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.SIunits.PressureDifference dp_turbulent(min=0)=0.001 "Pressure difference where regularization starts"; output Modelica.SIunits.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 := k*dp^m; elseif (dp <= -dp_turbulent) then V_flow :=-k*(-dp)^m; else pi := dp/dp_turbulent; pi2 := pi*pi; V_flow := k*dp_turbulent^m * pi * ( a + pi2 * ( b + pi2 * ( c + pi2 * d))); end if; end powerLawFixedM;

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.

Inputs

TypeNameDefaultDescription
RealCp0 Wind pressure coefficient for normal wind incidence angle
AngleincAng 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" input Real Cp0(min=0) "Wind pressure coefficient for normal wind incidence angle"; input Modelica.SIunits.Angle incAng "Wind incidence angle (0: normal to wall)"; input Real G "Natural logarithm of side ratio"; output Real Cp "Wind pressure coefficient"; protected constant Modelica.SIunits.Angle pi2 = 2*Modelica.Constants.pi; constant Modelica.SIunits.Angle aRDel = 5*Modelica.Constants.pi/180 "Lower bound where transition occurs"; constant Modelica.SIunits.Angle aRDel2 = aRDel/2 "Half-width of transition interval"; constant Modelica.SIunits.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.SIunits.Angle aR "alpha, restricted to 0...pi"; Modelica.SIunits.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 incAng < 0 then -incAng else incAng; // 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;