Skip to content

Instantly share code, notes, and snippets.

@jsb2505
jsb2505 / GetAlpha.txt
Last active June 15, 2023 10:11
Excel Lambda function to find alpha value
/*
A function to calculate alpha as given by Appendix G in SCI P398
INPUTS: m, m2 and e
RETURNS: value of alpha
Example:
=GetAlpha(40,45,35)
Returns:
5.345
@jsb2505
jsb2505 / Timber.txt
Last active October 3, 2023 21:38
A module of timber functions for excel AFE
Materials = {"Softwood", "Hardwood", "Glulam", "LVL", "Green_Oak"};
Material_Properties = {
"strength_class",
"f_m_y_k",
"f_v_k",
"f_c_90_k",
"E_0_mean",
"G_mean",
"E_005",
@jsb2505
jsb2505 / Trees.txt
Last active August 7, 2023 16:21
A module of Tree functions for AFE
Tree_Names = CHOOSECOLS(Tree_Data,1);
/**
Contains a table of trees in the format:
tree_name, tree_type, water_demand, mature_height
*/
Tree_Data = {
"Elm English", "Broad-leafed", "High", 24;
"Elm Wheatley", "Broad-leafed", "High", 22;
@jsb2505
jsb2505 / Wind.txt
Created November 27, 2022 17:10
A module of wind functions for AFE
Get_C_prob = LAMBDA(return_period, [n], [K],
LET(
p, return_period,
n, IF(ISOMITTED(n), 0.5, n),
K, IF(ISOMITTED(K), 0.2, K),
((1 - K * LN(-LN(1 - 1 / p))) / (1 - K * LN(-LN(0.98)))) ^ n
)
);
Get_C_alt = LAMBDA(altitude, [reference_height],
@jsb2505
jsb2505 / Geotech.txt
Last active October 3, 2023 10:03
A module of geotechnical related lambda functions.
/**Partial factor for action DA1 C1 or C2.
EXPECTED INPUTS:
Combination = 1 or 2.
Action = "permanent" or "variable".
Favourability = "unfavourable" or "favourable".
*/
Get_γ_action = LAMBDA(combination_1_or_2_as_number, action, [favourability],
LET(
_favourability, IF(ISOMITTED(favourability), "unfavourable", LOWER(favourability)),
_action, LOWER(action),
@jsb2505
jsb2505 / Masonry.txt
Last active June 15, 2023 10:09
A module of masonry functions for excel AFE
Get_Shape_Factor = LAMBDA(height_of_unit, width_of_unit,
LET(
h, height_of_unit,
w, width_of_unit,
widths, {50, 100, 150, 200, 250},
heights, {40, 50, 65, 100, 150, 200, 250},
shape_factors,
{
0.80, 0.70, "", "", "";
0.85, 0.75, 0.70, "", "";
@jsb2505
jsb2505 / Steel.txt
Last active September 28, 2023 10:31
A module of steel functions for excel AFE
UB_Table = {
//{"type","name",mass,height,breadth,web_thickness,flange_thickness,root radius}
"UB", "127 x 76 x 13", 13, 127, 76, 4, 7.6, 7.6;
"UB", "152 x 89 x 16", 16, 152.4, 88.7, 4.5, 7.7, 7.6;
"UB", "178 x 102 x 19", 19, 177.8, 101.2, 4.8, 7.9, 7.6;
"UB", "203 x 102 x 23", 23.1, 203.2, 101.8, 5.4, 9.3, 7.6;
"UB", "203 x 133 x 25", 25.1, 203.2, 133.2, 5.7, 7.8, 7.6;
"UB", "203 x 133 x 30", 30, 206.8, 133.9, 6.4, 9.6, 7.6;
"UB", "254 x 102 x 22", 22, 254, 101.6, 5.7, 6.8, 7.6;
"UB", "254 x 102 x 25", 25.2, 257.2, 101.9, 6, 8.4, 7.6;
@jsb2505
jsb2505 / Steel_Connection.txt
Last active August 7, 2023 16:20
A module of steel connection functions for Excel's AFE
/**
Calculates alpha as given by Appendix G in SCI P398.
Note: always omit last optional parameter
*/
Get_Alpha = LAMBDA(m, m_2, e, [alpha_DONT_INPUT],
LET(
lambda_1, m / (m + e),
lambda_2, m_2 / (m + e),
alpha, IF(ISOMITTED(alpha_DONT_INPUT), 4.45, alpha_DONT_INPUT),
lambda_1_temp, Get_Lambda_1(alpha, lambda_2),
@jsb2505
jsb2505 / Loading.txt
Created December 15, 2022 20:40
A module of loading functions for Excel's AFE
Get_Bending_Moment = LAMBDA(permanent_UDL, imposed_UDL, length_mm,
LET(
g_k, permanent_UDL,
q_k, imposed_UDL,
L, length_mm,
γ_g, 1.35,
γ_q, 1.5,
(γ_g * g_k + γ_q * q_k) * (L / 1000) ^ 2 / 8
)
);
@jsb2505
jsb2505 / Concrete.txt
Last active April 22, 2024 09:43
A gist of concrete lambda functions to BS EN 1992-1-1 and UK National Annex (Eurocode 2)
/**Poisson's ratio of concrete.
Ref: EC2 §3.1.3(4)
*/
Get_Poissons_Ratio = LAMBDA([isCracked],
LET(
_isCracked, IF(ISOMITTED(isCracked), FALSE, isCracked),
IF(_isCracked,
0, //for cracked concrete
0.2 //for uncracked concrete
)