Przeglądaj źródła

变更故障码方式及故障等级

Eric412V 2 lat temu
rodzic
commit
6d3054926f

+ 4 - 4
LIB/MIDDLE/SaftyCenter/DataDiag_Static/SC_CtrlSafty.py

@@ -53,19 +53,19 @@ class CtrlSafty:
         OtherTempMax=OtherTempMax[OtherTempMax[OtherTempNum]<(param.OtherOTlmt+5)].dropna(axis=0,how='all')
         if len(CellTempMax) and len(OtherTempMax):
             QuitErrCount[57]=0
-            if not 57 in df_Diag_Ram['code'].values.tolist():#如果故障发生当前故障中没有该故障,则压入该故障
-                df_Diag_Ram.loc[len(df_Diag_Ram)]=[bms_info.loc[len(bms_info)-1,'时间戳'],'0000-00-00 00:00:00',sn,57,4,'电芯温度高','立即联系用户确认电池状态']
+            if not 'C357' in df_Diag_Ram['code'].values.tolist():#如果故障发生当前故障中没有该故障,则压入该故障
+                df_Diag_Ram.loc[len(df_Diag_Ram)]=[bms_info.loc[len(bms_info)-1,'时间戳'],'0000-00-00 00:00:00',sn,'C357',3,'电芯温度高','立即联系用户确认电池状态']
                 ErrorFlg=1            
             else:#如果故障发生当前故障中有该故障,则不进行操作
                 pass
         else:
-            if 57 in df_Diag_Ram['code'].values.tolist():
+            if 'C357' in df_Diag_Ram['code'].values.tolist():
                 QuitErrCount[57]=QuitErrCount[57]+1
                 if QuitErrCount[57]>3:
                     QuitErrCount[57]=4
                     end_time=datetime.datetime.now()
                     end_time=end_time.strftime('%Y-%m-%d %H:%M:%S')
-                    df_Diag_Ram.loc[df_Diag_Ram[df_Diag_Ram['code']==57].index,['end_time']]=end_time
+                    df_Diag_Ram.loc[df_Diag_Ram[df_Diag_Ram['code']=='C357'].index,['end_time']]=end_time
                 else:
                     pass
             else:

+ 50 - 50
LIB/MIDDLE/SaftyCenter/DataDiag_Static/SC_SamplingSafty.py

@@ -67,38 +67,38 @@ class SamplingSafty:
         if len(InVMaxBatNo):
             if len(InVMinBatNo):
                 QuitErrCount[10]=0
-                if not 10 in df_Diag_Ram['code'].values.tolist():#如果故障发生当前故障中没有该故障,则压入该故障
-                    df_Diag_Ram.loc[len(df_Diag_Ram)]=[bms_infoN['时间戳'],'0000-00-00 00:00:00',sn,10,2,'电池电压采样断线,最高电压为{:.2f}V,电池编号为{},最低电压为{:.2f}V,电池编号为{}'.format(MaxVolt,InVMaxBatNo.values,MinVolt,InVMinBatNo.values),'返厂维修']
+                if not 'C310' in df_Diag_Ram['code'].values.tolist():#如果故障发生当前故障中没有该故障,则压入该故障
+                    df_Diag_Ram.loc[len(df_Diag_Ram)]=[bms_infoN['时间戳'],'0000-00-00 00:00:00',sn,'C310',3,'电池电压采样断线,最高电压为{:.2f}V,电池编号为{},最低电压为{:.2f}V,电池编号为{}'.format(MaxVolt,InVMaxBatNo.values,MinVolt,InVMinBatNo.values),'返厂维修']
                     ErrorFlg=1  
                 else:#如果故障发生当前故障中有该故障,则不进行操作
                     pass                 
             else:#如果没有故障,并且当前故障表中有该故障,则判断故障是否结束
                 QuitErrCount[50]=0
-                if 10 in df_Diag_Ram['code'].values.tolist():
+                if 'C310' in df_Diag_Ram['code'].values.tolist():
                     QuitErrCount[10]=QuitErrCount[10]+1
                     if QuitErrCount[10]>3:
                         QuitErrCount[10]=4
                         end_time=datetime.datetime.now()
                         end_time=end_time.strftime('%Y-%m-%d %H:%M:%S')
