feat(#55): Ti 行业布局模板(四状态流程视图)+ layout_validator

纯标准库实现,对齐 PRD 5.5「⑤ 配置化驾驶舱」iAOP-cockpit-layout-v1:

- cockpit.ti.yaml:海绵钛四状态工艺流程(氯化→精制→还原→蒸馏),
  process_view 主视图声明 stages 覆盖,trend/kpi_card bind 对齐
  point_dict.default.csv 的 point_id(CLF-01/RF-01/E-01/ST-01)。
- layout_validator.py:LayoutValidator 校验 widget 类型合法、12 列网格
  不越界、bind point_id 在点位字典内、四状态覆盖完整(order 单调/id 唯一);
  零依赖 YAML 子集解析(复制 impurity-forecast _parse_yaml_subset)。
- tests:18 用例覆盖真实资产端到端、非法类型、网格越界/负坐标/零宽、
  bind 漂移、缺 process_view、缺必需状态、order 非单调、stage 重复、
  $schema 头、CSV 加载、空布局。
- _sanity_check.py:冒烟验证 9 widgets 全校验通过。
This commit is contained in:
2026-08-05 05:28:20 +08:00
parent 4457b53170
commit 94c2782e75
7 changed files with 1025 additions and 0 deletions
+108
View File
@@ -0,0 +1,108 @@
# -*- coding: utf-8 -*-
# 海绵钛(Ti)车间驾驶舱布局资产(iAOP-Template-Ti,EPIC #12)。
#
# 对齐 PRD 5.5「⑤ 配置化驾驶舱」布局 JSON Schema(iAOP-cockpit-layout-v1):
# 切换行业模板后,驾驶舱按本布局自动重排,无需改前端代码。
# widget 类型:process_view(工艺流程视图)/ trend(实时趋势)/ kpi_card(KPI卡片)/
# alarm_panel(告警面板)/ nl_query(NL查询入口)。
#
# 四状态工艺流程(PRD 4.2 海绵钛:氯化 → 精制 → 还原 → 蒸馏):
# - 氯化 (CLF-01):TiO₂ + Cl₂ + C → TiCl₄(沸腾氯化炉)
# - 精制 :粗 TiCl₄ → 精 TiCl₄(除钒/除硅,常压精馏)
# - 还原 (RF-01):TiCl₄ + Mg → 海绵钛(真空还原,Kroll 法)
# - 蒸馏 :海绵钛 + 残余 Mg/MgCl₂ 分离(真空蒸馏)
# process_view 的 stages 字段声明四状态覆盖,layout_validator 校验完整性。
#
# bind 的 point_id 对齐 templates/ti-cl4/point-dict/point_dict.default.csv。
$schema: iAOP-cockpit-layout-v1
title: 海绵钛车间驾驶舱
theme: dark
widgets:
# ---- 四状态工艺流程主视图(首屏立即加载) ---------------------------
- type: process_view
src: ti_four_state.svg
x: 0
y: 0
w: 12
h: 4
description: 四状态工艺流程(氯化 → 精制 → 还原 → 蒸馏)
stages:
- id: chlorination
name: 氯化
device: CLF-01
order: 1
- id: purification
name: 精制
order: 2
- id: reduction
name: 还原
device: RF-01
order: 3
- id: distillation
name: 蒸馏
order: 4
# ---- 实时趋势:氯化炉温度/氯气流量(工艺核心监控) -------------------
- type: trend
bind: CLF-01.TEMP
x: 0
y: 4
w: 6
h: 2
description: 氯化炉温度实时趋势(沸腾氯化炉温 850±50℃)
- type: trend
bind: CLF-01.CL2
x: 6
y: 4
w: 6
h: 2
description: 氯气流量实时趋势(流态化监控)
# ---- KPI 卡片:还原质量/能耗(海绵钛核心指标) -----------------------
- type: kpi_card
metric: ticl4_purity
bind: RF-01.PURITY
label: TiCl₄纯度
x: 0
y: 6
w: 3
h: 2
description: 还原 TiCl₄ 纯度(%,工艺 ≥ 99.9%)
- type: kpi_card
metric: ticl4_impurity
bind: RF-01.IMP
label: 杂质含量
x: 3
y: 6
w: 3
h: 2
description: 还原杂质含量(%,越低越好)
- type: kpi_card
metric: energy_per_ton
bind: E-01.KWH
label: 累计电耗
x: 6
y: 6
w: 3
h: 2
description: 车间累计电耗(kWh,单吨海绵钛综合能耗输入)
- type: kpi_card
metric: steam_flow
bind: ST-01.STEAM
label: 蒸汽流量
x: 9
y: 6
w: 3
h: 2
description: 蒸汽流量(t/h,公用工程监控)
# ---- 告警面板 + NL 查询入口 ------------------------------------------
- type: alarm_panel
x: 0
y: 8
w: 9
h: 3
description: 告警面板(氯化炉温/还原真空度/纯度/杂质异常)
- type: nl_query
x: 9
y: 8
w: 3
h: 3
description: 自然语言查询入口(工艺/质量/能耗问答)