New energy automobile OBD protocol conversion method and system

Through the OBD protocol conversion method and system of new energy vehicles, the CAN data of various new energy vehicles is converted into standard OBD protocol data, which solves the problems of poor compatibility and high cost of data reading in new energy vehicles, and realizes efficient and low-cost data reading.

CN119922244AInactive Publication Date: 2025-05-02HONGKE TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202510340605.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-21
Publication Date
2025-05-02
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Due to the diversity of protocols, new energy vehicles use OBD interface to read vehicle speed, motor speed and other data, and face the problems of poor compatibility and high cost.

Method used

Provide a new energy vehicle OBD protocol conversion method and system, through protocol analysis module, data conversion module, communication interface module and storage module, it realizes the conversion of various new energy vehicle CAN data into standard OBD protocol data.

Benefits of technology

It solves the problems of poor compatibility and high cost in data reading of new energy vehicles, and realizes that existing equipment based on standard OBD protocols can successfully read the vehicle speed and motor speed of new energy vehicles, significantly improving detection efficiency and reducing costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119922244A_ABST
    Figure CN119922244A_ABST
Patent Text Reader

Abstract

The invention discloses a new energy automobile OBD protocol conversion method and system, and the method comprises the steps: collecting CAN data through a protocol analysis module, recognizing a protocol type through a protocol recognition algorithm, and carrying out the decoding, and obtaining the original data of an automobile; a conversion program in the data conversion module performs conversion processing on the vehicle original data according to the standard OBD protocol stored in the storage module, and the conversion processing specifically comprises data format conversion, data length adjustment and data meaning mapping; meanwhile, performing real-time verification on the converted data by using a multi-verification algorithm to obtain converted data; the converted data is transmitted to the communication interface module, and the communication interface module selects a corresponding communication interface according to the type of the accessed OBD software and hardware equipment of the new energy automobile and adapts and sends the converted data according to a communication protocol and an electrical standard of the corresponding communication interface.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of electronic communication of new energy vehicles, and in particular relates to a method and system for converting an OBD protocol of a new energy vehicle. Background Art

[0002] Under the background of global advocacy of green travel and sustainable development, new energy vehicles have rapidly increased their market share due to their advantages of environmental protection and high efficiency. New energy vehicles mainly include pure electric vehicles and plug-in hybrid vehicles. Their power systems are essentially different from traditional fuel vehicles. In terms of vehicle data communication management, various automobile manufacturers (OEMs) have adopted their own independently designed communication protocols in order to meet their own technical needs, ensure data security and product differentiation.

