12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- import CBMSBatSoh
- import log
- #coding=utf-8
- import datetime
- import pandas as pd
- from LIB.BACKEND import DBManager, Log
- from sqlalchemy import create_engine
- import time, datetime
- import os
- dbManager = DBManager.DBManager()
- if __name__ == "__main__":
- filepath=r'D:\00WorkSpace\01Python\data_analyze_platform\USER\03hezhong\98Download'
- files=os.listdir(filepath)
- # now_time=datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
- # now_time=datetime.datetime.strptime(now_time,'%Y-%m-%d %H:%M:%S')
- # start_time=now_time-datetime.timedelta(days=30)
- # end_time=str(now_time)
- # start_time=str(start_time)
- #log信息配置
- mylog=log.Mylog('log.txt','error')
- mylog.logcfg()
- for filename in files:
- try:
- # filename=files[3]
- sn=filename[7:17]
- print(filename)
- celltype=100
- start_time='2021-04-01 19:12:26'
- end_time='2021-09-02 19:12:26'
- df_volt = pd.read_excel(filepath+'\\'+filename,sheet_name='单体电池电压数据')
- df_temp = pd.read_excel(filepath+'\\'+filename,sheet_name='单体电池温度数据')
- df_bms = pd.read_excel(filepath+'\\'+filename,sheet_name='整车数据')
- df_volt.columns=df_volt.loc[0].astype('str')
- df_temp.columns=df_temp.loc[0].astype('str')
- df_volt=df_volt.drop(0,axis=0)
- df_temp=df_temp.drop(0,axis=0)
- df_volt=df_volt.reset_index(drop=True)
- df_temp=df_temp.reset_index(drop=True)
-
- df_accum=pd.DataFrame()
- # df_volt.to_excel(r'D:\00WorkSpace\01Python\data_analyze_platform\USER\03hezhong\99Result\\'+'CBMS_v_'+sn+'.xlsx')
- # df_temp.to_excel(r'D:\00WorkSpace\01Python\data_analyze_platform\USER\03hezhong\99Result\\'+'CBMS_t_'+sn+'.xlsx')
- # print(df_volt['1.0'])
- BatSoh=CBMSBatSoh.BatSoh(sn,celltype,df_bms,df_volt,df_temp,df_accum)
- df_res=BatSoh.batsoh()
- df_res.to_excel(r'D:\00WorkSpace\01Python\data_analyze_platform\USER\03hezhong\99Result\\'+'CBMS_SOH_'+sn+'.xlsx')
- print(sn,'done!!!')
-
- except IndexError as e:
- print(repr(e))
- mylog.logopt(sn,e)
- pass
|