/** * 기둥 배근 입력 (승인 2026-10-26, 시안 ③ 기둥 삽도). The inputs of the 기둥 panel; the names match ColumnInput. * Defaults are the 기둥철근 (1).md P1 values; the ranges are proposed and pending the design-standard check. * The 주철근 하단 갈고리 is fixed (no input). */ export interface ColumnRebarSettings { /** K1 중심 피복 c (기둥 면 ~ P1 중심, mm). */ c: number; /** 띠철근 간격 K3 (일반 구간, mm). */ ctcP3: number; /** 띠철근 간격 K5 (단부, mm). */ ctcP5: number; /** 띠철근 간격 K4 (기초 안, mm). */ ctcP4: number; /** 크로스타이 K6 간격 (단 간격, mm). */ ctcP6: number; /** 주철근 커플러 간격 (기초 상면부터, mm). */ ctcCoupler: number; /** P2 커플러를 P1보다 올리는 높이 (mm). */ dzCp2: number; /** 주철근 원주 등분 수 n_div (P1·P2 공통, 짝수). */ nDiv: number; } export const DEFAULT_COLUMN_REBAR: ColumnRebarSettings = { c: 125, ctcP3: 300, ctcP5: 120, ctcP4: 120, ctcP6: 1800, ctcCoupler: 3000, dzCp2: 150, nDiv: 46, }; /** Allowed range per input (inclusive, mm). */ export const COLUMN_REBAR_RANGES: Record = { c: [100, 150], ctcP3: [200, 400], ctcP5: [80, 200], ctcP4: [80, 200], ctcP6: [1200, 2400], ctcCoupler: [2000, 4000], dzCp2: [0, 300], nDiv: [40, 50], }; export interface ColumnSettingsIssue { code: 'CL01' | 'CL02'; key: keyof ColumnRebarSettings; message: string; } /** * CL01: a value is not a finite number or is out of range (W). CL02: n_div is odd (the main bars come in pairs around the circle). */ export function columnSettingsIssues(s: ColumnRebarSettings): ColumnSettingsIssue[] { const out: ColumnSettingsIssue[] = []; for (const key of Object.keys(COLUMN_REBAR_RANGES) as (keyof ColumnRebarSettings)[]) { const v = s[key]; const [lo, hi] = COLUMN_REBAR_RANGES[key]; if (!Number.isFinite(v) || v < lo || v > hi) { out.push({ code: 'CL01', key, message: `CL01 ${key} ${v} 범위 밖 (${lo}–${hi})` }); } } if (Number.isFinite(s.nDiv) && s.nDiv % 2 !== 0) { out.push({ code: 'CL02', key: 'nDiv', message: `CL02 주철근 등분 수 ${s.nDiv}는 홀수 (짝수만 허용)` }); } return out; }