/** * 솔플레이트 규칙 (C안, 2026-11-03). Pure: the solplate every bearing of a pier gets from its rule. The rule gives the * 받침높이 H (solplate included), the plan size (교직 L across the 교각축 직각, 교축 W along the 교축) and the slope S (%). * The centre thickness T is the smallest whole mm that keeps the thin end T2 at 22 mm or more: T = ⌈22 + L·|S|/200⌉. * The bearing body is then h3 = H − T. */ import type { SolplatePlan, SolplateRule } from './types'; /** 공통 기본값 (2026-11-03): 받침높이 211 mm, 교직 1000 × 교축 1100 mm, 종단 기울기 −0.5 %. */ export const SOLPLATE_RULE_DEFAULT: SolplateRule = { heightMm: 211, lengthMm: 1000, widthMm: 1100, slopePct: -0.5 }; /** Smallest allowed thickness at the thin end (mm). */ export const SOLPLATE_MIN_T2_MM = 22; /** Centre thickness T (mm, whole mm): the thin end T2 = T − L·|S|/200 is at least 22 mm. */ export function solplateCenterT(lengthMm: number, slopePct: number): number { return Math.ceil(SOLPLATE_MIN_T2_MM + (lengthMm * Math.abs(slopePct)) / 200); } /** The solplate plan of a rule: T, T1 = T + L·|S|/200, T2 = T − L·|S|/200, h3 = H − T. */ export function solplatePlan(rule: SolplateRule): SolplatePlan { const T = solplateCenterT(rule.lengthMm, rule.slopePct); const drop = (rule.lengthMm * Math.abs(rule.slopePct)) / 200; return { L: rule.lengthMm, W: rule.widthMm, slopePct: rule.slopePct, T, T1: T + drop, T2: T - drop, h3: rule.heightMm - T }; } /** Input problems of a rule, in Korean; empty when the rule can build a solplate. */ export function solplateRuleIssues(rule: SolplateRule): string[] { const issues: string[] = []; if (!(rule.lengthMm > 0) || !(rule.widthMm > 0)) issues.push('솔플레이트 교직·교축 길이는 0보다 커야 합니다.'); if (!Number.isFinite(rule.slopePct)) issues.push('종단 기울기는 숫자여야 합니다.'); if (!(rule.heightMm > 0)) issues.push('받침높이는 0보다 커야 합니다.'); if (issues.length === 0) { const plan = solplatePlan(rule); if (!(rule.heightMm > plan.T)) issues.push(`받침높이는 솔플레이트 중심 두께 ${plan.T} mm보다 커야 합니다.`); } return issues; }