|
@@ -1,3 +1,4 @@
|
|
|
+
|
|
|
from LIB.MIDDLE.FaultDetection.V1_0_2.aelstm import *
|
|
|
import pymysql
|
|
|
import datetime
|
|
@@ -20,6 +21,7 @@ import re
|
|
|
#...................................故障检测函数......................................................................................................................
|
|
|
def diag_cal():
|
|
|
global SNnums
|
|
|
+ global scaler_dict, scaler2_dict, model_dict, model2_dict
|
|
|
|
|
|
start=time.time()
|
|
|
now_time=datetime.datetime.now()
|
|
@@ -49,25 +51,7 @@ def diag_cal():
|
|
|
"mysql+pymysql://{}:{}@{}:{}/{}?charset=utf8".format(
|
|
|
user, parse.quote_plus(password), host, port, db
|
|
|
))
|
|
|
-
|
|
|
- scaler_list=[]
|
|
|
- scaler2_list=[]
|
|
|
- model_list=[]
|
|
|
- model2_list=[]
|
|
|
- for group in ['MGMLX','PK504','PK502','PK500','MGMCL']:
|
|
|
- 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'))
|
|
|
- model = load_model('LIB/MIDDLE/FaultDetection/V1_0_2/train_out/modelV_'+group+'_10.h5')
|
|
|
- model2 = load_model('LIB/MIDDLE/FaultDetection/V1_0_2/train_out/modelT_'+group+'_10.h5')
|
|
|
- scaler_list.append(scaler)
|
|
|
- scaler2_list.append(scaler2)
|
|
|
- model_list.append(model)
|
|
|
- model2_list.append(model2)
|
|
|
- scaler_dict={'MGMLX':scaler_list[0],'PK504':scaler_list[1],'PK502':scaler_list[2],'PK500':scaler_list[3],'MGMCL':scaler_list[4]}
|
|
|
- scaler2_dict={'MGMLX':scaler2_list[0],'PK504':scaler2_list[1],'PK502':scaler2_list[2],'PK500':scaler2_list[3],'MGMCL':scaler2_list[4]}
|
|
|
- model_dict={'MGMLX':model_list[0],'PK504':model_list[1],'PK502':model_list[2],'PK500':model_list[3],'MGMCL':model_list[4]}
|
|
|
- model2_dict={'MGMLX':model2_list[0],'PK504':model2_list[1],'PK502':model2_list[2],'PK500':model2_list[3],'MGMCL':model2_list[4]}
|
|
|
-
|
|
|
+
|
|
|
|
|
|
#调用主函数................................................................................................................................................................
|
|
|
for sn in SNnums:
|
|
@@ -162,6 +146,24 @@ if __name__ == "__main__":
|
|
|
|
|
|
SNnums = list(df_sn['sn'])
|
|
|
|
|
|
+ scaler_list=[]
|
|
|
+ scaler2_list=[]
|
|
|
+ model_list=[]
|
|
|
+ model2_list=[]
|
|
|
+ for group in ['MGMLX','PK504','PK502','PK500','MGMCL']:
|
|
|
+ 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'))
|
|
|
+ model = load_model('LIB/MIDDLE/FaultDetection/V1_0_2/train_out/modelV_'+group+'_10.h5')
|
|
|
+ model2 = load_model('LIB/MIDDLE/FaultDetection/V1_0_2/train_out/modelT_'+group+'_10.h5')
|
|
|
+ scaler_list.append(scaler)
|
|
|
+ scaler2_list.append(scaler2)
|
|
|
+ model_list.append(model)
|
|
|
+ model2_list.append(model2)
|
|
|
+ scaler_dict={'MGMLX':scaler_list[0],'PK504':scaler_list[1],'PK502':scaler_list[2],'PK500':scaler_list[3],'MGMCL':scaler_list[4]}
|
|
|
+ scaler2_dict={'MGMLX':scaler2_list[0],'PK504':scaler2_list[1],'PK502':scaler2_list[2],'PK500':scaler2_list[3],'MGMCL':scaler2_list[4]}
|
|
|
+ model_dict={'MGMLX':model_list[0],'PK504':model_list[1],'PK502':model_list[2],'PK500':model_list[3],'MGMCL':model_list[4]}
|
|
|
+ model2_dict={'MGMLX':model2_list[0],'PK504':model2_list[1],'PK502':model2_list[2],'PK500':model2_list[3],'MGMCL':model2_list[4]}
|
|
|
+ logger.info("模型加载完成")
|
|
|
|
|
|
diag_cal()
|
|
|
#定时任务.......................................................................................................................................................................
|
|
@@ -173,4 +175,4 @@ if __name__ == "__main__":
|
|
|
except Exception as e:
|
|
|
scheduler.shutdown()
|
|
|
logger.error(str(e))
|
|
|
- logger.error(traceback.format_exc())
|
|
|
+ logger.error(traceback.format_exc())
|