- 설계 계산(파이썬 _SectionGeometry · TS 짝 SectionGeometry) — 기울인 자리(tilted) 노면이 내려가는 쪽 노면 끝 원지반이 노면보다 높으면 같은 기울기로 늘여 원지반과 처음 만나는 자리까지 · 그 쪽 절토 사면 없음 · 샘플 반폭 안에서 못 만나면 옛 길 · 성토 쪽 그대로 · 결과 tilt_reach - 토공 면적 · 설계선이 늘인 노면을 따름(서버 정본 · [저장] 재계산 · 거울 시험 갈래) - 횡단 그림 — 콘크리트(포장층) · 월류 높이선이 늘인 끝까지(fordEdges) - 시험 test_294_3 새로 · 횡단 설계 거울 「물넘이포장 낮은 쪽 노면 연장」 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TteK8mfYZetk5P3bEZkyVZ
113 lines
4.2 KiB
Python
113 lines
4.2 KiB
Python
"""294 물넘이 낮은 쪽 연장 · 도수로/돌붙임 끝단 · 띠 ↔ 성토 사면 고름(요구 188-2 · 188-3 · 189 · 그림_188).
|
||
|
||
못박는 것
|
||
- 294-3 물넘이 측점 낮은 쪽 노면 끝 원지반이 노면보다 높으면(절토) 노면을 같은 기울기로 늘여 원지반과
|
||
처음 만나는 자리까지(그 쪽 절토 사면 없음 · `tilt_reach`) · 성토 쪽 그대로 · 반폭 안에서 못 만나면 옛 길 ·
|
||
서버 정본 ↔ TS 짝 같은 값 = 횡단 설계 거울(`test_b06_cross_design_mirror` 「물넘이포장 낮은 쪽 노면
|
||
연장」) · 그림 = 콘크리트(포장층)가 늘인 끝까지.
|
||
|
||
진짜 TS 는 `helper_294_3_ford_extend_chute.cjs` 가 Node 로 돌림. 화면은 사용자 확인.
|
||
"""
|
||
|
||
from __future__ import annotations
|
||
|
||
import json
|
||
import subprocess
|
||
import sys
|
||
from pathlib import Path
|
||
|
||
import pytest
|
||
|
||
HERE = Path(__file__).resolve().parent
|
||
ROOT = HERE.parents[1]
|
||
if str(ROOT) not in sys.path:
|
||
sys.path.insert(0, str(ROOT))
|
||
if str(HERE) not in sys.path:
|
||
sys.path.insert(0, str(HERE))
|
||
|
||
from B06_Section.B06_Section_Engine_Design import compute_cross_design # noqa: E402
|
||
from config.config_system import STANDARD_CROSS_SECTION # noqa: E402
|
||
from test_b06_cross_design_mirror import CASES, _dip_ground # noqa: E402
|
||
|
||
KW = {
|
||
"ground_type": "soil",
|
||
"section_mode": "left_cut",
|
||
"ditch_side": "left",
|
||
"paved": True,
|
||
"tilted": True,
|
||
"tilt_pct": 5.0,
|
||
"standard": STANDARD_CROSS_SECTION,
|
||
}
|
||
|
||
pytestmark = pytest.mark.skipif(
|
||
not (ROOT / "config" / "node_modules" / "typescript").is_dir(),
|
||
reason="프론트엔드 의존성 미설치",
|
||
)
|
||
|
||
|
||
def _line(samples_fn) -> list[dict]:
|
||
return [
|
||
{"offset_m": o / 2, "elevation_m": round(samples_fn(o / 2), 4), "valid": True}
|
||
for o in range(-24, 25)
|
||
]
|
||
|
||
|
||
@pytest.fixture(scope="module")
|
||
def dip() -> dict:
|
||
return compute_cross_design(_dip_ground(), 100.4, **KW)
|
||
|
||
|
||
@pytest.fixture(scope="module")
|
||
def ts(dip, tmp_path_factory) -> dict:
|
||
source = tmp_path_factory.mktemp("s294") / "in.json"
|
||
source.write_text(json.dumps({"design": dip}), encoding="utf-8")
|
||
proc = subprocess.run(
|
||
["node", str(HERE / "helper_294_3_ford_extend_chute.cjs"), str(source)],
|
||
capture_output=True,
|
||
text=True,
|
||
encoding="utf-8",
|
||
timeout=60,
|
||
)
|
||
assert proc.returncode == 0, proc.stderr
|
||
return json.loads(proc.stdout)
|
||
|
||
|
||
def test_양측_절토_낮은_쪽_늘인_끝은_원지반_교점(dip):
|
||
reach = dip["tilt_reach"]
|
||
# 원지반 101.05 + 0.2·o(−4.5 까지) · 노면 100.4 + 0.05·o → −4.3333 에서 만남
|
||
assert reach["side"] == "right"
|
||
assert reach["offset_m"] == pytest.approx(-4.3333, abs=1e-4)
|
||
assert reach["elevation_m"] == pytest.approx(100.4 - 0.05 * 4.3333, abs=1e-4)
|
||
edge = dip["road_edges"]["right"]["offset_m"]
|
||
for p in dip["design_line"]: # 노견 끝 ~ 늘인 끝 = 노면 기울기 그대로(절토 사면 없음)
|
||
if reach["offset_m"] - 1e-6 <= p["offset_m"] <= edge:
|
||
assert p["elevation_m"] == pytest.approx(100.4 + 0.05 * p["offset_m"], abs=1e-4)
|
||
assert dip["ditch_enabled"] is False
|
||
|
||
|
||
def test_성토_쪽은_그대로():
|
||
got = compute_cross_design(_line(lambda o: 100.0 + 0.35 * o), 100.4, **KW)
|
||
assert "tilt_reach" not in got # 낮은 쪽(우) 노면 끝 원지반이 노면 아래 = 성토 사면
|
||
|
||
|
||
def test_반폭_안에서_못_만나면_옛_길():
|
||
got = compute_cross_design(_line(lambda o: 101.0 + 0.02 * o), 100.4, **KW)
|
||
assert "tilt_reach" not in got # 늘인 노면이 끝까지 원지반 아래 = 절토 사면 그대로
|
||
right = [
|
||
p for p in got["design_line"] if p["offset_m"] < got["road_edges"]["right"]["offset_m"]
|
||
]
|
||
assert any(p["elevation_m"] > got["road_edges"]["right"]["elevation_m"] for p in right)
|
||
|
||
|
||
def test_서버_TS_같은_값은_거울_시험():
|
||
assert any(case["name"] == "물넘이포장 낮은 쪽 노면 연장" for case in CASES)
|
||
|
||
|
||
def test_콘크리트는_늘인_끝까지(dip, ts):
|
||
assert ts["edges"]["right"] == {
|
||
"offset_m": dip["tilt_reach"]["offset_m"],
|
||
"elevation_m": dip["tilt_reach"]["elevation_m"],
|
||
}
|
||
first = ts["pavePoints"].split()[1] # 포장층 윗면 우 끝
|
||
assert float(first.split(",")[0]) == pytest.approx(-4.3333, abs=1e-4)
|