|
@@ -112,10 +112,11 @@ def data_analyse(path: List[str]):
|
|
|
# 基础配置参数
|
|
# 基础配置参数
|
|
|
locate_file = path[0]
|
|
locate_file = path[0]
|
|
|
measure_file = path[1]
|
|
measure_file = path[1]
|
|
|
- noise_reduction = 0.000001 # 如果一个距离值的所有样本量小于总样本量的noise_reduction,则被去掉
|
|
|
|
|
- min_difference = 1.5 # 如果相邻2个点的距离差大于min_difference,则被注意是否是周期节点
|
|
|
|
|
angle_cone = float(path[2]) # 锥角
|
|
angle_cone = float(path[2]) # 锥角
|
|
|
axial_inclination = float(path[3]) # 轴向倾角
|
|
axial_inclination = float(path[3]) # 轴向倾角
|
|
|
|
|
+ noise_reduction = 0.000001 # 如果一个距离值的所有样本量小于总样本量的noise_reduction,则被去掉
|
|
|
|
|
+ min_difference = 1.5 # 如果相邻2个点的距离差大于min_difference,则被注意是否是周期节点
|
|
|
|
|
+ group_length = [10000, 30000, 5000] # 计算叶片轮廓时每个小切片的长度,三个数分别为叶中、叶根、叶尖切片长度
|
|
|
return_list = []
|
|
return_list = []
|
|
|
|
|
|
|
|
# 读取文件信息,包括风场名、风机编号、时间、采样频率、2个通道俯仰角
|
|
# 读取文件信息,包括风场名、风机编号、时间、采样频率、2个通道俯仰角
|
|
@@ -155,11 +156,11 @@ def data_analyse(path: List[str]):
|
|
|
|
|
|
|
|
# 根据起始结束点,对叶根、对叶片数据进行归一化处理,计算每个叶片的散点表、线表、边界点表、标准循环周期长度、每个叶片平均最小值
|
|
# 根据起始结束点,对叶根、对叶片数据进行归一化处理,计算每个叶片的散点表、线表、边界点表、标准循环周期长度、每个叶片平均最小值
|
|
|
result_line_tip, result_scatter_tip, border_rows_tip, cycle_len_tip, min_tip \
|
|
result_line_tip, result_scatter_tip, border_rows_tip, cycle_len_tip, min_tip \
|
|
|
- = data_normalize(filtered_data_tip, start_tip, end_tip)
|
|
|
|
|
|
|
+ = data_normalize(filtered_data_tip, start_tip, end_tip, group_length[0])
|
|
|
result_line_root, result_scatter_root, border_rows_root, cycle_len_root, min_root \
|
|
result_line_root, result_scatter_root, border_rows_root, cycle_len_root, min_root \
|
|
|
- = data_normalize(filtered_data_root, start_root, end_root)
|
|
|
|
|
|
|
+ = data_normalize(filtered_data_root, start_root, end_root, group_length[1])
|
|
|
result_line_nan, result_scatter_nan, border_rows_nan, cycle_len_nan, min_nan \
|
|
result_line_nan, result_scatter_nan, border_rows_nan, cycle_len_nan, min_nan \
|
|
|
- = data_normalize(filtered_data_nan, start_nan, end_nan)
|
|
|
|
|
|
|
+ = data_normalize(filtered_data_nan, start_nan, end_nan, group_length[2])
|
|
|
|
|
|
|
|
# 计算3个叶片的平均轮廓,3个叶片的形状差
|
|
# 计算3个叶片的平均轮廓,3个叶片的形状差
|
|
|
result_avg_tip, result_diff_tip = blade_shape(result_line_tip)
|
|
result_avg_tip, result_diff_tip = blade_shape(result_line_tip)
|
|
@@ -446,8 +447,8 @@ def data_analyse(path: List[str]):
|
|
|
json.dump(json_output, json_file, indent=4)
|
|
json.dump(json_output, json_file, indent=4)
|
|
|
|
|
|
|
|
print('csv文件路径' + str(csv_file_path))
|
|
print('csv文件路径' + str(csv_file_path))
|
|
|
- print(result_line_tip[0].iloc[:, 0])
|
|
|
|
|
- print(result_line_root[0].iloc[:, 0])
|
|
|
|
|
|
|
+ # print(result_line_tip[0].iloc[:, 0])
|
|
|
|
|
+ # print(result_line_root[0].iloc[:, 0])
|
|
|
print('振动主频' + str(tower_freq))
|
|
print('振动主频' + str(tower_freq))
|
|
|
print('振动幅值' + str(tower_max))
|
|
print('振动幅值' + str(tower_max))
|
|
|
print('最小值', min_values)
|
|
print('最小值', min_values)
|
|
@@ -462,9 +463,9 @@ def data_analyse(path: List[str]):
|
|
|
# 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_scatter_tip, 'scatter', 'data1')
|
|
|
- plot_data(result_line_root, 'line', 'data2')
|
|
|
|
|
|
|
+ # 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(result_scatter_root, 'scatter', 'data2')
|
|
|
# plot_data(dist_distribute, 'scatter', 'dist_distribute')
|
|
# plot_data(dist_distribute, 'scatter', 'dist_distribute')
|
|
|
|
|
|
|
|
return json_output
|
|
return json_output
|
|
@@ -649,7 +650,7 @@ def cycle_calculate(data_group: pd.DataFrame, noise_threshold: float, min_distan
|
|
|
return start_points, end_points, filtered_data
|
|
return start_points, end_points, filtered_data
|
|
|
|
|
|
|
|
|
|
|
|
|
-def data_normalize(data_group: pd.DataFrame, start_points: pd.DataFrame, end_points: pd.DataFrame) \
|
|
|
|
|
|
|
+def data_normalize(data_group: pd.DataFrame, start_points: pd.DataFrame, end_points: pd.DataFrame, group_len: int) \
|
|
|
-> Tuple[List[pd.DataFrame], List[pd.DataFrame], List[pd.DataFrame], int, list]:
|
|
-> Tuple[List[pd.DataFrame], List[pd.DataFrame], List[pd.DataFrame], int, list]:
|
|
|
|
|
|
|
|
"""
|
|
"""
|
|
@@ -657,6 +658,7 @@ def data_normalize(data_group: pd.DataFrame, start_points: pd.DataFrame, end_poi
|
|
|
:param data_group: cycle_calculate计算完成后的数据。
|
|
:param data_group: cycle_calculate计算完成后的数据。
|
|
|
:param start_points: 所有每个周期开始点,叶片前缘突变点。
|
|
:param start_points: 所有每个周期开始点,叶片前缘突变点。
|
|
|
:param end_points: 叶片后缘突变点。
|
|
:param end_points: 叶片后缘突变点。
|
|
|
|
|
+ :param group_len: 每个分组的长度。
|
|
|
:return: turbines_processed: 每个叶片的拟合数据,
|
|
:return: turbines_processed: 每个叶片的拟合数据,
|
|
|
turbines_scattered: 每个叶片的散点数据,
|
|
turbines_scattered: 每个叶片的散点数据,
|
|
|
border_rows: 每个叶片的2个边缘数据,
|
|
border_rows: 每个叶片的2个边缘数据,
|
|
@@ -710,8 +712,10 @@ def data_normalize(data_group: pd.DataFrame, start_points: pd.DataFrame, end_poi
|
|
|
turbines_processed = []
|
|
turbines_processed = []
|
|
|
turbines_scattered = []
|
|
turbines_scattered = []
|
|
|
min_list = []
|
|
min_list = []
|
|
|
|
|
+ plot_points = []
|
|
|
|
|
+ diff_line = []
|
|
|
sd_time = [-1, -1]
|
|
sd_time = [-1, -1]
|
|
|
- time_list = list(range(0, normalize_cycle, 9000))
|
|
|
|
|
|
|
+ time_list = list(range(0, normalize_cycle, group_len))
|
|
|
# time_list = [(i + 1) * normalize_cycle / fs * 100 for i in range(fs * 100)] # 生成时间序列
|
|
# time_list = [(i + 1) * normalize_cycle / fs * 100 for i in range(fs * 100)] # 生成时间序列
|
|
|
|
|
|
|
|
for turbine in turbines:
|
|
for turbine in turbines:
|
|
@@ -722,7 +726,7 @@ def data_normalize(data_group: pd.DataFrame, start_points: pd.DataFrame, end_poi
|
|
|
first_time = turbine_sorted['time'].iloc[0]
|
|
first_time = turbine_sorted['time'].iloc[0]
|
|
|
|
|
|
|
|
# 分组,时间列每1000为一组(每40个时间点一组)
|
|
# 分组,时间列每1000为一组(每40个时间点一组)
|
|
|
- bins = list(range(int(first_time), int(turbine_sorted['time'].max()), 9000))
|
|
|
|
|
|
|
+ bins = list(range(int(first_time), int(turbine_sorted['time'].max()), group_len))
|
|
|
# 原始代码
|
|
# 原始代码
|
|
|
# bins = list(range(int(first_time), int(turbine_sorted['time'].max()) + len(start_times), int(fs / 50)))
|
|
# bins = list(range(int(first_time), int(turbine_sorted['time'].max()) + len(start_times), int(fs / 50)))
|
|
|
grouped = turbine_sorted.groupby(pd.cut(turbine_sorted['time'], bins=bins, right=False))
|
|
grouped = turbine_sorted.groupby(pd.cut(turbine_sorted['time'], bins=bins, right=False))
|
|
@@ -759,23 +763,8 @@ def data_normalize(data_group: pd.DataFrame, start_points: pd.DataFrame, end_poi
|
|
|
first_index = np.where(diff_points < sdr_diff)[0][0]
|
|
first_index = np.where(diff_points < sdr_diff)[0][0]
|
|
|
last_index = np.where(diff_points < sdr_diff)[0][-1]
|
|
last_index = np.where(diff_points < sdr_diff)[0][-1]
|
|
|
|
|
|
|
|
- '''
|
|
|
|
|
- # 创建一个总图中有3个分图的形式
|
|
|
|
|
- fig, axs = plt.subplots(1, 1, figsize=(15, 9))
|
|
|
|
|
- plt.subplots_adjust(hspace=2)
|
|
|
|
|
-
|
|
|
|
|
- # 绘制 diff_points 的折线图
|
|
|
|
|
- axs.plot(diff_points, label='Diff Points', color='red', marker='x', markersize=5)
|
|
|
|
|
- axs.axhline(y=sdr_diff, color='red', linestyle='--')
|
|
|
|
|
- axs.legend()
|
|
|
|
|
- axs.set_title('Diff Points')
|
|
|
|
|
- axs.set_xlabel('Index')
|
|
|
|
|
- axs.set_ylabel('Value')
|
|
|
|
|
-
|
|
|
|
|
- # 显示图形
|
|
|
|
|
- plt.tight_layout()
|
|
|
|
|
- plt.show()
|
|
|
|
|
- '''
|
|
|
|
|
|
|
+ plot_points.append(diff_points)
|
|
|
|
|
+ diff_line.append(sdr_diff)
|
|
|
|
|
|
|
|
for index, (bin, group) in enumerate(grouped):
|
|
for index, (bin, group) in enumerate(grouped):
|
|
|
|
|
|
|
@@ -811,6 +800,22 @@ def data_normalize(data_group: pd.DataFrame, start_points: pd.DataFrame, end_poi
|
|
|
turbines_processed.append(processed_df)
|
|
turbines_processed.append(processed_df)
|
|
|
turbines_scattered.append(scattered_df)
|
|
turbines_scattered.append(scattered_df)
|
|
|
|
|
|
|
|
|
|
+ """# 创建一个总图中有3个分图的形式
|
|
|
|
|
+ fig, axs = plt.subplots(1, 1, figsize=(15, 9))
|
|
|
|
|
+ plt.subplots_adjust(hspace=2)
|
|
|
|
|
+
|
|
|
|
|
+ # 绘制 diff_points 的折线图
|
|
|
|
|
+ axs.plot(plot_points[1], label='Diff Points', color='blue', marker='x', markersize=5)
|
|
|
|
|
+ axs.axhline(y=diff_line[1], color='red', linestyle='--')
|
|
|
|
|
+ axs.legend()
|
|
|
|
|
+ axs.set_title('Diff Points')
|
|
|
|
|
+ axs.set_xlabel('Index')
|
|
|
|
|
+ axs.set_ylabel('Value')
|
|
|
|
|
+
|
|
|
|
|
+ # 显示图形
|
|
|
|
|
+ plt.tight_layout()
|
|
|
|
|
+ plt.show()"""
|
|
|
|
|
+
|
|
|
# 把三组叶片数据按sd_time进行筛选,并把每个的边界数据保存
|
|
# 把三组叶片数据按sd_time进行筛选,并把每个的边界数据保存
|
|
|
border_rows = []
|
|
border_rows = []
|
|
|
for i, turbine in enumerate(turbines_processed):
|
|
for i, turbine in enumerate(turbines_processed):
|
|
@@ -955,7 +960,7 @@ def blade_angle_aero_dist(border_rows: List[pd.DataFrame], radius: float, full_c
|
|
|
|
|
|
|
|
diff_time = turbine.iloc[1, 0] - turbine.iloc[0, 0]
|
|
diff_time = turbine.iloc[1, 0] - turbine.iloc[0, 0]
|
|
|
|
|
|
|
|
- diff_len = turbine.iloc[1, 1] - turbine.iloc[0, 1]
|
|
|
|
|
|
|
+ diff_len = (turbine.iloc[1, 1] - turbine.iloc[0, 1]) * np.cos(np.deg2rad(v_angle))
|
|
|
mean_col2 = (turbine.iloc[1, 1] + turbine.iloc[0, 1]) / 2
|
|
mean_col2 = (turbine.iloc[1, 1] + turbine.iloc[0, 1]) / 2
|
|
|
aero_dist = abs(mean_col2 - tower_dist) * np.cos(np.deg2rad(v_angle))
|
|
aero_dist = abs(mean_col2 - tower_dist) * np.cos(np.deg2rad(v_angle))
|
|
|
|
|
|
|
@@ -1116,8 +1121,8 @@ def blade_dist_distribute_cal(data_group: pd.DataFrame, start_points: pd.DataFra
|
|
|
# locate_path = "C:/Users/laiwe/Desktop/风电/激光测量/测试数据/20250728/gy_10-tf-20_20250630223600_20_13.03_23.32.csv"
|
|
# locate_path = "C:/Users/laiwe/Desktop/风电/激光测量/测试数据/20250728/gy_10-tf-20_20250630223600_20_13.03_23.32.csv"
|
|
|
# measure_path= "C:/Users/laiwe/Desktop/风电/激光测量/测试数据/20250728/gy_10-tf-20_20250630223849_20_17.89_21.07.csv"
|
|
# measure_path= "C:/Users/laiwe/Desktop/风电/激光测量/测试数据/20250728/gy_10-tf-20_20250630223849_20_17.89_21.07.csv"
|
|
|
|
|
|
|
|
-locate_path = "C:/Users/laiwe/Desktop/风电/激光测量/测试数据/20250728/gy_10-tf-50_20250630223358_50_13.03_23.32.csv"
|
|
|
|
|
-measure_path= "C:/Users/laiwe/Desktop/风电/激光测量/测试数据/20250728/gy_10-tf-50_20250630224408_50_17.89_21.07.csv"
|
|
|
|
|
|
|
+# locate_path = "C:/Users/laiwe/Desktop/风电/激光测量/测试数据/20250728/gy_10-tf-50_20250630223358_50_13.03_23.32.csv"
|
|
|
|
|
+# measure_path= "C:/Users/laiwe/Desktop/风电/激光测量/测试数据/20250728/gy_10-tf-50_20250630224408_50_17.89_21.07.csv"
|
|
|
|
|
|
|
|
# locate_path = "C:/Users/laiwe/Desktop/风电/激光测量/测试数据/20250728/gy_10-tf-100_20250630222752_100_13.03_23.32.csv"
|
|
# locate_path = "C:/Users/laiwe/Desktop/风电/激光测量/测试数据/20250728/gy_10-tf-100_20250630222752_100_13.03_23.32.csv"
|
|
|
# measure_path= "C:/Users/laiwe/Desktop/风电/激光测量/测试数据/20250728/gy_10-tf-100_20250630225119_100_17.89_21.07.csv"
|
|
# measure_path= "C:/Users/laiwe/Desktop/风电/激光测量/测试数据/20250728/gy_10-tf-100_20250630225119_100_17.89_21.07.csv"
|
|
@@ -1131,6 +1136,9 @@ measure_path= "C:/Users/laiwe/Desktop/风电/激光测量/测试数据/20250728/
|
|
|
# locate_path = "C:/Users/laiwe/Desktop/风电/激光测量/测试数据/20250728/gy_10-tff-100_20250630231610_100_12.51_20.06.csv"
|
|
# locate_path = "C:/Users/laiwe/Desktop/风电/激光测量/测试数据/20250728/gy_10-tff-100_20250630231610_100_12.51_20.06.csv"
|
|
|
# measure_path= "C:/Users/laiwe/Desktop/风电/激光测量/测试数据/20250728/gy_10-tff-100_20250630234012_100_15.35_18.16.csv"
|
|
# measure_path= "C:/Users/laiwe/Desktop/风电/激光测量/测试数据/20250728/gy_10-tff-100_20250630234012_100_15.35_18.16.csv"
|
|
|
|
|
|
|
|
|
|
+locate_path = "C:/Users/laiwe/Desktop/风电/激光测量/测试数据/gytest/测试数据/gy_18-RF-1_20250701154647_50_23.70_40.01.csv"
|
|
|
|
|
+measure_path= "C:/Users/laiwe/Desktop/风电/激光测量/测试数据/gytest/测试数据/gy_18-RF-2_20250701155057_50_29.30_36.78.csv"
|
|
|
|
|
+
|
|
|
start_t = time.time() # 记录开始时间
|
|
start_t = time.time() # 记录开始时间
|
|
|
data_path = [locate_path, measure_path, 5, 6]
|
|
data_path = [locate_path, measure_path, 5, 6]
|
|
|
list_1 = data_analyse(data_path)
|
|
list_1 = data_analyse(data_path)
|