test.py 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import CBMSBatDiag
  2. import QX_BatteryParam
  3. from SC_SamplingSafty import SamplingSafty
  4. import datetime
  5. import pandas as pd
  6. from LIB.BACKEND import DBManager, Log
  7. from sqlalchemy import create_engine
  8. import time, datetime
  9. from apscheduler.schedulers.blocking import BlockingScheduler
  10. from LIB.MIDDLE.CellStateEstimation.Common.V1_0_1 import DBDownload
  11. from LIB.MIDDLE.CellStateEstimation.Common.V1_0_1 import log
  12. from pandas.core.frame import DataFrame
  13. import datacompy
  14. import pymysql
  15. import GetFeiShuData
  16. #...................................电池包电芯安全诊断函数......................................................................................................................
  17. SNnums = ['MGMCLN750N215N049']
  18. end_time=datetime.datetime.now()
  19. start_time=end_time-datetime.timedelta(seconds=120)
  20. start_time=start_time.strftime('%Y-%m-%d %H:%M:%S')
  21. end_time=end_time.strftime('%Y-%m-%d %H:%M:%S')
  22. for sn in SNnums:
  23. start=time.time()
  24. print(sn)
  25. if 'PK500' in sn:
  26. celltype=1 #6040三元电芯
  27. elif 'PK502' in sn:
  28. celltype=2 #4840三元电芯
  29. elif 'K504B' in sn:
  30. celltype=99 #60ah林磷酸铁锂电芯
  31. elif 'MGMLXN750' in sn:
  32. celltype=3 #力信50ah三元电芯
  33. elif 'MGMCLN750' or 'UD' in sn:
  34. celltype=4 #CATL 50ah三元电芯
  35. else:
  36. print('SN:{},未找到对应电池类型!!!'.format(sn))
  37. continue
  38. # sys.exit()
  39. param=QX_BatteryParam.BatteryInfo(celltype)
  40. print(sn)
  41. # sn='PK50201A000002039'
  42. # celltype=2
  43. # start_time='2021-05-02 09:12:26'
  44. # end_time='2021-06-03 19:12:26'
  45. # # df_bms= pd.read_csv(r'D:\Platform\platform_python\data_analyze_platform\USER\01qixiang\98Download\\'+'BMS_'+sn+'.csv',encoding='GB18030')
  46. #读取原始数据库数据........................................................................................................................................................
  47. dbManager = DBManager.DBManager()
  48. df_data = dbManager.get_data(sn=sn, start_time=start_time, end_time=end_time, data_groups=['bms'])
  49. df_bms = df_data['bms']
  50. print(df_bms)
  51. end = time.time()
  52. print(end - start)