Browse Source

soh计算部署

lmstack 3 years ago
parent
commit
a83c6a923f

+ 46 - 0
LIB/FRONTEND/CellStateEstimation/SOH/create_table.py

@@ -0,0 +1,46 @@
+'''
+定义表的结构,并在数据库中创建对应的数据表
+'''
+__author__ = 'lmstack'
+
+from sqlalchemy.ext.declarative import declarative_base
+from sqlalchemy import Column, String, create_engine, Integer, DateTime, BigInteger, FLOAT, TIMESTAMP, func, Text
+from urllib import parse
+Base = declarative_base()
+
+
+class ConsistencyDeltaSoc(Base):
+    __tablename__ = "soh_result"
+    __table_args__ = ({'comment': 'soh 计算结果'})  # 添加索引和表注释
+
+    id = Column(Integer, primary_key=True, autoincrement=True, comment="主键")
+    add_time = Column(TIMESTAMP(True), server_default=func.now(), comment='记录创建时间') # 创建时间
+    update_time = Column(TIMESTAMP(True), nullable=False, server_default=func.now(), onupdate=func.now(), comment='记录更新时间') # 更新时间
+    sn = Column(String(64), comment="sn")
+    time_st = Column(TIMESTAMP(True), comment="开始时间")
+    time_sp = Column(TIMESTAMP(True), comment="结束时间")
+    method = Column(Integer, comment="计算方法")
+    soh = Column(FLOAT, comment="电池包soh")
+    cellsoh = Column(Text, comment="电芯soh")
+
+
+    # def __init__(self, sn, current, time_stamp, pack_state, line_state):
+    #     self.sn = sn
+    #     self.current = current
+    #     self.time_stamp = time_stamp
+    #     self.pack_state = pack_state
+    #     self.line_state = line_state
+
+# 执行该文件,创建表格到对应的数据库中
+if __name__ == "__main__":
+    host = 'rm-bp10j10qy42bzy0q77o.mysql.rds.aliyuncs.com'
+    port = 3306
+    user = 'qx_cas'
+    password = parse.quote_plus('Qx@123456')
+    database = 'qx_cas'
+    
+    db_engine = create_engine(
+        "mysql+pymysql://{}:{}@{}:{}/{}?charset=utf8".format(
+            user, password, host, port, database
+        ))
+    Base.metadata.create_all(db_engine)

+ 110 - 0
LIB/FRONTEND/CellStateEstimation/SOH/deploy.py

