|
@@ -104,16 +104,15 @@ def generate_plc_instructions(action_spec,current_L_s, current_t_bw_s, model_pre
|
|
|
if model_prev_t_bw_s is not None and not (action_spec.t_bw_min_s <= model_prev_t_bw_s <= action_spec.t_bw_max_s):
|
|
if model_prev_t_bw_s is not None and not (action_spec.t_bw_min_s <= model_prev_t_bw_s <= action_spec.t_bw_max_s):
|
|
|
print(f"警告: 模型上一轮反洗时长 {model_prev_t_bw_s} 秒不在允许范围内 [{action_spec.t_bw_min_s}, {action_spec.t_bw_max_s}]")
|
|
print(f"警告: 模型上一轮反洗时长 {model_prev_t_bw_s} 秒不在允许范围内 [{action_spec.t_bw_min_s}, {action_spec.t_bw_max_s}]")
|
|
|
|
|
|
|
|
- # 模型当前轮决策值检查(错误)
|
|
|
|
|
|
|
+ # 模型当前轮决策值检查
|
|
|
if model_L_s is None:
|
|
if model_L_s is None:
|
|
|
raise ValueError("错误: 决策模型建议的过滤时长不能为None")
|
|
raise ValueError("错误: 决策模型建议的过滤时长不能为None")
|
|
|
- elif not (action_spec.L_min_s <= model_L_s <= action_spec.L_max_s):
|
|
|
|
|
- raise ValueError(f"错误: 决策模型建议的过滤时长 {model_L_s} 秒不在允许范围内 [{action_spec.L_min_s}, {action_spec.L_max_s}]")
|
|
|
|
|
|
|
+ model_L_s = max(action_spec.L_min_s, min(model_L_s, action_spec.L_max_s))
|
|
|
|
|
|
|
|
if model_t_bw_s is None:
|
|
if model_t_bw_s is None:
|
|
|
raise ValueError("错误: 决策模型建议的反洗时长不能为None")
|
|
raise ValueError("错误: 决策模型建议的反洗时长不能为None")
|
|
|
- elif not (action_spec.t_bw_min_s <= model_t_bw_s <= action_spec.t_bw_max_s):
|
|
|
|
|
- raise ValueError(f"错误: 决策模型建议的反洗时长 {model_t_bw_s} 秒不在允许范围内 [{action_spec.t_bw_min_s}, {action_spec.t_bw_max_s}]")
|
|
|
|
|
|
|
+ model_t_bw_s = max(action_spec.t_bw_min_s, min(model_t_bw_s, action_spec.t_bw_max_s))
|
|
|
|
|
+
|
|
|
|
|
|
|
|
print(f"过滤时长基准: {source_L}, 值: {effective_current_L}")
|
|
print(f"过滤时长基准: {source_L}, 值: {effective_current_L}")
|
|
|
print(f"反洗时长基准: {source_t_bw}, 值: {effective_current_t_bw}")
|
|
print(f"反洗时长基准: {source_t_bw}, 值: {effective_current_t_bw}")
|