A vehicle-mounted CAN network traffic load prediction method, system and electronic device

By combining a one-dimensional convolutional module and a Transformer encoder in the traffic prediction model, the shortcomings of traffic prediction in vehicle CAN networks are addressed, achieving higher accuracy and speed in load prediction, and improving the stability and safety of the vehicle control system.

CN117008577BActive Publication Date: 2026-06-26JILIN UNIVERSITY

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
JILIN UNIVERSITY
Filing Date
2023-08-07
Publication Date
2026-06-26

Smart Images

  • Figure CN117008577B_ABST
    Figure CN117008577B_ABST
Patent Text Reader

Abstract

The application discloses a vehicle-mounted CAN network flow load prediction method and system and electronic equipment, and relates to the technical field of flow load prediction sources.The method comprises the following steps: acquiring vehicle-mounted CAN network flow load data of a current period of a vehicle to be predicted; inputting the vehicle-mounted CAN network flow load data of the current period into a flow prediction model to obtain predicted vehicle-mounted CAN network flow load data of a next moment of the current period.The application realizes vehicle-mounted CAN network flow load prediction, and improves the prediction accuracy and speed of the vehicle-mounted CAN network flow load.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of traffic load prediction technology, and in particular to a method, system and electronic device for predicting traffic load in a vehicle CAN network. Background Technology

[0002] With the development of automotive software, the demand for safe and efficient ECU remapping technology is becoming increasingly urgent. Currently, most vehicles require ECU upgrades or maintenance at 4S dealerships. This method suffers from low efficiency, high cost, and poor user experience. Therefore, remote online ECU remapping technology has emerged, with manufacturers using Over-the-Air (OTA) technology to remotely remapping vehicle ECUs. OTA technology comprises two parts: a cloud service system and an on-board unit. In the cloud, the cloud server manages, generates, and publishes relevant files; on the on-board unit, the T-Box receives data and transmits it to the ECU via the vehicle network to update the ECU. ECUs with control functions connect to the T-Box via a Controller Area Network (CAN). Therefore, researching dynamic data transmission technology in CAN is crucial for achieving efficient remote ECU remapping and has significant practical implications for improving related automotive technologies.

[0003] Today, the CAN protocol has become one of the most important communication protocols in modern automobiles, used to transmit various control and sensor data. However, due to the limited bandwidth of the CAN network, traffic overload can lead to system delays and malfunctions. Therefore, achieving real-time and accurate prediction of CAN network traffic load can help design more stable and efficient automotive control systems, optimize system performance and stability, improve driving safety and comfort, and also help vehicle manufacturers and suppliers better understand vehicle usage, thereby improving product quality and reliability. However, methods for predicting traffic in automotive CAN networks are currently lacking. Summary of the Invention

[0004] The purpose of this invention is to provide a method, system, and electronic device for predicting the traffic load of an in-vehicle CAN network, which not only achieves the prediction of the traffic load of an in-vehicle CAN network, but also improves the prediction accuracy and speed.

[0005] To achieve the above objectives, the present invention provides the following solution:

[0006] A method for predicting traffic load in an in-vehicle CAN network includes:

[0007] Obtain the onboard CAN network traffic load data of the vehicle to be predicted for the current time period;

[0008] The onboard CAN network traffic load data of the vehicle to be predicted in the current time period is input into the traffic prediction model to obtain the predicted onboard CAN network traffic load data of the vehicle to be predicted in the next time period. The traffic prediction model is obtained by training an initial network using onboard CAN network traffic load data sets of multiple training vehicles. The onboard CAN network traffic load data sets of the training vehicles include onboard CAN network traffic load data of the training time period and onboard CAN network traffic load data of the next time period. The initial network includes a one-dimensional convolution module and a Transformer encoder module.

[0009] Optionally, the training process of the traffic prediction model includes:

[0010] Acquire multiple sets of onboard CAN network traffic load data for training vehicles;

[0011] The initial network is constructed using the one-dimensional convolutional module and the Transformer encoder module;

[0012] The initial network is trained by taking the vehicle CAN network traffic load data of each training period as input and the vehicle CAN network traffic load data of the next moment of the corresponding training period as output, so as to obtain the traffic prediction model.

[0013] Optionally, obtain the vehicle's onboard CAN network traffic load data for the current time period, including:

[0014] Obtain the data log file on the CAN bus of the vehicle to be predicted for the current time period;

[0015] The data log file on the CAN bus of the vehicle to be predicted for the current time period is parsed and replayed to obtain the vehicle's onboard CAN network traffic load data for the current time period.

[0016] Optionally, the process of acquiring a group of onboard CAN network traffic load data for any training vehicle includes:

[0017] Obtain the data log files on the CAN bus of the training vehicle during a preset time period;

[0018] The data log files on the CAN bus during the preset time period are parsed and played back to obtain the vehicle CAN network traffic load data for the preset time period.

[0019] The vehicle CAN network traffic load data for a preset time period is divided into multiple vehicle CAN network traffic load data groups using a sliding window.

[0020] Optionally, before using a sliding window to divide the vehicle CAN network traffic load data for a preset time period into multiple vehicle CAN network traffic load data groups, it also includes...

[0021] All vehicle CAN network traffic load data in the preset time period are normalized.

[0022] A vehicle-mounted CAN network traffic load prediction system includes:

[0023] The data acquisition module is used to acquire the on-board CAN network traffic load data of the vehicle to be predicted during the current time period;

[0024] The prediction module is used to input the on-board CAN network traffic load data of the vehicle to be predicted for the current time period into the traffic prediction model to obtain the predicted on-board CAN network traffic load data of the vehicle to be predicted for the next time period. The traffic prediction model is obtained by training an initial network using on-board CAN network traffic load data sets of multiple training vehicles. The on-board CAN network traffic load data sets of the training vehicles include on-board CAN network traffic load data for the training time period and on-board CAN network traffic load data for the next time period. The initial network includes a one-dimensional convolution module and a Transformer encoder module.

[0025] An electronic device includes a memory and a processor, the memory storing a computer program, and the processor running the computer program to enable the electronic device to perform the above-described vehicle CAN network traffic load prediction method.

[0026] Optionally, the memory is a readable storage medium.

[0027] According to specific embodiments provided by the present invention, the present invention discloses the following technical effects:

[0028] This invention discloses a method, system, and electronic device for predicting the traffic load of an in-vehicle CAN network. First, the in-vehicle CAN network traffic load data for the current time period of the vehicle to be predicted is acquired. Then, the in-vehicle CAN network traffic load data for the current time period is input into a traffic prediction model to obtain the predicted in-vehicle CAN network traffic load data for the next time period. The traffic prediction model is obtained by training an initial network using multiple sets of in-vehicle CAN network traffic load data from training vehicles. The initial network includes a one-dimensional convolutional module and a Transformer encoder module. The traffic prediction model obtained by combining the one-dimensional convolutional module and the Transformer encoder module is used to predict the in-vehicle CAN network traffic load, which not only achieves the prediction of in-vehicle CAN network traffic load but also improves the prediction accuracy and speed. Attached Figure Description

[0029] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0030] Figure 1 This is a schematic diagram of the vehicle CAN network traffic load prediction method provided in Embodiment 1 of the present invention;

[0031] Figure 2 This diagram illustrates the training process of the traffic prediction model before predicting traffic load in an in-vehicle CAN network and the process of using the traffic prediction model to predict traffic load in an in-vehicle CAN network. Detailed Implementation

[0032] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0033] The purpose of this invention is to provide a method, system, and electronic device for predicting the traffic load of an in-vehicle CAN network, aiming to improve the prediction accuracy and speed of the in-vehicle CAN network traffic load while achieving the prediction.

[0034] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0035] Example 1

[0036] Figure 1 This is a schematic diagram of the vehicle-mounted CAN network traffic load prediction method provided in Embodiment 1 of the present invention. Figure 1 As shown, the vehicle CAN network traffic load prediction method in this embodiment includes:

[0037] Step 101: Obtain the on-board CAN network traffic load data of the vehicle to be predicted for the current time period.

[0038] Step 102: Input the on-board CAN network traffic load data of the vehicle to be predicted for the current time period into the traffic prediction model to obtain the predicted on-board CAN network traffic load data of the vehicle to be predicted for the next time period.

[0039] The traffic prediction model is obtained by training the initial network using a set of onboard CAN network traffic load data from multiple training vehicles. The set of onboard CAN network traffic load data from the training vehicles includes onboard CAN network traffic load data for the training period and onboard CAN network traffic load data for the next moment of the training period. The initial network includes a one-dimensional convolutional module and a Transformer encoder module.

[0040] As an optional implementation method, such as Figure 2 As shown, the training process of the traffic prediction model includes:

[0041] Acquire the onboard CAN network traffic load data sets of multiple training vehicles.

[0042] The initial network is constructed using a one-dimensional convolution module and a Transformer encoder module.

[0043] The vehicle CAN network traffic load data for each training period is used as input, and the vehicle CAN network traffic load data for the next moment of the corresponding training period is used as output to train the initial network and obtain the traffic prediction model.

[0044] Specifically, a one-dimensional convolutional neural network, Conv1d, was chosen to process the vehicle CAN network traffic load data during the training period (the vehicle CAN network traffic load data during the training period is a one-dimensional time series dataset). The one-dimensional convolutional kernel moves only in one direction to extract features, and outputs a vector after the operation.

[0045] Conv1d takes a 3D input tensor (batch_size, input_length, input_channels) and outputs a tensor of shape (batch_size, input_length, output_channels). Since this is a univariate sequence, the number of input_channels is 1. An additional dimension is manually added before passing it to the 1D convolution module to meet its input requirements. Here, batch_size is the batch size, input_length is the input length, input_channels are the input channels, and output_channels are the output channels.

[0046] The sequence processed by the one-dimensional convolution module is input into the Transformer encoder module. In the Transformer encoder module, the data first passes through a self-attention module to obtain the enhanced feature vector Z, i.e., Attention(Q, K, V):

[0047] Where, d k Let T denote the vector dimensions of Q and K, and T denote the transpose. Each sequence has three distinct variables: a Query vector (Q), a Key vector (K), and a Value vector (V), which are obtained by multiplying the embedding vector by three distinct weight matrices W. Q W K W W We obtain that the three weight matrices have the same size.

[0048] The entire process of calculating the Attention function can be divided into 6 steps:

[0049] 1. Based on the input vector, i.e. the embedding vector, obtain three vectors: Q, K, and V.

[0050] 2. Calculate the score for each embedding vector: score = Q·K.

[0051] 3. To stabilize the gradient, the Transformer uses score normalization, which involves dividing the score by... The normalized score is obtained.

[0052] 4. Apply the softmax activation function to the normalized score to obtain the value after the softmax activation function.

[0053] 5. Multiply the values ​​after the softmax activation function by V to obtain the weighted score v for each input vector.

[0054] 6. After adding all the v values ​​together, we get the final output Z: Z = ∑v.

[0055] The data is input into the four self-attention mechanisms mentioned above to obtain four weighted feature matrices Z. i Let i∈{1,2,3,4}, and let the four Z's be... i The columns are combined to form a large feature matrix, which is then passed through a fully connected layer to obtain the output Z.

[0056] After obtaining Z, it is fed into the next feedforward neural network module. This module has two fully connected layers. The activation function of the first fully connected layer is ReLU, and the activation function of the second fully connected layer is a linear activation function, expressed as:

[0057] FFN(Z)=max(0,ZW1+b1)W2+b2.

[0058] Where FFN() is the value after processing by the feedforward neural network, W1 is the weight coefficient of the first fully connected layer, b1 is the bias of the first fully connected layer, W2 is the weight coefficient of the second fully connected layer, and b2 is the bias of the second fully connected layer.

[0059] As an optional implementation, step 101 includes:

[0060] Obtain the data log file on the CAN bus of the vehicle to be predicted for the current time period.

[0061] The data log file on the CAN bus of the vehicle to be predicted for the current time period is parsed and played back to obtain the on-board CAN network traffic load data of the vehicle to be predicted for the current time period.

[0062] As an optional implementation, the process of acquiring the onboard CAN network traffic load data set of any training vehicle includes:

[0063] Obtain the data log files on the CAN bus of the training vehicle during a preset time period.

[0064] Specifically, the data log file can be obtained by: exporting the data log file on the vehicle's CAN bus from the vehicle using a USBCAN analyzer and transferring it to a computer.

[0065] The data log files on the CAN bus for a preset time period are parsed and played back to obtain the vehicle CAN network traffic load data for the preset time period.

[0066] Specifically, methods for parsing and replaying data log files to obtain vehicle CAN network traffic load data include:

