import type { Anchorage, Materials, Loads } from '../types/design'; export const calculateAnchorage = (anchorage: Anchorage, materials: Materials, loads: Loads) => { const { count, diameter, material } = anchorage; const { P, Vx, Vz } = loads; // Steel Strength in Tension // Ase,N = effective cross sectional area // Simplified: 0.75 * Gross Area? Or lookup table. // 1" dia -> Gross = 0.785. Ase approx 0.606. // Let's use a simple approximation: Ase = 0.8 * Ag const Ag = Math.PI * Math.pow(diameter / 2, 2); const Ase = 0.8 * Ag; // futa (Tensile strength of anchor) // F1554-36: fut = 58 ksi // F1554-55: fut = 75 ksi // F1554-105: fut = 125 ksi let futa = 58; if (material === 'F1554-55') futa = 75; if (material === 'F1554-105') futa = 125; const phi_tension = 0.75; const Nsa = Ase * futa; // Nominal steel strength per rod const phiNn_total = phi_tension * Nsa * count; // Tension Demand // If P < 0 (Tension), or if Moment causes tension. // Simplified: Net Tension = -P (if P is compression) // Plus tension from moment? // For MVP, let's just use Axial Tension if P < 0. const Tu = P < 0 ? -P : 0; const tensionRatio = Tu / phiNn_total; // Shear Strength // Steel strength in shear // Vsa = 0.6 * Ase * futa const Vsa = 0.6 * Ase * futa; const phi_shear = 0.65; const phiVn_total = phi_shear * Vsa * count; // Assuming all anchors take shear (with washers welded) // Shear Demand const Vu = Math.sqrt(Vx * Vx + Vz * Vz); const shearRatio = Vu / phiVn_total; // Interaction // (Tu / phiNn) + (Vu / phiVn) <= 1.2 ? Or 5/3 power? // Simplified linear interaction for now const interactionRatio = tensionRatio + shearRatio; return { phiNn_total, phiVn_total, tensionRatio, shearRatio, interactionRatio, isSafe: interactionRatio <= 1.0 }; };