{ "cells": [ { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "# 标签原始数据获取\n", "from ZlwlAlgosCommon.utils.ProUtils import *\n", "from ZlwlAlgosCommon.service.iotp.Beans import DataField\n", "from ZlwlAlgosCommon.service.iotp.IotpAlgoService import IotpAlgoService\n", "import pandas as pd" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "start env: dev \n" ] } ], "source": [ "cur_env = 'dev' # 设置运行环境\n", "app_path = \"/home/zhuxi/project/zlwl-algos\" # 设置相对路径\n", "sysUtils = SysUtils(cur_env, app_path)\n", "hbase_params = sysUtils.get_cf_param('hbase')\n", "hbase_datafactory_params = sysUtils.get_cf_param('hbase-datafactory')\n", "iotp_service = IotpAlgoService(hbase_params=hbase_params)\n", "iotp_datafactory_service = IotpAlgoService(hbase_params=hbase_datafactory_params)\n", "\n", "mysql_datafactory_params = sysUtils.get_cf_param('mysql-datafactory')\n", "mysqlUtils = MysqlUtils()\n", "mysql_datafactory_engine, mysql_datafactory_Session= mysqlUtils.get_mysql_engine(mysql_datafactory_params)\n", "mysql_datafactory_conn = mysql_datafactory_engine.connect()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# 获取标签集数据\n", "df_tags_dataset = iotp_datafactory_service.get_dataset_tags(mysql_datafactory_conn)" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "df_sn=pd.read_excel('/home/zhuxi/project/zlwl-algos/USER/zhuxi/FaultClass/V1_0_1/t_device.xlsx')\n", "sn_list=list(df_sn['sn'])" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "['PJXCLL128N22C5001',\n", " 'PJXCLL532S234M001',\n", " 'PJXCLL532S234M002',\n", " 'PJXCLL532S234M003',\n", " 'PJXCLL532S234M004',\n", " 'PJXCLL532S234M005',\n", " 'PJXCLL532S234M006',\n", " 'PJXCLL532S234M008',\n", " 'PJXCLL532S234M016',\n", " 'PJXCLL532S234M018',\n", " 'PJXCLL532S234M021',\n", " 'PJXCLL532S234M009',\n", " 'PJXCLL532S234M010',\n", " 'PJXCLL532S234M017',\n", " 'PJXCLL532S234M022',\n", " 'PJXCLL532S234M023',\n", " 'PJXCLL532S234M007',\n", " 'PJXCLL532S234M011',\n", " 'PJXCLL532S234M012',\n", " 'PJXCLL532S234M013',\n", " 'PJXCLL532S234M014',\n", " 'PJXCLL532S234M015',\n", " 'PJXCLL532S234M019',\n", " 'PJXCLL532S234M020',\n", " 'PJXCLL532S234M024',\n", " 'PJXCLL532S234M025',\n", " 'PJXCLL532S234M026',\n", " 'PJXCLL532S234M027',\n", " 'PJXCLL532S234M028',\n", " 'PJXCLL532S234M029',\n", " 'PJXCLL532S234M030']" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "sn_list" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [], "source": [ "# 根据标签 从 数据集 取数\n", "columns = [DataField.error_level, DataField.error_code, DataField.pack_crnt, DataField.pack_volt,\n", " DataField.bms_sta, DataField.cell_voltage_count, DataField.cell_temp_count, DataField.cell_voltage, DataField.cell_temp, \n", " DataField.pack_soc, DataField.other_temp_value, DataField.cell_balance,\n", " DataField.pack_soh, DataField.charge_sta]\n", "dataset=pd.DataFrame()\n", "#for idx in df_tags_dataset.index:\n", " #print(idx)\n", "for sn in sn_list:\n", " if sn[:4]=='MGMC':\n", " start_time='2023-04-01 00:00:00'\n", " end_time='2023-05-01 00:00:00'\n", " df_data = iotp_service.get_data(sn_list=[sn], columns=columns, start_time=start_time, end_time=end_time) \n", " # print(df_data)\n", " #break\n", " dataset=dataset.append(df_data)" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " |
---|
\n", " | update_time | \n", "create_by | \n", "sn | \n", "start_time | \n", "end_time | \n", "vin | \n", "factory_id | \n", "pack_model | \n", "device_cell_type | \n", "factory | \n", "tag | \n", "child_tag | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|
826 | \n", "2023-04-09 00:28:49 | \n", "admin | \n", "667CC900001 | \n", "2023-04-07 08:40:22 | \n", "2023-04-07 09:25:41 | \n", "None | \n", "1 | \n", "HY02520 | \n", "L | \n", "骑享 | \n", "BMS控制故障 | \n", "电芯欠压 | \n", "
665 | \n", "2023-04-07 19:23:39 | \n", "admin | \n", "PK50001A100000650 | \n", "2022-07-01 21:58:17 | \n", "2022-07-01 22:41:50 | \n", "None | \n", "1 | \n", "KY01710 | \n", "N | \n", "骑享 | \n", "温度故障 | \n", "接插件过温 | \n", "
677 | \n", "2023-04-07 19:23:39 | \n", "admin | \n", "PK50001A100000650 | \n", "2022-07-21 21:29:36 | \n", "2022-07-21 23:05:34 | \n", "None | \n", "1 | \n", "KY01710 | \n", "N | \n", "骑享 | \n", "温度故障 | \n", "接插件过温 | \n", "
676 | \n", "2023-04-07 19:23:39 | \n", "admin | \n", "PK50001A100000650 | \n", "2022-07-21 21:31:39 | \n", "2022-07-21 22:58:11 | \n", "None | \n", "1 | \n", "KY01710 | \n", "N | \n", "骑享 | \n", "温度故障 | \n", "接插件过温 | \n", "
675 | \n", "2023-04-07 19:23:39 | \n", "admin | \n", "PK50001A100000650 | \n", "2022-07-18 22:14:18 | \n", "2022-07-18 22:20:38 | \n", "None | \n", "1 | \n", "KY01710 | \n", "N | \n", "骑享 | \n", "温度故障 | \n", "接插件过温 | \n", "
... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
115 | \n", "2023-04-07 19:17:50 | \n", "admin | \n", "09SPE002BC011199T0000002 | \n", "2023-03-03 10:44:26 | \n", "2023-03-03 12:24:43 | \n", "LUZAGAAAXKA006304 | \n", "2 | \n", "2101TK | \n", "N | \n", "合众 | \n", "温度故障 | \n", "温差过大 | \n", "
114 | \n", "2023-04-07 19:17:50 | \n", "admin | \n", "09SPE002BC011199T0000002 | \n", "2023-03-02 08:36:52 | \n", "2023-03-02 11:09:58 | \n", "LUZAGAAAXKA006304 | \n", "2 | \n", "2101TK | \n", "N | \n", "合众 | \n", "温度故障 | \n", "温差过大 | \n", "
113 | \n", "2023-04-07 19:17:50 | \n", "admin | \n", "09SPE002BC011199P0000026 | \n", "2023-03-07 23:06:29 | \n", "2023-03-08 00:39:50 | \n", "LUZAGAAA7KA006311 | \n", "2 | \n", "2101TK | \n", "N | \n", "合众 | \n", "温度故障 | \n", "温差过大 | \n", "
112 | \n", "2023-04-07 19:17:50 | \n", "admin | \n", "09SPE002BC011199J0000018 | \n", "2023-03-23 04:38:09 | \n", "2023-03-23 06:29:50 | \n", "LUZAGAAAXKA005993 | \n", "2 | \n", "2101TK | \n", "N | \n", "合众 | \n", "温度故障 | \n", "温差过大 | \n", "
0 | \n", "2023-04-07 19:17:50 | \n", "admin | \n", "001PB047000001B230100075 | \n", "2023-03-28 17:14:02 | \n", "2023-03-28 19:33:02 | \n", "LUZAGBDA2MA007791 | \n", "2 | \n", "2101TS | \n", "L | \n", "合众 | \n", "系统故障 | \n", "SOC卡滞 | \n", "
827 rows × 12 columns
\n", "