Skip to content

Instantly share code, notes, and snippets.

@jsb2505
Created November 27, 2022 17:10
Show Gist options
  • Save jsb2505/32834a675e6a159b009748406089de1d to your computer and use it in GitHub Desktop.
Save jsb2505/32834a675e6a159b009748406089de1d to your computer and use it in GitHub Desktop.
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],
LET(
A, altitude,
z, IF(ISOMITTED(reference_height), 10, reference_height),
1 + 0.001 * A * IF(z <= 10, 1, (10 / z) ^ 0.2)
)
);
Get_Fundamental_Basic_Wind_Velocity_Altitude_Corrected = LAMBDA(
fundamental_basic_wind_velocity,
altitude_factor,
LET(V_b_map, fundamental_basic_wind_velocity, C_alt, altitude_factor, C_alt * V_b_map)
);
Get_Basic_Mean_Wind_Velocity = LAMBDA(
fundamental_basic_wind_velocity_altitude_corrected,
[probability_factor],
[direction_factor],
[season_factor],
LET(
V_b_0, fundamental_basic_wind_velocity_altitude_corrected,
C_prob, IF(ISOMITTED(probability_factor), 1, probability_factor),
C_dir, IF(ISOMITTED(direction_factor), 1, direction_factor),
C_season, IF(ISOMITTED(season_factor), 1, season_factor),
V_b_0 * C_prob * C_dir * C_season
)
);
Get_Basic_Wind_Velocity_Pressure = LAMBDA(basic_mean_wind_velocity, [air_density],
LET(
V_b_mean, basic_mean_wind_velocity,
ρ, IF(ISOMITTED(air_density), 1.226, air_density),
ρ * V_b_mean ^ 2 / 1000 / 2
)
);
Get_Peak_Wind_Velocity_Pressure = LAMBDA(
basic_mean_wind_velocity_pressure,
exposure_factor,
terrain,
[town_factor],
LET(
q_b, basic_mean_wind_velocity_pressure,
C_e, exposure_factor,
T, terrain,
C_T, IF(OR(ISOMITTED(town_factor), T <> "Town"), 1, town_factor),
C_e * C_T * q_b
)
);
Get_Characteristic_Wind_Pressure = LAMBDA(peak_velocity_wind_pressure, net_pressure_coefficient,
LET(qp, peak_velocity_wind_pressure, C_p_net, net_pressure_coefficient, qp * C_p_net)
);
Get_Design_Wind_Pressure = LAMBDA(characteristic_wind_pressure, [variable_load_factor],
LET(
q_k, characteristic_wind_pressure,
γ_q, IF(ISOMITTED(variable_load_factor), 1.5, variable_load_factor),
γ_q * q_k
)
);
Get_C_season = LAMBDA([duration_in_months], [starting_month],
LET(
months, IF(ISOMITTED(duration_in_months), 12, duration_in_months),
duration_index, IFS(
months <= 1,
1,
months <= 2,
2,
months <= 4,
3,
months <= 6,
4,
months > 6,
5
),
month_index, MONTH(starting_month & 1),
duration_coeff, {
0.98, 0.83, 0.82, 0.75, 0.69, 0.66, 0.62, 0.71, 0.82, 0.82, 0.88, 0.94;
0.98, 0.86, 0.83, 0.75, 0.71, 0.67, 0.71, 0.82, 0.85, 0.89, 0.95, 1;
0.98, 0.87, 0.83, 0.76, 0.73, 0.83, 0.86, 0.9, 0.96, 1, 1, 1;
1, 1, 1, 0.84, 0.84, 0.84, 0.84, 0.84, 0.84, 1, 1, 1;
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
},
INDEX(duration_coeff, duration_index, month_index)
)
);
Get_C_dir = LAMBDA([angle_of_wind_clockwise_from_north], [segment_angle],
LET(
seg_angle, IF(ISOMITTED(segment_angle), 0, segment_angle),
dir, IF(
ISOMITTED(angle_of_wind_clockwise_from_north),
240,
angle_of_wind_clockwise_from_north
),
interval, IF(dir < 0, -10, 10),
angle, MOD(MROUND(dir, interval), 360),
angle_index, (angle / 10) + 1,
dir_coeffs, {
0.78,
0.77,
0.75,
0.73,
0.73,
0.73,
0.73,
0.73,
0.74,
0.74,
0.74,
0.73,
0.73,
0.75,
0.78,
0.8,
0.82,
0.84,
0.85,
0.88,
0.91,
0.93,
0.96,
0.98,
1,
1,
1,
0.99,
0.97,
0.94,
0.91,
0.88,
0.85,
0.82,
0.81,
0.8,
0.78
},
INDEX(dir_coeffs, angle_index)
)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment