Methods, apparatus, electronic devices, and storage media for comparing differences in DBC files.

By employing block reading and index creation techniques, the problem of existing tools being unable to deeply understand the semantics of DBC files is solved, enabling fast and accurate comparison of DBC file differences and generation of detailed difference summaries.

CN119538902BActive Publication Date: 2025-10-28CHONGQING SELIS PHOENIX INTELLIGENT INNOVATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411592850.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-08
Publication Date
2025-10-28
Estimated Expiration
2044-11-08

AI Technical Summary

Technical Problem

Existing file comparison and difference comparison tools cannot deeply understand the semantics of DBC files, resulting in the inability to generate accurate difference summaries. Furthermore, manual inspection is prone to errors and is time-consuming.

Method used

By acquiring different versions of DBC files, reading data in blocks using multiple keywords, creating message indexes and signal indexes, and comparing the differences between the objects to be compared based on preset difference types, version difference information is generated.

Benefits of technology

It enables precise and rapid semantic location of changes in each message and signal based on DBC files, providing detailed change information and reducing manual operation time and error rate.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119538902B_ABST
    Figure CN119538902B_ABST
Patent Text Reader

Abstract

This application provides a method, apparatus, electronic device, and storage medium for comparing differences in DBC files. The method includes acquiring different versions of DBC files to be compared, reading data in blocks according to multiple keywords of the DBC files to be compared to obtain respective comparison objects, creating message indexes and signal indexes for the comparison objects, and classifying and comparing the differences between the comparison objects based on a preset difference type, each message index, and each signal index to obtain version difference information. The preset difference type is used to characterize the differences corresponding to the message level and signal level in the DBC files to be compared. This application can accurately and quickly locate the changes in each message and signal based on the semantics of the DBC files to be compared and provide detailed change information.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of DBC difference detection technology, and in particular to a method, apparatus, electronic device and storage medium for comparing differences in DBC files. Background Technology

[0002] In modern automotive electronic systems, communication between vehicle control units typically uses the Controller Area Network (CAN) bus protocol. The CAN Database (DBC) file describes the CAN bus communication protocol, defining signals, messages, and their associated attribute parameters. Different versions of the DBC file are generated with each software update. The differences between these DBC files are crucial information for generating the interface of the integrated software model. Therefore, quickly and accurately generating a summary of the differences between the DBC files is essential for software model interfaces and software integration, and provides a key basis for integration automation. However, external comparison tools are generally needed to handle the differences in the DBC files.

[0003] Currently, common methods for identifying differences in DBC files include file comparison tools, difference comparison tools, and manual inspection. File comparison tools include Beyond Compare, which supports line-by-line comparison of text files, highlights differences, and can compare various file formats, including DBC files. However, due to the complexity and specific structure of DBC files, Beyond Compare can only perform surface-level text comparisons and cannot deeply understand the semantic level of DBC files. It cannot effectively identify and process signal-level and / or message-level changes, nor can it generate difference summaries. Furthermore, Beyond Compare is paid software. Difference comparison tools include Diff, which can compare differences between text files, provided via command line or graphical interface, and can quickly identify differences between two text files. However, similar to Beyond Compare, difference comparison tools can only perform literal text comparisons and cannot analyze the structure and semantics of DBC files, easily missing potentially important changes or providing irrelevant change information. Engineers manually reviewing and comparing two versions of DBC files is suitable for situations with minor or simple changes; manual inspection is not only time-consuming but also prone to human error, especially with complex DBC files or a large number of signal changes. Existing technical methods all have limitations in their ability to deeply understand the semantics of DBC files, thus making it impossible to generate difference summary reports. Summary of the Invention

[0004] This application provides a method, apparatus, electronic device, and storage medium for comparing differences in DBC files, in order to solve the aforementioned technical problem of being unable to quickly perform difference comparisons based on the semantics of the DBC files to be compared.

[0005] In one embodiment of this application, a method for comparing differences in DBC files is provided, including obtaining different versions of DBC files to be compared; reading data in blocks according to multiple keywords of the DBC files to be compared to obtain respective comparison objects; creating message indexes and signal indexes for the comparison objects; classifying and comparing the differences of the comparison objects based on a preset difference type, each message index, and each signal index to obtain version difference information, wherein the preset difference type is used to characterize the differences corresponding to the message level and signal level in the DBC files to be compared.

[0006] In one embodiment of this application, the object to be compared includes the message identifier, the message object, the signal name, and the signal object. Creating a message index and a signal index for the object to be compared includes: using the message identifier as the index identifier of the message index and the message object as the index value of the message index, wherein the message object is used to represent a message attribute value and the message identifier is used to uniquely identify the message; using the message identifier as the index identifier of the signal index and a secondary index as the index value of the signal index, wherein the index identifier of the secondary index is the signal name and the index value of the secondary index is the signal object, wherein the signal object is used to represent a signal attribute value.

[0007] In one embodiment of this application, data is read in blocks based on multiple keywords of the DBC file to be compared to obtain the comparison object. This includes: dividing the DBC file to be compared into blocks according to multiple keywords and storing them in a cache; creating multiple conversion coroutines and multiple channels based on the number of keywords; performing structured conversion and validity verification on the attribute value data after the corresponding keyword in the cache through each conversion coroutine, and sending the structured data that passes the validity verification to the corresponding channel or generating error message information based on the structured data that fails the validity verification, wherein the structured data is used to represent the attribute value data after structured conversion, and the attribute value data is used to represent the attribute values ​​corresponding to messages and signals; if no error message information is generated, the structured data received by each of the channels is summarized in sequence to obtain the comparison object.

[0008] In one embodiment of this application, version difference information is obtained by classifying and comparing the differences of the objects to be compared based on a preset difference type, each of the message indices, and each of the signal indices. This includes: creating a shared data structure; creating multiple comparison coroutines based on the preset difference type; and using each comparison coroutine to compare the differences of the objects to be compared corresponding to the preset difference type based on each of the message indices and each of the signal indices to obtain version difference information, which is then stored in the shared data structure. The shared data structure is used by each comparison coroutine to simultaneously store the difference data compared according to the preset difference type.

[0009] In one embodiment of this application, version difference information is obtained by comparing the differences of the objects to be compared with each of the message indexes and the signal indexes according to the preset difference types. This includes: if the preset difference type is a new difference or a deleted difference, calculating the difference set of the preset difference types corresponding to different versions of the data sets to be compared to obtain new information or deleted information; if the preset difference type is a signal modification, comparing the key attributes of the signal according to the signal combination identifier set of different versions to obtain signal modification information; wherein, the data sets to be compared include a message identifier set or a signal combination identifier set, the message identifier set is obtained based on the message index, the signal combination identifier set is obtained by combining message identifiers and signal names based on the signal index, and the version difference information includes the new information, the deleted information, and the signal modification information.

[0010] In one embodiment of this application, if the preset difference type is an addition difference or a deletion difference, the difference set corresponding to the preset difference type for different versions of the data sets to be compared is calculated to obtain the addition information or deletion information, including: if the addition difference is the addition of a message, the difference set between the current message identifier set and the historical message identifier set is calculated to obtain the addition message identifier; if the deletion difference is the deletion of a message, the difference set between the historical message identifier set and the current message identifier set is calculated to obtain the deletion message identifier; if the addition difference is the addition of a signal, the difference set between the current signal combination identifier set and the historical signal combination identifier set is calculated to obtain the addition signal combination identifier; if the addition difference is the deletion of a signal, the difference set between the historical signal combination identifier set and the current signal combination identifier set is calculated to obtain the deletion signal combination identifier; wherein, the addition information includes the addition message identifier and the addition signal combination identifier, the deletion information includes the deletion message identifier and the deletion signal combination identifier, and the different versions of the data sets to be compared include the current message identifier set, the historical message identifier set, the current signal combination identifier set, and the historical signal combination identifier set.

[0011] In one embodiment of this application, signal modification information is obtained by comparing key attributes of a signal based on different versions of signal combination identifier sets. This includes: if a current signal combination identifier and a historical signal combination identifier are the same, then the current key attributes and the historical key attributes are compared to obtain the signal modification information of the current signal combination identifier; wherein the current key attributes are obtained based on the signal index corresponding to the current signal combination identifier, and the historical key attributes are obtained based on the signal index corresponding to the historical signal combination identifier.

[0012] In one embodiment of this application, a DBC file difference comparison device is provided, comprising: a file acquisition module for acquiring different versions of DBC files to be compared; a data reading module for reading data in blocks according to multiple keywords of the DBC files to be compared, to obtain respective comparison objects; a data classification module for creating message indexes and signal indexes of the comparison objects; and a difference comparison module for classifying and comparing the differences of the comparison objects based on a preset difference type, each message index, and each signal index to obtain version difference information, wherein the preset difference type is used to characterize the differences corresponding to the message level and signal level in the DBC files to be compared.

[0013] In one embodiment of this application, an electronic device is provided, the electronic device comprising: one or more processors; and a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the electronic device implements the DBC file difference comparison method as described in any of the above embodiments.

[0014] In one embodiment of this application, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by the processor of a computer, the computer performs the DBC file difference comparison method described in any of the above embodiments.