[0067] (1) Open the CANoe software, create a new CANoe project, enable Measurement Setup, open the settings diagram, load the data log file, switch to offline mode, set Trace, and set Graphics.

[0068] (2) Open the Simulation Setup window, set up the CAN network, click Databases to load the corresponding DBC file, and set up the corresponding CAN channel.

[0069] (3) Loading messages: You can see messages being generated in the Trance diagram.

[0070] (4) Set the properties of the Graphics window and add the signals that need to be analyzed.

[0071] (5) In the Simulation Setup window and Graphics window, analyze and replay the message normally to obtain information such as time, ID, data length, and message data in the CAN communication data, and save it as a .csv file.

[0072] (6) By using Python to debug the code, import the dataset from the above .csv file, and use the number of tasks within a certain time interval (e.g., 100ms) as the CAN network traffic load data. The CAN network traffic load data is a one-dimensional time series dataset.

[0073] The vehicle CAN network traffic load data for a preset time period is divided into multiple vehicle CAN network traffic load data groups using a sliding window.

[0074] Specifically, a sliding window is used to divide the one-dimensional time series dataset into multiple samples. The first m vehicle CAN network traffic load data are used as input, and the (m+1)th vehicle CAN network traffic load data is used as output. That is, the sliding window size is set to m, and the window slides down in steps of 1.

[0075] As an optional implementation, before dividing the vehicle CAN network traffic load data for a preset time period into multiple vehicle CAN network traffic load data groups using a sliding window, it also includes...

[0076] All vehicle CAN network traffic load data in the preset time period are normalized.

[0077] Specifically, to eliminate dimensions and accelerate convergence, the vehicle CAN network traffic load data is normalized using the MinMaxScaler method. The formula for the MinMaxScaler method is:

[0078] Where x′ is the value after data normalization, min is the lower limit of the one-dimensional time series dataset, max is the upper limit of the one-dimensional time series dataset, and x is the data in the one-dimensional time series dataset.

[0079] Example 2

[0080] The vehicle-mounted CAN network traffic load prediction system in this embodiment includes:

[0081] The data acquisition module is used to acquire the on-board CAN network traffic load data of the vehicle to be predicted during the current time period.

[0082] The prediction module is used to input the on-board CAN network traffic load data of the vehicle to be predicted for the current time period into the traffic prediction model to obtain the predicted on-board CAN network traffic load data of the vehicle to be predicted for the next time period. The traffic prediction model is obtained by training the initial network using on-board CAN network traffic load data sets of multiple training vehicles. The on-board CAN network traffic load data sets of the training vehicles include on-board CAN network traffic load data for the training time period and on-board CAN network traffic load data for the next time period. The initial network includes a one-dimensional convolution module and a Transformer encoder module.

[0083] Example 3

[0084] An electronic device includes a memory and a processor. The memory stores a computer program, and the processor runs the computer program to enable the electronic device to perform the vehicle CAN network traffic load prediction method of Embodiment 1.

[0085] As an optional implementation, the memory is a readable storage medium.

[0086] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the systems disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple; relevant parts can be referred to the method section.

[0087] This document uses specific examples to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. Furthermore, those skilled in the art will recognize that, based on the ideas of the present invention, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of the present invention.

Claims

1. A method for predicting traffic load in a vehicle-mounted CAN network, characterized in that, The method includes: Obtain the onboard CAN network traffic load data of the vehicle to be predicted for the current time period; The onboard CAN network traffic load data of the vehicle to be predicted in the current time period is input into the traffic prediction model to obtain the predicted onboard CAN network traffic load data of the vehicle to be predicted in the next time period. The traffic prediction model is obtained by training an initial network using onboard CAN network traffic load data sets of multiple training vehicles. The onboard CAN network traffic load data sets of the training vehicles include onboard CAN network traffic load data of the training time period and onboard CAN network traffic load data of the next time period. The initial network includes a one-dimensional convolution module and a Transformer encoder module. Obtain the current time period's onboard CAN network traffic load data for the vehicle to be predicted, including: Obtain the data log file on the CAN bus of the vehicle to be predicted for the current time period; The data log file on the CAN bus of the vehicle to be predicted for the current time period is parsed and replayed to obtain the vehicle CAN network traffic load data of the vehicle to be predicted for the current time period. Methods for parsing and replaying data log files to obtain vehicle CAN network traffic load data include: Open the CANoe software, create a new CANoe project, enable measurement settings, open the settings diagram, load the data log file, switch to offline mode, set the trajectory, and set the mapping. Open the simulation settings window, configure the CAN network, click Databases to load the corresponding DBC file, and configure the corresponding CAN channel; Load the message; you will see the message generated in the trajectory diagram. Set the Graphics window properties and add the signals that need to be analyzed; In the simulation settings window and the Graphics window, analyze and replay the messages normally to obtain information such as time, ID, data length, and message data contained in the CAN communication data, and save it as a .csv file. By using Python to debug the code and importing the dataset from the .csv file, the system plans to use the number of tasks within a certain time interval as CAN network traffic load data. The CAN network traffic load data is a one-dimensional time series dataset.