-                        df_Diag_Ram.loc[df_Diag_Ram[df_Diag_Ram['code']==10].index,['end_time']]=end_time
+                        df_Diag_Ram.loc[df_Diag_Ram[df_Diag_Ram['code']=='C310'].index,['end_time']]=end_time
                     else:
                         pass
                 else:
                     pass
-                if not 50 in df_Diag_Ram['code'].values.tolist():
-                    df_Diag_Ram.loc[len(df_Diag_Ram)]=[bms_infoN['时间戳'],'0000-00-00 00:00:00',sn,50,2,str(InVMaxBatNo.values)+'号电压大于{:.2f}V,采样无效'.format(param.CellOVlmt),'返厂维修']
+                if not 'C350' in df_Diag_Ram['code'].values.tolist():
+                    df_Diag_Ram.loc[len(df_Diag_Ram)]=[bms_infoN['时间戳'],'0000-00-00 00:00:00',sn,'C350',3,str(InVMaxBatNo.values)+'号电压大于{:.2f}V,采样无效'.format(param.CellOVlmt),'返厂维修']
                     ErrorFlg=1
                 else:
                     pass
         elif len(InVMinBatNo):
             QuitErrCount[50]=0
-            if not 50 in df_Diag_Ram['code'].values.tolist():
-                df_Diag_Ram.loc[len(df_Diag_Ram)]=[bms_infoN['时间戳'],'0000-00-00 00:00:00',sn,50,2,str(InVMinBatNo.values)+'号电压小于{:.2f}V,采样无效'.format(param.CellUVlmt),'返厂维修']
+            if not 'C350' in df_Diag_Ram['code'].values.tolist():
+                df_Diag_Ram.loc[len(df_Diag_Ram)]=[bms_infoN['时间戳'],'0000-00-00 00:00:00',sn,'C350',3,str(InVMinBatNo.values)+'号电压小于{:.2f}V,采样无效'.format(param.CellUVlmt),'返厂维修']
                 ErrorFlg=1
             else:
                 pass
         else:
-            if 50 in df_Diag_Ram['code'].values.tolist():
+            if 'C350' in df_Diag_Ram['code'].values.tolist():
                 QuitErrCount[50]=QuitErrCount[50]+1
                 if QuitErrCount[50]>3:
                     QuitErrCount[50]=4
@@ -113,25 +113,25 @@ class SamplingSafty:
         if ErrorFlg==0:
             AvgVolGap=CellVoltage-AvgVol
             OutlierVolNo=AvgVolGap[AvgVolGap>=param.AvgVolGap].index
-            if len(OutlierVolNo) and abs(bms_infoN['总电流[A]'])<2 and not 51 in df_Diag_Ram['code']:
+            if len(OutlierVolNo) and abs(bms_infoN['总电流[A]'])<2 and not 'C251' in df_Diag_Ram['code']:
                 VolCount=VolCount+1
                 QuitErrCount[51]=0
                 if VolCount>10:
                     VolCount=11
-                    if not 51 in df_Diag_Ram['code'].values.tolist():#如果故障发生当前故障中没有该故障,则压入该故障
-                        df_Diag_Ram.loc[len(df_Diag_Ram)]=[bms_infoN['时间戳'],'0000-00-00 00:00:00',sn,51,2,str(OutlierVolNo.values)+'号电池电压离群','技术介入诊断']
+                    if not 'C251' in df_Diag_Ram['code'].values.tolist():#如果故障发生当前故障中没有该故障,则压入该故障
+                        df_Diag_Ram.loc[len(df_Diag_Ram)]=[bms_infoN['时间戳'],'0000-00-00 00:00:00',sn,'C251',2,str(OutlierVolNo.values)+'号电池电压离群','技术介入诊断']
                         ErrorFlg=1            
                     else:#如果故障发生当前故障中有该故障,则不进行操作
                         pass                
             else:
                 VolCount=0
-                if 51 in df_Diag_Ram['code'].values.tolist():
+                if 'C251' in df_Diag_Ram['code'].values.tolist():
                     QuitErrCount[51]=QuitErrCount[51]+1
                     if QuitErrCount[51]>3:
                         QuitErrCount[51]=4
                         end_time=datetime.datetime.now()
                         end_time=end_time.strftime('%Y-%m-%d %H:%M:%S')