[0015] The beneficial effects of the embodiments of this application are as follows: This application provides a method, apparatus, electronic device and storage medium for comparing differences in DBC files. The embodiments of this application read data in blocks by using multiple keywords of the DBC files to be compared, obtain the respective objects to be compared, and establish message index and signal index to classify and compare the differences of different objects to be compared, thereby obtaining version difference information. This application can accurately and quickly locate the changes of each message and signal based on the semantics of the DBC file and provide detailed change information.

[0016] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description

[0017] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application. It is obvious that the drawings described below are merely some embodiments of this application, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort. In the drawings:

[0018] Figure 1 A flowchart illustrating a method for comparing differences in DBC files according to an embodiment of this application is shown.

[0019] Figure 2 A schematic diagram illustrating the implementation flow of a DBC file difference comparison method according to an embodiment of this application is shown;

[0020] Figure 3 A block diagram of a DBC file difference comparison apparatus according to an embodiment of this application is shown;

[0021] Figure 4 A schematic diagram of the structure of a computer system suitable for implementing an electronic device according to an embodiment of the present application is shown. Detailed Implementation

[0022] The following specific examples illustrate the implementation of this application. Those skilled in the art can easily understand other advantages and effects of this application from the content disclosed in this specification. This application can also be implemented or applied through other different specific embodiments, and various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of this application. It should be noted that, unless otherwise specified, the following embodiments and features in the embodiments can be combined with each other.

[0023] It should be noted that the illustrations provided in the following embodiments are only schematic representations of the basic concept of this application. Therefore, the drawings only show the components related to this application and are not drawn according to the actual number, shape and size of the components in the actual implementation. In the actual implementation, the form, quantity and proportion of each component can be arbitrarily changed, and the layout of the components may also be more complex.

[0024] In the following description, numerous details are explored to provide a more thorough explanation of embodiments of the present application. However, it will be apparent to those skilled in the art that embodiments of the present application may be practiced without these specific details. In other embodiments, well-known structures and devices are shown in block diagram form rather than in detail to avoid obscuring embodiments of the present application.

[0025] In related technologies, traditional difference comparison tools, such as Beyond Compare and Diff, cannot quickly perform difference comparisons based on the semantics of the DBC files to be compared.

[0026] To address the aforementioned technical problems, this application provides a method, apparatus, electronic device, and storage medium for comparing differences in DBC files. The implementation details of the technical solutions in the embodiments of this application are described in detail below.

[0027] Please see Figure 1 , Figure 1 A flowchart illustrating a method for comparing differences in DBC files according to an embodiment of this application is shown. Figure 1 As shown, in an exemplary embodiment, the method for comparing differences in DBC files includes at least steps S110 to S140, which are described in detail below:

[0028] Step S110: Obtain different versions of the DBC files to be compared.

[0029] In one embodiment of this application, the Controller Area Network (CAN) database (DBC) file is a file that describes the Controller Area Network (CAN) bus protocol and defines signals, messages and their related attribute parameters, such as identifier (ID), weekly data length, signal name, signal range, offset, precision, etc.

[0030] In one embodiment of this application, the DBC files to be compared include the current version of the DBC file and historical versions of the DBC file. The historical versions include at least one version prior to the current version, and the current version includes the latest version or a version prior to the latest version.

[0031] In one embodiment of this application, during system upgrades, function updates, performance optimizations, and error repairs of various controllers, messages and signals are updated to support these updates. At this time, the version of the DBC file will be changed accordingly and stored in the management system.

[0032] In one embodiment of this application, different versions of the DBC files to be compared are obtained from a management system that stores multiple versions of DBC files. The management system includes a version control system, a project directory structure, configuration management tools, a dedicated database, a file server, a continuous integration / continuous delivery (CI / CD) pipeline, a document management system, local backups, etc.

[0033] Step S120: Read data in blocks according to multiple keywords of the DBC files to be compared, and obtain the respective comparison objects.

[0034] In one embodiment of this application, data is read in blocks based on multiple keywords of the DBC file to be compared to obtain the comparison object. This includes: dividing the DBC file to be compared into blocks according to multiple keywords and storing them in a cache; creating multiple conversion coroutines and multiple channels based on the number of keywords; performing structured conversion and validity verification on the attribute value data after the corresponding keyword in the cache through each conversion coroutine, and sending the structured data that passes the validity verification to the corresponding channel or generating error message based on the structured data that fails the validity verification. The structured data is used to represent the attribute value data after structured conversion, and the attribute value data is used to represent the attribute values ​​corresponding to messages and signals; if no error message is generated, the structured data received by each channel is summarized in sequence to obtain the comparison object.

