v0.4.0.7 interpreter improvement

This commit is contained in:
2025-05-29 16:15:14 +08:00
parent 66df4edbed
commit eb2463b943
9 changed files with 80 additions and 334 deletions

View File

@ -17,18 +17,17 @@ class DoCurrentTest(QThread):
def initialization(self, data_dirs, data_files):
def check_files():
msg = "初始路径下不允许有文件夹,初始路径下只能存在如下三个文件,且文件为关闭状态,确认后重新运行!<br>"
msg += "1. T_电机电流.xlsx<br>2. configs.xlsx<br>3. xxxx.zip"
if len(data_dirs) != 0 or len(data_files) != 3:
msg = "初始路径下不允许有文件夹,初始路径下只能存在如下三个文件,且文件为关闭状态,确认后重新运行!<br>"
msg += "1. T_电机电流.xlsx<br>2. configs.xlsx(可选:测试单一场景时需要)<br>3. xxxx.zip"
if not (len(data_dirs) == 0 and (len(data_files) == 3 or len(data_files) == 2)):
clibs.logger("ERROR", "do_current", msg, "red")
prj_file, count = None, 0
prj_file, count, config_file = None, 0, ""
for data_file in data_files:
filename = data_file.split("/")[-1]
if filename == "T_电机电流.xlsx":
count += 1
elif filename == "configs.xlsx":
count += 1
config_file = data_file
elif filename.endswith(".zip"):
count += 1
@ -36,7 +35,7 @@ class DoCurrentTest(QThread):
else:
clibs.logger("ERROR", "do_current", msg, "red")
if count != 3:
if count != 2:
clibs.logger("ERROR", "do_current", msg, "red")
if self.tool == "tool100":
@ -162,35 +161,39 @@ class DoCurrentTest(QThread):
clibs.c_hr.execution("diagnosis.set_params", display_pdo_params=display_pdo_params)
def run_rl(self, prj_file, config_file):
wb = openpyxl.load_workbook(config_file, read_only=True)
ws = wb["Target"]
try:
single_current = int(str(ws.cell(row=6, column=2).value).strip())
except:
if config_file != "":
wb = openpyxl.load_workbook(config_file, read_only=True)
ws = wb["Target"]
try:
single_current = int(str(ws.cell(row=6, column=2).value).strip())
except:
single_current = -1
wb.close()
else:
single_current = -1
wb.close()
prj_name = ".".join(prj_file.split("/")[-1].split(".")[:-1])
c_regular = [
"scenario(0, j1_p, j1_n, p_speed, p_tool, i_tool)",
"scenario(0, j2_p, j2_n, p_speed, p_tool, i_tool)",
"scenario(0, j3_p, j3_n, p_speed, p_tool, i_tool)",
"scenario(0, j4_p, j4_n, p_speed, p_tool, i_tool)",
"scenario(0, j5_p, j5_n, p_speed, p_tool, i_tool)",
"scenario(0, j6_p, j6_n, p_speed, p_tool, i_tool)",
"scenario(4, j1_hold, j1_hold, p_speed, p_tool, i_tool)",
"scenario(4, j2_hold, j2_hold, p_speed, p_tool, i_tool)",
"scenario(4, j3_hold, j3_hold, p_speed, p_tool, i_tool)",
"scenario(4, j4_hold, j4_hold, p_speed, p_tool, i_tool)",
"scenario(4, j5_hold, j5_hold, p_speed, p_tool, i_tool)",
"scenario(4, j6_hold, j6_hold, p_speed, p_tool, i_tool)",
"scenario(1, j6_p, j6_n, p_speed, p_tool, i_tool)",
"scenario(2, j6_p, j6_n, p_speed, p_tool, i_tool)",
"scenario(3, j6_p, j6_n, p_speed, p_tool, i_tool)",
"scenario(0, j1_p, j1_n, p_speed, p_tool, i_tool);",
"scenario(0, j2_p, j2_n, p_speed, p_tool, i_tool);",
"scenario(0, j3_p, j3_n, p_speed, p_tool, i_tool);",
"scenario(0, j4_p, j4_n, p_speed, p_tool, i_tool);",
"scenario(0, j5_p, j5_n, p_speed, p_tool, i_tool);",
"scenario(0, j6_p, j6_n, p_speed, p_tool, i_tool);",
"scenario(4, j1_hold, j1_hold, p_speed, p_tool, i_tool);",
"scenario(4, j2_hold, j2_hold, p_speed, p_tool, i_tool);",
"scenario(4, j3_hold, j3_hold, p_speed, p_tool, i_tool);",
"scenario(4, j4_hold, j4_hold, p_speed, p_tool, i_tool);",
"scenario(4, j5_hold, j5_hold, p_speed, p_tool, i_tool);",
"scenario(4, j6_hold, j6_hold, p_speed, p_tool, i_tool);",
"scenario(1, j6_p, j6_n, p_speed, p_tool, i_tool);",
"scenario(2, j6_p, j6_n, p_speed, p_tool, i_tool);",
"scenario(3, j6_p, j6_n, p_speed, p_tool, i_tool);",
]
c_inertia = [
"scenario(5, j4_p_inertia, j4_n_inertia, p_speed, p_tool, i_tool)",
"scenario(5, j5_p_inertia, j5_n_inertia, p_speed, p_tool, i_tool)",
"scenario(5, j6_p_inertia, j6_n_inertia, p_speed, p_tool, i_tool)",
"scenario(5, j4_p_inertia, j4_n_inertia, p_speed, p_tool, i_tool);",
"scenario(5, j5_p_inertia, j5_n_inertia, p_speed, p_tool, i_tool);",
"scenario(5, j6_p_inertia, j6_n_inertia, p_speed, p_tool, i_tool);",
]
disc_regular = ["一轴", "二轴", "三轴", "四轴", "五轴", "六轴", "一轴保持", "二轴保持", "三轴保持", "四轴保持", "五轴保持", "六轴保持", "场景一", "场景二", "场景三"]
disc_inertia = ["四轴惯量", "五轴惯量", "六轴惯量"]