drivingBehaviorInfoModel.js 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. 'use strict';
  2. module.exports = app => {
  3. const mongoose = app.mongoose;
  4. const Schema = mongoose.Schema;
  5. const conn = app.mongooseDB.get('etlDB');
  6. // 驾驶行为数据结构 以上数据的时间粒度为日统计数据 时长都是ms
  7. const DrivingBehaviorInfoSchema = new Schema({
  8. _id: Schema.Types.ObjectId, // 主键
  9. vin: { type: String }, // 车辆VIN
  10. start_time: { type: Number }, // 统计开始时间戳
  11. end_time: { type: Number }, // 统计结束时间戳
  12. mileage_cnt: { type: Number }, // 行程次数
  13. mileage: { type: String }, // 行驶里程(单位: { type: Number }, // km, 精度: { type: Number }, // 0.1)
  14. supplementary_cnt: { type: Number }, // 补传次数
  15. battery_soc: { type: String }, // 蓄电池电量(单位: { type: Number }, // %, 精度: { type: Number }, // 1)
  16. engine_speed: { type: String }, // 发动机转速(单位: { type: Number }, // rpm, 精度: { type: Number }, // 0.01)
  17. inside_temperature: { type: String }, // 内部平均温度(单位: { type: Number }, // ℃, 精度: { type: Number }, // 0.1)
  18. outside_temperature: { type: String }, // 外部平均温度(单位: { type: Number }, // ℃, 精度: { type: Number }, // 0.1)
  19. power_battery_soc: { type: String }, // 动力电池电量(单位: { type: Number }, // %, 精度: { type: Number }, // 1)
  20. charge_duration: { type: Number }, // 充电时长(单位: { type: Number }, // ms, 精度: { type: Number }, // 1)
  21. charge_list: [
  22. {
  23. start_time: { type: Number }, // 充电开始时间戳
  24. end_time: { type: Number }, // 充电结束时间戳
  25. charge_duration: { type: String }, // 充电时长(单位: { type: Number }, // ms, 精度: { type: Number }, // 1)
  26. start_soc: { type: String }, // 每次充电初始值
  27. end_soc: { type: String }, // 每次充电结束值
  28. pre_start_mileage: { type: String }, // 充电前可行驶里程(单位: { type: Number }, // km, 精度: { type: Number }, // 1)
  29. charge_type: { type: String }, // 充电模式(1-32A交流充电、2-16A交流充电、
  30. // 3-10A交流充电、4-直流充电、5-63A交流充电),1代表本次充电为32A交流充电
  31. mileage: { type: String }, // 两次充电间行驶里程(单位: { type: Number }, // km, 精度: { type: Number }, // 0.1)
  32. },
  33. ], // 充电列表数据(可能为多次充电)
  34. avg_speed: { type: String }, // 平均车速(单位: { type: Number }, // km/h,精度: { type: Number }, // 0.01)
  35. avg_power_consumption: { type: String }, // 平均电耗(单位: { type: Number }, // soc/百公里,精度: { type: Number }, // 0.01)
  36. actual_mileage_list: [
  37. {
  38. start_time: { type: Number }, // 充电开始时间戳
  39. end_time: { type: Number }, // 充电结束时间戳
  40. start_soc: { type: String }, // 固定电量值初始值
  41. end_soc: { type: String }, // 固定电量值结束值
  42. mileage: { type: String }, // 实际续航里程
  43. },
  44. ], // 固定电量值实际续航里程 (实际续航里程分布(new))
  45. mileage_list: [
  46. {
  47. start_time: { type: Number }, // 行程开始时间戳
  48. end_time: { type: Number }, // 行程结束时间戳
  49. drive_duration: { type: Number }, // 行程驾驶时长
  50. at_night_drive_duration: { type: Number }, // 深夜出行时长
  51. mileage: { type: String }, // 本次行程驾驶里程(单位: { type: Number }, // km, 精度: { type: Number }, // 0.1)
  52. drive_style: { type: String }, // 单行行程驾驶行为风格(稳健型,一般型,激进型)
  53. dsm_status: { type: Number }, // 疲劳驾驶状态(0-未疲劳驾驶 1-疲劳驾驶)
  54. max_acce: { type: String }, // 单次行程中最大加速度
  55. max_dece: { type: String }, // 单次行程中最大减速度
  56. side_acce: { type: String }, // 单次行程最大侧向加速度
  57. series: { type: String }, // 车系
  58. start_electricity: { type: String }, // 行程开始时刻剩余电量(百分比值)
  59. end_electricity: { type: String }, // 行程结束时刻剩余电量(百分比值)
  60. startLongitude: { type: String }, // 开始经度
  61. end_longitude: { type: String }, // 结束时经度
  62. start_latitude: { type: String }, // 开始纬度
  63. end_latitude: { type: String }, // 结束时纬度
  64. max_speed: { type: String }, // 最高时速
  65. start_mileage: { type: String }, // 开始时里程
  66. end_mileage: { type: String }, // 结束时里程
  67. avg_power_consumption: { type: String }, // 平均电耗(soc/百公里)
  68. avg_speed: { type: String }, // 平均行驶速度(km/h)
  69. daylight_duration: { type: Number }, // 日间驾驶时长
  70. acc_avg_speed: { type: String }, // ACC平均车速
  71. acc_duration: { type: Number }, // ACC驾驶时长
  72. out_avg_degrees: { type: String }, // 外部环境温度
  73. air_duration: { type: Number }, // 空调使用时长
  74. air_avg_degrees: { type: String }, // 空调平均温度
  75. difference_degrees: { type: String }, // 平均温差
  76. total_burn: { type: String }, // 总油耗
  77. start_burn: { type: String }, // 开始油量
  78. end_burn: { type: String }, // 结束油量
  79. oil_consumption: { type: String }, // 油耗率
  80. his_oil: { type: String }, // 历史长时油耗
  81. avg_oil: { type: String }, // 平均油耗
  82. fcw_status: { type: Number }, // FCW前碰撞预警开关状态: { type: Number }, // 1-开启 2-关闭
  83. fcw_cnt: { type: Number }, // FCW前碰撞预警报警次数
  84. fcw_aclp_duration: { type: Number }, // FCW前碰撞报警后的加速踏板陡降时长
  85. fcw_brake_duration: { type: Number }, // FCW前碰撞报警后的首次刹车时长
  86. fcw_resp_evaluate: { type: String }, // FCW前碰撞报警响应评价
  87. ldw_status: { type: Number }, // LDW道路偏离预警系统开关状态: { type: Number }, // 1-开启 2-关闭
  88. ldw_cnt: { type: Number }, // LDW道路偏离预警次数
  89. ldw_sw_duration: { type: Number }, // LDW道路偏离后的方向盘响应时长
  90. ldw_resp_evaluate: { type: String }, // LDW道路偏离报警响应评价
  91. lka_status: { type: Number }, // LKA车道保持辅助系统开关状态: { type: Number }, // 1-开启 2-关闭
  92. lka_cnt: { type: Number }, // LKA车道保持辅助系统介入次数
  93. lka_sw_duration: { type: Number }, // LKA车道保持辅助系统提示驾驶员接管时刻后的方向盘响应时长
  94. lka_resp_evaluate: { type: String }, // LKA车道保持辅助系统介入响应评价
  95. bsd_status: { type: Number }, // BSD盲区监测系统开关状态: { type: Number }, // 1-开启 2-关闭
  96. bsd_cnt: { type: Number }, // BSD盲区监测系统报警次数
  97. bsd_sw_duration: { type: Number }, // BSD盲区监测报警时刻后的方向盘响应时长
  98. bsd_brake_duration: { type: Number }, // 盲区监测报警时刻后的首次刹车时长
  99. bsd_aclp_duration: { type: Number }, // 盲区监测报警时刻后的加速踏板开始陡降时长
  100. bsd_resp_evaluate: { type: String }, // 盲区监测报警响应评价
  101. ot_cnt: { type: Number }, // 交叉车流预警系统报警次数
  102. ot_sw_duration: { type: Number }, // 交叉车流预警系统报警时刻后的方向盘响应时长
  103. ot_brake_duration: { type: Number }, // 交叉车流预警系统报警时刻后的首次刹车时长
  104. ot_aclp_duration: { type: Number }, // 交叉车流预警系统报警时刻后的加速踏板开始陡降时长
  105. ot_resp_rvaluate: { type: String }, // 交叉车流预警报警响应评价
  106. lc_cnt: { type: Number }, // 变道预警系统报警次数
  107. lc_sw_duration: { type: Number }, // 变道预警系统报警时刻后的方向盘响应时长
  108. lc_brake_duration: { type: Number }, // 变道预警系统报警时刻后的首次刹车时长
  109. lc_aclp_duration: { type: Number }, // 变道预警系统报警时刻后的加速踏板开始陡降时长
  110. lc_resp_evaluate: { type: String }, // 变道预警报警响应评价
  111. acceleration_cnt: { type: Number }, // 急加速次数
  112. acceleration_duration: { type: Number }, // 急加速持续时长
  113. decelerate_cnt: { type: Number }, // 急减速次数
  114. decelerate_duration: { type: Number }, // 急减速持续时长
  115. turn_cnt: { type: Number }, // 急转弯次数
  116. turn_duration: { type: Number }, // 急转弯持续时长
  117. speeding_cnt: { type: Number }, // 超速次数
  118. speeding_duration: { type: Number }, // 超速持续时长
  119. un_tie_sb_duration: { type: Number }, // 未系安全带持续时间
  120. dsm_duration: { type: Number }, // 疲劳驾驶持续时长
  121. fault_duration: { type: Number }, // 故障行驶持续时长
  122. leave_sw_cnt: { type: Number }, // 双手离开方向盘次数
  123. safety_air_bag: { type: Number }, // 安全气囊弹出: { type: Number }, // 1-弹出 2-无
  124. sa_proportion: { type: String }, // 平稳加速占比
  125. sa_mileage: { type: String }, // 平稳加速里程
  126. acceleration_mileage: { type: String }, // 加速总里程
  127. sd_proportion: { type: String }, // 平稳减速占比
  128. sd_mileage: { type: String }, // 平稳减速里程
  129. decelerate_mileage: { type: String }, // 减速总里程
  130. steady_proportion: { type: String }, // 稳定车速里程占比
  131. steady_mileage: { type: String }, // 稳定车速里程
  132. un_consumption_oil_mileage: { type: String }, // 不耗油里程
  133. fa_cnt: { type: Number }, // 频繁加速次数
  134. fd_cnt: { type: Number }, // 频繁减速次数
  135. hs_turn_cnt: { type: Number }, // 高速过弯次数
  136. abt_cnt: { type: Number }, // 入弯前加速次数
  137. dat_cnt: { type: Number }, // 出弯后制动次数
  138. clu_cnt: { type: Number }, // 急换道次数
  139. flc_cnt: { type: Number }, // 频繁换道次数
  140. dlc_cnt: { type: Number }, // 危险换道次数
  141. io_cnt: { type: Number }, // 不合规超车次数
  142. at_night_drive_status: { type: Number }, // 是否深夜出行(23:00-4:00): { type: Number }, // 1-否 2-是,默认1
  143. idling_cnt: { type: Number }, // 怠速次数
  144. idling_duration: { type: Number }, // 怠速时长
  145. drive_anticipation_cnt: { type: Number }, // 驾驶预判次数
  146. stable_drive_cnt: { type: Number }, // 平稳驾驶次数
  147. power_consumption_score: { type: String }, // 百公里平均电耗分数
  148. oil_score: { type: String }, // 百公里平均油耗得分
  149. speed_score: { type: String }, // 平均速度分数
  150. acceleration_score: { type: String }, // 急加速分数
  151. decelerate_score: { type: String }, // 急减速分数
  152. turn_score: { type: String }, // 急转弯分数
  153. speeding_score: { type: String }, // 超速分数
  154. un_tie_sb_score: { type: String }, // 未系安全带持续分数
  155. dsm_score: { type: String }, // 疲劳驾驶分数
  156. fault_score: { type: String }, // 故障行驶分数
  157. leave_sw_score: { type: String }, // 双手离开方向盘分数
  158. safety_assistance_score: { type: String }, // 是否使用安全辅助分数
  159. drive_safety_score: { type: String }, // 驾驶安全策略分数
  160. total_score: { type: String }, // 总得分
  161. hs_turn_score: { type: String }, // 高速过弯得分
  162. at_night_drive_score: { type: String }, // 深夜驾驶得分
  163. sa_score: { type: String }, // 平稳加速评分
  164. sd_score: { type: String }, // 平稳减速评分
  165. steady_score: { type: String }, // 稳定车速评分
  166. driving_safety_score: { type: String }, // 驾驶行为安全得分
  167. energy_conservation_score: { type: String }, // 驾驶行为节能得分
  168. engine_common_fault: { type: String }, // 发动机常见故障
  169. electrical_common_fault: { type: String }, // 电气系统常见故障
  170. transmission_common_fault: { type: String }, // 传动系常见故障
  171. steering_common_fault: { type: String }, // 转向系常见故障
  172. brake_common_fault: { type: String }, // 制动系常见故障
  173. drive_common_fault: { type: String }, // 行驶系常见故障
  174. boc_common_fault: { type: String }, // 车身常见故障
  175. avp_cnt: { type: String }, // 代客泊车次数(该值大于0则本次行程为代客泊车行程)
  176. intelligent_driving_status: { type: String }, // 智能驾驶状态:1-是 2-否
  177. acc_cnt: { type: String }, // 自适应巡航开启次数,大于0则表示本次行程未1次自适应巡航行程数
  178. },
  179. ], // 单次行程列表(未该车辆每日的行程列表数据)
  180. charge_cnt: { type: Number }, // 充电次数
  181. avg_oil_consumption: { type: String }, // 平均油耗值(单位: { type: Number }, // L/百公里,精度: { type: Number }, // 0.01)
  182. dsm_cnt: { type: String }, // 日累计疲劳驾驶次数
  183. drive_duration: { type: Number }, // 日累计驾驶时长
  184. driving_safety_score: { type: String }, // 日驾驶行为安全平均得分
  185. acceleration_score: { type: String }, // 日急加速平均得分
  186. acceleration_cnt: { type: Number }, // 日累计急加速次数
  187. acceleration_mileage: { type: String }, // 加速总里程
  188. decelerate_score: { type: String }, // 日急制动平均得分
  189. decelerate_cnt: { type: Number }, // 日累计急制动次数
  190. decelerate_mileage: { type: String }, // 制动总里程
  191. speeding_score: { type: String }, // 日超速平均得分
  192. speeding_cnt: { type: Number }, // 日累计超速次数
  193. fa_cnt: { type: String }, // 日累计频繁加速次数
  194. fa_score: { type: String }, // 日频繁加速平均得分
  195. fd_cnt: { type: String }, // 日累计频繁制动次数
  196. fd_score: { type: String }, // 日频繁制动平均得分
  197. turn_score: { type: String }, // 日急转弯平均得分
  198. turn_cnt: { type: Number }, // 日累计急转弯次数
  199. clu_cnt: { type: String }, // 日累计急换道次数
  200. clu_score: { type: String }, // 日急换道平均得分
  201. flc_cnt: { type: String }, // 日累计频繁换道次数
  202. flc_score: { type: String }, // 日频繁换道平均得分
  203. io_cnt: { type: String }, // 日累计右侧超车次数
  204. io_score: { type: String }, // 日右侧超车平均得分
  205. hs_turn_cnt: { type: String }, // 日累计高速过弯次数
  206. hs_turn_score: { type: String }, // 日高速过弯平均得分
  207. at_night_drive_cnt: { type: String }, // 深夜出行次数
  208. at_night_drive_duration: { type: Number }, // 日累计深夜出行时长
  209. at_night_drive_mileage: { type: String }, // 深夜出行里程
  210. at_night_drive_score: { type: String }, // 日深夜出行平均得分
  211. un_tie_sb_score: { type: String }, // 日安全带平均得分
  212. un_tie_sb_cnt: { type: Number }, // 日累计未系安全带次数
  213. leave_sw_score: { type: String }, // 日双手离开方向盘平均得分
  214. leave_sw_cnt: { type: Number }, // 日累计双手离开方向盘次数
  215. dsm_score: { type: String }, // 日疲劳驾驶平均得分
  216. fcw_cnt: { type: Number }, // FCW报警次数
  217. fcw_score: { type: String }, // 日fcw平均得分
  218. bsd_cnt: { type: Number }, // BSD报警次数
  219. bsd_score: { type: String }, // 日BSD平均得分
  220. lka_cnt: { type: Number }, // LKA报警次数
  221. lka_score: { type: String }, // 日LKA平均得分
  222. ldw_cnt: { type: Number }, // 日LDW报警次数
  223. ldw_score: { type: String }, // 日LDW平均得分
  224. idling_cnt: { type: String }, // 怠速次数
  225. idling_score: { type: String }, // 怠速得分
  226. drive_anticipation_cnt: { type: String }, // 驾驶预判次数
  227. drive_anticipation_score: { type: String }, // 驾驶预判得分
  228. sa_score: { type: String }, // 加速行为分数(经济加速行为里程占比)
  229. sd_score: { type: String }, // 制动行为分数(经济制动行为里程占比)
  230. steady_score: { type: String }, // 匀速行为分数(经济匀速行为里程占比)
  231. power_consumption_score: { type: String }, // 电耗得分(电动车能耗)
  232. oil_score: { type: String }, // 油耗得分(燃油车能耗)
  233. sky_duration: { type: String }, // 天窗使用时长(毫秒)
  234. headlight_cnt: { type: String }, // 近光灯使用次数
  235. headlight_duration: { type: String }, // 近光灯使用时长(毫秒)
  236. high_beam_cnt: { type: String }, // 远光灯使用次数
  237. high_beam_duration: { type: String }, // 远光灯使用时长(毫秒)
  238. air_duration: { type: Number }, // 空调使用时长(毫秒)
  239. on_compressor_duration: { type: String }, // 空调状态和压缩机均打开使用时长(毫秒)
  240. off_compressor_duration: { type: String }, // 空调状态开压缩机关使用时长(毫秒)
  241. on_auto_duration: { type: Number }, // 激活且空调开启
  242. off_auto_duration: { type: String }, // 关闭且空调开启
  243. blower_rating_duration: {
  244. one: { type: Number }, // 风量1档
  245. two: { type: Number }, // 风量2档
  246. three: { type: Number }, // 风量3档
  247. four: { type: Number }, // 风量4档
  248. five: { type: Number }, // 风量5档
  249. six: { type: Number }, // 风量6档
  250. seven: { type: Number }, // 风量7档
  251. }, // 吹风等级
  252. create_time: { type: Number }, // 创建记录时间戳
  253. energy_conservation_score: { type: String }, // 日驾驶行为节能平均得分
  254. });
  255. DrivingBehaviorInfoSchema.index({ start_time: -1 });
  256. DrivingBehaviorInfoSchema.index({ start_time: -1, vin: -1 });
  257. DrivingBehaviorInfoSchema.index({ start_time: -1, 'mileage_list.start_time': -1, 'mileage_list.end_time': -1, vin: -1 });
  258. DrivingBehaviorInfoSchema.index({ vin: -1 });
  259. return conn.model('DrivingBehaviorInfo', DrivingBehaviorInfoSchema, 'driving_behavior_info');
  260. };