[0035] In one embodiment of this application, the DBC file uses different keywords to represent different semantic information. These keywords include "VERSION" (representing the version), "BA_DEF_" (representing the type and scope of a custom attribute), "BA_DEF_DEF_" (representing the default value of a custom attribute), "BO_" (representing a message), "SG_" (representing a signal), "CM_" (representing a comment), and "BU_" (representing a node).

[0036] In one embodiment of this application, the DBC file to be compared is divided into blocks by multiple keywords in the DBC file to be compared, and the data is read into the buffer. Blocking can reduce the amount of data processed each time.

[0037] In one embodiment of this application, a message is uniquely identified by a message ID.

[0038] In one embodiment of this application, the block data corresponding to the keyword "BO_" in the buffer, such as "BO_100MotorStatus:8", represents the attribute value corresponding to a message. The block data is structured and converted into structured data, such as message identifier ID is 100, message name is MotorStatus (motor status), and message length is 8 bytes.

[0039] In one embodiment of this application, n conversion coroutines are created to parse the data in the buffer. The number of conversion coroutines n is equal to the number of keywords. A coroutine is a user-mode thread.

[0040] In one embodiment of this application, parsing the data includes converting the data following the keywords into structured data, such as a structure or dictionary.

[0041] In one embodiment of this application, n channels are created to receive and process data, where the number of channels n is equal to the number of keywords.

[0042] In one embodiment of this application, during the data parsing process, the legality of the DBC files to be compared is verified, such as the accuracy of the DBC syntax, the repetition of the signal start bit, and whether the data frame size is appropriate.

[0043] In one embodiment of this application, sending structured data that has passed the validity check to the corresponding channel or generating an error message based on structured data that has failed the validity check includes: if the number of failed checks in a conversion goroutine is less than a preset threshold, then sending the structured data that has passed the validity check to the channel corresponding to the conversion goroutine; if the number of failed checks in a conversion goroutine is greater than or equal to the preset threshold, then generating an error message; wherein, the number of failed checks is used to characterize the number of structured data that has failed the validity check.

[0044] In one embodiment of this application, the preset threshold can be set to 1, that is, if illegal structured data is detected, the error will be exited; the preset threshold can be set to a percentage threshold of the total number of structured data, that is, the error will be exited only if some or all of the structure or data fails the legality check.

[0045] In one embodiment of this application, the data of the channels are summarized sequentially to obtain the summarized comparison object.

[0046] Step S130: Create message index and signal index for the objects to be compared.

[0047] In one embodiment of this application, the objects to be compared include a message identifier, a message object, a signal name, and a signal object. Creating a message index and a signal index for the objects to be compared includes: using the message identifier as the index identifier of the message index and the message object as the index value of the message index, where the message object is used to represent message attribute values ​​and the message identifier is used to uniquely identify the message; using the message identifier as the index identifier of the signal index and the secondary index as the index value of the signal index, where the index identifier of the secondary index is the signal name and the index value of the secondary index is the signal object, where the signal object is used to represent signal attribute values.

[0048] In one embodiment of this application, a message index is created, with the index identifier (ID) being messageID and the index value being a message object.

[0049] In one embodiment of this application, a signal index is created, with the index ID being the message ID and the index value being the entire secondary index. The secondary index has the index ID being the signal name and the index value being the signal object. Using the signal index and message index, identical fields can be quickly located and compared, reducing redundant calculations.

[0050] In one embodiment of this application, message attribute values ​​are the values ​​of message attribute parameters, such as message name, period, message identifier, etc. Signal attribute values ​​are the values ​​of signal attribute parameters, such as signal name, signal range, offset, etc.

[0051] Step S140: Based on the preset difference type, message index and signal index, classify and compare the differences of the objects to be compared to obtain version difference information.

[0052] The preset difference type is used to characterize the differences between the message level and the signal level in the DBC file to be compared.

[0053] In one embodiment of this application, version difference information is obtained by classifying and comparing the differences of the objects to be compared based on a preset difference type, each message index, and each signal index. This includes: creating a shared data structure; creating multiple comparison coroutines based on the preset difference type; and using each comparison coroutine to compare the differences of the objects to be compared corresponding to the preset difference type based on each message index and each signal index to obtain version difference information, which is then stored in the shared data structure. The shared data structure is used by each comparison coroutine to simultaneously store the difference data compared according to the preset difference type.

[0054] In one embodiment of this application, a shared concurrency-safe map (sync.Map) of DBCCompareInfo is created to store the comparison results. Instead of a mutex, sync.Map is a thread-safe data structure that avoids the need for an explicit mutex.

