Przeglądaj źródła

Merge branch 'dev' of lmstack/data_analyze_platform into master

update
lmstack 3 lat temu
rodzic
commit
575d9ee178

+ 3 - 1
.gitignore

@@ -8,4 +8,6 @@
 /*.ipynb
 *.csv
 *.doc
-!/demo.ipynb
+*.ppt
+*.tmp
+!/demo.ipynb

+ 2 - 0
CONFIGURE/PathSetting.py

@@ -1,3 +1,5 @@
+__author__ = 'Wang Liming'
+
 base_path = 'F:\work\QX\data_analyze_platform'
 
 backend_path = base_path + '\LIB\BACKEND'

+ 2 - 1
LIB/BACKEND/DBManager.py

@@ -3,7 +3,8 @@
 
 预留:后期若改用通过访问数据库的形式进行数据的获取,则本文件负责数据库的连接,sql指令的执行,数据获取等功能。
 '''
-__author__ = 'wlm'
+__author__ = 'Wang Liming'
+
 
 from re import S
 import time

+ 2 - 1
LIB/BACKEND/DataPreProcess.py

@@ -2,7 +2,8 @@
 数据预处理类
 
 '''
-__author__ = 'wlm'
+__author__ = 'Wang Liming'
+
 
 import CONFIGURE.PathSetting as PathSetting
 import sys

+ 2 - 1
LIB/BACKEND/Log.py

@@ -2,7 +2,8 @@
 Log类
 
 '''
-__author__ = 'wlm'
+__author__ = 'Wang Liming'
+
 
 import logging
 import os

+ 2 - 1
LIB/BACKEND/Tools.py

@@ -2,7 +2,8 @@
 工具类
 
 '''
-__author__ = 'wlm'
+__author__ = 'Wang Liming'
+
 
 import CONFIGURE.PathSetting as PathSetting
 import sys

+ 2 - 0
LIB/FRONTEND/day_sta.py

@@ -1,3 +1,5 @@
+__author__ = 'Wang Liming'
+
 # 每日指标统计函数
 import CONFIGURE.PathSetting as PathSetting
 import sys

+ 2 - 1
LIB/MIDDLE/IndexStaByOneCycle.py

@@ -2,7 +2,8 @@
 基于单一状态(一次行车、一次静置、一次充电)的指标统计库
 
 '''
-__author__ = 'wlm'
+__author__ = 'Wang Liming'
+
 import CONFIGURE.PathSetting as PathSetting
 import sys
 sys.path.append(PathSetting.backend_path)

+ 2 - 1
LIB/MIDDLE/IndexStaByPeriod.py

@@ -2,7 +2,8 @@
 基于某个周期(一天,一周...)的指标统计库
 
 '''
-__author__ = 'wlm'
+__author__ = 'Wang Liming'
+
 import CONFIGURE.PathSetting as PathSetting
 import sys
 sys.path.append(PathSetting.backend_path)

+ 37 - 9
demo.ipynb

@@ -12,6 +12,7 @@
       "### start to get data PK504B10100004410 from 2021-06-29 00:00:00 to 2021-06-30 00:00:00\n",
       "# get data from 2021-06-29 00:00:00 to 2021-06-30 00:00:00......... \n",
       "Server Error, retry 1...... \n",
+      "Server Error, retry 1...... \n",
       "all data-getting done, bms_count is 4052, gps_count is 1676, system_count is 86, accum_count is 511 \n",
       "\n"
      ]
@@ -101,6 +102,41 @@
     "df_bms_pro, df_gps_pro, res_record= dataPrePro.data_gps_judge_after_combine(df_bms_pro, df_gps_pro)"
    ]
   },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "# 单cycle指标统计\r\n",
+    "import sys\r\n",
+    "import CONFIGURE.PathSetting as PathSetting\r\n",
+    "sys.path.append(PathSetting.middle_path)\r\n",
+    "#import IndexStaByOneCycle\r\n",
+    "import importlib\r\n",
+    "importlib.reload(IndexStaByOneCycle) \r\n",
+    "\r\n",
+    "indexSta = IndexStaByOneCycle.IndexStaByOneCycle()\r\n",
+    "\r\n",
+    "data_number_list = sorted(list(set(df_bms[(df_bms['data_status'].isin(['drive']))]['data_split_by_status'])))\r\n",
+    "for data_number in data_number_list[:]:\r\n",
+    "    df_sel_bms = df_bms[df_bms['data_split_by_status'] == data_number]\r\n",
+    "    df_sel_bms = df_sel_bms.reset_index(drop=True)\r\n",
+    "    df_sel_gps = df_gps[(df_gps['时间戳']>df_sel_bms.loc[0,'时间戳']) & (df_gps['时间戳']<df_sel_bms.loc[len(df_sel_bms)-1,'时间戳'])]\r\n",
+    "    df_sel_gps = df_sel_gps.reset_index(drop=True)\r\n",
+    "\r\n",
+    "    print(indexSta.odo_sta(np.array(df_sel_gps['odo'])))\r\n",
+    "    print(indexSta.capacity_sta(40, np.array(df_sel_bms['SOC[%]']), np.array(df_sel_bms['SOH[%]'])))\r\n",
+    "    print(indexSta.energy_sta(40, np.array(df_sel_bms['SOC[%]']), np.array(df_sel_bms['SOH[%]']),np.array(df_sel_bms['总电压[V]'])))\r\n",
+    "    print(indexSta.acc_time_sta(np.array(df_sel_bms['时间戳'])))\r\n",
+    "    print(indexSta.mean_temp_sta(np.array(df_sel_bms['单体温度1'])))\r\n",
+    "    print(indexSta.temp_change_rate_sta(np.array(df_sel_bms['时间戳']), np.array(df_sel_bms['单体温度1'])))\r\n",
+    "    print(indexSta.dischrg_max_pwr_sta(np.array(df_sel_bms['总电压[V]']), np.array(df_sel_bms['总电流[A]'])))\r\n",
+    "    print(indexSta.chrg_max_pwr_sta(np.array(df_sel_bms['总电压[V]']), np.array(df_sel_bms['总电流[A]'])))\r\n",
+    "    print(indexSta.speed_sta(indexSta.odo_sta(np.array(df_sel_gps['odo'])), indexSta.acc_time_sta(np.array(df_sel_gps['时间戳'])), np.array(df_sel_gps['speed'])))\r\n",
+    "    break"
+   ]
+  },
   {
    "cell_type": "code",
    "execution_count": 11,
@@ -129,16 +165,8 @@
    "name": "python3"
   },
   "language_info": {
-   "codemirror_mode": {
-    "name": "ipython",
-    "version": 3
-   },
-   "file_extension": ".py",
-   "mimetype": "text/x-python",
    "name": "python",
-   "nbconvert_exporter": "python",
-   "pygments_lexer": "ipython3",
-   "version": "3.7.6"
+   "version": ""
   },
   "orig_nbformat": 4
  },

+ 1 - 1
demo.py

@@ -12,7 +12,7 @@ df_bms, df_gps = dbManager.get_data(sn='PK50201A000002005', start_time='2021-04-
 import sys
 import CONFIGURE.PathSetting as PathSetting
 sys.path.append(PathSetting.backend_path)
-import Tools
+import Tools 
 
 tools = Tools.Tools()
 write_path = r'D:\Platform\Users\CJH\Download\data'