A Method for Predicting Neutral Sliding of Commercial Vehicles on Long Downhill Sections Based on CAN Data
By receiving and processing CAN data and altitude data in real time, using the LightGBM model to predict the vehicle's long downhill neutral sliding state, the problem of insufficient data granularity and dimension in the prior art is solved, and the accuracy and robustness of judgment are improved.
Patent Information
- Application Number
- CN202211216580.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-30
- Publication Date
- 2025-07-01
- Estimated Expiration
- 2042-09-30
AI Technical Summary
In the prior art, when judging that the vehicle is sliding in a long downhill neutral gear, the granularity and dimensions of the altitude data and gear data are insufficient, resulting in a high misjudgment rate and a low robustness in rule judgment.
The commercial vehicle length downhill neutral sliding prediction method based on CAN data is adopted. By receiving CAN data and altitude data in real time, the characteristic values are extracted through stream processing, and the pre-trained LightGBM model is used for real-time prediction, and the prediction probability value is output to judge the vehicle status.
It improves the accuracy and robustness of the vehicle's long downhill neutral sliding state judgment, can make effective judgments in the absence of gear position data, and reduces the misjudgment rate.
Smart Images

Figure CN115526261B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of vehicle networking data applications, and particularly to a method for predicting neutral coasting of commercial vehicles on long downhill slopes based on CAN data. Background Art
[0002] Currently, the methods for judging neutral coasting of vehicles on long downhill slopes basically use altitude data and gear data and make judgments according to rules. However, there are many problems with the rule-based judgment based on altitude data and gear data. First, the granularity of the source data for analysis and prediction is insufficient. For example, the altitude data is collected every 20 s, and the sampling time interval is too large. Even if the intermediate interpolation method is used in the analysis, there will still be many misjudgments. Second, the dimension of the source data is insufficient. The hardware and protocols of each vehicle are different, and it is difficult to obtain the protocol files, resulting in difficulty in obtaining gear data and affecting the judgment results. Third, the method of using rule-based judgment to predict neutral coasting of vehicles on long downhill slopes is relatively simple and crude, and the robustness is not strong. Summary of the Invention
[0003] To solve the above problems, the present invention provides a method for predicting neutral coasting of commercial vehicles on long downhill slopes based on CAN data.
[0004] The present invention adopts the following technical solutions:
[0005] A method for predicting neutral coasting of commercial vehicles on long downhill slopes based on CAN data, comprising the following steps:
[0006] S1. Real-time receive the CAN data and altitude data uploaded by the vehicle, and merge the CAN data and altitude data as the source data;
[0007] S2. Perform stream processing on the source data, and extract the feature values of the source data in real time through a sliding window as the samples to be predicted;
[0008] S3. Input the samples to be predicted into a pre-trained LightGBM model for online real-time prediction to output a prediction probability value, where the prediction probability value represents the probability that the corresponding vehicle is currently in a neutral coasting state on a long downhill slope.
[0009] Further, it further includes: S4. Match the corresponding alarm level according to the prediction probability value, and send an alarm message to the vehicle.
[0010] Further, the training method of the LightGBM model includes the following steps:
[0011] A1. Collect the historical CAN data and historical altitude data of the vehicle, and merge them into historical source data;
[0012] A2. Use a sliding window to extract the eigenvalue of the historical source data as a training sample;
[0013] A3. Use an isolation forest model to perform binary classification prediction on the training sample to distinguish normal samples and abnormal samples;
[0014] A4. Arrange the abnormal samples in ascending order of scores, and label the eigenvalues related to long downhill neutral coasting in the abnormal samples to distinguish positive samples and negative samples;
[0015] A5. Use the SMOTE algorithm to sample the entire training sample to increase the number of positive samples;
[0016] A6. Train a LightGBM model with the labeled training sample and save the trained LightGBM model as a LightGBM model file.
[0017] Further, the CAN data is collected and uploaded through a CAN bus installed on the vehicle. The CAN data is collected once every 1 second, and the sampled CAN data includes CAN vehicle speed, CAN throttle, CAN brake, CAN engine speed, CAN instantaneous fuel consumption, and CAN liquid level.
[0018] Further, the altitude data is collected once every 20 seconds.
[0019] Further, the CAN data and altitude data are uploaded in the form of streaming data.
[0020] Further, in step S1, the CAN data and altitude data are merged as the source data. Specifically: first, use the method of linear interpolation to fill in the missing data in the middle of the altitude data to align the altitude data with the CAN data, and then merge the filled altitude data and the CAN data into 1 piece per second.
[0021] Further, in step S2, the stream processing uses a kafka message queue, and the kafka message queue consumes data once every second.
[0022] Further, the step size of the sliding window is 1 s, the window width is 20 s, and one sample is extracted for each slide. When the CAN speed is below 30 km / h, the sample eigenvalue is not extracted.
[0023] After adopting the above technical solution, compared with the background technology, the present invention has the following advantages:
[0024] 1. The long downhill neutral coasting prediction method of the present invention introduces CAN data (especially the engine speed and CAN brakes in CAN data) to assist in judging long downhill neutral coasting; when the vehicle is in neutral coasting, the engine speed is approximately 600 - 700 r, and the brakes are often used to control the vehicle speed. Therefore, the CAN data can be combined with altitude data to determine whether the vehicle is in neutral coasting, so as to judge the long downhill neutral coasting state of the vehicle even in the absence of gear data. In addition, due to the sampling frequency of CAN data being once per second, the problem of insufficient dimension and granularity of existing altitude data is solved;
[0025] 2. The long downhill neutral coasting prediction method of the present invention uses a machine learning method based on big data to judge long downhill neutral coasting. It combines the real-time uploaded CAN data and altitude data as source data, and uses a pre-trained LightGBM model to achieve real-time prediction of the long downhill neutral coasting state of the vehicle, improving the robustness of data analysis. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Figure 1 It is a flowchart of the method of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0027] In order to make the objectives, technical solutions and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0028] Embodiment
[0029] As Figure 1 shown, a long downhill neutral coasting prediction method for commercial vehicles based on CAN data includes the following steps:
[0030] S1. Real-time receive the CAN data and altitude data uploaded by the vehicle, and merge the CAN data and altitude data as source data;
[0031] The CAN data and altitude data are uploaded in the form of streaming data.
[0032] The CAN data is collected and uploaded through the CAN bus installed on the vehicle. The CAN data is collected once every 1 second, and the sampled CAN data includes CAN vehicle speed, CAN throttle, CAN brakes, CAN engine speed, CAN instantaneous fuel consumption, and CAN liquid level.
[0033] The altitude data is collected once every 20 seconds.
[0034] In step S1, the CAN data and altitude data are merged as the source data. Specifically, first, the method of linear interpolation is used to fill in the missing data in the middle of the altitude data to align the altitude data with the CAN data, and then the filled altitude data and the CAN data are merged into 1 piece per second.
[0035] S2. Perform stream processing on the source data, and use a sliding window to extract the eigenvalue of the source data in real time as the sample to be predicted; the stream processing uses a kafka message queue, and the kafka message queue consumes data once per second.
[0036] The step size of the sliding window is 1s, the window width is 20s, and one sample is extracted for each step of sliding. When the CAN speed is below 30 km / h, the eigenvalue of the sample is not extracted.
[0037] S3. Input the sample to be predicted into a pre-trained LightGBM model for online real-time prediction to output a prediction probability value, where the prediction probability value represents the probability that the corresponding vehicle is currently in the long downhill neutral coasting state.
[0038] S4. Match the corresponding alarm level according to the prediction probability value and send an alarm message to the vehicle.
[0039] Among them, the training method of the LightGBM model includes the following steps:
[0040] A1. Collect the historical CAN data and historical altitude data of the vehicle and merge them into historical source data;
[0041] A2. Use a sliding window to extract the eigenvalue of the historical source data as the training sample; similarly, the step size of the sliding window is 1s, the window width is 20s, and one sample is extracted for each step of sliding. When the CAN speed is below 30 km / h, the eigenvalue of the training sample is not extracted;
[0042] A3. Use an isolation forest model to perform binary classification prediction on the training sample to distinguish normal samples and abnormal samples;
[0043] A4. Arrange the abnormal samples in ascending order of scores, and label the eigenvalues related to long downhill neutral coasting in the abnormal samples to distinguish them into positive samples and negative samples; for example, 5 features can be selected from them as the target features for whether it is long downhill neutral coasting, and the 5 selected features are mainly based on CAN engine speed, CAN brake, and altitude data of the trajectory;
[0044] A5. Use the SMOTE algorithm to sample the entire training sample to increase the number of positive samples;
[0045] A6. Train the LightGBM model with the labeled training samples and save the trained LightGBM model as a LightGBM model file.
[0046] In addition, the feature extraction of the source data in the present invention and its extraction rules are as follows:
[0047] (1) cur_v, that is, the latest speed value (CAN_velocity) within the current 20s. The extraction rule is: if CAN_velocity is greater than 120 km / h or is empty, fill it with the data of the previous second. If the previous second is also empty, fill it with the data of the second previous second, and so on. In addition, if CAN_velocity is less than 52 km / h or there is no data directly assign 52;
[0048] (2) cur_a, that is, the acceleration within 1s. The extraction rule is: extract the values of the previous two CAN_velocity values. For each CAN_velocity value, if CAN_velocity is greater than 120 km / h or is empty, fill it with the data of the previous second. If the previous second is also empty, fill it with the data of the second previous second, and so on. Then subtract the CAN_velocity of the previous second from the current latest CAN_velocity;
[0049] (3) sigma_a, that is, the standard deviation of the acceleration within 20s (which is the first-order difference of CAN_velocity). The extraction rule is: extract 20 CAN_velocity values. For each CAN_velocity value, if it is greater than 120 km / h or is empty, fill it with the data of the previous second. If the previous second is also empty, fill it with the data of the second previous second, and so on. Then subtract the value of CAN_velocity of each second within 20s from the value of the previous second to obtain 19 acceleration values, and then calculate the standard deviation of these 19 acceleration values;
[0050] (4) sigma_a1d, that is, the standard deviation of the first-order difference of the acceleration within 20s. The extraction rule is: subtract each of the previous 19 acceleration values from the previous acceleration value to obtain 18 first-order differences of the acceleration, and then calculate the standard deviation of these 18 first-order differences of the acceleration;
[0051] (5) abssum_a1d, that is, the sum of the absolute values of the 18 first-order differences of the acceleration;
[0052] (6) cur_al, that is, the current latest altitude value. The extraction rule is: if there is a null value, fill it with the value of the previous second. If the previous second is also empty, fill it with the value of the second previous second, and so on;
[0053] (7) al1d_positive_set_0, which is the first-order difference of the current altitude. The extraction rule is: if this value is greater than 0, it is directly assigned 0;
[0054] (8) al1d_nag_count, which is the number of negative values among the first-order difference values of 19 altitude values;
[0055] (9) cur_r, which is the rotational speed in the current latest 1s. The extraction rule is: if it is less than 500 r / min, it is given 1100 r / min. If it is empty, it is filled with the value of the previous second. If the previous second is also empty, it is filled with the value of the second previous second, and so on;
[0056] (10) r700, which is the sum of the absolute values of the difference between each engine rotational speed value and 700 within 20s;
[0057] (11) sigma_r, which is the standard deviation of the rotational speed within 20 seconds;
[0058] (12) sigma_r1d, which is the standard deviation of the first-order difference of the rotational speed within 20s;
[0059] (13) abssum_r1d: the sum of the absolute values of the first-order difference of the rotational speed within 20s;
[0060] (14) cur_acc, which is the current throttle. The extraction rule is: if the current throttle is empty, it is filled with the value of the previous second. If the previous second is also empty, it is filled with the value of the second previous second, and so on;
[0061] (15) sum_ped, which is the sum of the brake values within 20s, that is, the number of times the brake value is 1. The extraction rule is: if the brake value is empty, no processing is required. If it is not 0, it is counted;
[0062] (16) cur_insoil, which is the current instantaneous fuel consumption. The extraction rule is: if there is an empty value, it is filled with the value of the previous second. If the previous second is also empty, it is filled with the value of the second previous second, and so on;
[0063] (17) sigma_insoi, which is the standard deviation of the instantaneous fuel consumption within 20s;
[0064] (18) insoil1d, which is the first-order difference of the instantaneous fuel consumption;
[0065] (19) sigma_insoil1d, which is the standard deviation of the first-order difference of the instantaneous fuel consumption;
[0066] (20) fluid1d, which is the liquid level. The extraction rule is: first, process the liquid level data. If it is empty, it is filled with the value of the previous second. If the previous second is also empty, it is filled with the value of the second previous second, and so on. Then, calculate the first-order difference of the current liquid level.
[0067] In addition, all values must not be empty. If there are still null values in the final calculation result, default values need to be given as follows:
[0068] cur_v: 52;
[0069] cur_a: 0;
[0070] sigma_a: 0, there must be 19 of them, otherwise set to 0;
[0071] sigma_a1d: 0, there must be 18 of them, otherwise set to 0;
[0072] abssum_a1d: 0, there must be 18 of them, otherwise set to 0;
[0073] cur_al: 0;
[0074] al1d_positive_set_0: 0;
[0075] al1d_nag_count: 0, there must be 19 of them, otherwise set to 0;
[0076] cur_r: 1200;
[0077] r700: 2000, there must be 20 of them, otherwise set to 2000;
[0078] sigma_r: 0, there must be 20 of them, otherwise set to 0;
[0079] sigma_r1d: 0, there must be 19 of them, otherwise set to 0;
[0080] abssum_r1d: 0, there must be 19 of them, otherwise set to 0;
[0081] cur_acc: 0;
[0082] sum_ped: 0, there must be 20 of them, otherwise set to 0;
[0083] cur_insoil: 0;
[0084] sigma_insoil: 0, there must be 20 of them, otherwise set to 0;
[0085] insoil1d: 0;
[0086] sigma_insoil1d: 0, there must be 19 of them, otherwise set to 0;
[0087] fluid1d: 0.
[0088] As described above, it is only the preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by those skilled in the art within the technical scope disclosed by the present invention should be covered within the protection scope of the present invention. Therefore, the protection scope of the present invention should be subject to the protection scope of the claims.
Claims
1. A method for predicting the neutral coasting of commercial vehicles based on CAN data, characterized in that: Including the following steps: S1. Receive the CAN data and altitude data uploaded by the vehicle in real time, and merge the CAN data and altitude data as the source data; S2. Perform stream processing on the source data, and extract the eigenvalue of the source data in real time through a sliding window as the sample to be predicted; S3. Input the sample to be predicted into the pre-trained LightGBM model for online real-time prediction to output a prediction probability value, where the prediction probability value represents the probability that the corresponding vehicle is currently in the long downhill neutral coasting state.
2. The method for predicting the neutral coasting of a commercial vehicle during long downhill based on CAN data according to claim 1, characterized in that: It further includes: S4. Match the corresponding alarm level according to the prediction probability value, and send an alarm message to the vehicle.
3. The method for predicting the neutral coasting of a commercial vehicle based on CAN data according to claim 2, wherein: The training method of the LightGBM model includes the following steps: A1. Collect the historical CAN data and historical altitude data of the vehicle, and merge them into historical source data; A2. Use a sliding window to extract the eigenvalue of the historical source data as the training sample; A3. Use the Isolation Forest model to perform binary classification prediction on the training sample to distinguish normal samples and abnormal samples; A4. Arrange the abnormal samples in ascending order of scores, and label the eigenvalues related to long downhill neutral coasting in the abnormal samples to distinguish positive samples and negative samples; A5. Use the SMOTE algorithm to sample the entire training sample to increase the number of positive samples; A6. Train the LightGBM model with the labeled training sample, and save the trained LightGBM model as a LightGBM model file.
4. The method for predicting the neutral coasting of a commercial vehicle during long downhill based on CAN data according to claim 3, wherein: The CAN data is collected and uploaded through the CAN bus installed on the vehicle. The CAN data is collected once every 1 second, and the sampled CAN data includes CAN vehicle speed, CAN throttle, CAN brake, CAN engine speed, CAN instantaneous fuel consumption, and CAN liquid level.
5. A method for predicting the neutral coasting of a commercial vehicle during long downhill based on CAN data according to claim 4, characterized in that: The altitude data is collected once every 20 seconds.
6. The method for predicting the neutral coasting of a commercial vehicle during long downhill based on CAN data according to claim 5, characterized in that: The CAN data and altitude data are uploaded in the form of stream data.
7. The method for predicting the neutral coasting of a commercial vehicle during long downhill based on CAN data according to claim 6, wherein: In step S1, after merging the CAN data and altitude data as the source data, specifically: first use the linear interpolation method to fill in the empty data in the middle of the altitude data to align the altitude data and CAN data, and then merge the filled altitude data and the CAN data into 1 piece per second.
8. The method for predicting the neutral coasting of a commercial vehicle during long downhill based on CAN data according to claim 7, characterized in that: In step S2, the stream processing uses a kafka message queue, and the kafka message queue consumes data once every second.
9. A method for predicting the neutral coasting of a commercial vehicle based on CAN data according to any one of claims 1-8, characterized in that: The step size of the sliding window is 1s, the window width is 20s, and one sample is extracted every time it slides. When the CAN speed is below 30 km / h, the sample eigenvalue is not extracted.
Citation Information
Patent Citations
Automobile coasting distance pre-measuring system
CN104006973A
Machine learning-based vehicle abnormal trajectory real-time recognition method
CN109785595A