[0055] In one embodiment of this application, version difference information is obtained by comparing the differences of the objects to be compared with each message index and each signal index according to a preset difference type. This includes: if the preset difference type is a new difference or a deleted difference, then the difference set of the preset difference type corresponding to different versions of the data sets to be compared is calculated to obtain new information or deleted information; if the preset difference type is a signal modification, then the key attributes of the signal are compared according to the signal combination identifier set of different versions to obtain signal modification information; wherein, the data sets to be compared include a message identifier set or a signal combination identifier set, the message identifier set is obtained based on the message index, the signal combination identifier set is obtained by combining the message identifier and the signal name based on the signal index, and the version difference information includes new information, deleted information, and signal modification information.

[0056] In one embodiment of this application, if the preset difference type is an addition difference or a deletion difference, the difference set corresponding to the preset difference type for different versions of the data sets to be compared is calculated to obtain the addition information or deletion information, including: if the addition difference is the addition of a message, the difference set between the current message identifier set and the historical message identifier set is calculated to obtain the addition message identifier; if the deletion difference is the deletion of a message, the difference set between the historical message identifier set and the current message identifier set is calculated to obtain the deletion message identifier; if the addition difference is the addition of a signal, the difference set between the current signal combination identifier set and the historical signal combination identifier set is calculated to obtain the addition signal combination identifier; if the addition difference is the deletion of a signal, the difference set between the historical signal combination identifier set and the current signal combination identifier set is calculated to obtain the deletion signal combination identifier; wherein, the addition information includes the addition message identifier and the addition signal combination identifier, the deletion information includes the deletion message identifier and the deletion signal combination identifier, and the different versions of the data sets to be compared include the current message identifier set, the historical message identifier set, the current signal combination identifier set, and the historical signal combination identifier set.

[0057] In one embodiment of this application, the preset difference types include types such as adding differences, deleting differences, and modifying signals. Adding differences includes adding messages and adding signals, while deleting differences includes deleting messages and deleting signals.

[0058] In one embodiment of this application, adding a message indicates that a message exists in the current version of the DBC file but not in a previous version of the DBC file; deleting a message indicates that a message does not exist in the current version of the DBC file but exists in a previous version of the DBC file; adding a signal indicates that a signal exists in the current version of the DBC file but not in a previous version of the DBC file; deleting a signal indicates that a signal does not exist in the current version of the DBC file but exists in a previous version of the DBC file; modifying a signal indicates that the signal attribute value of a signal in the current version of the DBC file differs from the signal attribute value of the signal in a previous version of the DBC file.

[0059] In one embodiment of this application, changes between two versions of a message can be categorized into five cases: the addition of a message, the deletion of a message, the addition of a signal, the deletion of a signal, and the modification of a signal. Thus, the comparison of changes can be achieved through five comparison goroutines.

[0060] In one embodiment of this application, in the comparison coroutines corresponding to the addition and deletion of messages, two sets of message identifiers are obtained based on the message index, such as the current message identifier set (CurrentMessageIDSet) corresponding to the current version and the historical message identifier set (PreviousMessageIDSet) corresponding to the historical version.

[0061] In one embodiment of this application, the addition of a message is achieved by obtaining the new message ID that exists in the current version but not in the previous version based on the difference between CurrentMessageIDSet and PreviousMessageIDSet, and then obtaining the attribute parameters of the new message based on the new message ID.

[0062] In one embodiment of this application, message deletion is performed by obtaining the deletion message ID that does not exist in the current version but exists in the previous version through the difference between PreviousMessageIDSet and CurrentMessageIDSet, thereby obtaining the attribute parameters of the deleted message based on the deletion message ID.

[0063] In one embodiment of this application, in the comparison coroutines corresponding to the addition, deletion, and modification of signals, two sets of signal combination identifiers are obtained based on the signal index, such as the current signal combination identifier set (PreviousSignalSet) corresponding to the current version and the historical signal combination identifier set (PrevioussignalIDSet) corresponding to the historical version.

[0064] In one embodiment of this application, the addition of a signal is achieved by obtaining the identifier of the new signal combination through the difference between CurrentSignalSet and PreviousSignalSet, thereby obtaining the corresponding attribute parameters.

[0065] In one embodiment of this application, the deletion of a signal is achieved by obtaining the deletion signal combination identifier through the difference between PreviousSignalSet and CurrentSignalSet, thereby obtaining the corresponding attribute parameters.

[0066] In one embodiment of this application, signal modification information is obtained by comparing key attributes of a signal based on different versions of the signal combination identifier set. This includes: if a current signal combination identifier and a historical signal combination identifier are the same, then the current key attributes and the historical key attributes are compared to obtain the signal modification information of the current signal combination identifier; wherein the current key attributes are obtained based on the signal index corresponding to the current signal combination identifier, and the historical key attributes are obtained based on the signal index corresponding to the historical signal combination identifier.

