Excel-to-DBC file conversion method and system based on intelligent verification and multi-version adaptation
By identifying Excel template versions through feature matching algorithms and multi-level validation rule bases, and combining them with Motorola byte order conversion algorithms, the problems of template rigidity and insufficient data validation in Excel to DBC file conversion are solved, achieving intelligent and accurate data processing and flexible output.
Patent Information
- Application Number
- CN202511573185.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-30
- Publication Date
- 2026-03-17
Smart Images

Figure CN121683701A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of file conversion technology, specifically to an Excel to DBC file conversion method and system based on intelligent verification and multi-version adaptation. Background Technology
[0002] Currently, Controller Area Network (CAN) bus communication in automotive electronic systems primarily uses the DBC (Database CAN) file format to describe network communication protocols. The DBC file defines key information such as messages, signals, and nodes, and is a fundamental document for automotive electronic system development.
[0003] The existing basic Excel-to-DBC file conversion method reads Excel worksheet data according to a fixed format, declares a DBC object containing a node list and a message list, extracts data information from the Excel file according to preset rules, and generates a DBC file according to the CAN network database file format. This method defines a working area concept, defines attribute names in row X, and fills in the specific message and signal information below row X. Data extraction and conversion are completed by reading line by line and storing data in a categorized manner.
[0004] Although existing technologies provide basic Excel to DBC conversion capabilities, the following significant problems still exist in practical engineering applications: 1. The template is rigid and lacks adaptability; 2. Weak data validation functionality; 3. Insufficient professional handling capabilities; 4. Limited output functionality; 5. Lacks version control functionality; 6. Poor user experience. Summary of the Invention
[0005] To address the shortcomings of existing technologies, the purpose of this invention is to provide an Excel to DBC file conversion method and system based on intelligent verification and multi-version adaptation. This system automatically identifies the Excel template version of the Excel file, provides good multi-level verification, ensures the accuracy of start bit calculation using a professional Motorola byte order conversion algorithm, supports multiple output formats, features a modular design for easy function expansion, supports rapid access to new template versions and output formats, and offers a good user experience.
[0006] Other features and advantages of this application will become apparent from the following detailed description, or may be learned in part from practice of this application.
[0007] According to a first aspect of this application, an Excel-to-DBC file conversion method based on intelligent verification and multi-version adaptation is provided, including: Automatically identify the Excel template version of an Excel file using a feature matching algorithm; The system calls the validation rule library corresponding to the identified Excel template version to perform multi-level validation on the Excel file. The Motorola byte order conversion algorithm is used to convert LSB byte order format signals to MSB byte order format signals. The signal converted to MSB byte order format is preprocessed to obtain a file conforming to DBC format; Extend DBC-compliant files to multi-format compatible output.
[0008] In some embodiments of this application, based on the foregoing scheme, the automatic identification of the Excel template version of an Excel file using a feature matching algorithm includes: Scan the header features of the Excel file, perform feature word matching based on the header features, and obtain the first score of the Excel file matching each Excel template version; Identify the key column positions in the Excel file, perform column matching based on the key column positions, and obtain the second score for each Excel template version matched by the Excel file. Identify the file metadata of an Excel file, perform structural and attribute matching based on the file metadata, and obtain the third score of the Excel file matching each Excel template version; The Excel file is matched against the first, second, and third scores of each Excel template version, and then weighted and combined to obtain the total score of the Excel file matching each Excel template version. The Excel template version of the Excel file is determined based on the total score.
[0009] In some embodiments of this application, based on the aforementioned scheme, for feature words, columns, structures and attributes, scores for complete matching and scores for incomplete matching are set respectively, and the score for complete matching is greater than the score for incomplete matching. Based on the scores of matching the feature words, columns, structure and attributes of the Excel file with each Excel template version, the first score, second score and third score of the Excel file matching each Excel template version are obtained.
[0010] In some embodiments of this application, based on the foregoing scheme, for the Excel V1.0 template, the feature words are MessageName, MessageID, and SignalName; for the Excel V2.0 template, the feature words are MsgName, CANID, and SigName; and for the Excel V3.0 template, the feature words are Message_Name, ID_Hex, and Signal_Name. The columns are: columns related to message name, columns related to message ID, columns related to signal name, and columns related to extended attributes; The structure and attributes include worksheet structure and file attribute information. The worksheet structure includes worksheet name, number of worksheets and worksheet relationships. The file attribute information includes creation information, version tag and time information.
[0011] In some embodiments of this application, based on the foregoing scheme, the multi-level verification includes a first-level verification, a second-level verification, a third-level verification, a fourth-level verification, and a fifth-level verification; The first level of verification is basic format verification, including format specification verification; The second level of verification is logical rationality verification, which includes numerical range verification and signal length compatibility verification; The third level of verification is a consistency verification, which includes message ID uniqueness verification and naming standardization verification; The fourth level of verification is a professional rule verification, including Motorola byte order compliance verification and start bit validity verification; The fifth level of verification is engineering semantic verification, including verification of specific specifications in the field of automotive electronics.
[0012] In some embodiments of this application, based on the foregoing scheme, the step of using the Motorola byte order conversion algorithm to convert the LSB byte order format signal to the MSB byte order format signal includes: If the length of the LSB byte order format signal is 1, no conversion is performed; If the length of the LSB byte order format signal is greater than 1, then the position of the LSB start bit within the byte is determined, and the position within the byte is the remainder obtained by dividing the LSB start bit by 8. Get the remaining available bits for the current byte. The remaining available bits for the current byte are 8 minus the position within the byte. To determine the number of bytes to span, the required number of bytes is the signal length minus the remaining available bits in the current byte. If the number of bits spanned across bytes is less than or equal to 0, then the LSB byte order signal is entirely within the current byte, and the start bit of the LSB byte order signal is the same as the start bit of the MSB byte order signal, without conversion. If the number of bytes to be spanned is greater than 0, the signal in LSB byte order format needs to be stored across bytes. If the remainder of the number of bytes to be spanned divided by 8 is 0, the signal occupies a complete byte. In this case, the number of complete bytes to be spanned is the number of bytes to be spanned divided by 8, and the number of bytes to be reduced is the number of complete bytes to be spanned minus 1. If the remainder of the number of bytes to be spanned divided by 8 is not 0, the signal part occupies the last byte. The number of complete bytes to be spanned is the largest integer not greater than the given real number. The given real number is the number of bytes to be spanned divided by 8, and the number of bytes to be reduced is the number of complete bytes to be spanned.
[0013] In some embodiments of this application, based on the aforementioned scheme, the preprocessing includes input parameter checking, initialization of cleaning parameters, removal of leading and trailing spaces, filtering of non-ASCII characters, replacement of special characters with underscores, merging of consecutive underscores, changing the position of the first and next non-numeric combination of a number combination, removing underscores, length checking, and uniqueness checking. The length check includes retaining characters whose length does not exceed the length threshold and truncating characters whose length exceeds the length threshold; Uniqueness checks include retaining unique signals and removing non-unique signals.
[0014] According to a second aspect of this application, an Excel-to-DBC file conversion system based on intelligent verification and multi-version adaptation is provided, the system comprising: The recognition module is used to automatically identify the Excel template version of an Excel file using a feature matching algorithm. The verification module is used to call the verification rule library corresponding to the identified Excel template version to perform multi-level verification on the Excel file; The conversion module is used to convert LSB byte order format signals to MSB byte order format signals using Motorola byte order conversion algorithm; The preprocessing module is used to preprocess the signals converted to MSB byte order format to obtain a file conforming to DBC format; The output module expands DBC-compliant files to multi-format compatible output.
[0015] According to a third aspect of this application, a computer-readable storage medium is provided that stores a computer program thereon, the computer program including executable instructions that, when executed by a processor, implement the method described above.
[0016] According to a fourth aspect of this application, an electronic device is provided, comprising: One or more processors; A memory for storing executable instructions of the processor, which, when executed by the one or more processors, cause the one or more processors to implement the method described above.
[0017] The beneficial effects of this application are as follows: (1) The Excel to DBC file conversion method and system based on intelligent verification and multi-version adaptation provided in this application has a high degree of intelligence: it adopts adaptive template recognition technology, which does not require manual specification of template version and automatically matches the best parsing scheme.
[0018] (2) The Excel to DBC file conversion method and system based on intelligent verification and multi-version adaptation provided in this application has accurate data processing: the professional Motorola byte order conversion algorithm ensures the accuracy of the start bit calculation.
[0019] (3) The Excel to DBC file conversion method and system based on intelligent verification and multi-version adaptation provided in this application has comprehensive verification functions: a five-level data verification system is established, covering all aspects such as format, logic, and compatibility.
[0020] (4) The Excel to DBC file conversion method and system based on intelligent verification and multi-version adaptation provided in this application has good output flexibility: it supports multiple output formats and meets the needs of different stages from basic debugging to formal release.
[0021] (5) The Excel to DBC file conversion method and system based on intelligent verification and multi-version adaptation provided in this application has strong system scalability: the modular design facilitates function expansion and supports the rapid access of new template versions and output formats.
[0022] 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
[0023] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this application, illustrate exemplary embodiments of the invention and are intended to explain the invention, but do not constitute an undue limitation thereof. In the drawings: Figure 1 This is a schematic diagram of an Excel to DBC file conversion method based on intelligent verification and multi-version adaptation according to the present invention; Figure 2 This is a logical block diagram of an Excel to DBC file conversion system based on intelligent verification and multi-version adaptation according to the present invention. Figure 3 This is a schematic diagram of an Excel to DBC file conversion system based on intelligent verification and multi-version adaptation according to the present invention. Figure 4 This is a schematic diagram of an electronic device according to the present invention. Detailed Implementation
[0024] To make the objectives, features, and advantages of this invention more apparent and understandable, the technical solutions of the embodiments of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the embodiments described below are only some embodiments of this invention, and not all embodiments. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this invention.
[0025] It should be understood that the terms "comprising" and other similar expressions in the specification, claims, and accompanying drawings of this invention are intended to cover a non-exclusive inclusion, such as a process, method, system, or apparatus that includes a series of steps or units and is not limited to the listed steps or units. Furthermore, "first" and "second" are used to distinguish different objects and are not intended to describe a specific order.
[0026] Please see Figure 1 The diagram illustrates the Excel to DBC file conversion method based on intelligent verification and multi-version adaptation of the present invention, including: Step S1: Automatically identify the Excel template version of the Excel file using a feature matching algorithm.
[0027] The basic Excel-to-DBC conversion methods provided in related technologies have certain fixed template limitations, supporting only a single fixed-format Excel template. They cannot adapt to the diverse template formats used by different OEMs or projects, and have poor version compatibility. When the Excel template structure changes, the parsing code needs to be manually modified, and they cannot automatically identify and adapt to different template versions. Furthermore, they lack scalability: they struggle to support newly added signal attributes or special format requirements, and lack a flexible extension mechanism. In this embodiment, a feature matching algorithm, including a header feature matching algorithm, a structure analysis algorithm, and a metadata recognition algorithm, is set to automatically determine the Excel template version (V1.0 / V2.0 / V3.0 / AUTO).
[0028] In this embodiment, the system verifies whether the user-specified Excel file path exists, and then checks whether the Excel file format meets the requirements, supporting only standard .xls and .xlsx format files. If the file does not exist or the format is incorrect, a clear error message is immediately provided to the user.
[0029] In this embodiment, after successfully verifying the Excel file, the system loads the Excel workbook and checks if the necessary worksheets exist. It requires at least the Matrix master data table, and also checks the existence of the Nodes and Attributes tables. For missing or non-essential worksheets, a warning message is logged, but processing continues.
[0030] In some implementations of this embodiment, the Excel template version of the Excel file is automatically identified using a feature matching algorithm, including: Step S101: Scan the header features of the Excel file, perform feature word matching based on the header features, and obtain the first score of the Excel file matching each Excel template version; Step S102: Identify the key column positions in the Excel file, perform column matching based on the key column positions, and obtain the second score of the Excel file matching each Excel template version; Step S103: Identify the file metadata of the Excel file, perform structure and attribute matching based on the file metadata, and obtain the third score of the Excel file matching each Excel template version respectively; Step S104: The first score, second score and third score of each Excel template version are matched with the Excel file respectively, and the total score of the Excel file matching each Excel template version is obtained by weighted fusion. The Excel template version of the Excel file is determined based on the total score.
[0031] Step S101 in this embodiment specifically includes: To locate the header row of an Excel file, the method is to examine the first K rows of the Excel file line by line, count the number of keywords such as "message", "signal", and "node" in each row, and select the row with the most keywords and the densest text as the header row. The header row is the header feature, where K is set to any integer from 3 to 8. Define the keywords for each Excel template version. For Excel V1.0 template: search for keywords such as "MessageName", "MessageID", and "SignalName"; for Excel V2.0 template: search for keywords such as "MsgName", "CANID", and "SigName"; for Excel V3.0 template: search for keywords such as "Message_Name", "ID_Hex", and "Signal_Name". Set scores for exact matches and incomplete matches for feature words. The score for exact matches is greater than the score for incomplete matches. Sum the scores of feature words that match each Excel template version in the Excel file to obtain the first score for each Excel template version.
[0032] Step S102 in this embodiment specifically includes: The function identifies the message name, message ID, signal name, and extended attributes of an Excel file. Specifically, identifying the message name involves scanning columns containing words related to "message," identifying the message ID involves scanning columns containing words related to "ID" or "identifier," identifying the first column containing words related to "signal," and identifying the extended attributes involves identifying the column area on the right side of the table that contains node names. Define the columns corresponding to message name, message ID, signal name, and extended attributes for each Excel template version. For Excel V1.0 template: message name is in column 1, message ID is in column 3, and signal name is in column 8. For Excel V2.0 template: message name is in column 2, message ID is in column 4, and signal name is in column 9. For Excel V3.0 template: message name is in column 1, message ID is in column 2, and extended attribute columns are also included. Set scores for columns that match the message name, message ID, signal name, and extended attributes exactly, and scores for columns that do not match exactly. The score for columns that match the message name, message ID, signal name, and extended attributes exactly is greater than the score for columns that do not match exactly. Sum the scores for matching the message name, message ID, signal name, and extended attributes exactly for each Excel template version based on the Excel file, and obtain the second score for matching each Excel template version.
[0033] Step S103 in this embodiment specifically includes: The third score is obtained by matching the Excel file to each Excel template version based on the worksheet structure and file attribute information of the Excel file.
[0034] Specifically, the worksheet structure includes worksheet name, number of worksheets, and worksheet relationships. The worksheet name is used to check the naming characteristics of the worksheets, the number of worksheets is used to count the number of worksheets containing related data, and the worksheet relationships are used to analyze the data relationships between different worksheets.
[0035] File attribute information includes creation information, version markers, and time information. Creation information is used to obtain information such as author and company from file attributes. Version markers are used to find explicit version numbers in the file. Time information is used to analyze the creation and modification time clues of the file.
[0036] The system sets scores for exact and incomplete matches of worksheet name, number of worksheets, worksheet relationships, creation information, version markers, and time information. The scores for exact matches are higher than the scores for incomplete matches of these criteria. The scores for matching each Excel template version are summed to obtain a third score for each Excel template version matched to the Excel file.
[0037] Step S104 in this embodiment also includes: Retrieve the highest total score from each Excel template version in the Excel file; If the highest total score falls within the first confidence interval, then the Excel template version corresponding to the highest total score is used as the Excel template version of the Excel file. Specifically, if the highest total score is greater than or equal to 80, then the highest total score falls within the first confidence interval. If the highest total score falls within the second confidence interval, deep learning is used to assist in the judgment and obtain the Excel template version of the Excel file. Specifically, if the highest total score is greater than or equal to 70 and less than 80, then the highest total score falls within the second confidence interval. If the highest total score falls within the third confidence interval, then manual judgment is performed to obtain the Excel template version of the Excel file. Specifically, if the highest total score is greater than or equal to 60 and less than 70, then the highest total score falls within the third confidence interval. If the highest total score falls within the fourth confidence interval, the identification fails. The rules for feature word matching, column matching, structure and attribute matching, and / or the weights of the first, second, and third scores are adjusted. Specifically, the highest total score is less than 60.
[0038] In this way, the feature matching algorithm automatically identifies different versions of Excel templates, analyzes them comprehensively from multiple dimensions, does not rely on a single feature, can adapt to subtle changes in different Excel template versions, and can continuously improve the recognition effect through learning, providing confidence assessment and avoiding false judgments. It shows a high accuracy rate in practical applications and supports adaptive parsing of multiple template versions such as V1.0, V2.0, and V3.0.
[0039] Step S2: Call the validation rule library corresponding to the identified Excel template version to perform multi-level validation on the Excel file.
[0040] The basic Excel-to-DBC conversion methods provided in related technologies have weak data validation capabilities and lack intelligent verification: they only perform basic null value checks and cannot deeply verify the logicality, rationality, and consistency of the data. Furthermore, error detection is incomplete: it cannot detect common errors such as duplicate message IDs, non-standard signal naming, and unreasonable numerical ranges. In addition, it lacks automatic correction capabilities: it only provides a prompt after detecting an error, lacking intelligent correction suggestions and automatic processing functions.
[0041] In some implementations of this example, different versions of the Excel template may differ in structure, field naming, and data format. After pre-identifying the Excel template version, a multi-level validation rule base corresponding to that version can be invoked. This ensures the accuracy and effectiveness of the validation, avoiding validation errors or omissions caused by template format mismatches.
[0042] In this embodiment, the multi-level verification includes first-level verification, second-level verification, third-level verification, fourth-level verification, and fifth-level verification.
[0043] The first level of verification is basic format verification, including format specification verification.
[0044] The second level of verification is logical rationality verification, which includes numerical range verification and signal length compatibility verification.
[0045] The third level of verification is consistency verification, which includes message ID uniqueness verification and naming standardization verification.
[0046] The fourth level of verification is professional rule verification, including Motorola byte order compliance verification and start bit validity verification.
[0047] The fifth level of verification is engineering semantic verification, which includes verification of specific specifications in the field of automotive electronics.
[0048] In this embodiment, the format specification verification includes checking whether the message name format conforms to the naming convention (starting with a letter and containing only letters, numbers, and underscores), whether the message identifier is within the valid range (0-0x7FF), and whether the signal name contains illegal characters, among other basic format issues.
[0049] If the verification message name format does not conform to the naming convention, a message indicating an error in the verification message name format will be displayed. If the verification message identifier is not within the valid range, a message indicating an error in the verification message identifier will be displayed. If the verification signal name contains illegal characters, an error message will be displayed indicating that the verification signal name is incorrect.
[0050] In this embodiment, the signal length compatibility check includes verifying whether the signal length is within a reasonable range (1-64 bits), verifying whether the combination of the start bit and the signal length will cause the bit field to exceed the 63-bit limit, and the numerical range check includes verifying whether the numerical range setting is reasonable.
[0051] If the verification signal length is not within a reasonable range, a message indicating an error in the verification signal length will be displayed. If the combination of the start bit and the signal length causes the bit field to exceed the 63-bit limit, an error message will be displayed indicating an incorrect combination of the start bit and the signal length. If the value range is set incorrectly, a message indicating an error in the value range setting will be displayed.
[0052] In this embodiment, message ID uniqueness verification includes verifying the uniqueness of message identifiers (duplicate message identifiers are not allowed), and naming convention verification includes verifying the uniqueness of signal names within the message (duplicate signal names are not allowed), and verifying the uniqueness of node names (duplicate node names are not allowed), ensuring that the generated DBC file does not have conflicting definitions.
[0053] If there is a duplicate message identifier, an error message will be displayed. If there are duplicate signal names, an error message will be displayed indicating that the signal name is incorrect. If there are duplicate node names, an error message will be displayed.
[0054] In this embodiment, the start bit validity check includes verifying the correctness of the start bit calculation, the Motorola byte order compliance check includes verifying the compliance of the Motorola byte order, and verifying the degree of matching between signal attributes and data types.
[0055] If the starting bit is calculated incorrectly, a message indicating an error in the starting bit will be displayed. If the Motorola byte order is not compliant, a message indicating a Motorola byte order error will be displayed. If the degree of matching between the verification signal attribute and the data type is lower than the preset matching threshold, a message indicating a low degree of matching between the verification signal attribute and the data type will be displayed.
[0056] In this embodiment, the specific specification verification in the field of automotive electronics includes verifying whether the unit of the verification signal conforms to engineering conventions, whether the range of the verification value meets the actual application requirements, and whether the resolution of the verification signal meets the control accuracy requirements.
[0057] If the signal unit does not conform to engineering conventions, an error message indicating an incorrect signal unit will be displayed. If the numerical range does not meet the actual application requirements, a message indicating an error in the numerical range will be displayed. If the signal resolution is lower than the preset accuracy threshold, a signal resolution error message will be displayed.
[0058] Step S3: Use the Motorola byte order conversion algorithm to convert the LSB byte order format signal to the MSB byte order format signal.
[0059] In CAN communication, Motorola uses two byte orders: MSB (Most Significant Bit): the most significant bit comes first, and the signals are arranged starting from the most significant bit of the byte; and LSB (Least Significant Bit): the least significant bit comes first, and the signals are arranged starting from the least significant bit of the byte.
[0060] The basic Excel to DBC conversion methods provided in related technologies lack professional processing capabilities and are oversimplified in byte order handling: the byte order handling of Motorola format is not professional enough, especially the conversion of LSB (Least Significant Bit) and MSB (Most Significant Bit) formats lacks effective algorithm support, and there are defects in signal length and start bit compatibility handling, which can easily generate incorrect DBC files.
[0061] Specifically, this embodiment uses the Motorola byte order conversion algorithm to convert a signal in LSB byte order format to a signal in MSB byte order format, including: Step S301: If the length of the LSB byte order format signal is 1, then no conversion is performed; Step S302: If the length of the LSB byte order format signal is greater than 1, then determine the position of the LSB start bit in the LSB byte order format signal within the byte. The position within the byte is the remainder obtained by dividing the LSB start bit by 8. Step S303: Obtain the remaining available bits of the current byte. The remaining available bits of the current byte are 8 minus the position within the byte. Step S304: Obtain the number of bytes to be crossed. The number of bytes to be crossed is the signal length minus the remaining available bits of the current byte. Step S305: If the number of bits to be crossed in a byte is less than or equal to 0, then the LSB byte order signal is completely within the current byte, and the start bit of the LSB byte order signal is set to the start bit of the MSB byte order signal without conversion. If the number of bytes to be spanned is greater than 0, the signal in LSB byte order format needs to be stored across bytes. If the remainder of the number of bytes to be spanned divided by 8 is 0, the signal occupies a complete byte. In this case, the number of complete bytes to be spanned is the number of bytes to be spanned divided by 8, and the number of bytes to be reduced is the number of complete bytes to be spanned minus 1. If the remainder of the number of bytes to be spanned divided by 8 is not 0, the signal part occupies the last byte. The number of complete bytes to be spanned is the largest integer not greater than the given real number. The given real number is the number of bytes to be spanned divided by 8, and the number of bytes to be reduced is the number of complete bytes to be spanned.
[0062] Therefore, an innovative Motorola byte order conversion algorithm is employed, considering multiple factors such as signal length, byte boundaries, and bit order relationships, to convert the start bit of a signal in LSB byte order format to the start bit of a signal in MSB byte order format. This ensures the accuracy of the conversion result, precisely achieving the conversion from LSB to MSB format, resolving the start bit calculation error problem, and ensuring the correct layout of the signal in the physical bytes. Furthermore, this algorithm can correctly handle various boundary cases, including the special case where the signal length is 1.
[0063] Step S4: Preprocess the signal converted to MSB byte order format to obtain a file conforming to DBC format.
[0064] In some embodiments of this example, the signal converted to MSB byte order format is preprocessed.
[0065] In some embodiments of this example, preprocessing includes input parameter checking, initialization of cleaning parameters, removal of leading and trailing spaces, filtering of non-ASCII characters, replacement of special characters with underscores, merging of consecutive underscores, changing the position of the first and next non-numeric combination of a number combination, removing underscores, length checking, and uniqueness checking.
[0066] In this embodiment, the length check includes retaining characters whose length does not exceed the length threshold and truncating characters whose length exceeds the length threshold.
[0067] In this embodiment, the uniqueness check includes retaining signals that are unique and removing signals that are not unique.
[0068] In one specific embodiment, the original input is "123-Engine#speed / Signal". After removing leading and trailing spaces, we get "123-Engine#speed / Signal". After filtering non-ASCII characters, we get "123-Engine# / Signal". After replacing special characters, we get "123_Engine__Signal". After merging consecutive underscores, we get "123_Engine_Signal". After processing the beginning of numbers, we get "Signal_123_Engine_Signal". After unifying the style, we get "Signal123EngineSignal". After length checking, we get "Signal123EngineSignal" (length 23, which meets the requirement). After uniqueness checking, we get no conflicts and keep it as is. Finally, we output "Signal123EngineSignal".
[0069] In this way, automatic normalization and standardization of signal names are achieved, including: illegal character handling: automatically removing or replacing characters that do not conform to the DBC specification; naming standardization: ensuring that signal names begin with a letter and contain only letters, numbers, and underscores; length optimization: automatically truncating excessively long names to ensure compliance with DBC format restrictions; and keyword avoidance: automatically detecting and avoiding the use of DBC reserved keywords.
[0070] Step S5: Extend the DBC-compliant file to multi-format adapted output.
[0071] In some implementations of this embodiment, four DBC file formats—BASIC, STANDARD, EXTENDED, and AUTOSAR—are supported to meet the needs of different application scenarios.
[0072] Specifically, the BASIC format is generated, with the message part retaining only the message ID, message name, message length, and sending node; the signal part retaining only the signal name, start bit, signal length, byte order, and data type; and the node part retaining only the names of the nodes actually participating in the communication.
[0073] Generate a STANDARD format, including complete information for all message, signal, and node sections, retaining basic comments and descriptions, and including all necessary communication attributes. The message section includes complete attributes such as message ID, message name, message length, sending node, period, and delay time; the signal section includes complete attributes such as signal name, start bit, signal length, byte order, data type, scaling factor, offset, value range, and unit; the node section includes the names of the nodes actually participating in the communication and all defined network nodes.
[0074] The EXTENDED format is generated, which includes not only all the contents of the STANDARD format, but also the signal timeout attribute definition, the addition of signal initial value attribute, the configuration of signal transmission type attribute, the definition of network management related attributes, and a complete description for each signal value table.
[0075] The system generates AUTOSAR format data. For AUTOSAR metadata configuration, it adds AUTOSAR-specific attribute definitions, configures the AUTOSAR namespace, and sets AUTOSAR version information. For data type conversion, it maps traditional data types to AUTOSAR types, handles AUTOSAR-specific data alignment requirements, and supports AUTOSAR bit data types. For communication mode adaptation, it configures AUTOSAR communication modes (periodic, event-based, etc.), sets AUTOSAR timing parameters, and defines the PDU (Protocol Data Unit) structure. For system signal processing, it identifies and specially processes AUTOSAR system signals, configures ECU system attributes, defines service interfaces, and performs AUTOSAR specification checks for compliance, automatically corrects non-compliance items, and generates a compliance verification report.
[0076] According to the second aspect of this application, such as Figure 2 and Figure 3 As shown, this embodiment provides a system for converting Excel to DBC files based on intelligent verification and multi-version adaptation. The system includes: The recognition module is used to automatically identify the Excel template version of an Excel file using a feature matching algorithm. The verification module is used to call the verification rule library corresponding to the identified Excel template version to perform multi-level verification on the Excel file; The conversion module is used to convert LSB byte order format signals to MSB byte order format signals using Motorola byte order conversion algorithm; The preprocessing module is used to preprocess the signals converted to MSB byte order format to obtain a file conforming to DBC format; The output module expands DBC-compliant files to multi-format compatible output.
[0077] Specifically, this embodiment corresponds one-to-one with the above method embodiments. The functions of each module have been described in detail in the corresponding method embodiments, so they will not be repeated here.
[0078] In this embodiment, the modules communicate through standardized interfaces to ensure the scalability and maintainability of the system.
[0079] According to a third aspect of this application, this embodiment provides a computer-readable storage medium having a computer program stored thereon, the computer program including executable instructions that, when executed by a processor, implement the method described above.
[0080] The present invention can implement all or part of the processes in the above methods, or it can be accomplished by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include: any entity or system capable of carrying computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium can be appropriately added or removed according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, the computer-readable medium does not include electrical carrier signals and telecommunication signals.
[0081] According to a fourth aspect of this application, an electronic device is provided, such as... Figure 4 As shown, it includes: One or more processors; Memory is used to store executable instructions for the processor, which, when executed by one or more processors, cause one or more processors to implement the methods described above.
[0082] Electronic devices are manifested in the form of general-purpose computing devices. Components of an electronic device may include, but are not limited to: at least one processor, at least one memory, and a bus connecting different system components (including memory and processor).
[0083] The processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor. The processor is the control center of a computer system, connecting all parts of the computer system through various interfaces and lines.
[0084] Memory can be used to store computer programs and / or modules. The processor implements various functions of the computer system by running or executing the computer programs and / or modules stored in the memory, and by accessing data stored in the memory. Memory can mainly include a program storage area and a data storage area. The program storage area can store the operating system and at least one application program required for a function (e.g., sound playback, image playback, etc.); the data storage area can store data created based on the use of the mobile phone (e.g., audio data, video data, etc.). Furthermore, memory can include high-speed random access memory, and can also include non-volatile memory, such as hard disks, RAM, plug-in hard disks, SmartMedia Cards (SMC), Secure Digital (SD) cards, Flash Cards, at least one disk storage device, flash memory device, or other volatile solid-state storage devices.
[0085] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, servers, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage and memory) containing computer-usable program code.
[0086] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), servers, and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A system that specifies functions in one or more boxes.
[0087] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including an instruction set implemented in a process. Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0088] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0089] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0090] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0091] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for converting Excel to DBC files based on intelligent verification and multi-version adaptation, characterized in that, include: Automatically identify the Excel template version of an Excel file using a feature matching algorithm; The system calls the validation rule library corresponding to the identified Excel template version to perform multi-level validation on the Excel file. The Motorola byte order conversion algorithm is used to convert LSB byte order format signals to MSB byte order format signals. The signal converted to MSB byte order format is preprocessed to obtain a file conforming to DBC format; Extend DBC-compliant files to multi-format compatible output.
2. The method for converting Excel to DBC files based on intelligent verification and multi-version adaptation according to claim 1, characterized in that, The automatic identification of the Excel template version of an Excel file using a feature matching algorithm includes: Scan the header features of the Excel file, perform feature word matching based on the header features, and obtain the first score of the Excel file matching each Excel template version; Identify the key column positions in the Excel file, perform column matching based on the key column positions, and obtain the second score for each Excel template version matched by the Excel file. Identify the file metadata of an Excel file, perform structural and attribute matching based on the file metadata, and obtain the third score of the Excel file matching each Excel template version; The Excel file is matched against the first, second, and third scores of each Excel template version, and then weighted and combined to obtain the total score of the Excel file matching each Excel template version. The Excel template version of the Excel file is determined based on the total score.
3. The method for converting Excel to DBC files based on intelligent verification and multi-version adaptation according to claim 2, characterized in that: For feature words, columns, structures, and attributes, scores for exact matches and incomplete matches are set respectively, with the score for an exact match being higher than the score for an incomplete match. Based on the scores of matching the feature words, columns, structure and attributes of the Excel file with each Excel template version, the first score, second score and third score of the Excel file matching each Excel template version are obtained.
4. The method for converting Excel to DBC files based on intelligent verification and multi-version adaptation according to claim 3, characterized in that: For Excel V1.0 templates, the feature words are MessageName, MessageID, and SignalName; for Excel V2.0 templates, the feature words are MsgName, CANID, and SigName; for Excel V3.0 templates, the feature words are Message_Name, ID_Hex, and Signal_Name. The columns are: columns related to message name, columns related to message ID, columns related to signal name, and columns related to extended attributes; The structure and attributes include worksheet structure and file attribute information. The worksheet structure includes worksheet name, number of worksheets and worksheet relationships. The file attribute information includes creation information, version tag and time information.
5. The method for converting Excel to DBC files based on intelligent verification and multi-version adaptation according to claim 1, characterized in that: The multi-level verification includes first-level verification, second-level verification, third-level verification, fourth-level verification, and fifth-level verification; The first level of verification is basic format verification, including format specification verification; The second level of verification is logical rationality verification, which includes numerical range verification and signal length compatibility verification; The third level of verification is a consistency verification, which includes message ID uniqueness verification and naming standardization verification; The fourth level of verification is a professional rule verification, including Motorola byte order compliance verification and start bit validity verification; The fifth level of verification is engineering semantic verification, including verification of specific specifications in the field of automotive electronics.
6. The method for converting Excel to DBC files based on intelligent verification and multi-version adaptation according to claim 1, characterized in that, The method of using the Motorola byte order conversion algorithm to convert LSB byte order format signals to MSB byte order format signals includes: If the length of the LSB byte order format signal is 1, no conversion is performed; If the length of the LSB byte order format signal is greater than 1, then the position of the LSB start bit within the byte is determined, and the position within the byte is the remainder obtained by dividing the LSB start bit by 8. Get the remaining available bits for the current byte. The remaining available bits for the current byte are 8 minus the position within the byte. To determine the number of bytes to span, the required number of bytes is the signal length minus the remaining available bits in the current byte. If the number of bits spanned across bytes is less than or equal to 0, then the LSB byte order signal is entirely within the current byte, and the start bit of the LSB byte order signal is the same as the start bit of the MSB byte order signal, without conversion. If the number of bytes to be spanned is greater than 0, the signal in LSB byte order format needs to be stored across bytes. If the remainder of the number of bytes to be spanned divided by 8 is 0, the signal occupies a complete byte. In this case, the number of complete bytes to be spanned is the number of bytes to be spanned divided by 8, and the number of bytes to be reduced is the number of complete bytes to be spanned minus 1. If the remainder of the number of bytes to be spanned divided by 8 is not 0, the signal part occupies the last byte. The number of complete bytes to be spanned is the largest integer not greater than the given real number. The given real number is the number of bytes to be spanned divided by 8, and the number of bytes to be reduced is the number of complete bytes to be spanned.
7. The method for converting Excel to DBC files based on intelligent verification and multi-version adaptation according to claim 1, characterized in that: Preprocessing includes input parameter checking, initialization and cleaning parameters, removal of leading and trailing spaces, filtering of non-ASCII characters, replacement of special characters with underscores, merging of consecutive underscores, swapping the position of the first and next non-numeric combination of a number combination, removing underscores, length checking, and uniqueness checking. The length check includes retaining characters whose length does not exceed the length threshold and truncating characters whose length exceeds the length threshold; Uniqueness checks include retaining unique signals and removing non-unique signals.
8. An Excel-to-DBC file conversion system based on intelligent verification and multi-version adaptation, characterized in that, The system includes: The recognition module is used to automatically identify the Excel template version of an Excel file using a feature matching algorithm. The verification module is used to call the verification rule library corresponding to the identified Excel template version to perform multi-level verification on the Excel file; The conversion module is used to convert LSB byte order format signals to MSB byte order format signals using Motorola byte order conversion algorithm; The preprocessing module is used to preprocess the signals converted to MSB byte order format to obtain a file conforming to DBC format; The output module expands DBC-compliant files to multi-format compatible output.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, The computer program includes executable instructions that, when executed by a processor, implement the method of any one of claims 1-7.
10. An electronic device, characterized in that, include: One or more processors; A memory for storing executable instructions of the processor, which, when executed by the one or more processors, cause the one or more processors to perform the method according to any one of claims 1-7.