|
@@ -6,9 +6,9 @@ import datetime
|
|
|
from LIB.MIDDLE.CellStateEstimation.Common.V1_0_1 import BatParam
|
|
|
|
|
|
class BatInterShort():
|
|
|
- def __init__(self,sn,celltype,df_bms,df_soh,df_last,df_last1,df_last2,df_last3,df_lfp):
|
|
|
+ def __init__(self,sn,celltype,df_bms,df_soh,df_last,df_last1,df_last2,df_last3,df_lfp,df_chrgvolt_ram_sn):
|
|
|
|
|
|
- if (not df_lfp.empty) and celltype>50:
|
|
|
+ if (not df_lfp.empty):
|
|
|
df_lfp.drop(['sn'],axis=1)
|
|
|
df_bms=pd.concat([df_lfp, df_bms], ignore_index=True)
|
|
|
else:
|
|
@@ -30,18 +30,19 @@ class BatInterShort():
|
|
|
self.df_last2=df_last2
|
|
|
self.df_last3=df_last3
|
|
|
self.df_lfp=df_lfp
|
|
|
+ self.df_chrgvolt_ram_sn=df_chrgvolt_ram_sn
|
|
|
|
|
|
self.cellvolt_name=['单体电压'+str(x) for x in range(1,self.param.CellVoltNums+1)]
|
|
|
self.celltemp_name=['单体温度'+str(x) for x in range(1,self.param.CellTempNums+1)]
|
|
|
|
|
|
def intershort(self):
|
|
|
if self.celltype<=50:
|
|
|
- df_res, df_ram_last, df_ram_last1, df_ram_last3=self._ncm_intershort()
|
|
|
- return df_res, df_ram_last, df_ram_last1,self.df_last2, df_ram_last3,self.df_lfp
|
|
|
+ df_res, df_ram_last, df_ram_last1, df_ram_last2, df_ram_last3, df_ram_lfp, df_ram_chrgvolt=self._ncm_intershort()
|
|
|
+ return df_res, df_ram_last, df_ram_last1, df_ram_last2, df_ram_last3, df_ram_lfp, df_ram_chrgvolt
|
|
|
|
|
|
else:
|
|
|
- df_res, df_ram_last, df_ram_last1, df_ram_last2, df_ram_last3, df_ram_lfp=self._lfp_intershort()
|
|
|
- return df_res, df_ram_last, df_ram_last1, df_ram_last2, df_ram_last3, df_ram_lfp
|
|
|
+ df_res, df_ram_last, df_ram_last1, df_ram_last2, df_ram_last3, df_ram_lfp, df_ram_chrgvolt=self._lfp_intershort()
|
|
|
+ return df_res, df_ram_last, df_ram_last1, df_ram_last2, df_ram_last3, df_ram_lfp, df_ram_chrgvolt
|
|
|
|
|
|
|
|
|
|
|
@@ -115,6 +116,11 @@ class BatInterShort():
|
|
|
def _cellvolt_get(self,num):
|
|
|
cellvolt = np.array(self.df_bms.loc[num,self.cellvolt_name])/1000
|
|
|
return cellvolt
|
|
|
+
|
|
|
+
|
|
|
+ def _celltemp_get(self,num):
|
|
|
+ celltemp = np.array(self.df_bms.loc[num,self.celltemp_name])
|
|
|
+ return celltemp
|
|
|
|
|
|
|
|
|
def _celldeltsoc_get(self,cellvolt_list,dict_baltime,capacity):
|
|
@@ -123,19 +129,8 @@ class BatInterShort():
|
|
|
for j in range(self.param.CellVoltNums):
|
|
|
cellvolt=cellvolt_list[j]
|
|
|
ocv_soc=np.interp(cellvolt,self.param.LookTab_OCV,self.param.LookTab_SOC)
|
|
|
-<<<<<<< HEAD
|
|
|
- if j in dict_baltime.keys():
|
|
|
-=======
|
|
|
-<<<<<<< HEAD
|
|
|
if j+1 in dict_baltime.keys():
|
|
|
->>>>>>> dev
|
|
|
ocv_soc=ocv_soc+dict_baltime[j+1]*self.param.BalCurrent/(capacity*3600)
|
|
|
-=======
|
|
|
-
|
|
|
- if j+1 in dict_baltime.keys():
|
|
|
- ocv_soc=ocv_soc+dict_baltime[j+1]*self.param.BalCurrent/(capacity*3600)
|
|
|
-
|
|
|
->>>>>>> master
|
|
|
else:
|
|
|
pass
|
|
|
cellsoc.append(ocv_soc)
|
|
@@ -216,11 +211,51 @@ class BatInterShort():
|
|
|
|
|
|
return np.array(celldeltAs)
|
|
|
|
|
|
+
|
|
|
+ def _deltvolt(self,chrg_start,chrg_end,voltmax_index):
|
|
|
+ if self.celltype<50:
|
|
|
+ volt_list=[4.16, 4.18, 4.2]
|
|
|
+ else:
|
|
|
+ volt_list=[3.47, 3.49, 3.51]
|
|
|
+ deltvolt_list=[]
|
|
|
+ packcrnt_mean_list=[]
|
|
|
+ temp_mean_list=[]
|
|
|
+ df_chrg=self.df_bms.loc[chrg_start:chrg_end]
|
|
|
+
|
|
|
+ for volt in volt_list:
|
|
|
+ df_chrg1=df_chrg[(df_chrg['单体电压'+str(voltmax_index)]/1000>=volt-0.02) & (df_chrg['单体电压'+str(voltmax_index)]/1000<volt) & (df_chrg['总电流[A]']>-20)]
|
|
|
+ if not df_chrg1.empty:
|
|
|
+ packcrnt_mean_list.append(np.mean(df_chrg1['总电流[A]']))
|
|
|
+ temp_mean=df_chrg1[self.celltemp_name].mean(axis=1)
|
|
|
+ temp_mean_list.append(np.mean(temp_mean))
|
|
|
+ cellvolt=(df_chrg1[self.cellvolt_name].mean(axis=0))/1000
|
|
|
+ cellvolt_mean=(np.sum(cellvolt)-min(cellvolt)-max(cellvolt))/(len(cellvolt)-2)
|
|
|
+ deltvolt=np.array(cellvolt-cellvolt_mean)
|
|
|
+ deltvolt_list.append(deltvolt)
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ else:
|
|
|
+ break
|
|
|
+
|
|
|
+ return deltvolt_list, packcrnt_mean_list, temp_mean_list
|
|
|
+
|
|
|
|
|
|
def _dvdq_peak(self, time, soc, cellvolt, packcrnt):
|
|
|
cellvolt = self._np_move_avg(cellvolt, 3, mode="same")
|
|
|
Soc = 0
|
|
|
Ah = 0
|
|
|
+ Ah_total=0
|
|
|
Volt = cellvolt[0]
|
|
|
DV_Volt = []
|
|
|
DQ_Ah = []
|
|
@@ -232,10 +267,11 @@ class BatInterShort():
|
|
|
|
|
|
for m in range(1, len(time)):
|
|
|
Step = (time[m] - time[m - 1]).total_seconds()
|
|
|
- Soc = Soc - packcrnt[m] * Step * 100 / (3600 * self.param.Capacity)
|
|
|
+ Soc = Soc - packcrnt[m] * Step * 100 / (3600 * float(self.param.Capacity))
|
|
|
Ah = Ah - packcrnt[m] * Step / 3600
|
|
|
+ Ah_total=Ah_total+Ah
|
|
|
if (cellvolt[m]-Volt)>0.0015 and Ah>0:
|
|
|
- DQ_Ah.append(Ah)
|
|
|
+ DQ_Ah.append(Ah_total)
|
|
|
DV_Volt.append(cellvolt[m]-Volt)
|
|
|
DVDQ.append((DV_Volt[-1])/Ah)
|
|
|
xvolt.append(cellvolt[m])
|
|
@@ -261,7 +297,7 @@ class BatInterShort():
|
|
|
df_Data1=df_Data1[(df_Data1['SOC']>40) & (df_Data1['SOC']<80)]
|
|
|
else:
|
|
|
df_Data1=df_Data1[(df_Data1['time']>start_time) & (df_Data1['SOC']<80)]
|
|
|
- df_Data1=df_Data1[(df_Data1['XVOLT']>self.param.PeakVoltLowLmt) & (df_Data1['XVOLT']<self.param.PeakVoltUpLmt)]
|
|
|
+ df_Data1=df_Data1[(df_Data1['XVOLT']>3.33) & (df_Data1['XVOLT']<3.95)]
|
|
|
|
|
|
|
|
|
|
|
@@ -281,17 +317,27 @@ class BatInterShort():
|
|
|
|
|
|
|
|
|
|
|
|
- if len(df_Data1)>2:
|
|
|
+ if len(df_Data1)>2:
|
|
|
PeakIndex = df_Data1['DVDQ'].idxmax()
|
|
|
df_Data2 = df_Data1[(df_Data1['SOC'] > (df_Data1['SOC'][PeakIndex] - 0.5)) & (df_Data1['SOC'] < (df_Data1['SOC'][PeakIndex] + 0.5))]
|
|
|
- if len(df_Data2) > 1 and df_Data1.loc[PeakIndex,'XVOLT']<self.param.PeakVoltUpLmt-0.015:
|
|
|
- return df_Data1['AhSoc'][PeakIndex]
|
|
|
+ if len(df_Data2) > 1 and min(df_Data1['SOC'])+0.5<df_Data1['SOC'][PeakIndex]<max(df_Data1['SOC'])-1:
|
|
|
+ return df_Data1['DQ_Ah'][PeakIndex]
|
|
|
+
|
|
|
else:
|
|
|
- df_Data1 = df_Data1.drop([PeakIndex])
|
|
|
- PeakIndex = df_Data1['DVDQ'].idxmax()
|
|
|
- df_Data2 = df_Data1[(df_Data1['SOC'] > (df_Data1['SOC'][PeakIndex] - 0.5)) & (df_Data1['SOC'] < (df_Data1['SOC'][PeakIndex] + 0.5))]
|
|
|
- if len(df_Data2) > 1 and df_Data1.loc[PeakIndex,'XVOLT']<self.param.PeakVoltUpLmt-0.015:
|
|
|
- return df_Data1['AhSoc'][PeakIndex]
|
|
|
+ if min(df_Data1['SOC'])+0.5<df_Data1['SOC'][PeakIndex]<max(df_Data1['SOC'])-1:
|
|
|
+ df_Data1=df_Data1.drop([PeakIndex])
|
|
|
+ elif df_Data1['SOC'][PeakIndex]>max(df_Data1['SOC'])-1:
|
|
|
+ df_Data1=df_Data1[df_Data1['SOC']<(df_Data1['SOC'][PeakIndex]-1)]
|
|
|
+ else:
|
|
|
+ df_Data1=df_Data1[df_Data1['SOC']>(df_Data1['SOC'][PeakIndex]+0.5)]
|
|
|
+
|
|
|
+ if len(df_Data1)>2:
|
|
|
+ PeakIndex = df_Data1['DVDQ'].idxmax()
|
|
|
+ df_Data2 = df_Data1[(df_Data1['SOC'] > (df_Data1['SOC'][PeakIndex] - 0.5)) & (df_Data1['SOC'] < (df_Data1['SOC'][PeakIndex] + 0.5))]
|
|
|
+ if len(df_Data2) > 1 and min(df_Data1['SOC'])+0.5<df_Data1['SOC'][PeakIndex]<max(df_Data1['SOC'])-1:
|
|
|
+ return df_Data1['DQ_Ah'][PeakIndex]
|
|
|
+ else:
|
|
|
+ return 0
|
|
|
else:
|
|
|
return 0
|
|
|
else:
|
|
@@ -344,7 +390,10 @@ class BatInterShort():
|
|
|
df_res=pd.DataFrame(columns=['time_st', 'time_sp', 'sn', 'method','short_current','baltime'])
|
|
|
df_ram_last=self.df_last
|
|
|
df_ram_last1=self.df_last1
|
|
|
+ df_ram_last2=self.df_last2
|
|
|
df_ram_last3=self.df_last3
|
|
|
+ df_ram_lfp=pd.DataFrame(columns=self.df_bms.columns.tolist())
|
|
|
+ df_ram_chrgvolt=self.df_chrgvolt_ram_sn
|
|
|
|
|
|
|
|
|
if self.df_soh.empty:
|
|
@@ -359,8 +408,8 @@ class BatInterShort():
|
|
|
firsttime=1
|
|
|
dict_bal={}
|
|
|
else:
|
|
|
- deltsoc_last=df_ram_last.loc[0,'deltsoc']
|
|
|
- cellsoc_last=df_ram_last.loc[0,'cellsoc']
|
|
|
+ deltsoc_last=np.array(df_ram_last.loc[0,'deltsoc'])
|
|
|
+ cellsoc_last=np.array(df_ram_last.loc[0,'cellsoc'])
|
|
|
time_last=df_ram_last.loc[0,'time']
|
|
|
firsttime=0
|
|
|
dict_bal={}
|
|
@@ -368,14 +417,27 @@ class BatInterShort():
|
|
|
firsttime1=1
|
|
|
dict_bal1={}
|
|
|
else:
|
|
|
- deltsoc_last1=df_ram_last1.loc[0,'deltsoc1']
|
|
|
+ deltsoc_last1=np.array(df_ram_last1.loc[0,'deltsoc1'])
|
|
|
time_last1=df_ram_last1.loc[0,'time1']
|
|
|
firsttime1=0
|
|
|
dict_bal1={}
|
|
|
+ if df_ram_chrgvolt.empty:
|
|
|
+ firsttime2=1
|
|
|
+ charging=0
|
|
|
+ dict_bal2={}
|
|
|
+ else:
|
|
|
+ deltvolt_last2=[np.array(x) for x in df_ram_chrgvolt.loc[0,'deltvolt']]
|
|
|
+ time_last2=df_ram_chrgvolt.loc[0,'time2']
|
|
|
+ temp_mean_last=df_ram_chrgvolt.loc[0,'temp_avg']
|
|
|
+ packcrnt_mean_last=df_ram_chrgvolt.loc[0,'packcrnt_avg']
|
|
|
+ firsttime2=0
|
|
|
+ charging=0
|
|
|
+ dict_bal2={}
|
|
|
if df_ram_last3.empty:
|
|
|
standingtime=0
|
|
|
standingtime1=0
|
|
|
standingtime2=0
|
|
|
+
|
|
|
else:
|
|
|
standingtime=df_ram_last3.loc[0,'standingtime']
|
|
|
standingtime1=df_ram_last3.loc[0,'standingtime1']
|
|
@@ -410,6 +472,7 @@ class BatInterShort():
|
|
|
delttime=(self.bmstime[i]-self.bmstime[i-1]).total_seconds()
|
|
|
standingtime=standingtime+delttime
|
|
|
standingtime1=standingtime1+delttime
|
|
|
+
|
|
|
self._celltemp_weight(i)
|
|
|
|
|
|
|
|
@@ -482,6 +545,7 @@ class BatInterShort():
|
|
|
|
|
|
if self.StandardStandingTime<standingtime1:
|
|
|
standingtime1=0
|
|
|
+
|
|
|
cellvolt_now1=self._avgvolt_get(i)
|
|
|
if not cellvolt_now1.empty:
|
|
|
cellvolt_max1=max(cellvolt_now1)
|
|
@@ -528,16 +592,83 @@ class BatInterShort():
|
|
|
firsttime=1
|
|
|
standingtime=0
|
|
|
standingtime1=0
|
|
|
+
|
|
|
pass
|
|
|
+
|
|
|
+
|
|
|
+ if charging==0 or charging==2:
|
|
|
+ if self.packcrnt[i]<=-1 and self.packcrnt[i-1]<=-1 and self.packcrnt[i+1]<=-1:
|
|
|
+ celltemp_now=self._celltemp_get(i)
|
|
|
+ cellvolt_now=self._cellvolt_get(i)
|
|
|
+ if min(celltemp_now)>0 and max(cellvolt_now)<4:
|
|
|
+ charging=2
|
|
|
+ if charging==2 and min(cellvolt_now)>3 and 4.1<max(cellvolt_now)<4.14:
|
|
|
+ charging=1
|
|
|
+ chrg_start=i
|
|
|
+ else:
|
|
|
+ pass
|
|
|
+
|
|
|
+ else:
|
|
|
+ cellvolt_now=self._cellvolt_get(i)
|
|
|
+
|
|
|
+ if max(cellvolt_now)>4.2 and self.packcrnt[i]>-0.1 and self.packcrnt[i+1]>-0.1:
|
|
|
+ if i-chrg_start>10:
|
|
|
+ chrg_end=i
|
|
|
+ charging=0
|
|
|
+
|
|
|
+
|
|
|
+ if firsttime2==1:
|
|
|
+ firsttime2=0
|
|
|
+ voltmax_index=list(cellvolt_now).index(max(cellvolt_now))+1
|
|
|
+
|
|
|
+
|
|
|
+ deltvolt_last2,packcrnt_mean_last,temp_mean_last=self._deltvolt(chrg_start,chrg_end,voltmax_index)
|
|
|
+
|
|
|
+ time_last2=self.bmstime[chrg_end]
|
|
|
+ df_ram_chrgvolt.loc[0]=[self.sn,time_last2,list(map(list,deltvolt_last2)),packcrnt_mean_last,temp_mean_last]
|
|
|
+ else:
|
|
|
+ dict_baltime2={}
|
|
|
+ time_now2=self.bmstime[chrg_end]
|
|
|
+ voltmax_index=list(cellvolt_now).index(max(cellvolt_now))+1
|
|
|
+
|
|
|
+
|
|
|
+ deltvolt_now2,packcrnt_mean_now,temp_mean_now=self._deltvolt(chrg_start,chrg_end,voltmax_index)
|
|
|
+ leak_current2=[]
|
|
|
+ for j in range(min(len(deltvolt_now2),len(deltvolt_last2))):
|
|
|
+ if abs(packcrnt_mean_now[j]-packcrnt_mean_last[j])<10 and (abs(temp_mean_now[j]-temp_mean_last[j])<10 or (temp_mean_now[j]>20 and temp_mean_last[j]>20)) and (time_now2-time_last2).total_seconds()<14*24*3600:
|
|
|
+ list_sub2=(deltvolt_now2[j]-deltvolt_last2[j])*1000
|
|
|
+ list_sub2=np.round(list_sub2,1)
|
|
|
+ leak_current2.append(list(list_sub2))
|
|
|
+ else:
|
|
|
+ break
|
|
|
+ if len(leak_current2)>0:
|
|
|
+ df_res.loc[len(df_res)]=[time_last2,time_now2,self.sn,4,str(leak_current2),str(dict_baltime2)]
|
|
|
+ time_last2=time_now2
|
|
|
+ deltvolt_last2=deltvolt_now2
|
|
|
+ packcrnt_mean_last=packcrnt_mean_now
|
|
|
+ temp_mean_last=temp_mean_now
|
|
|
+ dict_bal2={}
|
|
|
+ df_ram_chrgvolt.loc[0]=[self.sn,time_last2,list(map(list,deltvolt_last2)),packcrnt_mean_last,temp_mean_last]
|
|
|
+
|
|
|
+ else:
|
|
|
+ charging=0
|
|
|
+
|
|
|
+ elif self.packcrnt[i]>-0.1 and self.packcrnt[i-1]>-0.1:
|
|
|
+ charging=0
|
|
|
+ elif i==len(self.df_bms)-2:
|
|
|
+ df_ram_lfp=self.df_bms.iloc[chrg_start:]
|
|
|
+ df_ram_lfp['sn']=self.sn
|
|
|
+ else:
|
|
|
+ pass
|
|
|
|
|
|
|
|
|
df_ram_last3.loc[0]=[self.sn,self.bmstime[len(self.bmstime)-1],standingtime,standingtime1,standingtime2]
|
|
|
|
|
|
|
|
|
if df_res.empty:
|
|
|
- return pd.DataFrame(), df_ram_last, df_ram_last1, df_ram_last3
|
|
|
+ return pd.DataFrame(), df_ram_last, df_ram_last1, df_ram_last2, df_ram_last3, df_ram_lfp, df_ram_chrgvolt
|
|
|
else:
|
|
|
- return df_res, df_ram_last, df_ram_last1, df_ram_last3
|
|
|
+ return df_res, df_ram_last, df_ram_last1, df_ram_last2, df_ram_last3, df_ram_lfp, df_ram_chrgvolt
|
|
|
|
|
|
|
|
|
def _lfp_intershort(self):
|
|
@@ -548,6 +679,7 @@ class BatInterShort():
|
|
|
df_ram_last2=self.df_last2
|
|
|
df_ram_last3=self.df_last3
|
|
|
df_ram_lfp=pd.DataFrame(columns=self.df_bms.columns.tolist())
|
|
|
+ df_ram_chrgvolt=self.df_chrgvolt_ram_sn
|
|
|
|
|
|
|
|
|
if self.df_soh.empty:
|
|
@@ -574,13 +706,25 @@ class BatInterShort():
|
|
|
time_last1=df_ram_last1.loc[0,'time1']
|
|
|
firsttime1=0
|
|
|
dict_bal1={}
|
|
|
- if df_ram_last2.empty:
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if df_ram_chrgvolt.empty:
|
|
|
firsttime2=1
|
|
|
charging=0
|
|
|
dict_bal2={}
|
|
|
else:
|
|
|
- deltAs_last2=df_ram_last2.loc[0,'deltAs2']
|
|
|
- time_last2=df_ram_last2.loc[0,'time2']
|
|
|
+ deltvolt_last2=[np.array(x) for x in df_ram_chrgvolt.loc[0,'deltvolt']]
|
|
|
+ time_last2=df_ram_chrgvolt.loc[0,'time2']
|
|
|
+ temp_mean_last=df_ram_chrgvolt.loc[0,'temp_avg']
|
|
|
+ packcrnt_mean_last=df_ram_chrgvolt.loc[0,'packcrnt_avg']
|
|
|
firsttime2=0
|
|
|
charging=0
|
|
|
dict_bal2={}
|
|
@@ -762,148 +906,133 @@ class BatInterShort():
|
|
|
pass
|
|
|
except:
|
|
|
dict_bal2={}
|
|
|
-
|
|
|
-
|
|
|
- if self.packcrnt[i]<=-1 and self.packcrnt[i+1]<=-1 and self.packcrnt[i-1]<=-1:
|
|
|
- if charging==0:
|
|
|
- if self.bms_soc[i]<41:
|
|
|
- cellvolt_now=self._cellvolt_get(i)
|
|
|
- if min(cellvolt_now)<self.param.CellFullChrgVolt-0.15:
|
|
|
- charging=1
|
|
|
- chrg_start=i
|
|
|
- else:
|
|
|
- pass
|
|
|
+
|
|
|
+
|
|
|
+ if charging==0 or charging==2:
|
|
|
+ if self.packcrnt[i]<=-1 and self.packcrnt[i-1]<=-1 and self.packcrnt[i+1]<=-1:
|
|
|
+ celltemp_now=self._celltemp_get(i)
|
|
|
+ cellvolt_now=self._cellvolt_get(i)
|
|
|
+ if min(celltemp_now)>0 and max(cellvolt_now)<3.4:
|
|
|
+ charging=2
|
|
|
+ if charging==2 and min(cellvolt_now)>2 and 3.44<max(cellvolt_now)<3.7:
|
|
|
+ charging=1
|
|
|
+ chrg_start=i
|
|
|
else:
|
|
|
pass
|
|
|
|
|
|
- else:
|
|
|
- cellvolt_now=self._cellvolt_get(i)
|
|
|
- if (self.bmstime[i+1]-self.bmstime[i]).total_seconds()>180 or (self.packcrnt[i]>self.param.Capacity/2 and self.packcrnt[i+1]>self.param.Capacity/2):
|
|
|
+ else:
|
|
|
+ cellvolt_now=self._cellvolt_get(i)
|
|
|
+
|
|
|
+ if max(cellvolt_now)>3.51 and self.packcrnt[i]>-0.1 and self.packcrnt[i+1]>-0.1:
|
|
|
+ if i-chrg_start>10:
|
|
|
+ chrg_end=i
|
|
|
charging=0
|
|
|
- continue
|
|
|
- elif min(cellvolt_now)>self.param.CellFullChrgVolt-0.13:
|
|
|
- self._celltemp_weight(i)
|
|
|
- if i-chrg_start>10 and self.celltemp>20:
|
|
|
- chrg_end=i+1
|
|
|
- charging=0
|
|
|
-
|
|
|
-
|
|
|
- if firsttime2==1:
|
|
|
- dict_baltime={}
|
|
|
- deltAs_last2=self._cellDeltAs_get(chrg_start,chrg_end,dict_baltime)
|
|
|
- time_last2=self.bmstime[chrg_end]
|
|
|
- df_ram_last2.loc[0]=[self.sn,time_last2,deltAs_last2]
|
|
|
- else:
|
|
|
- dict_baltime=self._bal_time(dict_bal2)
|
|
|
- deltAs_now2=self._cellDeltAs_get(chrg_start,chrg_end,dict_baltime)
|
|
|
- time_now2=self.bmstime[chrg_end]
|
|
|
- df_ram_last2.loc[0]=[self.sn,time_now2,deltAs_now2]
|
|
|
-
|
|
|
- list_sub2=deltAs_now2-deltAs_last2
|
|
|
- list_pud2=-1000/(time_now2-time_last2).total_seconds()
|
|
|
- leak_current2=list_sub2*list_pud2
|
|
|
-
|
|
|
- leak_current2=np.round(leak_current2,3)
|
|
|
- leak_current2=list(leak_current2)
|
|
|
-
|
|
|
- df_res.loc[len(df_res)]=[time_last2,time_now2,self.sn,3,str(leak_current2),str(dict_baltime)]
|
|
|
- deltAs_last2=deltAs_now2
|
|
|
- time_last2=time_now2
|
|
|
- dict_bal2={}
|
|
|
|
|
|
+
|
|
|
+ if firsttime2==1:
|
|
|
+ firsttime2=0
|
|
|
+ voltmax_index=list(cellvolt_now).index(max(cellvolt_now))+1
|
|
|
+
|
|
|
+
|
|
|
+ deltvolt_last2,packcrnt_mean_last,temp_mean_last=self._deltvolt(chrg_start,chrg_end,voltmax_index)
|
|
|
+
|
|
|
+ time_last2=self.bmstime[chrg_end]
|
|
|
+ df_ram_chrgvolt.loc[0]=[self.sn,time_last2,list(map(list,deltvolt_last2)),packcrnt_mean_last,temp_mean_last]
|
|
|
else:
|
|
|
- charging=0
|
|
|
- continue
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- elif i==len(self.df_bms)-2:
|
|
|
- df_ram_lfp=self.df_bms.iloc[chrg_start:]
|
|
|
- df_ram_lfp['sn']=self.sn
|
|
|
+ dict_baltime2={}
|
|
|
+ time_now2=self.bmstime[chrg_end]
|
|
|
+ voltmax_index=list(cellvolt_now).index(max(cellvolt_now))+1
|
|
|
+
|
|
|
+
|
|
|
+ deltvolt_now2,packcrnt_mean_now,temp_mean_now=self._deltvolt(chrg_start,chrg_end,voltmax_index)
|
|
|
+ leak_current2=[]
|
|
|
+ for j in range(min(len(deltvolt_now2),len(deltvolt_last2))):
|
|
|
+ if abs(packcrnt_mean_now[j]-packcrnt_mean_last[j])<10 and (abs(temp_mean_now[j]-temp_mean_last[j])<10 or (temp_mean_now[j]>20 and temp_mean_last[j]>20)) and (time_now2-time_last2).total_seconds()<14*24*3600:
|
|
|
+ list_sub2=(deltvolt_now2[j]-deltvolt_last2[j])*1000
|
|
|
+ list_sub2=np.round(list_sub2,1)
|
|
|
+ leak_current2.append(list(list_sub2))
|
|
|
+ else:
|
|
|
+ break
|
|
|
+ if len(leak_current2)>0:
|
|
|
+ df_res.loc[len(df_res)]=[time_last2,time_now2,self.sn,4,str(leak_current2),str(dict_baltime2)]
|
|
|
+ time_last2=time_now2
|
|
|
+ deltvolt_last2=deltvolt_now2
|
|
|
+ packcrnt_mean_last=packcrnt_mean_now
|
|
|
+ temp_mean_last=temp_mean_now
|
|
|
+ dict_bal2={}
|
|
|
+ df_ram_chrgvolt.loc[0]=[self.sn,time_last2,list(map(list,deltvolt_last2)),packcrnt_mean_last,temp_mean_last]
|
|
|
+
|
|
|
else:
|
|
|
- pass
|
|
|
- else:
|
|
|
- pass
|
|
|
+ charging=0
|
|
|
+
|
|
|
+ elif self.packcrnt[i]>-0.1 and self.packcrnt[i-1]>-0.1:
|
|
|
+ charging=0
|
|
|
+ elif i==len(self.df_bms)-2:
|
|
|
+ df_ram_lfp=self.df_bms.iloc[chrg_start:]
|
|
|
+ df_ram_lfp['sn']=self.sn
|
|
|
+ else:
|
|
|
+ pass
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -911,6 +1040,6 @@ class BatInterShort():
|
|
|
|
|
|
|
|
|
if df_res.empty:
|
|
|
- return pd.DataFrame(), df_ram_last, df_ram_last1, df_ram_last2, df_ram_last3,df_ram_lfp
|
|
|
+ return pd.DataFrame(), df_ram_last, df_ram_last1, df_ram_last2, df_ram_last3, df_ram_lfp, df_ram_chrgvolt
|
|
|
else:
|
|
|
- return df_res, df_ram_last, df_ram_last1, df_ram_last2, df_ram_last3, df_ram_lfp
|
|
|
+ return df_res, df_ram_last, df_ram_last1, df_ram_last2, df_ram_last3, df_ram_lfp, df_ram_chrgvolt
|