Method for encoding can messages, method for decoding can messages, and computer program product

CN122093472APending Publication Date: 2026-05-26BOSCH AUTOMOTIVE PRODUCTS (SUZHOU) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BOSCH AUTOMOTIVE PRODUCTS (SUZHOU) CO LTD
Filing Date
2024-11-25
Publication Date
2026-05-26

Smart Images

  • Figure CN122093472A_ABST
    Figure CN122093472A_ABST
Patent Text Reader

Abstract

The invention provides a method for coding CAN (Controller Area Network) messages. The method comprises the following steps: classifying the collected CAN messages based on identifiers of the CAN messages; calculating a difference item between adjacent frame message data of the same kind of CAN messages in time; adjacent difference items with the same numerical value in the difference items arranged in sequence are merged into one difference item, and the number of merged items contained in each merged difference item is determined; and storing the first frame message data of each type of CAN messages, and the combined differential item and the combined item number of the CAN messages belonging to the corresponding type. The invention further provides a method for decoding the CAN message and a computer program product. According to the method and the device, the repeated data in the periodic message can be greatly compressed through the coding mode, and the storage space and the transmission bandwidth occupied by the message data record are effectively saved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of vehicle communication, and more particularly to a method for encoding CAN messages, a method for decoding CAN messages encoded by the method according to this application, and a computer program product for at least assisting in implementing the steps of the method according to this application. Background Technology

[0002] CAN (Controller Area Network) bus is a widely used in-vehicle communication bus. It connects the electronic control units (ECUs) of different subsystems in a vehicle and ensures the coordinated operation of these subsystems through communication between them. To monitor the message data transmitted on the CAN bus, CAN bus logging software is used to record bus message logs. These logs contain a large number of periodic messages. These periodic messages often exhibit signal values ​​that remain unchanged for extended periods, and the repeated recording of these periodic messages consumes significant storage space and transmission bandwidth.

[0003] Therefore, how to efficiently record CAN messages has become a technical challenge that needs to be solved. Summary of the Invention

[0004] The purpose of this application is to provide a method for encoding CAN messages, a method for decoding CAN messages encoded by the method of this application, and a computer program product to at least partially solve the problems in the prior art.

[0005] According to a first aspect of this application, a method for encoding CAN messages is provided, the method comprising:

[0006] - The collected CAN messages are classified based on the identifier of the CAN message;

[0007] - Calculate the difference between time-adjacent frames of CAN messages of the same type;

[0008] - Combine adjacent difference terms with the same value in the sequentially arranged difference terms into one difference term, and determine the number of combined terms contained in each combined difference term; and

[0009] - Stores the first frame data of various CAN messages, as well as the merged differential items and the number of merged items of the CAN messages belonging to the corresponding class.

[0010] The core concept of this application includes at least the following: Selecting periodic messages with the same CAN ID from the collected CAN messages according to their identifiers; effectively extracting the variation information of each frame of periodic messages of the same type by calculating and merging the difference terms of temporally adjacent frames of periodic messages; and thus, encoding this type of CAN message can be completed using the first frame of the message data, the merged difference terms, and the number of merged terms. This encoding method can significantly compress repetitive data in periodic messages, effectively saving storage space and transmission bandwidth occupied by message data records.

[0011] According to a second aspect of this application, a method for decoding a CAN message encoded by the method according to this application is provided, the method comprising:

[0012] -Based on the merged difference items and the number of merged items belonging to various types of CAN messages, the difference items between the time-adjacent frames of CAN messages of the corresponding type are restored respectively.

[0013] and

[0014] -Based on the first frame data of each type of CAN message and the restored differential terms of the corresponding CAN message, the data of each frame of the CAN message of the corresponding type is determined.

[0015] According to a third aspect of this application, a computer program product, such as a computer-readable program carrier, is provided, comprising computer program instructions that, when executed by a processor, at least partially implement the steps of the method described in this application. Attached Figure Description

[0016] The principles, features, and advantages of this application will be better understood below with reference to the accompanying drawings. The drawings include:

[0017] Figure 1 A flowchart illustrating a method for encoding CAN messages according to an exemplary embodiment of this application is shown.

[0018] Figure 2 A flowchart illustrating a method for encoding CAN messages according to another exemplary embodiment of this application is shown;

