qingfeng hace 2 años
padre
commit
0dcfe4d8bc
Se han modificado 1 ficheros con 4 adiciones y 2 borrados
  1. 4 2
      LIB/FRONTEND/FaultDetection/main_pred.py

+ 4 - 2
LIB/FRONTEND/FaultDetection/main_pred.py

@@ -36,11 +36,11 @@ def diag_cal():
     password='Qx@123456'
 
     #读取结果库数据......................................................
-    param='product_id,start_time,end_time,diff_min,SOC[%],AnoScoreV_sum_max,AnoScoreV_max_max,AnoScoreT_sum_max,AnoScoreT_max_max'
+    param='product_id,start_time,end_time,diff_min,SOC,AnoScoreV_sum_max,AnoScoreV_max_max,AnoScoreT_sum_max,AnoScoreT_max_max'
     tablename='fault_detection'
     mysql = pymysql.connect (host=host, user=user, password=password, port=port, database=db)
     cursor = mysql.cursor()
-    sql =  "select '{}' from {} where end_time='0000-00-00 00:00:00'".format(param,tablename)
+    sql =  "select {} from {} where end_time='0000-00-00 00:00:00'".format(param,tablename)
     cursor.execute(sql)
     res = cursor.fetchall()
     df_diag_ram= pd.DataFrame(res,columns=param.split(','))
@@ -60,11 +60,13 @@ def diag_cal():
             data_bms = df_data['bms']
             data_bms['sn']=sn
             if len(data_bms)>0:
+                logger.info("SN: {} 数据开始预处理".format(sn))
                 data_stand=data_groups(data_bms,sn,start_time,end_time)
                 df_stand=split(data_stand)   
                 res=pd.DataFrame()
                 if len(df_stand)>0:
                     #读取训练产出的缩放指标:均值&方差
+                    logger.info("SN: {} 数据开始模型预测".format(sn))
                     scaler = pickle.load(open('LIB/MIDDLE/FaultDetection/V1_0_2/train_out/scalerV_'+group+'_10.pkl', 'rb'))
                     scaler2 = pickle.load(open('LIB/MIDDLE/FaultDetection/V1_0_2/train_out/scalerT_'+group+'_10.pkl', 'rb'))
                     #读取训练产出的模型状态空间:电压模型&温度模型