Detection method for CAN bus of new energy automobile

By building a detection system, collecting and analyzing signals from the CAN bus of new energy vehicles, and combining with fault diagnosis algorithms, the problem of low detection efficiency in the existing technology is solved, and the rapid and accurate detection of CAN bus failures is achieved, which is suitable for large-scale production needs.

CN119728404APending Publication Date: 2025-03-28SHANGHAI LUBAN BUS SUIT INFORMATION TECHNOLOGY CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202411652761.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-19
Publication Date
2025-03-28

AI Technical Summary

Technical Problem

The prior art is difficult to detect the faults of the CAN bus of new energy vehicles quickly and accurately, resulting in low detection efficiency and difficult to meet the needs of large-scale production.

Method used

By building a detection system, including the connection of hardware equipment and the use of software algorithms, the signals of the CAN bus are collected, signal analysis and feature parameter extraction are performed, and combined with fault diagnosis algorithms, the rapid and accurate detection of CAN bus failures is achieved.

Benefits of technology

It realizes fast and accurate detection of CAN bus faults in new energy vehicles, improves the accuracy of detection and the accuracy of fault positioning, is simple to operate, and is suitable for large-scale production needs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119728404A_ABST
    Figure CN119728404A_ABST
Patent Text Reader

Abstract

The invention discloses a detection method for a new energy automobile CAN bus, and the method comprises the steps: 1, building a detection system which comprises the connection of hardware equipment, a signal collection module, a signal processing module and a display module, 2, collecting the message of the new energy automobile CAN bus, firstly starting the detection system, collecting the signal of the new energy automobile CAN bus, and transmitting the message of the new energy automobile CAN bus. Step 3, displaying and processing a detection result, transmitting fault information to a display module according to a message, and if the CAN bus has a fault, determining whether the CAN bus has the fault through specific hardware equipment and a software algorithm. The fault of the CAN bus of the new energy automobile can be rapidly and accurately detected, and the reliability and the safety of the new energy automobile are improved. Through experimental verification, the method has the advantages of high detection accuracy, accurate fault positioning, simple operation and the like, and has a wide application prospect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of CAN bus detection, and in particular to a detection method for a CAN bus of a new energy vehicle. Background Art

[0002] With the rapid development of new energy vehicles, CAN bus is a key communication technology for new energy vehicles, and its reliability and stability are crucial to the performance and safety of new energy vehicles. However, due to the complexity of new energy vehicles and the particularity of CAN bus, the traditional detection method is usually to observe the signal waveform of CAN bus through oscilloscope to determine whether there is a fault in the bus. This method requires professional technicians to operate, and the detection efficiency is low, which is difficult to meet the needs of large-scale production. Use a multimeter to measure the resistance, voltage and other parameters of the CAN bus to determine whether the bus is normal. This method can only detect some simple faults, and it is difficult to accurately judge complex faults. Therefore, the above methods are difficult to meet the detection needs of CAN bus of new energy vehicles. In order to solve the above shortcomings, it is of great practical significance to develop a CAN bus detection method for new energy vehicles. Summary of the invention

[0003] The purpose of the present invention is to solve at least one of the technical problems existing in the prior art, and to provide a detection method for the CAN bus of new energy vehicles. Through specific hardware equipment and software algorithms, the fault of the CAN bus of new energy vehicles can be detected quickly and accurately, thereby improving the reliability and safety of new energy vehicles. Through experimental verification, the method has the advantages of high detection accuracy, accurate fault location, simple operation, etc., and has broad application prospects.

[0004] The present invention also provides a detection method for a CAN bus of a new energy vehicle, comprising: step 1, building a detection system, which is divided into the connection of hardware devices, connecting a signal acquisition module, a signal processing module and a display module, and hardware devices to the CAN bus, ensuring that the communication between the devices is normal, installing the detection software into the signal processing module, and setting the sampling rate and signal type; Step 2: Collect the CAN bus message of the new energy vehicle. First, start the detection system, collect the signal of the CAN bus of the new energy vehicle, and transmit the collected signal to the signal processing module. Then, the signal processing module analyzes the collected signal, extracts the characteristic parameters of the signal, and transmits the analysis result to the display module. Finally, according to the characteristic parameters of the signal, the fault diagnosis algorithm performs fault diagnosis on the CAN bus to determine whether there is a fault on the bus; Step 3: Display and process the test results. According to the message, the fault information is transmitted to the display module. If there is a fault in the CAN bus, the fault location algorithm determines the location of the fault based on the propagation time of the fault signal, and displays the test results in an intuitive manner through the display module, including the fault type, severity and location information. According to the test results, take appropriate maintenance measures to repair the line.