[0067] In one embodiment of this application, by iterating through two sets of signal combination identifiers, when the historical signal name and the current signal name under the same message identifier are the same, key attributes such as the signal's start bit, length, gain, offset, maximum value and minimum value are compared as the basis for signal modification.

[0068] In one embodiment of this application, after obtaining version difference information, a difference summary report is generated based on the version difference information to enhance readability.

[0069] In one embodiment of this application, the corresponding attribute parameters can be accessed by adding a message identifier, deleting a message identifier, adding a signal combination identifier, and deleting a signal combination identifier, thereby obtaining DBCCompareInfo to generate a difference summary report.

[0070] In one embodiment of this application, the version difference information in DBCCompareInfo is organized into a structured difference summary report, including newly added messages / signals, deleted messages / signals, modified messages / signals, and their detailed changes. The detailed changes can be displayed according to the design specifications of the DBC files being compared, indicating whether the changes are diagnostic information changes or general business information changes.

[0071] In one embodiment of this application, the format of the difference summary report includes HTML, PDF, or plain text. To facilitate reading and analysis by engineers, the difference summary report may include charts or highlighted key differences to enhance readability. Table 1 shows the content of a difference summary report:

[0072] Table 1 Summary Report of Differences

[0073]

[0074] The difference summary report includes the message name, hexadecimal message ID, and decimal message ID of newly added and deleted messages, as well as the corresponding description, such as diagnostic messages and business messages. The difference summary report also includes the message name, hexadecimal message ID, and decimal message ID of newly added, deleted, and modified signals, the signal name, and the corresponding description, such as the modified signal being described as a business message, with the signal start bit changed from 247 to 243.

[0075] In one embodiment of this application, please refer to Figure 2 , Figure 2 A schematic diagram illustrating the implementation flow of a DBC file difference comparison method according to an embodiment of this application is shown. As shown in Figure 2, the configuration file parsing system manages various configuration files required for system operation, including the path and multi-coroutine configuration of the DBC files to be compared; the DBC file parsing system divides the DBC files to be compared into blocks based on multiple keywords, and performs structured conversion and legality verification by creating multiple conversion coroutines to read data corresponding to the keywords, thereby summarizing the objects to be compared; error handling is used to generate error prompts based on data that fails the legality verification and exit the difference comparison; multi-coroutine message-level and signal-level comparison is performed: multiple comparison coroutines are created to compare message deletion, message addition, signal deletion, signal addition, and signal modification, and the version difference information is stored in a shared data structure; difference summary is performed: after the comparison is completed, the detailed changes in the differences can be summarized; and a report is generated: a difference summary report is generated. This application can automatically read the data of the DBC file to be compared and compare different versions of the DBC file to be compared, reducing the time and errors of manual operation; it can accurately and quickly locate the changes of each message and signal in the DBC file to be compared and provide detailed change information; the generated difference summary report has a clear structure and is highly readable, so that engineers can quickly understand and use it; this application can provide support for signal model generation and interface automation functions.

[0076] Please see Figure 3 , Figure 3 A block diagram of a DBC file difference comparison apparatus according to one embodiment of this application is shown. This embodiment does not limit the implementation environment to which this apparatus is applicable.

[0077] like Figure 3 As shown, a difference comparison device 300 for DBC files according to an embodiment of this application includes: a file acquisition 301, a data reading module 302, a data classification module 303, and a difference comparison module 304.

[0078] The file acquisition module 301 is used to acquire different versions of the DBC file to be compared.

[0079] The data reading module 302 is used to read data in blocks according to multiple keywords of the DBC file to be compared, and obtain the respective comparison objects;

[0080] Data classification module 303 is used to create message indexes and signal indexes for the objects to be compared;

[0081] The difference comparison module 304 is used to compare the differences between the objects to be compared based on the preset difference type, each message index and each signal index, and to obtain version difference information. The preset difference type is used to characterize the differences between the message level and the signal level in the DBC file to be compared.

[0082] It should be noted that the DBC file difference comparison device and the DBC file difference comparison method provided in the above embodiments belong to the same concept. The specific operation methods of each module and unit have been described in detail in the method embodiments and will not be repeated here. In practical applications, the DBC file difference comparison device provided in the above embodiments can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. This is not a limitation here.

[0083] Embodiments of this application also provide an electronic device, including: one or more processors; and a storage device for storing one or more programs, which, when executed by one or more processors, cause the electronic device to implement the DBC file difference comparison method provided in the above embodiments.