[0003] The OBD (On-Board Diagnostics) protocol of traditional fuel vehicles is a standard and open specification. With the help of the OBD interface, key information such as vehicle speed and engine speed can be easily obtained, which greatly facilitates vehicle inspection, maintenance and performance analysis. However, due to the diversity of protocols, new energy vehicles face many difficulties in using the OBD interface to read data such as vehicle speed and motor speed (corresponding to the engine speed of fuel vehicles, which is a key parameter for measuring the operating status of the vehicle's power system).

[0004] Most of the OBD devices currently on the market are designed and manufactured around the OBD protocol for fuel vehicles. When it comes to new energy vehicles, compatibility issues are prominent. Even if some devices claim to support data reading for new energy vehicles, in actual applications they can only be adapted to specific brands or individual models, making it difficult to achieve widespread use. This situation has brought many inconveniences to auto repair companies, car enthusiasts, and related research and development institutions. Taking auto repair companies as an example, in daily maintenance operations, for new energy vehicles of different brands, a variety of special testing equipment must be equipped, which not only greatly increases the equipment procurement cost and maintenance cost, but also takes up a lot of space, and the operation process is cumbersome, seriously affecting the maintenance efficiency; for car enthusiasts and R&D personnel, it is difficult to obtain data from multi-brand new energy vehicles, which limits their in-depth research on vehicle performance and personalized modification exploration.

[0005] The fundamental reason for this dilemma is that the new energy vehicle industry has not yet established a unified and complete data reading protocol standard. The protocol design of each car company is significantly different, the protocol structure is complex and diverse, and the data format, communication method and verification mechanism are different. In the process of trying to solve this problem, there are many technical difficulties, such as the difficulty of parsing different new energy vehicle protocols, and the need to deeply understand the unique protocol logic of each car company; in the process of protocol conversion, it is necessary to ensure the accuracy and real-time nature of the data, avoid data loss, errors or delays, and meet the actual application needs. Summary of the invention

[0006] In view of the problems existing in the prior art, the present invention provides a new energy vehicle OBD protocol conversion method and system, which can convert CAN data of various brands of new energy vehicles into standard OBD protocol data, so that the existing software and hardware equipment based on the standard OBD protocol can smoothly read the vehicle speed and motor speed of the new energy vehicle, effectively solving the problems of poor compatibility and high cost in the current new energy vehicle data reading.

[0007] The technical solution of the present invention is achieved in this way:

[0008] A new energy vehicle OBD protocol conversion method comprises the following steps:

[0009] S1. Connect the protocol conversion system to the OBD interface of the new energy vehicle, where the protocol conversion system includes a protocol parsing module, a data conversion module, a communication interface module and a storage module;

[0010] The protocol analysis module starts to collect data, continuously monitors the CAN data sent by the vehicle through the CAN bus, and uses the protocol recognition algorithm to screen the collected CAN data to identify whether the protocol type followed by the CAN data exists in the protocol feature library in the storage module;

[0011] If the protocol feature library identifies the protocol type followed by the CAN data, the CAN data is decoded and the original vehicle data is obtained through the data screening mechanism;

[0012] If the protocol feature library does not identify the protocol type followed by the CAN data, a new decoding method is defined, and the CAN data is decoded to obtain the original vehicle data;

[0013] S2. After the data conversion module receives the original vehicle data, the conversion program inside the data conversion module converts the original vehicle data according to the standard OBD protocol stored in the storage module, specifically including: data format conversion, data length adjustment, and data meaning mapping;

[0014] During the conversion process, multiple verification algorithms are used to perform real-time verification on the data being converted to obtain the converted data;

[0015] S3. The converted data is transmitted to the communication interface module. The communication interface module selects the corresponding communication interface according to the OBD hardware and software device type of the connected new energy vehicle, and adapts and sends the converted data according to the communication protocol and electrical standard of the corresponding communication interface.

[0016] Furthermore, in S1, the protocol identification algorithm specifically includes preprocessing the CAN data, screening the messages carrying diagnostic information, specifically including the message ID, as well as the message type, data length and data content, and using the message ID and its corresponding data length and data content as the characteristic values ​​of the message corresponding to the message ID; the message type includes data frames and remote frames; comparing the characteristic value with the protocol in the protocol feature library in the storage module to identify the protocol type followed by the CAN data.

[0017] Furthermore, if the protocol feature library identifies the protocol type followed by the CAN data, the decoding method of the corresponding protocol type in the storage module is retrieved to decode the CAN data;

[0018] A hash table is established to establish the correspondence between the encoding of CAN data and vehicle data by looking up the table; when CAN data is received, the corresponding decoding rule in the hash table is searched according to the message ID to convert the encoding of CAN data into vehicle data;

[0019] The original vehicle data is obtained through a data screening mechanism, specifically including: setting screening conditions for vehicle data, screening according to the range of message IDs or characteristic values ​​of data frames, and obtaining the original vehicle data.

[0020] Furthermore, if the protocol feature library does not identify the protocol type followed by the CAN data, a new decoding method is defined, including:

[0021] Using the message ID as the hash key, the CAN data corresponding to the message ID, the data length of the message, the mapping relationship between the data content and the message ID are used as the new feature value of the new decoding method, and the new feature value and the mapping relationship are stored in the protocol feature library. The protocol type followed by the CAN data is identified again, and the CAN data is decoded.

[0022] Furthermore, in S2, data format conversion includes mapping the encoding format of vehicle original data to the standard OBD protocol format; data length adjustment includes adjusting the vehicle original data to a length that complies with the length specified by the standard OBD protocol; data meaning mapping includes establishing a mapping database of parameter meanings, and mapping the parameters in the vehicle data with the parameter meanings in the standard OBD protocol.

[0023] Further, in S2, the multiple check algorithms include a cyclic redundancy check algorithm, a cumulative sum check algorithm, an odd check algorithm and an even check algorithm;

[0024] The cyclic redundancy check algorithm specifically includes: setting and initializing the register, the register is used to calculate the check value; for the data to be checked, starting from the first byte, the byte is XORed with the register; then the register is shifted left by one bit, if the highest bit shifted out is 1, the register is XORed with the polynomial; if the highest bit shifted out is 0, no XOR operation is performed; repeat the left shift and XOR process to complete the processing of one byte; then process the next byte, and complete the processing of all bytes to obtain the check code; when sending data, the check code is attached to the end of the data frame, and when the receiving end receives the data, the check code is calculated again and obtained, and compared with the check code when the data is sent. If the check codes are equal, there is no error in the data transmission, and if the check codes are not equal, there is an error in the data transmission;

[0025] The accumulation and verification algorithm includes: setting an accumulator and initializing it with an initial value of 0; starting from the first byte of the data frame, adding the value of each byte to the accumulator in turn. If the value of the accumulator exceeds the maximum value it can represent, a modulo operation is performed, and then the value of the accumulator is inverted to obtain a verification byte; when sending data, the verification byte is appended to the end of the data frame. When the receiving end receives the data, the verification byte is calculated again and obtained, and compared with the verification byte when the data is sent. If the verification bytes are the same, no error occurs in the data transmission. If the verification bytes are different, an error occurs in the data transmission.

[0026] The odd parity check algorithm includes: for the data byte to be checked, the number of binary bits that are 1 is counted, if the number of 1s is an odd number, the check bit is set to 0, if the number of 1s is an even number, the check bit is set to 1; after adding the check bit, the number of 1s in the entire data byte is always an odd number; when the receiving end receives the data, the number of 1s in the data byte including the check bit is counted again, if the number of 1s is an odd number, no error occurs in the data transmission, if the number of 1s is an even number, an error occurs in the data transmission;

[0027] The even check algorithm includes: for the data byte to be checked, the number of binary bits that are 1 is counted; if the number of 1s is an even number, the check bit is set to 0; if the number of 1s is an odd number, the check bit is set to 1; after adding the check bit, the number of 1s in the entire data byte is always an even number; when the receiving end receives the data, the number of 1s in the data byte including the check bit is counted again; if the number of 1s is an even number, no error occurs in data transmission; if the number of 1s is an odd number, an error occurs in data transmission.

[0028] Further, if the external device sends a control instruction to the protocol conversion system, the communication interface module collects the control instruction and transmits it to the protocol parsing module or the data conversion module according to the type of the control instruction;

[0029] After receiving the control instruction, the protocol analysis module provides the corresponding protocol information; after receiving the control instruction, the data conversion module provides the corresponding converted data or the status information of the data conversion.

[0030] Furthermore, the storage module includes a flash memory storage method and a cache storage method; the protocol conversion system first reads data from the cache, and if the required data is not in the cache, it reads data from the flash memory and stores the data in the cache.

[0031] Furthermore, when an external device is connected to the protocol conversion system, the communication interface module identifies the interface type by detecting the characteristic signal of the interface, calls the corresponding interface driver and protocol conversion module according to the identified interface type, selects the corresponding interface for data transmission, and converts the data format in the storage module into a format recognizable by the external device.

[0032] Furthermore, a new energy vehicle OBD protocol conversion system includes a protocol parsing module, a data conversion module, a communication interface module and a storage module, and is applied in a new energy vehicle OBD protocol conversion method as described in any one of the above.

[0033] Compared with the prior art, the present invention achieves the following beneficial effects:

[0034] The present invention provides a new energy vehicle OBD protocol conversion method and system. Compared with the traditional detection method, which requires frequent replacement of special equipment for different brands of new energy vehicles, the operation is complicated and time-consuming. The system of the present invention realizes universal detection, greatly simplifies the detection process, shortens the detection time, and significantly improves the detection efficiency, saving a lot of manpower and time costs for automobile maintenance companies and detection institutions.

[0035] It also reduces the cost investment. There is no need to purchase a large number of expensive special testing equipment for different brands of new energy vehicles. The existing software and hardware equipment based on the standard OBD protocol can be fully utilized to complete the new energy vehicle data reading work. This not only reduces the equipment procurement cost, but also reduces the equipment maintenance cost and management cost, bringing significant economic benefits to related enterprises and individuals.

[0036] This invention helps promote the standardization process in the field of data reading in the new energy vehicle industry, breaks down the data barriers between brands, and provides a unified data interface and reading method for vehicle maintenance, research and development, after-sales, etc. This will promote technical exchanges and cooperation in the industry, improve the technical level and innovation ability of the entire industry, and promote the healthy and rapid development of the industry.

[0037] For car enthusiasts and ordinary users, this system can more conveniently and comprehensively obtain new energy vehicle data, facilitate vehicle status monitoring, performance analysis and personalized settings. This helps to improve users' understanding and control of new energy vehicles, and enhance users' experience and satisfaction. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] Figure 1 This is a flow chart of a new energy vehicle OBD protocol conversion method provided by an embodiment of the present invention;