@@ -0,0 +1,110 @@
+
+__author__ = 'lmstack'
+#coding=utf-8
+import os
+import datetime
+import pandas as pd
+from LIB.BACKEND import DBManager, Log
+from sqlalchemy import create_engine
+from sqlalchemy.orm import sessionmaker
+import time, datetime
+import dateutil.relativedelta
+import traceback
+from LIB.MIDDLE.CellStateEstimation.SOH.V1_0_0 import CBMSBatSoh
+from urllib import parse
+import pymysql
+dbManager = DBManager.DBManager()
+if __name__ == "__main__":
+    
+    # 时间设置
+    now_time = datetime.datetime.now()
+    pre_time = now_time + dateutil.relativedelta.relativedelta(years=-3)#上个月时间
+    end_time=datetime.datetime.strftime(now_time,"%Y-%m-%d 00:00:00")
+    start_time=datetime.datetime.strftime(pre_time,"%Y-%m-%d 00:00:00")
+    
+    # end_time="2021-08-02 01:00:00"
+    # start_time="2019-01-01 00:00:00"
+    
+
+    # 更新sn列表
+    host='rm-bp10j10qy42bzy0q7.mysql.rds.aliyuncs.com'
+    port=3306
+    db='qixiang_oss'
+    user='qixiang_oss'
+    password='Qixiang2021'
+    conn = pymysql.connect(host=host, port=port, user=user, password=password, database=db)
+    cursor = conn.cursor()
+    cursor.execute("select sn, imei from app_device")
+    res = cursor.fetchall()
+    df_sn = pd.DataFrame(res, columns=['sn', 'imei'])
+    df_sn = df_sn.reset_index(drop=True)
+    conn.close();
+    
+    # 数据库配置
+    host = 'rm-bp10j10qy42bzy0q77o.mysql.rds.aliyuncs.com'
+    port = 3306
+    user = 'qx_cas'
+    password = parse.quote_plus('Qx@123456')
+    database = 'qx_cas'
+
+    db_engine = create_engine(
+        "mysql+pymysql://{}:{}@{}:{}/{}?charset=utf8".format(
+            user, password, host, port, database
+        ))
+    DbSession = sessionmaker(bind=db_engine)
+    
+    # 日志配置
+    now_str = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()).replace(":","_")
+    log_path = 'log/' + now_str
+    if not os.path.exists(log_path):
+        os.makedirs(log_path)
+    log = Log.Mylog(log_name='soh', log_level = 'info')
+    log.set_file_hl(file_name='{}/info.log'.format(log_path), log_level='info', size=1024* 1024 * 100)
+    log.set_file_hl(file_name='{}/error.log'.format(log_path), log_level='error', size=1024* 1024 * 100)
+    logger = log.get_logger()
+
+    logger.info("pid is {}".format(os.getpid()))
+    
+
+
+    # 算法参数
+    host='rm-bp10j10qy42bzy0q77o.mysql.rds.aliyuncs.com'
+    port=3306
+    db='qx_cas'
+    user='qx_read'
+    password='Qx@123456'
+    tablename='soh_result'
+
+    for i in range(0, len(df_sn)):
+        try:
+            if df_sn.loc[i, 'imei'][5:9] == 'N640':
+                celltype=1 #6040三元电芯
+            elif df_sn.loc[i, 'imei'][5:9] == 'N440':
+                celltype=2 #4840三元电芯
+            elif df_sn.loc[i, 'imei'][5:9] == 'L660':
+                celltype=99 # 6060锂电芯
+            elif df_sn.loc[i, 'imei'][3:5] == 'LX' and df_sn.loc[i, 'imei'][5:9] == 'N750':    
+                celltype=3 #力信 50ah三元电芯
+            elif df_sn.loc[i, 'imei'][3:5] == 'CL' and df_sn.loc[i, 'imei'][5:9] == 'N750': 
+                celltype=4 #CATL 50ah三元电芯
+            else:
+                continue
+            sn = df_sn.loc[i, 'sn']
+            
+            logger.info("pid-{} celltype-{} SN: {} START!".format(os.getpid(), celltype, sn))
+            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']
+
+            BatSoh=CBMSBatSoh.BatSoh(sn,celltype,df_bms,df_accum,host, port, db, user, password, tablename)
+            df_res=BatSoh.batsoh()
+
+            if not df_res.empty:
+                df_res.columns = ['time_st', 'time_sp', 'sn', 'method', 'soh', 'cellsoh']
+                df_res.to_sql("soh_result",con=db_engine, if_exists="append",index=False)
+            logger.info("pid-{} celltype-{} SN: {} DONE!".format(os.getpid(), celltype, sn))
+        except:
+            logger.error(traceback.format_exc)
+            logger.error(u"{} :{},{} 任务运行错误\n".format(sn,start_time,end_time), exc_info=True)
+

+ 75 - 0
LIB/FRONTEND/CellStateEstimation/SOH/main.py

