1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- import CBMSBatInterShort
- import datetime
- import pandas as pd
- import datetime
- from USER.Common import DBDownload
- from USER.Common import log
- if __name__ == "__main__":
- SNnums= ['HeZhong']
- end_time=datetime.datetime.now()-datetime.timedelta(seconds=10)
- start_time=end_time-datetime.timedelta(seconds=12000)
- start_time=start_time.strftime('%Y-%m-%d %H:%M:%S')
- end_time=end_time.strftime('%Y-%m-%d %H:%M:%S')
- #log信息配置............................................................................................................................................................................
- mylog=log.Mylog('log_short.txt','error')
- mylog.logcfg()
- for sn in SNnums:
- try:
- # if 'PK500' in sn:
- # celltype=1 #6040三元电芯
- # elif 'PK502' in sn:
- # celltype=2 #4840三元电芯
- # elif 'PK504' in sn:
- # celltype=99 #60ah林磷酸铁锂电芯
- # elif 'MGMLXN750' in sn:
- # celltype=3 #力信50ah三元电芯
- # elif 'MGMCLN750' in sn:
- # celltype=4 #CATL 50ah三元电芯
- # else:
- # print('未找到对应电池编号!!!\n',sn)
- # # sys.exit()
- celltype=15
- #............................................................读取原始数据库数据...........................................................................
- df_bms= pd.read_csv(r'D:\00WorkSpace\01Python\data_analyze_platform\USER\03hezhong\98Download\合众data924T101(1).csv',encoding='GB18030')
- #............................................................读取结果数据库数据.........................................................................
- # host='rm-bp10j10qy42bzy0q77o.mysql.rds.aliyuncs.com'
- # port=3306
- # db='qx_cas'
- # user='qx_read'
- # password='Qx@123456'
- # mode=1
- # tablename='cellstateestimation_soh'
- # DBRead=DBDownload.DBDownload(host, port, db, user, password, mode)
- # with DBRead as DBRead:
- # df_soh=DBRead.getdata(param='time_st,time_sp,sn,method,soh,cellsoh', tablename=tablename, sn=sn, timename='time_sp', st=start_time, sp=end_time)
- df_soh=pd.DataFrame({'time_st':[1],'sn':[2],'soh':[100]})
- # print(df_soh)
-
- #...........................................................................计算漏电流............................................................................
- BatInterShort=CBMSBatInterShort.BatInterShort(sn,celltype,df_bms,df_soh)
- df_res=BatInterShort.intershort()
- df_res.to_excel(r'D:\00WorkSpace\01Python\data_analyze_platform\USER\03hezhong\99Result\\'+'CBMS_short_'+sn+'_1.xlsx')
- # print('done!!!')
-
- except Exception as e:
- print(repr(e))
- mylog.logopt(sn,e)
- pass
|