{ "cells": [ { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [], "source": [ "import oss2\n", "from itertools import islice\n", "import pandas as pd\n", "columns = [\"id\",\"VIN\",\"VehModel\",\"VehState\",\"Time\",\"CellVoltage\",\"PackVoltage\",'CellMaxVolNum',\"CellMinVolNum\",'CellTemp','CellMaxTempNum','CellMinTempNum','PackCrnt','VehRmnRng','VehOdo','FltCode',\n", "'FltLvl','VehSpd','PedalAngle','PackSoc','MotorPwr','EnmTemp','InsulationRss','ChrgSta','GPS_lon','GPS_lat','GPS_alt',\n", " 'PowerAlreadyTime','BMSSta','ACSta','OncCmState','HVILSta','OfcAccumTime','OncAccumTime','BmsOncChgCp','BmsOfcPileOutputVol','BmsOfcPileOutputCur','BmsOfcCc','BmsOfcAllowed',\n", " 'OncOutCurrent','OncOutVoltage','OfcStationMaxOutVolt','OfcStationMinOutVolt','OfcStationMaxOutCrnt','OfcStationMinOutCrnt','BmsOfcgVoltageRequest','BmsOfcType','BmsOfcCurrentRequest',\n", " 'BmsOncChgRequest','BmsRequestOutputCurrent','BmsRequestOutputVoltage','BmsOncCc','BmsS2State','HvUpState','HvDownState','CellMaxVol','CellMinVol','CellMaxTemp','CellMinTemp','Tripmeter',\n", " 'VehAccX','VehAccY','StringAngle','PTCSta','PTCPwr','PosRlySta','NegRlySta','OfcPreRlySta','OfcRlySta','OfcPosChrgerTemp','OfcNegChrgerTemp','OncPosChrgerTemp','OncNegChrgerTemp',\n", " 'InstPwrCmsmtion','AvgPwrCmsmtion','SubPwrCmsmtion','BmsCellVoltDiff','DriveMode','BmsBatTempDiff','BmsClmThermalSts','BmsBatteryTotalCapacity','BmsBatteryAvaiCapacity',\n", " 'BmsOncChgCpConn','CellVoltRecTime','CellVoltTotalCount','CellVoltFrameNo','CellVoltFrameCount','CellTempTotalCount','SN','BatteryModel']\n", "auth = oss2.Auth('LTAI4FyoDnXMjqd78rdRDFHN', 'sdFl6vjM9l2rvWiUTzuFQb2xqjUoY5')\n", "bucket = oss2.Bucket(auth, \"https://oss-cn-hangzhou.aliyuncs.com\", 'ff-hezhong')\n", "df_data = pd.DataFrame(columns = columns) \n", "for b in oss2.ObjectIterator(bucket,'alg/LUZAGAAA1MA038075/202202251410/'):\n", " bucket.get_object_to_file(b.key, 'test.txt')\n", " df = pd.read_csv('test.txt', names=columns, sep=' ')\n", " df_data = pd.concat([df_data,df])\n", "df_data = df_data.reset_index(drop=True)\n" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "b'{\"sn\":\"0CZPE007DN0111B4K0000084\",\"key\":\"0CZPE007DN0111B4K0000084_202202271605\",\"module_model_code\":\"J9\",\"pack_series_parallerl\":\"2P96S\",\"cell_battery_type\":\"E\",\"cell_dict_shape\":\"3\",\"pack_model_code\":\"2101TAB\",\"module_manufactory\":\"\\xe5\\x8d\\x8e\\xe9\\xbc\\x8e\\xe5\\x9b\\xbd\\xe8\\x81\\x94\\xe5\\x8a\\xa8\\xe5\\x8a\\x9b\\xe7\\x94\\xb5\\xe6\\xb1\\xa0\\xe6\\x9c\\x89\\xe9\\x99\\x90\\xe5\\x85\\xac\\xe5\\x8f\\xb8\",\"pack_capacity\":\"122\",\"cell_manufactory\":\"\\xe5\\x8d\\x8e\\xe9\\xbc\\x8e\\xe5\\x9b\\xbd\\xe8\\x81\\x94\\xe5\\x8a\\xa8\\xe5\\x8a\\x9b\\xe7\\x94\\xb5\\xe6\\xb1\\xa0\\xe6\\x9c\\x89\\xe9\\x99\\x90\\xe5\\x85\\xac\\xe5\\x8f\\xb8\"}'\n", "0\n", "b'{\"sn\":\"09SPE005FA0111B8L0000059\",\"key\":\"09SPE005FA0111B8L0000059_202202271605\",\"module_model_code\":\"MODULE_2.64kWh_177Ah_1P4S\",\"pack_series_parallerl\":\"1P104S\",\"cell_battery_type\":\"E\",\"cell_dict_shape\":\"1\",\"pack_model_code\":\"2101TW\",\"module_manufactory\":\"\\xe5\\xae\\x81\\xe5\\xbe\\xb7\\xe6\\x97\\xb6\\xe4\\xbb\\xa3\\xe6\\x96\\xb0\\xe8\\x83\\xbd\\xe6\\xba\\x90\\xe7\\xa7\\x91\\xe6\\x8a\\x80\\xe8\\x82\\xa1\\xe4\\xbb\\xbd\\xe6\\x9c\\x89\\xe9\\x99\\x90\\xe5\\x85\\xac\\xe5\\x8f\\xb8\",\"pack_capacity\":\"174\",\"cell_manufactory\":\"\\xe5\\xae\\x81\\xe5\\xbe\\xb7\\xe6\\x97\\xb6\\xe4\\xbb\\xa3\\xe6\\x96\\xb0\\xe8\\x83\\xbd\\xe6\\xba\\x90\\xe7\\xa7\\x91\\xe6\\x8a\\x80\\xe8\\x82\\xa1\\xe4\\xbb\\xbd\\xe6\\x9c\\x89\\xe9\\x99\\x90\\xe5\\x85\\xac\\xe5\\x8f\\xb8\"}'\n", "0\n", "b'{\"sn\":\"001PB047000001A8D0100014\",\"key\":\"001PB047000001A8D0100014_202202271605\",\"module_model_code\":\"CB350\",\"pack_series_parallerl\":\"1P112S\",\"cell_battery_type\":\"B\",\"cell_dict_shape\":\"1\",\"pack_model_code\":\"2101TS\",\"module_manufactory\":\"\\xe5\\xae\\x81\\xe5\\xbe\\xb7\\xe6\\x97\\xb6\\xe4\\xbb\\xa3\\xe6\\x96\\xb0\\xe8\\x83\\xbd\\xe6\\xba\\x90\\xe7\\xa7\\x91\\xe6\\x8a\\x80\\xe8\\x82\\xa1\\xe4\\xbb\\xbd\\xe6\\x9c\\x89\\xe9\\x99\\x90\\xe5\\x85\\xac\\xe5\\x8f\\xb8\",\"pack_capacity\":\"87\",\"cell_manufactory\":\"\\xe5\\xae\\x81\\xe5\\xbe\\xb7\\xe6\\x97\\xb6\\xe4\\xbb\\xa3\\xe6\\x96\\xb0\\xe8\\x83\\xbd\\xe6\\xba\\x90\\xe7\\xa7\\x91\\xe6\\x8a\\x80\\xe8\\x82\\xa1\\xe4\\xbb\\xbd\\xe6\\x9c\\x89\\xe9\\x99\\x90\\xe5\\x85\\xac\\xe5\\x8f\\xb8\"}'\n", "0\n", "b'{\"sn\":\"0CZPE007DN0111B990000050\",\"key\":\"0CZPE007DN0111B990000050_202202271605\",\"module_model_code\":\"J9\",\"pack_series_parallerl\":\"2P96S\",\"cell_battery_type\":\"E\",\"cell_dict_shape\":\"3\",\"pack_model_code\":\"2101TAB\",\"module_manufactory\":\"\\xe5\\x8d\\x8e\\xe9\\xbc\\x8e\\xe5\\x9b\\xbd\\xe8\\x81\\x94\\xe5\\x8a\\xa8\\xe5\\x8a\\x9b\\xe7\\x94\\xb5\\xe6\\xb1\\xa0\\xe6\\x9c\\x89\\xe9\\x99\\x90\\xe5\\x85\\xac\\xe5\\x8f\\xb8\",\"pack_capacity\":\"122\",\"cell_manufactory\":\"\\xe5\\x8d\\x8e\\xe9\\xbc\\x8e\\xe5\\x9b\\xbd\\xe8\\x81\\x94\\xe5\\x8a\\xa8\\xe5\\x8a\\x9b\\xe7\\x94\\xb5\\xe6\\xb1\\xa0\\xe6\\x9c\\x89\\xe9\\x99\\x90\\xe5\\x85\\xac\\xe5\\x8f\\xb8\"}'\n", "0\n", "b'{\"sn\":\"0CZPE007DN0111B800000064\",\"key\":\"0CZPE007DN0111B800000064_202202271605\",\"module_model_code\":\"J9\",\"pack_series_parallerl\":\"2P96S\",\"cell_battery_type\":\"E\",\"cell_dict_shape\":\"3\",\"pack_model_code\":\"2101TAB\",\"module_manufactory\":\"\\xe5\\x8d\\x8e\\xe9\\xbc\\x8e\\xe5\\x9b\\xbd\\xe8\\x81\\x94\\xe5\\x8a\\xa8\\xe5\\x8a\\x9b\\xe7\\x94\\xb5\\xe6\\xb1\\xa0\\xe6\\x9c\\x89\\xe9\\x99\\x90\\xe5\\x85\\xac\\xe5\\x8f\\xb8\",\"pack_capacity\":\"122\",\"cell_manufactory\":\"\\xe5\\x8d\\x8e\\xe9\\xbc\\x8e\\xe5\\x9b\\xbd\\xe8\\x81\\x94\\xe5\\x8a\\xa8\\xe5\\x8a\\x9b\\xe7\\x94\\xb5\\xe6\\xb1\\xa0\\xe6\\x9c\\x89\\xe9\\x99\\x90\\xe5\\x85\\xac\\xe5\\x8f\\xb8\"}'\n", "0\n", "b'{\"sn\":\"001PB047000001AA70100148\",\"key\":\"001PB047000001AA70100148_202202271605\",\"module_model_code\":\"CB350\",\"pack_series_parallerl\":\"1P112S\",\"cell_battery_type\":\"B\",\"cell_dict_shape\":\"1\",\"pack_model_code\":\"2101TS\",\"module_manufactory\":\"\\xe5\\xae\\x81\\xe5\\xbe\\xb7\\xe6\\x97\\xb6\\xe4\\xbb\\xa3\\xe6\\x96\\xb0\\xe8\\x83\\xbd\\xe6\\xba\\x90\\xe7\\xa7\\x91\\xe6\\x8a\\x80\\xe8\\x82\\xa1\\xe4\\xbb\\xbd\\xe6\\x9c\\x89\\xe9\\x99\\x90\\xe5\\x85\\xac\\xe5\\x8f\\xb8\",\"pack_capacity\":\"87\",\"cell_manufactory\":\"\\xe5\\xae\\x81\\xe5\\xbe\\xb7\\xe6\\x97\\xb6\\xe4\\xbb\\xa3\\xe6\\x96\\xb0\\xe8\\x83\\xbd\\xe6\\xba\\x90\\xe7\\xa7\\x91\\xe6\\x8a\\x80\\xe8\\x82\\xa1\\xe4\\xbb\\xbd\\xe6\\x9c\\x89\\xe9\\x99\\x90\\xe5\\x85\\xac\\xe5\\x8f\\xb8\"}'\n", "0\n", "b'{\"sn\":\"0CZPE007DN0111B8S0000045\",\"key\":\"0CZPE007DN0111B8S0000045_202202271605\",\"module_model_code\":\"J9\",\"pack_series_parallerl\":\"2P96S\",\"cell_battery_type\":\"E\",\"cell_dict_shape\":\"3\",\"pack_model_code\":\"2101TAB\",\"module_manufactory\":\"\\xe5\\x8d\\x8e\\xe9\\xbc\\x8e\\xe5\\x9b\\xbd\\xe8\\x81\\x94\\xe5\\x8a\\xa8\\xe5\\x8a\\x9b\\xe7\\x94\\xb5\\xe6\\xb1\\xa0\\xe6\\x9c\\x89\\xe9\\x99\\x90\\xe5\\x85\\xac\\xe5\\x8f\\xb8\",\"pack_capacity\":\"122\",\"cell_manufactory\":\"\\xe5\\x8d\\x8e\\xe9\\xbc\\x8e\\xe5\\x9b\\xbd\\xe8\\x81\\x94\\xe5\\x8a\\xa8\\xe5\\x8a\\x9b\\xe7\\x94\\xb5\\xe6\\xb1\\xa0\\xe6\\x9c\\x89\\xe9\\x99\\x90\\xe5\\x85\\xac\\xe5\\x8f\\xb8\"}'\n", "0\n", "b'{\"sn\":\"09SPE006DA0111A9K0000014\",\"key\":\"09SPE006DA0111A9K0000014_202202271605\",\"module_model_code\":\"MEAFG\",\"pack_series_parallerl\":\"1P96S\",\"cell_battery_type\":\"E\",\"cell_dict_shape\":\"1\",\"pack_model_code\":\"2101TZ\",\"module_manufactory\":\"\\xe6\\xb1\\x9f\\xe8\\x8b\\x8f\\xe6\\x97\\xb6\\xe4\\xbb\\xa3\\xe6\\x96\\xb0\\xe8\\x83\\xbd\\xe6\\xba\\x90\\xe7\\xa7\\x91\\xe6\\x8a\\x80\\xe6\\x9c\\x89\\xe9\\x99\\x90\\xe5\\x85\\xac\\xe5\\x8f\\xb8\",\"pack_capacity\":\"110\",\"cell_manufactory\":\"\\xe5\\xae\\x81\\xe5\\xbe\\xb7\\xe6\\x97\\xb6\\xe4\\xbb\\xa3\\xe6\\x96\\xb0\\xe8\\x83\\xbd\\xe6\\xba\\x90\\xe7\\xa7\\x91\\xe6\\x8a\\x80\\xe8\\x82\\xa1\\xe4\\xbb\\xbd\\xe6\\x9c\\x89\\xe9\\x99\\x90\\xe5\\x85\\xac\\xe5\\x8f\\xb8\"}'\n", "0\n", "b'{\"sn\":\"0CZPE007DN0111B8T0000051\",\"key\":\"0CZPE007DN0111B8T0000051_202202271605\",\"module_model_code\":\"J9\",\"pack_series_parallerl\":\"2P96S\",\"cell_battery_type\":\"E\",\"cell_dict_shape\":\"3\",\"pack_model_code\":\"2101TAB\",\"module_manufactory\":\"\\xe5\\x8d\\x8e\\xe9\\xbc\\x8e\\xe5\\x9b\\xbd\\xe8\\x81\\x94\\xe5\\x8a\\xa8\\xe5\\x8a\\x9b\\xe7\\x94\\xb5\\xe6\\xb1\\xa0\\xe6\\x9c\\x89\\xe9\\x99\\x90\\xe5\\x85\\xac\\xe5\\x8f\\xb8\",\"pack_capacity\":\"122\",\"cell_manufactory\":\"\\xe5\\x8d\\x8e\\xe9\\xbc\\x8e\\xe5\\x9b\\xbd\\xe8\\x81\\x94\\xe5\\x8a\\xa8\\xe5\\x8a\\x9b\\xe7\\x94\\xb5\\xe6\\xb1\\xa0\\xe6\\x9c\\x89\\xe9\\x99\\x90\\xe5\\x85\\xac\\xe5\\x8f\\xb8\"}'\n", "0\n", "b'{\"sn\":\"0CZPE007DN0111B4K0000084\",\"key\":\"0CZPE007DN0111B4K0000084_202202271606\",\"module_model_code\":\"J9\",\"pack_series_parallerl\":\"2P96S\",\"cell_battery_type\":\"E\",\"cell_dict_shape\":\"3\",\"pack_model_code\":\"2101TAB\",\"module_manufactory\":\"\\xe5\\x8d\\x8e\\xe9\\xbc\\x8e\\xe5\\x9b\\xbd\\xe8\\x81\\x94\\xe5\\x8a\\xa8\\xe5\\x8a\\x9b\\xe7\\x94\\xb5\\xe6\\xb1\\xa0\\xe6\\x9c\\x89\\xe9\\x99\\x90\\xe5\\x85\\xac\\xe5\\x8f\\xb8\",\"pack_capacity\":\"122\",\"cell_manufactory\":\"\\xe5\\x8d\\x8e\\xe9\\xbc\\x8e\\xe5\\x9b\\xbd\\xe8\\x81\\x94\\xe5\\x8a\\xa8\\xe5\\x8a\\x9b\\xe7\\x94\\xb5\\xe6\\xb1\\xa0\\xe6\\x9c\\x89\\xe9\\x99\\x90\\xe5\\x85\\xac\\xe5\\x8f\\xb8\"}'\n", "0\n", "b'{\"sn\":\"0CZPE007DN0111B990000050\",\"key\":\"0CZPE007DN0111B990000050_202202271606\",\"module_model_code\":\"J9\",\"pack_series_parallerl\":\"2P96S\",\"cell_battery_type\":\"E\",\"cell_dict_shape\":\"3\",\"pack_model_code\":\"2101TAB\",\"module_manufactory\":\"\\xe5\\x8d\\x8e\\xe9\\xbc\\x8e\\xe5\\x9b\\xbd\\xe8\\x81\\x94\\xe5\\x8a\\xa8\\xe5\\x8a\\x9b\\xe7\\x94\\xb5\\xe6\\xb1\\xa0\\xe6\\x9c\\x89\\xe9\\x99\\x90\\xe5\\x85\\xac\\xe5\\x8f\\xb8\",\"pack_capacity\":\"122\",\"cell_manufactory\":\"\\xe5\\x8d\\x8e\\xe9\\xbc\\x8e\\xe5\\x9b\\xbd\\xe8\\x81\\x94\\xe5\\x8a\\xa8\\xe5\\x8a\\x9b\\xe7\\x94\\xb5\\xe6\\xb1\\xa0\\xe6\\x9c\\x89\\xe9\\x99\\x90\\xe5\\x85\\xac\\xe5\\x8f\\xb8\"}'\n", "0\n", "b'{\"sn\":\"0CZPE007DN0111B8S0000045\",\"key\":\"0CZPE007DN0111B8S0000045_202202271606\",\"module_model_code\":\"J9\",\"pack_series_parallerl\":\"2P96S\",\"cell_battery_type\":\"E\",\"cell_dict_shape\":\"3\",\"pack_model_code\":\"2101TAB\",\"module_manufactory\":\"\\xe5\\x8d\\x8e\\xe9\\xbc\\x8e\\xe5\\x9b\\xbd\\xe8\\x81\\x94\\xe5\\x8a\\xa8\\xe5\\x8a\\x9b\\xe7\\x94\\xb5\\xe6\\xb1\\xa0\\xe6\\x9c\\x89\\xe9\\x99\\x90\\xe5\\x85\\xac\\xe5\\x8f\\xb8\",\"pack_capacity\":\"122\",\"cell_manufactory\":\"\\xe5\\x8d\\x8e\\xe9\\xbc\\x8e\\xe5\\x9b\\xbd\\xe8\\x81\\x94\\xe5\\x8a\\xa8\\xe5\\x8a\\x9b\\xe7\\x94\\xb5\\xe6\\xb1\\xa0\\xe6\\x9c\\x89\\xe9\\x99\\x90\\xe5\\x85\\xac\\xe5\\x8f\\xb8\"}'\n", "0\n", "b'{\"sn\":\"001PB047000001A8D0100014\",\"key\":\"001PB047000001A8D0100014_202202271606\",\"module_model_code\":\"CB350\",\"pack_series_parallerl\":\"1P112S\",\"cell_battery_type\":\"B\",\"cell_dict_shape\":\"1\",\"pack_model_code\":\"2101TS\",\"module_manufactory\":\"\\xe5\\xae\\x81\\xe5\\xbe\\xb7\\xe6\\x97\\xb6\\xe4\\xbb\\xa3\\xe6\\x96\\xb0\\xe8\\x83\\xbd\\xe6\\xba\\x90\\xe7\\xa7\\x91\\xe6\\x8a\\x80\\xe8\\x82\\xa1\\xe4\\xbb\\xbd\\xe6\\x9c\\x89\\xe9\\x99\\x90\\xe5\\x85\\xac\\xe5\\x8f\\xb8\",\"pack_capacity\":\"87\",\"cell_manufactory\":\"\\xe5\\xae\\x81\\xe5\\xbe\\xb7\\xe6\\x97\\xb6\\xe4\\xbb\\xa3\\xe6\\x96\\xb0\\xe8\\x83\\xbd\\xe6\\xba\\x90\\xe7\\xa7\\x91\\xe6\\x8a\\x80\\xe8\\x82\\xa1\\xe4\\xbb\\xbd\\xe6\\x9c\\x89\\xe9\\x99\\x90\\xe5\\x85\\xac\\xe5\\x8f\\xb8\"}'\n", "0\n", "b'{\"sn\":\"0CZPE007DN0111B8T0000051\",\"key\":\"0CZPE007DN0111B8T0000051_202202271606\",\"module_model_code\":\"J9\",\"pack_series_parallerl\":\"2P96S\",\"cell_battery_type\":\"E\",\"cell_dict_shape\":\"3\",\"pack_model_code\":\"2101TAB\",\"module_manufactory\":\"\\xe5\\x8d\\x8e\\xe9\\xbc\\x8e\\xe5\\x9b\\xbd\\xe8\\x81\\x94\\xe5\\x8a\\xa8\\xe5\\x8a\\x9b\\xe7\\x94\\xb5\\xe6\\xb1\\xa0\\xe6\\x9c\\x89\\xe9\\x99\\x90\\xe5\\x85\\xac\\xe5\\x8f\\xb8\",\"pack_capacity\":\"122\",\"cell_manufactory\":\"\\xe5\\x8d\\x8e\\xe9\\xbc\\x8e\\xe5\\x9b\\xbd\\xe8\\x81\\x94\\xe5\\x8a\\xa8\\xe5\\x8a\\x9b\\xe7\\x94\\xb5\\xe6\\xb1\\xa0\\xe6\\x9c\\x89\\xe9\\x99\\x90\\xe5\\x85\\xac\\xe5\\x8f\\xb8\"}'\n", "0\n", "b'{\"sn\":\"001PB047000001AA70100148\",\"key\":\"001PB047000001AA70100148_202202271606\",\"module_model_code\":\"CB350\",\"pack_series_parallerl\":\"1P112S\",\"cell_battery_type\":\"B\",\"cell_dict_shape\":\"1\",\"pack_model_code\":\"2101TS\",\"module_manufactory\":\"\\xe5\\xae\\x81\\xe5\\xbe\\xb7\\xe6\\x97\\xb6\\xe4\\xbb\\xa3\\xe6\\x96\\xb0\\xe8\\x83\\xbd\\xe6\\xba\\x90\\xe7\\xa7\\x91\\xe6\\x8a\\x80\\xe8\\x82\\xa1\\xe4\\xbb\\xbd\\xe6\\x9c\\x89\\xe9\\x99\\x90\\xe5\\x85\\xac\\xe5\\x8f\\xb8\",\"pack_capacity\":\"87\",\"cell_manufactory\":\"\\xe5\\xae\\x81\\xe5\\xbe\\xb7\\xe6\\x97\\xb6\\xe4\\xbb\\xa3\\xe6\\x96\\xb0\\xe8\\x83\\xbd\\xe6\\xba\\x90\\xe7\\xa7\\x91\\xe6\\x8a\\x80\\xe8\\x82\\xa1\\xe4\\xbb\\xbd\\xe6\\x9c\\x89\\xe9\\x99\\x90\\xe5\\x85\\xac\\xe5\\x8f\\xb8\"}'\n", "0\n", "b'{\"sn\":\"09SPE006DA0111A9K0000014\",\"key\":\"09SPE006DA0111A9K0000014_202202271606\",\"module_model_code\":\"MEAFG\",\"pack_series_parallerl\":\"1P96S\",\"cell_battery_type\":\"E\",\"cell_dict_shape\":\"1\",\"pack_model_code\":\"2101TZ\",\"module_manufactory\":\"\\xe6\\xb1\\x9f\\xe8\\x8b\\x8f\\xe6\\x97\\xb6\\xe4\\xbb\\xa3\\xe6\\x96\\xb0\\xe8\\x83\\xbd\\xe6\\xba\\x90\\xe7\\xa7\\x91\\xe6\\x8a\\x80\\xe6\\x9c\\x89\\xe9\\x99\\x90\\xe5\\x85\\xac\\xe5\\x8f\\xb8\",\"pack_capacity\":\"110\",\"cell_manufactory\":\"\\xe5\\xae\\x81\\xe5\\xbe\\xb7\\xe6\\x97\\xb6\\xe4\\xbb\\xa3\\xe6\\x96\\xb0\\xe8\\x83\\xbd\\xe6\\xba\\x90\\xe7\\xa7\\x91\\xe6\\x8a\\x80\\xe8\\x82\\xa1\\xe4\\xbb\\xbd\\xe6\\x9c\\x89\\xe9\\x99\\x90\\xe5\\x85\\xac\\xe5\\x8f\\xb8\"}'\n", "0\n", "b'{\"sn\":\"0CZPE007DN0111B800000064\",\"key\":\"0CZPE007DN0111B800000064_202202271606\",\"module_model_code\":\"J9\",\"pack_series_parallerl\":\"2P96S\",\"cell_battery_type\":\"E\",\"cell_dict_shape\":\"3\",\"pack_model_code\":\"2101TAB\",\"module_manufactory\":\"\\xe5\\x8d\\x8e\\xe9\\xbc\\x8e\\xe5\\x9b\\xbd\\xe8\\x81\\x94\\xe5\\x8a\\xa8\\xe5\\x8a\\x9b\\xe7\\x94\\xb5\\xe6\\xb1\\xa0\\xe6\\x9c\\x89\\xe9\\x99\\x90\\xe5\\x85\\xac\\xe5\\x8f\\xb8\",\"pack_capacity\":\"122\",\"cell_manufactory\":\"\\xe5\\x8d\\x8e\\xe9\\xbc\\x8e\\xe5\\x9b\\xbd\\xe8\\x81\\x94\\xe5\\x8a\\xa8\\xe5\\x8a\\x9b\\xe7\\x94\\xb5\\xe6\\xb1\\xa0\\xe6\\x9c\\x89\\xe9\\x99\\x90\\xe5\\x85\\xac\\xe5\\x8f\\xb8\"}'\n", "0\n", "b'{\"sn\":\"09SPE005FA0111B8L0000059\",\"key\":\"09SPE005FA0111B8L0000059_202202271606\",\"module_model_code\":\"MODULE_2.64kWh_177Ah_1P4S\",\"pack_series_parallerl\":\"1P104S\",\"cell_battery_type\":\"E\",\"cell_dict_shape\":\"1\",\"pack_model_code\":\"2101TW\",\"module_manufactory\":\"\\xe5\\xae\\x81\\xe5\\xbe\\xb7\\xe6\\x97\\xb6\\xe4\\xbb\\xa3\\xe6\\x96\\xb0\\xe8\\x83\\xbd\\xe6\\xba\\x90\\xe7\\xa7\\x91\\xe6\\x8a\\x80\\xe8\\x82\\xa1\\xe4\\xbb\\xbd\\xe6\\x9c\\x89\\xe9\\x99\\x90\\xe5\\x85\\xac\\xe5\\x8f\\xb8\",\"pack_capacity\":\"174\",\"cell_manufactory\":\"\\xe5\\xae\\x81\\xe5\\xbe\\xb7\\xe6\\x97\\xb6\\xe4\\xbb\\xa3\\xe6\\x96\\xb0\\xe8\\x83\\xbd\\xe6\\xba\\x90\\xe7\\xa7\\x91\\xe6\\x8a\\x80\\xe8\\x82\\xa1\\xe4\\xbb\\xbd\\xe6\\x9c\\x89\\xe9\\x99\\x90\\xe5\\x85\\xac\\xe5\\x8f\\xb8\"}'\n", "0\n" ] } ], "source": [ "import ssl\n", "from kafka import KafkaProducer, KafkaConsumer\n", "from kafka.errors import kafka_errors\n", "import traceback\n", "import json\n", "import pdb\n", "import os\n", "import pandas as pd\n", "import oss2\n", "from itertools import islice\n", "import pandas as pd\n", "context = ssl.create_default_context()\n", "context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)\n", "## The new python(2.7.8+) may cannot ignore the hostname check,\n", "## you could set to ssl.CERT_NONE to walk around the problem,\n", "## or you can change the client to confluent-python-demo \n", "\n", "# context.verify_mode = ssl.CERT_NONE\n", "context.verify_mode = ssl.CERT_REQUIRED\n", "topic = 'toAlgSn' # toAlg, toAlgSn\n", "# context.check_hostname = True\n", "context.load_verify_locations(\"ca-cert\")\n", "consumer = KafkaConsumer(topic, bootstrap_servers=['alikafka-pre-cn-8ed2kw57901x-1.alikafka.aliyuncs.com:9093',\n", " 'alikafka-pre-cn-8ed2kw57901x-2.alikafka.aliyuncs.com:9093',\n", " 'alikafka-pre-cn-8ed2kw57901x-3.alikafka.aliyuncs.com:9093'],\n", " sasl_mechanism=\"PLAIN\",\n", " ssl_context=context,\n", " security_protocol='SASL_SSL',\n", " api_version = (2,2),\n", " sasl_plain_username='alikafka_pre-cn-8ed2kw57901x',\n", " sasl_plain_password='hlQsApgUUdUxcWEr1uQoM9BeuF8t8vMF',\n", " consumer_timeout_ms= 100000000, # 如果10秒内kafka中没有可供消费的数据,自动退出\n", " client_id='consumer-python3',\n", " auto_offset_reset='earliest',# 消费kafka中最近的数据,如果设置为earliest则消费最早的数据,不管这些数据是否消费\n", " enable_auto_commit=True, # 自动提交消费者的offset\n", " auto_commit_interval_ms=3000, ## 自动提交消费者offset的时间间隔,\n", "\n", ")\n", "\n", "columns = [\"id\",\"VIN\",\"VehModel\",\"VehState\",\"Time\",\"CellVoltage\",\"PackVoltage\",'CellMaxVolNum',\"CellMinVolNum\",'CellTemp','CellMaxTempNum','CellMinTempNum','PackCrnt','VehRmnRng','VehOdo','FltCode',\n", "'FltLvl','VehSpd','PedalAngle','PackSoc','MotorPwr','EnmTemp','InsulationRss','ChrgSta','GPS_lon','GPS_lat','GPS_alt',\n", " 'PowerAlreadyTime','BMSSta','ACSta','OncCmState','HVILSta','OfcAccumTime','OncAccumTime','BmsOncChgCp','BmsOfcPileOutputVol','BmsOfcPileOutputCur','BmsOfcCc','BmsOfcAllowed',\n", " 'OncOutCurrent','OncOutVoltage','OfcStationMaxOutVolt','OfcStationMinOutVolt','OfcStationMaxOutCrnt','OfcStationMinOutCrnt','BmsOfcgVoltageRequest','BmsOfcType','BmsOfcCurrentRequest',\n", " 'BmsOncChgRequest','BmsRequestOutputCurrent','BmsRequestOutputVoltage','BmsOncCc','BmsS2State','HvUpState','HvDownState','CellMaxVol','CellMinVol','CellMaxTemp','CellMinTemp','Tripmeter',\n", " 'VehAccX','VehAccY','StringAngle','PTCSta','PTCPwr','PosRlySta','NegRlySta','OfcPreRlySta','OfcRlySta','OfcPosChrgerTemp','OfcNegChrgerTemp','OncPosChrgerTemp','OncNegChrgerTemp',\n", " 'InstPwrCmsmtion','AvgPwrCmsmtion','SubPwrCmsmtion','BmsCellVoltDiff','DriveMode','BmsBatTempDiff','BmsClmThermalSts','BmsBatteryTotalCapacity','BmsBatteryAvaiCapacity',\n", " 'BmsOncChgCpConn','CellVoltRecTime','CellVoltTotalCount','CellVoltFrameNo','CellVoltFrameCount','CellTempTotalCount','SN','BatteryModel']\n", "auth = oss2.Auth('LTAI4FyoDnXMjqd78rdRDFHN', 'sdFl6vjM9l2rvWiUTzuFQb2xqjUoY5')\n", "bucket = oss2.Bucket(auth, \"https://oss-cn-hangzhou.aliyuncs.com\", 'ff-hezhong')\n", " \n", "\n", "for message in consumer:\n", " print(message.value)\n", " # 读取vin数据\n", " # df_data = pd.DataFrame(columns = columns) \n", " # for b in oss2.ObjectIterator(bucket,'alg/'+str(message.value,'utf-8').replace(\"_\",\"/\")):\n", " # bucket.get_object_to_file(b.key, 'test.txt')\n", " # df = pd.read_csv('test.txt', names=columns, sep=' ')\n", " # df_data = pd.concat([df_data,df])\n", " # df_data = df_data.reset_index(drop=True)\n", " \n", " # 读取sn数据\n", " df_data = pd.DataFrame(columns = columns) \n", " for b in oss2.ObjectIterator(bucket,'alg/'+str(message.value,'utf-8').replace(\"_\",\"/\")):\n", " bucket.get_object_to_file(b.key, 'test.txt')\n", " df = pd.read_csv('test.txt', names=columns, sep=' ')\n", " df_data = pd.concat([df_data,df])\n", " df_data = df_data.reset_index(drop=True)\n", " print(str(len(df_data)))\n", " \n", " \n", "\n" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'LUZAGAAA5MA009680/202202271606'" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "str(message.value,'utf-8').replace(\"_\",\"/\")" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [], "source": [ "df_data['Time'] = pd.to_datetime(df['Time'],unit='ms')" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
idVINVehModelVehStateTimeCellVoltagePackVoltageCellMaxVolNumCellMinVolNumCellTemp...BmsBatteryTotalCapacityBmsBatteryAvaiCapacityBmsOncChgCpConnCellVoltRecTimeCellVoltTotalCountCellVoltFrameNoCellVoltFrameCountCellTempTotalCountSNBatteryModel
01803242740_LUZAGAAA5MA009680_9223370390905621153LUZAGAAA5MA009680EP1222022-02-27 08:05:54.6544.084,4.084,4.085,4.085,4.087,4.087,4.088,4.08...392.2268414,15,14,14,14,14,13,13,12,12,12,12,11,12,11,1......4.294967e+094.294967e+09255164115027000096196320CZPE007DN0111B4K0000084NaN
11803242740_LUZAGAAA5MA009680_9223370390905621122LUZAGAAA5MA009680EP1222022-02-27 08:05:54.6854.061,4.063,4.064,4.064,4.064,4.064,4.065,4.06...390.0188419,20,19,20,18,19,18,19,16,17,17,18,16,16,16,1......4.294967e+094.294967e+09255164117131300096196320CZPE007DN0111B4K0000084NaN
21803242740_LUZAGAAA5MA009680_9223370390905621106LUZAGAAA5MA009680EP1222022-02-27 08:05:54.7014.084,4.084,4.085,4.085,4.087,4.087,4.088,4.08...392.2268414,15,14,14,14,14,13,13,12,12,12,12,11,12,11,1......4.294967e+094.294967e+09255164115027000096196320CZPE007DN0111B4K0000084NaN
31803242740_LUZAGAAA5MA009680_9223370390905621092LUZAGAAA5MA009680EP1222022-02-27 08:05:54.7154.061,4.063,4.064,4.064,4.064,4.064,4.065,4.06...390.0188419,20,19,20,18,19,18,19,16,17,17,18,16,16,16,1......4.294967e+094.294967e+09255164117131300096196320CZPE007DN0111B4K0000084NaN
41803242740_LUZAGAAA5MA009680_9223370390905621081LUZAGAAA5MA009680EP1222022-02-27 08:05:54.7264.057,4.058,4.058,4.060,4.060,4.060,4.061,4.06...389.5258419,20,19,20,18,19,18,19,16,17,18,18,16,16,17,1......4.294967e+094.294967e+09255164117109300096196320CZPE007DN0111B4K0000084NaN
..................................................................
12931803242740_LUZAGAAA5MA009680_9223370390905615845LUZAGAAA5MA009680EP1222022-02-27 08:05:59.9624.067,4.069,4.069,4.070,4.070,4.070,4.071,4.07...390.5258418,18,18,18,17,18,17,18,16,16,16,17,15,16,15,1......4.294967e+094.294967e+09255164115791000096196320CZPE007DN0111B4K0000084NaN
12941803242740_LUZAGAAA5MA009680_9223370390905615844LUZAGAAA5MA009680EP1222022-02-27 08:05:59.9634.068,4.070,4.070,4.071,4.071,4.071,4.071,4.07...390.5258418,19,18,18,18,18,17,18,16,17,17,17,16,16,15,1......4.294967e+094.294967e+09255164115768700096196320CZPE007DN0111B4K0000084NaN
12951803242740_LUZAGAAA5MA009680_9223370390905615844LUZAGAAA5MA009680EP1222022-02-27 08:05:59.9634.069,4.070,4.071,4.071,4.071,4.071,4.071,4.07...390.5258418,19,18,19,18,18,17,18,16,17,17,17,16,16,16,1......4.294967e+094.294967e+09255164115733600096196320CZPE007DN0111B4K0000084NaN
12961803242740_LUZAGAAA5MA009680_9223370390905615843LUZAGAAA5MA009680EP1222022-02-27 08:05:59.9644.083,4.084,4.085,4.084,4.085,4.085,4.087,4.08...391.7268414,14,13,14,13,13,12,12,11,12,11,11,10,11,10,1......4.294967e+094.294967e+09255164115338800096196320CZPE007DN0111B4K0000084NaN
12971803242740_LUZAGAAA5MA009680_9223370390905615843LUZAGAAA5MA009680EP1222022-02-27 08:05:59.9644.083,4.084,4.085,4.085,4.085,4.087,4.088,4.08...392.0258414,14,14,14,13,13,12,13,12,12,11,12,11,11,10,1......4.294967e+094.294967e+09255164115221600096196320CZPE007DN0111B4K0000084NaN
\n", "

1298 rows × 90 columns

\n", "
" ], "text/plain": [ " id VIN \\\n", "0 1803242740_LUZAGAAA5MA009680_9223370390905621153 LUZAGAAA5MA009680 \n", "1 1803242740_LUZAGAAA5MA009680_9223370390905621122 LUZAGAAA5MA009680 \n", "2 1803242740_LUZAGAAA5MA009680_9223370390905621106 LUZAGAAA5MA009680 \n", "3 1803242740_LUZAGAAA5MA009680_9223370390905621092 LUZAGAAA5MA009680 \n", "4 1803242740_LUZAGAAA5MA009680_9223370390905621081 LUZAGAAA5MA009680 \n", "... ... ... \n", "1293 1803242740_LUZAGAAA5MA009680_9223370390905615845 LUZAGAAA5MA009680 \n", "1294 1803242740_LUZAGAAA5MA009680_9223370390905615844 LUZAGAAA5MA009680 \n", "1295 1803242740_LUZAGAAA5MA009680_9223370390905615844 LUZAGAAA5MA009680 \n", "1296 1803242740_LUZAGAAA5MA009680_9223370390905615843 LUZAGAAA5MA009680 \n", "1297 1803242740_LUZAGAAA5MA009680_9223370390905615843 LUZAGAAA5MA009680 \n", "\n", " VehModel VehState Time \\\n", "0 EP12 2 2022-02-27 08:05:54.654 \n", "1 EP12 2 2022-02-27 08:05:54.685 \n", "2 EP12 2 2022-02-27 08:05:54.701 \n", "3 EP12 2 2022-02-27 08:05:54.715 \n", "4 EP12 2 2022-02-27 08:05:54.726 \n", "... ... ... ... \n", "1293 EP12 2 2022-02-27 08:05:59.962 \n", "1294 EP12 2 2022-02-27 08:05:59.963 \n", "1295 EP12 2 2022-02-27 08:05:59.963 \n", "1296 EP12 2 2022-02-27 08:05:59.964 \n", "1297 EP12 2 2022-02-27 08:05:59.964 \n", "\n", " CellVoltage PackVoltage \\\n", "0 4.084,4.084,4.085,4.085,4.087,4.087,4.088,4.08... 392.2 \n", "1 4.061,4.063,4.064,4.064,4.064,4.064,4.065,4.06... 390.0 \n", "2 4.084,4.084,4.085,4.085,4.087,4.087,4.088,4.08... 392.2 \n", "3 4.061,4.063,4.064,4.064,4.064,4.064,4.065,4.06... 390.0 \n", "4 4.057,4.058,4.058,4.060,4.060,4.060,4.061,4.06... 389.5 \n", "... ... ... \n", "1293 4.067,4.069,4.069,4.070,4.070,4.070,4.071,4.07... 390.5 \n", "1294 4.068,4.070,4.070,4.071,4.071,4.071,4.071,4.07... 390.5 \n", "1295 4.069,4.070,4.071,4.071,4.071,4.071,4.071,4.07... 390.5 \n", "1296 4.083,4.084,4.085,4.084,4.085,4.085,4.087,4.08... 391.7 \n", "1297 4.083,4.084,4.085,4.085,4.085,4.087,4.088,4.08... 392.0 \n", "\n", " CellMaxVolNum CellMinVolNum \\\n", "0 26 84 \n", "1 18 84 \n", "2 26 84 \n", "3 18 84 \n", "4 25 84 \n", "... ... ... \n", "1293 25 84 \n", "1294 25 84 \n", "1295 25 84 \n", "1296 26 84 \n", "1297 25 84 \n", "\n", " CellTemp ... \\\n", "0 14,15,14,14,14,14,13,13,12,12,12,12,11,12,11,1... ... \n", "1 19,20,19,20,18,19,18,19,16,17,17,18,16,16,16,1... ... \n", "2 14,15,14,14,14,14,13,13,12,12,12,12,11,12,11,1... ... \n", "3 19,20,19,20,18,19,18,19,16,17,17,18,16,16,16,1... ... \n", "4 19,20,19,20,18,19,18,19,16,17,18,18,16,16,17,1... ... \n", "... ... ... \n", "1293 18,18,18,18,17,18,17,18,16,16,16,17,15,16,15,1... ... \n", "1294 18,19,18,18,18,18,17,18,16,17,17,17,16,16,15,1... ... \n", "1295 18,19,18,19,18,18,17,18,16,17,17,17,16,16,16,1... ... \n", "1296 14,14,13,14,13,13,12,12,11,12,11,11,10,11,10,1... ... \n", "1297 14,14,14,14,13,13,12,13,12,12,11,12,11,11,10,1... ... \n", "\n", " BmsBatteryTotalCapacity BmsBatteryAvaiCapacity BmsOncChgCpConn \\\n", "0 4.294967e+09 4.294967e+09 255 \n", "1 4.294967e+09 4.294967e+09 255 \n", "2 4.294967e+09 4.294967e+09 255 \n", "3 4.294967e+09 4.294967e+09 255 \n", "4 4.294967e+09 4.294967e+09 255 \n", "... ... ... ... \n", "1293 4.294967e+09 4.294967e+09 255 \n", "1294 4.294967e+09 4.294967e+09 255 \n", "1295 4.294967e+09 4.294967e+09 255 \n", "1296 4.294967e+09 4.294967e+09 255 \n", "1297 4.294967e+09 4.294967e+09 255 \n", "\n", " CellVoltRecTime CellVoltTotalCount CellVoltFrameNo CellVoltFrameCount \\\n", "0 1641150270000 96 1 96 \n", "1 1641171313000 96 1 96 \n", "2 1641150270000 96 1 96 \n", "3 1641171313000 96 1 96 \n", "4 1641171093000 96 1 96 \n", "... ... ... ... ... \n", "1293 1641157910000 96 1 96 \n", "1294 1641157687000 96 1 96 \n", "1295 1641157336000 96 1 96 \n", "1296 1641153388000 96 1 96 \n", "1297 1641152216000 96 1 96 \n", "\n", " CellTempTotalCount SN BatteryModel \n", "0 32 0CZPE007DN0111B4K0000084 NaN \n", "1 32 0CZPE007DN0111B4K0000084 NaN \n", "2 32 0CZPE007DN0111B4K0000084 NaN \n", "3 32 0CZPE007DN0111B4K0000084 NaN \n", "4 32 0CZPE007DN0111B4K0000084 NaN \n", "... ... ... ... \n", "1293 32 0CZPE007DN0111B4K0000084 NaN \n", "1294 32 0CZPE007DN0111B4K0000084 NaN \n", "1295 32 0CZPE007DN0111B4K0000084 NaN \n", "1296 32 0CZPE007DN0111B4K0000084 NaN \n", "1297 32 0CZPE007DN0111B4K0000084 NaN \n", "\n", "[1298 rows x 90 columns]" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_data" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "interpreter": { "hash": "5ac93a79b26608c768d42fbd754dd4f69161017bfc4d38cb4b18d60e5198dbca" }, "kernelspec": { "display_name": "Python 3.6.2 ('ana_py36')", "language": "python", "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.6.2" }, "orig_nbformat": 4 }, "nbformat": 4, "nbformat_minor": 2 }