|
@@ -395,6 +395,28 @@ def _section_power_curve(doc, data: Dict[str, Any]):
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+def _worst_subsystem(t: Dict[str, Any]) -> str:
|
|
|
|
|
+ labels = {
|
|
|
|
|
+ "generator": "发电机系统",
|
|
|
|
|
+ "nacelle": "机舱系统",
|
|
|
|
|
+ "grid": "电网环境",
|
|
|
|
|
+ "drive_train": "传动系统",
|
|
|
|
|
+ }
|
|
|
|
|
+ vals = []
|
|
|
|
|
+ for k, name in labels.items():
|
|
|
|
|
+ v = t.get(k)
|
|
|
|
|
+ try:
|
|
|
|
|
+ v = float(v)
|
|
|
|
|
+ except (TypeError, ValueError):
|
|
|
|
|
+ v = None
|
|
|
|
|
+ if v is not None and v >= 0:
|
|
|
|
|
+ vals.append((v, name))
|
|
|
|
|
+ if not vals:
|
|
|
|
|
+ return "未评估"
|
|
|
|
|
+ vals.sort(key=lambda x: x[0])
|
|
|
|
|
+ return vals[0][1]
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
def _section_conclusion(doc, data: Dict[str, Any]):
|
|
def _section_conclusion(doc, data: Dict[str, Any]):
|
|
|
from app.report import criteria
|
|
from app.report import criteria
|
|
|
|
|
|
|
@@ -410,6 +432,38 @@ def _section_conclusion(doc, data: Dict[str, Any]):
|
|
|
L._heading(doc, "8.2 结论", 2)
|
|
L._heading(doc, "8.2 结论", 2)
|
|
|
for i, c in enumerate(cr["conclusions"], 1):
|
|
for i, c in enumerate(cr["conclusions"], 1):
|
|
|
L._para(doc, f"{i}. {c}", indent=False)
|
|
L._para(doc, f"{i}. {c}", indent=False)
|
|
|
|
|
+
|
|
|
|
|
+ # 重点机组与部件定位
|
|
|
|
|
+ L._para(doc, "重点机组定位:", indent=False, bold=True)
|
|
|
|
|
+ ov = data.get("overview") or {}
|
|
|
|
|
+ h = data.get("health") or {}
|
|
|
|
|
+ f = data.get("fault") or {}
|
|
|
|
|
+ ah = data.get("algorithm_health") or {}
|
|
|
|
|
+
|
|
|
|
|
+ if ov.get("available") and ov.get("turbines"):
|
|
|
|
|
+ low_eff = sorted(ov["turbines"], key=lambda x: x.get("gen_mwh") or 0)[:5]
|
|
|
|
|
+ names = "、".join(
|
|
|
|
|
+ f"{t.get('name') or t.get('code')}({_num(t.get('gen_mwh'), 2, ' MWh')})" for t in low_eff
|
|
|
|
|
+ )
|
|
|
|
|
+ L._para(doc, f"· 能效低机组(发电量排名末 5):{names}。", indent=False, size=10)
|
|
|
|
|
+
|
|
|
|
|
+ if h.get("available") and h.get("low_turbines"):
|
|
|
|
|
+ items = []
|
|
|
|
|
+ for t in h["low_turbines"][:8]:
|
|
|
|
|
+ items.append(f"{t.get('name') or t.get('code')}({_num(t.get('score'), 2, ' 分')},{_worst_subsystem(t)})")
|
|
|
|
|
+ L._para(doc, f"· 健康低分机组(<70 分):{';'.join(items)}。", indent=False, size=10)
|
|
|
|
|
+
|
|
|
|
|
+ if f.get("available") and f.get("turbines"):
|
|
|
|
|
+ ft = sorted(f["turbines"], key=lambda x: x.get("count") or 0, reverse=True)[:8]
|
|
|
|
|
+ names = "、".join(f"{t.get('name') or t.get('code')}({t.get('count', 0)} 次)" for t in ft)
|
|
|
|
|
+ L._para(doc, f"· 故障集中机组:{names}。", indent=False, size=10)
|
|
|
|
|
+
|
|
|
|
|
+ if ah.get("available"):
|
|
|
|
|
+ unscored = [t for t in (ah.get("turbines") or []) if (t.get("overall") or {}).get("status") != "scored"]
|
|
|
|
|
+ if unscored:
|
|
|
|
|
+ names = "、".join(t.get("turbine_name") or t.get("turbine") or "" for t in unscored[:10])
|
|
|
|
|
+ L._para(doc, f"· 算法健康评估未评总分机组:{names}。", indent=False, size=10)
|
|
|
|
|
+
|
|
|
L._heading(doc, "8.3 建议", 2)
|
|
L._heading(doc, "8.3 建议", 2)
|
|
|
for i, s in enumerate(cr["suggestions"], 1):
|
|
for i, s in enumerate(cr["suggestions"], 1):
|
|
|
L._para(doc, f"{i}. {s}", indent=False, size=10)
|
|
L._para(doc, f"{i}. {s}", indent=False, size=10)
|