Skip to content

Instantly share code, notes, and snippets.

@nsolnit
Last active February 24, 2026 17:58
Show Gist options
  • Select an option

  • Save nsolnit/663f3878589f4f6b1e072b46b7b1bcfe to your computer and use it in GitHub Desktop.

Select an option

Save nsolnit/663f3878589f4f6b1e072b46b7b1bcfe to your computer and use it in GitHub Desktop.
Named Excel Lambdas for Air Systems
// Excel formula module with functions for air systems
/**Rectangular duct equivalent diameter (Huebscher) for static pressure loss*/
// See https://www.engineeringtoolbox.com/equivalent-diameter-d_205.html
RectDuctEqDiam = LAMBDA(WIDTH, HEIGHT,
1.30*(WIDTH*HEIGHT)^0.625/(WIDTH+HEIGHT)^0.25);
/** Equivalent rectangular duct dimension given equivalent diameter and fixed dimension (inches) -
Currently no array support*/
RectDuctEqWidth = LAMBDA(DIAM, HEIGHT,
LET(
FN, LAMBDA(W, RectDuctEqDiam(W,HEIGHT)),
rootBisection(FN, DIAM, DIAM/HEIGHT, DIAM^2, 0.1)
)
);
/** Equivalent Square duct dimension given equivalent diameter (inches) -
Currently no array support*/
SqDuctEqWidth = LAMBDA(DIAM,
LET(
FN, LAMBDA(W, RectDuctEqDiam(W,W)),
rootBisection(FN, DIAM, DIAM^0.5, DIAM^2,0.1)
)
);
/**Round Duct Diameter (in) for given airflow and SPL/100' based on simplified SPL formula*/
RoundDuctSize = LAMBDA(CFM, SPL,
(SPL/0.109136/CFM^1.9)^(-1/5.02)
);
/**Simple formulation for approx. sp loss (inwc/100') in round duct given flow (CFM) and diameter (Inches)*/
// See https://www.engineeringtoolbox.com/duct-friction-pressure-loss-d_444.html
RoundDuctStaticLoss = LAMBDA(CFM, DIA,
0.109136*CFM^1.9/DIA^5.02);
/**Simple formulation for CFM given sp loss (inwc/100') and Diameter in round duct (Inches)*/
// See https://www.engineeringtoolbox.com/duct-friction-pressure-loss-d_444.html
RoundDuctCFM = LAMBDA(DIA, SPL,
(SPL*DIA^5.02/0.109136)^(1/1.9));
/**Avg. air speed (ft/min) in round duct given flow (CFM) and diameter (Inches)*/
RoundDuctVelocity = LAMBDA(CFM, DIA,
LET(csa, PI() * DIA ^ 2 / 4 / 144,
CFM / csa)
);
/**Round Duct Flow based on Size and Maximum Duct Velocity (fpm)*/
RoundDuctCFM_Velocity = LAMBDA(DIA, FPM,
LET(csa, PI() * DIA ^ 2 / 4 / 144,
csa * FPM)
);
/**Round Duct Size based on CFM and Maximum Duct Velocity (fpm)*/
RoundDuctSize_Velocity = LAMBDA(CFM, FPM,
LET(csa, CFM/FPM*144,
(4*csa/PI())^0.5)
);
/**Round Elbow Loss Coefficient (dimensionless) from Turning Radius / Diameter,
Turning Angle, and number of gores (0 = smooth)*/
RoundElbowCF = LAMBDA(RD, angle, gores,
LET(
angles, {20,30,45,60,75,90,110,130,150,180},
angleFactors, {0.31, 0.45, 0.60, 0.78, 0.90, 1.00, 1.13, 1.20, 1.28, 1.40},
radiusRatios, {0.5, 0.75, 1.0, 1.5, 2.0},
goreCounts, {0,3,4,5},
radiusFactors, {0.71, 0.33, 0.22, 0.15, 0.13;
0.98, 0.54, 0.42, 0.34, 0.33;
0.88, 0.50, 0.37, 0.27, 0.24;
0.80, 0.46, 0.33, 0.24, 0.19},
angleFactor, INTERP1(angle,angles,angleFactors),
radiusFactor, INTERP2(RD, gores, radiusRatios, TRANSPOSE(goreCounts), radiusFactors),
angleFactor * radiusFactor
)
);
/**Rounds exact size up to nearest even dimension or minimum size.
Default min size is 6"*/
RoundDesignSize = LAMBDA(size, [MinSize],
LET(
ms, IF(ISOMITTED(MinSize),6,MinSize),
_ds1, 2*CEILING.MATH(size/2),
_ds2, IF(_ds1<ms, ms, _ds1),
IFERROR(_ds2, "")
)
);
/** Simple formulation for air stream velocity pressure (inWG) from velocity (ft/min)*/
VelocityPressure = LAMBDA(v,
(v/4005)^2
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment