Files
Pier_v1/tests/abut-bearing-table.test.ts
T
ypshimandClaude Opus 5.5 7e3ba306f3 feat(abut): ② 교량받침·받침블럭·솔플레이트 카드를 시안대로 구현
- 받침 ELEVATION TABLE (위치 s, 구간, 교좌면 EL, h1 75, h2 50, z = EL.X, h3, h4, E, 솔플 상면 EL, A, B, 블럭~계단 경계)과 솔플레이트 상세 TABLE (S, L, W, T, T1, T2, 검산)을 교대 모델에서 계산 (src/core/abut/bearing-table.ts)
- 공통 · 규칙 입력 4개: 받침 높이 h3 181, 솔플레이트 T 30, 솔플 여유 100, 받침 종류 탄성받침. 기본값은 교각 P1 가정 (QA-15). 교대 기록의 bearingRule에 저장, 프로젝트 파일 검사 포함
- 검사 줄: W02, W04, W03, I01
- ②에서는 받침별 z·교좌면 입력칸 대신 표를 보여 줌 (①은 그대로). 삽도는 넣지 않음
- 테스트 5건 추가, 전체 642건 통과, 타입 검사·빌드 통과. 브라우저 시각 확인은 미실시

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 18:14:29 +09:00

78 lines
3.5 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { readFileSync } from 'node:fs';
import { fileURLToPath } from 'node:url';
import * as XLSX from 'xlsx';
import { describe, expect, it } from 'vitest';
import { buildAbut } from '../src/core/abut/geometry';
import { parseAbutments, toAbutInput } from '../src/core/abut/parse';
import { buildMembers } from '../src/core/abut/members';
import {
ABUT_BEARING_RULE_DEFAULT,
abutBearingChecks,
abutElevationRows,
abutSolplateRows,
resolveBearingRule,
} from '../src/core/abut/bearing-table';
import { applyBearingRule } from '../src/core/abut/edit';
import { checkStoredAbutments } from '../src/core/project';
const RAG = fileURLToPath(new URL('../../../RAG/운곡교P1입력.xlsx', import.meta.url));
const rec = parseAbutments(XLSX.read(readFileSync(RAG), { type: 'buffer' })).abutments[0];
const input = toAbutInput(rec);
const model = buildAbut(input);
const members = buildMembers(model, { bottomEl: input.foundationBottomEl, pileLengthMm: input.pileLengthMm });
const rule = resolveBearingRule();
describe('교대 받침 카드 표 (시안 ②, QA-15 가정)', () => {
it('ELEVATION: block 125 = concrete 75 + pad 50, E = 75 + 50 + 181 + 30 = 336', () => {
const rows = abutElevationRows(model, rule);
expect(rows).toHaveLength(5);
for (const r of rows) {
expect(r.h1).toBe(75);
expect(r.h2).toBe(50);
expect(r.E).toBe(336);
expect(r.solplateTopEl).toBeCloseTo(r.seatEl + 0.336, 6);
}
const first = rows.find((r) => r.no === 1)!;
expect(first.seg).toBe('①');
expect(first.seatEl).toBeCloseTo(44.367, 3);
expect(first.z).toBeCloseTo(44.492, 3);
});
it('솔플레이트: L 800, W 740, S = −1.91 %, T1 38 / T2 22, check 16 ≈ 15.3', () => {
const [r] = abutSolplateRows(model, rule, rec.slopeI);
expect(r.L).toBe(800);
expect(r.W).toBe(740);
expect(r.S).toBeCloseTo(-1.91, 2);
expect([r.T, r.T1, r.T2]).toEqual([30, 38, 22]);
expect(r.check).toBe('16 ≈ 15.3');
});
it('the rule inputs change the table: h3 200 gives E 355, margin 150 gives L 850', () => {
const r2 = resolveBearingRule({ h3Mm: 200, solplateMarginMm: 150 });
expect(abutElevationRows(model, r2)[0].E).toBe(355);
expect(abutSolplateRows(model, r2, rec.slopeI)[0].L).toBe(850);
expect(ABUT_BEARING_RULE_DEFAULT.kind).toBe('탄성받침');
});
it('checks: W02, W04 (흉벽 ≈ 145 · 전면 255), W03 and I01 all clear for A1', () => {
const lines = abutBearingChecks(model, members, rule);
expect(lines).toHaveLength(4);
expect(lines[0]).toContain('W02 없음');
// 시안 145 is bearing ① (lateral 0.745); the smallest gap over the five bearings is 144 (lateral 0.744).
expect(lines[1]).toMatch(/흉벽 14[45]/);
expect(lines[1]).toContain('전면 255');
expect(lines[1]).toContain('W04 없음');
expect(lines[2]).toContain('W03 없음');
expect(lines[3]).toContain('I01 없음');
});
it('the rule edit keeps only changed values, refuses 0 and an empty 받침 종류, and the project file accepts it', () => {
const edited = applyBearingRule(applyBearingRule(rec, 'h3Mm', 200), 'kind', '포트받침 3000 kN');
expect(edited.bearingRule).toEqual({ h3Mm: 200, kind: '포트받침 3000 kN' });
expect(() => applyBearingRule(rec, 'solplateTMm', 0)).toThrow('0보다 큰');
expect(() => applyBearingRule(rec, 'kind', ' ')).toThrow('받침 종류');
expect(() => checkStoredAbutments([edited])).not.toThrow();
expect(() => checkStoredAbutments([{ ...edited, bearingRule: { h3Mm: 'x' } }])).toThrow('받침 규칙');
});
});