[0019] Figure 3 A flowchart illustrating a method for encoding CAN messages according to another exemplary embodiment of this application is shown;

[0020] Figure 4 A flowchart illustrating a method for encoding CAN messages according to another exemplary embodiment of this application is shown;

[0021] Figure 5 A flowchart illustrating a method for encoding CAN messages according to another exemplary embodiment of this application is shown;

[0022] Figure 6 A flowchart illustrating a method for decoding CAN messages according to an exemplary embodiment of this application is shown.

[0023] Figure 7 A flowchart illustrating a method for decoding CAN messages according to another exemplary embodiment of this application is shown; and

[0024] Figure 8 A flowchart illustrating a method for decoding CAN messages according to another exemplary embodiment of this application is shown. Detailed Implementation

[0025] To make the technical problems to be solved, the technical solutions, and the beneficial technical effects of this application clearer, the application will be further described in detail below with reference to the accompanying drawings and several exemplary embodiments. It should be understood that the specific embodiments described herein are only for explaining this application and are not intended to limit the scope of protection of this application.

[0026] According to existing CAN message recording methods, CAN bus messages are typically recorded in chronological order. After receiving a CAN message, the CAN bus recording software records the timestamp, channel, transmit / receive status, and message data in the order of reception. However, a large number of periodic messages exist within the recorded message data. The signals in these periodic messages do not change in every cycle, or some signal values ​​change at a constant rate. Therefore, the chronological CAN message recording method repeatedly records a large amount of message data with constant values ​​or changing at a constant rate. This chronological message recording method undoubtedly occupies a significant amount of storage space and transmission bandwidth. The method for encoding CAN messages and the method for decoding CAN messages encoded according to the method of this application can at least partially solve the above problems.

[0027] Figure 1 A flowchart illustrating a method for encoding CAN messages according to an exemplary embodiment of this application is shown. The following exemplary embodiments describe the method according to this application in more detail.

[0028] like Figure 1As shown, the method may include steps S1 to S4. In step S1, the collected CAN messages are classified based on the CAN message identifier. During vehicle operation, the electronic control units of various on-board components transmit the monitored on-board component status signals in the form of CAN messages on the CAN bus. The CAN messages may include CAN messages about the status signals of various on-board components, such as vehicle speed signals, throttle status signals, transmission status signals, air conditioning status signals, headlight status signals, window status signals, steering status signals, braking status signals, engine status signals, and / or tire pressure status signals. According to the CAN communication protocol, each CAN message about the status signal of an on-board component is assigned a corresponding identifier—that is, a CAN ID, which is set in the data header of each frame of the CAN message. Based on this identifier, the collected CAN messages can be classified according to the category of the on-board component status signal.

[0029] For clarity, the following example shows the data of each frame of a captured CAN message:

[0030] A 11 A 12 A 13 A 14 A 15 A 16 A 17 A 18 ,…A 1n

[0031] B 11 B 12 B 13 B 14 B 15 B 16 B 17 B 18 ,…B 1n

[0032] C 11 C 12 C 13 C 14 C 15 C 16 C 17 C 18 ,…C 1n

[0033] A 21 A 22 A 23 A 24 A 25 A 26 A27 A 28 ,…A 2n

[0034]

[0035] A 31 A 32 A 33 A 34 A 35 A 36 A 37 A 38 ,…A 3n

[0036]

[0037] A m1 A m2 A m3 A m4 A m5 A m6 A m7 A m8 ,…A mn

[0038] Here, A, B, and C represent three categories of CAN message data related to the status signals of different vehicle components. Each message data is, for example, 1 byte, and each frame of message data contains, for example, n bytes of message data. A CAN ID can be set in the header of each frame of message data. Based on the CAN ID of each frame of message data, the collected CAN messages can be classified. These CAN messages are transmitted in a time-division multiplexing manner, which results in message data of other CAN IDs being interspersed between two consecutive periodic messages with the same CAN ID. For example, between two frames of category A message data, category B message data and / or category C message data may be interspersed. From the above-mentioned collected CAN messages, a total of m frames of category A message data can be filtered out and classified into the same category. The m frames of category A message data are arranged in the order of CAN message reception time as follows:

[0039] A 11 A 12 A 13 A 14 A 15 A 16 A 17 A 18 ,…A 1n

[0040] A 21 A 22 A 23 A 24 A25 A 26 A 27 A 28 ,…A 2n

[0041] A 31 A 32 A 33 A 34 A 35 A 36 A 37 A 38 ,…A 3n

[0042]

[0043] A m1 A m2 A m3 A m4 A m5 A m6 A m7 A m8 ,…A mn

[0044] like Figure 2 As shown, the method may further include step S10. In step S10, the desired time period for the CAN message to be encoded can be set, and the CAN message can be collected based on the timestamp information of the CAN message within the set desired time period. Here, the initial time when the encoder starts collecting the CAN message can be recorded, and the timestamp information of each frame of the CAN message data received by the encoder can be recorded. Based on the initial time when the CAN message collection starts and the timestamp information of each frame of the received message data, it can be determined whether the received message data is within the set desired time period. It is understood that when the set desired time period changes, the number of frames of message data of each category received within the desired time period will change. For example, in the above embodiment, the number m of frames of message data of category A collected can be adjusted based on the set desired time period.

[0045] In step S2, the difference terms between temporally adjacent frames of CAN messages of the same type can be calculated. Here, the difference term D between each byte of temporally adjacent frames of CAN messages of the same type can be calculated. This difference term D reflects the signal change of the current frame's message data relative to the previous frame's message data. For example, for the m frames of A-type message data selected above, an m-1 row n column difference term matrix can be obtained. For instance, the difference term D between each byte of the A-type message data in the second frame and the corresponding byte of the A-type message data in the first frame. 11 To Dn1 The following can be calculated:

[0046] D 11 =A 21 -A 11 D 21 =A 22 -A 12 D 31 =A 23 -A 13 D 41 =A 24 -A 14 D 51 =A 25 -A 15 ,

[0047] D 61 =A 26 -A 16 D 71 =A 27 -A 17 D 81 =A 28 -A 18 ,…D n1 =A 2n -A 1n

[0048] The difference term D between the Class A message data in the third frame and the Class A message data in the second frame 12 To D n2 The following can be calculated:

[0049] D 12 =A 31 -A 21 D 22 =A 32 -A 22 D 32 =A 33 -A 23 D 42 =A 34 -A 24 D 52 =A 35 -A 25 ,

[0050] D 62 =A 36 -A 26 D 72 =A 37 -A 27 D 82 =A 38 -A 28 ,…D n2 =A3n -A 2n

[0051] The difference term D between the Class A message data in frame m and the Class A message data in frame (m-1) is... 1(m-1) To D n(m-1) The following can be calculated:

[0052] D 1(m-1) =A m1 -A (m-1)1 D 2(m-1) =A m2 -A (m-1)2 D 3(m-1) =A m3 -A (m-1)3 D 4(m-1) =A m4 -A (m-

[0053] 1)4 D 5(m-1) =A m5 -A (m-1)5 D 6(m-1) =A m6 -A (m-1)6 D 7(m-1) =A m7 -A (m-1)7 D 8(m-1) =A m8 -

[0054] A (m-1)8 ,…D n(m-1) =A mn -A (m-1)n

[0055] In step S3, adjacent difference items with the same value in the sequentially arranged difference items can be merged into one difference item, and the number of merged items contained in each merged difference item is determined. Here, the calculated difference items can be arranged according to the time order of the data in each frame of the message based on the assigned byte. For example, for the first byte of the message data of each frame of type A, the calculated difference items are sequentially sorted into D according to the time order of the message data in each frame. 11 D 12 D 13 ,…D 1(m-1) For the second byte of the message data of each frame of type A, sort the calculated difference terms sequentially according to the time order of the message data of each frame as D. 21 D 22 D 23 ,…D 2(m-1)Similarly, for the nth byte of the message data of each frame of type A, the calculated difference terms are sorted sequentially according to the time order of the message data of each frame as D. n1 D n2 D n3 ,…D n(m-1) .

