Files
Aislo/B05_Profile/B05_Profile_Engine_Grade_CurveLaw.py
T
eomsangdonandClaude Opus 5.5 172ff8170b refactor(511-B B-6 정리): 운영 부름 0 파이썬 짝 걷음 · 남는 짝 머리에 남는 까닭 · 등록부 until 걷음 · 알려진 차 까닭 · 322_3 flow 빨강 고침
걷은 함수(운영 부름 0 · 전수 확인 = 화면 · 서버 · 체인 · 추천 엔진 · B07 · 시험)
- common_util/common_util_excavation.py 통째(126 줄 · pipe_trench_width_m · wall_trench_area_m2 · wall_trench_width_m · 서버 = Node excavation.trench)
- Engine_Grade_Carry.carry_edits(Node carry_seat 겉) · Route_Save_Parts.seat_route_moved(시험 헬퍼 helper_475_1_moved 로 옮김)
- Engine_Tilt.attach_underdrains · Engine_Structures_Wall.attach_wall_structures · load_wall_structures
- Engine_Grade_Alignment.tangent_elevation(부름 0) · station_key.dedupe_station_keys · loose_chainage
줄 수 전 → 후: excavation.py 126 → 0 · Grade_Carry 178 → 157 · Save_Parts 289 → 269 · Wall 221 → 197 · Tilt 115 → 112 · station_key 141 → 122 · Alignment 657 → 654

남는 짝(머리 「남는 까닭」 한 줄) — Grade · Grade_Profile · Alignment · CurveLaw(2~4 순위 폴백 · 추천) · NodeEdits · SampleExtend · Router_Design · Ranges · Engine_Design · Areas · cross_berm(DTM 아닌 지표면 · Node 못 부를 때 · B07 · 추천) · Tilt · Wall · Culvert(B04 B07 B08) · route_follow · structure_station · station_key · route_polyline(745 줄 · 까닭 = 등록부 R1 줄)

등록부 — until 칸 걷음(G1 = py 표본기 남김 · 까닭 note) · C6 pair = attach_underdrain_specs · F8 pair null
알려진 차 — golden KNOWN 셋 그대로 나타남(R7 표본 출처 · W0 저장 때 경고 · X2 입력 선 자릿수 · 까닭 고침) · underdrain 알려진 차 까닭 · 511_b5 KNOWN_ARC 그대로
계산 자리 창 — 45 줄 · 서버만 아닌 41(바꿀 수 있음 40 + F9) · 서버만 넷(G3 D1 D2 N1 줄마다 까닭) · 옛 까닭 「짝 모으는 중 · B-4」 글 걷음
test_322_3_flow 빨강 — 헬퍼가 @config/config_frontend 흉내(511-A design_calc_server import)
시험 기준 — 걷은 짝 거울 = 걷기 전 파이썬 값 고정(excavation · station_key) · Node carry_seat · attach_underdrain_specs · wall_specs_from

검증: 고친 대상 시험 97 파일 562 통과 · 21 건너뜀 · typecheck 0 · 700 줄 넘는 새 파일 없음 — 요구 320-4

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 16:34:08 +09:00

76 lines
3.5 KiB
Python

"""B05 종단곡선 초기값 직선 · 법정 미달 판정(432 · 요구 262).
- `flat_bends` · `straighten_held` : 초기값(자동설계 체인 · 추천 [적용] · 노선 저장 때 새로 생긴
구간)에서만 — 기본 L 기준 R 이 `initial_straight_radius_m`(500 m)보다 큰(대수차 L/R 안쪽) 꼭짓점
묶음을 앞뒤 경계(진짜 꺾임 · 시종점)를 잇는 직선 위로 옮김(438 · 종단 직선화 단추와 같은 규칙).
직선 위 꼭짓점은 직선 판정(426)이라 곡선 없음 · 되풀이는 `straight_pass_through`.
- `vertical_curve_shortfalls` : 설계속도별 종단곡선 최소 R · L 미달(지식DB 별표2 마.) — 막지 않고
경고만 · 비포장 대수차 5 % 이하(생략 가능)는 뺌 · 45 % 규칙으로 줄어든 곡선도 같은 잣대.
짝: TS `logic/B05_Profile_Profile_CurveLaw.ts` — 거울 시험 `test_432_1_curve_law.py`.
남는 까닭(511-B B-6) — 종단곡선 법칙 정본 = Node `profile.alignment` 안 · 이 짝 = 추천 엔진 첫
계획선 · 2~4 순위 폴백.
"""
from typing import Any
import numpy as np
from config.config_system import FOREST_ROAD_PROFILE_ALIGNMENT
# 초기값 직선 문턱 R(m) — TS `INITIAL_STRAIGHT_RADIUS_M` 과 같은 값.
INITIAL_STRAIGHT_RADIUS_M = float(FOREST_ROAD_PROFILE_ALIGNMENT["initial_straight_radius_m"])
# 법정 미달 판정 오차(m) — R = L/Δ 되셈 L 19.99998 거짓 미달 막음(271-1) · TS `SHORTFALL_TOLERANCE_M` 짝.
SHORTFALL_TOLERANCE_M = 1e-3
def flat_bends(base_s: np.ndarray, base_z: np.ndarray, curve_length_m: float | None) -> np.ndarray:
"""안쪽 꼭짓점 중 기본 L 기준 R > 500 m(|대수차| < L/500) 인 것 — 시종점은 늘 False."""
flat = np.zeros(len(base_s), dtype=bool)
if not curve_length_m or len(base_s) < 3:
return flat
spans = np.diff(base_s)
grades = np.diff(base_z) / np.where(spans > 0, spans, 1.0)
flat[1:-1] = np.abs(np.diff(grades)) < float(curve_length_m) / INITIAL_STRAIGHT_RADIUS_M
return flat
def straighten_held(base_s: np.ndarray, base_z: np.ndarray, held: np.ndarray) -> np.ndarray:
"""`held` 꼭짓점 묶음마다 앞뒤 경계(held 아닌 꼭짓점)를 잇는 직선 위로 옮긴 표고."""
z = np.asarray(base_z, dtype=np.float64).copy()
index = 1
while index < len(z) - 1:
if not held[index]:
index += 1
continue
end = index
while end + 1 < len(z) - 1 and held[end + 1]:
end += 1
a, b = index - 1, end + 1
z[index:b] = np.interp(base_s[index:b], [base_s[a], base_s[b]], [z[a], z[b]])
index = b
return z
def vertical_curve_shortfalls(
curves: list[dict[str, Any]], min_radius_m: float, min_length_m: float
) -> list[str]:
"""법정 최소 R · L 을 못 채운 종단곡선 경고 글(누가거리 순) — 기준 0 이면 판정 안 함."""
if min_radius_m <= 0 and min_length_m <= 0:
return []
out = []
for curve in curves:
if curve.get("omitted") or curve.get("skip_allowed"):
continue
radius = float(curve.get("radius_m", curve.get("r_m", 0.0)))
length = float(curve.get("length_m", curve.get("l_m", 0.0)))
if (
radius < min_radius_m - SHORTFALL_TOLERANCE_M
or length < min_length_m - SHORTFALL_TOLERANCE_M
):
out.append(
f"{float(curve['chainage_m']):.1f}m: 종단곡선 R {radius:.0f}m · L {length:.1f}m — "
f"법정 최소 R {min_radius_m:.0f}m · L {min_length_m:.0f}m 미달"
)
return out