Browse Source

Merge remote-tracking branch 'origin/dev' into pro

lmstack 3 years ago
parent
commit
e2023514bb

+ 4 - 0
LIB/MIDDLE/OutlierDetection/VoltOutlier/V_1_0_0/sta.py

@@ -22,6 +22,8 @@ def cal_volt_uniform(dfin, volt_column, window=10, step=5, threshold=3):
     # 电压偏离度
     mean = df_volt_rolling.mean(axis=1)
     std = df_volt_rolling.std(axis=1)
+    # mean = [np.array(sorted(x)[1:-1]).mean() for x in df_volt_rolling.values]
+    # std = [np.array(sorted(x)[1:-1]).std() for x in df_volt_rolling.values]
     df_volt_rolling_norm = df_volt_rolling.sub(mean, axis=0).div(std,axis=0)
     df_volt_rolling_norm = df_volt_rolling_norm.reset_index(drop=True)
     return df_volt_rolling_norm, time_list
@@ -54,6 +56,8 @@ def cal_voltdiff_uniform(dfin, volt_column, window=10, step=5, window2=10, step2
     time_list = time_list[window2-1::step2] 
     mean = df_voltdiff_rolling.mean(axis=1)
     std = df_voltdiff_rolling.std(axis=1)
+    # mean = [np.array(sorted(x)[1:-1]).mean() for x in df_voltdiff_rolling.values]
+    # std = [np.array(sorted(x)[1:-1]).std() for x in df_voltdiff_rolling.values]
     df_voltdiff_rolling_norm = df_voltdiff_rolling.sub(mean, axis=0).div(std,axis=0)
     df_voltdiff_rolling_norm = df_voltdiff_rolling_norm.reset_index(drop=True)
     return df_voltdiff_rolling_norm, time_list

File diff suppressed because it is too large
+ 0 - 9
LIB/MIDDLE/OutlierDetection/VoltOutlier/main.ipynb


+ 1 - 0
LIB/MIDDLE/SaftyCenter/DataSta/DataStatistics.py

@@ -58,6 +58,7 @@ class DataSta():
         FaultLvlCount=DataFrame(columns=['level','count'])
         FaultLvlCount=df_fltinfo.groupby('level').count().T.head(1).T
         FaultLvlCount=FaultLvlCount.reset_index(drop=False)
+        
         return FaultLvlCount
     def SftyWrngClsfy(df_fltinfo):
         DsnSaftyCode=[]

+ 8 - 12
LIB/MIDDLE/SaftyCenter/DataSta/main.py

@@ -35,20 +35,16 @@ def Week_Task():
     end_time=end_time.strftime('%Y-%m-%d')
     FltAlarmInfo,Celltype=DataSta.SaftyWarningSta(CS_Data,df_fltinfo,start_time,end_time)
     FaultLvlCount=DataSta.WeekInfoSta(df_fltinfo,start_time,end_time)
-    lvl1=FaultLvlCount[FaultLvlCount['level']==1]['product_id'].values
-    lvl2=FaultLvlCount[FaultLvlCount['level']==2]['product_id'].values
-    lvl3=FaultLvlCount[FaultLvlCount['level']==3]['product_id'].values
-    lvl4=FaultLvlCount[FaultLvlCount['level']==4]['product_id'].values
-    lvl5=FaultLvlCount[FaultLvlCount['level']==5]['product_id'].values
+    for i in range(1,6):
+        if not FaultLvlCount[FaultLvlCount['level']==i]['product_id'].empty:
+            all_period_fault_info.loc[0,'level'+str(i)+'_count']=int(FaultLvlCount[FaultLvlCount['level']==i]['product_id'].values)
+        else:
+            all_period_fault_info.loc[0,'level'+str(i)+'_count']=int(0)
     all_period_fault_info.loc[0,'factory']='骑享'
     all_period_fault_info.loc[0,'week']=toweek
-    all_period_fault_info.loc[0,'level1_count']=lvl1
-    all_period_fault_info.loc[0,'level2_count']=lvl2
-    all_period_fault_info.loc[0,'level3_count']=lvl3
-    all_period_fault_info.loc[0,'level4_count']=lvl4
-    all_period_fault_info.loc[0,'level5_count']=lvl5
     all_period_fault_info.loc[0,'solve_rate']=FltAlarmInfo.loc[0,'OprationManageRate']
-    
+    all_period_fault_info.fillna(0,inplace=False)
+    print(all_period_fault_info)
 def Minutes_Task():
     
     #............................获取数据................................
@@ -129,7 +125,7 @@ def Minutes_Task():
     all_statistic_info.loc[0,'controller_safety_risk_count']=SatftyCount.loc[0,'CtrlSaftyCodeCount']
     all_statistic_info.loc[0,'design_safety_risk_count']=SatftyCount.loc[0,'DsnSaftyCodeCount']
 #定时任务....................................................................................................................................................................... 
-#Week_Task()
+Week_Task()
 Minutes_Task()
 scheduler = BlockingScheduler()
 scheduler.add_job(Week_Task, 'interval', days=7, id='Week_Task')

+ 7 - 7
LIB/MIDDLE/SaftyCenter/diagfault/main.py

@@ -10,8 +10,8 @@ from LIB.MIDDLE.CellStateEstimation.Common.V1_0_1 import DBDownload
 from LIB.MIDDLE.CellStateEstimation.Common.V1_0_1 import log
 from pandas.core.frame import DataFrame
 import datacompy
-from SaftyCenter.Common import FeiShuData
-from SaftyCenter.Common import QX_BatteryParam
+from LIB.MIDDLE.SaftyCenter.Common import FeiShuData
+from LIB.MIDDLE.SaftyCenter.SaftyCenter.Common import QX_BatteryParam
 
 #...................................电池包电芯安全诊断函数......................................................................................................................
 def diag_cal():
@@ -20,7 +20,7 @@ def diag_cal():
   
     start=time.time()
     end_time=datetime.datetime.now()
-    start_time=end_time-datetime.timedelta(seconds=130)
+    start_time=end_time-datetime.timedelta(seconds=300)
     start_time=start_time.strftime('%Y-%m-%d %H:%M:%S')
     end_time=end_time.strftime('%Y-%m-%d %H:%M:%S')
     df_read_Yunw = FeiShuData.getFeiShuDATA()#运维表格数据
@@ -125,11 +125,11 @@ def diag_cal():
             df_Diag_Ram = df_temp4
             df_Diag_Ram_fix = df_Diag_Ram.loc[df_Diag_Ram['Batpos'] == 1]
             df_Diag_Ram_unfix = df_Diag_Ram.loc[df_Diag_Ram['Batpos'] == 0]
-        if len(df_Diag_Ram) > 0:
+        if len(df_Diag_Ram) > 0:#历史及现有故障
             df_Diag_Ram.to_csv(r'D:\Work\Code_write\data_analyze_platform\USER\01Screen_Problem\result.csv',index=False,encoding='GB18030')
-        if len(df_Diag_Ram_fix) > 0:
+        if len(df_Diag_Ram_fix) > 0:#故障车辆已返仓
             df_Diag_Ram_fix.to_csv(r'D:\Work\Code_write\data_analyze_platform\USER\01Screen_Problem\result_fix.csv',index=False,encoding='GB18030')
-        if len(df_Diag_Ram_unfix) > 0:
+        if len(df_Diag_Ram_unfix) > 0:#故障车辆未返仓
             df_Diag_Ram_unfix.to_csv(r'D:\Work\Code_write\data_analyze_platform\USER\01Screen_Problemm\result_unfix.csv',index=False,encoding='GB18030')
         end=time.time()
         print(end-start)
@@ -167,7 +167,7 @@ if __name__ == "__main__":
     print('-------计算中-----------')
     #定时任务.......................................................................................................................................................................
     scheduler = BlockingScheduler()
-    scheduler.add_job(diag_cal, 'interval', seconds=120, id='diag_job')
+    scheduler.add_job(diag_cal, 'interval', seconds=300, id='diag_job')
 
     try:  
         scheduler.start()

BIN
df_file.xlsx


Some files were not shown because too many files changed in this diff