This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
| // --- Unit parsing and conversion --- | |
| // Check a compound unit string for valid registry entries. Not intended for workbook use | |
| // Strips parentheses, exponents, and sign characters; splits on * and /; checks each | |
| // component unit name against ureg_units. | |
| // Returns "OK" if all components are found, or "Undefined Units :: a, b, ..." for all bad names. | |
| UnitDefCheck = LAMBDA(ustring, | |
| LET( | |
| stripped, REGEXREPLACE(ustring, "[()\d+\-\s]", ""), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /**Pipe ID (in.) based on Hazen-Williams formulation | |
| given Head Loss (ft. hd.), flow (GPM), Hazen Williams Roughness Coefficient (), | |
| and length (ft.) [100']*/ | |
| HazenWilliamsDiam = LAMBDA(Head, GPM, [RC], [Length], | |
| LET(RC_, IF(ISOMITTED(RC), 140, RC), | |
| L, IF(ISOMITTED(Length), 100, Length), | |
| (4.52 * (GPM/RC_)^1.852*L / (Head/2.31)) ^ (1/4.8704) | |
| ) | |
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /**Cumulative sum over array*/ | |
| CSUM = LAMBDA(arr, | |
| SCAN(0,arr,LAMBDA(a,c,a+c))); | |
| /**Ignores Null ref (empty, space or 0), returns "" or VAl if provided*/ | |
| IFN = LAMBDA(REF,FUN,[VAL], | |
| IF(OR(REF="",REF=" ",REF=0),IF(ISOMITTED(VAL),"",VAL),FUN) | |
| ); | |
| /**1D linear interpolation, set SORTED=0 for unsorted data - presorting data recommended*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /**Basic 1D linear generator from 2 pts*/ | |
| LEXT = LAMBDA(X,XS,YS, | |
| LET(X_1,INDEX(XS,1), | |
| X_2, INDEX(XS,2), | |
| Y_1, INDEX(YS,1), | |
| Y_2, INDEX(YS,2), | |
| Y_1+(X-X_1)*(Y_2-Y_1)/(X_2-X_1) | |
| ) | |
| ); |