[modify] skip when data is invalid
This commit is contained in:
parent
fd553b3442
commit
cad7792fa1
@ -169,14 +169,14 @@ def single_file_process(data_file, wb_result, count, av, rr, axis, vel, trq, w2t
|
||||
result_sheet_name = find_result_sheet_name(conditions, count)
|
||||
ws_result = wb_result[result_sheet_name]
|
||||
|
||||
row_max, row_start = find_row_start(data_file, df, conditions, av, rr, axis, vel, w2t, rpm)
|
||||
row_max, row_start, flag = find_row_start(data_file, df, conditions, av, rr, axis, vel, w2t, rpm)
|
||||
|
||||
copy_data_to_result(df, ws_result, row_max, row_start, vel, trq, rpm)
|
||||
copy_data_to_result(flag, df, ws_result, row_max, row_start, vel, trq, rpm)
|
||||
ws_result["C2"] = int(2)
|
||||
ws_result["G2"] = int(10+4)
|
||||
|
||||
|
||||
def copy_data_to_result(df, ws_result, row_max, row_start, vel, trq, rpm):
|
||||
def copy_data_to_result(flag, df, ws_result, row_max, row_start, vel, trq, rpm):
|
||||
# 功能:将数据文件中有效数据拷贝至结果文件对应的 sheet
|
||||
# 参数:如上
|
||||
# 返回值:-
|
||||
@ -185,6 +185,7 @@ def copy_data_to_result(df, ws_result, row_max, row_start, vel, trq, rpm):
|
||||
for cell in row:
|
||||
cell.value = None
|
||||
|
||||
if flag == 1:
|
||||
# 将合适的数据复制到结果文件
|
||||
row_max = row_start + 399 if row_max-row_start > 400 else row_max
|
||||
rc = 1 if rpm == 1 else 1000
|
||||
@ -199,6 +200,8 @@ def copy_data_to_result(df, ws_result, row_max, row_start, vel, trq, rpm):
|
||||
for cell in row:
|
||||
cell.value = data[i]
|
||||
i = i + 1
|
||||
else:
|
||||
pass
|
||||
|
||||
|
||||
def find_result_sheet_name(conditions, count):
|
||||
@ -235,14 +238,16 @@ def find_row_start(data_file, df, conditions, av, rr, axis, vel, w2t, rpm):
|
||||
|
||||
if abs(speed_avg-speed_max) < threshold:
|
||||
row_start = row_start - 10
|
||||
flag = 1
|
||||
break
|
||||
else:
|
||||
row_start -= step
|
||||
else:
|
||||
msg = f"可能是{data_file}这个文件数据采集有问题,比如未采集理论速度值,也有可能是程序步长设定问题,请检查......"
|
||||
w2t(msg)
|
||||
flag = 0
|
||||
|
||||
return row_max, row_start
|
||||
return row_max, row_start, flag
|
||||
|
||||
|
||||
def get_threshold_step(excel_file, axis):
|
||||
|
Loading…
x
Reference in New Issue
Block a user