-                        df_Diag_Ram.loc[df_Diag_Ram[df_Diag_Ram['code']==51].index,['end_time']]=end_time                
+                        df_Diag_Ram.loc[df_Diag_Ram[df_Diag_Ram['code']=='C251'].index,['end_time']]=end_time                
                     else:
                         pass
                 else:
@@ -176,44 +176,44 @@ class SamplingSafty:
         if len(InVMaxTempBatNo):
             if len(InVMinTempBatNo):
                 QuitErrCount[53]=0
-                if not 53 in df_Diag_Ram['code'].values.tolist():#如果故障发生当前故障中没有该故障,则压入该故障
-                    df_Diag_Ram.loc[len(df_Diag_Ram)]=[bms_infoN['时间戳'],'0000-00-00 00:00:00',sn,53,2,'电池温度采样断线,最高温度为{}℃,电池编号为{},最低温度为{}℃,电池编号为{}'.format(maxCellTemp,InVMaxTempBatNo.values,minCellTemp,InVMinTempBatNo.values),'返厂维修']
+                if not 'C353' in df_Diag_Ram['code'].values.tolist():#如果故障发生当前故障中没有该故障,则压入该故障
+                    df_Diag_Ram.loc[len(df_Diag_Ram)]=[bms_infoN['时间戳'],'0000-00-00 00:00:00',sn,'C353',3,'电池温度采样断线,最高温度为{}℃,电池编号为{},最低温度为{}℃,电池编号为{}'.format(maxCellTemp,InVMaxTempBatNo.values,minCellTemp,InVMinTempBatNo.values),'返厂维修']
                     ErrorFlg=1 
                 else:#如果故障发生当前故障中有该故障,则不进行操作
                     pass                 
             else:#如果没有故障,并且当前故障表中有该故障,则判断故障是否结束
                 QuitErrCount[2]=0
-                if 53 in df_Diag_Ram['code'].values.tolist():
+                if 'C353' in df_Diag_Ram['code'].values.tolist():
                     QuitErrCount[53]=QuitErrCount[53]+1
                     if QuitErrCount[53]>3:
                         QuitErrCount[53]=4
                         end_time=datetime.datetime.now()
                         end_time=end_time.strftime('%Y-%m-%d %H:%M:%S')
-                        df_Diag_Ram.loc[df_Diag_Ram[df_Diag_Ram['code']==53].index,['end_time']]=end_time
+                        df_Diag_Ram.loc[df_Diag_Ram[df_Diag_Ram['code']=='C353'].index,['end_time']]=end_time
                     else:
                         pass
                 else:
                     pass
-                if not 2 in df_Diag_Ram['code'].values.tolist():
-                    df_Diag_Ram.loc[len(df_Diag_Ram)]=[bms_infoN['时间戳'],'0000-00-00 00:00:00',sn,2,2,str(InVMaxTempBatNo.values)+'号温度大于{}℃,采样无效'.format(param.PackOTlmt),'联系用户核实电池温度情况,并返厂维修']
+                if not 'C302' in df_Diag_Ram['code'].values.tolist():
+                    df_Diag_Ram.loc[len(df_Diag_Ram)]=[bms_infoN['时间戳'],'0000-00-00 00:00:00',sn,'C302',3,str(InVMaxTempBatNo.values)+'号温度大于{}℃,采样无效'.format(param.PackOTlmt),'联系用户核实电池温度情况,并返厂维修']
                     ErrorFlg=1
                 else:
                     pass
         elif len(InVMinTempBatNo):
             QuitErrCount[2]=0
-            if not 2 in df_Diag_Ram['code'].values.tolist():
-                df_Diag_Ram.loc[len(df_Diag_Ram)]=[bms_infoN['时间戳'],'0000-00-00 00:00:00',sn,2,2,str(InVMinTempBatNo.values)+'号温度小于{}℃,采样无效'.format(param.PackUTlmt),'返厂维修']
+            if not 'C302' in df_Diag_Ram['code'].values.tolist():
+                df_Diag_Ram.loc[len(df_Diag_Ram)]=[bms_infoN['时间戳'],'0000-00-00 00:00:00',sn,'C302',3,str(InVMinTempBatNo.values)+'号温度小于{}℃,采样无效'.format(param.PackUTlmt),'返厂维修']
                 ErrorFlg=1
             else:
                 pass
         else:
-            if 2 in df_Diag_Ram['code'].values.tolist():
+            if 'C302' in df_Diag_Ram['code'].values.tolist():
                 QuitErrCount[2]=QuitErrCount[2]+1
                 if QuitErrCount[2]>3:
                     QuitErrCount[2]=4
                     end_time=datetime.datetime.now()
                     end_time=end_time.strftime('%Y-%m-%d %H:%M:%S')
-                    df_Diag_Ram.loc[df_Diag_Ram[df_Diag_Ram['code']==2].index,['end_time']]=end_time                   
+                    df_Diag_Ram.loc[df_Diag_Ram[df_Diag_Ram['code']=='C302'].index,['end_time']]=end_time                   
                 else:
                     pass
             else:
@@ -223,19 +223,19 @@ class SamplingSafty:
             OutlierTempNo=AvgCellTempGap[AvgCellTempGap>=param.AvgCellTempGap].index
             if len(OutlierTempNo):
                 QuitErrCount[8]=0
-                if not 8 in df_Diag_Ram['code'].values.tolist():#如果故障发生当前故障中没有该故障,则压入该故障
-                    df_Diag_Ram.loc[len(df_Diag_Ram)]=[bms_infoN['时间戳'],'0000-00-00 00:00:00',sn,8,2,str(OutlierTempNo.values)+'号电池异常温度离群','技术介入诊断']
+                if not 'C108' in df_Diag_Ram['code'].values.tolist():#如果故障发生当前故障中没有该故障,则压入该故障
+                    df_Diag_Ram.loc[len(df_Diag_Ram)]=[bms_infoN['时间戳'],'0000-00-00 00:00:00',sn,'C108',1,str(OutlierTempNo.values)+'号电池异常温度离群','技术介入诊断']
                     ErrorFlg=1            
                 else:#如果故障发生当前故障中有该故障,则不进行操作
                     pass
             else:
-                if 8 in df_Diag_Ram['code'].values.tolist():
+                if 'C108' in df_Diag_Ram['code'].values.tolist():
                     QuitErrCount[8]=QuitErrCount[8]+1
                     if QuitErrCount[8]>3:
                         QuitErrCount[8]=4
                         end_time=datetime.datetime.now()
                         end_time=end_time.strftime('%Y-%m-%d %H:%M:%S')
-                        df_Diag_Ram.loc[df_Diag_Ram[df_Diag_Ram['code']==8].index,['end_time']]=end_time
+                        df_Diag_Ram.loc[df_Diag_Ram[df_Diag_Ram['code']=='C108'].index,['end_time']]=end_time
                     else:
                         pass
                 else:
@@ -263,44 +263,44 @@ class SamplingSafty:
             if len(InVMaxOtherTempBatNo):
                 if len(InVMinOtherTempBatNo):
                     QuitErrCount[54]=0
-                    if not 54 in df_Diag_Ram['code'].values.tolist():#如果故障发生当前故障中没有该故障,则压入该故障
-                        df_Diag_Ram.loc[len(df_Diag_Ram)]=[bms_infoN['时间戳'],'0000-00-00 00:00:00',sn,54,2,'其他温度采样断线,最高温度为{}℃,传感器编号为{},最低温度为{}℃,传感器编号为{}'.format(maxOtherTemp,InVMaxOtherTempBatNo.values,minOtherTemp,InVMinOtherTempBatNo.values),'返厂维修']
+                    if not 'C354' in df_Diag_Ram['code'].values.tolist():#如果故障发生当前故障中没有该故障,则压入该故障
+                        df_Diag_Ram.loc[len(df_Diag_Ram)]=[bms_infoN['时间戳'],'0000-00-00 00:00:00',sn,'C354',3,'其他温度采样断线,最高温度为{}℃,传感器编号为{},最低温度为{}℃,传感器编号为{}'.format(maxOtherTemp,InVMaxOtherTempBatNo.values,minOtherTemp,InVMinOtherTempBatNo.values),'返厂维修']
                         ErrorFlg=1 
                     else:#如果故障发生当前故障中有该故障,则不进行操作
                         pass                 
                 else:#如果没有故障,并且当前故障表中有该故障,则判断故障是否结束
                     QuitErrCount[55]=0