[0005] According to a detection method for a CAN bus of a new energy vehicle provided by the present invention, the signal acquisition module uses Python to set a CAN bus interface; bus=can.interface.Bus(channel='vcan0',bustype='socketcan'), defprocess_can_message(message), import the CAN library, then create a Bus object, specify the channel of the CAN bus, here assume the use of the virtual CAN bus vcan0, in actual use you need to adjust according to your hardware settings, the bus type is socketcan, define a can_data_reader function, in this function use an infinite loop to continuously receive messages on the CAN bus, when the message is received, print out the arbitration ID and data content of the message.

[0006] According to a detection method for a CAN bus of a new energy vehicle provided by the present invention, the signal processing module defines a process_can_message function to process a specific CAN message based on the signal acquisition result. It is assumed that a message with a processing ID of 0x123 is processed and the vehicle speed information is extracted from the message data. The can_data_reader function receives the message on the CAN bus in an infinite loop and calls the process_can_message function for processing.

[0007] According to a detection method for a CAN bus of a new energy vehicle provided by the present invention, the display and processing of the detection results, the failure to receive messages with a specific important message ID for multiple consecutive times during the detection and the message data exceeding the normal range, and the need to combine the specific knowledge of new energy vehicles and the CAN bus protocol to determine the fault information.

[0008] According to a detection method for the CAN bus of a new energy vehicle provided by the present invention, the display and processing execution flow of the detection result first creates an infinite loop to ensure that the program continues to run to continuously receive messages from the CAN bus, and uses the bus object connected to the CAN bus to call the recv method to receive a CAN message. This method will block the execution of the program until a message arrives or an error occurs, and check whether the received message is non-empty. If no message is received, message will be None. This step is to prevent invalid processing when there is no message. If a valid message is received, it will be passed to the process_can_message function for specific processing, and the corresponding parsing and operation will be performed according to the arbitration ID and data content of the message.

[0009] According to a detection method for a CAN bus of a new energy vehicle provided by the present invention, the information entropy of a data set, conditional entropy, information gain, split information and information gain rate are calculated for the information gain rate of the vehicle CAN bus.

[0010] Compared with the prior art, the detection method for the CAN bus of a new energy vehicle of the present invention can quickly and accurately detect the fault of the CAN bus of the new energy vehicle through specific hardware equipment and software algorithms, thereby improving the reliability and safety of the new energy vehicle.

[0011] Compared with the prior art, the detection method for the CAN bus of new energy vehicles of the present invention has been verified through experiments. The method has the advantages of high detection accuracy, accurate fault location, simple operation, etc., and has broad application prospects. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] The present invention is further described below in conjunction with the accompanying drawings and embodiments; Figure 1 The present invention is a schematic diagram of the steps of a detection method for a CAN bus of a new energy vehicle. DETAILED DESCRIPTION

[0013] This section will describe in detail the specific embodiments of the present invention. The preferred embodiments of the present invention are shown in the accompanying drawings. The purpose of the accompanying drawings is to supplement the description of the text part of the specification with graphics, so that people can intuitively and vividly understand each technical feature and the overall technical solution of the present invention, but it cannot be understood as a limitation on the scope of protection of the present invention.

[0014] Reference Figure 1, an embodiment of the present invention is a detection method for a CAN bus of a new energy vehicle, which includes the steps of: 1. building a detection system, which is divided into the connection of hardware devices, connecting a signal acquisition module, a signal processing module and a display module, and hardware devices to the CAN bus, ensuring that the communication between the devices is normal, installing the detection software into the signal processing module, and setting the sampling rate and signal type; Step 2: Collect the CAN bus message of the new energy vehicle. First, start the detection system, collect the signal of the CAN bus of the new energy vehicle, and transmit the collected signal to the signal processing module. Then, the signal processing module analyzes the collected signal, extracts the characteristic parameters of the signal, and transmits the analysis result to the display module. Finally, according to the characteristic parameters of the signal, the fault diagnosis algorithm performs fault diagnosis on the CAN bus to determine whether there is a fault on the bus; Step 3: Display and process the test results. According to the message, the fault information is transmitted to the display module. If there is a fault in the CAN bus, the fault location algorithm determines the location of the fault based on the propagation time of the fault signal, and displays the test results in an intuitive manner through the display module, including the fault type, severity and location information. According to the test results, take appropriate maintenance measures to repair the line.

