Procházet zdrojové kódy

激光测量v2.3,修正了塔筒振动算法(考虑了角度分量影响),修改了周期判断逻辑,以适应叶尖低采样频率数据周期识别

wei_lai před 6 měsíci
rodič
revize
dc58e4d91b
2 změnil soubory, kde provedl 22 přidání a 15 odebrání
  1. 14 8
      data_analyse_origin.py
  2. 8 7
      data_clean.py

+ 14 - 8
data_analyse_origin.py

@@ -120,7 +120,7 @@ def data_analyse(path: List[str]):
 
     # 读取文件信息,包括风场名、风机编号、时间、采样频率、2个通道俯仰角
     wind_name, turbine_code, time_code, sampling_fq, angle_nan, angle_cen = find_param(locate_file)
-    wind_name_1, turbine_code_1, time_code, sampling_fq_1, angle_tip, angle_root = find_param(measure_file)
+    wind_name_1, turbine_code_1, time_code_1, sampling_fq_1, angle_tip, angle_root = find_param(measure_file)
     sampling_fq_1 = sampling_fq_1 * 1000
     sampling_fq = sampling_fq * 1000
     print(wind_name, turbine_code, time_code, sampling_fq, angle_nan, angle_cen)
@@ -128,6 +128,7 @@ def data_analyse(path: List[str]):
 
     # 读取数据,并检查是否有时间序列异常,分离2通道数据
     data_nan, data_cen = process_data(locate_file)
+    data_cen.iloc[:, 1] = data_cen.iloc[:, 1] * np.cos(np.deg2rad(angle_cen))
     data_tip, data_root = process_data(measure_file)
 
     # 全部数据进行降噪、去除异常点处理,叶根叶尖数据计算叶片扫掠起始、结束点,轮毂中心数据计算距离均值
@@ -434,7 +435,7 @@ def data_analyse(path: List[str]):
     # plot_data(result_line_tip, 'line', 'data1')
     # 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_line_root, 'line', 'data2')
     # plot_data(result_diff_root, 'line', 'data_diff_2')
     # plot_data(result_scatter_root, 'scatter', 'data2')
     # plot_data(dist_distribute, 'scatter', 'dist_distribute')
