import type { Geometry, Materials, Loads } from '../types/design'; export const calculateBearing = (geometry: Geometry, materials: Materials, loads: Loads) => { const { plateShape, widthZ, lengthX, diameter, support } = geometry; const { fc } = materials; const { P } = loads; // Bearing Area A1 let A1 = 0; if (plateShape === 'rectangular') { A1 = widthZ * lengthX; } else { A1 = Math.PI * Math.pow(diameter / 2, 2); } // Support Area A2 (Simplified: assume support is the concrete pier size) // In reality, A2 is the area of the supporting surface that is geometrically similar to and concentric with the loaded area. // We'll use the full support area for now. let A2 = 0; // Support is defined by Wp1, Lp1 (top) and Wp2, Lp2 (bottom)? // Let's assume Wp1/Lp1 is the top surface dimensions. // If circular support is not explicitly handled in inputs (inputs show Wp1/Lp1), assume rect support for rect plate? // Or if plate is circular, support might be circular. // Let's use Wp1 * Lp1 for now. A2 = support.widthWp1 * support.lengthLp1; // If A2 < A1, that's an issue (plate larger than support), but let's assume A2 >= A1. if (A2 < A1) A2 = A1; const sqrtA2A1 = Math.min(Math.sqrt(A2 / A1), 2); // Nominal Strength Pp // AISC J8: Pp = 0.85 * fc * A1 * sqrt(A2/A1) <= 1.7 * fc * A1 const phi = 0.65; // LRFD for bearing const Pp = 0.85 * fc * A1 * sqrtA2A1; const maxPp = 1.7 * fc * A1; const Pn = Math.min(Pp, maxPp); const phiPn = phi * Pn; // Check // If P is negative (tension), bearing is 0? Or P is compression? // Usually P is compression positive in these apps? // Screenshot shows "Axial Force P 0.0 kip". // Let's assume P > 0 is compression. const bearingRatio = P > 0 ? P / phiPn : 0; return { phiPn, bearingRatio, isSafe: bearingRatio <= 1.0 }; };