- 세월교 명세(design_structure_ford) — 세월교(관경 · 월류 폭 · 월류 높이 · 수량(련)) · 유입 구조 · 유출 구조(없음 · 날개벽 · 흙막이) · 모두 필수 · 컨테이너마다 구조물 조합 잇기(gford · gfordin · gfordout) - 구조 키 inlet_type · outlet_type + 옛 날개벽 설치 칸(wing_in · wing_out) 함께 씀 · 옛 저장 · B06 조정창 설치 칸으로 구조를 맞춤 · 옛 관종 · 날개벽 치수는 지난 정의 값 - 계산 파일 따로(design_structure_ford_calc) — 높이 = 설계유량을 그 폭으로 넘기는 Manning 필요 수심 · 0.01 올림 · 폭을 바꾸면 채움 · 그 아래는 안 받음 · 근거 통수단면.md:23~33 · :59 - B06 날개벽 조정 행 자리 = 유입 · 유출 구조 컨테이너 끝 · 세월교 옛 관종 · 관경 · 월류 칸 걷음 - 정의 종류.ford_bridge.이름 표 · 명세 등록(STRUCTURE_SPECS) · 52-1 시험 헬퍼가 같은 폴더 명세 import 를 읽음 - 시험 test_52_4_structure_spec_ford · 화면 시나리오 ui_checks/52-4_세월교_컨테이너 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NPJGtfXo6GMbcpiboQC4uK
87 lines
3.5 KiB
JavaScript
87 lines
3.5 KiB
JavaScript
/* 세월교 명세(표 04) · 월류 폭 ↔ 높이 계산 단위검증 헬퍼(PLAN 52-4) — `design_structure_spec.ts` ·
|
|
* `design_structure_ford.ts` · `design_structure_ford_calc.ts`(+ `fordSection` 이 든 B05 칸 조각)를 그 자리에서
|
|
* 트랜스파일해 Node 로 돌림. 결과 = JSON 한 벌. 인자 `names` 면 세월교 이름 표(정의 `종류.ford_bridge.이름`)만 냄.
|
|
*/
|
|
const fs = require("fs");
|
|
const path = require("path");
|
|
const ts = require(path.join(__dirname, "..", "..", "config", "node_modules", "typescript"));
|
|
|
|
const ROOT = path.join(__dirname, "..", "..");
|
|
const cache = new Map();
|
|
/** TS 한 파일을 CommonJS 로 — 상대 import 는 그 파일 자리 기준 · `@config/` 는 config 폴더 · .json 은 그대로. */
|
|
const load = (file) => {
|
|
if (cache.has(file)) return cache.get(file);
|
|
if (file.endsWith(".json")) return JSON.parse(fs.readFileSync(file, "utf8"));
|
|
const js = ts.transpileModule(fs.readFileSync(file, "utf8"), {
|
|
compilerOptions: { module: ts.ModuleKind.CommonJS, target: ts.ScriptTarget.ES2020 },
|
|
}).outputText;
|
|
const box = { exports: {} };
|
|
cache.set(file, box.exports);
|
|
const near = (m) => {
|
|
const base = m.startsWith("@config/")
|
|
? path.join(ROOT, "config", m.slice(8))
|
|
: path.join(path.dirname(file), m);
|
|
return load(base.endsWith(".json") ? base : `${base}.ts`);
|
|
};
|
|
new Function("exports", "module", "require", js)(box.exports, box, near);
|
|
cache.set(file, box.exports);
|
|
return box.exports;
|
|
};
|
|
const D = (f) => path.join(ROOT, "A00_Common", "design", f);
|
|
const s = load(D("design_structure_spec.ts"));
|
|
const { FORD_SPEC, withLegacyGuards } = load(D("design_structure_ford.ts"));
|
|
const calc = load(D("design_structure_ford_calc.ts"));
|
|
|
|
if (process.argv[2] === "names") {
|
|
process.stdout.write(JSON.stringify(s.nameTable(FORD_SPEC)));
|
|
process.exit(0);
|
|
}
|
|
|
|
const old = {
|
|
pipe_kind: "파형강관",
|
|
pipe_diameter_mm: 1000,
|
|
pipe_count: 2,
|
|
ford_width_m: 10,
|
|
ford_height_m: 0.3,
|
|
wing_in: "있음",
|
|
wing_in_height_m: 1,
|
|
wing_out: "없음",
|
|
};
|
|
const legacy = withLegacyGuards(old);
|
|
const state = s.readState(FORD_SPEC, legacy);
|
|
const back = s.writeOptions(FORD_SPEC, state);
|
|
const soil = JSON.parse(JSON.stringify(state));
|
|
soil.inlet[0].structure = "흙막이";
|
|
soil.outlet[0].structure = "날개벽";
|
|
const soilOut = s.writeOptions(FORD_SPEC, soil);
|
|
|
|
const flows = [0.5, 2.54, 8];
|
|
const widths = [3, 5, 10, 20];
|
|
const table = flows.flatMap((q) => widths.map((b) => [q, b, calc.fordHeightM(q, b)]));
|
|
|
|
const out = {
|
|
containers: FORD_SPEC.containers.map((c) => [c.id, c.title, c.required]),
|
|
items: FORD_SPEC.containers.map((c) => c.items.map((i) => [i.id, i.kind, i.key ?? null])),
|
|
choices: FORD_SPEC.containers.map((c) =>
|
|
c.items.filter((i) => i.kind === "select").map((i) => s.choicesOf(i, {}).map((ch) => ch.label)),
|
|
),
|
|
legacy: { inlet: legacy.inlet_type, outlet: legacy.outlet_type },
|
|
keepSoil: withLegacyGuards({ inlet_type: "흙막이", wing_in: "없음" }).inlet_type,
|
|
b06Off: withLegacyGuards({ inlet_type: "날개벽", wing_in: "없음" }).inlet_type,
|
|
b06On: withLegacyGuards({ inlet_type: "없음", wing_in: "있음" }).inlet_type,
|
|
state,
|
|
back,
|
|
soilOut,
|
|
links: FORD_SPEC.containers.map((c) => s.linkOf(c, 1)),
|
|
keys: s.specKeys(FORD_SPEC),
|
|
retired: FORD_SPEC.retired,
|
|
table,
|
|
none: [calc.fordHeightM(null, 10), calc.fordHeightM(2.54, 0)],
|
|
hints: [
|
|
calc.fordHeightHint(2.54, 10),
|
|
calc.fordHeightHint(2.54, 0),
|
|
calc.fordHeightHint(null, 10),
|
|
],
|
|
};
|
|
process.stdout.write(JSON.stringify(out));
|