@ -28,16 +28,16 @@ def initialization(path, sub, w2t):
filename = data_file . split ( ' \\ ' ) [ - 1 ]
if data_file . endswith ( ' configs.xlsx ' ) :
count + = 1
elif sub == ' cycle ' and data_file . endswith ( ' .xlsx ' ) :
elif sub == ' cycle ' and data_file . endswith ( ' T_电机电流 .xlsx' ) :
count + = 1
else :
if not ( match ( ' j[1-7].* \\ .data ' , filename ) or match ( ' j[1-7].* \\ .csv ' , filename ) ) :
msg = f " 不合规 { data_file } \n "
msg + = f " 所有文件必须以 jx_ 开头,以 .data/csv 结尾( x取值1-7) , 请检查后重新运行。 "
msg + = f " 所有数据 文件必须以 jx_ 开头,以 .data/csv 结尾( x取值1-7) , 配置文件需要命名为 \" configs.xlsx \" ,结果文件需要命名为 \" T_电机电流.xlsx \" , 请检查后重新运行。 "
w2t ( msg , 0 , 6 , ' red ' )
if not ( ( sub == ' cycle ' and count == 2 ) or ( sub != ' cycle ' and count == 1 ) ) :
w2t ( " 使用max/avg功能时, 需要有配置文件表格; 使用cycle功能时, 需要有电机电流数据处理和配置文件 两个表格,确认后重新运行! " , 0 , 5 , ' red ' )
w2t ( " 使用max/avg功能时, 需要有配置文件表格\" configs.xlsx \" ; 使用cycle功能时, 需要有电机电流数据处理\" T_电机电流.xlsx \" 和配置文件 \" configs.xlsx \" 两个表格,确认后重新运行! " , 0 , 5 , ' red ' )
return data_files
@ -186,7 +186,8 @@ def find_point(data_file, pos, flag, df, _row_s, _row_e, w2t, exitcode, threshol
else :
return _row_s , _row_e
else :
w2t ( f " [ { pos } ] { data_file} 数据有误,需要检查,无法找到第{ exitcode} 个有效点..." , 0 , exitcode , ' red ' )
# w2t(f"[{pos}] { data_file} 数据有误,需要检查,无法找到第{ exitcode} 个有效点...", 0, exitcode, 'red' )
w2t ( f " [ { pos } ] { data_file } 数据有误,需要检查,无法找到第 { exitcode } 个有效点... " , 0 , 0 , ' red ' )
elif flag == ' gt ' :
while _row_e > end_point :
speed_avg = df . iloc [ _row_s : _row_e , 0 ] . abs ( ) . mean ( )
@ -197,7 +198,8 @@ def find_point(data_file, pos, flag, df, _row_s, _row_e, w2t, exitcode, threshol
else :
return _row_s , _row_e
else :
w2t ( f " [ { pos } ] { data_file} 数据有误,需要检查,无法找到有效起始点或结束点..." , 0 , exitcode , ' red ' )
# w2t(f"[{pos}] { data_file} 数据有误,需要检查,无法找到有效起始点或结束点...", 0, exitcode, 'red' )
w2t ( f " [ { pos } ] { data_file } 数据有误,需要检查,无法找到有效起始点或结束点... " , 0 , 0 , ' red ' )
def p_single ( wb , single , vel , trq , rpms , rrs , w2t ) :