w2tgit add .!

This commit is contained in:
2025-01-22 16:40:29 +08:00
parent 92bdf133f2
commit 6b6fa1ec71
11 changed files with 23 additions and 22 deletions

View File

@ -69,7 +69,7 @@ def get_configs(config_file, w2t):
p_dir = config_file.split('/')[-2]
if not re.match("^[jJ][123]$", p_dir):
w2t("被处理的根文件夹命名必须是 [Jj][123] 的格式", "red", "DirNameError")
w2t("被处理的根文件夹命名必须是 [Jj][123] 的格式\n", "red", "DirNameError")
axis = int(p_dir[-1])
rrs = [abs(_) for _ in configs["TRANSMISSION"]["REDUCTION_RATIO_NUMERATOR"]] # 减速比rr for reduction ratio

View File

@ -64,11 +64,11 @@ def current_max(data_files, rts, trq, w2t, insert_logdb):
if not cur:
continue
else:
w2t(f"{axis}轴数据:")
w2t(f"{axis}最大转矩数据:")
for value in cur:
w2t(f"{value:.4f} ")
w2t("\n")
w2t("\n【MAX】数据处理完毕......")
w2t("\n【MAX】最大转矩数据处理完毕......\n")
insert_logdb("INFO", "current", f"MAX: 获取最大转矩值结束 current_max = {current}")
return current
@ -106,11 +106,11 @@ def current_avg(data_files, rts, trqh, w2t, insert_logdb):
if not cur:
continue
else:
w2t(f"{axis}轴数据:")
w2t(f"{axis}平均转矩数据:")
for value in cur:
w2t(f"{value:.4f} ")
w2t("\n")
w2t("\n【AVG】数据处理完毕......\n")
w2t("\n【AVG】平均转矩数据处理完毕......\n")
insert_logdb("INFO", "current", f"AVG: 获取平均转矩值结束 current_avg = {current}")
return current
@ -176,7 +176,7 @@ def find_point(data_file, df, flag, row_s, row_e, threshold, step, end_point, sk
insert_logdb("WARNING", "current", f"【lt】{axis} 轴第 {seq} 次查找数据可能有异常row_s = {row_s}, row_e = {row_e}")
return row_s, row_e
else:
w2t(f"{data_file} 数据有误,需要检查,无法找到第 {seq} 个有效点...", "red", "AnchorNotFound")
w2t(f"{data_file} 数据有误,需要检查,无法找到第 {seq} 个有效点...\n", "red", "AnchorNotFound")
elif flag == "gt":
while row_e > end_point:
speed_avg = df.iloc[row_s:row_e].abs().mean()
@ -194,7 +194,7 @@ def find_point(data_file, df, flag, row_s, row_e, threshold, step, end_point, sk
insert_logdb("WARNING", "current", f"【gt】{axis} 轴第 {seq} 次查找数据可能有异常row_s = {row_s}, row_e = {row_e}")
return row_s, row_e
else:
w2t(f"{data_file} 数据有误,需要检查,无法找到第 {seq} 个有效点...", "red", "AnchorNotFound")
w2t(f"{data_file} 数据有误,需要检查,无法找到第 {seq} 个有效点...\n", "red", "AnchorNotFound")
def get_row_number(threshold, flag, df, row_s, row_e, axis, insert_logdb):
@ -345,7 +345,7 @@ def p_scenario(wb, scenario, vel, trq, sensor, rrs, dur_time, w2t):
row_start = 3000
row_end = row_start + int(dur_time/cycle)
if row_end > df.index[-1]:
w2t(f"位置超限:{data_file} 共有 {df.index[-1]} 条数据,无法取到第 {row_end} 条数据,需要确认场景周期时间...", "red", "DataOverLimit")
w2t(f"位置超限:{data_file} 共有 {df.index[-1]} 条数据,无法取到第 {row_end} 条数据,需要确认场景周期时间...\n", "red", "DataOverLimit")
data, first_c, second_c, third_c, fourth_c = [], vel-1, trq-1, sensor-1, sensor
for row in range(row_start, row_end+1):

View File

@ -147,7 +147,7 @@ def main():
ws.cell(row=i, column=7).value = None
except Exception as Err:
clibs.insert_logdb("ERROR", "iso", f"main: 无法打开文件 {filename}")
w2t(f"发生错误:{Err}", "red", "FileOpenError")
w2t(f"发生错误:{Err}\n", "red", "FileOpenError")
p_files = []
for file in files:
@ -172,7 +172,7 @@ def main():
wb.close()
if len(p_files) == 0:
w2t(f"目录 {path} 下没有需要处理的文件,需要确认......", "red")
w2t(f"目录 {path} 下没有需要处理的文件,需要确认......\n", "red")
else:
os.remove(tmpfile)
w2t("------------------------------------------\n")