浏览代码

标签手册:删除1.1/1.3/1.5统计小节,保留机组、阶段和总体演化

18922397810 4 小时之前
父节点
当前提交
b9b9fcd18c
共有 2 个文件被更改,包括 4 次插入 和 62 次删除
  1. 4 62
      build_tag_manual.py
  2. 二进制
      总结文档/组态数据高质量演化过程故障标签手册.docx

+ 4 - 62
build_tag_manual.py

@@ -431,22 +431,14 @@ def add_summary(doc: Document, labels: list[dict]) -> None:
     body_paragraph(
         doc,
         f"本手册共收录 {len(labels)} 条演化标签,覆盖润滑油压力故障和振动故障两类,"
-        "按机组、阶段和周期编号统计如下。",
+        "按机组和阶段统计如下。",
     )
 
     kind_counts = Counter(label["kindLabel"] for label in labels)
     device_kind = Counter((label["device"], label["kindLabel"]) for label in labels)
-    stage_kind = Counter((label["stage"], label["kindLabel"]) for label in labels)
     device_stage = Counter((label["device"], label["stage"]) for label in labels)
 
-    doc.add_heading("1.1 按类型统计", level=2)
-    rows = [
-        [name, str(kind_counts.get(name, 0)), f"{kind_counts.get(name, 0) / len(labels) * 100:.1f}%"]
-        for name in ("润滑油压力", "振动")
-    ]
-    add_table(doc, ["类型", "数量", "占比"], rows, [7.0, 5.0, 5.0], align_center=True)
-
-    doc.add_heading("1.2 按机组统计", level=2)
+    doc.add_heading("1.1 按机组统计", level=2)
     rows = []
     for device in ("7号机", "8号机", "9号机"):
         pressure = device_kind.get((device, "润滑油压力"), 0)
@@ -460,21 +452,7 @@ def add_summary(doc: Document, labels: list[dict]) -> None:
     ])
     add_table(doc, ["机组", "润滑油压力", "振动", "合计"], rows, [6.0, 6.0, 6.0, 6.0], align_center=True)
 
-    doc.add_heading("1.3 按阶段统计", level=2)
-    rows = []
-    for stage in ("轻微", "异常", "严重异常"):
-        pressure = stage_kind.get((stage, "润滑油压力"), 0)
-        vibration = stage_kind.get((stage, "振动"), 0)
-        rows.append([stage, str(pressure), str(vibration), str(pressure + vibration)])
-    rows.append([
-        "合计",
-        str(kind_counts.get("润滑油压力", 0)),
-        str(kind_counts.get("振动", 0)),
-        str(len(labels)),
-    ])
-    add_table(doc, ["阶段", "润滑油压力", "振动", "合计"], rows, [6.0, 6.0, 6.0, 6.0], align_center=True)
-
-    doc.add_heading("1.4 按机组和阶段统计", level=2)
+    doc.add_heading("1.2 按机组和阶段统计", level=2)
     rows = []
     for device in ("7号机", "8号机", "9号机"):
         values = [device_stage.get((device, stage), 0) for stage in ("轻微", "异常", "严重异常")]
@@ -493,43 +471,7 @@ def add_summary(doc: Document, labels: list[dict]) -> None:
         align_center=True,
     )
 
-    doc.add_heading("1.5 按周期编号统计", level=2)
-    grouped: dict[tuple, list[dict]] = defaultdict(list)
-    for label in labels:
-        grouped[(label["device"], label["kind"], cycle_name(label))].append(label)
-    rows = []
-    for (device, kind, cycle), items in sorted(
-        grouped.items(),
-        key=lambda item: (
-            DEVICE_ORDER.get(item[0][0], 99),
-            KIND_ORDER.get(item[0][1], 9),
-            item[0][2],
-        ),
-    ):
-        stages = Counter(item["stage"] for item in items)
-        starts = min(item["start"] for item in items)
-        ends = max(item["end"] for item in items)
-        rows.append([
-            device,
-            KIND_LABEL.get(kind, kind),
-            cycle,
-            str(stages.get("轻微", 0)),
-            str(stages.get("异常", 0)),
-            str(stages.get("严重异常", 0)),
-            str(len(items)),
-            starts[:16],
-            ends[:16],
-        ])
-    add_table(
-        doc,
-        ["机组", "类型", "周期编号", "轻微", "异常", "严重异常", "合计", "起始", "结束"],
-        rows,
-        [2.2, 2.4, 3.0, 1.4, 1.4, 1.8, 1.4, 4.8, 4.8],
-        font_size=8.0,
-        align_center=True,
-    )
-
-    doc.add_heading("1.6 总体演化过程", level=2)
+    doc.add_heading("1.3 总体演化过程", level=2)
     pressure = kind_counts.get("润滑油压力", 0)
     vibration = kind_counts.get("振动", 0)
     slight = total_stage.get("轻微", 0)

二进制
总结文档/组态数据高质量演化过程故障标签手册.docx