feat:enm/service 修改translate_eval_formula

This commit is contained in:
zty 2025-01-17 16:08:27 +08:00
parent 805d4ac4fe
commit cd652f3696
1 changed files with 2 additions and 1 deletions

View File

@ -42,11 +42,12 @@ def translate_eval_formula(exp_str: str, year: int, month: int, day: int, hour:
# exp_str2 = exp_str2.replace(f"{{{match}}}", str(mpst.val))
# 为了校正计算测点
exp_str2 = exp_str2.replace(f"{{{match}}}", str(mpst.val if mpst.val_correct is None else mpst.val_correct))
rval = 0
try:
rval = eval(exp_str2)
except Exception as e:
myLogger.error(f"表达式计算错误: {e}, {exp_str}, --{exp_str2}")
rval = 0
return rval
def transfer_mpoint_val_to_ep_running_state(current_val, base_val: float, expr_str: str):