@@ -592,7 +593,7 @@ def cycle_calculate(data_group: pd.DataFrame, noise_threshold: float, min_distan
         # 获取当前行的 distance 值
         current_distance = filtered_data.loc[idx, 'distance']
 
-        next_rows_large = filtered_data.loc[idx - 1000: idx - 1]
+        next_rows_large = filtered_data.loc[idx - 300: idx - 1]
 
         # 检查是否任意 distance 的值小于 current_distance - 2
         if next_rows_large['distance'].le(current_distance - min_distance).all():
@@ -603,7 +604,7 @@ def cycle_calculate(data_group: pd.DataFrame, noise_threshold: float, min_distan
         # 获取当前行的 distance 值
         current_distance = filtered_data.loc[idx - 1, 'distance']
 
-        next_rows_small = filtered_data.iloc[idx: idx + 1000]
+        next_rows_small = filtered_data.iloc[idx: idx + 300]
 
         # 检查是否任意 distance 的值小于 current_distance - 2
         if next_rows_small['distance'].le(current_distance - min_distance).all():
@@ -683,7 +684,7 @@ def data_normalize(data_group: pd.DataFrame, start_points: pd.DataFrame, end_poi
     turbines_scattered = []
     min_list = []
     sd_time = [-1, -1]
-    time_list = list(range(0, normalize_cycle, 1000))
+    time_list = list(range(0, normalize_cycle, 10000))
     # time_list = [(i + 1) * normalize_cycle / fs * 100 for i in range(fs * 100)]  # 生成时间序列
 
     for turbine in turbines:
@@ -694,7 +695,7 @@ def data_normalize(data_group: pd.DataFrame, start_points: pd.DataFrame, end_poi
         first_time = turbine_sorted['time'].iloc[0]
 
         # 分组,时间列每1000为一组(每40个时间点一组)
-        bins = list(range(int(first_time), int(turbine_sorted['time'].max()), 1000))
+        bins = list(range(int(first_time), int(turbine_sorted['time'].max()), 10000))
         # 原始代码
         # 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))
@@ -1092,8 +1093,8 @@ def blade_dist_distribute_cal(data_group: pd.DataFrame, start_points: pd.DataFra
 # measure_path = "C:/Users/laiwe/Desktop/风电/激光测量/测试数据/20250513/p'l_9p_20250514084957_100_27.48_29.47.csv"
 # locate_path = "C:/Users/laiwe/Desktop/风电/激光测量/测试数据/20250513/p'l_9p_20250514084814_100_27.75_32.93.csv"
 
-locate_path = "C:/Users/laiwe/Desktop/风电/激光测量/测试数据/20250513/pl_63_20250513160502_100_41.38_41.38.csv"
-measure_path= "C:/Users/laiwe/Desktop/风电/激光测量/测试数据/20250513/pl_63_20250513160655_100_28.10_35.43.csv"
+# locate_path = "C:/Users/laiwe/Desktop/风电/激光测量/测试数据/20250513/pl_63_20250513160502_100_41.38_41.38.csv"
+# measure_path= "C:/Users/laiwe/Desktop/风电/激光测量/测试数据/20250513/pl_63_20250513160655_100_28.10_35.43.csv"
 
 # locate_path = "C:/Users/laiwe/Desktop/风电/激光测量/测试数据/20250513/平陆_4_20250514073658_100_16.00_20.56.csv"
 # measure_path= "C:/Users/laiwe/Desktop/风电/激光测量/测试数据/20250513/平陆_4_20250514073248_100_12.72_17.3.csv"
@@ -1101,6 +1102,11 @@ measure_path= "C:/Users/laiwe/Desktop/风电/激光测量/测试数据/20250513/
 # locate_path = "C:/Users/laiwe/Desktop/风电/激光测量/测试数据/20250416/__20250416134815_50_14.55_17.00.csv"
 # measure_path= "C:/Users/laiwe/Desktop/风电/激光测量/测试数据/20250416/__20250416135017_50_11.85_14.31.csv"
 
+# locate_path = "C:/Users/laiwe/Desktop/风电/激光测量/测试数据/20250616/qx_b14-1_20250616161311_50_38.06_37.81.csv"
+# measure_path= "C:/Users/laiwe/Desktop/风电/激光测量/测试数据/20250616/qx_b14-1_20250616160625_50_23.38_35.13.csv"
+
+locate_path = "C:/Users/laiwe/Desktop/风电/激光测量/测试数据/20250616/qx_17_20250616140305_50_28.12_28.12.csv"
+measure_path= "C:/Users/laiwe/Desktop/风电/激光测量/测试数据/20250616/qx_17_20250616140452_50_21.09_26.22.csv"
 
 
 start_t = time.time()  # 记录开始时间

+ 8 - 7
data_clean.py

@@ -87,17 +87,18 @@ def data_analyse(path: List[str]):
     measure_file = path[1]
     noise_reduction = 0.000001  
     min_difference = 1.5  
-    angle_cone = float(path[2])  
-    axial_inclination = float(path[3])  
+    angle_cone = float(path[2])
+    axial_inclination = float(path[3])
     return_list = []
 
     wind_name, turbine_code, time_code, sampling_fq, angle_nan, angle_cen = find_param(locate_file)
-    wind_name_1, turbine_code_1, time_code, sampling_fq_1, angle_tip, angle_root = find_param(measure_file)
+    wind_name_1, turbine_code_1, time_code_1, sampling_fq_1, angle_tip, angle_root = find_param(measure_file)
 
     sampling_fq_1 = sampling_fq_1 * 1000
     sampling_fq = sampling_fq * 1000
 
     data_nan, data_cen = process_data(locate_file)
+    data_cen.iloc[:, 1] = data_cen.iloc[:, 1] * np.cos(np.deg2rad(angle_cen))
     data_tip, data_root = process_data(measure_file)
 
     start_tip, end_tip, filtered_data_tip = cycle_calculate(data_tip, noise_reduction, min_difference)
@@ -465,7 +466,7 @@ def cycle_calculate(data_group: pd.DataFrame, noise_threshold: float, min_distan
         
         current_distance = filtered_data.loc[idx, 'distance']
 
-        next_rows_large = filtered_data.loc[idx - 1000: idx - 1]
+        next_rows_large = filtered_data.loc[idx - 100: idx - 1]
 
         
         if next_rows_large['distance'].le(current_distance - min_distance).all():
@@ -476,7 +477,7 @@ def cycle_calculate(data_group: pd.DataFrame, noise_threshold: float, min_distan
         
         current_distance = filtered_data.loc[idx - 1, 'distance']
 
-        next_rows_small = filtered_data.iloc[idx: idx + 1000]
+        next_rows_small = filtered_data.iloc[idx: idx + 100]
 
         
         if next_rows_small['distance'].le(current_distance - min_distance).all():
@@ -537,7 +538,7 @@ def data_normalize(data_group: pd.DataFrame, start_points: pd.DataFrame, end_poi
     turbines_scattered = []
     min_list = []
     sd_time = [-1, -1]
-    time_list = list(range(0, normalize_cycle, 1000))
+    time_list = list(range(0, normalize_cycle, 10000))
 
     for turbine in turbines:
         
@@ -547,7 +548,7 @@ def data_normalize(data_group: pd.DataFrame, start_points: pd.DataFrame, end_poi
         first_time = turbine_sorted['time'].iloc[0]
 
         
-        bins = list(range(int(first_time), int(turbine_sorted['time'].max()), 1000))
+        bins = list(range(int(first_time), int(turbine_sorted['time'].max()), 10000))
         
         
         grouped = turbine_sorted.groupby(pd.cut(turbine_sorted['time'], bins=bins, right=False))