[0039] Figure 2 It is a scheme comparison diagram of a new energy vehicle OBD protocol conversion method provided by an embodiment of the present invention;

[0040] Figure 3 It is a system architecture diagram of a new energy vehicle OBD protocol conversion system provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0041] In order to make the purpose, technical solution and advantages of the present invention more clear, the technical solution in the embodiment of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiment of the present invention. Obviously, the described embodiment is only a part of the embodiment of the present invention, not all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0042] Example

[0043] like Figures 1 to 3 , a new energy vehicle OBD protocol conversion method, comprising the following steps:

[0044] S1. Connect the protocol conversion system to the OBD interface of the new energy vehicle, where the protocol conversion system includes a protocol parsing module, a data conversion module, a communication interface module and a storage module;

[0045] The protocol analysis module starts to collect data, continuously monitors the CAN data sent by the vehicle through the CAN bus, and uses the protocol recognition algorithm to screen the collected CAN data to identify whether the protocol type followed by the CAN data exists in the protocol feature library in the storage module;

[0046] The protocol identification algorithm specifically includes preprocessing the CAN data, screening the messages carrying diagnostic information, including the message ID, message type, data length and data content, and using the message ID and its corresponding data length and data content as the characteristic values ​​of the message corresponding to the message ID; the message type includes data frames and remote frames; comparing the characteristic value with the protocol in the protocol feature library in the storage module to identify the protocol type followed by the CAN data.

[0047] Specifically, the present invention performs preprocessing on CAN data, and only considers the message ID, message type (MSG_TYPE), data length (DLC / Length), and data content (DATA) of the received message.

[0048] First, the received CAN or CAN FD message is filtered to filter out the message carrying diagnostic information, as well as the corresponding message ID and DLC, DATA and other data as the feature value of the message. Then this feature value is compared with the protocol feature library (such as protocol A, protocol B, protocol C, etc.) inside the system to determine whether the system directly executes the existing decoding algorithm or defines a new decoding method.

[0049] If the protocol feature library identifies the protocol type followed by the CAN data, the decoding method of the corresponding protocol type in the storage module is retrieved to decode the CAN data, and the original vehicle data is obtained through the data screening mechanism;

[0050] Specifically, once the protocol type is identified, the protocol parsing module performs in-depth parsing of the CAN data according to the corresponding protocol parsing rules stored in the storage module. During the parsing process, a specific decoding algorithm and data screening mechanism are used to accurately extract key data such as vehicle speed and motor speed, and transmit these raw data to the data conversion module. The specific decoding algorithm is:

[0051] A hash table is established to establish the correspondence between the encoding of CAN data and vehicle data by looking up the table; when CAN data is received, the corresponding decoding rule in the hash table is searched according to the message ID to convert the encoding of CAN data into vehicle data;