-                    if 54 in df_Diag_Ram['code'].values.tolist():
+                    if 'C354' in df_Diag_Ram['code'].values.tolist():
                         QuitErrCount[54]=QuitErrCount[54]+1
                         if QuitErrCount[54]>3:
                             QuitErrCount[54]=4
                             end_time=datetime.datetime.now()
                             end_time=end_time.strftime('%Y-%m-%d %H:%M:%S')
-                            df_Diag_Ram.loc[df_Diag_Ram[df_Diag_Ram['code']==54].index,['end_time']]=end_time
+                            df_Diag_Ram.loc[df_Diag_Ram[df_Diag_Ram['code']=='C354'].index,['end_time']]=end_time
                         else:
                             pass
                     else:
                         pass
-                    if not 55 in df_Diag_Ram['code'].values.tolist():
-                        df_Diag_Ram.loc[len(df_Diag_Ram)]=[bms_infoN['时间戳'],'0000-00-00 00:00:00',sn,55,2,'传感器温度大于{}℃,采样无效'.format(param.OtherOTlmt),'联系用户核实电池温度情况,并返厂维修']
+                    if not 'C355' in df_Diag_Ram['code'].values.tolist():
+                        df_Diag_Ram.loc[len(df_Diag_Ram)]=[bms_infoN['时间戳'],'0000-00-00 00:00:00',sn,'C355',3,'传感器温度大于{}℃,采样无效'.format(param.OtherOTlmt),'联系用户核实电池温度情况,并返厂维修']
                         ErrorFlg=1
                     else:
                         pass
             elif len(InVMinTempBatNo):
                 QuitErrCount[55]=0
-                if not 55 in df_Diag_Ram['code'].values.tolist():
-                    df_Diag_Ram.loc[len(df_Diag_Ram)]=[bms_infoN['时间戳'],'0000-00-00 00:00:00',sn,55,2,'传感器温度小于{}℃,采样无效'.format(param.OtherUTlmt),'返厂维修']
+                if not 'C355' in df_Diag_Ram['code'].values.tolist():
+                    df_Diag_Ram.loc[len(df_Diag_Ram)]=[bms_infoN['时间戳'],'0000-00-00 00:00:00',sn,'C355',3,'传感器温度小于{}℃,采样无效'.format(param.OtherUTlmt),'返厂维修']
                     ErrorFlg=1
                 else:
                     pass
             else:
-                if 55 in df_Diag_Ram['code'].values.tolist():
+                if 'C355' in df_Diag_Ram['code'].values.tolist():
                     QuitErrCount[55]=QuitErrCount[55]+1
                     if QuitErrCount[55]>3:
                         QuitErrCount[55]=4
                         end_time=datetime.datetime.now()
                         end_time=end_time.strftime('%Y-%m-%d %H:%M:%S')
-                        df_Diag_Ram.loc[df_Diag_Ram[df_Diag_Ram['code']==55].index,['end_time']]=end_time                   
+                        df_Diag_Ram.loc[df_Diag_Ram[df_Diag_Ram['code']=='C355'].index,['end_time']]=end_time                   
                     else:
                         pass
                 else:
@@ -310,19 +310,19 @@ class SamplingSafty:
                 OutlierOtherTempNo=AvgOtherTempGap[AvgOtherTempGap>=param.AvgOtherTempGap].index
                 if len(OutlierOtherTempNo):
                     QuitErrCount[56]=0
-                    if not 56 in df_Diag_Ram['code'].values.tolist():#如果故障发生当前故障中没有该故障,则压入该故障
-                        df_Diag_Ram.loc[len(df_Diag_Ram)]=[bms_infoN['时间戳'],'0000-00-00 00:00:00',sn,56,2,'传感器温度异常离群','技术介入诊断']
+                    if not 'C156' in df_Diag_Ram['code'].values.tolist():#如果故障发生当前故障中没有该故障,则压入该故障
+                        df_Diag_Ram.loc[len(df_Diag_Ram)]=[bms_infoN['时间戳'],'0000-00-00 00:00:00',sn,'C156',1,'传感器温度异常离群','技术介入诊断']
                         ErrorFlg=1            
                     else:#如果故障发生当前故障中有该故障,则不进行操作
                         pass
                 else:
-                    if 56 in df_Diag_Ram['code'].values.tolist():
+                    if 'C156' in df_Diag_Ram['code'].values.tolist():
                         QuitErrCount[56]=QuitErrCount[56]+1
                         if QuitErrCount[56]>3:
                             QuitErrCount[56]=4
                             end_time=datetime.datetime.now()
                             end_time=end_time.strftime('%Y-%m-%d %H:%M:%S')
-                            df_Diag_Ram.loc[df_Diag_Ram[df_Diag_Ram['code']==56].index,['end_time']]=end_time
+                            df_Diag_Ram.loc[df_Diag_Ram[df_Diag_Ram['code']=='C156'].index,['end_time']]=end_time
                         else:
                             pass
                     else:
@@ -330,31 +330,31 @@ class SamplingSafty:
 
                 if (maxOtherTemp-maxCellTemp)>param.AvgOtherTempGap and  maxOtherTemp<param.OtherOTlmt and maxCellTemp<param.PackOTlmt:
                     QuitErrCount[56]=0
-                    if not 56 in df_Diag_Ram['code'].values.tolist():
-                        df_Diag_Ram.loc[len(df_Diag_Ram)]=[bms_infoN['时间戳'],'0000-00-00 00:00:00',sn,56,2,'传感器温度异常离群','技术立即介入诊断']
+                    if not 'C156' in df_Diag_Ram['code'].values.tolist():
+                        df_Diag_Ram.loc[len(df_Diag_Ram)]=[bms_infoN['时间戳'],'0000-00-00 00:00:00',sn,'C156',1,'传感器温度异常离群','技术立即介入诊断']
                         ErrorFlg=1
                 else:
-                    if 56 in df_Diag_Ram['code'].values.tolist():
+                    if 'C156' in df_Diag_Ram['code'].values.tolist():
                             QuitErrCount[56]=QuitErrCount[56]+1
                             if QuitErrCount[56]>3:
                                 QuitErrCount[56]=4
                                 end_time=datetime.datetime.now()
                                 end_time=end_time.strftime('%Y-%m-%d %H:%M:%S')
-                                df_Diag_Ram.loc[df_Diag_Ram[df_Diag_Ram['code']==56].index,['end_time']]=end_time
+                                df_Diag_Ram.loc[df_Diag_Ram[df_Diag_Ram['code']=='C156'].index,['end_time']]=end_time
                                 
                 if (maxCellTemp-maxOtherTemp)>param.AvgOtherTempGap and  maxOtherTemp<param.OtherOTlmt and maxCellTemp<param.PackOTlmt and not 8 in df_Diag_Ram['code']:
                     QuitErrCount[8]=0
-                    if not 8 in df_Diag_Ram['code'].values.tolist():
-                        df_Diag_Ram.loc[len(df_Diag_Ram)]=[bms_infoN['时间戳'],'0000-00-00 00:00:00',sn,8,2,str(OutlierTempNo.values)+'号电芯温度异常离群','技术立即介入诊断']
+                    if not 'C108' in df_Diag_Ram['code'].values.tolist():
+                        df_Diag_Ram.loc[len(df_Diag_Ram)]=[bms_infoN['时间戳'],'0000-00-00 00:00:00',sn,'C108',1,str(OutlierTempNo.values)+'号电芯温度异常离群','技术立即介入诊断']
                         
                         ErrorFlg=1
                 else:
-                    if 8 in df_Diag_Ram['code'].values.tolist():
+                    if 'C108' in df_Diag_Ram['code'].values.tolist():
                             QuitErrCount[8]=QuitErrCount[8]+1
                             if QuitErrCount[8]>3:
                                 QuitErrCount[8]=4
                                 end_time=datetime.datetime.now()
                                 end_time=end_time.strftime('%Y-%m-%d %H:%M:%S')
-                                df_Diag_Ram.loc[df_Diag_Ram[df_Diag_Ram['code']==8].index,['end_time']]=end_time              
+                                df_Diag_Ram.loc[df_Diag_Ram[df_Diag_Ram['code']=='C108'].index,['end_time']]=end_time              
 
         return df_Diag_Ram