123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266 |
- 'use strict';
- module.exports = app => {
- const mongoose = app.mongoose;
- const Schema = mongoose.Schema;
- const conn = app.mongooseDB.get('etlDB');
- // 驾驶行为数据结构 以上数据的时间粒度为日统计数据 时长都是ms
- const DrivingBehaviorInfoSchema = new Schema({
- _id: Schema.Types.ObjectId, // 主键
- vin: { type: String }, // 车辆VIN
- start_time: { type: Number }, // 统计开始时间戳
- end_time: { type: Number }, // 统计结束时间戳
- mileage_cnt: { type: Number }, // 行程次数
- mileage: { type: String }, // 行驶里程(单位: { type: Number }, // km, 精度: { type: Number }, // 0.1)
- supplementary_cnt: { type: Number }, // 补传次数
- battery_soc: { type: String }, // 蓄电池电量(单位: { type: Number }, // %, 精度: { type: Number }, // 1)
- engine_speed: { type: String }, // 发动机转速(单位: { type: Number }, // rpm, 精度: { type: Number }, // 0.01)
- inside_temperature: { type: String }, // 内部平均温度(单位: { type: Number }, // ℃, 精度: { type: Number }, // 0.1)
- outside_temperature: { type: String }, // 外部平均温度(单位: { type: Number }, // ℃, 精度: { type: Number }, // 0.1)
- power_battery_soc: { type: String }, // 动力电池电量(单位: { type: Number }, // %, 精度: { type: Number }, // 1)
- charge_duration: { type: Number }, // 充电时长(单位: { type: Number }, // ms, 精度: { type: Number }, // 1)
- charge_list: [
- {
- start_time: { type: Number }, // 充电开始时间戳
- end_time: { type: Number }, // 充电结束时间戳
- charge_duration: { type: String }, // 充电时长(单位: { type: Number }, // ms, 精度: { type: Number }, // 1)
- start_soc: { type: String }, // 每次充电初始值
- end_soc: { type: String }, // 每次充电结束值
- pre_start_mileage: { type: String }, // 充电前可行驶里程(单位: { type: Number }, // km, 精度: { type: Number }, // 1)
- charge_type: { type: String }, // 充电模式(1-32A交流充电、2-16A交流充电、
- // 3-10A交流充电、4-直流充电、5-63A交流充电),1代表本次充电为32A交流充电
- mileage: { type: String }, // 两次充电间行驶里程(单位: { type: Number }, // km, 精度: { type: Number }, // 0.1)
- },
- ], // 充电列表数据(可能为多次充电)
- avg_speed: { type: String }, // 平均车速(单位: { type: Number }, // km/h,精度: { type: Number }, // 0.01)
- avg_power_consumption: { type: String }, // 平均电耗(单位: { type: Number }, // soc/百公里,精度: { type: Number }, // 0.01)
- actual_mileage_list: [
- {
- start_time: { type: Number }, // 充电开始时间戳
- end_time: { type: Number }, // 充电结束时间戳
- start_soc: { type: String }, // 固定电量值初始值
- end_soc: { type: String }, // 固定电量值结束值
- mileage: { type: String }, // 实际续航里程
- },
- ], // 固定电量值实际续航里程 (实际续航里程分布(new))
- mileage_list: [
- {
- start_time: { type: Number }, // 行程开始时间戳
- end_time: { type: Number }, // 行程结束时间戳
- drive_duration: { type: Number }, // 行程驾驶时长
- at_night_drive_duration: { type: Number }, // 深夜出行时长
- mileage: { type: String }, // 本次行程驾驶里程(单位: { type: Number }, // km, 精度: { type: Number }, // 0.1)
- drive_style: { type: String }, // 单行行程驾驶行为风格(稳健型,一般型,激进型)
- dsm_status: { type: Number }, // 疲劳驾驶状态(0-未疲劳驾驶 1-疲劳驾驶)
- max_acce: { type: String }, // 单次行程中最大加速度
- max_dece: { type: String }, // 单次行程中最大减速度
- side_acce: { type: String }, // 单次行程最大侧向加速度
- series: { type: String }, // 车系
- start_electricity: { type: String }, // 行程开始时刻剩余电量(百分比值)
- end_electricity: { type: String }, // 行程结束时刻剩余电量(百分比值)
- startLongitude: { type: String }, // 开始经度
- end_longitude: { type: String }, // 结束时经度
- start_latitude: { type: String }, // 开始纬度
- end_latitude: { type: String }, // 结束时纬度
- max_speed: { type: String }, // 最高时速
- start_mileage: { type: String }, // 开始时里程
- end_mileage: { type: String }, // 结束时里程
- avg_power_consumption: { type: String }, // 平均电耗(soc/百公里)
- avg_speed: { type: String }, // 平均行驶速度(km/h)
- daylight_duration: { type: Number }, // 日间驾驶时长
- acc_avg_speed: { type: String }, // ACC平均车速
- acc_duration: { type: Number }, // ACC驾驶时长
- out_avg_degrees: { type: String }, // 外部环境温度
- air_duration: { type: Number }, // 空调使用时长
- air_avg_degrees: { type: String }, // 空调平均温度
- difference_degrees: { type: String }, // 平均温差
- total_burn: { type: String }, // 总油耗
- start_burn: { type: String }, // 开始油量
- end_burn: { type: String }, // 结束油量
- oil_consumption: { type: String }, // 油耗率
- his_oil: { type: String }, // 历史长时油耗
- avg_oil: { type: String }, // 平均油耗
- fcw_status: { type: Number }, // FCW前碰撞预警开关状态: { type: Number }, // 1-开启 2-关闭
- fcw_cnt: { type: Number }, // FCW前碰撞预警报警次数
- fcw_aclp_duration: { type: Number }, // FCW前碰撞报警后的加速踏板陡降时长
- fcw_brake_duration: { type: Number }, // FCW前碰撞报警后的首次刹车时长
- fcw_resp_evaluate: { type: String }, // FCW前碰撞报警响应评价
- ldw_status: { type: Number }, // LDW道路偏离预警系统开关状态: { type: Number }, // 1-开启 2-关闭
- ldw_cnt: { type: Number }, // LDW道路偏离预警次数
- ldw_sw_duration: { type: Number }, // LDW道路偏离后的方向盘响应时长
- ldw_resp_evaluate: { type: String }, // LDW道路偏离报警响应评价
- lka_status: { type: Number }, // LKA车道保持辅助系统开关状态: { type: Number }, // 1-开启 2-关闭
- lka_cnt: { type: Number }, // LKA车道保持辅助系统介入次数
- lka_sw_duration: { type: Number }, // LKA车道保持辅助系统提示驾驶员接管时刻后的方向盘响应时长
- lka_resp_evaluate: { type: String }, // LKA车道保持辅助系统介入响应评价
- bsd_status: { type: Number }, // BSD盲区监测系统开关状态: { type: Number }, // 1-开启 2-关闭
- bsd_cnt: { type: Number }, // BSD盲区监测系统报警次数
- bsd_sw_duration: { type: Number }, // BSD盲区监测报警时刻后的方向盘响应时长
- bsd_brake_duration: { type: Number }, // 盲区监测报警时刻后的首次刹车时长
- bsd_aclp_duration: { type: Number }, // 盲区监测报警时刻后的加速踏板开始陡降时长
- bsd_resp_evaluate: { type: String }, // 盲区监测报警响应评价
- ot_cnt: { type: Number }, // 交叉车流预警系统报警次数
- ot_sw_duration: { type: Number }, // 交叉车流预警系统报警时刻后的方向盘响应时长
- ot_brake_duration: { type: Number }, // 交叉车流预警系统报警时刻后的首次刹车时长
- ot_aclp_duration: { type: Number }, // 交叉车流预警系统报警时刻后的加速踏板开始陡降时长
- ot_resp_rvaluate: { type: String }, // 交叉车流预警报警响应评价
- lc_cnt: { type: Number }, // 变道预警系统报警次数
- lc_sw_duration: { type: Number }, // 变道预警系统报警时刻后的方向盘响应时长
- lc_brake_duration: { type: Number }, // 变道预警系统报警时刻后的首次刹车时长
- lc_aclp_duration: { type: Number }, // 变道预警系统报警时刻后的加速踏板开始陡降时长
- lc_resp_evaluate: { type: String }, // 变道预警报警响应评价
- acceleration_cnt: { type: Number }, // 急加速次数
- acceleration_duration: { type: Number }, // 急加速持续时长
- decelerate_cnt: { type: Number }, // 急减速次数
- decelerate_duration: { type: Number }, // 急减速持续时长
- turn_cnt: { type: Number }, // 急转弯次数
- turn_duration: { type: Number }, // 急转弯持续时长
- speeding_cnt: { type: Number }, // 超速次数
- speeding_duration: { type: Number }, // 超速持续时长
- un_tie_sb_duration: { type: Number }, // 未系安全带持续时间
- dsm_duration: { type: Number }, // 疲劳驾驶持续时长
- fault_duration: { type: Number }, // 故障行驶持续时长
- leave_sw_cnt: { type: Number }, // 双手离开方向盘次数
- safety_air_bag: { type: Number }, // 安全气囊弹出: { type: Number }, // 1-弹出 2-无
- sa_proportion: { type: String }, // 平稳加速占比
- sa_mileage: { type: String }, // 平稳加速里程
- acceleration_mileage: { type: String }, // 加速总里程
- sd_proportion: { type: String }, // 平稳减速占比
- sd_mileage: { type: String }, // 平稳减速里程
- decelerate_mileage: { type: String }, // 减速总里程
- steady_proportion: { type: String }, // 稳定车速里程占比
- steady_mileage: { type: String }, // 稳定车速里程
- un_consumption_oil_mileage: { type: String }, // 不耗油里程
- fa_cnt: { type: Number }, // 频繁加速次数
- fd_cnt: { type: Number }, // 频繁减速次数
- hs_turn_cnt: { type: Number }, // 高速过弯次数
- abt_cnt: { type: Number }, // 入弯前加速次数
- dat_cnt: { type: Number }, // 出弯后制动次数
- clu_cnt: { type: Number }, // 急换道次数
- flc_cnt: { type: Number }, // 频繁换道次数
- dlc_cnt: { type: Number }, // 危险换道次数
- io_cnt: { type: Number }, // 不合规超车次数
- at_night_drive_status: { type: Number }, // 是否深夜出行(23:00-4:00): { type: Number }, // 1-否 2-是,默认1
- idling_cnt: { type: Number }, // 怠速次数
- idling_duration: { type: Number }, // 怠速时长
- drive_anticipation_cnt: { type: Number }, // 驾驶预判次数
- stable_drive_cnt: { type: Number }, // 平稳驾驶次数
- power_consumption_score: { type: String }, // 百公里平均电耗分数
- oil_score: { type: String }, // 百公里平均油耗得分
- speed_score: { type: String }, // 平均速度分数
- acceleration_score: { type: String }, // 急加速分数
- decelerate_score: { type: String }, // 急减速分数
- turn_score: { type: String }, // 急转弯分数
- speeding_score: { type: String }, // 超速分数
- un_tie_sb_score: { type: String }, // 未系安全带持续分数
- dsm_score: { type: String }, // 疲劳驾驶分数
- fault_score: { type: String }, // 故障行驶分数
- leave_sw_score: { type: String }, // 双手离开方向盘分数
- safety_assistance_score: { type: String }, // 是否使用安全辅助分数
- drive_safety_score: { type: String }, // 驾驶安全策略分数
- total_score: { type: String }, // 总得分
- hs_turn_score: { type: String }, // 高速过弯得分
- at_night_drive_score: { type: String }, // 深夜驾驶得分
- sa_score: { type: String }, // 平稳加速评分
- sd_score: { type: String }, // 平稳减速评分
- steady_score: { type: String }, // 稳定车速评分
- driving_safety_score: { type: String }, // 驾驶行为安全得分
- energy_conservation_score: { type: String }, // 驾驶行为节能得分
- engine_common_fault: { type: String }, // 发动机常见故障
- electrical_common_fault: { type: String }, // 电气系统常见故障
- transmission_common_fault: { type: String }, // 传动系常见故障
- steering_common_fault: { type: String }, // 转向系常见故障
- brake_common_fault: { type: String }, // 制动系常见故障
- drive_common_fault: { type: String }, // 行驶系常见故障
- boc_common_fault: { type: String }, // 车身常见故障
- avp_cnt: { type: String }, // 代客泊车次数(该值大于0则本次行程为代客泊车行程)
- intelligent_driving_status: { type: String }, // 智能驾驶状态:1-是 2-否
- acc_cnt: { type: String }, // 自适应巡航开启次数,大于0则表示本次行程未1次自适应巡航行程数
- },
- ], // 单次行程列表(未该车辆每日的行程列表数据)
- charge_cnt: { type: Number }, // 充电次数
- avg_oil_consumption: { type: String }, // 平均油耗值(单位: { type: Number }, // L/百公里,精度: { type: Number }, // 0.01)
- dsm_cnt: { type: String }, // 日累计疲劳驾驶次数
- drive_duration: { type: Number }, // 日累计驾驶时长
- driving_safety_score: { type: String }, // 日驾驶行为安全平均得分
- acceleration_score: { type: String }, // 日急加速平均得分
- acceleration_cnt: { type: Number }, // 日累计急加速次数
- acceleration_mileage: { type: String }, // 加速总里程
- decelerate_score: { type: String }, // 日急制动平均得分
- decelerate_cnt: { type: Number }, // 日累计急制动次数
- decelerate_mileage: { type: String }, // 制动总里程
- speeding_score: { type: String }, // 日超速平均得分
- speeding_cnt: { type: Number }, // 日累计超速次数
- fa_cnt: { type: String }, // 日累计频繁加速次数
- fa_score: { type: String }, // 日频繁加速平均得分
- fd_cnt: { type: String }, // 日累计频繁制动次数
- fd_score: { type: String }, // 日频繁制动平均得分
- turn_score: { type: String }, // 日急转弯平均得分
- turn_cnt: { type: Number }, // 日累计急转弯次数
- clu_cnt: { type: String }, // 日累计急换道次数
- clu_score: { type: String }, // 日急换道平均得分
- flc_cnt: { type: String }, // 日累计频繁换道次数
- flc_score: { type: String }, // 日频繁换道平均得分
- io_cnt: { type: String }, // 日累计右侧超车次数
- io_score: { type: String }, // 日右侧超车平均得分
- hs_turn_cnt: { type: String }, // 日累计高速过弯次数
- hs_turn_score: { type: String }, // 日高速过弯平均得分
- at_night_drive_cnt: { type: String }, // 深夜出行次数
- at_night_drive_duration: { type: Number }, // 日累计深夜出行时长
- at_night_drive_mileage: { type: String }, // 深夜出行里程
- at_night_drive_score: { type: String }, // 日深夜出行平均得分
- un_tie_sb_score: { type: String }, // 日安全带平均得分
- un_tie_sb_cnt: { type: Number }, // 日累计未系安全带次数
- leave_sw_score: { type: String }, // 日双手离开方向盘平均得分
- leave_sw_cnt: { type: Number }, // 日累计双手离开方向盘次数
- dsm_score: { type: String }, // 日疲劳驾驶平均得分
- fcw_cnt: { type: Number }, // FCW报警次数
- fcw_score: { type: String }, // 日fcw平均得分
- bsd_cnt: { type: Number }, // BSD报警次数
- bsd_score: { type: String }, // 日BSD平均得分
- lka_cnt: { type: Number }, // LKA报警次数
- lka_score: { type: String }, // 日LKA平均得分
- ldw_cnt: { type: Number }, // 日LDW报警次数
- ldw_score: { type: String }, // 日LDW平均得分
- idling_cnt: { type: String }, // 怠速次数
- idling_score: { type: String }, // 怠速得分
- drive_anticipation_cnt: { type: String }, // 驾驶预判次数
- drive_anticipation_score: { type: String }, // 驾驶预判得分
- sa_score: { type: String }, // 加速行为分数(经济加速行为里程占比)
- sd_score: { type: String }, // 制动行为分数(经济制动行为里程占比)
- steady_score: { type: String }, // 匀速行为分数(经济匀速行为里程占比)
- power_consumption_score: { type: String }, // 电耗得分(电动车能耗)
- oil_score: { type: String }, // 油耗得分(燃油车能耗)
- sky_duration: { type: String }, // 天窗使用时长(毫秒)
- headlight_cnt: { type: String }, // 近光灯使用次数
- headlight_duration: { type: String }, // 近光灯使用时长(毫秒)
- high_beam_cnt: { type: String }, // 远光灯使用次数
- high_beam_duration: { type: String }, // 远光灯使用时长(毫秒)
- air_duration: { type: Number }, // 空调使用时长(毫秒)
- on_compressor_duration: { type: String }, // 空调状态和压缩机均打开使用时长(毫秒)
- off_compressor_duration: { type: String }, // 空调状态开压缩机关使用时长(毫秒)
- on_auto_duration: { type: Number }, // 激活且空调开启
- off_auto_duration: { type: String }, // 关闭且空调开启
- blower_rating_duration: {
- one: { type: Number }, // 风量1档
- two: { type: Number }, // 风量2档
- three: { type: Number }, // 风量3档
- four: { type: Number }, // 风量4档
- five: { type: Number }, // 风量5档
- six: { type: Number }, // 风量6档
- seven: { type: Number }, // 风量7档
- }, // 吹风等级
- create_time: { type: Number }, // 创建记录时间戳
- energy_conservation_score: { type: String }, // 日驾驶行为节能平均得分
- });
- DrivingBehaviorInfoSchema.index({ start_time: -1 });
- DrivingBehaviorInfoSchema.index({ start_time: -1, vin: -1 });
- DrivingBehaviorInfoSchema.index({ start_time: -1, 'mileage_list.start_time': -1, 'mileage_list.end_time': -1, vin: -1 });
- DrivingBehaviorInfoSchema.index({ vin: -1 });
- return conn.model('DrivingBehaviorInfo', DrivingBehaviorInfoSchema, 'driving_behavior_info');
- };
|