fix: 电机电流异常情况修复
This commit is contained in:
		| @@ -1 +1 @@ | ||||
| 0 | ||||
| 1 | ||||
| @@ -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): | ||||
|   | ||||
		Reference in New Issue
	
	Block a user