|
@@ -6,27 +6,25 @@ import pandas as pd
|
|
|
from LIB.BACKEND import DBManager, Log
|
|
|
from sqlalchemy import create_engine
|
|
|
import time, datetime
|
|
|
-
|
|
|
-host='rm-bp10j10qy42bzy0q77o.mysql.rds.aliyuncs.com'
|
|
|
-port=3306
|
|
|
-db='qx_cas'
|
|
|
-user='qx_read'
|
|
|
-password='Qx@123456'
|
|
|
-tablename='soh_result'
|
|
|
+from LIB.MIDDLE.CellStateEstimation.Common import DBDownload
|
|
|
|
|
|
dbManager = DBManager.DBManager()
|
|
|
if __name__ == "__main__":
|
|
|
- excelpath=r'D:\Platform\platform_python\data_analyze_platform\USER\01qixiang\骑享资产梳理-20210621.xlsx'
|
|
|
- SNdata_6040 = pd.read_excel(excelpath, sheet_name='6040骑享')
|
|
|
- SNdata_6060 = pd.read_excel(excelpath, sheet_name='6060')
|
|
|
- SNdata_4840 = pd.read_excel(excelpath, sheet_name='4840骑享')
|
|
|
- SNdata_7250 = pd.read_excel(excelpath, sheet_name='7250')
|
|
|
- SNnums_6060=SNdata_6060['SN号']
|
|
|
- SNnums_6040=SNdata_6040['SN号']
|
|
|
- SNnums_4840=SNdata_4840['SN号']
|
|
|
- SNnums_7250=SNdata_7250['SN号']
|
|
|
+ excelpath=r'D:\Platform\platform_python\data_analyze_platform\USER\01qixiang\sn-20210903.xlsx'
|
|
|
+ SNdata_6060 = pd.read_excel(excelpath, sheet_name='科易6060')
|
|
|
+ SNdata_6040 = pd.read_excel(excelpath, sheet_name='科易6040')
|
|
|
+ SNdata_4840 = pd.read_excel(excelpath, sheet_name='科易4840')
|
|
|
+ SNdata_L7255 = pd.read_excel(excelpath, sheet_name='格林美-力信7255')
|
|
|
+ SNdata_C7255 = pd.read_excel(excelpath, sheet_name='格林美-CATL7255')
|
|
|
+ SNdata_U7255 = pd.read_excel(excelpath, sheet_name='优旦7255')
|
|
|
+ SNnums_6060=SNdata_6060['SN号'].tolist()
|
|
|
+ SNnums_6040=SNdata_6040['SN号'].tolist()
|
|
|
+ SNnums_4840=SNdata_4840['SN号'].tolist()
|
|
|
+ SNnums_L7255=SNdata_L7255['SN号'].tolist()
|
|
|
+ SNnums_C7255=SNdata_C7255['SN号'].tolist()
|
|
|
+ SNnums_U7255=SNdata_U7255['SN号'].tolist()
|
|
|
+ SNnums= SNnums_6060 + SNnums_L7255 + SNnums_C7255 + SNnums_6040 + SNnums_4840 + SNnums_U7255
|
|
|
|
|
|
- SNnums=SNnums_6060.tolist()+SNnums_6040.tolist()+SNnums_4840.tolist()
|
|
|
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)
|
|
@@ -50,23 +48,40 @@ if __name__ == "__main__":
|
|
|
elif 'MGMCLN750' in sn:
|
|
|
celltype=4 #CATL 50ah三元电芯
|
|
|
else:
|
|
|
- print('未找到对应电池编号!!!')
|
|
|
+ print('未找到对应电池编号!!!\n',sn)
|
|
|
# sys.exit()
|
|
|
|
|
|
- # sn='MGMCLN750N215H001'
|
|
|
- # start_time='2021-08-01 18:52:08'
|
|
|
- # end_time='2021-08-31 18:52:08'
|
|
|
+ sn='PK504B10100004353'
|
|
|
+ celltype=99
|
|
|
+ start_time='2021-04-01 19:12:26'
|
|
|
+ end_time='2021-06-02 19:12:26'
|
|
|
+ # df_bms= pd.read_csv(r'D:\Platform\platform_python\data_analyze_platform\USER\01qixiang\98Download\\'+'BMS_'+sn+'.csv',encoding='GB18030')
|
|
|
+ # df_accum= pd.read_csv(r'D:\Platform\platform_python\data_analyze_platform\USER\01qixiang\98Download\\'+'BMS_accum_'+sn+'.csv',encoding='GB18030')
|
|
|
|
|
|
+ #..........................................................................读取原始数据库数据...........................................................................
|
|
|
dbManager = DBManager.DBManager()
|
|
|
df_data = dbManager.get_data(sn=sn, start_time=start_time, end_time=end_time, data_groups=['bms','accum'])
|
|
|
df_bms = df_data['bms']
|
|
|
df_accum=df_data['accum']
|
|
|
- # df_bms.to_csv('BMS_'+sn+'.csv')
|
|
|
- # df_accum.to_csv('BMS_accum_'+sn+'.csv')
|
|
|
+ # df_bms.to_csv(r'D:\Platform\platform_python\data_analyze_platform\USER\01qixiang\98Download\\'+'BMS_'+sn+'.csv',encoding='GB18030')
|
|
|
+ # df_accum.to_csv(r'D:\Platform\platform_python\data_analyze_platform\USER\01qixiang\98Download\\'+'BMS_accum_'+sn+'.csv',encoding='GB18030')
|
|
|
+
|
|
|
+ #..........................................................................读取结果数据库数据.........................................................................
|
|
|
+ host='rm-bp10j10qy42bzy0q77o.mysql.rds.aliyuncs.com'
|
|
|
+ port=3306
|
|
|
+ db='qx_cas'
|
|
|
+ user='qx_read'
|
|
|
+ password='Qx@123456'
|
|
|
+ tablename='soh_result'
|
|
|
+ DBRead=DBDownload.DBDownload(host, port, db, user, password)
|
|
|
+ with DBRead as DBRead:
|
|
|
+ df_soh=DBRead.getdata('time_st','time_sp','sn','method','soh','cellsoh', tablename='cellstateestimation_soh', sn=sn)
|
|
|
|
|
|
- BatSoh=CBMSBatSoh.BatSoh(sn,celltype,df_bms,df_accum,host, port, db, user, password, tablename)
|
|
|
+ #..............................................................................计算soh...................................................................................
|
|
|
+ BatSoh=CBMSBatSoh.BatSoh(sn,celltype,df_bms,df_accum,df_soh)
|
|
|
df_res=BatSoh.batsoh()
|
|
|
- df_res.to_csv('BMS_SOH_'+sn+'.csv',encoding='GB18030')
|
|
|
+ df_res.to_csv(r'D:\Platform\platform_python\data_analyze_platform\USER\01qixiang\99Result\\'+'CBMS_SOH'+sn+'_1.csv',encoding='GB18030')
|
|
|
+ # print('done!!!')
|
|
|
|
|
|
except IndexError as e:
|
|
|
print(repr(e))
|