import CBMSBatDiag import QX_BatteryParam from SC_SamplingSafty import SamplingSafty import datetime import pandas as pd from LIB.BACKEND import DBManager, Log from sqlalchemy import create_engine import time, datetime from apscheduler.schedulers.blocking import BlockingScheduler from LIB.MIDDLE.CellStateEstimation.Common.V1_0_1 import DBDownload from LIB.MIDDLE.CellStateEstimation.Common.V1_0_1 import log from pandas.core.frame import DataFrame import datacompy import pymysql import GetFeiShuData #...................................电池包电芯安全诊断函数...................................................................................................................... SNnums = ['MGMCLN750N215N049'] end_time=datetime.datetime.now() start_time=end_time-datetime.timedelta(seconds=120) start_time=start_time.strftime('%Y-%m-%d %H:%M:%S') end_time=end_time.strftime('%Y-%m-%d %H:%M:%S') for sn in SNnums: start=time.time() print(sn) if 'PK500' in sn: celltype=1 #6040三元电芯 elif 'PK502' in sn: celltype=2 #4840三元电芯 elif 'K504B' in sn: celltype=99 #60ah林磷酸铁锂电芯 elif 'MGMLXN750' in sn: celltype=3 #力信50ah三元电芯 elif 'MGMCLN750' or 'UD' in sn: celltype=4 #CATL 50ah三元电芯 else: print('SN:{},未找到对应电池类型!!!'.format(sn)) continue # sys.exit() param=QX_BatteryParam.BatteryInfo(celltype) print(sn) # sn='PK50201A000002039' # celltype=2 # start_time='2021-05-02 09:12:26' # end_time='2021-06-03 19:12:26' # # df_bms= pd.read_csv(r'D:\Platform\platform_python\data_analyze_platform\USER\01qixiang\98Download\\'+'BMS_'+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']) df_bms = df_data['bms'] print(df_bms) end = time.time() print(end - start)