[0015] Signal acquisition module, using Python to set up the CAN bus interface; bus=can.interface.Bus(channel='vcan0',bustype='socketcan'), defprocess_can_message(message), import the CAN library, then create a Bus object, specify the channel of the CAN bus, here assume the use of the virtual CAN bus vcan0, in actual use you need to adjust according to your hardware settings, the bus type is socketcan, define a can_data_reader function, in this function use an infinite loop to continuously receive messages on the CAN bus, when the message is received, print out the arbitration ID and data content of the message.

[0016] The signal processing module defines the process_can_message function to process specific CAN messages based on the signal acquisition results. It is assumed that the message with the processing ID 0x123 is processed and the vehicle speed information is extracted from the message data. The can_data_reader function receives the message on the CAN bus in an infinite loop and calls the process_can_message function for processing.

[0017] Process the message with ID 0x123, if message.arbitration_id == 0x123:data =message.data The first two bytes of the data represent the vehicle speed in km / h, speed = (data[0]<<8 | data[1]) / 10.0 print(f"Current speed: {speed} km / h") else:print(f"Received other messages, ID: {message.arbitration_id}, data: {message.data}") def can_data_reader(): while True:message = bus.recv() if message is not None:process_can_message(message) if __name__ == "__main__":can_data_reader() Display and processing of test results: failure to receive messages with specific important message IDs for multiple consecutive times during the test and message data exceeding the normal range. At the same time, it is necessary to combine new energy vehicle specific knowledge and CAN bus protocol to determine fault information; def diagnose_can_bus(message): Example 1: If a message with a specific important message ID is not received for multiple consecutive times, a fault exists important_message_id = 0x456 consecutive_missing_threshold = 5 global missing_important_message_count if message.arbitration_id == important_message_id: missing_important_message_count = 0 else: if important_message_id not in [m.arbitration_id for m in bus.recv(0.1)]: missing_important_message_count +=1 If-missing_important_message_count>=consecutive_missing_threshold: Return-f"Failure: An important message with ID {important_message_id} was not received {consecutive_missing_threshold} times in a row." Example 2: Message data exceeds the normal range and there is a fault if message.arbitration_id == 0x789: The first byte of the data in this message represents a sensor value, and the normal range is 0-255 data = message.data sensor_value = data[0] if sensor_value<0 or sensor_value>255: return f"There was a fault: the sensor value in the message with ID {message.arbitration_id} was out of range." Call this diagnostic function in the can_data_reader function and return None def can_data_reader(): while True: message = bus.recv() if message is not None: diagnosis_result = diagnose_can_bus(message) if diagnosis_result: print(diagnosis_result) process_can_message(message) The display of the test results and the execution flow of the processing, first create an infinite loop to ensure that the program continues to run to continuously receive messages from the CAN bus, and use the bus object connected to the CAN bus to call the recv method to receive a CAN message. This method will block the execution of the program until a message arrives or an error occurs, and check whether the received message is non-empty. If no message is received, message will be None. This step is to prevent invalid processing when there is no message. If a valid message is received, it will be passed to the process_can_message function for specific processing, and the corresponding parsing and operation will be performed according to the arbitration ID and data content of the message.

[0018] Calculate the information entropy of the data set based on the information gain rate of the vehicle CAN bus: def entropy(data): total_count = len(data) classes = set([d[-1] for d in data]) ent = 0 for c in classes: class_count = sum([1 for d in data if d[-1] == c]) if class_count>0: prob = class_count / total_count ent += -prob * math.log2(prob) return ent Calculate conditional entropy: def conditional_entropy(data, feature): values ​​= set([d[feature] for d in data]) ce = 0 for v in values: subset = [d for d in data if d[feature] == v] prob = len(subset) / len(data) ce += prob * entropy(subset) return ce Calculate information gain: def information_gain(data, feature): return entropy(data) - conditional_entropy(data, feature) Calculate split information: def split_information(data, feature): values ​​= set([d[feature] for d in data]) si = 0 total_count = len(data) for v in values: subset_count = sum([1 for d in data if d[feature] == v]) prob = subset_count / total_count if prob>0: si += -prob * math.log2(prob) return si Calculate the information gain ratio: def gain_ratio(data, feature): ig = information_gain(data, feature) si = split_information(data, feature) if si == 0: return 0 return ig / si. The embodiments of the present invention are described in detail above with reference to the accompanying drawings. However, the present invention is not limited to the above embodiments. Various changes can be made within the knowledge scope of ordinary technicians in the technical field without departing from the purpose of the present invention.