[0052] Specifically, by establishing a hash table, the correspondence between the CAN data encoding of new energy vehicles and the actual physical quantity (i.e., vehicle speed, motor speed, etc.) is established by table lookup. After receiving CAN or CAN FD data, according to the specific identifier in the data, such as the message ID, the corresponding decoding rule is found in the lookup table to convert the binary code into the actual physical quantity value. The two data of more concern are vehicle speed and engine speed; vehicle speed data is generally reflected as one-byte hexadecimal data in kilometers per hour; engine speed is generally reflected as two-byte hexadecimal data A and B, and its calculation formula is (A*256+B) / 4.

[0053] The original vehicle data is obtained through a data screening mechanism, specifically including: setting screening conditions for vehicle data, screening according to the range of message IDs or characteristic values ​​of data frames, and obtaining the original vehicle data.

[0054] Specifically, set the filtering conditions for key data, such as retaining only CAN or CAN FD data frames related to important parameters such as vehicle speed, motor speed, battery voltage, etc. You can filter according to the range of CAN ID or specific flag bits in the data frame to remove redundant and irrelevant data. This step is mainly implemented by the system calling the CAN controller, which is a software and hardware filtering mechanism.

[0055] If the protocol feature library does not identify the protocol type followed by the CAN data, a new decoding method is defined, and the CAN data is decoded to obtain the original vehicle data;

[0056] A new decoding method is defined, specifically including: using the message ID as the hash key, and taking the CAN data corresponding to the message ID, the data length of the message, the mapping relationship between the data content and the message ID as the new feature value of the new decoding method, and storing the new feature value and the mapping relationship in the protocol feature library, identifying the protocol type followed by the CAN data again, and decoding the CAN data.

[0057] By extracting the message ID, data length, and data content of the data frame in the message as features, the extracted features are compared with the protocol feature library. The protocol feature library is stored in a hash table, and the message ID is used as the hash key to locate the corresponding protocol type. The protocol is determined by calculating the similarity of the feature vector;

[0058] Specifically, feature extraction: extract the message ID, data length (DLC), the first few bytes of the data content, etc. in the message data frame as features. The specific data segment bytes include but are not limited to the definition rules of SID and PID in the OBD protocol. For example, the message ID of the battery management system (BMS) data frame of different brands of new energy vehicles often has a specific range or pattern, and the data length is relatively fixed.

[0059] Pattern matching uses the message ID as a hash key to quickly locate possible protocol types. The specific protocol is determined by calculating the similarity of feature vectors, such as Euclidean distance or cosine similarity. For example, if the extracted message ID matches the message ID hash value of a certain brand of BMS protocol, and other features are highly similar, it is determined to be that protocol.

[0060] If multiple corresponding protocol types are located, they are first classified according to the message ID, and then the corresponding decoding methods are called according to the corresponding features of the classified messages to decode the CAN data, and then the decoded data is integrated.

[0061] For example, the vehicle's power system and infotainment system may transmit data at the same time. After being distinguished by the message ID, they are parsed using the corresponding protocol parsing rules and finally the data is integrated.

[0062] S2. After the data conversion module receives the original vehicle data, the conversion program inside the data conversion module converts the original vehicle data according to the standard OBD protocol stored in the storage module, specifically including: data format conversion, data length adjustment, and data meaning mapping;

[0063] After the data conversion module receives the original vehicle data, its internal conversion program performs a full range of data conversion processing according to the standard OBD protocol specifications stored in the storage module;

[0064] The data conversion strictly follows the standard OBD protocol specifications and accurately converts the parsed new energy vehicle data.

[0065] Data format conversion includes mapping the encoding format of the vehicle's original data to the standard OBD protocol format;

[0066] Specifically, the data format conversion uses a predefined format conversion table to quickly map the data encoding formats of different new energy vehicles to the standard OBD protocol format. In the computer, it is implemented through a hash table algorithm, using the source data encoding as an index to quickly find the corresponding standard format encoding. For example, the battery voltage data of a new energy vehicle is represented in a specific binary complement format. The conversion table records the conversion relationship between it and the voltage representation in the standard OBD protocol, and the conversion is directly looked up in the table to reduce the amount of calculation.

[0067] Data length adjustment includes adjusting the original vehicle data to a length that complies with the standard OBD protocol;

[0068] Data meaning mapping includes establishing a mapping database of parameter meanings and mapping the parameters in the vehicle data with the parameter meanings in the standard OBD protocol.

[0069] Specifically, for parameters in new energy vehicle data, such as motor torque percentage, they are accurately mapped to parameter definitions in the standard OBD protocol. Database indexing technology is used to improve query and mapping speed. Logically, when new energy vehicle data is received, the database is queried according to the parameter identifier to obtain the corresponding standard OBD parameter representation to achieve coding mapping.

[0070] During the conversion process, multiple verification algorithms are used to perform real-time verification on the data being converted to obtain the converted data;

[0071] During the conversion process, the conversion program uses multiple verification algorithms to perform real-time verification of data. Once data errors or anomalies are found, error correction is performed immediately to ensure that the converted data is accurate.

[0072] Multiple check algorithms include cyclic redundancy check algorithm, cumulative sum check algorithm, odd check algorithm and even check algorithm;

