feat:enm/service 修改translate_eval_formula
This commit is contained in:
parent
805d4ac4fe
commit
cd652f3696
|
@ -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))
|
||||||
# 为了校正计算测点
|
# 为了校正计算测点
|
||||||
exp_str2 = exp_str2.replace(f"{{{match}}}", str(mpst.val if mpst.val_correct is None else mpst.val_correct))
|
exp_str2 = exp_str2.replace(f"{{{match}}}", str(mpst.val if mpst.val_correct is None else mpst.val_correct))
|
||||||
|
rval = 0
|
||||||
try:
|
try:
|
||||||
rval = eval(exp_str2)
|
rval = eval(exp_str2)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
myLogger.error(f"表达式计算错误: {e}, {exp_str}, --{exp_str2}")
|
myLogger.error(f"表达式计算错误: {e}, {exp_str}, --{exp_str2}")
|
||||||
|
rval = 0
|
||||||
return rval
|
return rval
|
||||||
|
|
||||||
def transfer_mpoint_val_to_ep_running_state(current_val, base_val: float, expr_str: str):
|
def transfer_mpoint_val_to_ep_running_state(current_val, base_val: float, expr_str: str):
|
||||||
|
|
Loading…
Reference in New Issue