Claims

1. A detection method for a CAN bus of a new energy vehicle, characterized in that: include: Step 1: Build the detection system, which is divided into the connection of hardware devices, connect the signal acquisition module, signal processing module and display module, and the hardware devices to the CAN bus, ensure that the communication between the devices is normal, install the detection software into the signal processing module, and set the sampling rate and signal type; Step 2: Collect the CAN bus message of the new energy vehicle. First, start the detection system, collect the signal of the CAN bus of the new energy vehicle, and transmit the collected signal to the signal processing module. Then, the signal processing module analyzes the collected signal, extracts the characteristic parameters of the signal, and transmits the analysis result to the display module. Finally, according to the characteristic parameters of the signal, the fault diagnosis algorithm performs fault diagnosis on the CAN bus to determine whether there is a fault on the bus; Step 3: Display and process the test results. According to the message, the fault information is transmitted to the display module. If there is a fault in the CAN bus, the fault location algorithm determines the location of the fault based on the propagation time of the fault signal, and displays the test results in an intuitive manner through the display module, including the fault type, severity and location information. According to the test results, take appropriate maintenance measures to repair the line.

2. A detection method for a CAN bus of a new energy vehicle according to claim 1, characterized in that: The signal acquisition module uses Python to set the CAN bus interface; bus=can.interface.Bus(channel='vcan0',bustype='socketcan'), def process_can_message(message), import the CAN library, then create a Bus object, specify the channel of the CAN bus, here assume the use of the virtual CAN bus vcan0, in actual use you need to adjust according to your hardware settings, the bus type is socketcan, define a can_data_reader function, in this function use an infinite loop to continuously receive messages on the CAN bus, when the message is received, print out the arbitration ID and data content of the message.

3. A detection method for a CAN bus of a new energy vehicle according to claim 1, characterized in that: The signal processing module defines the process_can_message function to process specific CAN messages based on the signal acquisition results. It is assumed that the message with the processing ID 0x123 is extracted from the message data. The can_data_reader function receives the message on the CAN bus in an infinite loop and calls the process_can_message function for processing.

4. A detection method for a CAN bus of a new energy vehicle according to claim 1, characterized in that: The display and processing of the test results, the failure to receive messages with specific important message IDs for multiple consecutive times during the test and the message data exceeding the normal range, and the need to combine the specific knowledge of new energy vehicles and the CAN bus protocol to determine the fault information.

5. A detection method for a CAN bus of a new energy vehicle according to claim 1, characterized in that: The display and processing execution flow of the test results described above first creates an infinite loop to ensure that the program continues to run to continuously receive messages from the CAN bus, and uses the bus object connected to the CAN bus to call the recv method to receive a CAN message. This method will block program execution until a message arrives or an error occurs, and check whether the received message is non-empty. If no message is received, message will be None. This step is to prevent invalid processing when there is no message. If a valid message is received, it will be passed to the process_can_message function for specific processing, and the corresponding parsing and operation will be performed according to the arbitration ID and data content of the message.

6. A detection method for a CAN bus of a new energy vehicle according to claim 1, characterized in that: Calculate the information entropy of the data set, calculate the conditional entropy, calculate the information gain, calculate the split information, and calculate the information gain rate for the vehicle CAN bus.

Citation Information

Patent Citations

  • Vehicle fault detection system and method based on vehicle-mounted CAN network

    CN105549580A

  • Remote fault diagnosis method and system for new energy vehicle

    CN110109447A

  • Vehicle-mounted CAN bus network abnormity detection method and system

    CN110275508A

  • A software code automatic generation method and system for CAN fault diagnosis

    CN113342319A

  • Vehicle CAN bus fault rapid troubleshooting system and method

    CN116184983A