[0084] Please see Figure 4 , Figure 4 The following is a schematic diagram showing the structure of a computer system suitable for implementing an electronic device according to an embodiment of the present application. Figure 4 The computer system 400 of the electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.

[0085] like Figure 4As shown, the computer system 400 includes a Central Processing Unit (CPU) 401, which can perform various appropriate actions and processes, such as executing the methods described in the above embodiments, based on programs stored in Read-Only Memory (ROM) 402 or programs loaded from storage portion 408 into Random Access Memory (RAM) 403. The RAM 403 also stores various programs and data required for system operation. The CPU 401, ROM 402, and RAM 403 are interconnected via a bus 404. An Input / Output (I / O) interface 405 is also connected to the bus 404.

[0086] The following components are connected to the input / output interface 405: an input section 406 including a keyboard, mouse, etc.; an output section 407 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 408 including a hard disk, etc.; and a communication section 409 including a network interface card such as a LAN (Local Area Network) card, modem, etc. The communication section 409 performs communication processing via a network such as the Internet. A drive 410 is also connected to the input / output interface 405 as needed. A removable medium 411, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 410 as needed so that computer programs read from it can be installed into the storage section 408 as needed.

[0087] Specifically, according to embodiments of this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program including a computer program for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 409, and / or installed from removable medium 411. When the computer program is executed by central processing unit (CPU) 401, it performs various functions defined in the system of this application.

[0088] It should be noted that the computer-readable medium shown in the embodiments of this application can be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), flash memory, optical fiber, portable compact disc read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this application, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying a computer-readable computer program. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. A computer program embodied on a computer-readable medium may be transmitted using any suitable medium, including but not limited to wireless, wired, or any suitable combination thereof.

[0089] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present application. Among them, each box in the flowchart or block diagram can represent a module, program segment, or part of the code, and the above-mentioned module, program segment, or part of the code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0090] The units described in the embodiments of this application can be implemented in software or hardware, and the described units can also be located in a processor. The names of these units do not necessarily limit the specific unit itself. Therefore, the technical solutions according to the embodiments of this application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, touch terminal, or network device, etc.) to execute the methods according to the embodiments of this application.

[0091] Another aspect of this application provides a computer-readable storage medium storing a computer program thereon, which, when executed by a computer's processor, causes the computer to perform the DBC file difference comparison method provided in the various embodiments above. This computer-readable storage medium may be included in the electronic device described in the above embodiments, or it may exist independently and not assembled into the electronic device.

[0092] In the above embodiments, unless otherwise specified, the use of ordinal numbers such as "first" and "second" to describe common objects only indicates that they refer to different instances of the same object, rather than indicating that the objects being described must be in a given order, whether temporally, spatially, sequentially, or in any other way.

[0093] The above embodiments are merely illustrative of the principles and effects of this application and are not intended to limit this application. Any person skilled in the art can modify or alter the above embodiments without departing from the spirit and scope of this application. Therefore, all equivalent modifications or alterations made by those skilled in the art without departing from the spirit and technical concept disclosed in this application should still be covered by the claims of this application.

Claims

1. A method for comparing differences in DBC files, characterized in that, The method comprises: Obtain different versions of the DBC files to be compared; Data is read in blocks based on multiple keywords of the DBC files to be compared, and the respective comparison objects are obtained. Create a message index and a signal index for the objects to be compared; wherein the objects to be compared include the message identifier, the message object, the signal name, and the signal object, with the message identifier serving as the index identifier of the message index and the message object serving as the index value of the message index, the message object being used to represent message attribute values, and the message identifier being used to uniquely identify the message; the message identifier is also used as the index identifier of the signal index, and a secondary index is used as the index value of the signal index, the index identifier of the secondary index being the signal name, and the index value of the secondary index being the signal object, the signal object being used to represent signal attribute values; Based on a preset difference type, each message index, and each signal index, the differences between the objects to be compared are classified and compared to obtain version difference information. The preset difference type is used to characterize the differences between the message level and the signal level in the DBC file to be compared. A shared data structure is created; multiple comparison coroutines are created based on the preset difference type; each comparison coroutine compares the differences of the objects to be compared corresponding to the preset difference type based on each message index and each signal index to obtain version difference information, which is then stored in the shared data structure. The shared data structure is used by each comparison coroutine to simultaneously store the difference data compared according to the preset difference type.

