Buildings.Airflow.Multizone.BaseClasses.Examples

Collection of models that illustrate model use and test models

Information

This package contains examples for the use of models that can be found in Buildings.Airflow.Multizone.BaseClasses.

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

Package Content

Name Description
Buildings.Airflow.Multizone.BaseClasses.Examples.Interpolate Interpolate Test model for the function flowElementData
Buildings.Airflow.Multizone.BaseClasses.Examples.PowerLaw PowerLaw Test model for power law function
Buildings.Airflow.Multizone.BaseClasses.Examples.PowerLawFixedM PowerLawFixedM Test model for power law function
Buildings.Airflow.Multizone.BaseClasses.Examples.WindPressureLowRise WindPressureLowRise Test model for wind pressure function
Buildings.Airflow.Multizone.BaseClasses.Examples.WindPressureProfile WindPressureProfile Test model for wind pressure profile function

Buildings.Airflow.Multizone.BaseClasses.Examples.Interpolate Buildings.Airflow.Multizone.BaseClasses.Examples.Interpolate

Test model for the function flowElementData

Information

This example demonstrates the function Buildings.Airflow.Multizone.BaseClasses.interpolate.

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

Parameters

TypeNameDefaultDescription
Realtable[:, :][-50, -0.08709; -25, -0.0615...Table of mass flow rate in kg/s (second column) as a function of pressure difference in Pa (first column)

Modelica definition

model Interpolate "Test model for the function flowElementData" extends Modelica.Icons.Example; parameter Real table[:,:]=[-50,-0.08709; -25,-0.06158; -10,-0.03895; -5,-0.02754; -3,-0.02133; -2,-0.01742; -1,-0.01232; 0,0; 1,0.01232; 2,0.01742; 3,0.02133; 4.5,0.02613; 50,0.02614] "Table of mass flow rate in kg/s (second column) as a function of pressure difference in Pa (first column)"; Modelica.Units.SI.PressureDifference dp "Pressure difference"; Modelica.Units.SI.MassFlowRate m_flow "Mass flow rate"; protected parameter Real[:] xd=table[:,1] "X-axis support points"; parameter Real[size(xd, 1)] yd=table[:,2] "Y-axis support points"; parameter Real[size(xd, 1)] d(each fixed=false) "Derivatives at the support points"; Modelica.Blocks.Sources.Ramp ramp( duration=500, height=100, offset=-50) "Ramp from -50Pa to +50Pa"; initial equation d =Buildings.Utilities.Math.Functions.splineDerivatives( x=xd, y=yd, ensureMonotonicity=true); equation dp=ramp.y; m_flow =Buildings.Airflow.Multizone.BaseClasses.interpolate(u=dp,xd=xd,yd=yd,d=d); end Interpolate;

Buildings.Airflow.Multizone.BaseClasses.Examples.PowerLaw Buildings.Airflow.Multizone.BaseClasses.Examples.PowerLaw

Test model for power law function

Information

This examples demonstrates the Buildings.Airflow.Multizone.BaseClasses.powerLaw function.

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

Parameters

TypeNameDefaultDescription
RealC2/10^mFlow coefficient, k = V_flow/ dp^m
Realm0.5Flow exponent, m=0.5 for turbulent, m=1 for laminar
PressureDifferencedp_turbulent5Pressure difference where regularization starts [Pa]

Modelica definition

model PowerLaw "Test model for power law function" extends Modelica.Icons.Example; parameter Real C = 2/10^m "Flow coefficient, k = V_flow/ dp^m"; parameter Real m(min=0.5, max=1) = 0.5 "Flow exponent, m=0.5 for turbulent, m=1 for laminar"; parameter Modelica.Units.SI.PressureDifference dp_turbulent(min=0) = 5 "Pressure difference where regularization starts"; Modelica.Units.SI.PressureDifference dp "Pressure difference"; Modelica.Units.SI.VolumeFlowRate V_flow "Volume flow rate"; equation dp = 10*(-1+2*time); V_flow = Buildings.Airflow.Multizone.BaseClasses.powerLaw( dp=dp, C=C, m=m, dp_turbulent=dp_turbulent); end PowerLaw;

Buildings.Airflow.Multizone.BaseClasses.Examples.PowerLawFixedM Buildings.Airflow.Multizone.BaseClasses.Examples.PowerLawFixedM

Test model for power law function

Information

This examples demonstrates the Buildings.Airflow.Multizone.BaseClasses.powerLaw and Buildings.Airflow.Multizone.BaseClasses.powerLawFixedM functions. They need to return the same function value. This is verified by an assert statement.

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

Parameters

TypeNameDefaultDescription
RealC2/10^mFlow coefficient, C = V_flow/ dp^m
PressureDifferencedp_turbulent5Pressure difference where regularization starts [Pa]

Modelica definition

model PowerLawFixedM "Test model for power law function" extends Modelica.Icons.Example; parameter Real C = 2/10^m "Flow coefficient, C = V_flow/ dp^m"; constant Real m(min=0.5, max=1) = 0.5 "Flow exponent, m=0.5 for turbulent, m=1 for laminar"; parameter Modelica.Units.SI.PressureDifference dp_turbulent(min=0) = 5 "Pressure difference where regularization starts"; Modelica.Units.SI.PressureDifference dp "Pressure difference"; Modelica.Units.SI.VolumeFlowRate V_flow "Volume flow rate computed with model powerLaw"; Modelica.Units.SI.VolumeFlowRate VFixed_flow "Volume flow rate computed with model powerLawFixed"; constant Real gamma(min=1) = 1.5 "Normalized flow rate where dphi(0)/dpi intersects phi(1)"; constant Real a = gamma "Polynomial coefficient for regularized implementation of flow resistance"; constant Real b = 1/8*m^2 - 3*gamma - 3/2*m + 35.0/8 "Polynomial coefficient for regularized implementation of flow resistance"; constant Real c = -1/4*m^2 + 3*gamma + 5/2*m - 21.0/4 "Polynomial coefficient for regularized implementation of flow resistance"; constant Real d = 1/8*m^2 - gamma - m + 15.0/8 "Polynomial coefficient for regularized implementation of flow resistance"; equation dp = 10*(-1+2*time); V_flow = Buildings.Airflow.Multizone.BaseClasses.powerLaw( dp=dp, C=C, m=m, dp_turbulent=dp_turbulent); VFixed_flow = Buildings.Airflow.Multizone.BaseClasses.powerLawFixedM( C=C, dp=dp, m=m, a=a, b=b, c=c, d=d, dp_turbulent=dp_turbulent); assert(abs(V_flow-VFixed_flow) < 1E-10, "Error: The two implementations of the power law model need to give identical results"); end PowerLawFixedM;

Buildings.Airflow.Multizone.BaseClasses.Examples.WindPressureLowRise Buildings.Airflow.Multizone.BaseClasses.Examples.WindPressureLowRise

Test model for wind pressure function

Information

This examples demonstrates the Buildings.Airflow.Multizone.BaseClasses.windPressureLowRise function.

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

Parameters

TypeNameDefaultDescription
RealCp00.6Wind pressure coefficient for normal wind incidence angle
RealGModelica.Math.log(0.5)Natural logarithm of side ratio

Modelica definition

model WindPressureLowRise "Test model for wind pressure function" extends Modelica.Icons.Example; parameter Real Cp0 = 0.6 "Wind pressure coefficient for normal wind incidence angle"; Modelica.Units.SI.Angle incAng "Wind incidence angle (0: normal to wall)"; parameter Real G = Modelica.Math.log(0.5) "Natural logarithm of side ratio"; Real Cp "Wind pressure coefficient"; equation incAng=time*2*Modelica.Constants.pi; Cp =Buildings.Airflow.Multizone.BaseClasses.windPressureLowRise( Cp0=Cp0, G=G, alpha=incAng); end WindPressureLowRise;

Buildings.Airflow.Multizone.BaseClasses.Examples.WindPressureProfile Buildings.Airflow.Multizone.BaseClasses.Examples.WindPressureProfile

Test model for wind pressure profile function

Information

This examples demonstrates the Buildings.Airflow.Multizone.BaseClasses.windPressureProfile function.

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

Parameters

TypeNameDefaultDescription
AngleincAngSurNor[:]{0,45,90,135,180,225,270,315...Wind incidence angles, relative to the surface normal (normal=0), first point must be 0, last smaller than 2 pi(=360 deg) [rad]
RealCp[:]{0.4,0.1,-0.3,-0.35,-0.2,-0....Cp values at the corresponding incAngSurNor [1]

Modelica definition

model WindPressureProfile "Test model for wind pressure profile function" extends Modelica.Icons.Example; parameter Modelica.Units.SI.Angle incAngSurNor[:]( each displayUnit="deg")= {0, 45, 90, 135, 180, 225, 270, 315}*Modelica.Constants.pi/180 "Wind incidence angles, relative to the surface normal (normal=0), first point must be 0, last smaller than 2 pi(=360 deg)"; parameter Real Cp[:]( each final unit="1")= {0.4, 0.1, -0.3, -0.35, -0.2, -0.35, -0.3, 0.1} "Cp values at the corresponding incAngSurNor"; Modelica.Units.SI.Angle alpha "Wind incidence angle (0: normal to wall)"; Real CpAct "Wind pressure coefficient"; protected final parameter Integer n=size(incAngSurNor, 1) "Number of data points provided by user"; final parameter Modelica.Units.SI.Angle incAngExt[n + 3](each displayUnit= "deg") = cat( 1, {incAngSurNor[n - 1] - (2*Modelica.Constants.pi)}, incAngSurNor, 2*Modelica.Constants.pi .+ {incAngSurNor[1],incAngSurNor[2]}) "Extended number of incidence angles"; final parameter Real CpExt[n+3]=cat(1, {Cp[n-1]}, Cp, {Cp[1], Cp[2]}) "Extended number of Cp values"; final parameter Real[n+3] deri= Buildings.Utilities.Math.Functions.splineDerivatives( x=incAngExt, y=CpExt, ensureMonotonicity=false) "Derivatives for table interpolation"; Modelica.Blocks.Sources.Ramp ramp( duration=500, height=3*360, offset=-360) "Ramp model generating a singal from -360 to 720"; initial equation assert(size(incAngSurNor, 1) == size(Cp, 1), "In " + getInstanceName() + ": Size of parameters are size(CpincAng, 1) = " + String(size(incAngSurNor, 1)) + " and size(Cp, 1) = " + String(size(Cp, 1)) + ". They must be equal."); assert(abs(incAngSurNor[1]) < 1E-4, "In " + getInstanceName() + ": First point in the table CpAngAtt must be 0."); assert(2*Modelica.Constants.pi - incAngSurNor[end] > 1E-4, "In " + getInstanceName() + ": Last point in the table CpAngAtt must be smaller than 2 pi (360 deg)."); equation alpha=Modelica.Constants.D2R*ramp.y; CpAct =Buildings.Airflow.Multizone.BaseClasses.windPressureProfile( alpha=alpha, incAngTab=incAngExt, CpTab=CpExt, d=deri) "Actual wind pressure coefficient"; end WindPressureProfile;