[0056] For the aforementioned sequentially arranged difference terms, adjacent difference terms with the same value can be merged into one difference term, and the number of merged difference terms can be counted to determine how many original difference terms each merged difference term was derived from. The final number of merged difference terms depends on the signal value variation of the message data. This includes not only the frequency of signal changes, which reflects the variability of signal value changes, but also the difference in signal changes, which reflects whether the signal value changes uniformly. If the frequency of signal value changes in the message data is higher and the changes are non-uniform, then there will be fewer adjacent difference terms with the same value, resulting in a larger number of merged difference terms, and each merged difference term will contain fewer merged terms.

[0057] For example, for CAN messages where the signal value of the message data does not change or changes uniformly, the adjacent difference term D of the first byte of the message data... 11 D 12 D 13 ,…D 1(m-1) All are equal, and these adjacent difference terms can be combined into a single difference term D. 11 And the number of combined terms C of this difference term nt11 It equals m-1. If the signal value of the message data varies non-uniformly, the adjacent difference term D of the first byte of the message data... 11 D 12 D 13 ,…D 1(m-1) The number of adjacent difference terms with the same value will decrease, and the final difference term D obtained by merging will be reduced. 1i The number i will increase, and the number C of merged terms contained in each merged difference term will also increase. nt1i It will decrease.

[0058] Similarly, for the adjacent difference term D of the second byte of the message data 21 D 22 D 23 ,…D 2(m-1) The same merging and statistical process can be performed to obtain the merged difference term D. 2i And the number of merged terms C contained in each merged difference term. nt2i And so on, until the adjacent difference term D of the nth byte of the message data is obtained. n1 D n2 Dn3 ,…D n(m-1) All of them undergo similar merging and statistical processes to obtain the merged difference term D. ni And the number of merged terms C contained in each merged difference term. ntni .

[0059] In step S4, the first frame data of various types of CAN messages, as well as the values ​​and number of merged differential items of the CAN messages belonging to the corresponding class, can be stored. For example, the first frame data of message data of category A can be stored. 11 A 12 A 13 A 14 A 15 A 16 A 17 A 18 ,…A 1n And the merged difference items and merged item number of category A message data, such as difference item D. 1i and the number of combined items C nt1i Difference term D 2i and the number of combined items C nt2i ...difference term D ni and the number of combined items C ntni .

[0060] The same encoding method can be applied to both Class B and Class C message data. The encoding process is similar to that described above for Class A message data, and will not be repeated here.

[0061] According to the above embodiments of this application, periodic messages with the same CAN ID are filtered from the collected CAN messages according to their identifiers. By calculating and merging the difference terms of time-adjacent frames of periodic message data, the change information of each frame of the same type of CAN message can be effectively extracted. Thus, the encoding of this type of CAN message can be completed using the first frame of the message data, the merged difference terms, and the number of merged terms. This encoding method can significantly compress repetitive data in periodic messages, effectively saving storage space and transmission bandwidth occupied by message data records.

[0062] Figure 3 A flowchart illustrating a method for encoding CAN messages according to another exemplary embodiment of this application is shown. The following only describes the method in relation to... Figure 1 The differences between the embodiments shown are omitted for brevity, and the same steps will not be repeated.

[0063] like Figure 3As shown, the method may further include steps S41 and S42. In step S41, the compression ratio of the corresponding class of CAN message can be determined based on the number of merged differential items. Here, the number of merged items reflects the number of adjacent differential items with the same value. Since adjacent differential items with the same value are merged into the same differential item, the number of merged differential items can be used to determine how many original differential items were merged into the merged differential item.

[0064] For example, for CAN messages where the signal value of the message data does not change or changes uniformly, the adjacent difference term D of the first byte of the message data of category A... 11 D 12 D 13 ,…D 1(m-1) Since they are all equal, these m-1 adjacent difference terms can be combined into a single difference term D. 11 The number of merged items C nt11 The value is equal to m-1, thus determining that the compression ratio of the first byte of the message data is m-1:1.

[0065] For example, for CAN messages with non-uniformly varying signal values, regarding the adjacent difference term D of the second byte of the message data in category A... 21 D 22 D 23 ,…D 2(m-1) They are combined into difference terms D respectively. 21 D 23 and D 26 The number of merged items is 2, 3, and m-6 respectively, thus determining the compression ratio of the second byte of the message data as m-1:3. Similarly, the compression ratio of each byte of the message data can be determined, and the compression ratio of category A message data can be determined based on the compression ratio of all n bytes.

