8 Commits

Author SHA1 Message Date
windpacer
b828647cca chore(sql): report_keep_qv_tags.sql 폐기표시 — 빌더가 근본 처리
응급 수동 보정(FIQ-*.QV를 addr=0/realtime=false로 keep 분류)은 이제 불필요.
빌더가 AnalogPoint 보조슬롯에서 FIQ-*.QV를 실제 주소·realtime=TRUE·archive=TRUE로
생성하므로 map 재빌드/--db-conn 적용 시 자동 분류·폴링된다. 이력 보존용으로만 유지.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-19 05:47:38 +09:00
windpacer
bb99729e9e chore(report): 디지털잔재정리 문서 폐기 + 리포트 .QV 7개 keep 재분류
- docs/작업지시-history-디지털잔재정리.md: SUPERSEDED 배너(실행 금지).
  2026-06-18 실측 — 삭제대상(비-archive ~2천만)은 디지털 잔재 0, 전부 아날로그
  루프/적산. 특히 .QV는 리포트(history_table)가 의존 → 삭제 시 과거 리포트 파손.
- scripts/sql/report_keep_qv_tags.sql: SteamFlow 적산 FIQ-*.QV 7개를
  archive_enabled=TRUE로 재분류(register-map 누락 보정). realtime/is_active=FALSE
  로 폴링 부작용 0. 멱등(map 재빌드 후 재적용). DB에는 이미 적용.

검증: 리포트 태그 삭제대상 0행, 전체 삭제대상 19.98M→17.62M(2.36M 보호).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-18 20:42:37 +09:00
windpacer
400ba2c639 feat(report): P2-C 템플릿별 자동생성 스케줄러 — 멱등 catchup BackgroundService
- report_template에 schedule_enabled/period/hour/source 컬럼(ALTER IF NOT EXISTS,
  p0_report.sql + 서비스 EnsureSchema 멱등).
- Hc900ReportScheduleService: 매 N초 활성 템플릿마다 완료된 기간(anchor)을
  lookback 내 산출 → report_run 성공기록 없으면 FillAsync 생성·기록.
  중복 0(HasSuccessfulRun dedup)·다운타임 자동복구. 윈도는 셀 토큰 period=가 결정.
- IReportTemplateStore.UpdateSchedule/HasSuccessfulRun, ListAsync에 스케줄 컬럼.
- PUT /api/report/template/{id}/schedule (period/hour 검증).
- UI: 목록에 스케줄 상태 표시 + 선택 템플릿 스케줄 편집기.
- appsettings Report:Schedule (간격·catchup) 추가.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-17 21:30:17 +09:00
windpacer
c3a5258bf2 feat(report): P1d 실시간 알람 엔진 (kpi_alert) — P1 온라인 히스토리안 완료
운전모드/폐합 기반 실시간 알람 — P1 마지막 조각.

- kpi_alert 테이블(edge-trigger: 진입 active, 해제 resolved, DB상태라 크래시 무관).
- Hc900LiveKpiService 알람 평가: 최신 history_1s 샘플로 운전모드(cleaning/drawdown/normal) 판정
  + 폐합 이탈(normal & |closure-100|>tol). 룰: cleaning/drawdown(info), closure_deviation(warning).
- GET /api/report/alerts. Report:LiveKpi:ClosureTolerancePct(기본 2%) config.

검증: 라이브 C-8111 drawdown 알람 발화(feed≈0 포착), opened_at 고정·updated_at 갱신(edge-trigger),
/alerts 정상. (데모 sim은 임계 빈번교차로 flapping 가능 — M분 디바운스는 운영 튜닝.)

P1 완료: P1a 1초버퍼 · P1b 연속집계 · P1c 온라인누적기 · P1d 알람.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-15 08:15:29 +09:00
windpacer
b820e6c33a feat(report): P1c 온라인 KPI 누적기 (live_kpi) + 메트릭 소스 일반화
온라인 히스토리안 3계층 — 실시간 KPI를 history_1s에서 산출·캐싱.

- 메트릭 소스 일반화: history_table | history_1s | history_1min_src | fast_record.
  history_1min_src = 연속집계 드롭인 호환뷰(bucket→recorded_at).