2. The method for comparing differences in DBC files according to claim 1, characterized in that, Data is read in blocks based on multiple keywords of the DBC file to be compared, to obtain the comparison object, including: The DBC file to be compared is segmented into blocks according to multiple keywords and stored in the cache area; Create multiple conversion coroutines and multiple channels based on the number of keywords; Each transformation goroutine performs structured transformation and validity verification on the attribute value data following the corresponding keyword in the cache area, and sends the structured data that passes the validity verification to the corresponding channel or generates an error message based on the structured data that fails the validity verification. The structured data is used to represent the attribute value data after structured transformation, and the attribute value data is used to represent the attribute values ​​corresponding to messages and signals. If no error message is generated, the structured data received from each of the channels is summarized in sequence to obtain the object to be compared.

3. The method for comparing differences in DBC files according to any one of claims 1-2, characterized in that, Based on the message index and the signal index, the differences of the objects to be compared are compared according to the preset difference type to obtain version difference information, including: If the preset difference type is a new difference or a deleted difference, then calculate the difference set of the preset difference type corresponding to different versions of the data set to be compared to obtain the new information or deleted information; If the preset difference type is a signal modification, then the key attributes of the signal are compared according to the signal combination identifier set of different versions to obtain the signal modification information; The data set to be compared includes a message identifier set or a signal combination identifier set. The message identifier set is obtained based on the message index, and the signal combination identifier set is obtained by combining message identifiers and signal names based on the signal index. The version difference information includes the added information, the deleted information, and the signal modified information.

4. The method for comparing differences in DBC files according to claim 3, characterized in that, If the preset difference type is an added difference or a deleted difference, then the difference set of the preset difference type corresponding to different versions of the data sets to be compared is calculated to obtain the added information or deleted information, including: If the new difference is a new message, then calculate the difference between the current message identifier set and the historical message identifier set to obtain the new message identifier; If the deletion difference is the deletion of a message, then the difference between the historical message identifier set and the current message identifier set is calculated to obtain the deleted message identifier; If the new difference is a new signal, then calculate the difference between the current signal combination identifier set and the historical signal combination identifier set to obtain the new signal combination identifier; If the newly added difference is the deletion of a signal, then the difference between the historical signal combination identifier set and the current signal combination identifier set is calculated to obtain the deleted signal combination identifier; The newly added information includes the newly added message identifier and the newly added signal combination identifier; the deleted information includes the deleted message identifier and the deleted signal combination identifier; and the data set to be compared for different versions includes the current message identifier set, the historical message identifier set, the current signal combination identifier set, and the historical signal combination identifier set.

5. The method for comparing differences in DBC files according to claim 3, characterized in that, By comparing the key attributes of the signal based on different versions of the signal combination identifier set, signal modification information is obtained, including: If a current signal combination identifier and a historical signal combination identifier are the same, then the current key attributes and the historical key attributes are compared to obtain the signal modification information of the current signal combination identifier; The current key attribute is obtained based on the signal index corresponding to the current signal combination identifier, and the historical key attribute is obtained based on the signal index corresponding to the historical signal combination identifier.

6. A device for comparing differences in DBC files, characterized in that, The device comprises: The file acquisition module is used to acquire different versions of the DBC file to be compared. The data reading module is used to read data in blocks according to multiple keywords of the DBC file to be compared, so as to obtain the respective comparison objects; The data classification module is used to create a message index and a signal index for the objects to be compared. The objects to be compared include a message identifier, a message object, a signal name, and a signal object. The message identifier is used as the index identifier of the message index, and the message object is used as the index value of the message index. The message object is used to represent message attribute values, and the message identifier is used to uniquely identify the message. The message identifier is also used as the index identifier of the signal index, and a secondary index is used as the index value of the signal index. The index identifier of the secondary index is the signal name, and the index value of the secondary index is the signal object. The signal object is used to represent signal attribute values. A difference comparison module is used to compare the differences of the objects to be compared based on a preset difference type, each message index, and each signal index to obtain version difference information. The preset difference type is used to characterize the differences between the message level and the signal level in the DBC file to be compared. The module includes: creating a shared data structure; creating multiple comparison coroutines based on the preset difference type; and using each comparison coroutine to compare the differences of the objects to be compared corresponding to the preset difference type based on each message index and each signal index to obtain version difference information, which is then stored in the shared data structure. The shared data structure is used by each comparison coroutine to simultaneously store the difference data compared according to the preset difference type.

7. An electronic device, characterized in that, The electronic device includes: one or more processors; A storage device for storing one or more programs, which, when executed by one or more processors, cause the electronic device to implement the DBC file difference comparison method as described in any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that, It stores a computer program that, when executed by the computer's processor, causes the computer to perform the difference comparison method for DBC files as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Method and device for wireless communication between connected objects and gateways

    CN108141886A

  • Communication matrix comparison method and system

    CN110390082A