DBC file difference comparison method and device, electronic equipment and storage medium
By reading and indexing DBC files in chunks, and combining the comparison method of preset differences types, the problem that the existing technology cannot deeply understand the semantics of DBC files is solved, and the precise difference comparison and detailed difference summary report generation of DBC files are realized.
Patent Information
- Application Number
- CN202411592850.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-08
- Publication Date
- 2025-02-28
- Estimated Expiration
- 2044-11-08
AI Technical Summary
The prior art cannot deeply understand the semantics of DBC files, resulting in the inability to effectively identify and process changes in signal level and/or message level, and the inability to generate a diff summary report.
By obtaining different versions of DBC files, reading data in chunks according to multiple keywords, creating message indexes and signal indexes, and comparing the differences of objects to be compared based on preset differences types to obtain version differences information.
The semantics based on DBC files are accurately and quickly positioned the changes of each message and signal, and provided detailed change information. The generated difference summary report is clearly structured and readable.
Smart Images

Figure CN119538902A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of DBC difference detection, and in particular to a DBC file difference comparison method, device, electronic device and storage medium. Background Art
[0002] In modern automotive electronic systems, the communication between vehicle control units usually adopts the Controller Area Network (CAN) bus protocol. The Controller Area Network Database (DBC) file is a file that describes the CAN bus communication protocol and defines signals, messages and their related attribute parameters. Different versions of DBC files will be generated as the software version is updated. The differences between these DBC files are key information for generating integrated software model interfaces. Therefore, quickly and accurately generating a difference summary of DBC files is crucial for software model interfaces and software integration, and also provides a key basis for integrated automation. However, it is generally necessary to use external comparison tools to handle the differences in DBC files.
[0003] At present, commonly used file comparison tools, difference comparison tools and manual inspection are used to determine the differences of DBC files. Among them, file comparison tools include Beyond Compare, which supports line-by-line comparison of text files, can highlight differences, and can compare various file formats including DBC files; but due to the complexity and specific structure of DBC files, Beyond Compare can only perform surface text comparison, cannot deeply understand the semantic level of DBC files, cannot effectively identify and process changes at the signal level and / or message level, and cannot generate difference summaries, and Beyond Compare is a paid software. Difference comparison tools include Diff tools, which can compare the differences of text files, are provided in the form of command lines or graphical interfaces, and can quickly identify the differences between two text files; but similar to Beyond Compare, difference comparison tools can only perform literal text comparison, cannot parse the structure and semantics of DBC files, and are prone to missing potential important changes or providing irrelevant change information. Engineers manually review and compare two versions of DBC files, which can be used in cases where the changes are small or simple; manual inspection is not only time-consuming, but also prone to human errors, especially for complex DBC files or a large number of signal changes. The existing technical means are unable to deeply understand the semantics of the DBC file, and thus are unable to generate a difference summary report. Summary of the invention
[0004] The present application provides a DBC file difference comparison method, device, electronic device and storage medium to solve the above-mentioned technical problem that the difference comparison cannot be quickly performed based on the semantics of the DBC files to be compared.
[0005] In one embodiment of the present application, the present application provides a method for comparing differences in DBC files, 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 objects to be compared; creating message indexes and signal indexes of the objects to be compared; and comparing the differences of the objects to be compared based on a preset difference type, each of the message indexes, and each of the signal indexes to obtain version difference information, wherein the preset difference type is used to characterize the differences corresponding to the message level and the signal level in the DBC files to be compared.
[0006] In one embodiment of the present application, the object to be compared includes the message identifier, the message object, the signal name and the signal object, and the message index and signal index of the object to be compared are created, including: using the message identifier as the index identifier of the message index, and using the message object as the index value of the message index, the message object is used to represent the 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 using the secondary index as the index value of the signal index, the index identifier of the secondary index is the signal name, the index value of the secondary index is the signal object, and the signal object is used to represent the signal attribute value.
[0007] In one embodiment of the present application, data is read in blocks according to multiple keywords of the DBC file to be compared to obtain an object to be compared, including: dividing the DBC file to be compared into blocks according to multiple keywords and storing them in a cache area; creating multiple conversion coroutines and multiple channels based on the number of keywords; performing structured conversion and legitimacy verification on the attribute value data after the corresponding keyword in the cache area through each conversion coroutine, and sending the structured data that passes the legitimacy verification to the corresponding channel or generating error prompt information based on the structured data that fails the legitimacy verification, the structured data is used to represent the attribute value data after the structured conversion, and the attribute value data is used to represent the attribute values corresponding to messages and signals; if no error prompt information is generated, the structured data received by each of the channels is sequentially summarized to obtain the object to be compared.
[0008] In one embodiment of the present application, the differences of the objects to be compared are compared based on the preset difference type, each of the message indexes and each of the signal indexes to obtain version difference information, including: creating a shared data structure; creating multiple comparison routines based on the preset difference type; using each comparison routine to compare the differences of the objects to be compared corresponding to the preset difference type based on each of the message indexes and each of the signal indexes to obtain version difference information, and storing it in the shared data structure; wherein the shared data structure is used for each of the comparison routines to simultaneously store the difference data compared corresponding to the preset difference type.
[0009] In one embodiment of the present application, the difference of the preset difference type corresponding to the object to be compared is compared based on each of the message indexes and each of the signal indexes to obtain version difference information, including: if the preset difference type is a new difference or a deleted difference, then the difference set of the preset difference type corresponding to the different versions of the data sets to be compared is calculated to obtain the new information or the deleted information; if the preset difference type is a modification of the signal, then the key attributes of the signal are compared according to the signal combination identifier sets of different versions to obtain the signal modification information; wherein, 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, 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 the new information, the deleted information and the signal modification information.
[0010] In one embodiment of the present application, if the preset difference type is a new difference or a deleted difference, 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, including: if the new difference is the addition of a message, the difference set of the current message identification set and the historical message identification set is calculated to obtain the new message identification; if the deleted difference is the deletion of a message, the difference set of the historical message identification set and the current message identification set is calculated to obtain the deleted message identification; if the new difference is the addition of a signal, the difference set of the current signal combination identification set and the historical signal combination identification set is calculated to obtain the new signal combination identification; if the new difference is the deletion of a signal, the difference set of the historical signal combination identification set and the current signal combination identification set is calculated to obtain the deleted signal combination identification; wherein the new information includes the new message identification and the new signal combination identification, the deletion information includes the deleted message identification and the deleted signal combination identification, and the different versions of the data sets to be compared include the current message identification set, the historical message identification set, the current signal combination identification set, and the historical signal combination identification set.
[0011] In one embodiment of the present application, key attributes of a signal are compared according to different versions of signal combination identifier sets to obtain signal modification information, including: if a current signal combination identifier and a historical signal combination identifier are the same, 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 the present application, the present application provides a DBC file difference comparison device, including: a file acquisition module, used to obtain different versions of DBC files to be compared; a data reading module, used to read data in blocks according to multiple keywords of the DBC files to be compared, and obtain respective objects to be compared; a data classification module, used to create message indexes and signal indexes of the objects to be compared; a difference comparison module, used to compare the differences of the objects to be compared based on a preset difference type, each of the message indexes and each of the signal indexes, and obtain version difference information, wherein the preset difference type is used to characterize the differences corresponding to the message level and the signal level in the DBC files to be compared.
[0013] In one embodiment of the present application, the present application provides an electronic device, which includes: one or more processors; a storage device for storing one or more programs, 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 the present application, the present application provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor of a computer, the computer executes the DBC file difference comparison method described in any one of the above embodiments.
[0015] Beneficial effects of the embodiments of the present application: The present application provides a method, device, electronic device and storage medium for comparing the differences of DBC files. The embodiments of the present application read data in blocks through multiple keywords of the DBC files to be compared, obtain respective objects to be compared, and establish message indexes and signal index classifications to compare the differences between different objects to be compared, and obtain version difference information. The present application can accurately and quickly locate the changes of each message and signal based on the semantics of the DBC files, and provide detailed change information.
[0016] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present application, and together with the specification, are used to explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and for those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative work. In the drawings:
[0018] Figure 1 A schematic diagram of a process of comparing differences in DBC files according to an embodiment of the present application is shown;
[0019] Figure 2 A schematic diagram of an implementation flow of a method for comparing differences in DBC files according to an embodiment of the present application is shown;
[0020] Figure 3 A block diagram of a device for comparing differences in DBC files according to an embodiment of the present application is shown;
[0021] Figure 4 A schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present application is shown. DETAILED DESCRIPTION
[0022] The following describes the embodiments of the present application through specific examples, and those skilled in the art can easily understand other advantages and effects of the present application from the contents disclosed in this specification. The present application can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present application. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict.
[0023] It should be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present application, and thus the drawings only show components related to the present application rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed at will, and the component layout may also be more complicated.
[0024] In the following description, a large number of details are discussed to provide a more thorough explanation of the embodiments of the present application. However, it is obvious to those skilled in the art that the embodiments of the present application can be implemented without these specific details. In other embodiments, well-known structures and devices are shown in the form of block diagrams rather than in detail to avoid making the embodiments of the present application difficult to understand.
[0025] In the related art, traditional difference comparison tools, such as Beyond Compare and Diff tools, cannot quickly perform difference comparison based on the semantics of the DBC files to be compared.
[0026] In order to solve the above technical problems, the present application provides a DBC file difference comparison method, device, electronic device and storage medium. The implementation details of the technical solution of the embodiment of the present application are elaborated in detail below.
[0027] See also Figure 1 , Figure 1 FIG. 2 is a flow chart showing a method for comparing differences in DBC files according to an embodiment of the present application. Figure 1 As shown, in an exemplary embodiment, the method for comparing the differences of DBC files includes at least steps S110 to S140, which are described in detail as follows:
[0028] Step S110, obtaining DBC files of different versions to be compared.
[0029] In one embodiment of the present application, a controller area network database (Data Base CAN, DBC) file is a file that describes the controller area network (Controller Area Network, CAN) bus protocol, which defines signals, messages and their related attribute parameters, such as identification (ID), weekly data length, signal name, signal range, offset, accuracy, etc.
[0030] In one embodiment of the present application, the DBC files to be compared include a current version of the DBC file and a historical version of the DBC file, wherein the historical version includes at least one version before the current version, and the current version includes the latest version or a version before the latest version.
[0031] In one embodiment of the present application, during the process of system upgrades, function updates, performance optimization, and error repairs of various controllers, messages and signals are updated to support the above updates. At this time, the version of the DBC file will be replaced and stored in the management system.
[0032] In one embodiment of the present application, different versions of DBC files to be compared are obtained from a management system storing multiple versions of DBC files, wherein the management system includes a version control system, a project directory structure, a configuration management tool, a dedicated database, a file server, a continuous integration / continuous delivery (CI / CD) pipeline, a document management system, a local backup, etc.
[0033] Step S120 , reading data in blocks according to multiple keywords of the DBC files to be compared, to obtain respective objects to be compared.
[0034] In one embodiment of the present application, data is read in blocks according to multiple keywords of a DBC file to be compared to obtain an object to be compared, including: 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 legitimacy 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 legitimacy verification to the corresponding channel or generating an error prompt message based on the structured data that fails the legitimacy verification, the structured data is used to represent the attribute value data after the structured conversion, and the attribute value data is used to represent the attribute values corresponding to messages and signals; if no error prompt message is generated, the structured data received by each channel is summarized in turn to obtain the object to be compared.
[0035] In one embodiment of the present application, the DBC file uses different keywords to represent different semantic information. The keywords include the version represented by "VERSION", the type and applicable scope of the custom attribute represented by "BA_DEF_", the default value of the custom attribute represented by "BA_DEF_DEF_", the message represented by "BO_", the signal represented by "SG_", the comment represented by "CM_", and the node represented by "BU_".
[0036] In one embodiment of the present application, the DBC file to be compared is divided into blocks according to multiple keywords in the DBC file to be compared, and the data is read into a buffer. The block division can reduce the amount of data processed each time.
[0037] In one embodiment of the present application, a message is uniquely identified by a message ID.
[0038] In one embodiment of the present application, the block data corresponding to the keyword "BO_" in the buffer, for example "BO_100MotorStatus:8", represents the attribute value corresponding to a message, and the block data is structured and converted into structured data, such as the message identification ID is 100, the message name is MotorStatus (motor status), and the message length is 8 bytes.
[0039] In one embodiment of the present application, n conversion coroutines are created to parse the data in the buffer, the number n of conversion coroutines is equal to the number of keywords, and the coroutine is a user-mode thread.
[0040] In one embodiment of the present application, parsing the data includes converting the data after the keyword into structured data, such as a structure, a dictionary, and the like.
[0041] In one embodiment of the present application, n channels chanal are created to receive processed data, and the number n of chanal is equal to the number of keywords.
[0042] In one embodiment of the present application, during the data parsing process, the legality of the DBC file to be compared is verified, such as the accuracy of the DBC syntax, the repetition of the signal start bit, whether the data frame size is appropriate, etc.
[0043] In one embodiment of the present application, sending structured data that has passed the legality check to a corresponding channel or generating error prompt information based on structured data that has not passed the legality check includes: if the number of failures in a conversion procedure is less than a preset threshold, sending the structured data that has passed the legality check to the channel corresponding to the conversion procedure; if the number of failures in a conversion procedure is greater than or equal to a preset threshold, generating error prompt information; wherein the number of failures is used to characterize the number of structured data that have failed the legality check.
[0044] In one embodiment of the present application, the preset threshold can be set to 1, that is, if illegal structured data is detected, the system will exit with an error; the preset threshold can be set to a percentage threshold of the total amount of structured data, that is, if part or all of the structure or data fails the legality check, the system will exit with an error.
[0045] In one embodiment of the present application, the data of the channels are summarized in sequence to obtain the summarized objects to be compared.
[0046] Step S130: Create a message index and a signal index of the object to be compared.
[0047] In one embodiment of the present application, the objects to be compared include a message identifier, a message object, a signal name and a signal object, and a message index and a signal index of the objects to be compared are created, including: using the message identifier as the index identifier of the message index, and using the message object as the index value of the message index, the message object is used to represent the 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 using the secondary index as the index value of the signal index, the index identifier of the secondary index is the signal name, the index value of the secondary index is the signal object, and the signal object is used to represent the signal attribute value.
[0048] In one embodiment of the present application, a message index is created, the index identifier (ID) is messageID, and the index value is the message object.
[0049] In one embodiment of the present application, a signal index is created, the index ID is the message ID, and the index value is the secondary index as a whole. The index ID of the secondary index is the signal name, and the index value is the signal object. The signal index and the message index can be used to quickly locate and compare the same fields, reducing repeated calculations.
[0050] In one embodiment of the present application, the message attribute value is the value of the attribute parameter of the message, such as the message name, period, message identifier, etc. The signal attribute value is the value of the attribute parameter of the signal, such as the signal name, signal range, offset, etc.
[0051] Step S140 , comparing the differences of the objects to be compared based on the preset difference type, each message index and each signal index classification, and obtaining 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 files to be compared.
[0053] In one embodiment of the present application, the differences of the objects to be compared are compared based on the preset difference type, each message index and each signal index classification to obtain version difference information, including: creating a shared data structure; creating multiple comparison coroutines based on the preset difference type; having each comparison coroutine 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, and storing it in the shared data structure; wherein the shared data structure is used for each comparison coroutine to simultaneously store the difference data compared corresponding to the preset difference type.
[0054] In one embodiment of the present application, a shared concurrent safe map (sync.Map) DBCCompareInfo is created to store the comparison result. The sync.Map is used instead of the mutex, which is a thread-safe data structure, to avoid using an explicit mutex.
[0055] In one embodiment of the present application, the difference of the preset difference type corresponding to the object to be compared is compared based on each message index and each signal index to obtain version difference information, including: if the preset difference type is a new difference or a deleted difference, then the difference set of the preset difference type corresponding to the 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 modification of the signal, then the key attributes of the signal are compared according to the signal combination identification sets of different versions to obtain signal modification information; wherein, the data set to be compared includes a message identification set or a signal combination identification set, the message identification set is obtained based on the message index, the signal combination identification set is obtained by combining the message identification 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 the present application, if the preset difference type is a new difference or a deleted difference, 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, including: if the new difference is the addition of a message, the difference set of the current message identification set and the historical message identification set is calculated to obtain the new message identification; if the deleted difference is the deletion of a message, the difference set of the historical message identification set and the current message identification set is calculated to obtain the deleted message identification; if the new difference is the addition of a signal, the difference set of the current signal combination identification set and the historical signal combination identification set is calculated to obtain the new signal combination identification; if the new difference is the deletion of a signal, the difference set of the historical signal combination identification set and the current signal combination identification set is calculated to obtain the deleted signal combination identification; wherein, the new information includes the new message identification and the new signal combination identification, the deleted information includes the deleted message identification and the deleted signal combination identification, and the different versions of the data sets to be compared include the current message identification set, the historical message identification set, the current signal combination identification set and the historical signal combination identification set.
[0057] In one embodiment of the present application, the preset difference types include new addition differences, deletion differences, and signal modification, etc. The new addition differences include the addition of messages and the addition of signals, and the deletion differences include the deletion of messages and the deletion of signals.
[0058] In one embodiment of the present application, the addition of a message is used to represent that a message exists in the current version of the DBC file but not in the historical version of the DBC file; the deletion of a message is used to represent that a message does not exist in the current version of the DBC file but exists in the historical version of the DBC file; the addition of a signal is used to represent that a signal exists in the current version of the DBC file but not in the historical version of the DBC file; the deletion of a signal is used to represent that a signal does not exist in the current version of the DBC file but exists in the historical version of the DBC file; the modification of a signal is used to represent that the signal attribute value of a signal in the current version of the DBC file is different from the signal attribute value of the signal in the historical version of the DBC file.
[0059] In one embodiment of the present application, the changes between two versions of messages can be divided into five situations, namely, addition of message, deletion of message, addition of signal, deletion of signal, and modification of signal, so that the comparison of changes can be achieved through five comparison coroutines.
[0060] In one embodiment of the present application, in the comparison coroutine corresponding to the addition and deletion of messages, two versions of message identification sets are obtained according to the message index, such as the current message identification set (CurrentMessageIDSet) corresponding to the current version, and the historical message identification set (PreviousMessageIDSet) corresponding to the historical version.
[0061] In one embodiment of the present application, the message is added: based on the difference set of CurrentMessageIDSet-PreviousMessageIDSet, the newly added messageID that exists in the current version but does not exist in the historical version is obtained, and then the attribute parameters of the newly added Message are obtained based on the newly added messageID.
[0062] In one embodiment of the present application, message deletion: through the difference set of PreviousMessageIDSet-CurrentMessageIDSet, the deleted messageID that does not exist in the current version but exists in the historical version is obtained, and then the attribute parameters of the deleted Message are obtained based on the deleted messageID.
[0063] In one embodiment of the present application, in the comparison coroutine corresponding to the addition, deletion, and modification of a signal, two versions of signal combination identification sets are obtained according to the signal index, such as the current signal combination identification set (PreviousSignalSet) corresponding to the current version, and the historical signal combination identification set (PrevioussignalIDSet) corresponding to the historical version.
[0064] In one embodiment of the present application, the addition of signal: by the difference set of CurrentSignalSet-PreviousSignalSet, the new signal combination identifier is obtained, thereby obtaining the corresponding attribute parameter
[0065] In one embodiment of the present application, signal deletion: a deletion signal combination identifier is obtained through the difference set of PreviousSignalSet-CurrentSignalSet, thereby obtaining the corresponding attribute parameters.
[0066] In one embodiment of the present application, key attributes of a signal are compared according to different versions of signal combination identifier sets to obtain signal modification information, including: if a current signal combination identifier and a historical signal combination identifier are the same, the current key attributes and the historical key attributes are compared to obtain 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 the present application, by looping through two versions of the signal combination identifier set, when the historical signal name and the current signal name under the same message identifier are the same, key attributes such as the start bit, length, gain, offset, maximum value and minimum value of the signal are compared as a basis for signal modification.
[0068] In one embodiment of the present application, after the version difference information is obtained, a difference summary report is generated based on the version difference information to enhance readability.
[0069] In one embodiment of the present 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 the present 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 change details. The change details can be displayed as diagnostic information changes or ordinary business information changes according to the design specifications of the DBC files to be compared.
[0071] In one embodiment of the present application, the format of the difference summary report includes HTML, PDF or plain text. In order to facilitate engineers to read and analyze, the difference summary report may include charts or highlight key differences to enhance readability. Table 1 shows the content of a difference summary report:
[0072] Table 1 Difference Summary Report
[0073]
[0074] Among them, the difference summary report includes the message names, hexadecimal message IDs, decimal message IDs, and corresponding descriptions of new messages and deleted messages, such as diagnostic messages and business messages; the difference summary report also includes the message names, hexadecimal message IDs, decimal message IDs, signal names and corresponding descriptions of new signals, deleted signals, and modified signals. For example, if the description of a modified signal is a business message, the signal start bit is changed from 247 to 243.
[0075] In one embodiment of the present application, see Figure 2 , Figure 2 The implementation flow diagram of the DBC file difference comparison method according to an embodiment of the present application is shown. As shown in Figure 2, the configuration file parsing system: manages various configuration files required for the operation of the system, including the path of the DBC file to be compared and the multi-coroutine configuration; the DBC file parsing system: divides the DBC file to be compared into blocks according to multiple keywords, and reads the data of the corresponding keywords by creating multiple conversion coroutines for structured conversion and legality verification, thereby summarizing the objects to be compared; error handling: used to generate error prompt information based on data that has not passed the legality verification and exit the difference comparison; multi-coroutines perform message level and signal level comparison: create multiple comparison coroutines to compare the deletion of messages, the addition of messages, the deletion of signals, the addition of signals, and the modification of signals, and store the version difference information in a shared data structure; difference summary: after the comparison is completed, the detailed content of the difference changes can be summarized; generate a report: generate a difference summary report. This application can automatically read the data of the DBC files to be compared and compare different versions of the DBC files to be compared, reducing the time and errors of manual operations; it can accurately and quickly locate the changes of each message and signal in the DBC files to be compared, and provide detailed change information; the generated difference summary report has a clear structure and strong readability, so that engineers can quickly understand and use it; this application can provide support for signal model generation and interface automation functions.
[0076] See also Figure 3 , Figure 3 A block diagram of a DBC file difference comparison device according to an embodiment of the present application is shown. This embodiment does not limit the applicable implementation environment of the device.
[0077] like Figure 3 As shown, a DBC file difference comparison device 300 according to an embodiment of the present 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 DBC files to be compared;
[0079] The data reading module 302 is used to read the data in blocks according to multiple keywords of the DBC files to be compared, so as to obtain respective objects to be compared;
[0080] The data classification module 303 is used to create a message index and a signal index of the object to be compared;
[0081] The difference comparison module 304 is used to compare the differences of the objects to be compared based on preset difference types, message indexes and signal indexes to obtain version difference information. The preset difference type is used to characterize the differences corresponding to the message level and the signal level in the DBC files to be compared.
[0082] It should be noted that the DBC file difference comparison device provided in the above embodiment and the DBC file difference comparison method provided in the above embodiment belong to the same concept, wherein the specific manner in which each module and unit performs the operation has been described in detail in the method embodiment, and will not be repeated here. In actual application, the DBC file difference comparison device provided in the above embodiment can allocate the above functions to different functional modules as needed, that is, divide the internal structure of the device into different functional modules to complete all or part of the functions described above, and this is not limited here.
[0083] An embodiment of the present application also provides an electronic device, including: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, the electronic device implements the DBC file difference comparison method provided in the above-mentioned embodiments.
[0084] See also Figure 4 , Figure 4 The structure diagram of the computer system suitable for implementing the electronic device of the embodiment of the present application is shown. It should be noted that: Figure 4 The computer system 400 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present 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 according to the program stored in the read-only memory (ROM) 402 or the program loaded from the storage part 408 to the random access memory (RAM) 403, such as executing the method in the above embodiment. In the random access memory 403, various programs and data required for system operation are also stored. The central processing unit 401, the read-only memory 402 and the random access memory 403 are connected to each other through 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, a mouse, etc.; an output section 407 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker; 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, a 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 magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 410 as needed so that a computer program read therefrom is installed into the storage section 408 as needed.
[0087] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a computer program for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication section 409, and / or installed from a removable medium 411. When the computer program is executed by a central processing unit (CPU) 401, various functions defined in the system of the present application are executed.
[0088] It should be noted that the computer-readable medium shown in the embodiment of the present application can be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium can be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, wherein a computer-readable computer program is carried. This propagated data signal can take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. A computer program contained on a computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0089] The flowchart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program product according to various embodiments of the present application. Wherein, each box in the flowchart or block diagram can represent a module, a program segment, or a part of the code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order 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 a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0090] The units involved in the embodiments described in the present application can be implemented by software or by hardware, and the units described can also be set in a processor. Among them, the names of these units do not constitute a limitation on the units themselves under certain circumstances. Therefore, the technical solution according to the implementation mode of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including a number of instructions to enable a computing device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the implementation mode of the present application.
[0091] Another aspect of the present application provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor of a computer, the computer executes the DBC file difference comparison method provided in the above embodiments. The computer-readable storage medium may be included in the electronic device described in the above embodiments, or may exist independently without being assembled into the electronic device.
[0092] In the above embodiments, unless otherwise specified, by using serial numbers such as "first" and "second" to describe common objects, it only means that they refer to different instances of the same object, rather than indicating that the objects being described must adopt a given order, whether in time, space, sorting or any other way.
[0093] The above embodiments are merely illustrative of the principles and effects of the present application, and are not intended to limit the present application. Anyone familiar with the technology may modify or change the above embodiments without violating the spirit and scope of the present application. Therefore, all equivalent modifications or changes made by a person of ordinary skill in the art without departing from the spirit and technical ideas disclosed in the present application shall still be covered by the claims of the present application.
Claims
1. A method for comparing differences in DBC files, characterized in that: The method comprises: Get different versions of DBC files to be compared; Read data in blocks according to multiple keywords of the DBC file to be compared, to obtain respective objects to be compared; Creating a message index and a signal index of the object to be compared; The differences of the objects to be compared are compared based on a preset difference type, each of the message indexes and each of the signal indexes to obtain version difference information. The preset difference type is used to characterize the differences corresponding to the message level and the signal level in the DBC files to be compared.
2. The method for comparing differences in DBC files according to claim 1, characterized in that: The object to be compared includes the message identifier, the message object, the signal name and the signal object, and creating the message index and the signal index of the object to be compared includes: The message identifier is used as an index identifier of a message index, and the message object is used as an 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; The message identifier is used as the index identifier of the signal index, and the secondary index is used as the index value of the signal index, the index identifier of the secondary index is the signal name, the index value of the secondary index is the signal object, and the signal object is used to represent the signal attribute value.
3. The method for comparing differences in DBC files according to claim 1, characterized in that: Reading data in blocks according to multiple keywords of the DBC file to be compared to obtain the object to be compared includes: Splitting the DBC file to be compared into blocks according to multiple keywords and storing them in a buffer area; Creating a plurality of conversion coroutines and a plurality of channels based on the number of the keywords; The attribute value data after the corresponding keyword in the buffer area is subjected to structured conversion and legality verification through each conversion coroutine, and the structured data that passes the legality verification is sent to the corresponding channel or error prompt information is generated based on the structured data that fails the legality verification, wherein the structured data is used to represent the attribute value data after the structured conversion, and the attribute value data is used to represent the attribute value corresponding to the message and the signal; If no error prompt information is generated, the structured data received by each of the channels are summarized in turn to obtain an object to be compared.
4. The method for comparing the differences of DBC files according to any one of claims 1 to 3, characterized in that: Comparing the differences of the objects to be compared based on the preset difference type, each of the message indexes and each of the signal indexes, and obtaining version difference information, including: Create shared data structures; Create multiple comparison coroutines based on preset difference types; By comparing the differences of the objects to be compared corresponding to the preset difference types based on the message indexes and the signal indexes through each comparison coroutine, version difference information is obtained and stored in the shared data structure; The shared data structure is used by each comparison procedure to simultaneously store the difference data obtained by comparing the corresponding preset difference types.
5. The method for comparing differences of DBC files according to claim 4, characterized in that: Comparing the differences of the objects to be compared corresponding to the preset difference types based on the message indexes and the signal indexes to obtain version difference information includes: If the preset difference type is a new difference or a deleted difference, then the difference sets of the different versions of the to-be-compared data sets corresponding to the preset difference type are calculated to obtain the new information or the deleted information; If the preset difference type is signal modification, comparing key attributes of the signal according to the signal combination identifier sets of different versions to obtain signal modification information; Among them, 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 the message identifier and the signal name based on the signal index, and the version difference information includes the newly added information, the deleted information and the signal modification information.
6. The method for comparing differences of DBC files according to claim 5, characterized in that: If the preset difference type is a new difference or a deleted difference, then the difference sets of the different versions of the to-be-compared data sets corresponding to the preset difference type are calculated to obtain the new information or the deleted information, including: If the newly added difference is a new message, then the difference between the current message identifier set and the historical message identifier set is calculated to obtain the newly added 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 newly added difference is a new addition of a signal, then a difference set between the current signal combination identifier set and the historical signal combination identifier set is calculated to obtain a newly added signal combination identifier; If the newly added difference is a deletion of a signal, then a difference set between the historical signal combination identifier set and the current signal combination identifier set is calculated to obtain a deleted signal combination identifier; Among them, 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 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.
7. The method for comparing differences of DBC files according to claim 5, characterized in that: Compare the key attributes of the signal according to the signal combination identification sets of different versions to obtain signal modification information, including: If a current signal combination identifier is the same as a historical signal combination identifier, then comparing the current key attribute with the historical key attribute to obtain 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.
8. A DBC file difference comparison device, characterized in that: The device comprises: The file acquisition module is used to obtain different versions of DBC files to be compared; A data reading module, used for reading data in blocks according to multiple keywords of the DBC file to be compared, to obtain respective objects to be compared; A data classification module, used to create a message index and a signal index of the object to be compared; The 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 classification to obtain version difference information. The preset difference type is used to characterize the differences corresponding to the message level and the signal level in the DBC file to be compared.
9. An electronic device, characterized in that: The electronic device comprises: one or more processors; A storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, enables the electronic device to implement the DBC file difference comparison method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed by a processor of a computer, the computer is caused to execute the method for comparing differences in DBC files according to any one of claims 1 to 7.
Citation Information
Patent Citations
Method and device for wireless communication between connected objects and gateways
CN108141886A
Communication matrix comparison method and system
CN110390082A
File comparison method and device based on traversal algorithm, and electronic equipment
CN116483781A
Message information consistency detection method and device, electronic equipment and storage medium
CN118400288A
Representing directory structure in content-addressable storage systems
US20150186393A1
Cited By
Transformer substation configuration description file comparison method and system, medium, equipment and product
CN119940337A