[0073] The cyclic redundancy check algorithm specifically includes: setting and initializing the register, the register is used to calculate the check value; for the data to be checked, starting from the first byte, the byte is XORed with the register; then the register is shifted left by one bit, if the highest bit shifted out is 1, the register is XORed with the polynomial; if the highest bit shifted out is 0, no XOR operation is performed; repeat the left shift and XOR process to complete the processing of one byte; then process the next byte, and complete the processing of all bytes to obtain the check code; when sending data, the check code is attached to the end of the data frame, and when the receiving end receives the data, the check code is calculated again and obtained, and compared with the check code when the data is sent. If the check codes are equal, there is no error in the data transmission, and if the check codes are not equal, there is an error in the data transmission;

[0074] For example, initialization: set a 16-bit register, usually initialized to 0xFFFF. This register will be used to calculate the value of the checksum;

[0075] Processing data bytes: For the data to be verified, starting from the first byte, perform an XOR operation on the byte and the lower 8 bits of the register. Then shift the register left by one bit. If the highest bit shifted out is 1, perform an XOR operation on the register and the polynomial 0x1021 (the generating polynomial of CRC-16-CCITT); if the highest bit shifted out is 0, no XOR operation is performed. Repeat this process of left shift and XOR 8 times to complete the processing of one byte. Then process the next byte and repeat the above steps until all data bytes are processed.

[0076] When all data processing is completed, the value in the register is the calculated check code. When sending data, this check code is attached to the end of the data frame. After receiving the data, the receiving end uses the same algorithm to calculate the value of the check code and compares it with the received check code. If the two are equal, it is considered that there is no error in the data transmission process; otherwise, the data may have an error.

[0077] The C++ implementation code is as follows:

[0078]

[0079]

[0080] The accumulation and verification algorithm includes: setting an accumulator and initializing it with an initial value of 0; starting from the first byte of the data frame, adding the value of each byte to the accumulator in turn. If the value of the accumulator exceeds the maximum value it can represent, a modulo operation is performed, and then the value of the accumulator is inverted to obtain a verification byte; when sending data, the verification byte is appended to the end of the data frame. When the receiving end receives the data, the verification byte is calculated again and obtained, and compared with the verification byte when the data is sent. If the verification bytes are the same, no error occurs in the data transmission. If the verification bytes are different, an error occurs in the data transmission.

[0081] For example, initialization: set an accumulator with an initial value of 0.

[0082] Calculate the cumulative sum: Starting from the first valid byte of the data frame, the value of each byte is accumulated into the accumulator in turn. During the accumulation process, if the value of the accumulator exceeds the maximum value it can represent (for an 8-bit accumulator, the maximum value is 255; for a 16-bit accumulator, the maximum value is 65535), a modulo operation is performed. For example, for an 8-bit accumulator, when the accumulated value exceeds 255, it is modulo 256.

[0083] Generate check byte: After the calculation is completed, the value of the accumulator is inverted (or other processing is performed according to the specific protocol requirements), and the result is the check byte. When sending data, the check byte is attached to the end of the data frame. After receiving the data, the receiving end calculates the accumulated sum in the same way and compares it with the received check byte to determine whether the data is correct.

[0084] The C++ implementation code is as follows:

[0085]

[0086] The odd parity check algorithm includes: for the data byte to be checked, the number of binary bits that are 1 is counted, if the number of 1s is an odd number, the check bit is set to 0, if the number of 1s is an even number, the check bit is set to 1; after adding the check bit, the number of 1s in the entire data byte is always an odd number; when the receiving end receives the data, the number of 1s in the data byte including the check bit is counted again, if the number of 1s is an odd number, no error occurs in the data transmission, if the number of 1s is an even number, an error occurs in the data transmission;

[0087] For example, to calculate the number of 1s: for the data byte to be checked, count the number of binary bits that are 1.

[0088] Generate the check bit: If the number of 1s is odd, the check bit is set to 0; if the number of 1s is even, the check bit is set to 1. In this way, after adding the check bit, the number of 1s in the entire data (including the check bit) is always an odd number. For example, for the data byte 0b10101100, where the number of 1s is 4 (even), the odd check bit should be 1, and the final data sent is 0b101011001.

[0089] Check: After receiving the data, the receiving end also counts the number of 1s in the data (including the check bit). If the number of 1s is an odd number, it is considered that there may be no error in the data transmission process; if the number of 1s is an even number, it means that there may be an error in the data.

[0090] The C++ implementation code is as follows:

[0091]

[0092]

[0093] The even check algorithm includes: for the data byte to be checked, the number of binary bits that are 1 is counted; if the number of 1s is an even number, the check bit is set to 0; if the number of 1s is an odd number, the check bit is set to 1; after adding the check bit, the number of 1s in the entire data byte is always an even number; when the receiving end receives the data, the number of 1s in the data byte including the check bit is counted again; if the number of 1s is an even number, no error occurs in data transmission; if the number of 1s is an odd number, an error occurs in data transmission.

[0094] For example, to calculate the number of 1s: Similar to odd parity, first count the number of binary bits that are 1 in the statistical byte.

[0095] Generate a check bit: If the number of 1s is even, the check bit is set to 0; if the number of 1s is odd, the check bit is set to 1. After adding the check bit, the number of 1s in the entire data is always an even number. For example, in the data byte 0b10101100, the number of 1s is 4 (even), the even check bit should be 0, and the final data sent is 0b101011000.

[0096] Checksum: After receiving the data, the receiver counts the number of 1s in the statistics (including the check digit). If the number of 1s is an even number, the data is considered to be correct; if the number of 1s is an odd number, the data may be wrong.

