5. 重新在write2textbox中添加exitcode参数,并补齐相关逻辑和修改brake中的调用方式

6. 修复参数检查无效的情况
7. 屏蔽电流相关的功能
This commit is contained in:
2024-05-30 17:12:43 +08:00
parent b04b9e9205
commit 06e5111309
3 changed files with 29 additions and 18 deletions

View File

@@ -89,7 +89,7 @@ def check_files(raw_data_dirs, result_files, w2t):
msg = "结果文件数目错误,结果文件有且只有三个,请确认!"
for result_file in result_files:
w2t(result_file)
w2t(msg)
w2t(msg, 0, 2)
prefix = []
for result_file in result_files:
@@ -102,7 +102,7 @@ def check_files(raw_data_dirs, result_files, w2t):
1. load33_自研_制动性能测试.xlsx
2. load66_自研_制动性能测试.xlsx
3. load100_自研_制动性能测试.xlsx"""
w2t(msg)
w2t(msg, 0, 3)
for raw_data_dir in raw_data_dirs:
components = raw_data_dir.split('\\')[-1].split('_')
@@ -114,16 +114,16 @@ def check_files(raw_data_dirs, result_files, w2t):
f"命名规则:\n 1. loadAA_speedBB_reachCC\n 2. loadAA_reachBB_speedCC\n" \
f"规则解释AA/BB/CC 指的是负载/速度/臂展的比例\n" \
f"load66_speed100_reach3366% 负载100% 速度以及 33% 臂展情况下的测试结果文件夹"
w2t(msg)
w2t(msg, 0, 4)
_, raw_data_files = traversal_files(raw_data_dir, w2t)
if len(raw_data_files) != 3:
msg = f"数据目录 {raw_data_dir} 下数据文件个数错误,每个数据目录下有且只能有三个以 .data 为后缀的数据文件"
w2t(msg)
w2t(msg, 0, 5)
for raw_data_file in raw_data_files:
if not (raw_data_file.split('\\')[-1].endswith('.data') or raw_data_file.split('\\')[-1].endswith('.csv')):
msg = f"数据文件 {raw_data_file} 后缀错误,每个数据目录下有且只能有三个以 .data/csv 为后缀的数据文件"
w2t(msg)
w2t(msg, 0, 6)
w2t("数据目录合规性检查结束,未发现问题......")
@@ -273,7 +273,7 @@ def traversal_files(path, w2t):
# 返回值:路径下的文件夹列表 路径下的文件列表
if not exists(path):
msg = f'数据文件夹{path}不存在,请确认后重试......'
w2t(msg)
w2t(msg, 0, 1)
else:
dirs = []
files = []
@@ -291,16 +291,15 @@ def main(path, av, rr, rpm, axis, vel, trq, w2t):
# 参数initialization函数的返回值
# 返回值:-
time_start = time()
raw_data_dirs, result_files = traversal_files(path, w2t)
check_files(raw_data_dirs, result_files, w2t)
prefix = []
for raw_data_dir in raw_data_dirs:
prefix.append(raw_data_dir.split('\\')[-1].split("_")[0])
try:
# threads = []
check_files(raw_data_dirs, result_files, w2t)
for result_file in result_files:
if result_file.split('\\')[-1].split('_')[0] not in set(prefix):
continue
@@ -318,7 +317,7 @@ def main(path, av, rr, rpm, axis, vel, trq, w2t):
w2t("全部处理完毕")
time_end = time()
time_total = time_end - time_start
msg = f"数据处理时间:{time_total // 3600:02.0f} h {time_total % 3600 // 60:02.0f} min {time_total % 60:02.0f} s"
msg = f"数据处理时间:{time_total // 3600:02.0f} h {time_total % 3600 // 60:02.0f} m {time_total % 60:02.0f} s"
w2t(msg)