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

This commit is contained in:
2026-10-06 18:16:13 +09:00
11 changed files with 1011 additions and 2 deletions
@@ -0,0 +1,73 @@
"""B08 4탭 홍수량 계산서 엔진 — 견본 입력 손계산 대조 (PLAN 62-2 · 62-3).
견본(울진 2공구 71+13) 입력: A 0.132 ㎢ · L 480 m · H 185 m · R24 305.9 · D 1,200 · S 1/20 ·
n 0.013 · 할증 1.5 · 만관. 도달시간만 Kirpich(사용자 결정).
"""
from __future__ import annotations
import math
import sys
from pathlib import Path
import pytest
ROOT = Path(__file__).resolve().parents[2]
sys.path.insert(0, str(ROOT))
from B08_Quantity.B08_Quantity_Engine_Hydro import compute # noqa: E402
SAMPLE = {
"factor": 1.5,
"runoff": 0.8,
"area_km2": 0.132,
"length_m": 480.0,
"height_m": 185.0,
"tc_min_minutes": 5.0,
"r24_mm": 305.9,
"region": "울진",
"return_period": 100,
"pipe_kind": "흄관",
"n": 0.013,
"diameter_mm": 1200.0,
"slope_denominator": 20.0,
"section": "full",
}
def test_견본_입력_손계산과_같다() -> None:
out = compute(SAMPLE)
# Kirpich: 0.0663 × 0.48^0.77 × (185/480)^-0.385 = 0.05439 hr(3.26 분) → 최소 5 분
assert out["tc_raw_hr"] * 60 == pytest.approx(3.2632, abs=1e-3)
assert out["tc_hr"] == pytest.approx(5 / 60) and out["tc_floored"]
# rt = 305.9/24 × (24 / (5/60))^0.557 = 12.7458 × 288^0.557
assert out["intensity"] == pytest.approx(298.71, abs=0.01)
assert out["flow"] == pytest.approx(0.8 * 298.71 * 0.132 / 3.6, rel=1e-4) # 8.762
assert out["design_flow"] == pytest.approx(1.5 * out["flow"])
# 만관 Ø1.2: A 1.1310 · P 3.7699 · R 0.3 · V = (1/0.013)·0.3^(2/3)·0.05^0.5 = 7.708
assert out["section_area"] == pytest.approx(1.13097, abs=1e-4)
assert out["radius"] == pytest.approx(0.3)
assert out["velocity"] == pytest.approx(7.708, abs=1e-3)
assert out["capacity"] == pytest.approx(8.718, abs=1e-3)
assert out["ok"] is False # 8.718 < Qd 13.14
assert out["ratio_pct"] == pytest.approx(8.718 / 13.143 * 100, abs=0.1)
def test_최소_도달시간을_끄면_Kirpich_값_그대로() -> None:
out = compute({**SAMPLE, "tc_min_minutes": 0})
assert out["tc_hr"] == out["tc_raw_hr"] and not out["tc_floored"]
def test_단면_가정과_관_종류() -> None:
d = 1.2
arc = compute({**SAMPLE, "section": "arc240"})
assert arc["section_area"] == pytest.approx(0.63185 * d * d, abs=1e-4)
assert arc["perimeter"] == pytest.approx(math.pi * d * 2 / 3)
eff = compute({**SAMPLE, "section": "eff70"})
assert eff["section_area"] == pytest.approx(0.7 * math.pi * d * d / 4)
assert eff["radius"] == pytest.approx(d / 4)
# n 비우면 관 종류 값(파형강관 0.024)
kind = compute({**SAMPLE, "n": None, "pipe_kind": "파형강관"})
assert kind["n"] == 0.024
# 할증 · 단면만 바꾸면 홍수량 쪽 Q 는 그대로
assert compute({**SAMPLE, "factor": 2.0})["flow"] == pytest.approx(arc["flow"])