|
@@ -46,11 +46,11 @@ def result_main():
|
|
|
return csv_file_path
|
|
return csv_file_path
|
|
|
|
|
|
|
|
|
|
|
|
|
-def delete_data(names):
|
|
|
|
|
|
|
+def delete_data(name):
|
|
|
|
|
|
|
|
"""
|
|
"""
|
|
|
删除历史分析数据
|
|
删除历史分析数据
|
|
|
- :param names: 删除条件
|
|
|
|
|
|
|
+ :param name: 删除条件
|
|
|
:return: csv文件路径
|
|
:return: csv文件路径
|
|
|
"""
|
|
"""
|
|
|
|
|
|
|
@@ -63,14 +63,12 @@ def delete_data(names):
|
|
|
csv_file_path = os.path.join(data_folder, 'history_data.csv')
|
|
csv_file_path = os.path.join(data_folder, 'history_data.csv')
|
|
|
df = pd.read_csv(csv_file_path)
|
|
df = pd.read_csv(csv_file_path)
|
|
|
|
|
|
|
|
- for name in names:
|
|
|
|
|
- # 检查条件
|
|
|
|
|
- condition = ((df['时间'].str.contains(name[0])) &
|
|
|
|
|
- (df['场站'].str.contains(name[1])) &
|
|
|
|
|
- (df['风机编号'].str.contains(name[2])))
|
|
|
|
|
|
|
+ condition = ((df['时间'].astype(str).str.contains(name[0])) &
|
|
|
|
|
+ (df['场站'].astype(str).str.contains(name[1])) &
|
|
|
|
|
+ (df['风机编号'].astype(str).str.contains(name[2])))
|
|
|
|
|
|
|
|
- # 删除满足条件的行
|
|
|
|
|
- df = df[~condition]
|
|
|
|
|
|
|
+ # 删除满足条件的行
|
|
|
|
|
+ df = df[~condition]
|
|
|
# 如果需要,可以将修改后的 DataFrame 保存回 CSV 文件
|
|
# 如果需要,可以将修改后的 DataFrame 保存回 CSV 文件
|
|
|
df.to_csv(csv_file_path, index=False)
|
|
df.to_csv(csv_file_path, index=False)
|
|
|
|
|
|
|
@@ -85,7 +83,9 @@ def history_data(name):
|
|
|
:return:
|
|
:return:
|
|
|
"""
|
|
"""
|
|
|
|
|
|
|
|
- wind_name, turbine_code, time_code = name[1], name[2], name[0]
|
|
|
|
|
|
|
+ time_code = name[0]
|
|
|
|
|
+ wind_name = name[1]
|
|
|
|
|
+ turbine_code = name[2]
|
|
|
# 获取当前程序的绝对路径
|
|
# 获取当前程序的绝对路径
|
|
|
python_interpreter_path = sys.executable
|
|
python_interpreter_path = sys.executable
|
|
|
project_directory = os.path.dirname(python_interpreter_path)
|
|
project_directory = os.path.dirname(python_interpreter_path)
|
|
@@ -193,13 +193,13 @@ def data_analyse(path: List[str]):
|
|
|
max_keys = []
|
|
max_keys = []
|
|
|
mean_values = []
|
|
mean_values = []
|
|
|
for df in dist_distribute:
|
|
for df in dist_distribute:
|
|
|
- second_col_min = round(df[df.columns[1]].min(), 2)
|
|
|
|
|
- second_col_max = round(df[df.columns[1]].max(), 2)
|
|
|
|
|
|
|
+ second_col_min = df[df.columns[1]].min()
|
|
|
|
|
+ second_col_max = df[df.columns[1]].max()
|
|
|
min_row = df[df[df.columns[1]] == second_col_min]
|
|
min_row = df[df[df.columns[1]] == second_col_min]
|
|
|
max_row = df[df[df.columns[1]] == second_col_max]
|
|
max_row = df[df[df.columns[1]] == second_col_max]
|
|
|
- min_values.append(second_col_min)
|
|
|
|
|
|
|
+ min_values.append(round(second_col_min, 2))
|
|
|
min_keys.append(round(min_row.iloc[0][df.columns[0]], 2))
|
|
min_keys.append(round(min_row.iloc[0][df.columns[0]], 2))
|
|
|
- max_values.append(second_col_max)
|
|
|
|
|
|
|
+ max_values.append(round(second_col_max, 2))
|
|
|
max_keys.append(round(max_row.iloc[0][df.columns[0]], 2))
|
|
max_keys.append(round(max_row.iloc[0][df.columns[0]], 2))
|
|
|
|
|
|
|
|
for i in range(3):
|
|
for i in range(3):
|
|
@@ -230,7 +230,7 @@ def data_analyse(path: List[str]):
|
|
|
twist_avg = round((twist_1 + twist_2 + twist_3) / 3, 2)
|
|
twist_avg = round((twist_1 + twist_2 + twist_3) / 3, 2)
|
|
|
|
|
|
|
|
# 降低给数据采样频率,降低接口负担
|
|
# 降低给数据采样频率,降低接口负担
|
|
|
- sampling_num = int(0.01 * sampling_fq_1)
|
|
|
|
|
|
|
+ sampling_num = int(0.015 * sampling_fq_1)
|
|
|
|
|
|
|
|
# 将原始数据的时间列由计时时钟转换为实际时间
|
|
# 将原始数据的时间列由计时时钟转换为实际时间
|
|
|
data_tip.iloc[:, 0] = data_tip.iloc[:, 0] / 5000000
|
|
data_tip.iloc[:, 0] = data_tip.iloc[:, 0] / 5000000
|
|
@@ -238,9 +238,9 @@ def data_analyse(path: List[str]):
|
|
|
lowpass_data.iloc[:, 0] = lowpass_data.iloc[:, 0] / 5000000
|
|
lowpass_data.iloc[:, 0] = lowpass_data.iloc[:, 0] / 5000000
|
|
|
|
|
|
|
|
# 将需要保存到CSV的数据添加到return_list中
|
|
# 将需要保存到CSV的数据添加到return_list中
|
|
|
- return_list.append(time_code)
|
|
|
|
|
- return_list.append(wind_name)
|
|
|
|
|
- return_list.append(turbine_code)
|
|
|
|
|
|
|
+ return_list.append(str(time_code))
|
|
|
|
|
+ return_list.append(str(wind_name))
|
|
|
|
|
+ return_list.append(str(turbine_code))
|
|
|
return_list.append(sampling_fq_1)
|
|
return_list.append(sampling_fq_1)
|
|
|
return_list.append(pitch_angle_root[0])
|
|
return_list.append(pitch_angle_root[0])
|
|
|
return_list.append(pitch_angle_root[1])
|
|
return_list.append(pitch_angle_root[1])
|
|
@@ -282,16 +282,16 @@ def data_analyse(path: List[str]):
|
|
|
'ydata': lowpass_data['distance_filtered'].tolist()[::sampling_num],
|
|
'ydata': lowpass_data['distance_filtered'].tolist()[::sampling_num],
|
|
|
'xmax': max(lowpass_data['time'].tolist()),
|
|
'xmax': max(lowpass_data['time'].tolist()),
|
|
|
'xmin': min(lowpass_data['time'].tolist()),
|
|
'xmin': min(lowpass_data['time'].tolist()),
|
|
|
- 'ymax': max(lowpass_data['distance_filtered'].tolist()),
|
|
|
|
|
- 'ymin': min(lowpass_data['distance_filtered'].tolist())
|
|
|
|
|
|
|
+ 'ymax': max(lowpass_data['distance_filtered'].tolist()) + 0.02,
|
|
|
|
|
+ 'ymin': min(lowpass_data['distance_filtered'].tolist()) - 0.02
|
|
|
},
|
|
},
|
|
|
'fft': {
|
|
'fft': {
|
|
|
'xdata': fft_x,
|
|
'xdata': fft_x,
|
|
|
'ydata': fft_y,
|
|
'ydata': fft_y,
|
|
|
'xmax': max(fft_x),
|
|
'xmax': max(fft_x),
|
|
|
'xmin': min(fft_x),
|
|
'xmin': min(fft_x),
|
|
|
- 'ymax': max(fft_y),
|
|
|
|
|
- 'ymin': min(fft_y)
|
|
|
|
|
|
|
+ 'ymax': max(fft_y) + 0.02,
|
|
|
|
|
+ 'ymin': 0
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
'blade_tip': {
|
|
'blade_tip': {
|
|
@@ -431,13 +431,13 @@ def data_analyse(path: List[str]):
|
|
|
print('轮毂中心距离' + str(dist_cen))
|
|
print('轮毂中心距离' + str(dist_cen))
|
|
|
print('time_length:' + str(data_root.iloc[-1, 0]))
|
|
print('time_length:' + str(data_root.iloc[-1, 0]))
|
|
|
|
|
|
|
|
- plot_data(result_line_tip, 'line', 'data1')
|
|
|
|
|
|
|
+ # plot_data(result_line_tip, 'line', 'data1')
|
|
|
# plot_data(result_diff_tip, 'line', 'data_diff_1')
|
|
# plot_data(result_diff_tip, 'line', 'data_diff_1')
|
|
|
- plot_data(result_scatter_tip, 'scatter', 'data1')
|
|
|
|
|
- plot_data(result_line_root, 'line', 'data2')
|
|
|
|
|
|
|
+ # plot_data(result_scatter_tip, 'scatter', 'data1')
|
|
|
|
|
+ # plot_data(result_line_root, 'line', 'data2')
|
|
|
# plot_data(result_diff_root, 'line', 'data_diff_2')
|
|
# plot_data(result_diff_root, 'line', 'data_diff_2')
|
|
|
- plot_data(result_scatter_root, 'scatter', 'data2')
|
|
|
|
|
- plot_data(dist_distribute, 'scatter', 'dist_distribute')
|
|
|
|
|
|
|
+ # plot_data(result_scatter_root, 'scatter', 'data2')
|
|
|
|
|
+ # plot_data(dist_distribute, 'scatter', 'dist_distribute')
|
|
|
|
|
|
|
|
return json_output
|
|
return json_output
|
|
|
|
|
|
|
@@ -1041,7 +1041,7 @@ def blade_dist_distribute_cal(data_group: pd.DataFrame, start_points: pd.DataFra
|
|
|
:param blade_cen_dist: 叶片内部距离。
|
|
:param blade_cen_dist: 叶片内部距离。
|
|
|
"""
|
|
"""
|
|
|
|
|
|
|
|
- print('正在进行各周期净空距离计算......')
|
|
|
|
|
|
|
+ print('正在进行各周期净空距离分布计算......')
|
|
|
time.sleep(1)
|
|
time.sleep(1)
|
|
|
|
|
|
|
|
combined_df_sorted = pd.concat([start_points, end_points]).sort_values(by='time')
|
|
combined_df_sorted = pd.concat([start_points, end_points]).sort_values(by='time')
|
|
@@ -1069,11 +1069,8 @@ def blade_dist_distribute_cal(data_group: pd.DataFrame, start_points: pd.DataFra
|
|
|
segment = data_group[(data_group['time'] > start_time) & (data_group['time'] <= end_time)]
|
|
segment = data_group[(data_group['time'] > start_time) & (data_group['time'] <= end_time)]
|
|
|
min_distance = segment['distance'].min()
|
|
min_distance = segment['distance'].min()
|
|
|
clearance = np.abs(tower_dist - min_distance - blade_cen_dist[i % 3]) * np.cos(np.deg2rad(v_angle))
|
|
clearance = np.abs(tower_dist - min_distance - blade_cen_dist[i % 3]) * np.cos(np.deg2rad(v_angle))
|
|
|
- r_speed = (start_times[i + 2] - start_times[i]) * 3 / 5000000
|
|
|
|
|
|
|
+ r_speed = round(60 / ((start_times[i + 2] - start_times[i]) * 3 / 5000000), 2)
|
|
|
|
|
|
|
|
- # 周期归一化
|
|
|
|
|
- ratio = (end_time - start_time) / normalize_cycle
|
|
|
|
|
- segment.loc[:, 'time'] = (segment['time'] - start_time) / ratio
|
|
|
|
|
|
|
|
|
|
new_df = pd.DataFrame({
|
|
new_df = pd.DataFrame({
|
|
|
'r_speed': [r_speed],
|
|
'r_speed': [r_speed],
|
|
@@ -1083,6 +1080,9 @@ def blade_dist_distribute_cal(data_group: pd.DataFrame, start_points: pd.DataFra
|
|
|
# 将结果添加到相应的 turbine 数据框中
|
|
# 将结果添加到相应的 turbine 数据框中
|
|
|
tower_clearance[i % 3] = pd.concat([tower_clearance[i % 3], new_df])
|
|
tower_clearance[i % 3] = pd.concat([tower_clearance[i % 3], new_df])
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+ tower_clearance = [df.sort_values(by='r_speed') for df in tower_clearance]
|
|
|
|
|
+
|
|
|
return tower_clearance
|
|
return tower_clearance
|
|
|
|
|
|
|
|
|
|
|