@@ -0,0 +1,75 @@
+import CBMSBatSoh
+import log
+#coding=utf-8
+import os
+import sys
+import datetime
+import pandas as pd
+from LIB.BACKEND import DBManager, Log
+# from LIB.MIDDLE import SignalMonitor
+from sqlalchemy import create_engine
+from sqlalchemy.orm import sessionmaker
+import time, datetime
+from LIB.MIDDLE.soh import NCMSoh_20210716 as NCMSoh
+from LIB.MIDDLE.soh import LFPSoh_20210711 as LFPSoh
+from urllib import parse
+
+host='rm-bp10j10qy42bzy0q77o.mysql.rds.aliyuncs.com'
+port=3306
+db='qx_cas'
+user='qx_read'
+password='Qx@123456'
+tablename='soh_result'
+
+dbManager = DBManager.DBManager()
+if __name__ == "__main__":
+    SNdata_6040 = pd.read_excel('骑享资产梳理-20210621.xlsx', sheet_name='6040骑享')
+    SNdata_6060 = pd.read_excel('骑享资产梳理-20210621.xlsx', sheet_name='6060')
+    SNdata_4840 = pd.read_excel('骑享资产梳理-20210621.xlsx', sheet_name='4840骑享')
+    SNdata_7250 = pd.read_excel('骑享资产梳理-20210621.xlsx', sheet_name='7250')
+    SNnums_6060=SNdata_6060['SN号']
+    SNnums_6040=SNdata_6040['SN号']
+    SNnums_4840=SNdata_4840['SN号']
+    SNnums_7250=SNdata_7250['SN号']
+
+    SNnums=SNnums_6040.tolist()+SNnums_6060.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)
+    end_time=str(now_time)
+    start_time=str(start_time)
+
+    #log信息配置
+    mylog=log.Mylog('log.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('未找到对应电池编号!!!')
+                sys.exit()
+            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')
+
+            BatSoh=CBMSBatSoh.BatSoh(sn,celltype,df_bms,df_accum,host, port, db, user, password, tablename)
+            df_res=BatSoh.batsoh()
+            df_res.to_csv('BMS_SOH_'+sn+'.csv',encoding='GB18030')
+             
+        except IndexError as e:
+            print(repr(e))
+            mylog.logopt(sn,e)
+            pass

+ 4 - 0
LIB/FRONTEND/CellStateEstimation/SOH/run.bat

@@ -0,0 +1,4 @@
+cd /d D:\deploy\python_platform\data_analyze_platform\LIB\FRONTEND\CellStateEstimation\SOH
+title soh 计算
+D:\env\py_pro\python.exe D:\deploy\python_platform\data_analyze_platform\LIB\FRONTEND\CellStateEstimation\SOH\deploy.py
+pause

+ 2 - 2
LIB/FRONTEND/DrivingRange/create_table2.py

@@ -13,10 +13,10 @@ class DrivingRangeResult(Base):
     __tablename__ = "driving_range_result"
     __table_args__ = ({'comment': '每5分钟计算一次续驶里程结果'})  # 添加索引和表注释
 
-    # id = Column(Integer, primary_key=True, autoincrement=True, comment="主键")
+    id = Column(Integer, primary_key=True, autoincrement=True, comment="主键")
     add_time = Column(TIMESTAMP(True), server_default=func.now(), comment='记录创建时间') # 创建时间
     update_time = Column(TIMESTAMP(True), nullable=False, server_default=func.now(), onupdate=func.now(), comment='记录更新时间') # 更新时间
-    sn = Column(String(64), comment="sn, 主键", primary_key=True,)
+    sn = Column(String(64), comment="sn")
     time = Column(DateTime, comment="时间")
     soc = Column(FLOAT, comment="soc")
     a0 = Column(FLOAT, comment="系数")

+ 21 - 18
LIB/FRONTEND/DrivingRange/deploy_driving_range.py

@@ -77,24 +77,27 @@ if __name__ == "__main__":
         logger.info(u"{},{} 任务运行开始\n".format(start_time,end_time), exc_info=True)
         df_res = UpdtFct.updtVehElecRng(db_qx, db_qx, sn_newest_table_name='driving_range_sn_factor_newest', input_time=start_time)
         df_res = df_res.reset_index(drop=True)
-        session = DbSession()
-        for i in range(0, len(df_res)-1):
-            obj = session.query(DrivingRangeResult).filter_by(sn=df_res.loc[i,'sn']).first()
-            if not obj:
-                obj = DrivingRangeResult(df_res.loc[i,'sn'],df_res.loc[i,'time'],df_res.loc[i,'soc'],df_res.loc[i,'a0'],df_res.loc[i,'a1'],df_res.loc[i,'a2'],df_res.loc[i,'a3'],df_res.loc[i,'a4'],
-                                         df_res.loc[i,'vehelecrng'])               
-            else:
-                obj.time = df_res.loc[i,'time']
-                obj.soc = df_res.loc[i,'soc']
-                obj.a0 = df_res.loc[i,'a0']
-                obj.a1 = df_res.loc[i,'a1']
-                obj.a2 = df_res.loc[i,'a2']
-                obj.a3 = df_res.loc[i,'a3']
-                obj.a4 = df_res.loc[i,'a4']
-                obj.vehelecrng = df_res.loc[i,'vehelecrng']
-            session.add(obj)
-        session.commit()
-        session.close()
+        if not df_res.empty:
+            df_res.columns = ['sn', 'time', 'soc', 'a0', 'a1', 'a2', 'a3', 'a4', 'vehelecrng']                
+            df_res.to_sql("driving_range_result",con=db_engine, if_exists="append",index=False)
+        # session = DbSession()
+        # for i in range(0, len(df_res)-1):
+        #     obj = session.query(DrivingRangeResult).filter_by(sn=df_res.loc[i,'sn']).first()
+        #     if not obj:
+        #         obj = DrivingRangeResult(df_res.loc[i,'sn'],df_res.loc[i,'time'],df_res.loc[i,'soc'],df_res.loc[i,'a0'],df_res.loc[i,'a1'],df_res.loc[i,'a2'],df_res.loc[i,'a3'],df_res.loc[i,'a4'],
+        #                                  df_res.loc[i,'vehelecrng'])               
+        #     else:
+        #         obj.time = df_res.loc[i,'time']
+        #         obj.soc = df_res.loc[i,'soc']
+        #         obj.a0 = df_res.loc[i,'a0']
+        #         obj.a1 = df_res.loc[i,'a1']
+        #         obj.a2 = df_res.loc[i,'a2']
+        #         obj.a3 = df_res.loc[i,'a3']
+        #         obj.a4 = df_res.loc[i,'a4']
+        #         obj.vehelecrng = df_res.loc[i,'vehelecrng']
+        #     session.add(obj)
+        # session.commit()
+        # session.close()
         logger.info(u"{},{} 续驶里程计算完成\n".format(start_time,end_time), exc_info=True)
     except:
         logger.error(traceback.format_exc)

+ 243 - 31
demo.ipynb

@@ -2,15 +2,15 @@
  "cells": [
   {
    "cell_type": "code",
-   "execution_count": 8,
+   "execution_count": 1,
    "source": [
     "# 获取数据\r\n",
     "import sys\r\n",
     "from LIB.BACKEND import DBManager\r\n",
     "\r\n",
-    "sn = \"MGMLXN750N217V003\"\r\n",
-    "st = '2021-07-24 10:38:47'\r\n",
-    "et = '2021-08-24 10:38:47'\r\n",
+    "sn = \"MGMLXN750N218C010\"\r\n",
+    "st = '2021-08-28 04:30:13'\r\n",
+    "et = '2021-08-28 04:40:13'\r\n",
     "\r\n",
     "dbManager = DBManager.DBManager()\r\n",
     "df_data = dbManager.get_data(sn=sn, start_time=st, end_time=et, data_groups=['bms', 'gps', 'accum', 'system'])\r\n",
@@ -25,35 +25,247 @@
      "output_type": "stream",
      "name": "stdout",
      "text": [
-      "### start to get data MGMLXN750N217V003 from 2021-07-24 10:38:47 to 2021-08-24 10:38:47\n",
-      "# get data from 2021-07-30 10:38:47 to 2021-07-31 10:38:47......... "
+      "### start to get data MGMLXN750N218C010 from 2021-08-28 04:30:13 to 2021-08-28 04:40:13\n",
+      "# get data from 2021-08-28 04:30:13 to 2021-08-28 04:40:13......... \n",
+      "all data-getting done, bms_count is 6, gps_count is 8, system_count is 0, accum_count is 0 \n",
+      "\n"
      ]
-    },
+    }
+   ],
+   "metadata": {}
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 2,
+   "source": [
+    "df_bms"
+   ],
+   "outputs": [
     {
-     "output_type": "error",
-     "ename": "Exception",
-     "evalue": "",
-     "traceback": [
-      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
-      "\u001b[1;31mValueError\u001b[0m                                Traceback (most recent call last)",
-      "\u001b[1;32mD:\\env\\py_pro\\lib\\site-packages\\pandas\\core\\internals\\managers.py\u001b[0m in \u001b[0;36mcreate_block_manager_from_blocks\u001b[1;34m(blocks, axes)\u001b[0m\n\u001b[0;32m   1670\u001b[0m                 blocks = [\n\u001b[1;32m-> 1671\u001b[1;33m                     \u001b[0mmake_block\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mvalues\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mblocks\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mplacement\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mslice\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mlen\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0maxes\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m   1672\u001b[0m                 ]\n",
-      "\u001b[1;32mD:\\env\\py_pro\\lib\\site-packages\\pandas\\core\\internals\\blocks.py\u001b[0m in \u001b[0;36mmake_block\u001b[1;34m(values, placement, klass, ndim, dtype)\u001b[0m\n\u001b[0;32m   2743\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m-> 2744\u001b[1;33m     \u001b[1;32mreturn\u001b[0m \u001b[0mklass\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mvalues\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mndim\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mndim\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mplacement\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mplacement\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m   2745\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n",
-      "\u001b[1;32mD:\\env\\py_pro\\lib\\site-packages\\pandas\\core\\internals\\blocks.py\u001b[0m in \u001b[0;36m__init__\u001b[1;34m(self, values, placement, ndim)\u001b[0m\n\u001b[0;32m    129\u001b[0m         \u001b[1;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_validate_ndim\u001b[0m \u001b[1;32mand\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mndim\u001b[0m \u001b[1;32mand\u001b[0m \u001b[0mlen\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mmgr_locs\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;33m!=\u001b[0m \u001b[0mlen\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mvalues\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 130\u001b[1;33m             raise ValueError(\n\u001b[0m\u001b[0;32m    131\u001b[0m                 \u001b[1;34mf\"Wrong number of items passed {len(self.values)}, \"\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
-      "\u001b[1;31mValueError\u001b[0m: Wrong number of items passed 37, placement implies 41",
-      "\nDuring handling of the above exception, another exception occurred:\n",
-      "\u001b[1;31mValueError\u001b[0m                                Traceback (most recent call last)",
-      "\u001b[1;32md:\\deploy\\python_platform\\data_analyze_platform\\LIB\\BACKEND\\DBManager.py\u001b[0m in \u001b[0;36mget_data\u001b[1;34m(self, url, sn, start_time, end_time, data_groups)\u001b[0m\n\u001b[0;32m    340\u001b[0m                             \u001b[0mfile_url\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0murl\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mformat\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m12\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0msn\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;33m+\u001b[0m \u001b[1;34m\"&from=\"\u001b[0m\u001b[1;33m+\u001b[0m\u001b[0mtimefrom\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mstrftime\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'%Y-%m-%d %H:%M:%S'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m+\u001b[0m\u001b[1;34m\"&to=\"\u001b[0m\u001b[1;33m+\u001b[0m\u001b[0mtimeto\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mstrftime\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'%Y-%m-%d %H:%M:%S'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 341\u001b[1;33m                             \u001b[0mbms_data\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mDBManager\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_get_data\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mfile_url\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;34m'bms'\u001b[0m\u001b[1;33m,\u001b[0m\u001b[0mmode\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m    342\u001b[0m                         \u001b[1;32mif\u001b[0m \u001b[0mdata_group\u001b[0m \u001b[1;33m==\u001b[0m \u001b[1;34m'gps'\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
-      "\u001b[1;32md:\\deploy\\python_platform\\data_analyze_platform\\LIB\\BACKEND\\DBManager.py\u001b[0m in \u001b[0;36m_get_data\u001b[1;34m(urls, type_name, mode)\u001b[0m\n\u001b[0;32m    243\u001b[0m                 \u001b[0mdata_blocks\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;33m[\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 244\u001b[1;33m             \u001b[0mdf_all\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mpd\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mDataFrame\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mcolumns\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mcolumns_name\u001b[0m\u001b[1;33m,\u001b[0m\u001b[0mdata\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mdata_blocks\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m    245\u001b[0m             \u001b[1;32mif\u001b[0m \u001b[1;32mnot\u001b[0m \u001b[0mdf_all\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mempty\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
-      "\u001b[1;32mD:\\env\\py_pro\\lib\\site-packages\\pandas\\core\\frame.py\u001b[0m in \u001b[0;36m__init__\u001b[1;34m(self, data, index, columns, dtype, copy)\u001b[0m\n\u001b[0;32m    496\u001b[0m             \u001b[1;32melse\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 497\u001b[1;33m                 \u001b[0mmgr\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0minit_ndarray\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mdata\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mindex\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mcolumns\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mdtype\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mdtype\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mcopy\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mcopy\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m    498\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n",
-      "\u001b[1;32mD:\\env\\py_pro\\lib\\site-packages\\pandas\\core\\internals\\construction.py\u001b[0m in \u001b[0;36minit_ndarray\u001b[1;34m(values, index, columns, dtype, copy)\u001b[0m\n\u001b[0;32m    233\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 234\u001b[1;33m     \u001b[1;32mreturn\u001b[0m \u001b[0mcreate_block_manager_from_blocks\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mblock_values\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m[\u001b[0m\u001b[0mcolumns\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mindex\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m    235\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n",
-      "\u001b[1;32mD:\\env\\py_pro\\lib\\site-packages\\pandas\\core\\internals\\managers.py\u001b[0m in \u001b[0;36mcreate_block_manager_from_blocks\u001b[1;34m(blocks, axes)\u001b[0m\n\u001b[0;32m   1680\u001b[0m         \u001b[0mtot_items\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0msum\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mb\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mshape\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m]\u001b[0m \u001b[1;32mfor\u001b[0m \u001b[0mb\u001b[0m \u001b[1;32min\u001b[0m \u001b[0mblocks\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m-> 1681\u001b[1;33m         \u001b[1;32mraise\u001b[0m \u001b[0mconstruction_error\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mtot_items\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mblocks\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mshape\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0maxes\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0me\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m   1682\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n",
-      "\u001b[1;31mValueError\u001b[0m: Shape of passed values is (219, 37), indices imply (219, 41)",
-      "\nDuring handling of the above exception, another exception occurred:\n",
-      "\u001b[1;31mException\u001b[0m                                 Traceback (most recent call last)",
-      "\u001b[1;32m<ipython-input-8-d265fc353a42>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[0;32m      7\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m      8\u001b[0m \u001b[0mdbManager\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mDBManager\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mDBManager\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 9\u001b[1;33m \u001b[0mdf_data\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mdbManager\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mget_data\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0msn\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0msn\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mstart_time\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mst\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mend_time\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0met\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mdata_groups\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m'bms'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m'gps'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m'accum'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m'system'\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m     10\u001b[0m \u001b[1;31m#\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m     11\u001b[0m \u001b[0mdf_bms\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mdf_data\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m'bms'\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
-      "\u001b[1;32md:\\deploy\\python_platform\\data_analyze_platform\\LIB\\BACKEND\\DBManager.py\u001b[0m in \u001b[0;36mget_data\u001b[1;34m(self, url, sn, start_time, end_time, data_groups)\u001b[0m\n\u001b[0;32m    353\u001b[0m                         \u001b[1;32mcontinue\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    354\u001b[0m                     \u001b[1;32melse\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 355\u001b[1;33m                         \u001b[1;32mraise\u001b[0m \u001b[0mException\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m    356\u001b[0m                 \u001b[1;32melse\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    357\u001b[0m                     \u001b[0mbms_all_data\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mpd\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mconcat\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mbms_all_data\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mbms_data\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mignore_index\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;32mTrue\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
-      "\u001b[1;31mException\u001b[0m: "
-     ]
+     "output_type": "execute_result",
+     "data": {
+      "text/plain": [
+       "                   时间戳  GSM信号  故障等级  故障代码  开关状态  总电流[A]  总电压[V]  充电状态   单体压差  \\\n",
+       "0  2021-08-28 04:30:39   15.0   0.0   3.0   0.0     0.0    83.5   0.0  0.024   \n",
+       "1  2021-08-28 04:31:09   15.0   0.0   3.0   0.0     0.0    83.5   0.0  0.027   \n",
+       "2  2021-08-28 04:36:42   17.0   0.0   3.0   0.0     0.0    83.5   0.0  0.026   \n",
+       "3  2021-08-28 04:37:13   17.0   0.0  18.0   0.0     0.0    83.5   0.0  0.032   \n",
+       "4  2021-08-28 04:37:42   15.0   0.0  17.0   0.0     0.0    83.5   0.0  0.026   \n",
+       "5  2021-08-28 04:38:12   15.0   0.0  16.0   0.0     0.0    83.5   0.0  0.027   \n",
+       "\n",
+       "   SOC[%]  ...  单体温度1  单体温度2  单体温度3  单体温度4  其他温度1  其他温度2  其他温度3  其他温度4  其他温度5  \\\n",
+       "0    99.0  ...   44.0   45.0   45.0   42.0   98.0  -40.0   49.0   52.0   57.0   \n",
+       "1    99.0  ...   44.0   46.0   45.0   42.0   98.0  -40.0   50.0   52.0   57.0   \n",
+       "2    99.0  ...   47.0   48.0   48.0   44.0  100.0  -40.0   52.0   55.0   59.0   \n",
+       "3    99.0  ...   47.0   48.0   48.0   45.0  100.0  -40.0   52.0   55.0   60.0   \n",
+       "4    99.0  ...   47.0   48.0   48.0   45.0  100.0  -40.0   53.0   55.0   60.0   \n",
+       "5    99.0  ...   47.0   49.0   48.0   46.0  100.0  -40.0   53.0   55.0   60.0   \n",
+       "\n",
+       "   其他温度6  \n",
+       "0   56.0  \n",
+       "1   57.0  \n",
+       "2   59.0  \n",
+       "3   59.0  \n",
+       "4   60.0  \n",
+       "5   60.0  \n",
+       "\n",
+       "[6 rows x 41 columns]"
+      ],
+      "text/html": [
+       "<div>\n",
+       "<style scoped>\n",
+       "    .dataframe tbody tr th:only-of-type {\n",
+       "        vertical-align: middle;\n",
+       "    }\n",
+       "\n",
+       "    .dataframe tbody tr th {\n",
+       "        vertical-align: top;\n",
+       "    }\n",
+       "\n",
+       "    .dataframe thead th {\n",
+       "        text-align: right;\n",
+       "    }\n",
+       "</style>\n",
+       "<table border=\"1\" class=\"dataframe\">\n",
+       "  <thead>\n",
+       "    <tr style=\"text-align: right;\">\n",
+       "      <th></th>\n",
+       "      <th>时间戳</th>\n",
+       "      <th>GSM信号</th>\n",
+       "      <th>故障等级</th>\n",
+       "      <th>故障代码</th>\n",
+       "      <th>开关状态</th>\n",
+       "      <th>总电流[A]</th>\n",
+       "      <th>总电压[V]</th>\n",
+       "      <th>充电状态</th>\n",
+       "      <th>单体压差</th>\n",
+       "      <th>SOC[%]</th>\n",
+       "      <th>...</th>\n",
+       "      <th>单体温度1</th>\n",
+       "      <th>单体温度2</th>\n",
+       "      <th>单体温度3</th>\n",
+       "      <th>单体温度4</th>\n",
+       "      <th>其他温度1</th>\n",
+       "      <th>其他温度2</th>\n",
+       "      <th>其他温度3</th>\n",
+       "      <th>其他温度4</th>\n",
+       "      <th>其他温度5</th>\n",
+       "      <th>其他温度6</th>\n",
+       "    </tr>\n",
+       "  </thead>\n",
+       "  <tbody>\n",
+       "    <tr>\n",
+       "      <th>0</th>\n",
+       "      <td>2021-08-28 04:30:39</td>\n",
+       "      <td>15.0</td>\n",
+       "      <td>0.0</td>\n",
+       "      <td>3.0</td>\n",
+       "      <td>0.0</td>\n",
+       "      <td>0.0</td>\n",
+       "      <td>83.5</td>\n",
+       "      <td>0.0</td>\n",
+       "      <td>0.024</td>\n",
+       "      <td>99.0</td>\n",
+       "      <td>...</td>\n",
+       "      <td>44.0</td>\n",
+       "      <td>45.0</td>\n",
+       "      <td>45.0</td>\n",
+       "      <td>42.0</td>\n",
+       "      <td>98.0</td>\n",
+       "      <td>-40.0</td>\n",
+       "      <td>49.0</td>\n",
+       "      <td>52.0</td>\n",
+       "      <td>57.0</td>\n",
+       "      <td>56.0</td>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>1</th>\n",
+       "      <td>2021-08-28 04:31:09</td>\n",
+       "      <td>15.0</td>\n",
+       "      <td>0.0</td>\n",
+       "      <td>3.0</td>\n",
+       "      <td>0.0</td>\n",
+       "      <td>0.0</td>\n",
+       "      <td>83.5</td>\n",
+       "      <td>0.0</td>\n",
+       "      <td>0.027</td>\n",
+       "      <td>99.0</td>\n",
+       "      <td>...</td>\n",
+       "      <td>44.0</td>\n",
+       "      <td>46.0</td>\n",
+       "      <td>45.0</td>\n",
+       "      <td>42.0</td>\n",
+       "      <td>98.0</td>\n",
+       "      <td>-40.0</td>\n",
+       "      <td>50.0</td>\n",
+       "      <td>52.0</td>\n",
+       "      <td>57.0</td>\n",
+       "      <td>57.0</td>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>2</th>\n",
+       "      <td>2021-08-28 04:36:42</td>\n",
+       "      <td>17.0</td>\n",
+       "      <td>0.0</td>\n",
+       "      <td>3.0</td>\n",
+       "      <td>0.0</td>\n",
+       "      <td>0.0</td>\n",
+       "      <td>83.5</td>\n",
+       "      <td>0.0</td>\n",
+       "      <td>0.026</td>\n",
+       "      <td>99.0</td>\n",
+       "      <td>...</td>\n",
+       "      <td>47.0</td>\n",
+       "      <td>48.0</td>\n",
+       "      <td>48.0</td>\n",
+       "      <td>44.0</td>\n",
+       "      <td>100.0</td>\n",
+       "      <td>-40.0</td>\n",
+       "      <td>52.0</td>\n",
+       "      <td>55.0</td>\n",
+       "      <td>59.0</td>\n",
+       "      <td>59.0</td>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>3</th>\n",
+       "      <td>2021-08-28 04:37:13</td>\n",
+       "      <td>17.0</td>\n",
+       "      <td>0.0</td>\n",
+       "      <td>18.0</td>\n",
+       "      <td>0.0</td>\n",
+       "      <td>0.0</td>\n",
+       "      <td>83.5</td>\n",
+       "      <td>0.0</td>\n",
+       "      <td>0.032</td>\n",
+       "      <td>99.0</td>\n",
+       "      <td>...</td>\n",
+       "      <td>47.0</td>\n",
+       "      <td>48.0</td>\n",
+       "      <td>48.0</td>\n",
+       "      <td>45.0</td>\n",
+       "      <td>100.0</td>\n",
+       "      <td>-40.0</td>\n",
+       "      <td>52.0</td>\n",
+       "      <td>55.0</td>\n",
+       "      <td>60.0</td>\n",
+       "      <td>59.0</td>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>4</th>\n",
+       "      <td>2021-08-28 04:37:42</td>\n",
+       "      <td>15.0</td>\n",
+       "      <td>0.0</td>\n",
+       "      <td>17.0</td>\n",
+       "      <td>0.0</td>\n",
+       "      <td>0.0</td>\n",
+       "      <td>83.5</td>\n",
+       "      <td>0.0</td>\n",
+       "      <td>0.026</td>\n",
+       "      <td>99.0</td>\n",
+       "      <td>...</td>\n",
+       "      <td>47.0</td>\n",
+       "      <td>48.0</td>\n",
+       "      <td>48.0</td>\n",
+       "      <td>45.0</td>\n",
+       "      <td>100.0</td>\n",
+       "      <td>-40.0</td>\n",
+       "      <td>53.0</td>\n",
+       "      <td>55.0</td>\n",
+       "      <td>60.0</td>\n",
+       "      <td>60.0</td>\n",
+       "    </tr>\n",
+       "    <tr>\n",
+       "      <th>5</th>\n",
+       "      <td>2021-08-28 04:38:12</td>\n",
+       "      <td>15.0</td>\n",
+       "      <td>0.0</td>\n",
+       "      <td>16.0</td>\n",
+       "      <td>0.0</td>\n",
+       "      <td>0.0</td>\n",
+       "      <td>83.5</td>\n",
+       "      <td>0.0</td>\n",
+       "      <td>0.027</td>\n",
+       "      <td>99.0</td>\n",
+       "      <td>...</td>\n",
+       "      <td>47.0</td>\n",
+       "      <td>49.0</td>\n",
+       "      <td>48.0</td>\n",
+       "      <td>46.0</td>\n",
+       "      <td>100.0</td>\n",
+       "      <td>-40.0</td>\n",
+       "      <td>53.0</td>\n",
+       "      <td>55.0</td>\n",
+       "      <td>60.0</td>\n",
+       "      <td>60.0</td>\n",
+       "    </tr>\n",
+       "  </tbody>\n",
+       "</table>\n",
+       "<p>6 rows × 41 columns</p>\n",
+       "</div>"
+      ]
+     },
+     "metadata": {},
+     "execution_count": 2
     }
    ],
    "metadata": {}