Jelajahi Sumber

fix(DHU): 更新配置文件读取逻辑并优化推送策略

- 修改 `config_reader.py` 中 `all_equp_names_short` 属性,仅返回启用状态的设备名称
- 调整 `optimize.py` 和 `train.py` 中的默认配置文件路径,从 `DHU_AB配置.xlsx` 改为 `DHU.xlsx`
- 注释掉排风机频率相关优化逻辑,临时禁用该变量优化
- 优化结果推送时,`point_id` 增加设备前缀,确保唯一性
- 推送策略中增加 `job_id` 获取逻辑,优先从环境变量获取
- 完善 `main.py` 中未实现异常提示信息,明确具体未实现的模块或设备类型
zhangshenhao 5 bulan lalu
induk
melakukan
b7fe488840
4 mengubah file dengan 8 tambahan dan 24 penghapusan
  1. 1 1
      apps/DHU/config_reader.py
  2. 4 20
      apps/DHU/optimize.py
  3. 1 1
      apps/DHU/train.py
  4. 2 2
      main.py

+ 1 - 1
apps/DHU/config_reader.py

@@ -24,7 +24,7 @@ class ConfigReader:
     
     @property
     def all_equp_names_short(self):
-        return self.equp.loc[:,'名称'].to_list()
+        return self.equp.loc[lambda dt:dt.启用==True].loc[:,'名称'].to_list()
     
     
     def get_equp_info(self,equp_name,key:str,info_type):

+ 4 - 20
apps/DHU/optimize.py

@@ -21,7 +21,7 @@ def optimize(*inputs,config=None):
         config_reader_path = '/mnt/workflow_data'
         data_URL           = 'http://basedataportal-svc:8080/data/getpointsdata'
         
-    config_reader = ConfigReader(path=f'{config_reader_path}/DHU_AB配置.xlsx')
+    config_reader = ConfigReader(path=f'{config_reader_path}/DHU配置.xlsx')
     
     ALL_RESULT = {
         'EXCEPTION':{
@@ -262,10 +262,6 @@ def optimize_dhu(
             config_reader.get_app_info(each_eaup_name,'实时优化','后再生盘管温度下限','float'),
             config_reader.get_app_info(each_eaup_name,'实时优化','后再生盘管温度上限','float')
         ),
-        # fan_2_Hz=(
-        #     config_reader.get_app_info(each_eaup_name,'实时优化','排风机频率下限','float'),
-        #     config_reader.get_app_info(each_eaup_name,'实时优化','排风机频率上限','float')
-        # ),
         fan_2_Hz   = None,
         constrains = constrains,
         logging    = False,
@@ -300,7 +296,7 @@ def push_result(
                         'name'      : '前再生加热温度',
                         'rcmd_value': opt_result['opt_var'][0].round(1).iat[0,0],
                         'curr_value': data_cur.loc[:,['wheel_1_TinR']].round(1).iat[0,0],
-                        'point_id'  : equp_point['wheel_1_TinR_AISP']
+                        'point_id'  : f'{each_eaup_name}_{equp_point["wheel_1_TinR_AISP"]}'
                     }
                 ]
             },
@@ -312,22 +308,10 @@ def push_result(
                         'name'      : '后再生加热温度',
                         'rcmd_value': opt_result['opt_var'][1].round(1).iat[0,0],
                         'curr_value': data_cur.loc[:,['wheel_2_TinR']].round(1).iat[0,0],
-                        'point_id'  : equp_point['wheel_2_TinR_AISP']
+                        'point_id'  : f'{each_eaup_name}_{equp_point["wheel_2_TinR_AISP"]}'
                     }
                 ]
             },
-            # {
-            #     'name'      : '排风机频率',
-            #     'rcmd_value': opt_result['opt_var'][2].iat[0,0],
-            #     'children'  : [
-            #         {
-            #             'name'      : '排风机频率',
-            #             'rcmd_value': opt_result['opt_var'][2].round(1).iat[0,0],
-            #             'curr_value': data_cur.loc[:,['fan_2_Hz']].round(1).iat[0,0],
-            #             'point_id'  : equp_point['fan_2_Hz_AISP']
-            #         }
-            #     ]
-            # }
         ]
     else:
         raise Exception('MODEL_TYPE_ERROR')
@@ -335,7 +319,7 @@ def push_result(
     if config_reader.get_app_info(each_eaup_name,'实时优化','推送策略','bool'):
         add_ai_rcmd_operation(
             code           = each_eaup_name_short,
-            job_id         = None,
+            job_id         = os.environ.get('JOB_ID', None),
             rcmd           = rcmd,
             custom_details = []
         )

+ 1 - 1
apps/DHU/train.py

@@ -25,7 +25,7 @@ def train(*inputs,config=None):
         config_reader_path = '/mnt/workflow_data'
         data_URL           = 'http://basedataportal-svc:8080/data/getpointsdata'
         
-    config_reader = ConfigReader(path=f'{config_reader_path}/DHU_AB配置.xlsx')
+    config_reader = ConfigReader(path=f'{config_reader_path}/DHU.xlsx')
     
     ALL_RESULT = {
         'EXCEPTION':{

+ 2 - 2
main.py

@@ -10,9 +10,9 @@ def main(*args,config=None):
             from .apps.DHU.train import train
             train(*args,config=config)
         else:
-            raise NotImplementedError
+            raise NotImplementedError(mode)
     else:
-        raise NotImplementedError
+        raise NotImplementedError(equp_type)