[0066] In step S42, the determined compression ratio can be stored as an additional flag bit for the CAN message belonging to the corresponding class. In the above embodiment, the determined compression ratio can be stored as an additional flag bit for the CAN message belonging to class A, to characterize the compression ratio of the encoded data stored in step S4—that is, the first frame message data of the CAN message of class A and the merged differential items and the number of merged items of the CAN message belonging to class A.

[0067] It is understandable that for CAN messages collected within the same time period, the signal values ​​of the status signals of the same type of vehicle components will change differently under different vehicle operating conditions. Therefore, the compression ratio of the CAN messages collected within the same time period using the method for encoding CAN messages according to this application will also be different. This results in unequal amounts of data stored after compression encoding, which will vary with different vehicle operating conditions. In particular, the more frequent the signal changes of the status signals of vehicle components, the larger the amount of data stored after compression encoding.

[0068] Figure 4 A flowchart illustrating a method for encoding CAN messages according to another exemplary embodiment of this application is shown. The following only describes the method in relation to... Figure 1 The differences between the embodiments shown are omitted for brevity, and the same steps will not be repeated.

[0069] like Figure 4 As shown, the method may further include step S43. In step S43, the compression ratio of the corresponding class of CAN messages can be determined based on the number of merged differential items, and it is determined whether the determined compression ratio exceeds a preset threshold. When the signal value of a certain type of message data changes at a high frequency and non-uniformly, the number of merged differential items in that type of message data is small, and its compression ratio is also low.

[0070] Understandably, a low compression ratio means that the decoding method according to this application cannot effectively compress the acquired CAN messages. Therefore, the computing power required for encoding and decoding the message data is no longer wasted. Instead, step S4 is executed only when the determined compression ratio exceeds a preset threshold. This step involves storing the first frame message data of each type of CAN message, as well as the value of the merged differential item and the number of merged items of the CAN message belonging to the corresponding type.

[0071] Figure 5 A flowchart illustrating a method for encoding CAN messages according to another exemplary embodiment of this application is shown. The following only describes the method in relation to... Figure 1 The differences between the embodiments shown are omitted for brevity, and the same steps will not be repeated.

[0072] like Figure 5As shown, the method may further include step S5. In step S5, identifiers and / or timestamp information of each frame of message data belonging to various types of CAN messages may be stored. Here, the identifier of the message data—i.e., the CAN ID—can characterize the CAN message category to which the frame of message data belongs; the timestamp information of the message data can characterize the time sequence of the frame of message data in the acquired CAN messages. This information can be used in the decoding process of CAN messages, which will be described in detail in the method for decoding CAN messages encoded by the method according to this application.

[0073] Figure 6 A flowchart illustrating a method for decoding CAN messages according to an exemplary embodiment of this application is shown.

[0074] like Figure 6 As shown, the method may include steps S1' and S2'. In step S1', the difference items between temporally adjacent frames of CAN messages of the corresponding type can be restored based on the merged difference items and the number of merged items associated with each type of CAN message. For each byte of the message data in each frame of the same type of CAN message, the original difference items between temporally adjacent frames of message data can be restored using the merged difference items and the number of merged items.

[0075] For example, the merged difference item D for the first byte of message data of category A in the above embodiments 11 Given its merging term m-1, the original difference term D between the first byte of each temporally adjacent frame of message data can be reconstructed. 11 D 12 D 13 ,…D 1(m-1) The values ​​of these original difference terms are all equal.

[0076] Regarding the merged difference item D of the second byte of the message data of category A in the above embodiment... 21 D 23 and D 26 With its combined terms 2, 3, and m-6, the original difference term D between the second bytes of the time-adjacent frames of message data can be reconstructed. 21 D 22 D 23 ,…D 2(m-1) Among them, the difference term D 21 With D 22 Equal, difference term D 23 D 24 With D 25 Equal, difference term D 26 D 27 ,…D2(m-1) They are equal. By analogy, the original difference term D between the nth byte of each temporally adjacent frame of message data can be reconstructed. n1 D n2 D n3 ,…D n(m-1) .

