From 88776c67941e8c3bb690a48ec0cf5c2bdb7f6384 Mon Sep 17 00:00:00 2001 From: gitea Date: Mon, 30 Dec 2024 09:04:24 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=94=B5=E6=9C=BA=E7=94=B5=E6=B5=81?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E6=83=85=E5=86=B5=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- aio/assets/templates/heartbeat | 2 +- aio/code/data_process/current.py | 20 ++++++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/aio/assets/templates/heartbeat b/aio/assets/templates/heartbeat index c227083..56a6051 100644 --- a/aio/assets/templates/heartbeat +++ b/aio/assets/templates/heartbeat @@ -1 +1 @@ -0 \ No newline at end of file +1 \ No newline at end of file diff --git a/aio/code/data_process/current.py b/aio/code/data_process/current.py index 0261414..7c68d7f 100644 --- a/aio/code/data_process/current.py +++ b/aio/code/data_process/current.py @@ -249,23 +249,30 @@ def p_single(wb, single, vel, trq, rpms, rrs, w2t): row_end = _row_e - _adjust _row_e -= _end_point _row_s -= _end_point - _row_s, _row_e = find_point(data_file, 'a2', 'gt', df, _row_s, _row_e, w2t, 3, threshold=5, step=_step, end_point=_end_point) + _row_s, _row_e = find_point(data_file, 'a2', 'gt', df, _row_s, _row_e, w2t, 2, threshold=5, step=_step, end_point=_end_point) # 速度已经快要降为零了,继续寻找下一个速度上升点 + _row_middle = _row_s _row_e -= _end_point _row_s -= _end_point _row_s, _row_e = find_point(data_file, 'a3', 'lt', df, _row_s, _row_e, w2t, 3, threshold=5, step=_step, end_point=_end_point) + if abs((_row_s-_row_middle)-(_row_middle-row_end)) > 1000: # 两段相差太大,判定后者较小(很罕见的情况,所以只假设之前遇到的情况,所以可能有bug) + row_end = _row_middle + _row_e -= _end_point + _row_s -= _end_point + _row_s, _row_e = find_point(data_file, 'a4', 'gt', df, _row_s, _row_e, w2t, 4, threshold=5, step=_step, end_point=_end_point) + elif speed_avg > 2: # 过滤尾部非零无效数据 - _row_s, _row_e = find_point(data_file, 'b1', 'gt', df, _row_s, _row_e, w2t, 2, threshold=5, step=_step, end_point=_end_point) + _row_s, _row_e = find_point(data_file, 'b1', 'gt', df, _row_s, _row_e, w2t, 1, threshold=5, step=_step, end_point=_end_point) # 找到第一个起始点 row_end,继续找到有数据的部分,后面有一段零数据区 row_end = _row_e - _adjust _row_e -= _end_point _row_s -= _end_point - _row_s, _row_e = find_point(data_file, 'b2', 'lt', df, _row_s, _row_e, w2t, 4, threshold=5, step=_step, end_point=_end_point) + _row_s, _row_e = find_point(data_file, 'b2', 'lt', df, _row_s, _row_e, w2t, 2, threshold=5, step=_step, end_point=_end_point) # 目前已经有一点的速度值了,继续往前搜寻下一个速度为零的点 _row_e -= _end_point _row_s -= _end_point - _row_s, _row_e = find_point(data_file, 'b3', 'gt', df, _row_s, _row_e, w2t, 4, threshold=5, step=_step, end_point=_end_point) + _row_s, _row_e = find_point(data_file, 'b3', 'gt', df, _row_s, _row_e, w2t, 3, threshold=5, step=_step, end_point=_end_point) row_start = _row_s + _adjust data = [] @@ -314,6 +321,7 @@ def p_scenario(wb, single, vel, trq, rpms, rrs, dur, w2t): col_names = list(df.columns) df_1 = df[col_names[vel-1]].multiply(rpm*addition) df_2 = df[col_names[trq-1]].multiply(scale) + df_origin = df df = concat([df_1, df_2], axis=1) row_start = 300 @@ -323,8 +331,8 @@ def p_scenario(wb, single, vel, trq, rpms, rrs, dur, w2t): data = [] for row in range(row_start, row_end): - data.append(df.iloc[row, 0]) - data.append(df.iloc[row, 1]) + data.append(df_origin.iloc[row, 0]) + data.append(df_origin.iloc[row, 1]) i = 0 for row in ws.iter_rows(min_row=2, min_col=2, max_row=250000, max_col=3):