完善流量控制前馈、稳态判定与阀门标定流程

- 前馈冻结改用可配置的 3 秒流量绝对误差滑窗,修复采样抖动造成的重复解冻,并保留下游扰动后的自动更新
- 支持非单调阀特性反解、最小可测面积以下直接全关,以及闭阀端精细扫点与辨识开关
- 调整双压力判稳、最长等待时间、在线入口全开收尾和闭环四联图
- 更新配置、README、阀模型及离线测试,归档本轮实验数据与诊断产物
This commit is contained in:
2026-09-02 16:14:42 +08:00
parent 5888b4ccce
commit cfeedcf887
80 changed files with 40473 additions and 171 deletions
+13 -5
View File
@@ -117,13 +117,13 @@ def load_steady_points(csv_path, tail=DEFAULT_TAIL):
return points
def compute_area_table(steady_points):
"""把稳态点换算成 (x, A_eff) 单调表,并返回逐点测量值供诊断图着色。
def compute_area_table(steady_points, check_monotonic=True):
"""把稳态点换算成 (x, A_eff) 表,并返回逐点测量值供诊断图着色。
返回 ``(table, dropped, stats, area_points)``
- ``area_points``:每个实测点的 ``(x, A_eff, direction)``,按 x 升序,未平均;
- ``table``:同一行程 x 的多个 A_eff 先平均,再按 x 升序取最长单调连续段;
- ``table``:同一行程 x 的多个 A_eff 先平均;启用检查时再取最长单调连续段;
- ``dropped``:因非单调被丢弃的 ``(x, A_eff)``
- ``stats``:阻塞/亚声速点统计(按原始测量点计数)。
"""
@@ -155,7 +155,7 @@ def compute_area_table(steady_points):
merged = [(float(x), sum(vals) / len(vals)) for x, vals in sorted(by_x.items())]
ys = [a for _, a in merged]
if _is_monotonic(ys):
if not check_monotonic or _is_monotonic(ys):
table = merged
dropped = []
else:
@@ -215,7 +215,11 @@ def identify(csv_paths, tail=DEFAULT_TAIL, out_path=None):
steady = []
for path in csv_paths:
steady.extend(load_steady_points(path, tail))
table, dropped, stats, area_points = compute_area_table(steady)
check_monotonic = config.IDENTIFY_VALVE_MONOTONIC_CHECK_ENABLED
table, dropped, stats, area_points = compute_area_table(
steady,
check_monotonic=check_monotonic,
)
if len(table) < 2:
raise ValueError(
f"有效稳态点不足({len(table)} 个),无法构表。请确认 CSV 为 "
@@ -227,6 +231,7 @@ def identify(csv_paths, tail=DEFAULT_TAIL, out_path=None):
table,
config.MOTOR_OPEN_POSITION,
config.MOTOR_CLOSED_POSITION,
enforce_monotonic=check_monotonic,
)
if out_path:
model.save(out_path)
@@ -390,6 +395,9 @@ def main(argv=None):
f"{len(table)} 点,同一行程已平均)。"
)
if not config.IDENTIFY_VALVE_MONOTONIC_CHECK_ENABLED:
print("提示:单调性检查已关闭,所有按行程平均后的点均被保留。")
if dropped:
print(
"警告:A_eff(x) 非单调,以下点被丢弃"