[0077] In step S2', the data of each frame of a CAN message of a certain type can be determined based on the first frame data of each type of CAN message and the restored differential terms of the corresponding CAN message. To obtain the decoded value of each byte of the data of each frame of CAN messages of the same type, the restored differential terms of the corresponding bytes are sequentially superimposed according to the time order of the data of each frame, starting from the corresponding byte of the first frame data of the corresponding CAN message.

[0078] For example, in order to obtain the decoded value of the first byte of the message data of type A in the above embodiment, the first byte A of the first frame message data is... 11 The difference term D between the first byte of the second frame data and the first byte of the first frame data is superimposed. 11 The first byte A of the second frame data can then be recovered. 21 ; the first byte A of the second frame message data 21 The difference term D between the first byte of the third frame data and the first byte of the second frame data is superimposed. 12 The first byte A of the third frame data can then be obtained. 31 ; and so on, the first byte A of the data in the (m-1)th frame is... (m-1)1 The difference term D between the first byte of the data in frame m and the first byte of the data in frame (m-1) is superimposed. 1(m-1) The first byte A of the m-th frame data can then be recovered. m1 .

[0079] Similarly, in order to obtain the decoded value of the second byte of the A-type message data in the above embodiment, the second byte A of the first frame message data is... 12 The difference term D between the second byte of the second frame data and the second byte of the first frame data is superimposed. 12 The second byte A of the second frame data can then be obtained. 22 ; the second byte A of the third frame message data 22 The difference term D between the second byte of the superimposed third frame data and the second byte of the third frame data. 22 The second byte A of the third frame data can then be obtained. 32 ; and so on, the second byte A of the (m-1)th frame message data (m-1)3The difference term D between the second byte of the m-th frame data and the second byte of the (m-1)-th frame data is superimposed. 2(m-1) The second byte A of the m-th frame data can then be obtained. m2 .

[0080] By repeating the above process, the decoded value A of the nth byte of the message data of type A can be obtained sequentially. 1n A 2n A 3n ,…,A mn .

[0081] The same decoding method can be used for both Class B and Class C message data. The decoding process is similar to that described above for Class A message data, and will not be repeated here.

[0082] According to the above embodiments of this application, the original difference terms between time-adjacent frames of CAN messages of the same type can be restored by merging the difference terms and the number of merged terms. After introducing the first frame of message data of the corresponding type, the decoded values ​​of each frame of message data can be quickly restored through iterative calculation. This decoding method can quickly and efficiently decode CAN messages encoded by the method of this application.

[0083] Figure 7 A flowchart illustrating a method for decoding CAN messages according to another exemplary embodiment of this application is shown. The following only describes the method in relation to... Figure 6 The differences between the embodiments shown are omitted for brevity, and the same steps will not be repeated.

[0084] like Figure 7 The method may further include step S3'. In step S3', an identifier belonging to the corresponding frame message data can be added to the data header of each determined frame message data. For example, a CAN ID of type A is added to the data header of each frame message data of all type A CAN messages; a CAN ID of type B is added to the data header of each frame message data of all type B CAN messages; a CAN ID of type B is added to the data header of each frame message data of all type C CAN messages, and so on.

[0085] Figure 8 A flowchart illustrating a method for decoding CAN messages according to another exemplary embodiment of this application is shown. The following only describes the method in relation to... Figure 7 The differences between the embodiments shown are omitted for brevity, and the same steps will not be repeated.

[0086] like Figure 8The method may further include step S4'. In step S4', the determined frame message data can be sorted based on the timestamp information of each stored frame message data. Here, the timestamp information of each frame message data can determine the time difference between the reception time of the corresponding frame message data received by the encoder and the initial time of starting CAN message acquisition. Therefore, the determined frame message data can be sorted according to the reception time order of the message data from the initial time of starting CAN message acquisition, thereby obtaining the frame message data of CAN messages recorded in chronological order:

[0087] A 11 A 12 A 13 A 14 A 15 A 16 A 17 A 18 ,…A 1n

[0088] B 11 B 12 B 13 B 14 B 15 B 16 B 17 B 18 ,…B 1n

[0089] C 11 C 12 C 13 C 14 C 15 C 16 C 17 C 18 ,…C 1n

[0090] A 21 A 22 A 23 A 24 A 25 A 26 A 27 A 28 ,…A 2n

[0091]

[0092] A 31 A 32 A 33 A 34 A 35 A 36 A 37 A38 ,…A 3n

