Merge remote-tracking branch 'origin/sub_laptop_2' into main_laptop_1

This commit is contained in:
2026-10-19 09:28:19 +09:00
25 changed files with 737 additions and 286 deletions
+86 -1
View File
@@ -9,7 +9,10 @@
* context?: { earthwork_conversion · natural_spoil_min_ground_slope ·
* haul_equipment_limits · 채집석 · 구조물 잔토(B08) } ·
* excavation?: { pipes: [{ diameter_mm }] · walls: [{ height_m · average_thickness_m ·
* has_foundation }] } } }
* has_foundation }] } ·
* cross_design?: { standard: 표준 횡단(config 위에 저장분 덮은 한 벌) ·
* stations: [{ samples · design_elevation_m · options: 파이썬 `compute_cross_design` 키 }] } ·
* berm?: { structures: 구조물 정본 목록 · chainages: [측점 m] } } }
* 출력 { results: { [id]: 값 }, available: [id…] }
* — 차례는 요청 차례가 아니라 기댐 차례(누가토량 앞에 구조물 면적을 상세에 얹음 ·
* server-calc 묶음과 같은 차례).
@@ -17,6 +20,10 @@
* ========================================================================== */
import { readFileSync, writeFileSync } from "node:fs";
import { bermSpansFromStructures, bermSpecAt } from "@util/common_util_berm_spans";
import type { BermSpec } from "@util/common_util_cross_berm";
import { computeCrossDesign } from "@util/common_util_cross_design";
import type { CrossDesignOptions, CrossGroundSample } from "@util/common_util_cross_design";
import { pipeTrenchWidthM, wallTrenchAreaM2, wallTrenchWidthM } from "@util/common_util_excavation";
import { computeMassHaul, massHaulPayload } from "@util/common_util_mass_haul";
import type { MassHaulResult } from "@util/common_util_mass_haul";
@@ -58,6 +65,67 @@ interface CalcInputs {
has_foundation?: boolean;
}>;
};
berm?: {
structures: Parameters<typeof bermSpansFromStructures>[0];
chainages: number[];
};
cross_design?: {
standard: CrossDesignOptions["standard"];
stations?: Array<{
samples: CrossGroundSample[];
design_elevation_m: number | null;
options: Record<string, unknown>;
}>;
};
}
/** 파이썬 `compute_cross_design` 키 → TS 짝 키(거울 시험 test_b06_cross_design_mirror 표와 같음). */
const CROSS_OPTION_KEYS: Record<string, keyof CrossDesignOptions> = {
ground_type: "groundType",
section_mode: "sectionMode",
ditch_side: "ditchSide",
ditch_type: "ditchType",
paved: "paved",
rock_boundary_offset_m: "rockBoundaryOffsetM",
two_stage_slope: "twoStageSlope",
cut_slope_ratio: "cutSlopeRatio",
ditch_enabled: "ditchEnabled",
ditch_choice: "ditchChoice",
surface_drop_m: "surfaceDropM",
plan_radius_m: "planRadiusM",
curve_outer_side: "curveOuterSide",
curve_widening_m: "curveWideningM",
shoulder_extend_left_m: "shoulderExtendLeftM",
shoulder_extend_right_m: "shoulderExtendRightM",
tilted: "tilted",
tilt_pct: "tiltPct",
};
/** 파이썬 BermSpec(NamedTuple → dict) → TS BermSpec. */
function bermOf(value: unknown): BermSpec | null {
if (!value || typeof value !== "object") return null;
const berm = value as Record<string, number | null>;
return {
widthM: berm.width_m as number,
intervalM: berm.interval_m as number,
slopeDeg: berm.slope_deg as number,
depthM: berm.depth_m as number,
depthLeftM: berm.depth_left_m ?? null,
depthRightM: berm.depth_right_m ?? null,
};
}
function crossOptions(
raw: Record<string, unknown>,
standard: CrossDesignOptions["standard"],
): CrossDesignOptions {
const options: Record<string, unknown> = { standard };
for (const [key, value] of Object.entries(raw)) {
if (key === "berm") options.berm = bermOf(value);
else if (key in CROSS_OPTION_KEYS) options[CROSS_OPTION_KEYS[key]] = value;
else throw new Error(`모르는 횡단 설계 키: ${key}`);
}
return options as unknown as CrossDesignOptions;
}
/** 한 번 돌림 — 같은 id 는 한 번만 셈(memo) · 앞 id 는 `need` 로. */
@@ -117,6 +185,23 @@ function runDesignCalc(run: readonly string[], inputs: CalcInputs) {
),
})),
}),
// 소단 구간(C4) — 구조물 정본 → 구간 · 측점마다 제원(겹치면 먼저 놓은 것).
"cross.berm_spans": () => {
const spans = bermSpansFromStructures(inputs.berm?.structures ?? []);
return { spans, at: (inputs.berm?.chainages ?? []).map((c) => bermSpecAt(spans, c)) };
},
// 측점마다 TS 짝(`computeCrossDesign`) — 못 세우면 그 자리 { error }(파이썬은 ValueError 로 되던짐).
"cross.design": () => {
const batch = inputs.cross_design;
return (batch?.stations ?? []).map((station) => {
try {
const options = crossOptions(station.options, batch!.standard);
return computeCrossDesign(station.samples, station.design_elevation_m, options);
} catch (error) {
return { error: error instanceof Error ? error.message : String(error) };
}
});
},
// 편집 전 정본 — 계획선 샘플은 저장분 그대로(corridor 묶음과 같은 값) · 측점 둘 미만이면 null.
"corridor.mesh": () => {
const detail = inputs.detail;
+12 -14
View File
@@ -365,11 +365,10 @@ export const CALC_REGISTRY: readonly CalcEntry[] = [
site: "browser_now",
stage: "cross",
ts: `${U}common_util_cross_design.ts#computeCrossDesign`,
runner: `py:${B06}B06_Section_Engine_Design.py#compute_cross_design`,
until: "472-4",
runner: "node:cross.design",
pair: `${B06}B06_Section_Engine_Design.py#compute_cross_design`,
mirror: ["test_b06_cross_design_mirror", "test_178_2_berm_fill_mirror"],
note: "파이썬 짝은 B07 · 추천 · Route_Save · B05 확정도 부름 — 짝 남음",
note: "[저장] · [확정] 다시 셈 = Node(472-4 ②) · 파이썬 짝 남음(B07 · 추천 · Route_Save · B05 확정 · 넓힘 찾기) · 알려진 차 = 설계선 점 반올림 동점 1e-4 m",
},
{
id: "cross.areas",
@@ -380,11 +379,10 @@ export const CALC_REGISTRY: readonly CalcEntry[] = [
site: "browser_now",
stage: "cross",
ts: `${U}common_util_cross_design_areas.ts#splitCutAreas`,
runner: `py:${B06}B06_Section_Engine_Areas.py#_split_cut_areas`,
until: "472-4",
runner: "node:cross.design",
pair: `${B06}B06_Section_Engine_Areas.py#_split_cut_areas`,
mirror: ["test_b06_cross_design_mirror"],
note: "X3 — 표준 측점 = 파이썬 · 구조물 측점 = Node(structure.layouts)",
note: "설계선과 한 셈(cross.design) · X3 한 갈래 — 표준 측점 · 구조물 측점(structure.layouts) 모두 Node",
},
{
id: "cross.enforce",
@@ -398,6 +396,7 @@ export const CALC_REGISTRY: readonly CalcEntry[] = [
runner: `py:${B06}B06_Section_Router_Design.py#enforce_design_lines`,
until: "472-4",
pair: `${B06}B06_Section_Router_Design.py#enforce_design_lines`,
note: "구간 판정 = 파이썬 짝(Router_Design_Ranges) · 다시 세운 설계 = Node cross.design",
mirror: ["test_349_0n_cross_enforce_mirror"],
},
{
@@ -408,12 +407,11 @@ export const CALC_REGISTRY: readonly CalcEntry[] = [
outputs: ["소단 구간"],
site: "browser_now",
stage: null,
ts: `${B06}B06_Section_UI_Page_Persist.ts#bermSpansFromStructures`,
runner: `py:${B06}B06_Section_Engine_Structures_Wall.py#load_berm_spans`,
until: "472-4",
ts: `${U}common_util_berm_spans.ts#bermSpansFromStructures`,
runner: "node:cross.berm_spans",
pair: `${B06}B06_Section_Engine_Structures_Wall.py#load_berm_spans`,
mirror: ["test_272_berm_source"],
note: "TS 가 화면 파일 안 — common_util 로(472-4 ②)",
note: "[저장] 다시 셈 = Node(472-4 ②) · 파이썬 짝은 Node 못 부를 때만",
},
{
id: "cross.berm_slope",
@@ -424,9 +422,9 @@ export const CALC_REGISTRY: readonly CalcEntry[] = [
site: "browser_now",
stage: "cross",
ts: `${U}common_util_cross_berm.ts#cutProfilePoints`,
runner: `py:${U}common_util_cross_berm.py#cut_profile_points`,
until: "472-4",
runner: "node:cross.design",
pair: `${U}common_util_cross_berm.py#cut_profile_points`,
note: "설계선 셈 안(cross.design) · 파이썬 짝 남음(cross.design 과 같은 까닭)",
mirror: ["test_178_2_berm_fill_mirror"],
},
{
@@ -441,8 +439,8 @@ export const CALC_REGISTRY: readonly CalcEntry[] = [
runner: `py:${B06}B06_Section_Engine_Tilt.py#attach_underdrains`,
until: "472-4",
pair: `${B06}B06_Section_Engine_Tilt.py#attach_underdrains`,
mirror: [],
note: "거울 시험 없음 — 옮기기 전 먼저",
mirror: ["test_472_4_underdrain_mirror"],
note: "얹기 = GET 상세(파이썬) · 알려진 차 = 옛 underdrain 걷음 TS 만 · 기울임은 cross.design 안",
},
{
id: "cross.fit",