|
@@ -4,10 +4,9 @@ import datetime
|
|
import bisect
|
|
import bisect
|
|
import matplotlib.pyplot as plt
|
|
import matplotlib.pyplot as plt
|
|
from LIB.MIDDLE.CellStateEstimation.Common import BatParam
|
|
from LIB.MIDDLE.CellStateEstimation.Common import BatParam
|
|
-from LIB.MIDDLE.CellStateEstimation.Common import DBDownload
|
|
|
|
|
|
|
|
class BatSoh:
|
|
class BatSoh:
|
|
- def __init__(self,sn,celltype,df_bms,df_accum, host, port, db, user, password, tablename): #参数初始化
|
|
|
|
|
|
+ def __init__(self,sn,celltype,df_bms,df_accum,df_soh): #参数初始化
|
|
|
|
|
|
self.sn=sn
|
|
self.sn=sn
|
|
self.celltype=celltype
|
|
self.celltype=celltype
|
|
@@ -23,12 +22,7 @@ class BatSoh:
|
|
self.df_accum=df_accum
|
|
self.df_accum=df_accum
|
|
self.accumtime=pd.to_datetime(df_accum['时间戳'], format='%Y-%m-%d %H:%M:%S')
|
|
self.accumtime=pd.to_datetime(df_accum['时间戳'], format='%Y-%m-%d %H:%M:%S')
|
|
|
|
|
|
- self.host=host
|
|
|
|
- self.port=port
|
|
|
|
- self.db=db
|
|
|
|
- self.user=user
|
|
|
|
- self.password=password
|
|
|
|
- self.tablename=tablename
|
|
|
|
|
|
+ self.df_soh=df_soh
|
|
|
|
|
|
def batsoh(self):
|
|
def batsoh(self):
|
|
if self.celltype==1 or self.celltype==2 or self.celltype==3 or self.celltype==4:
|
|
if self.celltype==1 or self.celltype==2 or self.celltype==3 or self.celltype==4:
|
|
@@ -42,12 +36,6 @@ class BatSoh:
|
|
else:
|
|
else:
|
|
return pd.DataFrame()
|
|
return pd.DataFrame()
|
|
|
|
|
|
- #获取预算结果库的结果....................................................................................................................
|
|
|
|
- def getdata(self):
|
|
|
|
- DBManager=DBDownload.DBDownload(self.host, self.port, self.db, self.user, self.password)
|
|
|
|
- with DBManager as DBManager:
|
|
|
|
- self.df_soh=DBManager.getdata('time_st','time_sp','sn','method','soh','cellsoh', tablename='cellstateestimation_soh', sn=self.sn)
|
|
|
|
-
|
|
|
|
#定义滑动滤波函数.........................................................................................................................
|
|
#定义滑动滤波函数.........................................................................................................................
|
|
def _np_move_avg(self,a, n, mode="same"):
|
|
def _np_move_avg(self,a, n, mode="same"):
|
|
return (np.convolve(a, np.ones((n,)) / n, mode=mode))
|
|
return (np.convolve(a, np.ones((n,)) / n, mode=mode))
|
|
@@ -83,7 +71,7 @@ class BatSoh:
|
|
self.tempweight=0.5
|
|
self.tempweight=0.5
|
|
self.StandardStandingTime=3600
|
|
self.StandardStandingTime=3600
|
|
elif min(celltemp)>=5:
|
|
elif min(celltemp)>=5:
|
|
- self.tempweight=0
|
|
|
|
|
|
+ self.tempweight=0.2
|
|
self.StandardStandingTime=7200
|
|
self.StandardStandingTime=7200
|
|
else:
|
|
else:
|
|
self.tempweight=0
|
|
self.tempweight=0
|
|
@@ -91,16 +79,16 @@ class BatSoh:
|
|
else:
|
|
else:
|
|
if min(celltemp)>=20:
|
|
if min(celltemp)>=20:
|
|
self.tempweight=1
|
|
self.tempweight=1
|
|
- self.StandardStandingTime=900
|
|
|
|
|
|
+ self.StandardStandingTime=1200
|
|
elif min(celltemp)>=10:
|
|
elif min(celltemp)>=10:
|
|
self.tempweight=0.8
|
|
self.tempweight=0.8
|
|
- self.StandardStandingTime=1200
|
|
|
|
|
|
+ self.StandardStandingTime=1800
|
|
elif min(celltemp)>=5:
|
|
elif min(celltemp)>=5:
|
|
self.tempweight=0.3
|
|
self.tempweight=0.3
|
|
- self.StandardStandingTime=1800
|
|
|
|
|
|
+ self.StandardStandingTime=3600
|
|
else:
|
|
else:
|
|
self.tempweight=0.1
|
|
self.tempweight=0.1
|
|
- self.StandardStandingTime=3600
|
|
|
|
|
|
+ self.StandardStandingTime=7200
|
|
|
|
|
|
#获取SOC差对应的SOH权重值...................................................................................................................
|
|
#获取SOC差对应的SOH权重值...................................................................................................................
|
|
def _deltsoc_weight(self,deltsoc):
|
|
def _deltsoc_weight(self,deltsoc):
|
|
@@ -234,7 +222,6 @@ class BatSoh:
|
|
#NCM充电数据soh计算.........................................................................................................................
|
|
#NCM充电数据soh计算.........................................................................................................................
|
|
def _ncmsoh_chrg(self):
|
|
def _ncmsoh_chrg(self):
|
|
self._chrgdata()
|
|
self._chrgdata()
|
|
- self.getdata()
|
|
|
|
ChgStartValid=[]
|
|
ChgStartValid=[]
|
|
ChgEndValid=[]
|
|
ChgEndValid=[]
|
|
tempweightlist=[]
|
|
tempweightlist=[]
|
|
@@ -363,7 +350,6 @@ class BatSoh:
|
|
|
|
|
|
#计算SOH......................................................................................................................
|
|
#计算SOH......................................................................................................................
|
|
if standingpoint_sp:
|
|
if standingpoint_sp:
|
|
- self.getdata() #获取已计算的soh
|
|
|
|
column_name=['time_st','time_sp','sn','method','soh','cellsoh']
|
|
column_name=['time_st','time_sp','sn','method','soh','cellsoh']
|
|
df_res=pd.DataFrame(columns=column_name)
|
|
df_res=pd.DataFrame(columns=column_name)
|
|
|
|
|
|
@@ -599,7 +585,6 @@ class BatSoh:
|
|
|
|
|
|
#开始计算SOH.............................................................................................................................................
|
|
#开始计算SOH.............................................................................................................................................
|
|
if standingpoint_sp or chrg_end:
|
|
if standingpoint_sp or chrg_end:
|
|
- self.getdata() #获取已计算的soh
|
|
|
|
column_name=['time_st','time_sp','sn','method','soh','cellsoh','weight']
|
|
column_name=['time_st','time_sp','sn','method','soh','cellsoh','weight']
|
|
df_res=pd.DataFrame(columns=column_name)
|
|
df_res=pd.DataFrame(columns=column_name)
|
|
|
|
|