solveSecant() to find the rail span where demand equals capacity. For syntax and general usage, see Equation Functions.
Calcs Builder equations are powered by Math.js; solveSecant() is a custom solver built on top of it.
Big Picture
- We know that for a given rail span (the distance between rail supports), a panel will experience some demand (like wind load or snow load) that depends on that span.
- We also know that the rail has a certain capacity to withstand that load, which depends on the rail span (longer spans mean lower capacity) and on the angle of the force acting on it.
- The formula sets up: f(rail_span) = Demand(rail_span) - Capacity(rail_span)
- We want to solve f(rail_span) = 0, where Demand equals Capacity.
- To do that, we’re using a numerical solver named
solveSecant(). This function tries different values for rail_span (starting between 30 cm and 300 cm) and zeroes in on the value that makes f(rail_span) = 0.
High-Level Code Flow
1. Secant Method Setup
Initial Parameters:
30 cm, 300 cm: These are our initial “guesses” or bracket for the solution. We know the actual required rail span is somewhere between 30 cm and 300 cm.0.00001 cm: The solver will stop iterating if it finds a solution whose error is smaller than 10^ cm.100: This is the maximum number of iterations to try before giving up (i.e., if no solution is found within 100 tries, it’ll fail).
2. The Function f(rail_span)
InsidesolveSecant(), we define:
A) Demand Part
Demand Components Breakdown
Demand Components Breakdown
matrixSubset(ultimateLCs_Resultant_Cpemin, rowIndex() + 1, 2)- This takes the loads of Ultimate Limit State - Resultant Loads
(panel_ornt == "Landscape Vert. Rails" ? pnlX : pnlY )- If the panel orientation is “Landscape Vert. Rails,” we use
pnlX; otherwise, we usepnlY. Essentially, this picks the relevant dimension of the panel based on orientation.
- If the panel orientation is “Landscape Vert. Rails,” we use
rail_span- The rail span (the variable we’re trying to solve for).
- Divide by 2
- Because the demand is distributed in two rails.
B) Capacity Part
Next, we subtract the “capacity part” from that Demand. The capacity expression is:Breaking Down the Capacity Part
1. Angle-Based Interpolation
Notice that the capacity calculation involves two interpolations, each using four data points for angles 0°, 30°, 60°, and 90°.2. First Interpolation
- Each element in the array represents an exponential formula for the rail_span:
- A * exp(B * rail_span) - C
- where the constants A, B, and C are slightly different for each angle (0°, 30°, 60°, 90°).
- The
angle_valuecomes from matrixSubset(angle_resultF_Cpemin). This value represents the force angle (in degrees) that we’re considering. - The
interpolate()function selects a capacity factor based on the actual angle by interpolating between the data points.
3. Second Interpolation
- This provides a base capacity (in Newtons) corresponding to the angles (0°, 30°, 60°, 90°).
- Again, the actual angle is used to interpolate the specific base capacity.
4. Multiplying the Two Interpolations
- The exponential factor decreases as rail_span increases.
- The base capacity is adjusted according to the force angle.
Final Formula: Demand - Capacity
Putting the two parts together:- Demand(rail_span) = (load factor) * (panel dimension) * rail_span / 2
- Capacity(rail_span, angle) = (interpolated exponential factor) * (interpolated base capacity)