import React, { useMemo } from 'react'; import { useCalculatorStore } from '../../../store/calculatorStore'; import { calculateWindPressure } from '../../../utils/windLogic'; import { calculateMwfrsPressures } from '../../../utils/mwfrsLogic'; import type { MwfrsInputs } from '../../../utils/mwfrsLogic'; import { PressureSummaryTable } from '../mwfrs/PressureSummaryTable'; import { ParapetTable } from '../mwfrs/ParapetTable'; import { WallPressureTable } from '../mwfrs/WallPressureTable'; import { MwfrsDirectionalDiagram } from '../mwfrs/MwfrsDirectionalDiagram'; import { WindForcesTable } from '../mwfrs/WindForcesTable'; import { ElevatedBuildingsSection } from '../mwfrs/ElevatedBuildingsSection'; export const MwfrsSheet: React.FC = () => { const { wind, buildingGeometry, mwfrs, setMwfrs } = useCalculatorStore(); // Derived values const h = mwfrs.userRidgeHeight > 0 ? mwfrs.userRidgeHeight : buildingGeometry.meanRoofHeight; // Assume Store 'buildingLength' is dim parallel to ridge, 'leastWidth' is normal. const dimParallel = buildingGeometry.buildingLength; const dimNormal = buildingGeometry.leastWidth; // Calculate qh const qh = calculateWindPressure({ speed: wind.speed, exposure: wind.exposure, height: h, kzt: wind.topography.factor, kd: wind.directionality, ke: wind.groundElevationFactor, g: -1 // unused }); const G = wind.gust.factor; const GCpi = wind.internalPressure; // Toggle Orientation const toggleOrientation = (e: React.ChangeEvent) => { setMwfrs({ ridgeOrientation: e.target.value as any }); }; // Case 1: Wind Normal to Ridge const resultsNormal = useMemo(() => { const inputs: MwfrsInputs = { direction: 'Normal', // Normal to Ridge L: dimNormal, B: dimParallel, h, roofAngle: 0, // Placeholder q_h: qh, G, GCpi, windDirection: 'Normal to Ridge' }; return calculateMwfrsPressures(inputs); }, [dimNormal, dimParallel, h, qh, G, GCpi]); // Case 2: Wind Parallel to Ridge const resultsParallel = useMemo(() => { const inputs: MwfrsInputs = { direction: 'Parallel', // Parallel to Ridge L: dimParallel, B: dimNormal, h, roofAngle: 0, q_h: qh, G, GCpi, windDirection: 'Parallel to Ridge' }; return calculateMwfrsPressures(inputs); }, [dimNormal, dimParallel, h, qh, G, GCpi]); return (

Wind Loads - MWFRS all h (Except for Open Buildings)

Job No: {useCalculatorStore.getState().general.jobNo}
By: {useCalculatorStore.getState().general.calculatedBy}
{/* Header Data Block */}
{/* Column 1: Velocities & Factors */}
Base pressure (qh) = {qh.toFixed(1)} psf
(Kd qh) = {(0.85 * qh).toFixed(1)} psf
Roof Angle (θ) = 0.4 deg
Roof tributary area: 605 sf
{/* Column 2: Dimensions */}
Kh = {wind.exposure === 'C' ? '0.94' : 'N/A'} (approx)
Bldg dim parallel to ridge = {dimParallel.toFixed(1)} ft
Bldg dim normal to ridge = {dimNormal.toFixed(1)} ft
h = {h.toFixed(1)} ft
ridge ht = {h.toFixed(1)} ft
{/* Column 3: Factors */}
GCpi = +/- {GCpi}
G = {G}
qi = qh
{/* Left Sidebar: Parapet / Wall Pressures */}
{/* Main Content */}
{/* Upper Section: Pressures & Diagram */}
{/* Summary Tables */}
Ultimate Wind Surface Pressures (psf)
{/* Wind Overhangs Note */}
Windward roof overhangs : 15.3 psf (upward : add to qhGCp windward roof pressure)
{/* Directional Diagram Sidebar */}
{/* Wind Forces Section */}
{/* Elevated Buildings Section */}
); };