[0093]

[0094] A m1 A m2 A m3 A m4 A m5 A m6 A m7 A m8 ,…A mn

[0095] In addition, it should be noted that the step numbers described herein do not necessarily represent the order of steps, but are merely a reference numeral. The order may be changed depending on the specific circumstances, as long as the technical objective of this application can be achieved.

[0096] It should be understood that the terms “first,” “second,” “third,” etc., used in this document are for descriptive purposes only and should not be construed as indicating or implying relative importance, nor should they be construed as implicitly specifying the number of technical features indicated.

[0097] If an embodiment includes an "and / or" association between a first feature and a second feature, it should be interpreted as follows: according to one implementation, the embodiment has not only the first feature but also the second feature; according to another implementation, the embodiment has either only the first feature or only the second feature.

[0098] Although specific embodiments have been described above, these embodiments are not intended to limit the scope of this application, even when only a single embodiment is described with respect to a particular feature. The feature examples provided in this application are intended for illustrative purposes and not for limitation, unless otherwise stated. In practice, multiple features may be combined with each other as needed and where technically feasible. Various substitutions, modifications, and alterations are also conceived without departing from the spirit and scope of this application.

Claims

1. A method for encoding CAN messages, the method comprising: The collected CAN messages are classified based on the identifier of the CAN message; Calculate the difference between time-adjacent frames of CAN messages of the same type; Adjacent difference terms with the same value in the sequentially arranged difference terms are merged into one difference term, and the number of merged terms contained in each merged difference term is determined; and It stores the first frame data of various CAN messages, as well as the merged differential items and the number of merged items of the CAN messages belonging to the corresponding class.

2. The method according to claim 1, wherein, Calculate the difference terms between corresponding bytes of time-adjacent CAN message frames, and arrange the calculated difference terms according to the time order of the assigned bytes.

3. The method according to claim 1, wherein, The method further includes: The compression ratio of the corresponding class of CAN messages is determined based on the number of merged differential items; and The determined compression ratio is stored as an additional flag bit for the CAN message belonging to the corresponding class.

4. The method according to claim 3, wherein, If the determined compression ratio exceeds the preset threshold, store the first frame data of each type of CAN message, as well as the value of the merged differential item and the number of merged items of the CAN message belonging to the corresponding class.

5. The method according to any one of claims 1 to 4, wherein, The method further includes: Stores the identifiers and / or timestamp information of each frame of message data associated with various types of CAN messages.

6. The method according to any one of claims 1 to 4, wherein, The CAN message includes CAN messages about the status signals of various vehicle components, and each CAN message about the status signal of a vehicle component is assigned a corresponding identifier. The status signals of the vehicle components include, for example, vehicle speed signal, throttle status signal, transmission status signal, air conditioning status signal, headlight status signal, window status signal, steering status signal, braking status signal, engine status signal and / or tire pressure status signal.

7. The method according to any one of claims 1 to 4, wherein, The method further includes: Set the desired time period for the CAN message to be encoded, and collect the CAN message based on the timestamp information of the CAN message within the set desired time period.

8. A method for decoding a CAN message encoded by the method according to any one of claims 1 to 7, the method comprising: Based on the merged difference items and the number of merged items belonging to various types of CAN messages, the difference items between the time-adjacent frames of CAN messages of the corresponding type are restored respectively. and The data of each frame of the CAN message of the corresponding class is determined based on the first frame data of each type of CAN message and the restored differential terms of the CAN message belonging to the corresponding class.

9. The method according to claim 8, wherein, In order to obtain the decoded values ​​of each byte of the data in each frame of the same type of CAN message, starting from the corresponding byte of the first frame of the corresponding type of CAN message, the restored differential terms belonging to the corresponding byte are sequentially superimposed according to the time order of the data in each frame of the message.

10. The method according to claim 8 or 9, wherein, The method further includes: Add an identifier belonging to the corresponding frame of message data to the header of each determined frame of message data; and / or The determined frame of message data is sorted based on the timestamp information of each stored frame of message data.

11. A computer program product, such as a computer-readable program carrier, comprising computer program instructions that, when executed by a processor, at least auxiliaryly implement the steps of the method according to any one of claims 1 to 10.