|
@@ -55,7 +55,7 @@ for k in range(l):
|
|
|
df_data = dbManager.get_data(sn=sn, start_time=start_time, end_time=end_time, data_groups=['bms'])
|
|
|
data_test = df_data['bms']
|
|
|
data_test=data_test[data_test['SOC[%]']>20]
|
|
|
- if len(data_test)>0:
|
|
|
+ if len(data_test)>5:
|
|
|
pca1 = joblib.load('pca1_'+sn+'.m')
|
|
|
pca2 = joblib.load('pca2_'+sn+'.m')
|
|
|
res1 = pd.read_csv('res1_'+sn+'.csv',encoding='gbk')
|
|
@@ -64,12 +64,10 @@ for k in range(l):
|
|
|
outliers1=detect_outliers(res1,pred1,threshold=30)
|
|
|
outliers2=detect_outliers(res2,pred2,threshold=16)
|
|
|
if (len(outliers1)>0) & (len(outliers2)>0):
|
|
|
- outliers=check_anomaly(outliers1,outliers2)
|
|
|
+ outliers=check_anomaly(outliers1,outliers2,res2)
|
|
|
if len(outliers)>5:
|
|
|
- outliers.to_csv('outliers'+sn+'.csv',encoding='gbk')
|
|
|
outliers['sn']=sn
|
|
|
anomalies=anomalies.append(outliers)
|
|
|
- anomalies.to_csv('anomalies.csv',encoding='gbk')
|
|
|
if df_diag_ram_sn.empty:
|
|
|
product_id=sn
|
|
|
start_time=outliers.loc[0,'时间']
|