[0097] The C++ implementation code is as follows:

[0098]

[0099] In addition, the forward error correction (FEC) algorithm is introduced. At the sending end, the data is FEC-encoded to add redundant information. At the receiving end, this redundant information is used for error correction. The computer uses a specific decoding algorithm to calculate and correct possible error bits based on the received data and redundant information, thereby improving data accuracy.

[0100] S3, the converted data is transmitted to the communication interface module. The communication interface module automatically selects the appropriate communication interface (such as CAN interface, USB interface, etc.) according to the type of externally connected OBD-related hardware and software devices, and adapts and sends the converted data according to the communication protocol and electrical standards of the interface.

[0101] For example, if the connection is to a professional OBD diagnostic instrument that supports the CAN interface, the communication interface module will send the data to the diagnostic instrument according to the frame format and communication rate of the CAN bus protocol; if the connection is to the Pico software and supporting hardware that are connected to the computer via the USB interface, the communication interface module will convert the data into the USB protocol format and transmit it to the computer via the USB bus.

[0102] If the external device sends a control instruction to the protocol conversion system, the communication interface module collects the control instruction and transmits it to the protocol parsing module or the data conversion module according to the type of the control instruction;

[0103] After receiving the control instruction, the protocol analysis module provides the corresponding protocol information; after receiving the control instruction, the data conversion module provides the corresponding converted data or the status information of the data conversion.

[0104] Specifically, after receiving the instruction, the protocol parsing module adjusts the parsing strategy according to the instruction requirements, such as switching the protocol parsing mode, updating the parsing rules, etc., or provides relevant protocol information; the data conversion module provides the converted data, data conversion status information, etc. according to the request content, to achieve efficient interaction between the system and external devices. The specific switching protocol parsing mode and updating the parsing protocol rules are as follows:

[0105] Switch protocol parsing mode: When the communication interface module receives a switching instruction sent by an external device (the instruction contains the target protocol type identifier), the protocol parsing module first suspends the current parsing work, and then reads the corresponding parsing mode configuration from the storage module according to the target protocol type, including data extraction method, decoding rules, etc. After completing the configuration loading, restart the parsing work.

[0106] Update parsing rules: When the communication interface module receives an instruction to update the parsing rules (the instruction contains the version number, content and other information of the new rules), the protocol parsing module first verifies the new rules (such as using multiple verification algorithms to ensure the integrity of the rule data). After the verification passes, the new rules are stored in the corresponding protocol parsing rule area in the storage module, overwriting the original rules. The next time the data of the protocol type is parsed, the updated rules will be used.

[0107] The storage module includes a flash memory storage method and a cache storage method; the protocol conversion system first reads data from the cache, and if the required data is not in the cache, it reads data from the flash memory and stores the data in the cache.

[0108] Specifically, flash memory is used to store critical and infrequently changing data for a long time, such as the vehicle's historical fault codes, long-term driving data statistics, etc. Cache is used to store recently frequently accessed data, such as real-time vehicle operating parameters (vehicle speed, motor speed, etc.).

[0109] When the system needs to read data, it first checks whether the required data is in the cache. If so, it reads directly to increase the reading speed. If not, it reads from the flash memory and stores the data in the cache for subsequent quick access. When writing data, it writes to the cache first. When certain conditions are met (such as cache full or timed refresh), it writes to the flash memory in batches, reducing the number of writes to the flash memory and extending the life of the flash memory.

[0110] Flash memory is used to store critical data for a long time to ensure data persistence; cache increases data reading and writing speeds to meet the system's real-time requirements for data processing.

[0111] When an external device is connected to the protocol conversion system, the communication interface module identifies the interface type by detecting the characteristic signal of the interface. According to the identified interface type, the corresponding interface driver and protocol conversion module are called to select the corresponding interface for data transmission, and the data format in the storage module is converted into a format recognizable by the external device.

[0112] Specifically, the present invention integrates multiple communication interface circuits such as CAN interface, RS-232 interface, DI / O interface, etc. Each interface circuit has corresponding circuit designs such as level conversion and signal isolation to ensure stable signal transmission.

[0113] The communication interface module first automatically identifies the interface type by detecting the characteristic signal of the interface (such as the bus level of the CAN interface). Then, based on the identification result, the corresponding interface driver and protocol conversion module are called. Next, the interface selection algorithm is used to evaluate the current status of each interface (such as bandwidth occupancy, connection stability, etc.) and select the optimal interface for data transmission. During the data transmission process, the internal data format is converted into a format that can be recognized by the external device through protocol conversion technology to ensure compatibility and stability.

[0114] A new energy vehicle OBD protocol conversion system comprises a protocol parsing module, a data conversion module, a communication interface module and a storage module, and is applied in the new energy vehicle OBD protocol conversion method as described above.

[0115] In the protocol analysis module of the present invention, in addition to using a dedicated protocol analysis chip, a field programmable gate array (FPGA) can also be used. FPGA has a high degree of flexibility, and a custom logic can be written through a hardware description language (HDL) to implement the protocol analysis function. By utilizing the parallel processing characteristics of FPGA, the protocol analysis process can be accelerated at the hardware level, and the processing speed and real-time performance can be improved. However, this method requires high hardware design capabilities of developers, and the development cycle is relatively long.

