New energy automobile electronic control unit ECU control test method
By performing binary conversion and homogeneous calculation of test codes and test data in the automotive electronic control unit (ECU), CAN communication is carried out after ensuring the consistency of the number of bits, the source code leakage problem caused by the unprocessed test data set in the prior art is solved. The security of data transmission is realized.
Patent Information
- Application Number
- CN202411192220.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-28
- Publication Date
- 2024-12-03
- Estimated Expiration
- 2044-08-28
AI Technical Summary
The prior art fails to effectively process the fuzzy test data set when conducting automotive electronic control unit (ECU) testing, resulting in the risk of source code leakage.
By obtaining the test code and test data sent by the upper computer, converting it into binary form, and performing homologous calculations to ensure that the number of bits of the test data and test code are consistent. Then, the test data is sent through CAN communication to ensure the security of the data during the transmission process. sex.
It effectively guarantees the security of automobile test data, prevents leakage during the transmission process, and ensures the security of data transmission.
Smart Images

Figure CN119065352A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of automobile technology, and in particular to a control test method for an electronic control unit (ECU) of a new energy automobile. Background Art
[0002] CAN is a serial communication protocol bus for real-time applications and effective support for distributed control systems. It is one of the most widely used fieldbuses in the world. The CAN protocol was first developed by Bosch in Germany in the 1980s as a serial communication bus specifically for the automotive industry. Due to the high performance, high reliability and unique CAN-bus technology of the protocol, it has received increasing attention and is widely used in the field of industrial control. Patent application number 202011339860X, named "A vehicle ECU security test method and device", discloses the following: obtaining vehicle CAN bus data, dividing CAN bus data with the same frame ID into the same data set as the original data set; wherein different frame IDs correspond to different ECUs; determining whether each original data set belongs to a single-value data set, a multi-value data set or a full-value data set; constructing a corresponding fuzzy test data set according to the characteristics of each original data set; and sending the data in each fuzzy test data set to the CAN bus to determine the security of each ECU of the vehicle. However, the invention does not perform security processing on the fuzzy test data set, which will lead to the leakage of source code. Summary of the invention
[0003] The present invention aims to at least solve the technical problems existing in the prior art, and in particular innovatively proposes a control test method for an electronic control unit (ECU) of a new energy vehicle.
[0004] In order to achieve the above-mentioned object of the present invention, the present invention provides a new energy vehicle electronic control unit ECU control test method, comprising the following steps:
[0005] S1, the new energy vehicle electronic control unit ECU obtains the test code and test data sent by the host computer;
[0006] S2, the new energy vehicle electronic control unit ECU converts the test data obtained in step S1 into binary test data;
[0007] S3, the new energy vehicle electronic control unit ECU converts the test code obtained in step S1 into a binary test code;
[0008] S4, the new energy vehicle electronic control unit ECU determines the size relationship between P and Q, making the sizes of P and Q consistent;
[0009] S5, performing parity calculation on the binary test data obtained in step S4 and the binary test code to obtain vehicle test data;
[0010] S6. Send the vehicle test data to the test unit via CAN communication for testing.
[0011] In a preferred embodiment of the present invention, in step S4, the method to make the magnitude between P and Q the same is as follows:
[0012] If P > Q, where P is the number of characters of the binary test data and Q is the number of characters of the binary test code, then add q zeros or ones at the end of the binary test code; perform the next step;
[0013] If P < Q, where P is the number of characters of the binary test data and Q is the number of characters of the binary test code, then reduce p bits at the end of the binary test code; perform the next step;
[0014] If P = Q, where P is the number of characters of the binary test data and Q is the number of characters of the binary test code, then perform the next step.
[0015] In a preferred embodiment of the present invention, step S4 is
[0016] The new energy vehicle electronic control unit ECU determines the magnitude relationship between P and Q:
[0017] If P > Q, where P is the number of characters of the binary test data and Q is the number of characters of the binary test code, then add q zeros at the end of the binary test code; perform the next step;
[0018] If P < Q, where P is the number of characters of the binary test data and Q is the number of characters of the binary test code, then reduce p bits at the end of the binary test code; perform the next step;
[0019] If P = Q, where P is the number of characters of the binary test data and Q is the number of characters of the binary test code, then perform the next step.
[0020] In a preferred embodiment of the present invention, the calculation method of q in step S4 is:
[0021] q = P - Q,
[0022] where q is the number of added ones;
[0023] P represents the number of characters of the binary test data;
[0024] Q represents the number of characters of the binary test code.
[0025] In a preferred embodiment of the present invention, the calculation method of p in step S4 is:
[0026] p = Q - P,
[0027] where p represents the number of reduced bits;
[0028] P represents the number of characters in the binary test data;
[0029] Q represents the number of character bits of the binary test code.
[0030] In a preferred embodiment of the present invention, in step S5, the binary test data after step S4 is subjected to parity calculation with the binary test code to obtain the vehicle test data in the following manner:
[0031] P 1 P 2 P 3 …P J ⊙Q 1 Q 2 Q 3 …Q J =P 1 ′P 2 ′P 3 ′…P J ′,
[0032] Among them, P 1 Indicates the value at the first position from left to right in the binary test data;
[0033] P 2 Indicates the value at the second position from left to right in the binary test data;
[0034] P 3 Indicates the value at the third position from left to right in the binary test data;
[0035] P J Indicates the value at the Jth position from left to right in the binary test data;
[0036] Q 1 Indicates the value of the first bit from left to right in the binary test code;
[0037] Q 2 Indicates the value of the second bit from left to right in the binary test code;
[0038] Q 3 Indicates the value of the third bit from left to right in the binary test code;
[0039] Q J Indicates the value at the Jth position from left to right in the binary test code;
[0040] P 1 ' represents the first value from left to right in the automobile test data;
[0041] P 2' represents the second value from left to right in the automobile test data;
[0042] P 3 ' represents the third value from left to right in the automobile test data;
[0043] P J ' represents the value at the Jth position from left to right in the automobile test data;
[0044] ⊙ represents the same position operator;
[0045] J represents the total number of digits;
[0046] P 1 P 2 P 3 …P J Represents binary test data;
[0047] Q 1 Q 2 Q 3 …Q J represents a binary test code;
[0048] P 1 ′P 2 ′P 3 ′…P J ′ represents the car test data.
[0049] In a preferred embodiment of the present invention, P j The calculation method of ′ is:
[0050]
[0051] Among them, P j ' represents the value at the jth position from left to right in the test data to be sent;
[0052] If means logical condition;
[0053] P j Represents the value at the jth position from left to right in the binary test data;
[0054] Q j Indicates the value at the jth position from left to right in the binary test code;
[0055] or indicates logical condition or;
[0056] and represents the logical condition and;
[0057] J represents the total number of digits.
[0058] In summary, due to the adoption of the above technical solutions, the present invention can ensure the security of automotive test data and prevent leakage during transmission.
[0059] Additional aspects and advantages of the present invention will be given in part in the following description, become apparent in part from the following description, or be learned through the practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] The above and / or additional aspects and advantages of the present invention will become apparent and be readily understood from the description of the embodiments in conjunction with the following drawings, wherein:
[0061] Figure 1 is a flowchart of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0062] Embodiments of the present invention will be described in detail below. Examples of the embodiments are shown in the drawings, where the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below by referring to the drawings are exemplary only for explaining the present invention and should not be construed as limiting the present invention.
[0063] The present invention discloses a method for controlling and testing an electronic control unit (ECU) of a new energy vehicle, as Figure 1 shown, including the following steps:
[0064] S1. The electronic control unit (ECU) of the new energy vehicle obtains a test code and test data sent by a host computer (a notebook or a computer PC);
[0065] S2. The electronic control unit (ECU) of the new energy vehicle converts the test data obtained in step S1 into binary test data;
[0066] S3. The electronic control unit (ECU) of the new energy vehicle converts the test code obtained in step S1 into binary test code;
[0067] S4. The electronic control unit (ECU) of the new energy vehicle determines the magnitude relationship between P and Q:
[0068] If P > Q, where P is the number of characters of the binary test data and Q is the number of characters of the binary test code, then q zeros or ones are added after the binary test code; proceed to the next step;
[0069] If P < Q, where P is the number of characters of the binary test data and Q is the number of characters of the binary test code, then p bits are removed from the binary test code; proceed to the next step;
[0070] If P = Q, where P is the number of characters of the binary test data and Q is the number of characters of the binary test code, then proceed to the next step;
[0071] Make the number of characters of P and Q the same through step S4;
[0072] S5. Perform a bit-by-bit calculation on the binary test data after step S4 and the binary test code to obtain vehicle test data;
[0073] S6. Send the vehicle test data to the test unit through CAN communication for testing. The test unit can be an engine system, an air conditioning system, an indicator light system, etc.
[0074] In a preferred embodiment of the present invention, step S4 is
[0075] The new energy vehicle electronic control unit ECU judges the magnitude relationship between P and Q:
[0076] If P > Q, where P is the number of characters of the binary test data and Q is the number of characters of the binary test code, then add q zeros after the binary test code; proceed to the next step;
[0077] If P < Q, where P is the number of characters of the binary test data and Q is the number of characters of the binary test code, then remove p bits from the end of the binary test code; proceed to the next step;
[0078] If P = Q, where P is the number of characters of the binary test data and Q is the number of characters of the binary test code, then proceed to the next step.
[0079] In a preferred embodiment of the present invention, the calculation method of q in step S4 is:
[0080] q = P - Q,
[0081] where q is the number of added zeros;
[0082] P represents the number of characters of the binary test data;
[0083] Q represents the number of characters of the binary test code.
[0084] In a preferred embodiment of the present invention, the calculation method of p in step S4 is:
[0085] p = Q - P,
[0086] where p is the number of removed bits;
[0087] P represents the number of characters of the binary test data;
[0088] Q represents the number of characters of the binary test code.
[0089] In a preferred embodiment of the present invention, in step S5, the binary test data after step S4 is subjected to parity calculation with the binary test code to obtain the vehicle test data in the following manner:
[0090] P 1 P 2 P 3 …P J ⊙Q 1 Q 2 Q 3 …Q J =P 1 ′P 2 ′P 3 ′…P J ′,
[0091] Among them, P 1 Indicates the value of the first bit from left to right in the binary test data; P 2 Indicates the value at the second position from left to right in the binary test data;
[0092] P 3 Indicates the value at the third position from left to right in the binary test data;
[0093] P J Indicates the value at the Jth position from left to right in the binary test data;
[0094] Q 1 Indicates the value of the first bit from left to right in the binary test code;
[0095] Q 2 Indicates the value of the second bit from left to right in the binary test code;
[0096] Q 3 Indicates the value of the third bit from left to right in the binary test code;
[0097] Q J Indicates the value at the Jth position from left to right in the binary test code;
[0098] P 1 ' represents the first value from left to right in the automobile test data;
[0099] P 2 ' represents the second value from left to right in the automobile test data;
[0100] P 3 ' represents the third value from left to right in the automobile test data; P J ' represents the value at the Jth position from left to right in the automobile test data;
[0101] ⊙ represents the same position operator;
[0102] J represents the total number of digits;
[0103] P 1 P 2 P 3 …P J Represents binary test data;
[0104] Q 1 Q 2 Q 3 …Q J represents a binary test code;
[0105] P 1 ′P 2 ′P 3 ′…P J ′ represents the car test data.
[0106] In a preferred embodiment of the present invention, P j The calculation method of ′ is:
[0107]
[0108] Among them, P j ' represents the value at the jth position from left to right in the test data to be sent; if represents the logical condition if;
[0109] P j Represents the value at the jth position from left to right in the binary test data;
[0110] Q j Indicates the value at the jth position from left to right in the binary test code;
[0111] or indicates logical condition or;
[0112] and represents the logical condition and;
[0113] J represents the total number of digits.
[0114] In a preferred embodiment of the present invention, in step S5, it further includes calculating the vehicle code corresponding to the vehicle test data, and determining whether the binary vehicle code is consistent with the binary test code:
[0115] If the binary vehicle code is consistent with the binary test code, the vehicle test data is correct vehicle test data;
[0116] If the binary vehicle code is inconsistent with the binary test code, the vehicle test data is erroneous vehicle test data.
[0117] In a preferred embodiment of the present invention, the method for calculating the vehicle code corresponding to the vehicle test data is as follows:
[0118] Cardatastring = Datastringenerateway(Cartestcode),
[0119] where Cardatastring represents the vehicle code calculated according to the vehicle test data;
[0120] Datastringenerateway() represents the method for calculating the vehicle code, and the sha256 digest algorithm can be used;
[0121] Cartestcode represents the vehicle test data.
[0122] In a preferred embodiment of the present invention, in step S1, the method for generating the test data includes the following steps:
[0123] S11, obtain the test data to be sent;
[0124] S12, convert the test data obtained in step S11 into binary test data, and generate the test code of the test data according to the binary test data;
[0125] S13, convert the test code in step S12 into a binary test code;
[0126] S14, judge the size relationship between U and V:
[0127] If U > V, where U is the number of characters of the binary test data and V is the number of characters of the binary test code, then add v zeros or ones after the binary test code; execute the next step;
[0128] If U < V, where U is the number of characters of the binary test data and V is the number of characters of the binary test code, then reduce u bits after the binary test code; execute the next step;
[0129] If U = V, where U is the number of characters of the binary test data and V is the number of characters of the binary test code, then execute the next step;
[0130] Make the number of characters of U and V the same through step S14;
[0131] S15, perform bit-by-bit calculation on the binary test data and the binary test code after step S14 to obtain the actual test data to be sent;
[0132] S16, send the test code and the actual test data to be sent to the test vehicle by using the host computer.
[0133] In a preferred embodiment of the present invention, step S14 is as follows:
[0134] Judge the magnitude relationship between U and V:
[0135] If U > V, where U is the number of characters of the binary test data and V is the number of characters of the binary test code, then add v zeros after the binary test code; proceed to the next step;
[0136] If U < V, where U is the number of characters of the binary test data and V is the number of characters of the binary test code, then reduce u bits after the binary test code; proceed to the next step;
[0137] If U = V, where U is the number of characters of the binary test data and V is the number of characters of the binary test code, then proceed to the next step;
[0138] Make the number of characters of U and V the same through step S14.
[0139] In a preferred embodiment of the present invention, the calculation method of v in step S14 is as follows:
[0140] v = U - V,
[0141] where v is the number of added ones;
[0142] U represents the number of characters of the binary test data;
[0143] V represents the number of characters of the binary test code.
[0144] In a preferred embodiment of the present invention, the calculation method of u in step S14 is as follows:
[0145] u = V - U,
[0146] where u represents the number of reduced ones;
[0147] U represents the number of characters of the binary test data;
[0148] V represents the number of characters of the binary test code.
[0149] In a preferred embodiment of the present invention, in step S15, the method of obtaining the actual test data to be sent by performing bit - by - bit calculation on the binary test data and the binary test code that have gone through step S14 is as follows:
[0150] U 1 U 2 U 3 …U K ⊙V 1 V 2 V 3 …V K =U1 'U 2 'U 3 '…U' K ,
[0151] Among them, U 1 Indicates the value at the first position from left to right in the binary test data;
[0152] U 2 Indicates the value at the second position from left to right in the binary test data;
[0153] U 3 Indicates the value at the third position from left to right in the binary test data;
[0154] U K Indicates the value at the Kth position from left to right in the binary test data;
[0155] V 1 Indicates the value of the first bit from left to right in the binary test code;
[0156] V 2 Indicates the value of the second bit from left to right in the binary test code;
[0157] V 3 Indicates the value of the third bit from left to right in the binary test code;
[0158] V K Indicates the value at the Kth position from left to right in the binary test code;
[0159] U 1 ' represents the value of the first bit from left to right in the actual test data to be sent;
[0160] U 2 ' represents the value of the second bit from left to right in the actual test data to be sent;
[0161] U 3 ' represents the value of the third bit from left to right in the actual test data to be sent;
[0162] U′ K Indicates the value at the Kth position from left to right in the actual test data to be sent;
[0163] ⊙ represents the same position operator;
[0164] K represents the total number of digits;
[0165] U 1 U 2 U 3 …U K Represents binary test data;
[0166] V 1 V 2 V 3 …V K represents a binary test code;
[0167] U 1 'U 2 'U 3 '…U' K Indicates the actual test data to be sent;
[0168] U k The calculation method of ′ is:
[0169]
[0170] Among them, U k ' represents the value at the kth position from left to right in the actual test data to be sent;
[0171] If means logical condition;
[0172] U k Indicates the value at the kth position from left to right in the binary test data;
[0173] V k Indicates the value at the kth position from left to right in the binary test code;
[0174] or indicates logical condition or;
[0175] and represents the logical condition and;
[0176] K represents the total number of digits.
[0177] In a preferred embodiment of the present invention, the method for generating a test code of test data according to binary test data in step S12 is:
[0178] Testingstring=Testingstringenerateway(Testdata),
[0179] Among them, Testingstring represents the test code generated according to the acquired test data;
[0180] Testingstringenerateway() indicates the method of generating the test code, which can use the sha256 digest algorithm;
[0181] Testdata means obtaining the test data to be tested.
[0182] Although the embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the claims and their equivalents.
Claims
1. A new energy vehicle electronic control unit ECU control test method, characterized in that: It includes the following steps: S1, the electronic control unit (ECU) of a new energy vehicle obtains the test code and test data sent by the host computer; S2, the ECU of the new energy vehicle converts the test data obtained in step S1 into binary test data; S3, the ECU of the new energy vehicle converts the test code obtained in step S1 into binary test code; S4, the ECU of the new energy vehicle judges the size relationship between P and Q to make the size between P and Q consistent; S5, perform bit-by-bit calculation on the binary test data and binary test code after step S4 to obtain vehicle test data; S6, send the vehicle test data to the test unit for testing through CAN communication.
2. The new energy vehicle electronic control unit ECU control test method according to claim 1 is characterized in that: In step S4, the method to make the size between P and Q consistent is as follows: If P > Q, where P is the number of characters of the binary test data and Q is the number of characters of the binary test code, then add q zeros or ones after the binary test code; proceed to the next step; If P < Q, where P is the number of characters of the binary test data and Q is the number of characters of the binary test code, then reduce p bits from the binary test code; proceed to the next step; If P = Q, where P is the number of characters of the binary test data and Q is the number of characters of the binary test code, then proceed to the next step.
3. The new energy vehicle electronic control unit ECU control test method according to claim 1 is characterized in that: Step S4 is the ECU of the new energy vehicle judges the size relationship between P and Q: If P > Q, where P is the number of characters of the binary test data and Q is the number of characters of the binary test code, then add q zeros after the binary test code; proceed to the next step; If P < Q, where P is the number of characters of the binary test data and Q is the number of characters of the binary test code, then reduce p bits from the binary test code; proceed to the next step; If P = Q, where P is the number of characters of the binary test data and Q is the number of characters of the binary test code, then proceed to the next step.
4. The new energy vehicle electronic control unit ECU control test method according to claim 1 is characterized in that: In step S4, the calculation method of q is: q = P - Q where q is the number of added ones; P represents the number of characters of the binary test data; Q represents the number of characters of the binary test code.
5. The new energy vehicle electronic control unit ECU control test method according to claim 1 is characterized in that: In step S4, the calculation method of p is: p = Q - P where p represents the number of reduced bits; P represents the number of characters of the binary test data; Q represents the number of characters of the binary test code.
6. The new energy vehicle electronic control unit ECU control test method according to claim 1 is characterized in that: In step S5, the method to perform bit-by-bit calculation on the binary test data and binary test code after step S4 to obtain vehicle test data is: P1P2P3…P J ⊙Q1Q2Q3…Q J =P1′P2′P3′…P J ′, where P1 represents the value of the first bit from left to right in the binary test data; P2 represents the value of the second bit from left to right in the binary test data; P3 represents the value of the third bit from left to right in the binary test data; P J Indicates the value at the Jth position from left to right in the binary test data; Q1 represents the value of the first bit from left to right in the binary test code; Q2 represents the value of the second bit from left to right in the binary test code; Q3 represents the value of the third bit from left to right in the binary test code; Q J Indicates the value at the Jth position from left to right in the binary test code; P1′ represents the value of the first bit from left to right in the vehicle test data; P2′ represents the value of the second bit from left to right in the vehicle test data; P3′ represents the value of the third bit from left to right in the vehicle test data; P J ' represents the value at the Jth position from left to right in the automobile test data; ⊙ represents the same position operator; J represents the total number of digits; P1P2P3…P J Represents binary test data; Q1Q2Q3…Q J represents a binary test code; P1′P2′P3′…P J ′ represents the car test data.
7. The new energy vehicle electronic control unit ECU control test method according to claim 1 is characterized in that: P j The calculation method of ′ is: Among them, P j ' represents the value at the jth position from left to right in the test data to be sent; If means logical condition; P j Represents the value at the jth position from left to right in the binary test data; Q j Indicates the value at the jth position from left to right in the binary test code; or indicates logical condition or; and represents the logical condition and; J represents the total number of digits.
Citation Information
Patent Citations
White-box testing method and system
CN107038110A
Vehicle ECU safety test method and device
CN112532716A
CAN bus fuzzy test method based on data analysis
CN113268430A
Interface test method and device based on binary data communication, equipment and medium
CN113626322A
Automobile ECU diagnosis test method based on hardware-in-the-loop platform
CN114610000A
