|
@@ -6,9 +6,9 @@ import datetime
|
|
from LIB.MIDDLE.CellStateEstimation.Common.V1_0_1 import BatParam
|
|
from LIB.MIDDLE.CellStateEstimation.Common.V1_0_1 import BatParam
|
|
|
|
|
|
class BatInterShort():
|
|
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_lfp.drop(['sn'],axis=1)
|
|
df_bms=pd.concat([df_lfp, df_bms], ignore_index=True)
|
|
df_bms=pd.concat([df_lfp, df_bms], ignore_index=True)
|
|
else:
|
|
else:
|
|
@@ -30,18 +30,19 @@ class BatInterShort():
|
|
self.df_last2=df_last2
|
|
self.df_last2=df_last2
|
|
self.df_last3=df_last3
|
|
self.df_last3=df_last3
|
|
self.df_lfp=df_lfp
|
|
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.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)]
|
|
self.celltemp_name=['单体温度'+str(x) for x in range(1,self.param.CellTempNums+1)]
|
|
|
|
|
|
def intershort(self):
|
|
def intershort(self):
|
|
if self.celltype<=50:
|
|
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:
|
|
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):
|
|
def _cellvolt_get(self,num):
|
|
cellvolt = np.array(self.df_bms.loc[num,self.cellvolt_name])/1000
|
|
cellvolt = np.array(self.df_bms.loc[num,self.cellvolt_name])/1000
|
|
return cellvolt
|
|
return cellvolt
|
|
|
|
+
|
|
|
|
+ #获取当前行所有温度数据........................................................................................
|
|
|
|
+ def _celltemp_get(self,num):
|
|
|
|
+ celltemp = np.array(self.df_bms.loc[num,self.celltemp_name])
|
|
|
|
+ return celltemp
|
|
|
|
|
|
#获取当前行所有soc差...........................................................................................
|
|
#获取当前行所有soc差...........................................................................................
|
|
def _celldeltsoc_get(self,cellvolt_list,dict_baltime,capacity):
|
|
def _celldeltsoc_get(self,cellvolt_list,dict_baltime,capacity):
|
|
@@ -122,16 +128,8 @@ class BatInterShort():
|
|
celldeltsoc=[]
|
|
celldeltsoc=[]
|
|
for j in range(self.param.CellVoltNums): #获取每个电芯电压对应的SOC值
|
|
for j in range(self.param.CellVoltNums): #获取每个电芯电压对应的SOC值
|
|
cellvolt=cellvolt_list[j]
|
|
cellvolt=cellvolt_list[j]
|
|
- ocv_soc=np.interp(cellvolt,self.param.LookTab_OCV,self.param.LookTab_SOC)
|
|
|
|
-<<<<<<< HEAD
|
|
|
|
if j+1 in dict_baltime.keys():
|
|
if j+1 in dict_baltime.keys():
|
|
ocv_soc=ocv_soc+dict_baltime[j+1]*self.param.BalCurrent/(capacity*3600) #补偿均衡电流
|
|
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:
|
|
else:
|
|
pass
|
|
pass
|
|
cellsoc.append(ocv_soc)
|
|
cellsoc.append(ocv_soc)
|
|
@@ -212,11 +210,51 @@ class BatInterShort():
|
|
|
|
|
|
return np.array(celldeltAs)
|
|
return np.array(celldeltAs)
|
|
|
|
|
|
|
|
+ #充电delt_volt获取.................................................................................
|
|
|
|
+ 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, 4.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)
|
|
|
|
+
|
|
|
|
+ # if volt>4.19:
|
|
|
|
+ # df_chrg1=df_chrg[(df_chrg['CellVoltage'+str(voltmax_index)]>=volt) & (df_chrg['CellVoltage'+str(voltmax_index)]<4.3)]
|
|
|
|
+ # if not df_chrg1.empty:
|
|
|
|
+ # packcrnt_mean_list.append(np.mean(df_chrg1['PackCrnt']))
|
|
|
|
+ # 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)
|
|
|
|
+ # cellvolt_mean=(np.sum(cellvolt)-min(cellvolt)-max(cellvolt))/(len(cellvolt)-2)
|
|
|
|
+ # deltvolt=np.array(cellvolt-cellvolt_mean)
|
|
|
|
+ # deltvolt_list.append(deltvolt)
|
|
|
|
+ # else:
|
|
|
|
+ # break
|
|
|
|
+ else:
|
|
|
|
+ break
|
|
|
|
+
|
|
|
|
+ return deltvolt_list, packcrnt_mean_list, temp_mean_list
|
|
|
|
+
|
|
#寻找DVDQ的峰值点,并返回..........................................................................................................................
|
|
#寻找DVDQ的峰值点,并返回..........................................................................................................................
|
|
def _dvdq_peak(self, time, soc, cellvolt, packcrnt):
|
|
def _dvdq_peak(self, time, soc, cellvolt, packcrnt):
|
|
cellvolt = self._np_move_avg(cellvolt, 3, mode="same")
|
|
cellvolt = self._np_move_avg(cellvolt, 3, mode="same")
|
|
Soc = 0
|
|
Soc = 0
|
|
Ah = 0
|
|
Ah = 0
|
|
|
|
+ Ah_total=0
|
|
Volt = cellvolt[0]
|
|
Volt = cellvolt[0]
|
|
DV_Volt = []
|
|
DV_Volt = []
|
|
DQ_Ah = []
|
|
DQ_Ah = []
|
|
@@ -228,10 +266,11 @@ class BatInterShort():
|
|
|
|
|
|
for m in range(1, len(time)):
|
|
for m in range(1, len(time)):
|
|
Step = (time[m] - time[m - 1]).total_seconds()
|
|
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 = Ah - packcrnt[m] * Step / 3600
|
|
|
|
+ Ah_total=Ah_total+Ah
|
|
if (cellvolt[m]-Volt)>0.0015 and Ah>0:
|
|
if (cellvolt[m]-Volt)>0.0015 and Ah>0:
|
|
- DQ_Ah.append(Ah)
|
|
|
|
|
|
+ DQ_Ah.append(Ah_total)
|
|
DV_Volt.append(cellvolt[m]-Volt)
|
|
DV_Volt.append(cellvolt[m]-Volt)
|
|
DVDQ.append((DV_Volt[-1])/Ah)
|
|
DVDQ.append((DV_Volt[-1])/Ah)
|
|
xvolt.append(cellvolt[m])
|
|
xvolt.append(cellvolt[m])
|
|
@@ -257,7 +296,7 @@ class BatInterShort():
|
|
df_Data1=df_Data1[(df_Data1['SOC']>40) & (df_Data1['SOC']<80)]
|
|
df_Data1=df_Data1[(df_Data1['SOC']>40) & (df_Data1['SOC']<80)]
|
|
else:
|
|
else:
|
|
df_Data1=df_Data1[(df_Data1['time']>start_time) & (df_Data1['SOC']<80)]
|
|
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)]
|
|
|
|
|
|
# print(packcrnt[int(len(time)/2)], min(self.celltemp))
|
|
# print(packcrnt[int(len(time)/2)], min(self.celltemp))
|
|
# ax1 = plt.subplot(3, 1, 1)
|
|
# ax1 = plt.subplot(3, 1, 1)
|
|
@@ -277,17 +316,27 @@ class BatInterShort():
|
|
# plt.legend()
|
|
# plt.legend()
|
|
# # plt.show()
|
|
# # plt.show()
|
|
|
|
|
|
- if len(df_Data1)>2: #寻找峰值点,且峰值点个数>2
|
|
|
|
|
|
+ if len(df_Data1)>2:
|
|
PeakIndex = df_Data1['DVDQ'].idxmax()
|
|
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))]
|
|
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:
|
|
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:
|
|
else:
|
|
return 0
|
|
return 0
|
|
else:
|
|
else:
|
|
@@ -340,7 +389,10 @@ class BatInterShort():
|
|
df_res=pd.DataFrame(columns=['time_st', 'time_sp', 'sn', 'method','short_current','baltime'])
|
|
df_res=pd.DataFrame(columns=['time_st', 'time_sp', 'sn', 'method','short_current','baltime'])
|
|
df_ram_last=self.df_last
|
|
df_ram_last=self.df_last
|
|
df_ram_last1=self.df_last1
|
|
df_ram_last1=self.df_last1
|
|
|
|
+ df_ram_last2=self.df_last2
|
|
df_ram_last3=self.df_last3
|
|
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:
|
|
if self.df_soh.empty:
|
|
@@ -355,8 +407,8 @@ class BatInterShort():
|
|
firsttime=1
|
|
firsttime=1
|
|
dict_bal={}
|
|
dict_bal={}
|
|
else:
|
|
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']
|
|
time_last=df_ram_last.loc[0,'time']
|
|
firsttime=0
|
|
firsttime=0
|
|
dict_bal={}
|
|
dict_bal={}
|
|
@@ -364,14 +416,27 @@ class BatInterShort():
|
|
firsttime1=1
|
|
firsttime1=1
|
|
dict_bal1={}
|
|
dict_bal1={}
|
|
else:
|
|
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']
|
|
time_last1=df_ram_last1.loc[0,'time1']
|
|
firsttime1=0
|
|
firsttime1=0
|
|
dict_bal1={}
|
|
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:
|
|
if df_ram_last3.empty:
|
|
standingtime=0
|
|
standingtime=0
|
|
standingtime1=0
|
|
standingtime1=0
|
|
standingtime2=0
|
|
standingtime2=0
|
|
|
|
+ # standingtime3=0
|
|
else:
|
|
else:
|
|
standingtime=df_ram_last3.loc[0,'standingtime']
|
|
standingtime=df_ram_last3.loc[0,'standingtime']
|
|
standingtime1=df_ram_last3.loc[0,'standingtime1']
|
|
standingtime1=df_ram_last3.loc[0,'standingtime1']
|
|
@@ -406,6 +471,7 @@ class BatInterShort():
|
|
delttime=(self.bmstime[i]-self.bmstime[i-1]).total_seconds()
|
|
delttime=(self.bmstime[i]-self.bmstime[i-1]).total_seconds()
|
|
standingtime=standingtime+delttime
|
|
standingtime=standingtime+delttime
|
|
standingtime1=standingtime1+delttime
|
|
standingtime1=standingtime1+delttime
|
|
|
|
+ # standingtime3=0
|
|
self._celltemp_weight(i)
|
|
self._celltemp_weight(i)
|
|
|
|
|
|
#长时间静置法计算内短路-开始.....................................................................................................................................
|
|
#长时间静置法计算内短路-开始.....................................................................................................................................
|
|
@@ -478,6 +544,7 @@ class BatInterShort():
|
|
#满电静置法计算内短路-开始.....................................................................................................................................................
|
|
#满电静置法计算内短路-开始.....................................................................................................................................................
|
|
if self.StandardStandingTime<standingtime1:
|
|
if self.StandardStandingTime<standingtime1:
|
|
standingtime1=0
|
|
standingtime1=0
|
|
|
|
+ # standingtime3=0
|
|
cellvolt_now1=self._avgvolt_get(i)
|
|
cellvolt_now1=self._avgvolt_get(i)
|
|
if not cellvolt_now1.empty:
|
|
if not cellvolt_now1.empty:
|
|
cellvolt_max1=max(cellvolt_now1)
|
|
cellvolt_max1=max(cellvolt_now1)
|
|
@@ -524,16 +591,83 @@ class BatInterShort():
|
|
firsttime=1
|
|
firsttime=1
|
|
standingtime=0
|
|
standingtime=0
|
|
standingtime1=0
|
|
standingtime1=0
|
|
|
|
+ # standingtime3=0
|
|
pass
|
|
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: #电压>93%对应的电压
|
|
|
|
+ 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
|
|
|
|
+ # cellvolt_max=(self.df_bms['单体电压'+str(voltmax_index)][chrg_start:chrg_end])/1000
|
|
|
|
+
|
|
|
|
+ deltvolt_last2,packcrnt_mean_last,temp_mean_last=self._deltvolt(chrg_start,chrg_end,voltmax_index) #获取deltAs
|
|
|
|
+
|
|
|
|
+ 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] #更新RAM信息
|
|
|
|
+ else:
|
|
|
|
+ dict_baltime2={}
|
|
|
|
+ time_now2=self.bmstime[chrg_end]
|
|
|
|
+ voltmax_index=list(cellvolt_now).index(max(cellvolt_now))+1
|
|
|
|
+ # cellvolt_max=(self.df_bms['单体电压'+str(voltmax_index)][chrg_start:chrg_end])/1000
|
|
|
|
+
|
|
|
|
+ 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)] #计算结果存入Dataframe
|
|
|
|
+ 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] #更新RAM信息
|
|
|
|
+
|
|
|
|
+ else:
|
|
|
|
+ charging=0
|
|
|
|
+
|
|
|
|
+ elif self.packcrnt[i]>-0.1 and self.packcrnt[i-1]>-0.1: #(self.packcrnt[i]<-eval(self.pack_param['capacity'])/2 and self.packcrnt[i-1]<-eval(self.pack_param['capacity'])/2): #如果充电过程中时间间隔>180s,则舍弃该次充电
|
|
|
|
+ charging=0
|
|
|
|
+ elif i==len(self.df_bms)-2: #数据中断后仍在充电,将前段充电数据写入RAM
|
|
|
|
+ df_ram_lfp=self.df_bms.iloc[chrg_start:]
|
|
|
|
+ df_ram_lfp['sn']=self.sn
|
|
|
|
+ else:
|
|
|
|
+ pass
|
|
|
|
|
|
#更新RAM的standingtime
|
|
#更新RAM的standingtime
|
|
df_ram_last3.loc[0]=[self.sn,self.bmstime[len(self.bmstime)-1],standingtime,standingtime1,standingtime2]
|
|
df_ram_last3.loc[0]=[self.sn,self.bmstime[len(self.bmstime)-1],standingtime,standingtime1,standingtime2]
|
|
|
|
|
|
#返回计算结果
|
|
#返回计算结果
|
|
if df_res.empty:
|
|
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:
|
|
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):
|
|
def _lfp_intershort(self):
|
|
@@ -544,6 +678,7 @@ class BatInterShort():
|
|
df_ram_last2=self.df_last2
|
|
df_ram_last2=self.df_last2
|
|
df_ram_last3=self.df_last3
|
|
df_ram_last3=self.df_last3
|
|
df_ram_lfp=pd.DataFrame(columns=self.df_bms.columns.tolist())
|
|
df_ram_lfp=pd.DataFrame(columns=self.df_bms.columns.tolist())
|
|
|
|
+ df_ram_chrgvolt=self.df_chrgvolt_ram_sn
|
|
|
|
|
|
#容量初始化
|
|
#容量初始化
|
|
if self.df_soh.empty:
|
|
if self.df_soh.empty:
|
|
@@ -570,13 +705,25 @@ class BatInterShort():
|
|
time_last1=df_ram_last1.loc[0,'time1']
|
|
time_last1=df_ram_last1.loc[0,'time1']
|
|
firsttime1=0
|
|
firsttime1=0
|
|
dict_bal1={}
|
|
dict_bal1={}
|
|
- if df_ram_last2.empty:
|
|
|
|
|
|
+ # if df_ram_last2.empty:
|
|
|
|
+ # firsttime2=1
|
|
|
|
+ # charging=0
|
|
|
|
+ # dict_bal2={}
|
|
|
|
+ # else:
|
|
|
|
+ # deltAs_last2=df_ram_last2.loc[0,'deltAs2']
|
|
|
|
+ # time_last2=df_ram_last2.loc[0,'time2']
|
|
|
|
+ # firsttime2=0
|
|
|
|
+ # charging=0
|
|
|
|
+ # dict_bal2={}
|
|
|
|
+ if df_ram_chrgvolt.empty:
|
|
firsttime2=1
|
|
firsttime2=1
|
|
charging=0
|
|
charging=0
|
|
dict_bal2={}
|
|
dict_bal2={}
|
|
else:
|
|
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
|
|
firsttime2=0
|
|
charging=0
|
|
charging=0
|
|
dict_bal2={}
|
|
dict_bal2={}
|
|
@@ -758,148 +905,133 @@ class BatInterShort():
|
|
pass
|
|
pass
|
|
except:
|
|
except:
|
|
dict_bal2={}
|
|
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:
|
|
else:
|
|
pass
|
|
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): #如果充电过程中时间间隔>180s,则舍弃该次充电
|
|
|
|
|
|
+ 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: #电压>93%对应的电压
|
|
|
|
+ if i-chrg_start>10:
|
|
|
|
+ chrg_end=i
|
|
charging=0
|
|
charging=0
|
|
- continue
|
|
|
|
- elif min(cellvolt_now)>self.param.CellFullChrgVolt-0.13: #电压>满充电压-0.13V,即3.37V
|
|
|
|
- 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] #更新RAM信息
|
|
|
|
- else:
|
|
|
|
- dict_baltime=self._bal_time(dict_bal2) #获取每个电芯的均衡时间
|
|
|
|
- deltAs_now2=self._cellDeltAs_get(chrg_start,chrg_end,dict_baltime) #获取每个电芯的As差
|
|
|
|
- time_now2=self.bmstime[chrg_end]
|
|
|
|
- df_ram_last2.loc[0]=[self.sn,time_now2,deltAs_now2] #更新RAM信息
|
|
|
|
-
|
|
|
|
- list_sub2=deltAs_now2-deltAs_last2
|
|
|
|
- list_pud2=-1000/(time_now2-time_last2).total_seconds()
|
|
|
|
- leak_current2=list_sub2*list_pud2
|
|
|
|
- # leak_current=np.array(leak_current)
|
|
|
|
- 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)] #计算结果存入Dataframe
|
|
|
|
- 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
|
|
|
|
+ # cellvolt_max=(self.df_bms['单体电压'+str(voltmax_index)][chrg_start:chrg_end])/1000
|
|
|
|
+
|
|
|
|
+ deltvolt_last2,packcrnt_mean_last,temp_mean_last=self._deltvolt(chrg_start,chrg_end,voltmax_index) #获取deltAs
|
|
|
|
+
|
|
|
|
+ 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] #更新RAM信息
|
|
else:
|
|
else:
|
|
- charging=0
|
|
|
|
- continue
|
|
|
|
- # elif min(cellvolt_now)>self.param.CellFullChrgVolt-0.1: #电压>满充电压
|
|
|
|
- # self._celltemp_weight(i)
|
|
|
|
- # if i-chrg_start>10 and self.celltemp>10:
|
|
|
|
- # chrg_end=i+1
|
|
|
|
- # charging=0
|
|
|
|
-
|
|
|
|
- # #计算漏电流值...................................................................
|
|
|
|
- # if firsttime2==1:
|
|
|
|
- # dict_baltime={}
|
|
|
|
- # peaksoc_list=[]
|
|
|
|
- # for j in range(1, self.param.CellVoltNums + 1):
|
|
|
|
- # cellvolt = self._singlevolt_get(i,j,2) #取单体电压j的所有电压值
|
|
|
|
- # cellvolt = list(cellvolt[chrg_start:chrg_end])
|
|
|
|
- # time = list(self.bmstime[chrg_start:chrg_end])
|
|
|
|
- # packcrnt = list(self.packcrnt[chrg_start:chrg_end])
|
|
|
|
- # soc = list(self.bms_soc[chrg_start:chrg_end])
|
|
|
|
- # peaksoc = self._dvdq_peak(time, soc, cellvolt, packcrnt)
|
|
|
|
- # if peaksoc>1:
|
|
|
|
- # peaksoc_list.append(peaksoc)
|
|
|
|
- # else:
|
|
|
|
- # break
|
|
|
|
- # if len(peaksoc_list)==self.param.CellVoltNums:
|
|
|
|
- # celldeltsoc=[]
|
|
|
|
- # consum_num=10
|
|
|
|
- # cellsoc1=peaksoc_list[:self.param.CellVoltNums-consum_num] #切片,将bms耗电的电芯和非耗电的电芯分离开
|
|
|
|
- # cellsocmean1=(sum(cellsoc1)-max(cellsoc1)-min(cellsoc1))/(len(cellsoc1)-2)
|
|
|
|
- # cellsoc2=peaksoc_list[self.param.CellVoltNums-consum_num:]
|
|
|
|
- # cellsocmean2=(sum(cellsoc2)-max(cellsoc2)-min(cellsoc2))/(len(cellsoc2)-2)
|
|
|
|
-
|
|
|
|
- # for j in range(len(peaksoc_list)): #计算每个电芯的soc差
|
|
|
|
- # if j<self.param.CellVoltNums-consum_num:
|
|
|
|
- # celldeltsoc.append(peaksoc_list[j]-cellsocmean1)
|
|
|
|
- # else:
|
|
|
|
- # celldeltsoc.append(peaksoc_list[j]-cellsocmean2)
|
|
|
|
- # deltsoc_last2=celldeltsoc
|
|
|
|
- # time_last2=self.bmstime[chrg_end]
|
|
|
|
- # df_ram_last2.loc[0]=[self.sn,time_last2,deltsoc_last2] #更新RAM信息
|
|
|
|
- # else:
|
|
|
|
- # dict_baltime=self._bal_time(dict_bal2) #获取每个电芯的均衡时间
|
|
|
|
- # peaksoc_list=[]
|
|
|
|
- # for j in range(1, self.param.CellVoltNums + 1):
|
|
|
|
- # cellvolt = self._singlevolt_get(i,j,2) #取单体电压j的所有电压值
|
|
|
|
- # cellvolt = list(cellvolt[chrg_start:chrg_end])
|
|
|
|
- # time = list(self.bmstime[chrg_start:chrg_end])
|
|
|
|
- # packcrnt = list(self.packcrnt[chrg_start:chrg_end])
|
|
|
|
- # soc = list(self.bms_soc[chrg_start:chrg_end])
|
|
|
|
- # peaksoc = self._dvdq_peak(time, soc, cellvolt, packcrnt)
|
|
|
|
- # if peaksoc>1:
|
|
|
|
- # peaksoc_list.append(peaksoc)
|
|
|
|
- # else:
|
|
|
|
- # break
|
|
|
|
- # if len(peaksoc_list)==self.param.CellVoltNums:
|
|
|
|
- # celldeltsoc=[]
|
|
|
|
- # consum_num=10
|
|
|
|
- # cellsoc1=peaksoc_list[:self.param.CellVoltNums-consum_num] #切片,将bms耗电的电芯和非耗电的电芯分离开
|
|
|
|
- # cellsocmean1=(sum(cellsoc1)-max(cellsoc1)-min(cellsoc1))/(len(cellsoc1)-2)
|
|
|
|
- # cellsoc2=peaksoc_list[self.param.CellVoltNums-consum_num:]
|
|
|
|
- # cellsocmean2=(sum(cellsoc2)-max(cellsoc2)-min(cellsoc2))/(len(cellsoc2)-2)
|
|
|
|
-
|
|
|
|
- # for j in range(len(peaksoc_list)): #计算每个电芯的soc差
|
|
|
|
- # if j<self.param.CellVoltNums-consum_num:
|
|
|
|
- # celldeltsoc.append(peaksoc_list[j]-cellsocmean1)
|
|
|
|
- # else:
|
|
|
|
- # celldeltsoc.append(peaksoc_list[j]-cellsocmean2)
|
|
|
|
- # deltsoc_now2=celldeltsoc
|
|
|
|
- # time_now2=self.bmstime[chrg_end]
|
|
|
|
- # df_ram_last2.loc[0]=[self.sn,time_now2,deltsoc_now2] #更新RAM信息
|
|
|
|
-
|
|
|
|
- # list_sub2=deltsoc_now2-deltsoc_last2
|
|
|
|
- # list_pud2=(0.01*capacity*3600*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)] #计算结果存入Dataframe
|
|
|
|
- # deltsoc_last2=deltsoc_now2
|
|
|
|
- # time_last2=time_now2
|
|
|
|
- # dict_bal2={}
|
|
|
|
-
|
|
|
|
- # else:
|
|
|
|
- # charging=0
|
|
|
|
- # continue
|
|
|
|
-
|
|
|
|
- elif i==len(self.df_bms)-2: #数据中断后仍在充电,将前段充电数据写入RAM
|
|
|
|
- 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
|
|
|
|
+ # cellvolt_max=(self.df_bms['单体电压'+str(voltmax_index)][chrg_start:chrg_end])/1000
|
|
|
|
+
|
|
|
|
+ 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)] #计算结果存入Dataframe
|
|
|
|
+ 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] #更新RAM信息
|
|
|
|
+
|
|
else:
|
|
else:
|
|
- pass
|
|
|
|
- else:
|
|
|
|
- pass
|
|
|
|
|
|
+ charging=0
|
|
|
|
+
|
|
|
|
+ elif self.packcrnt[i]>-0.1 and self.packcrnt[i-1]>-0.1: #(self.packcrnt[i]<-eval(self.pack_param['capacity'])/2 and self.packcrnt[i-1]<-eval(self.pack_param['capacity'])/2): #如果充电过程中时间间隔>180s,则舍弃该次充电
|
|
|
|
+ charging=0
|
|
|
|
+ elif i==len(self.df_bms)-2: #数据中断后仍在充电,将前段充电数据写入RAM
|
|
|
|
+ df_ram_lfp=self.df_bms.iloc[chrg_start:]
|
|
|
|
+ df_ram_lfp['sn']=self.sn
|
|
|
|
+ else:
|
|
|
|
+ pass
|
|
|
|
+
|
|
|
|
+ # #判断充电状态
|
|
|
|
+ # 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
|
|
|
|
+ # 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): #如果充电过程中时间间隔>180s,则舍弃该次充电
|
|
|
|
+ # charging=0
|
|
|
|
+ # continue
|
|
|
|
+ # elif min(cellvolt_now)>self.param.CellFullChrgVolt-0.13: #电压>满充电压-0.13V,即3.37V
|
|
|
|
+ # 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] #更新RAM信息
|
|
|
|
+ # else:
|
|
|
|
+ # dict_baltime=self._bal_time(dict_bal2) #获取每个电芯的均衡时间
|
|
|
|
+ # deltAs_now2=self._cellDeltAs_get(chrg_start,chrg_end,dict_baltime) #获取每个电芯的As差
|
|
|
|
+ # time_now2=self.bmstime[chrg_end]
|
|
|
|
+ # df_ram_last2.loc[0]=[self.sn,time_now2,deltAs_now2] #更新RAM信息
|
|
|
|
+
|
|
|
|
+ # list_sub2=deltAs_now2-deltAs_last2
|
|
|
|
+ # list_pud2=-1000/(time_now2-time_last2).total_seconds()
|
|
|
|
+ # leak_current2=list_sub2*list_pud2
|
|
|
|
+ # # leak_current=np.array(leak_current)
|
|
|
|
+ # 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)] #计算结果存入Dataframe
|
|
|
|
+ # deltAs_last2=deltAs_now2
|
|
|
|
+ # time_last2=time_now2
|
|
|
|
+ # dict_bal2={}
|
|
|
|
+
|
|
|
|
+ # else:
|
|
|
|
+ # charging=0
|
|
|
|
+ # continue
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ # elif i==len(self.df_bms)-2: #数据中断后仍在充电,将前段充电数据写入RAM
|
|
|
|
+ # df_ram_lfp=self.df_bms.iloc[chrg_start:]
|
|
|
|
+ # df_ram_lfp['sn']=self.sn
|
|
|
|
+ # else:
|
|
|
|
+ # pass
|
|
|
|
+ # else:
|
|
|
|
+ # pass
|
|
|
|
|
|
|
|
|
|
#更新RAM
|
|
#更新RAM
|
|
@@ -907,6 +1039,6 @@ class BatInterShort():
|
|
|
|
|
|
#返回结果
|
|
#返回结果
|
|
if df_res.empty:
|
|
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:
|
|
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
|