Browse Source

更新LFP一致性计算

qingfeng 3 years ago
parent
commit
91d1ef03e0
1 changed files with 11 additions and 9 deletions
  1. 11 9
      LIB/MIDDLE/DeltSoc/LFPDeltSoc20210804.py

+ 11 - 9
LIB/MIDDLE/DeltSoc/LFPDeltSoc20210804.py

@@ -40,7 +40,6 @@ def cal_deltsoc(sn, end_time, start_time):
     # 筛选充电数据
     ChgStart = []
     ChgEnd = []
-
     for i in range(3, len(time) - 3):
         if i==3 and bmsstat[i]==2 and bmsstat[i+1]==2 and bmsstat[i+2]==2:
             ChgStart.append(i)
@@ -52,10 +51,9 @@ def cal_deltsoc(sn, end_time, start_time):
             ChgEnd.append(len(time)-1)
 
     # 筛选充电起始Soc<46%,电芯温度>15℃的数据
+    ChgStartValid = []
+    ChgEndValid = []
     if ChgStart:
-        ChgStartValid = []
-        ChgEndValid = []
-
         for i in range(min(len(ChgStart),len(ChgEnd))):
             # 获取最小温度值
             celltemp = []
@@ -64,7 +62,7 @@ def cal_deltsoc(sn, end_time, start_time):
                 temp = df_bms['单体温度' + s]
                 celltemp.append(temp[ChgEnd[i]])
 
-            if SOC[ChgStart[i]] < 46 and SOC[ChgEnd[i]]>80 and min(celltemp) > 10:
+            if SOC[ChgStart[i]] < 46 and SOC[ChgEnd[i]]>85 and min(celltemp) > 10 and (ChgEnd[i]-ChgStart[i])>10:
                 if ((time[ChgEnd[i]]-time[ChgStart[i]]).total_seconds())/(ChgEnd[i]-ChgStart[i])<30:
                     ChgStartValid.append(ChgStart[i])
                     ChgEndValid.append(ChgEnd[i])
@@ -106,7 +104,7 @@ def cal_deltsoc(sn, end_time, start_time):
                                 'DVDQ': DVDQ,
                                 'AhSOC': soc1})
 
-        df_Data1 = df_Data1[(df_Data1['SOC'] > 50) & (df_Data1['SOC'] < 75)]
+        df_Data1 = df_Data1[(df_Data1['SOC'] > 50) & (df_Data1['SOC'] < 80)]
         # 寻找峰值点,且峰值点个数>3
         if len(df_Data1['DVDQ'])>2:
             PeakIndex = df_Data1['DVDQ'].idxmax()
@@ -140,12 +138,16 @@ def cal_deltsoc(sn, end_time, start_time):
                     DetaSoc1.append(a)  # 计算到达峰值点的累计Soc
             if DetaSoc1:
                 DetaSoc2.append(max(DetaSoc1) - min(DetaSoc1))
-                DetaSoc_time.append(time[ChgStartValid[i]])
-                DetaSoc_SN.append(SNnum)
+
+        DetaSocMean = np.mean(DetaSoc2)
+        DetaSoc.append(DetaSocMean)
+        DetaSoc_SN.append(SNnum)
+        DetaSoc_time.append(time[ChgStartValid[-1]])
+
 
         result_DetaSoc={'time':DetaSoc_time,
                         'SN号':DetaSoc_SN,
-                        'Soc差':DetaSoc2}
+                        'Soc差':DetaSoc}
         Result_DetaSoc=pd.DataFrame(result_DetaSoc)
         return Result_DetaSoc
     return pd.DataFrame()