[0116] The data processing chip of the data conversion module can consider using a digital signal processor (DSP) with powerful digital signal processing capabilities. DSP has unique advantages in processing complex digital signals and algorithms. Compared with general data processing chips, it may have higher efficiency and accuracy when executing data conversion algorithms. However, the cost of DSP is relatively high, and the development tools and programming environment are relatively professional, which increases the difficulty of development.

[0117] In terms of storage modules, in addition to the existing flash memory and cache chip combinations, new storage technologies such as non-volatile random access memory (NVRAM) can be explored. NVRAM has the characteristics of both random access and non-volatile storage, can save data when the system loses power, and has fast read and write speeds. Using NVRAM can simplify storage system design and improve the efficiency of data storage and reading, but the current cost of NVRAM is relatively high, which may be subject to certain limitations when it is used on a large scale.

[0118] The protocol conversion system provided by the present invention is composed of four core parts: a protocol analysis module, a data conversion module, a communication interface module and a storage module; each part is closely connected through a high-speed data bus and works in coordination. The protocol analysis module is directly connected to the CAN bus of the new energy vehicle to collect the vehicle CAN data in real time; the protocol analysis module transmits the parsed original data to the data conversion module, and the data conversion module converts and processes the data according to the standard OBD protocol; the converted data is output through the communication interface module, and the communication interface module is responsible for data interaction with external OBD-related software and hardware devices; the storage module is bidirectionally connected with the protocol analysis module and the data conversion module to provide data storage support for the system, and stores various new energy vehicle protocol information, standard OBD protocol rules and temporary data during the conversion process.

[0119] Protocol parsing module: This module consists of a professional protocol parsing chip and a customized software algorithm. The protocol parsing chip uses a high-performance, multi-core processor with powerful data processing capabilities and rich communication interface resources, and can quickly process complex CAN data signals. The software algorithm is based on deep learning and pattern recognition technology, and is deeply optimized for the communication protocols of different brands of new energy vehicles. Through learning and training of a large amount of sample data, the algorithm can accurately identify the protocol type of CAN data, and then parse the data according to the corresponding protocol rules, accurately extracting key information such as vehicle speed and motor speed.

[0120] Data conversion module: It consists of a high-performance data processing chip and a self-developed conversion program. The data processing chip has powerful computing power and efficient data processing architecture, and can quickly process the original data transmitted by the protocol parsing module. The conversion program strictly follows the format, encoding rules and data definition of the standard OBD protocol, and re-encodes, encapsulates and converts the format of the original data. During the conversion process, multiple data verification and error correction mechanisms, such as CRC verification and parity verification, are used to ensure the accuracy and integrity of the converted data, which meets the strict requirements of the standard OBD protocol.

[0121] Communication interface module: Integrates various types of communication interface circuits, including but not limited to CAN interface, serial port, USB interface, Ethernet interface, etc., to meet the communication requirements of different types of OBD-related hardware and software devices. The communication interface circuit is responsible for adapting and transmitting the converted data according to the corresponding interface standards to ensure stable and efficient data transmission between different devices. At the same time, the module can also receive control instructions, query requests and other information sent by external devices, and pass them to the protocol analysis module and data conversion module in a timely manner to achieve two-way communication between the system and external devices.

[0122] Storage module: It uses advanced storage technology and consists of a large-capacity flash memory chip and a cache chip to form a storage array. The flash memory chip is used to store important information such as various new energy vehicle protocol information, standard OBD protocol rules, system configuration parameters, and historical data for a long time to ensure that the data is not lost after the system is powered off. The cache chip is used as a temporary storage area for data processing. It uses its high-speed read and write characteristics to cache intermediate data during the conversion process, effectively improving data processing speed and system response performance.

[0123] The system architecture of the present invention is designed to adopt an architecture design in which a protocol analysis module, a data conversion module, a communication interface module and a storage module work in coordination. Each module has clear functions and division of labor, and realizes rapid transmission and sharing of data through a high-speed data bus. The optimized architecture design not only improves the overall performance and stability of the system, but also facilitates the expansion and upgrade of the system.

[0124] The OBD protocol conversion method for new energy vehicles provided by the present invention is compatible with multiple communication protocols of mainstream new energy vehicles on the market, such as protocol A, protocol B, protocol C, etc., breaking through the limitation that traditional OBD equipment is only applicable to specific brands of vehicles, and significantly improving the versatility of the equipment. The system has excellent adaptability and wide compatibility.

[0125] Using advanced data processing algorithms and technical means, when converting new energy vehicle CAN data into standard OBD protocol data, the processing accuracy of key data such as vehicle speed and motor speed is extremely high, ensuring the accuracy and real-time nature of the data, controlling the data error within a very small range, and meeting the needs of high-precision data reading.

[0126] Based on the present invention, existing software and hardware equipment based on the standard OBD protocol, such as the powerful Pico software and its supporting hardware, can be directly applied to new energy vehicle data reading without large-scale transformation, maximizing the use of existing resources and effectively reducing costs.

[0127] The gateway adopts a scientific and reasonable design architecture, has good openness and scalability, and can be easily integrated into the existing automobile detection system. At the same time, with the continuous development of new energy vehicle technology and the emergence of new protocols, the system can be easily upgraded to adapt to industry changes.

[0128] According to the disclosure and teaching of the above description, those skilled in the art to which the present invention belongs may also make changes and modifications to the above embodiments. Therefore, the present invention is not limited to the specific embodiments disclosed and described above, and some modifications and changes to the present invention should also fall within the scope of protection of the claims of the present invention. In addition, although some specific terms are used in this specification, these terms are only for the convenience of description and do not constitute any limitation to the present invention.

