123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- # 获取数据
- import sys
- import CONFIGURE.PathSetting as PathSetting
- sys.path.append(PathSetting.backend_path)
- import DBManager
- dbManager = DBManager.DBManager()
- df_bms, df_gps = dbManager.get_data(sn='PK50201A000002005', start_time='2021-04-01 00:00:00',
- end_time='2021-04-05 00:00:00', gps_switch=True, mode=0)
- # 下载数据 7255
- import sys
- import CONFIGURE.PathSetting as PathSetting
- sys.path.append(PathSetting.backend_path)
- import Tools
- tools = Tools.Tools()
- write_path = r'D:\Platform\Users\CJH\Download\data'
- st = '2021-06-01 00:00:00'
- et = '2021-06-03 00:00:00'
- tools.data_download(write_path=write_path, sn='UD02030118B4C0010', start_time=st,
- end_time=et, mode=1)
- # 下载数据 非7255
- import sys
- import CONFIGURE.PathSetting as PathSetting
- sys.path.append(PathSetting.backend_path)
- import Tools
- tools = Tools.Tools()
- write_path = r'D:\Platform\Users\WLM\data_ana\Data_Files'
- tools.data_download(write_path=write_path, sn='PK504B00100004017', start_time='2021-04-01 00:00:00',
- end_time='2021-04-05 00:00:00', gps_switch=True, mode=0)
- # 数据预处理
- import sys
- import CONFIGURE.PathSetting as PathSetting
- sys.path.append(PathSetting.backend_path)
- import DataPreProcess
- importlib.reload(DataPreProcess)
- dataPrePro = DataPreProcess.DataPreProcess()
- # 时间完全相同的数据仅保留一行
- df_bms_pro, df_gps_pro = dataPrePro.time_filter(df_bms, df_gps)
- # bms数据按照电流和状态分段, 然后在状态分段内部,根据时间跳变继续分段(解决段内数据丢失)
- df_bms_pro = dataPrePro.data_split_by_status(df_bms_pro)
- df_bms_pro = dataPrePro.data_split_by_time(df_bms_pro)
- # bms数据将两次充电间的状态合并
- df_bms_pro = dataPrePro.combine_drive_stand(df_bms_pro)
- # bms 数据计算行车和充电开始前后的静置时间
- df_bms_pro = dataPrePro.cal_stand_time(df_bms_pro)
- # gps 数据可靠性判断, 并增加里程和速度至gps数据(根据未合并的数据段判断)
- df_bms_pro, df_gps_pro, res_record= dataPrePro.gps_data_judge(df_bms_pro, df_gps_pro)
- # gps 数据可靠性判断, 并增加里程和速度至gps数据(根据已合并的数据段判断)
- df_bms_pro, df_gps_pro, res_record= dataPrePro.data_gps_judge_after_combine(df_bms_pro, df_gps_pro)
- # 单cycle指标统计
- import sys
- import CONFIGURE.PathSetting as PathSetting
- sys.path.append(PathSetting.middle_path)
- #import IndexStaByOneCycle
- import importlib
- importlib.reload(IndexStaByOneCycle)
- indexSta = IndexStaByOneCycle.IndexStaByOneCycle()
- data_number_list = sorted(list(set(df_bms[(df_bms['data_status'].isin(['drive']))]['data_split_by_status'])))
- for data_number in data_number_list[:]:
- df_sel_bms = df_bms[df_bms['data_split_by_status'] == data_number]
- df_sel_bms = df_sel_bms.reset_index(drop=True)
- df_sel_gps = df_gps[(df_gps['时间戳']>df_sel_bms.loc[0,'时间戳']) & (df_gps['时间戳']<df_sel_bms.loc[len(df_sel_bms)-1,'时间戳'])]
- df_sel_gps = df_sel_gps.reset_index(drop=True)
- print(indexSta.odo_sta(np.array(df_sel_gps['odo'])))
- print(indexSta.capacity_sta(40, np.array(df_sel_bms['SOC[%]']), np.array(df_sel_bms['SOH[%]'])))
- print(indexSta.energy_sta(40, np.array(df_sel_bms['SOC[%]']), np.array(df_sel_bms['SOH[%]']),np.array(df_sel_bms['总电压[V]'])))
- print(indexSta.acc_time_sta(np.array(df_sel_bms['时间戳'])))
- print(indexSta.mean_temp_sta(np.array(df_sel_bms['单体温度1'])))
- print(indexSta.temp_change_rate_sta(np.array(df_sel_bms['时间戳']), np.array(df_sel_bms['单体温度1'])))
- print(indexSta.dischrg_max_pwr_sta(np.array(df_sel_bms['总电压[V]']), np.array(df_sel_bms['总电流[A]'])))
- print(indexSta.chrg_max_pwr_sta(np.array(df_sel_bms['总电压[V]']), np.array(df_sel_bms['总电流[A]'])))
- 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'])))
- break
|