feat: 优化transfer_mpoint_val_to_ep_running_state
This commit is contained in:
parent
02d672a39d
commit
85bbdd6cd9
|
@ -46,14 +46,13 @@ def transfer_mpoint_val_to_ep_running_state(current_val, base_val: float, expr_s
|
||||||
matches = re.findall(pattern, expr_str)
|
matches = re.findall(pattern, expr_str)
|
||||||
for match in matches:
|
for match in matches:
|
||||||
if match == "self":
|
if match == "self":
|
||||||
expr_str = expr_str.replace(f"${{{match}}}", str(current_val))
|
expr_str = expr_str.replace("{self}", str(current_val))
|
||||||
else:
|
else:
|
||||||
|
match_val = 50
|
||||||
mpoint_data = MpointCache(match).data
|
mpoint_data = MpointCache(match).data
|
||||||
if mpoint_data:
|
if mpoint_data and mpoint_data.get("gather_state", -2) == 0: # 测点正常采集
|
||||||
match_val = 50
|
match_val = mpoint_data["last_data"]["last_mrs"]
|
||||||
if mpoint_data.get("gather_state", -2) == 0: # 测点正常采集
|
expr_str = expr_str.replace(f"{{{match}}}", str(match_val))
|
||||||
match_val = mpoint_data["last_data"]["last_mrs"]
|
|
||||||
expr_str = expr_str.replace(f"{{{match}}}", str(match_val))
|
|
||||||
rval = eval(expr_str)
|
rval = eval(expr_str)
|
||||||
return rval
|
return rval
|
||||||
if isinstance(current_val, bool):
|
if isinstance(current_val, bool):
|
||||||
|
|
Loading…
Reference in New Issue