diff --git a/aio/README.md b/aio/README.md index 47d4631..c367c30 100644 --- a/aio/README.md +++ b/aio/README.md @@ -473,5 +473,9 @@ v0.1.9.2(2024/07/13) - 调整单轴测试时间为35s,适配大负载机型,调整堵转电流持续时间15s,适当减少测试时间 - 将act信号置为False的动作放在初始化,增加程序健壮性 - 修改所有输出文件的命名,在扩展名之前加入时间戳 -3. [current: current.py]: 在find_point函数种,当无法找到正确点位时,继续执行,而不是直接终止执行 + - 删除多余的时序矫正语句——item['value'].reverse(),使输出的曲线为平滑的自然顺序 +3. [current: current.py] + - 在find_point函数种,当无法找到正确点位时,继续执行,而不是直接终止执行 + - max功能计算逻辑矫正,应该是取绝对值的最大值 + - 整体梳理了trq/trqh的传递路径,现已修正完毕 diff --git a/aio/code/automatic_test/do_current.py b/aio/code/automatic_test/do_current.py index 583f7ae..245fe0f 100644 --- a/aio/code/automatic_test/do_current.py +++ b/aio/code/automatic_test/do_current.py @@ -120,10 +120,8 @@ def data_proc_regular(path, filename, channel, scenario_time): for item in data: item['value'].reverse() if item.get('channel', None) == channel and item.get('name', None) == 'hw_joint_vel_feedback': - item['value'].reverse() _d2d_vel['hw_joint_vel_feedback'].extend(item['value']) elif item.get('channel', None) == channel and item.get('name', None) == 'device_servo_trq_feedback': - item['value'].reverse() _d2d_trq['device_servo_trq_feedback'].extend(item['value']) df1 = pandas.DataFrame.from_dict(_d2d_vel) diff --git a/aio/code/data_process/current.py b/aio/code/data_process/current.py index b7cd024..cef7a6b 100644 --- a/aio/code/data_process/current.py +++ b/aio/code/data_process/current.py @@ -79,7 +79,7 @@ def initialization(path, sub, w2t): return data_files -def current_max(data_files, rcs, trqh, w2t): +def current_max(data_files, rcs, trq, w2t): current = {1: [], 2: [], 3: [], 4: [], 5: [], 6: [], 7: []} for data_file in data_files: if data_file.endswith('.data'): @@ -93,8 +93,8 @@ def current_max(data_files, rcs, trqh, w2t): axis = int(data_file.split('\\')[-1].split('_')[0].removeprefix('j')) rca = rcs[axis-1] - col = df.columns.values[trqh-1] - c_max = df[col].max() + col = df.columns.values[trq-1] + c_max = df[col].abs().max() scale = 1 if data_file.endswith('.csv') else 1000 _ = abs(c_max/scale*rca) @@ -118,7 +118,7 @@ def current_max(data_files, rcs, trqh, w2t): return current -def current_avg(data_files, rcs, trqh, w2t): +def current_avg(data_files, rcs, trq, w2t): current = {1: [], 2: [], 3: [], 4: [], 5: [], 6: [], 7: []} for data_file in data_files: if data_file.endswith('.data'): @@ -132,7 +132,7 @@ def current_avg(data_files, rcs, trqh, w2t): axis = int(data_file.split('\\')[-1].split('_')[0].removeprefix('j')) rca = rcs[axis-1] - col = df.columns.values[trqh - 1] + col = df.columns.values[trq-1] c_std = df[col].std() c_avg = df[col].mean() @@ -223,8 +223,7 @@ 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, 0, 'red') + w2t(f"[{pos}] {data_file}数据有误,需要检查,无法找到第{exitcode}个有效点...", 0, exitcode, 'red') elif flag == 'gt': while _row_e > end_point: speed_avg = df.iloc[_row_s:_row_e, 0].abs().mean() @@ -235,8 +234,7 @@ 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, 0, 'red') + w2t(f"[{pos}] {data_file}数据有误,需要检查,无法找到有效起始点或结束点...", 0, exitcode, 'red') def p_single(wb, single, vel, trq, rpms, w2t): @@ -395,9 +393,9 @@ def main(path, sub, dur, vel, trq, trqh, w2t): data_files = initialization(path, sub, w2t) rpms, rcs = get_configs(path + '\\configs.xlsx', w2t) if sub == 'max': - current_max(data_files, rcs, trqh, w2t) + current_max(data_files, rcs, trq, w2t) elif sub == 'avg': - current_avg(data_files, rcs, trqh, w2t) + current_avg(data_files, rcs, trq, w2t) elif sub == 'cycle': current_cycle(dur, data_files, rcs, vel, trq, trqh, rpms, w2t) else: