This document explains the step-by-step process used by the "Composite Beam Deflection Calculator" to determine the deflection of a composite beam. The explanation refers to the JavaScript functions within the provided HTML file.
When you click the "Calculate Deflection" button:
beamForm) captures the submit event.testvalues.png defaults): Total Beam Length: 8 ft * 12 = 96 inches.params_inch_based) which is then passed to the main calculation function, calculateBeamDeflection. This object also includes the state of the isPointLoadMode toggle.calculateBeamDeflection FunctionThis function is the heart of the analysis. It takes the params_inch_based object.
num_points - 1 equal segments.x is created containing the x-coordinates (in inches) of these points, from 0 to L_beam_total.EI_eff, y_NA, I_transformed)x array, the function getLocalBeamProperties(xi, mat1_props, mat2_props) is called.getLocalBeamProperties Function:
xi falls within the defined start and end x-positions of Material 1 (mat1_props.x_start_mat1 to mat1_props.x_end_mat1).n): mat1_E / mat2_E.A1_transformed): mat1_A * n.I1_cg_transformed): mat1_I_cg * n.y_NA_val) is found using the formula:
y_NA = (A1_transformed * y1_cg_global + A2 * y2_cg_global) / (A1_transformed + A2).I_transformed_val):
I_transformed_val = I1_NA_transformed + I2_NA. This I is relative to mat2_E.EI_val): mat2_E * I_transformed_val.y_NA_val is the centroid of Material 1 (relative to the bottom of Material 2).I_transformed_val becomes mat1_I_cg (Material 1's own moment of inertia).EI_val becomes mat1_E * mat1_I_cg.y_NA_val is the centroid of Material 2.I_transformed_val is mat2_I_cg.EI_val is mat2_E * mat2_I_cg.EI_eff_array[i], y_NA_array[i], I_transformed_total_array[i]) are stored for each point.R_a_reaction, R_b_reaction)The method depends on isPointLoadMode:
isPointLoadMode is true (Point Load Mode):
derived_P1_lbf_at_0, derived_P2_lbf_at_L) that would occur if the entire tapered distributed line load (defined by w_start_line_load_lbf_in and w_end_line_load_lbf_in) were applied to a beam of length L_beam_total simply supported at its extreme ends (x=0 and x=L_beam_total).
derived_P1_lbf_at_0 = (L_beam_total / 6) * (2 * w_start_line_load_lbf_in + w_end_line_load_lbf_in)derived_P2_lbf_at_L = (L_beam_total / 6) * (w_start_line_load_lbf_in + 2 * w_end_line_load_lbf_in)derived_P1_lbf_at_0 and derived_P2_lbf_at_L are then treated as the point loads applied at x=0 and x=L_beam_total respectively on the actual beam (which has supports at a_support and b_support).
a_support) to find the other reaction, then summing vertical forces.
R_b_reaction = (derived_P1_lbf_at_0 * a_support + derived_P2_lbf_at_L * (L_beam_total - a_support)) / (b_support - a_support)R_a_reaction = derived_P1_lbf_at_0 + derived_P2_lbf_at_L - R_b_reactiona_support. a_support itself is the distance from x=0 to the first support. The moment of derived_P1_lbf_at_0 (at x=0) about a_support is derived_P1_lbf_at_0 * (a_support - 0)).isPointLoadMode is false (Distributed Load Mode):
F_total_load) and the location of its resultant (x_bar_load) are calculated.
k_slope = (w_end_line_load_lbf_in - w_start_line_load_lbf_in) / L_beam_totalF_total_load = (w_start_line_load_lbf_in + w_end_line_load_lbf_in) * L_beam_total / 2x_bar_load = L_beam_total * (w_start_line_load_lbf_in + 2 * w_end_line_load_lbf_in) / (3 * (w_start_line_load_lbf_in + w_end_line_load_lbf_in)) (with handling for zero denominator).R_b_reaction = F_total_load * (x_bar_load - a_support) / (b_support - a_support)R_a_reaction = F_total_load - R_b_reactionM_vals)For each point xi in the x array, the bending moment is calculated using singularity functions (eval_s(value, power) which returns value^power if value > 0, else 0).
isPointLoadMode is true:M(xi) = R_a * <xi - a_support>^1 + R_b * <xi - b_support>^1 - derived_P1_at_0 * <xi - 0>^1 - derived_P2_at_L * <xi - L_beam_total>^1isPointLoadMode is false:M(xi) = R_a * <xi - a_support>^1 + R_b * <xi - b_support>^1 - (w_start_line_load_lbf_in / 2) * xi^2 - (k_slope / 6) * xi^3<xi-0>^2 and <xi-0>^3 are simplified to xi^2 and xi^3 as they start at x=0).kappa_vals)κ = M / EI.kappa_vals[i] = M_vals[i] / EI_eff_array[i].EI_eff might be zero (if M is also zero, curvature is zero; if M is non-zero and EI_eff is zero, an error is thrown).The cumtrapz(x_array, y_array) function performs cumulative numerical integration using the trapezoidal rule.
slope_raw): slope_raw = ∫ κ dx = cumtrapz(x, kappa_vals). This gives the slope at each point relative to an unknown integration constant.deflection_raw): deflection_raw = ∫ slope_raw dx = cumtrapz(x, slope_raw). This gives a deflection profile that satisfies the curvature but doesn't yet meet the boundary conditions (zero deflection at supports). It's off by C1*x + C2.The beam is supported, so deflection at the support locations (a_support, b_support) must be zero.
interp1(x, deflection_raw, target_x) function (linear interpolation) is used to find the raw deflection values at a_support and b_support:
val_def_raw_at_a = interp1(x, deflection_raw, a_support)val_def_raw_at_b = interp1(x, deflection_raw, b_support)C1_num and C2_num:y(support) = 0:
deflection_raw(a_support) + C1_num * a_support + C2_num = 0deflection_raw(b_support) + C1_num * b_support + C2_num = 0C1_num and C2_num.xi is calculated:deflection[i] = deflection_raw[i] + C1_num * x[i] + C2_num.deflection array to find the maximum absolute deflection (overall_max_deflection) and its corresponding x-coordinate (overall_x_max_deflection).L_oh_left_in), span between supports (L_span_in), and right overhang (L_oh_right_in) are calculated.limit = (2 * L_overhang) / deflectionLimitDenominatorlimit = L_span / deflectionLimitDenominatordeflectionLimitDenominator is taken from user input, defaulting to 180).The function returns an object containing:
deflection array (inches)x array (inches)y_NA and I_transformed_total at each pointR_a_reaction, R_b_reaction (lbf)This data is then used by the JavaScript in the HTML file to populate the results tables.