Claims

1. A new energy vehicle OBD protocol conversion method, characterized in that: The following steps are involved: S1. Connect the protocol conversion system to the OBD interface of the new energy vehicle, where the protocol conversion system includes a protocol parsing module, a data conversion module, a communication interface module and a storage module; The protocol analysis module starts to collect data, continuously monitors the CAN data sent by the vehicle through the CAN bus, and uses the protocol recognition algorithm to screen the collected CAN data to identify whether the protocol type followed by the CAN data exists in the protocol feature library in the storage module; If the protocol feature library identifies the protocol type followed by the CAN data, the CAN data is decoded and the original vehicle data is obtained through the data screening mechanism; If the protocol feature library does not identify the protocol type followed by the CAN data, a new decoding method is defined, and the CAN data is decoded to obtain the original vehicle data; S2. After the data conversion module receives the original vehicle data, the conversion program inside the data conversion module converts the original vehicle data according to the standard OBD protocol stored in the storage module, specifically including: data format conversion, data length adjustment, and data meaning mapping; During the conversion process, multiple verification algorithms are used to perform real-time verification on the data being converted to obtain the converted data; S3. The converted data is transmitted to the communication interface module. The communication interface module selects the corresponding communication interface according to the OBD hardware and software device type of the connected new energy vehicle, and adapts and sends the converted data according to the communication protocol and electrical standard of the corresponding communication interface.

2. A new energy vehicle OBD protocol conversion method according to claim 1, characterized in that: In S1, the protocol identification algorithm specifically includes preprocessing the CAN data, screening the messages carrying diagnostic information, specifically including the message ID, and the message type, data length and data content, and using the message ID and its corresponding data length and data content as the characteristic value of the message corresponding to the message ID; The message types include data frames and remote frames; the characteristic value is compared with the protocol in the protocol characteristic library in the storage module to identify the protocol type followed by the CAN data.

3. A new energy vehicle OBD protocol conversion method according to claim 2, characterized in that: If the protocol feature library identifies the protocol type followed by the CAN data, the decoding method of the corresponding protocol type in the storage module is called to decode the CAN data; A hash table is established to establish the correspondence between the encoding of CAN data and vehicle data by looking up the table; when CAN data is received, the corresponding decoding rule in the hash table is searched according to the message ID to convert the encoding of CAN data into vehicle data; The original vehicle data is obtained through a data screening mechanism, specifically including: setting screening conditions for vehicle data, screening according to the range of message IDs or characteristic values ​​of data frames, and obtaining the original vehicle data.

4. A new energy vehicle OBD protocol conversion method according to claim 3, characterized in that: If the protocol signature library does not identify the protocol type followed by the CAN data, a new decoding method is defined, including: Using the message ID as the hash key, the CAN data corresponding to the message ID, the data length of the message, the mapping relationship between the data content and the message ID are used as the new feature value of the new decoding method, and the new feature value and the mapping relationship are stored in the protocol feature library. The protocol type followed by the CAN data is identified again, and the CAN data is decoded.

5. A new energy vehicle OBD protocol conversion method according to claim 1, characterized in that: In S2, the data format conversion includes mapping the encoding format of the vehicle original data to the standard OBD protocol format; Data length adjustment includes adjusting the original vehicle data to a length that complies with the standard OBD protocol; Data meaning mapping includes establishing a mapping database of parameter meanings and mapping the parameters in the vehicle data with the parameter meanings in the standard OBD protocol.

6. A new energy vehicle OBD protocol conversion method according to claim 1, characterized in that: In S2, the multiple check algorithms include a cyclic redundancy check algorithm, a cumulative sum check algorithm, an odd check algorithm and an even check algorithm.

7. A new energy vehicle OBD protocol conversion method according to claim 1, characterized in that: If the external device sends a control instruction to the protocol conversion system, the communication interface module collects the control instruction and transmits it to the protocol parsing module or the data conversion module according to the type of the control instruction; After receiving the control instruction, the protocol analysis module provides the corresponding protocol information; after receiving the control instruction, the data conversion module provides the corresponding converted data or the status information of the data conversion.

8. A new energy vehicle OBD protocol conversion method according to claim 1, characterized in that: The storage module includes a flash memory storage method and a cache storage method; the protocol conversion system first reads data from the cache, and if the required data is not in the cache, it reads data from the flash memory and stores the data in the cache.

9. A new energy vehicle OBD protocol conversion method according to claim 1, characterized in that: When an external device is connected to the protocol conversion system, the communication interface module identifies the interface type by detecting the characteristic signal of the interface. According to the identified interface type, the corresponding interface driver and protocol conversion module are called to select the corresponding interface for data transmission, and the data format in the storage module is converted into a format recognizable by the external device.

10. A new energy vehicle OBD protocol conversion system, characterized in that: It comprises a protocol parsing module, a data conversion module, a communication interface module and a storage module, and is applied in a new energy vehicle OBD protocol conversion method as described in any one of claims 1 to 9.

Citation Information

Patent Citations

  • Automobile communication method and device and computer readable memory medium

    CN107864080A

  • Protocol conversion method and device

    CN109669442A

  • CAN protocol analysis method, system, device and medium

    CN118677970A

  • Unknown on-board diagnostics (OBD) protocol interpreter and conversion system

    US20160253849A1