2. The method for predicting traffic load in a vehicle-mounted CAN network according to claim 1, characterized in that, The training process of the traffic prediction model includes: Acquire multiple sets of onboard CAN network traffic load data for training vehicles; The initial network is constructed using the one-dimensional convolutional module and the Transformer encoder module; The initial network is trained by taking the vehicle CAN network traffic load data of each training period as input and the vehicle CAN network traffic load data of the next moment of the corresponding training period as output, so as to obtain the traffic prediction model.

3. The method for predicting traffic load in a vehicle-mounted CAN network according to claim 2, characterized in that, The process of acquiring a set of onboard CAN network traffic load data for any training vehicle includes: Obtain the data log files on the CAN bus of the training vehicle during a preset time period; The data log files on the CAN bus during the preset time period are parsed and played back to obtain the vehicle CAN network traffic load data for the preset time period. The vehicle CAN network traffic load data for a preset time period is divided into multiple vehicle CAN network traffic load data groups using a sliding window.

4. The method for predicting traffic load in a vehicle-mounted CAN network according to claim 3, characterized in that, Before using a sliding window to divide the vehicle CAN network traffic load data for a preset time period into multiple vehicle CAN network traffic load data groups, it also includes... All vehicle CAN network traffic load data in the preset time period are normalized.

5. A vehicle-mounted CAN network traffic load prediction system, characterized in that, The system includes: The data acquisition module is used to acquire the on-board CAN network traffic load data of the vehicle to be predicted during the current time period; The prediction module is used to input the on-board CAN network traffic load data of the vehicle to be predicted in the current time period into the traffic prediction model to obtain the predicted on-board CAN network traffic load data of the vehicle to be predicted in the next time period. The traffic prediction model is obtained by training an initial network using on-board CAN network traffic load data sets of multiple training vehicles. The on-board CAN network traffic load data sets of the training vehicles include on-board CAN network traffic load data of the training time period and on-board CAN network traffic load data of the next time period. The initial network includes a one-dimensional convolution module and a Transformer encoder module. Obtain the current time period's onboard CAN network traffic load data for the vehicle to be predicted, including: Obtain the data log file on the CAN bus of the vehicle to be predicted for the current time period; The data log file on the CAN bus of the vehicle to be predicted for the current time period is parsed and replayed to obtain the vehicle CAN network traffic load data of the vehicle to be predicted for the current time period. Methods for parsing and replaying data log files to obtain vehicle CAN network traffic load data include: Open the CANoe software, create a new CANoe project, enable measurement settings, open the settings diagram, load the data log file, switch to offline mode, set the trajectory, and set the mapping. Open the simulation settings window, configure the CAN network, click Databases to load the corresponding DBC file, and configure the corresponding CAN channel; Load the message; you will see the message generated in the trajectory diagram. Set the Graphics window properties and add the signals that need to be analyzed; In the simulation settings window and the Graphics window, analyze and replay the messages normally to obtain information such as time, ID, data length, and message data contained in the CAN communication data, and save it as a .csv file. By using Python to debug the code and importing the dataset from the .csv file, the system plans to use the number of tasks within a certain time interval as CAN network traffic load data. The CAN network traffic load data is a one-dimensional time series dataset.

6. An electronic device, characterized in that, The device includes a memory and a processor, the memory being used to store a computer program, and the processor running the computer program to cause the electronic device to perform the vehicle CAN network traffic load prediction method according to any one of claims 1 to 4.

7. An electronic device according to claim 6, characterized in that, The memory is a readable storage medium.