- Hc900LiveKpiService: 매 15s 오늘(KST) 컬럼별 KPI(production/yield/energy/closure)를
  history_1s에서 재계산해 live_kpi upsert. 재계산=러닝상태의 stateless 동등판(causal 동치,
  크래시 복구 불필요). 컬럼 state(normal/idle/error) 산출.
- live_kpi 테이블 + GET /api/report/live 조회 엔드포인트.
- Report:LiveKpi config(Enabled/IntervalSeconds/Source).

검증: 라이브 live_kpi 28행(7컬럼×4KPI) 15s 갱신, /live 정상. 데모 sim은 totalizer가
평평해 값 0/idle(플러밍 정상, 실데이터면 실값).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-15 07:52:31 +09:00
windpacer
3506a67c28 feat(report): P1b 연속집계 history_1min — 1초 버퍼 60초 롤업(장기 무손실)
온라인 히스토리안 2계층: history_1s(최근 14일, 고해상) + history_1min(장기, 60초).

- history_1min 연속집계(timescaledb.continuous): time_bucket('1 min') + last(value)/last(controller_id).
  refresh 정책(start 3h, end 10min, 5분마다) → 집계 lag ≪ 보존윈도(14일)이라 1초 raw evict 전 materialize.
- Hc900FastHistoryService.EnsureSchemaAsync에 cagg 생성+정책 멱등 추가. SQL 파일 동기화.

검증: 2계층 값 일치(1s last == 1min cagg), 정책 활성, 무손실 불변식 충족.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-15 07:13:12 +09:00
windpacer
7f67f0e54d feat(report): P1a 1초 링버퍼 히스토리안 (history_1s)
온라인 히스토리안 1계층 — 디스크 상한 고정 1초 버퍼.

- history_1s Timescale 하이퍼테이블(1h 청크) + 압축(6h) + 보존 14일(청크DROP, 디스크 상한 고정).
- Hc900FastHistoryService: 매 1초 realtime_table 큐레이션 태그 → history_1s append.
  기동 시 스키마/정책 멱등 생성. Hc900HistoryService(60s) 패턴.
- ReportColumnMap.HistorianTags(): 메트릭/마스크가 읽는 태그를 기존 config에서 유도(~105개,
  중복정의 없음) — 유량 .PV/.QV, 진공, 민감단 TC, 하부루프 .PV/.SP/.OP.
- Report:Historian config(Enabled/IntervalSeconds/RetentionDays).

검증: 라이브 초당 ~38행 append, 샘플 간격 ~1.004s, 보존/압축 정책 활성.
주의(데모): realtime 폴링이 areas 61/62/81만 커버 → 1s 버퍼도 해당 컬럼만(배포 시 전 컨트롤러).
1s 버퍼 주 가치는 .PV/.OP 동특성; .QV 적산은 60s로도 정확.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-15 04:56:15 +09:00
windpacer
37a464ab96 feat(report): P0 셀프서비스 결정론 리포트 — 메트릭 3종·엑셀 토큰 채움·fastRecord 소스
운전원이 올린 엑셀 템플릿의 {{ metric=...; column=... }} 토큰을, 선택한 날짜의
결정론 계산값으로 채워 다운로드하는 셀프서비스 리포트 레이어(P0).

- 메트릭 3종: energy_efficiency·yield·control_residual (분 버킷 피벗, 클린필터,
  KST→UTC 경계). history_table(60s)·fast_record(s/min) 동일 long 포맷이라 source만 교체.
- 컬럼→태그 매핑은 기존 appsettings SteamAdvisor:Columns 재사용(7컬럼 무료).
- EPPlus 토큰 치환 + 셀 주석에 해상도 메타(source/sampling/n/keep) 부착.
- report_template/report_run 테이블 + cells_json 감사 박제.
- 리포트 탭(웹 UI) + 샘플 템플릿.

검증: 빌드 0에러. E2E 라운드트립 실동작(2026-05-15 C-6111 효율 0.778·수율 0.872·
잔차 mean 0.746 — 오프라인 검증값과 일치). 결정론 검증 게이트 준수(표본0=N/A, 0 날조 금지).

⚠️ EPPlus는 NonCommercial 컨텍스트 — 상용 출시 전 라이선스 정리 필요.

설계: docs/작업플랜-셀프서비스-분석리포트-MVP-P0-상세설계.md

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-13 00:14:35 +09:00