A PSI5-based data detection method and system
By adopting a data detection method based on the PSI5 protocol in the sensor network, combining cyclic redundancy checking, dynamic hash checking and data frame exception prediction models, the problem of data errors or losses is solved, and efficient and reliable data transmission and decision support are achieved.
Patent Information
- Application Number
- CN202411687213.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-25
- Publication Date
- 2025-06-24
- Estimated Expiration
- 2044-11-25
AI Technical Summary
In sensor networks, the accuracy and reliability of data are affected by environmental interference, degraded link quality, node failure and data conflicts, resulting in data errors or loss, and it is difficult for the prior art to effectively detect and verify data.
Using a data detection method based on the PSI5 protocol, the data frames sent by the sensor are received through the peripheral sensor interface of each ECU, cyclic redundancy checks and dynamic hash checks are performed, and the data frame abnormality prediction model is used to identify normal and abnormal data patterns.
It realizes effective verification of transmitted data, improves data integrity and reliability, quickly recognizes and responds to abnormal signals from sensors, improves the safety and stability of the autonomous driving system, and optimizes data transmission efficiency and decision-making support capabilities.
Smart Images

Figure CN119211300B_ABST
Abstract
Description
Technical Field
[0001] The present invention proposes a data detection method and system based on PSI5, which relates to the technical field of data processing. Background Art
[0002] The PSI5 (Peripheral Sensor Interface) protocol is an open standard based on existing sensor interfaces for peripheral airbag sensors and has been verified in millions of airbag systems. The data of such sensors can be transmitted synchronously and asynchronously simultaneously through a two-wire interface. The technical characteristics and low implementation cost of the PSI5 communication protocol make it equally suitable for many other automotive sensor applications. In a sensor network, the accuracy and reliability of data are crucial. During the actual deployment of sensors, affected by environmental interference, degraded link quality, node failure, and data conflicts, etc., data errors or losses may occur. Therefore, implementing an effective data detection and verification mechanism to ensure the integrity and accuracy of the transmitted information is an important part of improving the system reliability. Summary of the Invention
[0003] The present invention provides a data detection method and system based on PSI5 to solve the above-mentioned problems:
[0004] A data detection method based on PSI5 proposed by the present invention, the method includes:
[0005] Receiving data frames sent by sensors through the peripheral sensor interface PSI5 of each ECU, the data frame format is defined by the PSI5 protocol;
[0006] Each ECU inputs the data that has passed cyclic redundancy check into a data frame anomaly prediction model to identify normal and abnormal data patterns, and sends the data frames identified as normal patterns to the main control unit in the vehicle according to the time slots allocated dynamically.
[0007] Further, receiving data frames sent by sensors through the peripheral sensor interface PSI5 of each ECU, the data frame format is defined by the PSI5 protocol, including:
[0008] Each sensor sends its data frame within the pre-allocated time slot, and this data frame is in the defined format according to the PSI5 protocol, and the defined format includes: frame start flag, sensor ID, data field, data length, cyclic redundancy check code, and frame end flag;
[0009] The ECU receives data frames sent by each sensor through the PSI5 interface within the pre-allocated time slot;
[0010] The ECU parses and validates the received data frame, and the parsing and validation include:
[0011] Parse the received data, and separate the data field, frame start flag, frame end flag, and cyclic redundancy check code;
[0012] Confirm whether the frame start flag and the frame end flag conform to the specification. If the frame start flag and the frame end flag do not conform to the specification, the frame is determined to be illegal data, and the retransmission mechanism is triggered;
[0013] Perform CRC calculation on the data field using the selected CRC polynomial and initial value to obtain the calculated CRC value;
[0014] If the calculated CRC value is the same as the separated cyclic redundancy check code, the data cyclic redundancy check passes. If they are different, the data cyclic redundancy check fails, and the retransmission mechanism is triggered.
[0015] Furthermore, each ECU inputs the data frame that has passed the cyclic redundancy check into the data frame anomaly prediction model to identify normal and abnormal data patterns, and sends the data frames identified as normal mode to the main control unit in the vehicle according to the time slots allocated by the dynamic time slot allocation, including:
[0016] Train the data frame anomaly prediction model;
[0017] Input the data frame that has passed the cyclic redundancy check into the data frame anomaly prediction model to determine whether the data frame is abnormal;
[0018] If it is abnormal, the retransmission mechanism is triggered. If it is normal, the ECU sends the normal data frame to the main control unit in the vehicle according to the method of dynamic time slot allocation;
[0019] The main control unit performs hash check on the received data, and the hash check includes:
[0020] When the ECU generates a data packet, calculate the hash value through the dynamic hash model, and attach the calculated hash value to the data packet. Specifically, the dynamic hash model is:
[0021]
[0022] Among them, H represents the calculated hash value, T represents the timestamp when the data starts to be transmitted from the ECU to the main control unit, D represents the transmitted data value, U represents the status field of the sensor, I represents the sensor ID, FC represents the value of the frame counter, and P represents the preset prime number value;
[0023] The ECU sends the data packet attached with the hash value to the main control unit;
[0024] After the master controller receives the data packet, it recalculates the hash value through the dynamic hash model and compares the calculated hash value with the received hash value;
[0025] If they are the same, the data is considered complete; if they do not match, a retransmission is requested;
[0026] If the hash check passes, the master control unit in the vehicle makes a decision based on the data field of the data frame.
[0027] Furthermore, training the data frame anomaly prediction model includes:
[0028] Defining data features, collecting data frames from sensors and ECUs according to the defined data features, where the data features include: timestamp of the data frame, time interval between adjacent data frames, sensor ID, data value of the data frame, average value of data values of data frames with the same sensor ID, variance of data values of data frames with the same sensor ID, cyclic redundancy check code, cyclic redundancy check status, data frame sequence number, number of data frame anomalies, average value of data frames with the same sensor ID in a specific past time window, historical maximum value of data frames with the same sensor ID, historical minimum value of data frames with the same sensor ID, volatility of data values of data frames with the same sensor ID, dynamic time slot, signal-to-noise ratio of the data frame, and packet loss rate of the data frame;
[0029] Collecting data frames from sensors and ECUs according to the defined data features, where the collected data frames include normal frames and abnormal frames;
[0030] Preprocessing the collected data frames, where the preprocessing includes removing duplicates and filling in missing values;
[0031] Dividing the preprocessed data frames into a training set and a test set, with 80% of the preprocessed data frames as the training set and 20% as the test set;
[0032] Selecting random forest as the classification model, training the random forest model on the training set, using k-fold cross-validation, and evaluating the performance using a confusion matrix after validation. The evaluated performance includes: accuracy, precision, recall, F1-score, ROC curve, and AUC value;
[0033] When the evaluated performance value is greater than or equal to the preset threshold, a trained data frame anomaly prediction model is obtained.
[0034] Furthermore, the ECU sends normal data frames to the master control unit in the vehicle according to the method of dynamic time slot allocation, including:
[0035] Initializing and defining the initial load, priority, and respective relative bandwidth ratios of each ECU;
[0036] At the beginning of each communication cycle, the slot length allocated to ECU i is calculated through a dynamic slot allocation model according to the adjusted real-time load of ECU i and the priority of ECU i. Specifically, the dynamic slot allocation model is as follows:
[0037]
[0038] Wherein, represents the slot length allocated to ECU i, N represents the number of ECUs, represents the real-time load of ECU i, S represents the load of all ECUs, represents the priority of ECU i, F represents the dynamic adjustment factor, represents the available bandwidth ratio of ECU i relative to the master control unit, W represents the network bandwidth of ECU i, t represents the time constant, and m represents the storage capacity of ECU i;
[0039] Each ECU sends data within its allocated slot, monitors the sending result and calculates the success rate;
[0040] Based on the monitoring results, Li and Pi are adjusted respectively through the real-time load update model and the priority adjustment model, and then substituted back into the dynamic slot allocation model to calculate the slot. Specifically, the real-time load update model is as follows:
[0041]
[0042] Wherein, represents the adjusted load requirement of ECU i, represents the real-time transmission success rate, and β represents the load base value;
[0043] The priority adjustment model is as follows:
[0044]
[0045] Wherein, represents the adjusted priority of ECU i, represents the current priority of ECU i, represents the maximum load requirement among all ECUs, δ represents the adjustment factor, represents the preset minimum priority of ECU i.
[0046] A data detection system based on PSI5 proposed by the present invention, the system includes:
[0047] A receiving sensor data frame module, configured to receive data frames sent by sensors through the peripheral sensor interface PSI5 of each ECU, and the data frame format is defined by the PSI5 protocol;
[0048] It is sent to the main control unit module. For each ECU, the data input through cyclic redundancy check is input into the data frame anomaly prediction model to identify normal and abnormal data patterns, and the data frames identified as normal patterns are sent to the main control unit in the vehicle according to the time slots allocated by dynamic time slot allocation.
[0049] Furthermore, the receiving sensor data frame module includes:
[0050] A defined data frame module, which is used for each sensor to send its data frame within the pre-allocated time slot. This data frame is in the defined format according to the PSI5 protocol, and the defined format includes: frame start flag, sensor ID, data field, data length, cyclic redundancy check code, and frame end flag;
[0051] A receiving module, which is used for the ECU to receive the data frames sent by each sensor through the PSI5 interface within the pre-allocated time slot;
[0052] A parsing and verification module, which is used for the ECU to parse and verify the received data frame. The parsing and verification includes:
[0053] Parsing the received data to separate the data field, frame start flag, frame end flag, and cyclic redundancy check code;
[0054] Confirming whether the frame start flag and the frame end flag conform to the specifications. If the frame start flag and the frame end flag do not conform to the specifications, the frame is determined to be illegal data, and a retransmission mechanism is triggered;
[0055] Using the selected CRC polynomial and initial value to perform CRC calculation on the data field to obtain the calculated CRC value;
[0056] If the calculated CRC value is the same as the separated cyclic redundancy check code, the data cyclic redundancy check passes; if not, the data cyclic redundancy check fails, and a retransmission mechanism is triggered.
[0057] Furthermore, the sending to the main control unit module includes:
[0058] A training model module, which is used to train the data frame anomaly prediction model;
[0059] A judgment module, which is used to input the data frame that has passed the cyclic redundancy check into the data frame anomaly prediction model to determine whether the data frame is abnormal;
[0060] A dynamic time slot sending module, which is used to trigger a retransmission mechanism if it is abnormal, and if it is normal, the ECU sends the normal data frame to the main control unit in the vehicle according to the method of dynamic time slot allocation;
[0061] A hash verification module for the master control unit to perform hash verification on the received data. The hash verification includes:
[0062] When the ECU generates a data packet, calculate the hash value through a dynamic hash model and attach the calculated hash value to the data packet. Specifically, the dynamic hash model is:
[0063]
[0064] Where H represents the calculated hash value, T represents the timestamp when the data starts to be transmitted from the ECU to the master control unit, D represents the transmitted data value, U represents the status field of the sensor, I represents the sensor ID, FC represents the value of the frame counter, and P represents the preset prime number value;
[0065] The ECU sends the data packet with the attached hash value to the master control unit;
[0066] After receiving the data packet, the master control recalculates the hash value through the dynamic hash model and compares the calculated hash value with the received hash value;
[0067] If they are the same, the data is considered complete; if they do not match, a retransmission is requested;
[0068] If the hash verification passes, the master control unit in the vehicle makes a decision based on the data field of the data frame.
[0069] Furthermore, the training model module includes:
[0070] A data feature definition module for defining data features and collecting data frames from sensors and the ECU according to the defined data features. The data features include: the timestamp of the data frame, the time interval between adjacent data frames, the sensor ID, the data value of the data frame, the average value of the data values of the data frames with the same sensor ID, the variance of the data values of the data frames with the same sensor ID, the cyclic redundancy check code, the cyclic redundancy check status, the data frame sequence number, the number of data frame anomalies, the average value of the data frames with the same sensor ID in a specific past time window, the historical maximum value of the data frames with the same sensor ID, the historical minimum value of the data frames with the same sensor ID, the volatility of the data values of the data frames with the same sensor ID, the dynamic time slot, the signal-to-noise ratio of the data frame, and the packet loss rate of the data frame;
[0071] A data collection module for collecting data frames from sensors and the ECU according to the defined data features. The collected data frames include normal frames and abnormal frames;
[0072] A preprocessing module for preprocessing the collected data frames. The preprocessing includes deduplication and filling in missing values;
[0073] The data set division module is used to divide the pre - processed data frame into a training set and a test set. 80% of the pre - processed data frame is used as the training set, and 20% is used as the test set;
[0074] The training module is used to select the random forest as the classification model, train the random forest model on the training set, use k - fold cross - validation, and evaluate the performance using the confusion matrix after validation. The evaluated performance includes: accuracy, precision, recall, F1 - score, ROC curve, and AUC value;
[0075] The model acquisition module is used to obtain the trained data frame anomaly prediction model when the evaluated performance value is greater than or equal to the preset threshold.
[0076] Furthermore, the dynamic time - slot sending module includes:
[0077] The initial definition module is used to initialize and define the initial load, priority, and respective relative bandwidth ratios of each ECU;
[0078] The time - slot length calculation module is used to calculate the time - slot length allocated to ECU i at the beginning of each communication cycle according to the real - time load of ECU i after adjustment and the priority of ECU i through the dynamic time - slot allocation model. Specifically, the dynamic time - slot allocation model is:
[0079]
[0080] Where, represents the time - slot length allocated to ECU i, N represents the number of ECUs, represents the real - time load of ECU i, S represents the load of all ECUs, represents the priority of ECU i, F represents the dynamic adjustment factor, represents the available bandwidth ratio of ECU i relative to the master control unit, W represents the network bandwidth of ECU i, t represents the time constant, and m represents the storage capacity of ECU i;
[0081] The monitoring module is used for each ECU to send data within its allocated time - slot, monitor the sending result and calculate the success rate;
[0082] The adjustment and update module is used to adjust Li and Pi respectively through the real - time load update model and the priority adjustment model based on the monitoring results, and re - substitute them into the dynamic time - slot allocation model to calculate the time - slot. Specifically, the real - time load update model is:
[0083]
[0084] Where, represents the adjusted load requirement of ECU i, represents the real-time transmission success rate, and β represents the load base value;
[0085] The priority adjustment model is:
[0086]
[0087] Wherein, represents the adjusted priority of ECU i, represents the current priority of ECU i, represents the maximum load requirement among all ECUs, δ represents the adjustment factor, represents the preset minimum priority of ECU i.
[0088] Advantages of the present invention: Data integrity is guaranteed. By means of the cyclic redundancy check and hash check mechanisms, effective verification of the transmitted data is achieved, improving the integrity and reliability of the data, and effectively reducing the negative impacts caused by data transmission errors; Using the data frame anomaly prediction model, it can quickly identify and respond to the abnormal signals of sensors, early warning of possible fault situations, and enhancing the safety and stability of the autonomous driving system; Efficient data processing. Through dynamic time slot allocation, the ECU can optimize the data sending timing, reduce network congestion, and improve data transmission efficiency, thus better meeting the real-time requirements; Accurately parsing the data pattern ensures that the main control unit obtains accurate and timely data, enhancing the decision-making support ability of the entire system, and helping to achieve more precise control and scheduling; Allows subsequent continuous learning and optimization of the anomaly prediction model, which can adapt to the data feature changes of new sensor types or different working environments; Based on the PSI5 protocol, combined with the CRC check and the anomaly prediction model, the accuracy, efficiency, and safety of data collection and processing in the vehicle are effectively improved, promoting the further development of intelligent driving technology. BRIEF DESCRIPTION OF THE DRAWINGS
[0089] Figure 1 is a schematic diagram of a data detection method based on PSI5 according to the present invention. DETAILED DESCRIPTION OF THE INVENTION
[0090] In order to more clearly understand the above objects, features, and advantages of the present invention, the present invention will be described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that, without conflict, the embodiments of the present application and the features in the embodiments can be combined with each other.
[0091] In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present invention. The described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the scope of protection of the present invention.
[0092] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the technical field to which the present invention belongs. The terms used in the specification of the present invention herein are only for the purpose of describing specific embodiments and are not intended to limit the present invention.
[0093] In one embodiment of the present invention, data frames sent by sensors are received through the peripheral sensor interface PSI5 of each ECU, and the data frame format is defined by the PSI5 protocol;
[0094] Each ECU inputs the data that has passed the cyclic redundancy check into the data frame anomaly prediction model to identify normal and abnormal data patterns, and sends the data frames identified as normal patterns to the main control unit in the vehicle according to the time slots allocated dynamically.
[0095] The working principle and effects of the above technical solution are as follows: Efficient sensor data reception and processing are achieved through the PSI5 protocol to ensure data integrity and reliability; Data frame reception, each ECU (Electronic Control Unit) receives data frames sent from sensors through its peripheral sensor interfaces using the PSI5 protocol. These data frames follow the format defined by the PSI5 protocol to ensure data consistency and standardization; After receiving the data frame, each ECU will first perform a CRC check. This process is used to detect possible errors during transmission, such as data corruption or loss. CRC is a reliable data integrity verification mechanism that helps improve the accuracy of data processing; After the check passes, the data frame is input into the data frame anomaly prediction model. This model uses machine learning methods to identify normal data patterns and abnormal data patterns. Through learning historical data, the model can effectively distinguish normal sensor readings from potential fault signals; When the data frame is identified as a normal pattern, the ECU will send the data to the main control unit according to the dynamic time slot allocation strategy; The transmission time slot of the data is flexibly adjusted according to factors such as the current network load and data priority to ensure that the main control unit can receive the data under optimal conditions. Data integrity guarantee, with the help of cyclic redundancy check and hash check mechanisms, effective verification of the transmitted data is achieved, improving data integrity and reliability, and effectively reducing the negative impact caused by data transmission errors; Using the data frame anomaly prediction model, it can quickly identify and respond to abnormal signals of sensors, early warning of possible fault situations, and enhancing the safety and stability of the autonomous driving system; Efficient data processing, through dynamic time slot allocation, the ECU can optimize the data sending timing, reduce network congestion, and improve data transmission efficiency, thus better meeting real-time requirements; Accurately parsing data patterns to ensure that the main control unit obtains accurate and timely data, enhancing the decision-making support ability of the entire system, and helping to achieve more precise control and scheduling; Allowing continuous learning and optimization of the anomaly prediction model in the future, which can adapt to changes in data characteristics of new sensor types or different working environments; Based on the PSI5 protocol, combined with CRC check and anomaly prediction model, the accuracy, efficiency, and safety of data collection and processing in the vehicle are effectively improved, promoting the further development of intelligent driving technology.
[0096] In an embodiment of the present invention, each sensor sends its data frame within the pre-allocated time slot. This data frame follows the defined format of the PSI5 protocol, and the defined format includes: frame start flag, sensor ID, data field, data length, cyclic redundancy check code, and frame end flag;
[0097] The ECU receives data frames sent from each sensor within the pre-allocated time slot through the PSI5 interface;
[0098] The ECU parses and checks the received data frame, and the parsing and checking include:
[0099] Parse the received data, and separate the data field, frame start flag, frame end flag, and cyclic redundancy check code;
[0100] Verify whether the frame start flag and the frame end flag conform to the specifications. If the frame start flag and the frame end flag do not conform to the specifications, the frame is determined to be illegal data, and the retransmission mechanism is triggered;
[0101] Perform CRC calculation on the data field using the selected CRC polynomial and initial value to obtain the calculated CRC value;
[0102] If the calculated CRC value is the same as the separated cyclic redundancy check code, the data cyclic redundancy check passes; if not, the data cyclic redundancy check fails, and the retransmission mechanism is triggered.
[0103] The working principle and effects of the above technical solution are as follows: By using pre-allocated time slots, each sensor sends data frames through the PSI5 protocol and is received and verified by the ECU (Electronic Control Unit). Each sensor sends a data frame in its pre-allocated time slot according to the format defined by the PSI5 protocol. The data frame format includes: Frame start flag: Indicates the start of the data frame; Sensor ID: Used to uniquely identify the sensor sending the data; Data field: Contains the actual data collected by the sensor; Data length: Indicates the length of the data field to ensure that the receiving party can parse it correctly; Cyclic Redundancy Check Code (CRC): Used for data integrity verification; Frame end flag: Indicates the end of the data frame. The ECU receives the data frames sent from each sensor through the PSI5 interface in the pre-allocated time slots to ensure that the transmissions of each sensor do not conflict. The ECU parses and verifies the received data frames. The steps include: Data parsing: Separating the data field, frame start flag, frame end flag, and CRC value; Start and end flag verification: Confirming whether the frame start flag and frame end flag conform to the predefined specifications. If they do not conform to the specifications, the frame is determined to be illegal data and the retransmission mechanism is triggered; Using the selected CRC polynomial and initial value, performing CRC calculation on the data field to obtain the calculated CRC value. Comparing the calculated CRC value with the CRC value in the data frame. If they are the same, it is considered that the data has passed the cyclic redundancy check; if they are different, the retransmission mechanism is triggered. Through the CRC verification mechanism, it strongly guarantees the integrity of data during transmission, reducing the risk of system failures caused by data corruption or loss; Efficient error detection. By verifying the start and end flags, frames with format errors can be detected in a timely manner, avoiding interference from illegal data to the normal data processing flow; Once illegal data or CRC verification failure is detected, the system can quickly trigger the retransmission mechanism to ensure the timely and accurate arrival of data, improving the reliability of the system; Ensuring data timeliness. By pre-allocating time slots, the data transmissions of each sensor are ordered in time, reducing data competition and ensuring the effective transmission and processing of real-time data; Enhancing system stability. It enhances the ECU's ability to receive and process data from multiple sensors, thereby improving the stability and response speed of the entire system, providing effective support for real-time control and decision-making; Through the reasonable application of the PSI5 protocol, it not only improves the integrity and reliability of data transmission but also realizes an efficient error detection and processing mechanism, ensuring the effective utilization of sensor data in the automotive system and laying a solid foundation for the implementation of intelligent driving technology.
[0104] In one embodiment of the present invention, each ECU inputs the data frames that have passed the cyclic redundancy check into a data frame anomaly prediction model to identify normal and abnormal data patterns, and sends the data frames identified as normal patterns to the main control unit in the vehicle according to the time slots allocated by the dynamic time slot allocation, including:
[0105] Train a data frame anomaly prediction model;
[0106] Input the data frame that has passed the cyclic redundancy check into the data frame anomaly prediction model to determine whether the data frame is abnormal;
[0107] If it is abnormal, trigger the retransmission mechanism. If it is normal, the ECU will send the normal data frame to the main control unit in the vehicle according to the method of dynamic time slot allocation;
[0108] The main control unit performs a hash check on the received data. The hash check includes:
[0109] When the ECU generates a data packet, calculate the hash value through the dynamic hash model and append the calculated hash value to the data packet. Specifically, the dynamic hash model is:
[0110]
[0111] Among them, H represents the calculated hash value, T represents the timestamp when the data starts to be transmitted from the ECU to the main control unit, D represents the transmitted data value, U represents the status field of the sensor, I represents the sensor ID, FC represents the value of the frame counter, and P represents the preset prime number value;
[0112] The ECU sends the data packet with the appended hash value to the main control unit;
[0113] After the main control unit receives the data packet, recalculate the hash value through the dynamic hash model and compare the calculated hash value with the received hash value;
[0114] If they are the same, the data is considered complete; if they do not match, request retransmission;
[0115] If the hash check is passed, the main control unit in the vehicle makes a decision based on the data field of the data frame.
[0116] The working principle and effects of the above technical solution are as follows: When the electronic control unit (ECU) generates a data frame, it first performs anomaly prediction on the data frame to be sent. This process uses a trained data frame anomaly prediction model, which analyzes the input data frame (the frame after cyclic redundancy check) to determine whether it is abnormal; if the prediction model determines that the data frame is abnormal, the ECU will trigger the retransmission mechanism, that is, the ECU will regenerate and send the data frame to ensure that the receiving end (the main control unit) receives valid data; if the data frame is determined to be normal, the next step will be continued. In the normally sent data frame, a dynamic hash model is used to generate a hash value, and the calculated hash value is attached to the generated data packet, and then the ECU sends the data packet to the main control unit; after receiving the data packet, the main control unit calculates the hash value again using the same dynamic hash model. The recalculated hash value is compared with the hash value attached to the data packet; if the two hash values are the same, the data is considered complete, and the main control unit can make a decision based on the received data frame; if the hash values do not match, it means that the data may be damaged during transmission, and the main control unit will trigger the request retransmission mechanism. By introducing the dynamic hash verification mechanism, the technical solution significantly improves the integrity and security of the data frame during transmission, and can effectively prevent data damage or tampering;
[0117] With the help of the trained anomaly prediction model, the ECU can identify and process abnormal data in a timely manner, avoid unnecessary data transmission, and ensure that only valid data is sent; when the data frame is normal and passes the hash verification, the main control unit can quickly make a decision based on the data, optimizing the vehicle's response and control speed; enhancing system robustness, the introduction of the retransmission mechanism can effectively cope with unreliable situations in data transmission, enhancing the system's robustness and stability; the flexibility of the dynamic hash model enables the system to adapt to different types of sensors and data types, with good scalability; by combining anomaly prediction, dynamic hash verification and retransmission mechanism, the reliability, integrity and overall system performance of in-vehicle data transmission are effectively improved. The dynamic hash model combines two hash algorithms, SHA3- and BLAKE2b, to provide higher security; SHA3 is a hash algorithm with strong collision resistance and is suitable for encrypting data content. BLAKE2b is known for its high efficiency and faster calculation speed, and is particularly suitable for calculations in resource-constrained environments; combining the data value D and the status field F to ensure that the current state of the data is taken into account when calculating the hash, thereby improving the uniqueness and security of the data; the timestamp T provides the sending time of each frame of data, preventing replay attacks and increasing the variability of the hash value, so that the same data frame generates different hash values when sent at different times; the use of the frame counter FC and the maximum frame count MAX_FC, through the previous dynamic adjustment item based on frame count , enabling different frames to generate different hash values even under similar conditions, further enhancing security; the introduction of a dynamic adjustment factor increases the flexibility of the system under different load conditions.
[0118] Perform modulo operation using a preset large prime number P to ensure that the generated hash values are within a specific range, which has a direct impact on optimizing storage and computing efficiency, and also increases the unpredictability of the output. Enhance security. By combining multiple hash algorithms and dynamic parameters, this formula significantly improves the anti-tampering and integrity of data, effectively preventing malicious data modification; incorporating timestamps and frame counters can prevent replay attacks on data, ensuring that each data packet is unique; the formula design allows the system to adaptively adjust according to the actual network status and conditions, thereby enhancing the adaptability to various dynamic environments; by selecting appropriate hash algorithms and mathematical operations, it is ensured that the calculation process is still efficient under resource-constrained conditions, accelerating the data processing speed; once the hash value verification mechanism is implemented, it can check the integrity of data during transmission in real time and automatically, ensuring the system's quick response; not only considering security and integrity, but also fully considering the flexibility and efficiency of the system in actual applications, enabling the entire in-vehicle data transmission process to achieve a good balance among reliability, efficiency, and security. This design provides strong guarantee for data streams under numerous uncertain factors.
[0119] An embodiment of the present invention, training a data frame anomaly prediction model, includes:
[0120] Define data features, and collect data frames from sensors and ECUs according to the defined data features. The data features include: timestamp of the data frame, time interval between adjacent data frames, sensor ID, data value of the data frame, average value of data values of data frames with the same sensor ID, variance of data values of data frames with the same sensor ID, cyclic redundancy check code, cyclic redundancy check status, data frame sequence number, number of data frame anomalies, average value of data frames with the same sensor ID in a past specific time window, historical maximum value of data frames with the same sensor ID, historical minimum value of data frames with the same sensor ID, volatility of data values of data frames with the same sensor ID, dynamic time slot, signal-to-noise ratio of the data frame, and packet loss rate of the data frame;
[0121] Collect data frames from sensors and ECUs according to the defined data features. The collected data frames include normal frames and abnormal frames;
[0122] Preprocess the collected data frames. The preprocessing includes removing duplicates and filling in missing values;
[0123] Divide the preprocessed data frames into a training set and a test set. 80% of the preprocessed data frames are used as the training set, and 20% are used as the test set;
[0124] Select the random forest as the classification model, train the random forest model on the training set, use k-fold cross-validation, and evaluate the performance using the confusion matrix after validation. The evaluated performance includes: accuracy, precision, recall, F1-score, ROC curve, and AUC value;
[0125] When the evaluated performance value is greater than or equal to the preset threshold, a trained data frame anomaly prediction model is obtained.
[0126] The working principle and effects of the above technical solution are as follows: First, define data features to ensure that the data frames collected from sensors and electronic control units (ECUs) contain information useful for anomaly detection. These features include: timestamps of data frames, time intervals between adjacent data frames, sensor IDs (SensorID), data values of data frames, mean values (MeanValue) of data values of data frames with the same sensor ID, variances (Variance) of data values of data frames with the same sensor ID, cyclic redundancy check codes (CRC), cyclic redundancy check status (CRC Status), data frame sequence numbers (Frame Sequence Number), counts of abnormal frames (Count of Abnormal Frames), historical means (Historical Mean) of data frames with the same sensor ID in a specific past time window, historical maxima (Historical Max) of data frames with the same sensor ID, historical minima (Historical Min) of data frames with the same sensor ID, volatilities (Volatility) of data values of data frames, dynamic time slots (Dynamic Time Slots), signal-to-noise ratios (Signal-to-Noise Ratio, SNR) of data frames, and packet loss rates (Packet Loss Rate) of data frames. According to the defined data features, collect data of normal frames and abnormal frames from sensors and ECUs. Ensure that various situations are covered so that the model can learn comprehensively; preprocess the collected data frames to ensure data quality. The preprocessing operations include: deduplication: remove duplicate frames to avoid data redundancy; filling missing values: use appropriate methods (such as mean filling, interpolation, or other algorithms) to fill in missing data features to ensure that the model can use complete data; divide the preprocessed data frames into a training set and a test set. The common practice is to use 80% of the data as the training set and 20% of the data as the test set for subsequent model training and performance evaluation; select random forest as the classification model. This is an ensemble learning method that improves prediction accuracy by constructing multiple decision trees and combining their results; train the random forest model on the training set using the k-fold cross-validation method to effectively evaluate the generalization ability and robustness of the model; after training, evaluate the model performance using a confusion matrix. The evaluation metrics include: accuracy, precision, recall, F1-score, ROC curve (Receiver Operating Characteristic Curve), and AUC value (Area Under the Curve)
[0127] , if the evaluated performance indicators meet the preset threshold conditions, it is considered that the trained data frame anomaly prediction model is effective and can be used for practical applications. High accuracy and reliability, by using the random forest model and the combination of multiple features, can effectively improve the accuracy and reliability of the anomaly prediction model and further improve the integrity of the data; strong generalization ability, using k-fold cross-validation can effectively offset the overfitting phenomenon and improve the model's performance on unknown data;
[0128] Through multi-dimensional data features, the model can comprehensively consider various influencing factors, so as to accurately distinguish the normality and abnormality of data frames in various situations; by timely discovering and processing abnormal data frames, it helps to improve the stability and performance of the entire vehicle control system, making the decision-making more accurate; the model is trained and can implement real-time monitoring and instant analysis of data, so as to provide a more reliable basis for vehicle control decisions; by defining key data features and then designing an effective model training and evaluation process, it helps to achieve efficient and accurate data frame anomaly detection, and effectively improves the intelligent level of the in-vehicle system.
[0129] In one embodiment of the present invention, the ECU sends normal data frames to the main control unit in the vehicle according to the method of dynamic time slot allocation, including:
[0130] Initialize and define the initial load, priority, and respective relative bandwidth ratios of each ECU;
[0131] At the beginning of each communication cycle, calculate the time slot length allocated to ECU i through the dynamic time slot allocation model according to the real-time load of ECU i and the priority of ECU i after adjustment. Specifically, the dynamic time slot allocation model is:
[0132]
[0133] Wherein, represents the time slot length allocated to ECU i, N represents the number of ECUs, represents the real-time load of ECU i, S represents the load of all ECUs, represents the priority of ECU i, F represents the dynamic adjustment factor, represents the available bandwidth ratio of ECU i relative to the main control unit, W represents the network bandwidth of ECU i, t represents the time constant, and m represents the storage capacity of ECU i;
[0134] Each ECU sends data within its allocated time slot, monitors the sending result and calculates the success rate;
[0135] Based on the monitoring results, adjust Li and Pi respectively through the real-time load update model and the priority adjustment model, and then substitute them back into the dynamic time slot allocation model to calculate the time slots. Specifically, the real-time load update model is as follows:
[0136]
[0137] Among them, represents the adjusted load requirement of ECU i, represents the real-time transmission success rate, and β represents the load base value;
[0138] The priority adjustment model is as follows:
[0139]
[0140] Among them, represents the adjusted priority of ECU i, represents the current priority of ECU i, represents the maximum load requirement among all ECUs, and δ represents the adjustment factor, represents the preset minimum priority of ECU i.
[0141] The priority value range is from 1 to N, where 1 is the highest priority and N is the lowest priority. The real-time load of an ECU is the memory occupancy of the data of the sensors managed by this ECU, and the load of all ECUs is the sum of the memory occupancies of the data of the sensors managed by all ECUs. The dynamic adjustment factor is calculated based on the historical packet loss rate. Collect historical packet loss data, calculate the packet loss rate, maintain a sliding window, and calculate the average packet loss rate in the past N time periods. The value of the average packet loss rate is the value of the dynamic adjustment factor. The adjustment factor δ is used to ensure that the priority of critical ECUs does not decrease.
[0142] The working principle and effect of the above technical solution are as follows: Each electronic control unit (ECU) is assigned an initial load, priority, and its respective relative bandwidth ratio when the system starts. These initial parameters lay the foundation for subsequent dynamic allocation. At the beginning of each communication cycle, according to the current real-time load and priority, the dynamic time slot allocation model is used to calculate the time slot length allocated to each ECU. Each ECU sends data within its allocated time slot and monitors the sending result to calculate the sending success rate. Adjust the real-time load and priority according to the result. The monitored success rate will affect the adjustment of the load and priority. Use the real-time load update model to recalculate the time slots: Substitute the adjusted load and priority back into the dynamic time slot allocation model to recalculate the allocated time slot length, forming a continuously dynamically adjusted feedback loop, through This item ensures that different ECUs obtain corresponding time slot lengths under relative loads. The ECU with a high load gets more transmission time to help it send critical information in a timely manner. By introducing the power of σ with priority as a weighting factor, the influence degree of priority on the time slot length can be adjusted, so that appropriate communication time can be given when high-priority tasks are needed. It has strong adaptability and can adjust the communication time slots of each ECU in a timely manner according to real-time conditions (such as load and success rate) to adapt to an unstable or changing network environment. The addition of a dynamic adjustment factor allows the system to automatically adjust when the network state changes, improving the adaptability to real-time conditions, which is particularly important for network congestion or signal attenuation. By considering the bandwidth αi and storage capacity m, the reflection of the resource limitations of each ECU is enhanced, meeting the requirements of different ECUs in terms of bandwidth and storage capacity, and improving the overall efficiency and resilience of the system. By combining the success rate, if Ri is low, indicating that the load has dropped to an unacceptable level, it is lowered to ensure the stable operation of the system. The dynamic adjustment of the load, and the real-time load update model can adapt to network conditions and operating conditions, prevent overload, and maintain the flexibility and stability of the system. The priority adjustment model compares the current load with the maximum load of all ECUs, so that when the load of an ECU increases, its priority may be correspondingly reduced to ensure that the priority does not get out of balance under high-load conditions. The priority adjustment mechanism can effectively balance resource allocation, ensure that high-priority tasks can still be processed in real time when the system is busy, and improve the reliability of critical tasks. Improve communication efficiency. By dynamically allocating time slots according to priority, the data of critical tasks can be preferentially transmitted at critical moments, thus improving the overall communication efficiency of the system. Using real-time load and priority adjustment, better load balancing can be achieved among different ECUs, reducing the pressure on a single ECU and enhancing the stability of the system. The real-time feedback mechanism enables ECUs to continuously adapt to network conditions, optimize the response time of data transmission, and thus improve the real-time performance of the entire system. Combining real-time load, priority, bandwidth, and time factors, it can manage the communication between ECUs more efficiently, flexibly, and intelligently, adapt to the changing working environment, and ensure the stability and reliability of data transmission.
[0143] An embodiment of the present invention, a data detection system based on PSI5, the system includes:
[0144] A module for receiving sensor data frames, configured to receive data frames sent by sensors through the peripheral sensor interface PSI5 of each ECU, and the data frame format is defined by the PSI5 protocol;
[0145] Sent to the main control unit module, for each ECU to input the data with cyclic redundancy check into the data frame anomaly prediction model, identify normal and abnormal data patterns, and send the data frames identified as normal mode to the main control unit in the vehicle according to the time slots allocated by dynamic time slot allocation.
[0146] The working principle and effects of the above technical solution are as follows: Efficient sensor data reception and processing are achieved through the PSI5 protocol to ensure data integrity and reliability; Data frame reception, each ECU (Electronic Control Unit) receives data frames sent from sensors through its peripheral sensor interfaces using the PSI5 protocol. These data frames follow the format defined by the PSI5 protocol to ensure data consistency and standardization; After receiving the data frame, each ECU will first perform CRC check. This process is used to detect possible errors during transmission, such as data corruption or loss. CRC is a reliable data integrity verification mechanism that helps improve the accuracy of data processing; After the check passes, the data frame will be input into the data frame anomaly prediction model. This model uses machine learning methods to identify normal data patterns and abnormal data patterns. Through learning historical data, the model can effectively distinguish normal sensor readings from potential fault signals; When the data frame is identified as the normal mode, the ECU will send the data to the main control unit according to the dynamic time slot allocation strategy; Flexibly adjust the data sending time slots according to factors such as the current network load and data priority to ensure that the main control unit can receive data under optimal conditions. Data integrity guarantee, with the help of cyclic redundancy check and hash check mechanisms, effectively verify the transmitted data, improve data integrity and reliability, and effectively reduce the negative impacts caused by data transmission errors; Using the data frame anomaly prediction model, it can quickly identify and respond to abnormal signals of sensors, early warning of possible fault situations, and improve the safety and stability of the autonomous driving system; Efficient data processing, through dynamic time slot allocation, the ECU can optimize the data sending timing, reduce network congestion, and improve data transmission efficiency, so as to better meet the real-time requirements; Accurately parse data patterns to ensure that the main control unit obtains accurate and timely data, improve the decision-making support ability of the entire system, and help achieve more precise control and scheduling; Allow subsequent continuous learning and optimization of the anomaly prediction model to adapt to changes in data characteristics of new sensor types or different working environments; Based on the PSI5 protocol, combined with CRC check and anomaly prediction model, effectively improve the accuracy, efficiency and safety of data collection and processing in the vehicle, and promote the further development of intelligent driving technology.
[0147] In an embodiment of the present invention, the receiving sensor data frame module includes:
[0148] Define a data frame module for each sensor to send its data frame within the pre-allocated time slot. This data frame follows the defined format of the PSI5 protocol, and the defined format includes: frame start flag, sensor ID, data field, data length, cyclic redundancy check code, and frame end flag;
[0149] A receiving module for the ECU to receive the data frames sent from each sensor through the PSI5 interface within the pre-allocated time slot;
[0150] A parsing and verification module for the ECU to parse and verify the received data frames. The parsing and verification include:
[0151] Parse the received data, separating the data field, frame start flag, frame end flag, and cyclic redundancy check code;
[0152] Confirm whether the frame start flag and the frame end flag conform to the specifications. If the frame start flag and the frame end flag do not conform to the specifications, the frame is determined to be illegal data, triggering the retransmission mechanism;
[0153] Perform CRC calculation on the data field using the selected CRC polynomial and initial value to obtain the calculated CRC value;
[0154] If the calculated CRC value is the same as the separated cyclic redundancy check code, the data cyclic redundancy check passes; if not, the data cyclic redundancy check fails, triggering the retransmission mechanism.
[0155] The working principle and effects of the above technical solution are as follows: By using pre-allocated time slots, each sensor sends data frames through the PSI5 protocol and is received and verified by the ECU (Electronic Control Unit). Each sensor sends a data frame in its pre-allocated time slot according to the format defined by the PSI5 protocol. The data frame format includes: Frame start flag: Indicates the start of the data frame, Sensor ID: Used to uniquely identify the sensor sending the data, Data field: Contains the actual data collected by the sensor, Data length: Indicates the length of the data field to ensure that the receiving party parses it correctly, Cyclic Redundancy Check Code (CRC): Used for data integrity verification, Frame end flag: Indicates the end of the data frame; The ECU receives the data frames sent from each sensor through the PSI5 interface within the pre-allocated time slots to ensure that the transmissions of each sensor do not conflict; The ECU parses and verifies the received data frames. The steps include: Data parsing: Separating the data field, frame start flag, frame end flag, and CRC value, Start and end flag verification: Confirming whether the frame start flag and frame end flag conform to the predefined specifications. If they do not conform to the specifications, the frame is determined to be illegal data and the retransmission mechanism is triggered; Using the selected CRC polynomial and initial value, performing CRC calculation on the data field to obtain the calculated CRC value. Comparing the calculated CRC value with the CRC value in the data frame. If they are the same, it is considered that the data has passed the cyclic redundancy check; If they are different, the retransmission mechanism is triggered. Through the CRC verification mechanism, it strongly guarantees the integrity of the data during transmission and reduces the risk of system failures caused by data corruption or loss; Efficient error detection, through the verification of the start and end flags, can timely detect frames with format errors and avoid interference from illegal data to the normal data processing flow; Once illegal data or CRC verification failure is detected, the system can quickly trigger the retransmission mechanism to ensure the timely and accurate arrival of the data and improve the reliability of the system; Ensure data timeliness. By pre-allocating time slots, the data transmissions of each sensor are ordered in time, reducing data competition and ensuring the effective transmission and processing of real-time data; Enhance system stability, enhance the ECU's ability to receive and process data from multiple sensors, thereby enhancing the stability and response speed of the entire system and providing effective support for real-time control and decision-making; Through the reasonable application of the PSI5 protocol, not only the integrity and reliability of data transmission are improved, but also an efficient error detection and processing mechanism is realized, ensuring the effective utilization of sensor data in the automotive system and laying a solid foundation for the implementation of intelligent driving technology.
[0156] In an embodiment of the present invention, the sending to the main control unit module includes:
[0157] A training model module for training a data frame anomaly prediction model;
[0158] A judgment module, configured to input a data frame that has passed cyclic redundancy check into the data frame anomaly prediction model to determine whether the data frame is abnormal;
[0159] A dynamic time slot sending module, configured to trigger a retransmission mechanism if it is abnormal, and if it is normal, the ECU sends the normal data frame to the main control unit in the vehicle according to the method of dynamic time slot allocation;
[0160] A hash check module, configured to perform hash check on the data received by the main control unit, and the hash check includes:
[0161] When the ECU generates a data packet, calculate the hash value through the dynamic hash model, and append the calculated hash value to the data packet. Specifically, the dynamic hash model is:
[0162]
[0163] Where, H represents the calculated hash value, T represents the timestamp when the data starts to be transmitted from the ECU to the main control unit, D represents the transmitted data value, U represents the status field of the sensor, I represents the sensor ID, FC represents the value of the frame counter, and P represents the preset prime number value;
[0164] The ECU sends the data packet appended with the hash value to the main control unit;
[0165] After receiving the data packet, the main control unit recalculates the hash value through the dynamic hash model, and compares the calculated hash value with the received hash value;
[0166] If they are the same, the data is considered to be complete; if they do not match, a retransmission is requested;
[0167] If the hash check is passed, the main control unit in the vehicle makes a decision based on the data field of the data frame.
[0168] The working principle and effects of the above technical solution are as follows: When the electronic control unit (ECU) generates a data frame, it first performs anomaly prediction on the data frame to be sent. This process uses a trained data frame anomaly prediction model, which analyzes the input data frame (the frame after cyclic redundancy check) to determine whether it is abnormal; if the prediction model determines that the data frame is abnormal, the ECU will trigger the retransmission mechanism, that is, the ECU will regenerate and send the data frame to ensure that the receiving end (the master control unit) receives valid data; if the data frame is determined to be normal, the next step will be continued. In the normally sent data frame, a dynamic hash model is used to generate a hash value, and the calculated hash value is attached to the generated data packet, and then the ECU sends the data packet to the master control unit; after receiving the data packet, the master control unit calculates the hash value again using the same dynamic hash model. The recalculated hash value is compared with the hash value attached to the data packet; if the two hash values are the same, the data is considered complete, and the master control unit can make a decision based on the received data frame; if the hash values do not match, it means that the data may be damaged during transmission, and the master control unit will trigger the request retransmission mechanism. By introducing the dynamic hash verification mechanism, the technical solution significantly improves the integrity and security of the data frame during transmission, and can effectively prevent data damage or tampering;
[0169] With the help of the trained anomaly prediction model, the ECU can timely identify and process abnormal data, avoid unnecessary data transmission, and ensure that only valid data is sent; when the data frame is normal and passes the hash verification, the master control unit can quickly make a decision based on the data, optimizing the vehicle's response and control speed; enhancing system robustness, the introduction of the retransmission mechanism can effectively handle unreliable situations in data transmission, enhancing the system's robustness and stability; the flexibility of the dynamic hash model enables the system to adapt to different types of sensors and data types, with good scalability; by combining anomaly prediction, dynamic hash verification and retransmission mechanism, the reliability, integrity and overall system performance of in-vehicle data transmission are effectively improved. The dynamic hash model combines two hash algorithms, SHA3- and BLAKE2b, to provide higher security; SHA3 is a hash algorithm with strong collision resistance and is suitable for encrypting data content. BLAKE2b is known for its high efficiency and faster calculation speed, and is especially suitable for calculation in resource-constrained environments; combining the data value D and the status field F to ensure that the current state of the data is considered when calculating the hash, thereby improving the uniqueness and security of the data; the timestamp T provides the sending time of each frame of data, preventing replay attacks and increasing the variability of the hash value, so that the same data frame generates different hash values when sent at different times; the use of the frame counter FC and the maximum frame count MAX_FC, through the previous dynamic adjustment item based on frame count , enabling different frames to generate different hash values even under similar conditions, further enhancing security; the introduction of a dynamic adjustment factor increases the flexibility of the system under different load conditions.
[0170] Perform modulo operation using a preset large prime number P to ensure that the generated hash values are within a specific range, which has a direct impact on optimizing storage and computing efficiency and also increases the unpredictability of the output. Enhance security. By combining multiple hash algorithms and dynamic parameters, this formula significantly improves the anti-tampering and integrity of data, effectively preventing malicious data modification; incorporating timestamps and frame counters can prevent replay attacks on data, ensuring that each data packet is unique; the formula design allows the system to adaptively adjust according to the actual network status and conditions, thus enhancing the adaptability to various dynamic environments; by selecting appropriate hash algorithms and mathematical operations, it is ensured that the calculation process remains efficient under resource-constrained conditions, accelerating the data processing speed; once the hash value verification mechanism is implemented, it can check the integrity of data during transmission in real time and automatically, ensuring the system's rapid response; not only considering security and integrity, but also fully considering the flexibility and efficiency of the system in actual applications, enabling the entire in-vehicle data transmission process to achieve a good balance among reliability, efficiency, and security. This design provides strong guarantees for data streams under numerous uncertain factors.
[0171] An embodiment of the present invention, the training model module includes:
[0172] Define data feature module, used to define data features, collect data frames from sensors and ECUs according to the defined data features, and the data features include: timestamp of the data frame, time interval between adjacent data frames, sensor ID, data value of the data frame, average value of the data values of data frames with the same sensor ID, variance of the data values of data frames with the same sensor ID, cyclic redundancy check code, cyclic redundancy check status, data frame sequence number, number of data frame anomalies, average value of data frames with the same sensor ID in a specific past time window, historical maximum value of data frames with the same sensor ID, historical minimum value of data frames with the same sensor ID, volatility of the data values of data frames with the same sensor ID, dynamic time slot, signal-to-noise ratio of the data frame, and packet loss rate of the data frame;
[0173] Collect data module, used to collect data frames from sensors and ECUs according to the defined data features, and the collected data frames include normal frames and abnormal frames;
[0174] Preprocessing module, used to preprocess the collected data frames, and the preprocessing includes deduplication and filling missing values;
[0175] A data set division module, which is used to divide the pre - processed data frame into a training set and a test set. 80% of the pre - processed data frame is used as the training set, and 20% is used as the test set;
[0176] A training module, which is used to select random forest as the classification model, train the random forest model on the training set, use k - fold cross - validation, and evaluate the performance using a confusion matrix after validation. The evaluated performance includes: accuracy, precision, recall, F1 - score, ROC curve, and AUC value;
[0177] A model acquisition module, which is used to obtain a trained data frame anomaly prediction model when the evaluated performance value is greater than or equal to a preset threshold.
[0178] The working principle and effect of the above technical solution are as follows: When an electronic control unit (ECU) generates a data frame, it will first perform anomaly prediction on the data frame to be sent. This process uses a trained data frame anomaly prediction model, which analyzes the input data frame (the frame after cyclic redundancy check) to determine whether it is abnormal; if the prediction model determines that the data frame is abnormal, the ECU will trigger a re - transmission mechanism, that is, the ECU will regenerate and send the data frame to ensure that the receiving end (the master unit) receives valid data; if the data frame is determined to be normal, the next step will be continued. Among the normally sent data frames, a dynamic hash model is used to generate a hash value, and the calculated hash value is attached to the generated data packet, and then the ECU sends the data packet to the master unit; after receiving the data packet, the master unit calculates the hash value again using the same dynamic hash model. The re - calculated hash value is compared with the hash value attached to the data packet; if the two hash values are the same, the data is considered complete, and the master unit can make a decision based on the received data frame; if the hash values do not match, it indicates that the data may be damaged during transmission, and the master unit will trigger a request re - transmission mechanism. By introducing the dynamic hash verification mechanism, the technical solution significantly improves the integrity and security of the data frame during transmission, and can effectively prevent data damage or tampering;
[0179] With the trained anomaly prediction model, the ECU can identify and process abnormal data in a timely manner, avoid unnecessary data transmission, and ensure that only valid data is sent; when the data frame is normal and passes the hash check, the main control unit can quickly make decisions based on the data, optimizing the vehicle's response and control speed; by introducing a retransmission mechanism, the system robustness is enhanced, effectively coping with unreliable situations in data transmission and enhancing the system's robustness and stability; the flexibility of the dynamic hash model enables the system to adapt to different types of sensors and data types, featuring good scalability; by combining anomaly prediction, dynamic hash check, and retransmission mechanism, the reliability, integrity, and overall system performance of in-vehicle data transmission are effectively improved. The dynamic hash model combines two hash algorithms, SHA3- and BLAKE2b, providing higher security; SHA3 is a hash algorithm with strong collision resistance, suitable for encrypting data content. BLAKE2b is known for its high efficiency and faster calculation speed, especially suitable for calculations in resource-constrained environments; by combining the data value D and the status field F, it is ensured that the current state of the data is taken into account when calculating the hash, thus improving the uniqueness and security of the data; the timestamp T provides the sending time of each data frame, preventing replay attacks and increasing the variability of the hash value, so that the same data frame generates different hash values when sent at different times; the use of the frame counter FC and the maximum frame count MAX_FC, through the previous dynamic adjustment term based on frame count sin(2πFC / (MAK FC)), enables different frames to generate different hash values even under similar conditions, further enhancing security; the introduction of the dynamic adjustment factor increases the flexibility of the system under different load conditions.
[0180] Perform modulo operation using a preset large prime number P to ensure that the generated hash value is within a specific range, which has a direct impact on optimizing storage and computing efficiency, and also increases the unpredictability of the output. To enhance security, by combining multiple hash algorithms and dynamic parameters, this formula significantly improves the anti-tampering and integrity of data, effectively preventing malicious data modification; incorporating timestamps and frame counters can prevent replay attacks on data, ensuring that each data packet is unique; the formula design allows the system to adaptively adjust according to the actual network status and conditions, thereby enhancing the adaptability to various dynamic environments; by selecting appropriate hash algorithms and mathematical operations, it is ensured that the calculation process remains efficient under resource-constrained conditions, accelerating the data processing speed; once the hash value verification mechanism is implemented, it can real-time and automatically check the integrity of data during transmission, ensuring the system's quick response; not only considering security and integrity, but also fully considering the flexibility and efficiency of the system in actual applications, enabling the entire in-vehicle data transmission process to achieve a good balance among reliability, efficiency, and security. This design provides strong guarantees for data streams under numerous uncertain factors.
[0181] In one embodiment of the present invention, the dynamic time slot sending module includes:
[0182] An initial definition module for initializing and defining the initial load, priority, and respective relative bandwidth ratios of each ECU;
[0183] A time slot length calculation module for calculating the time slot length allocated to ECU i at the beginning of each communication cycle according to the real-time load of ECU i after adjustment and the priority of ECU i through a dynamic time slot allocation model. Specifically, the dynamic time slot allocation model is:
[0184]
[0185] Wherein, represents the time slot length allocated to ECU i, N represents the number of ECUs, represents the real-time load of ECU i, S represents the load of all ECUs, represents the priority of ECU i, F represents the dynamic adjustment factor, represents the available bandwidth ratio of ECU i relative to the master control unit, W represents the network bandwidth of ECU i, t represents the time constant, and m represents the storage capacity of ECU i;
[0186] A monitoring module for each ECU to send data within its allocated time slot, monitor the sending result and calculate the success rate;
[0187] An adjustment and update module is used to adjust Li and Pi respectively through a real-time load update model and a priority adjustment model based on the monitoring results, and then substitute them back into the dynamic time slot allocation model to calculate time slots. Specifically, the real-time load update model is:
[0188]
[0189] Where, represents the adjusted load requirement of ECU i, represents the real-time transmission success rate, and β represents the load base value;
[0190] The priority adjustment model is:
[0191]
[0192] Where, represents the adjusted priority of ECU i, represents the current priority of ECU i, represents the maximum load requirement among all ECUs, δ represents the adjustment factor, represents the preset minimum priority of ECU i.
[0193] The working principle and effect of the above technical solution are as follows: Each electronic control unit (ECU) is assigned an initial load, priority, and its respective relative bandwidth ratio when the system starts. These initial parameters lay the foundation for subsequent dynamic allocation. At the beginning of each communication cycle, according to the current real-time load and priority, the dynamic time slot allocation model is used to calculate the time slot length allocated to each ECU. Each ECU sends data within its allocated time slot and monitors the sending result to calculate the sending success rate. Adjust the real-time load and priority according to the result. The monitored success rate will affect the adjustment of the load and priority. Use the real-time load update model to recalculate the time slots: Substitute the adjusted load and priority back into the dynamic time slot allocation model to recalculate the allocated time slot length, forming a continuously dynamically adjusted feedback loop, through This item ensures that different ECUs obtain corresponding time slot lengths under relative loads. The ECU with a high load gets more transmission time to help it send critical information in a timely manner. By introducing the power of σ with priority as a weighting factor, the influence degree of priority on the time slot length can be adjusted, so that appropriate communication time can be given when high-priority tasks are needed. It has strong adaptability and can adjust the communication time slots of each ECU in a timely manner according to real-time conditions (such as load, success rate) to adapt to an unstable or changing network environment. The addition of a dynamic adjustment factor allows the system to automatically adjust when the network state changes, enhancing its adaptability to real-time conditions, which is particularly important for network congestion or signal attenuation. By considering the bandwidth αi and storage capacity m, the reflection of resource limitations of each ECU is enhanced, meeting the requirements of different ECUs in terms of bandwidth and storage capacity, and improving the overall efficiency and resilience of the system. By combining the success rate, if Ri is low, it means the load has dropped to an unacceptable level, then it is adjusted downwards to ensure the stable operation of the system. The dynamic adjustment of the load, and the real-time load update model can adapt to network conditions and operating conditions, prevent overload, and maintain the flexibility and stability of the system. The priority adjustment model compares the current load with the maximum load of all ECUs, so that when the load of a certain ECU increases, its priority may be correspondingly reduced to ensure that the priority does not get out of balance under high-load conditions. The priority adjustment mechanism can effectively balance resource allocation, ensure that high-priority tasks can still be processed in real time when the system is busy, and improve the reliability of critical tasks. It improves communication efficiency. By dynamically allocating time slots according to priority, the data of critical tasks can be preferentially transmitted at critical moments, thus improving the overall communication efficiency of the system. By using real-time load and priority adjustment, better load balancing can be achieved among different ECUs, reducing the pressure on a single ECU and enhancing the stability of the system. The real-time feedback mechanism enables ECUs to continuously adapt to network conditions, optimize the response time of data transmission, and thus improve the real-time performance of the entire system. By combining real-time load, priority, bandwidth, and time factors, it can manage the communication between ECUs more efficiently, flexibly, and intelligently, adapt to the changing working environment, and ensure the stability and reliability of data transmission.
[0194] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalent technologies, the present invention is also intended to include these changes and modifications.
Claims
1. A data detection method based on PSI5, characterized in that: The method comprises: Receive a data frame sent by a sensor through a peripheral sensor interface PSI5 of each ECU, wherein the data frame format is defined by a PSI5 protocol; Each ECU inputs the data that has passed the cyclic redundancy check into the data frame anomaly prediction model, identifies normal and abnormal data patterns, and sends the data frames identified as normal patterns to the main control unit in the car according to the time slots allocated by the dynamic time slots, including: Training data frame anomaly prediction model; Inputting the data frame that passes the cyclic redundancy check into the data frame anomaly prediction model to determine whether the data frame is abnormal; If abnormal, the retransmission mechanism is triggered. If normal, the ECU sends the normal data frame to the main control unit in the car according to the dynamic time slot allocation method, including: Initialization defines the initial load, priority, and relative bandwidth ratio of each ECU; At the beginning of each communication cycle, the time slot length allocated to ECU i is calculated by a dynamic time slot allocation model according to the adjusted real-time load of ECU i and the priority of ECU i. Specifically, the dynamic time slot allocation model is: in, represents the time slot length assigned to ECU i, N represents the number of ECUs, represents the real-time load of ECU i, S represents the load of all ECUs, represents the priority of ECU i, F represents the dynamic adjustment factor, represents the ratio of available bandwidth of ECU i to the main control unit, W represents the network bandwidth of ECU i, t represents the time constant, and m represents the storage capacity of ECU i; Each ECU sends data in its assigned time slot, monitors the sending results and calculates the success rate; Based on the monitoring results, Li and Pi are adjusted respectively through the real-time load update model and the priority adjustment model, and then re-substituted into the dynamic time slot allocation model to calculate the time slot. Specifically, the real-time load update model is: in, represents the load requirement after ECU i is adjusted, represents the real-time transmission success rate, and β represents the load base value; The priority adjustment model is: in, Indicates the priority of ECU i after adjustment, represents the current priority of ECU i, represents the maximum load requirement among all ECUs, δ represents the adjustment factor, Indicates the lowest priority of the preset ECU i; The main control unit performs a hash check on the received data, and the hash check includes: When the ECU generates a data packet, the hash value is calculated through the dynamic hash model and the calculated hash value is attached to the data packet. Specifically, the dynamic hash model is: Wherein, H represents the calculated hash value, T represents the timestamp when the data starts to be transmitted from the ECU to the main control unit, D represents the transmitted data value, U represents the status field of the sensor, I represents the sensor ID, FC represents the value of the frame counter, and P represents the preset prime number value; The ECU sends the data packet with the hash value attached to it to the main control unit; After receiving the data packet, the master controller recalculates the hash value through the dynamic hash model and compares the calculated hash value with the received hash value; If they are the same, the data is considered complete; if they do not match, a retransmission is requested; If the hash check passes, the main control unit in the car makes a decision based on the data field of the data frame.
2. A data detection method based on PSI5 according to claim 1, characterized in that: The data frame sent by the sensor is received through the peripheral sensor interface PSI5 of each ECU. The data frame format is defined by the PSI5 protocol and includes: Each sensor sends its data frame in the pre-assigned time slot. The data frame follows the format defined by the PSI5 protocol. The format includes: frame start flag, sensor ID, data field, data length, cyclic redundancy check code and frame end flag. The ECU receives data frames sent from various sensors in pre-assigned time slots through the PSI5 interface; The ECU performs parsing and verification on the received data frame, and the parsing and verification includes: Parse the received data and separate the data field, frame start flag, frame end flag and cyclic redundancy check code; Confirm whether the frame start flag and the frame end flag meet the specifications. If the frame start flag and the frame end flag do not meet the specifications, the frame is determined to be illegal data, triggering a retransmission mechanism; Perform CRC calculation on the data field using the selected CRC polynomial and the initial value to obtain a calculated CRC value; If the calculated CRC value is the same as the separated cyclic redundancy check code, the data cyclic redundancy check passes; if they are different, the data cyclic redundancy check fails, triggering a retransmission mechanism.
3. The data detection method based on PSI5 according to claim 1, characterized in that: Training data frame anomaly prediction model, including: Define data features, and collect data frames from sensors and ECUs according to the defined data features, wherein the data features include: a timestamp of a data frame, a time interval between adjacent data frames, a sensor ID, a data value of a data frame, an average value of data values of data frames with the same sensor ID, a variance of data values of data frames with the same sensor ID, a cyclic redundancy check code, a cyclic redundancy check state, a data frame sequence number, a number of abnormal data frame times, an average value of data frames with the same sensor ID in a specific time window in the past, a historical maximum value of data frames with the same sensor ID, a historical minimum value of data frames with the same sensor ID, volatility of data values of data frames with the same sensor ID, a dynamic time slot, a signal-to-noise ratio of a data frame, and a packet loss rate of a data frame; Collect data frames from sensors and ECUs according to defined data features, and the collected data frames include normal frames and abnormal frames; Preprocessing the collected data frames, including removing duplicates and filling missing values; The preprocessed data frames are divided into training sets and test sets, with 80% of the preprocessed data frames used as training sets and 20% as test sets; Select random forest as the classification model, train the random forest model on the training set, use k-fold cross validation, and use the confusion matrix to evaluate the performance after validation. The performance evaluated includes: accuracy, precision, recall, F1-score, ROC curve and AUC value; When the evaluated performance value is greater than or equal to the preset threshold, a trained data frame anomaly prediction model is obtained.
4. A data detection system based on PSI5, characterized in that: The system comprises: A sensor data frame receiving module is used to receive data frames sent by sensors through the peripheral sensor interface PSI5 of each ECU, wherein the data frame format is defined by the PSI5 protocol; Sent to the main control unit module, for each ECU to input the data that passes the cyclic redundancy check into the data frame abnormality prediction model, identify normal and abnormal data patterns, and send the data frames identified as normal patterns to the main control unit in the car according to the time slots allocated by the dynamic time slots, including: The training model module is used to train the data frame anomaly prediction model; A judgment module, used for inputting the data frame that passes the cyclic redundancy check into the data frame abnormality prediction model to judge whether the data frame is abnormal; The dynamic time slot sending module is used to trigger the retransmission mechanism if it is abnormal. If it is normal, the ECU sends the normal data frame to the main control unit in the car according to the dynamic time slot allocation method, including: The initial definition module is used to initialize and define the initial load, priority, and relative bandwidth ratio of each ECU; The time slot length calculation module is used to calculate the time slot length allocated to ECU i at the beginning of each communication cycle according to the adjusted real-time load of ECU i and the priority of ECU i through the dynamic time slot allocation model. Specifically, the dynamic time slot allocation model is: in, represents the time slot length assigned to ECU i, N represents the number of ECUs, represents the real-time load of ECU i, S represents the load of all ECUs, represents the priority of ECU i, F represents the dynamic adjustment factor, represents the ratio of available bandwidth of ECU i to the main control unit, W represents the network bandwidth of ECU i, t represents the time constant, and m represents the storage capacity of ECU i; The monitoring module is used for each ECU to send data in its allocated time slot, monitor the sending results and calculate the success rate; The adjustment and update module is used to adjust Li and Pi respectively based on the monitoring results through the real-time load update model and the priority adjustment model, and re-substitute them into the dynamic time slot allocation model to calculate the time slot. Specifically, the real-time load update model is: in, represents the load requirement after ECU i is adjusted, represents the real-time transmission success rate, and β represents the load base value; The priority adjustment model is: in, Indicates the priority of ECU i after adjustment, represents the current priority of ECU i, represents the maximum load requirement among all ECUs, δ represents the adjustment factor, Indicates the lowest priority of the preset ECU i; A hash check module is used for the main control unit to perform a hash check on the received data, and the hash check includes: When the ECU generates a data packet, the hash value is calculated through the dynamic hash model and the calculated hash value is attached to the data packet. Specifically, the dynamic hash model is: Wherein, H represents the calculated hash value, T represents the timestamp when the data starts to be transmitted from the ECU to the main control unit, D represents the transmitted data value, U represents the status field of the sensor, I represents the sensor ID, FC represents the value of the frame counter, and P represents the preset prime number value; The ECU sends the data packet with the hash value attached to it to the main control unit; After receiving the data packet, the master controller recalculates the hash value through the dynamic hash model and compares the calculated hash value with the received hash value; If they are the same, the data is considered complete; if they do not match, a retransmission is requested; If the hash check passes, the main control unit in the car makes a decision based on the data field of the data frame.
5. A data detection system based on PSI5 according to claim 4, characterized in that: The module for receiving sensor data frames comprises: A data frame definition module is used for each sensor to send its data frame in a pre-allocated time slot. The data frame follows the definition format of the PSI5 protocol. The definition format includes: a frame start flag, a sensor ID, a data field, a data length, a cyclic redundancy check code, and a frame end flag. The receiving module is used for the ECU to receive data frames sent from various sensors in pre-assigned time slots through the PSI5 interface; The parsing and verification module is used by the ECU to perform parsing and verification on the received data frame, and the parsing and verification includes: Parse the received data and separate the data field, frame start flag, frame end flag and cyclic redundancy check code; Confirm whether the frame start flag and the frame end flag meet the specifications. If the frame start flag and the frame end flag do not meet the specifications, the frame is determined to be illegal data, triggering a retransmission mechanism; Perform CRC calculation on the data field using the selected CRC polynomial and the initial value to obtain a calculated CRC value; If the calculated CRC value is the same as the separated cyclic redundancy check code, the data cyclic redundancy check passes; if they are different, the data cyclic redundancy check fails, triggering a retransmission mechanism.
6. A data detection system based on PSI5 according to claim 4, characterized in that: The training model module includes: A data feature definition module is used to define data features, and collect data frames from sensors and ECUs according to the defined data features, wherein the data features include: a timestamp of a data frame, a time interval between adjacent data frames, a sensor ID, a data value of a data frame, an average value of data values of data frames with the same sensor ID, a variance of data values of data frames with the same sensor ID, a cyclic redundancy check code, a cyclic redundancy check state, a data frame sequence number, a number of abnormal data frame times, an average value of data frames with the same sensor ID in a specific time window in the past, a historical maximum value of data frames with the same sensor ID, a historical minimum value of data frames with the same sensor ID, volatility of data values of data frames with the same sensor ID, a dynamic time slot, a signal-to-noise ratio of a data frame, and a packet loss rate of a data frame; The data collection module is used to collect data frames from sensors and ECUs according to defined data features. The collected data frames include normal frames and abnormal frames. A preprocessing module, used to preprocess the collected data frames, wherein the preprocessing includes deduplication and filling of missing values; The data set partitioning module is used to divide the preprocessed data frame into a training set and a test set, with 80% of the preprocessed data frame used as a training set and 20% as a test set; The training module is used to select random forest as the classification model, train the random forest model on the training set, use k-fold cross validation, and use the confusion matrix to evaluate the performance after validation. The evaluated performance includes: accuracy, precision, recall, F1-score, ROC curve and AUC value; The model acquisition module is used to obtain the trained data frame anomaly prediction model when the evaluated performance value is greater than or equal to a preset threshold.
Citation Information
Patent Citations
Message encryption method and device, message decryption method and device and storage medium
CN115277219A
Model construction method, test platform, computer equipment and storage medium
CN117278423A
Data transmission method, chip and storage medium
CN117997973A