Method and device for converting communication matrix into dbc file and computer equipment
By converting the communication matrix into a dbc file, the problem of excessive useless information and time-consuming manual writing in the air-conditioning control module message analysis is solved, and the dbc file is automatically generated, which improves the accuracy and efficiency of the analysis.
Patent Information
- Application Number
- CN202411864397.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-17
- Publication Date
- 2025-04-18
AI Technical Summary
During the message collection and analysis process of the air conditioning control module, there is a large amount of useless information, which leads to a large amount of reading workload for testers, manual writing of dbc files is time-consuming and prone to errors, reducing the accuracy and efficiency of message analysis.
Provides a method of converting a communication matrix into a dbc file, including obtaining a communication matrix, performing format checks and converting it into two-dimensional tabular data, processing line by line to obtain information instances, and storing these information instances into a dbc file.
Generating dbc files in an automated way reduces the time and errors of manual writing and improves the accuracy and efficiency of message analysis.
Smart Images

Figure CN119847995A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method, a device and a computer equipment for converting a communication matrix into a dbc file. Background Art
[0002] In the problem screening of air-conditioning control modules, message collection and message analysis often take up a lot of time. Under the current situation, the following problems exist: the collected messages contain a lot of useless information, the reading workload of testers is large, the DBC files manually written by testers are large in workload and time-consuming, and some errors are always inevitable, which makes the accuracy and efficiency of message analysis low. Summary of the invention
[0003] In view of this, an embodiment of the present invention provides a method, an apparatus and a computer device for converting a communication matrix into a dbc file, so as to improve the accuracy and efficiency of message analysis.
[0004] On the one hand, an embodiment of the present invention provides a method for converting a communication matrix into a dbc file, comprising: obtaining the communication matrix; Checking the communication matrix, and when the check passes, converting the communication matrix into two-dimensional table data; Processing the two-dimensional table data row by row to obtain information instances; The information instance is stored in the dbc file.
[0005] Optionally, the checking the communication matrix includes: The communication matrix is subjected to one or any combination of format check, matrix file specification check and / or header check.
[0006] Optionally, the information instance includes a first information instance and a second information instance, and the step of processing the two-dimensional table data row by row to obtain the information instance includes: Classifying the two-dimensional table data to generate message data and signal data; Processing the message name of the message data to perform a standard check on the message name; storing the message data in a first information instance; Processing the signal name of the signal data to perform a standard check on the signal name; The signal data is stored in a second information instance.
[0007] Optionally, the processing the message name of the message data includes: Performing vectorization processing on the message name based on TF-IDF technology to generate a first message vector; Performing vectorization processing on the set message name library based on TF-IDF technology to generate a second message vector; Calculating the cosine similarity between the first message vector and the second message vector; When the cosine similarity between the first message vector and one of the second message vectors is 1, it is determined that the message name meets the specification.
[0008] Optionally, the processing the signal name of the signal data includes: Performing vectorization processing on the signal name based on TF-IDF technology to generate a first signal vector; Based on the TF-IDF technology, the set signal name library is vectorized to generate a second signal vector; Calculating the cosine similarity between the first signal vector and the second signal vector; When the cosine similarity between the first signal vector and one of the second signal vectors is 1, it is determined that the signal name complies with the specification.
[0009] Optionally, storing the information instance in the dbc file includes: Reading the first information instance, and inputting the first information instance into the dbc file according to a first specified format; The second information instance is read, and the second information instance is input into the dbc file according to a second specified format.
[0010] Optionally, the first information instance includes a message name, a message ID, a message sending type, a message cycle time, and a message input type; The first specified format includes: inputting the dbc file in the format of "<message ID><message name>:<message length><node>"; and then inputting the format of "<message ID><message cycle time>" and "<message ID><message input type>" into the dbc file; The second information example includes a signal name, a start bit, a signal length, a scale factor, an offset, a unit, a conversion formula, a signal truth table, a physical minimum value, a physical maximum value, an attribute, an attribute value, a range, and a message ID; The second specified format includes: inputting the dbc file in the format of “<signal name>:<starting bit>|<signal length>@<endian><signed or unsigned>(<scale factor>, <offset>[physical minimum value|physical maximum value]) “<unit>””, and then inputting the dbc file in the format of “ “<attribute>”<message ID><signal name><attribute value>”, inputting its conversion formula and range in the format of “<message ID><signal name><conversion formula><range>”, and inputting its truth table in the format of “<message ID><signal name><key 1><value 1><key 2><value 2>…”.
[0011] On the other hand, an embodiment of the present invention provides a device for converting a communication matrix into a dbc file, comprising: An acquisition module, used for acquiring the communication matrix; A conversion module, used for checking the communication matrix, and when the check passes, converting the communication matrix into two-dimensional table data; A processing module, used for processing the two-dimensional table data row by row to obtain information instances; A storage module is used to store the information instance in the dbc file.
[0012] On the other hand, an embodiment of the present invention provides a storage medium, which includes a stored program, wherein when the program is running, the device where the storage medium is located is controlled to execute the method of converting the communication matrix into a dbc file.
[0013] On the other hand, an embodiment of the present invention provides a computer device, including a memory and a processor, wherein the memory is used to store information including program instructions, and the processor is used to control the execution of the program instructions, wherein the program instructions, when loaded and executed by the processor, implement the steps of the method for converting the above-mentioned communication matrix into a dbc file.
[0014] In the technical solution provided by the embodiment of the present invention, a communication matrix is obtained; the communication matrix is checked, and when the check passes, the communication matrix is converted into two-dimensional table data; the two-dimensional table data is processed row by row to obtain information instances; and the information instances are stored in a dbc file. In the technical solution provided by the embodiment of the present invention, a dbc file can be automatically output according to the communication matrix input by the user, and manual writing is not required throughout the process, thereby improving the accuracy and efficiency of message analysis. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0016] Figure 1 A flow chart of a method for converting a communication matrix into a dbc file provided by an embodiment of the present invention; Figure 2 A flowchart of an example of processing two-dimensional table data row by row to obtain information provided by an embodiment of the present invention; Figure 3 A flowchart of processing a message name of message data provided by an embodiment of the present invention; Figure 4 A flowchart of processing a signal name of signal data provided by an embodiment of the present invention; Figure 5 A schematic diagram of a device for converting a communication matrix into a dbc file provided by an embodiment of the present invention; Figure 6 A schematic diagram of a computer device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0017] In order to better understand the technical solution of the present invention, the embodiments of the present invention are described in detail below with reference to the accompanying drawings.
[0018] It should be clear that the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0019] The terms used in the embodiments of the present invention are only for the purpose of describing specific embodiments, and are not intended to limit the present invention. The singular forms "a", "said" and "the" used in the embodiments of the present invention and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings.
[0020] It should be understood that the term "and / or" used in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.
[0021] In the related technology, Vehicle Spy 3 software has complex functions and some testers are not familiar with its operation; the collected messages contain a lot of useless information, and the testers have a heavy workload to read; the DBC files manually written by testers are labor-intensive and time-consuming, and some errors are always inevitable, which makes the accuracy and efficiency of test engineers in message analysis low.
[0022] In order to solve the technical problems in the related art, the embodiment of the present invention provides a software-assisted tool to solve the above-mentioned problems of repetitive and mechanical operations and improve efficiency.
[0023] In the embodiment of the present invention, a software-assisted tool is used to solve the above technical problems, wherein the tool has two branches: the communication matrix to dbc conversion function is used to solve the huge time-consuming problem caused by manually writing dbc files, and at the same time, the content of the communication matrix is standardized checked; the csv format message reading function is used to solve the problem that the message contains useless information, the reading volume is large, and there is no intuitive change trend chart.
[0024] An embodiment of the present invention provides a method for converting a communication matrix into a dbc file. Figure 1 A flow chart of a method for converting a communication matrix into a dbc file provided by an embodiment of the present invention is shown as follows: Figure 1 As shown, the method includes: Step 102: Obtain the communication matrix.
[0025] In the embodiment of the present invention, the communication matrix input by the user can be read.
[0026] Step 104 , check the communication matrix, and if the check passes, convert the communication matrix into two-dimensional table data.
[0027] In the embodiment of the present invention, one or any combination of format check, matrix file specification check and / or header check may be performed on the communication matrix.
[0028] Among them, the format check includes checking whether the format of the communication matrix is Microsoft Excel format, the matrix file specification check includes checking whether the communication matrix has a worksheet named "Matrix", and the header check includes checking whether the header name of the communication matrix meets the specification requirements. For example, the Chinese and English names of the header must be exactly the same as the specified template and conform to the format of "English name + line break + Chinese name").
[0029] For example, Table 1 is a table of Chinese and English names of table headers, as shown in Table 1 below.
[0030] Table 1 In the embodiment of the present invention, if the check fails, the user will be reminded to change the communication matrix, and the process returns to step 102 to update the modified communication matrix.
[0031] In the embodiment of the present invention, when the check is passed, the communication matrix is converted into two-dimensional table data matching the pandas library, and the two-dimensional table data can be in DataFrame format.
[0032] Step 106: Process the two-dimensional table data row by row to obtain information instances.
[0033] In the embodiment of the present invention, the information instance includes a first information instance and a second information instance.
[0034] Figure 2 A flowchart of an example of processing two-dimensional table data row by row to obtain information is provided in an embodiment of the present invention, such as Figure 2 As shown, step 106 includes: Step 1062: Classify the two-dimensional table data to generate message data and signal data.
[0035] In the embodiment of the present invention, the two-dimensional table data is read row by row. If the 0th, 2nd, 3rd, 4th, and 5th columns of the row (these columns are the information of the message) have content and the 6th to 22nd columns have no content (these columns are the information of the signal), it is classified as "message data", and a first information instance (an instance of the Message class) is added to store its information (including the message name, message identifier, message sending type, message cycle time, message length, and signal list). If the 6th to 22nd columns of the row have content and the 0th, 2nd, 3rd, 4th, and 5th columns have no content, it is classified as "signal data", and a second information instance (an instance of the Signal class) is added to store its information (including the signal name, arrangement format, start byte, start bit, signal length, data type, signal full name, Chinese name, scale factor, offset, unit, conversion formula, signal truth table, physical minimum value, physical maximum value, initial value, invalid value, and the name of the message to which it belongs) is added, and it is placed in the signal list of the nearest Message class instance.
[0036] In the embodiment of the present invention, Table 2 shows the relationship between messages and signals in a communication matrix, as shown in Table 2 below.
[0037] Table 2 Among them, signal A and signal B belong to message 1, and signal C belongs to message 2.
[0038] Step 1064: Process the message name of the message data to perform a standard check on the message name.
[0039] Figure 3 A flowchart of processing a message name of message data provided by an embodiment of the present invention, such as Figure 3 As shown, step 1064 includes: Step 10642: Vectorize the message name based on the TF-IDF technology to generate a first message vector.
[0040] In an embodiment of the present invention, a standard check is performed on the message name and matched with a set message name library. Since the message name library and the signal name library have a large amount of data, the traditional string matching method is time-consuming. Therefore, the TF-IDF (Term Frequency-Inverse Document Frequency) technology is used in the embodiment of the present invention. TF-IDF is a commonly used text representation method, which can convert text into a vector and reflect the importance of each word in the text.
[0041] Step 10644: vectorize the set message name library based on the TF-IDF technology to generate a second message vector.
[0042] Step 10646: Calculate the cosine similarity between the first message vector and the second message vector.
[0043] In the embodiment of the present invention, the cosine similarity can be used to characterize the similarity of the message names.
[0044] Step 10648: When the cosine similarity between the first message vector and one of the second message vectors is 1, it is determined that the message name meets the specification.
[0045] In an embodiment of the present invention, if the cosine similarity between the first message vector and a certain one of the second message vectors is less than 1 but greater than 0.8, and the remaining cosine similarities are all less than 0.8, a spelling error or improper use of abbreviations may have occurred. At this time, it is corrected to the corresponding standard name, and a statement is output on the console to prompt the user; if the cosine similarity between the first message vector and two or more of the second message vectors is less than 1 but greater than 0.8, or all cosine similarities with the second message vector are less than 0.8, then the message name is not named in a standard manner, and no new information instance (instance of the Message class) is added and the user is prompted, the entire program is interrupted, and the process ends.
[0046] Step 1066: Store the message data in the first information instance.
[0047] In an embodiment of the present invention, the remaining information of the message data (message identifier (ID), message sending type, message cycle time, message length) can be read and used as attributes of this Message class instance, and a signal list attribute is added to store all signals under this message. After the instance is created, this instance is recorded as the most recent instance of the Message class.
[0048] Step 1068: Process the signal name of the signal data to perform a standard check on the signal name.
[0049] In the embodiment of the present invention, the execution steps of steps 10682-10688 are similar to the execution steps of steps 10642-10648, and are not repeated here.
[0050] Figure 4 A flowchart of processing the signal name of signal data provided by an embodiment of the present invention, such as Figure 4 As shown, step 1068 includes: Step 10682: Vectorize the signal name based on the TF-IDF technology to generate a first signal vector.
[0051] Step 10684: vectorize the set signal name library based on TF-IDF technology to generate a second signal vector.
[0052] Step 10686: Calculate the cosine similarity between the first signal vector and the second signal vector.
[0053] Step 10688: When the cosine similarity between the first signal vector and one of the second signal vectors is 1, it is determined that the signal name meets the specification.
[0054] In an embodiment of the present invention, after the signal name specification check is completed, an additional check of the inclusion relationship of the message signal is required. By default, the current signal belongs to the message stored in the most recent instance of the Message class. Check whether the message name to which the signal belongs in the signal name library is the same as the message name stored in the most recent instance of the Message class. If they are not the same, the user is prompted, the entire program is interrupted, and the process ends.
[0055] Step 1070: Store the signal data into the second information instance.
[0056] In the embodiment of the present invention, signal data can be placed into an instance of the Signal class one by one according to the signal data, including signal name, arrangement format, starting byte, starting bit, signal length, data type, full name of the signal, Chinese name, scale factor, offset, unit, conversion formula, signal truth table, physical minimum value, physical maximum value, initial value, invalid value, and the name of the message to which it belongs. According to the specification, the signal truth table should be in the format of "$0=value0 $1=value1 $ 2=value2 ...", so it is divided by the "$" character and the "=" character to obtain the key-value pair as the content of the signal truth table.
[0057] In the embodiment of the present invention, after reading all rows of the two-dimensional table data, the program stores all instances of the Message class.
[0058] In the embodiment of the present invention, some fixed contents (such as node name, symbol type, etc.) may be input into the dbc file.
[0059] Step 108: Store the information instance into a dbc file.
[0060] In the embodiment of the present invention, the first information instance is read and input into the dbc file according to the first specified format; the second information instance is read and input into the dbc file according to the second specified format.
[0061] In the embodiment of the present invention, the first information instance includes a message name, a message ID, a message sending type, a message cycle time, and a message input type.
[0062] The second information example includes signal name, start bit, signal length, scale factor, offset, unit, conversion formula, signal truth table, physical minimum value, physical maximum value, attribute, attribute value, range, and message ID.
[0063] Among them, the first specified format includes: inputting the dbc file in the format of “BO_<message ID><message name>:<message length><node>”; and then inputting the dbc file in the format of “BA_“GenMsgCycleTime” BO_<message ID><message cycle time>” and “BA_“GenMsgSendType” BO_<message ID><message input type>”.
[0064] The second specified format includes: entering the dbc file in the format of “SG_<signal name>:<starting bit>|<signal length>@<endian><signed>(<scale factor>,<offset>[physical minimum value|physical maximum value]) “<unit>””, and then entering the dbc file in the format of “BA_ “<attribute>” SG_<message ID><signal name><attribute value>”, entering its conversion formula and range in the format of “CM_ SG_<message ID><signal name><conversion formula><range>”, and entering its truth table in the format of “VAL_<message ID><signal name><key 1><value 1><key 2><value 2>…”.
[0065] In the embodiment of the present invention, the user only needs to input the communication matrix, and the above steps can be automatically executed and a dbc file can be output, and manual writing is not required in the whole process.
[0066] In the technical solution provided by the embodiment of the present invention, a communication matrix is obtained; the communication matrix is checked, and when the check passes, the communication matrix is converted into two-dimensional table data; the two-dimensional table data is processed row by row to obtain information instances; and the information instances are stored in a dbc file. In the technical solution provided by the embodiment of the present invention, a dbc file can be automatically output according to the communication matrix input by the user, and manual writing is not required throughout the process, thereby improving the accuracy and efficiency of message analysis.
[0067] The technical solution provided by the embodiment of the present invention saves software development outsourcing project costs and reduces time costs.
[0068] In the technical solution provided by the embodiment of the present invention, there is no need to manually write a dbc file, and the program can be generated with one click, and the time consumed is reduced from an average of 4 to 6 hours to an average of 1 minute, and the efficiency is improved by 99%.
[0069] In addition, the software auxiliary tool provided in the embodiment of the present invention can also be used to read csv format messages, which can solve the problems of messages containing useless information, large reading volume and no intuitive change trend chart.
[0070] In the embodiment of the present invention, the data of the csv format message is read through the following steps.
[0071] Step S1, obtaining the message data in csv format input by the user.
[0072] In the embodiment of the present invention, the message data is exported by the controller area network (CAN) acquisition software (such as Vehicle Spy), in which it records the message or signal collected at the current timestamp, which is relatively chaotic, and it is not easy to view the change trend of a certain signal over time, and there is no intuitive line graph to reflect it.
[0073] Step S2: Generate a data table according to the message data in csv format.
[0074] In the embodiment of the present invention, a time axis (row) can be generated according to the message data in csv format input by the user, and all messages and signal names in the message data in csv format can be obtained to generate columns, and the two are combined into a data table, so that the user can view a certain column (a certain signal), and each row is the value of the signal at the current timestamp. For missing value filling, the processing method is to use the signal value of the last update.
[0075] Table 3 shows the values of signal A and signal B on the time axis, as shown in Table 3 below.
[0076] Table 3 As shown in Table 3 above, the value of signal A at 0.1 second is 1, the value at 0.5 second is 0, and the value at 0.8 second is 1. The value of signal B at 0.2 second is 2, the value at 0.4 second is 3, the value at 0.6 second is 4, the value at 0.8 second is 5, and the value at 1.0 second is 6.
[0077] Step S3: Draw a signal change line graph according to the data table.
[0078] In the embodiment of the present invention, the user can choose to save the data table or draw a line graph of the signal change of the value of the signal to be viewed. The user can select the time interval to be viewed (if not filled in, the entire time interval will be used by default), check the name of the signal to be viewed, and then click Draw. During the drawing process, the program will perform relevant processing on the signal selected by the user.
[0079] In this step, a signal change line graph may be drawn according to the data table based on the following algorithm.
[0080] Label Encoder: A machine learning algorithm that encodes the values of discrete non-numeric variables so that each different value is mapped to a single number and finally converted into a numeric variable. This allows the value of the signal to be displayed in a line chart, because the vertical axis of the line chart must be a numeric value. The size of the value does not affect the user's analysis, because the user is concerned about the change in the value of discrete numeric variables, not the size of the value.
[0081] Normalize: A machine learning algorithm that normalizes numerical variables so that their value range is within [0,1]. Otherwise, when variables with different value ranges are plotted in the same line graph, the change trend of the variable with a small value range will not be obvious, or even disappear. When all value ranges are compressed to the same interval, the steepness of each signal change will be the same. The size of the value does not affect the user's analysis, because the user is more concerned about the timing of the change between signals rather than the size of the two signal values.
[0082] In the embodiment of the present invention, the matplotlib library can be used to draw a signal change line graph, with the horizontal axis as the time axis and the vertical axis as the value.
[0083] In the embodiment of the present invention, the user only needs to input the CSV format message without any other operations. The program will automatically analyze the message. After that, the user only needs to select the signal to be viewed, and the program will automatically draw a line chart of the signal change. This solves the problems encountered by test engineers in message analysis, such as large amount of reading, many useless messages and signals, and the lack of intuitive display of signal values.
[0084] In the technical solution provided by the embodiment of the present invention, the auxiliary function of reading CSV format messages enables test engineers to view the value of signals more intuitively, filter out useless messages and signals, and view the line graph of signal changes, making the change of signal values more intuitive. According to statistical surveys, after using auxiliary tools, the time spent on message analysis by test engineers was reduced from an average of 6.32 hours to 3.78 hours, and the efficiency was improved by about 40%.
[0085] The software auxiliary tool provided by the embodiment of the present invention is not only suitable for CAN network test engineers of air-conditioning control modules, but can also be extended to test engineers who need to perform CAN network testing.
[0086] An embodiment of the present invention provides a device for converting a communication matrix into a dbc file. Figure 5 A schematic diagram of a device for converting a communication matrix into a dbc file provided by an embodiment of the present invention is shown in FIG. Figure 5 As shown, the device includes: an acquisition module 11, a conversion module 12, a processing module 13 and a storage module 14.
[0087] The acquisition module 11 is used to acquire the communication matrix.
[0088] The conversion module 12 is used to check the communication matrix, and when the check passes, convert the communication matrix into two-dimensional table data.
[0089] The processing module 13 is used to process the two-dimensional table data row by row to obtain information instances.
[0090] The storage module 14 is used to store the information instance in the dbc file.
[0091] In the embodiment of the present invention, the conversion module 12 is specifically used to perform one or any combination of format check, matrix file specification check and / or header check on the communication matrix.
[0092] In the embodiment of the present invention, the information instance includes a first information instance and a second information instance, and the processing module 13 is specifically used to: Classifying the two-dimensional table data to generate message data and signal data; Processing the message name of the message data to perform a standard check on the message name; storing the message data in a first information instance; Processing the signal name of the signal data to perform a standard check on the signal name; The signal data is stored in a second information instance.
[0093] In the embodiment of the present invention, the processing module 13 is specifically used for: Performing vectorization processing on the message name based on TF-IDF technology to generate a first message vector; Performing vectorization processing on the set message name library based on TF-IDF technology to generate a second message vector; Calculating the cosine similarity between the first message vector and the second message vector; When the cosine similarity between the first message vector and one of the second message vectors is 1, it is determined that the message name meets the specification.
[0094] In the embodiment of the present invention, the processing module 13 is specifically used for: Performing vectorization processing on the signal name based on TF-IDF technology to generate a first signal vector; Based on the TF-IDF technology, the set signal name library is vectorized to generate a second signal vector; Calculating the cosine similarity between the first signal vector and the second signal vector; When the cosine similarity between the first signal vector and one of the second signal vectors is 1, it is determined that the signal name complies with the specification.
[0095] In the embodiment of the present invention, the storage module 14 is specifically used for: Reading the first information instance, and inputting the first information instance into the dbc file according to a first specified format; The second information instance is read, and the second information instance is input into the dbc file according to a second specified format.
[0096] In the embodiment of the present invention, the first information instance includes a message name, a message ID, a message sending type, a message cycle time, and a message input type; The first specified format includes: inputting the dbc file in the format of "<message ID><message name>:<message length><node>"; and then inputting the format of "<message ID><message cycle time>" and "<message ID><message input type>" into the dbc file; The second information example includes a signal name, a start bit, a signal length, a scale factor, an offset, a unit, a conversion formula, a signal truth table, a physical minimum value, a physical maximum value, an attribute, an attribute value, a range, and a message ID; The second specified format includes: inputting the dbc file in the format of “<signal name>:<starting bit>|<signal length>@<endian><signed or unsigned>(<scale factor>, <offset>[physical minimum value|physical maximum value]) “<unit>””, and then inputting the dbc file in the format of “ “<attribute>”<message ID><signal name><attribute value>”, inputting its conversion formula and range in the format of “<message ID><signal name><conversion formula><range>”, and inputting its truth table in the format of “<message ID><signal name><key 1><value 1><key 2><value 2>…”.
[0097] In the technical solution provided by the embodiment of the present invention, a communication matrix is obtained; the communication matrix is checked, and when the check passes, the communication matrix is converted into two-dimensional table data; the two-dimensional table data is processed row by row to obtain information instances; and the information instances are stored in a dbc file. In the technical solution provided by the embodiment of the present invention, a dbc file can be automatically output according to the communication matrix input by the user, and manual writing is not required throughout the process, thereby improving the accuracy and efficiency of message analysis.
[0098] The device for converting the communication matrix into a dbc file provided in the embodiment of the present invention can be used to implement the above Figure 1 The method for converting the communication matrix into a dbc file can be specifically described in the embodiment of the method for converting the communication matrix into a dbc file, which will not be repeated here.
[0099] An embodiment of the present invention provides a storage medium, which includes a stored program, wherein when the program is running, the device where the storage medium is located is controlled to execute the steps of the embodiment of the method for converting the communication matrix into a DBC file. For a specific description, please refer to the embodiment of the method for converting the communication matrix into a DBC file.
[0100] An embodiment of the present invention provides a computer device, including a memory and a processor, wherein the memory is used to store information including program instructions, and the processor is used to control the execution of the program instructions. When the program instructions are loaded and executed by the processor, the steps of the embodiment of the method for converting the above-mentioned communication matrix into a DBC file are implemented. For a specific description, please refer to the embodiment of the method for converting the above-mentioned communication matrix into a DBC file.
[0101] Figure 6 A schematic diagram of a computer device provided by an embodiment of the present invention. Figure 6 As shown, the computer device 20 of this embodiment includes: a processor 21, a memory 22, and a computer program 23 stored in the memory 22 and executable on the processor 21. When the computer program 23 is executed by the processor 21, the method for converting the communication matrix into a dbc file in the embodiment is implemented. To avoid repetition, it is not described one by one here. Alternatively, when the computer program is executed by the processor 21, the functions of each model / unit in the device for converting the communication matrix into a dbc file in the embodiment are implemented. To avoid repetition, it is not described one by one here.
[0102] The computer device 20 includes, but is not limited to, a processor 21 and a memory 22. Those skilled in the art will appreciate that Figure 6 It is only an example of the computer device 20 and does not constitute a limitation of the computer device 20. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the computer device may also include input and output devices, network access devices, buses, etc.
[0103] The processor 21 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0104] The memory 22 may be an internal storage unit of the computer device 20, such as a hard disk or memory of the computer device 20. The memory 22 may also be an external storage device of the computer device 20, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the computer device 20. Further, the memory 22 may also include both an internal storage unit of the computer device 20 and an external storage device. The memory 22 is used to store computer programs and other programs and data required by the computer device. The memory 22 may also be used to temporarily store data that has been output or is to be output.
[0105] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0106] In the several embodiments provided by the present invention, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0107] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0108] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0109] The above-mentioned integrated unit implemented in the form of a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to perform some steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program codes.
[0110] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A method for converting a communication matrix into a dbc file, characterized in that: include: obtaining the communication matrix; Checking the communication matrix, and when the check passes, converting the communication matrix into two-dimensional table data; Processing the two-dimensional table data row by row to obtain information instances; The information instance is stored in the dbc file.
2. The method according to claim 1, characterized in that: The checking of the communication matrix includes: The communication matrix is subjected to one or any combination of format check, matrix file specification check and / or header check.
3. The method according to claim 1, characterized in that: The information instance includes a first information instance and a second information instance, and the two-dimensional table data is processed row by row to obtain the information instance, including: Classifying the two-dimensional table data to generate message data and signal data; Processing the message name of the message data to perform a standard check on the message name; storing the message data in a first information instance; Processing the signal name of the signal data to perform a standard check on the signal name; The signal data is stored in a second information instance.
4. The method according to claim 3, characterized in that The processing of the message name of the message data includes: Performing vectorization processing on the message name based on TF-IDF technology to generate a first message vector; Performing vectorization processing on the set message name library based on TF-IDF technology to generate a second message vector; Calculating the cosine similarity between the first message vector and the second message vector; When the cosine similarity between the first message vector and one of the second message vectors is 1, it is determined that the message name meets the specification.
5. The method according to claim 3, characterized in that: The processing of the signal name of the signal data includes: Performing vectorization processing on the signal name based on TF-IDF technology to generate a first signal vector; Based on the TF-IDF technology, the set signal name library is vectorized to generate a second signal vector; Calculating the cosine similarity between the first signal vector and the second signal vector; When the cosine similarity between the first signal vector and one of the second signal vectors is 1, it is determined that the signal name complies with the specification.
6. The method according to claim 3, characterized in that The storing the information instance into the dbc file comprises: Reading the first information instance, and inputting the first information instance into the dbc file according to a first specified format; The second information instance is read, and the second information instance is input into the dbc file according to a second specified format.
7. The method according to claim 6, characterized in that The first information example includes a message name, a message ID, a message sending type, a message cycle time, and a message input type; The first specified format includes: inputting the dbc file in the format of "<message ID> <message name>: <message length> <node>"; and then inputting the formats of "<message ID> <message cycle time>" and "<message ID> <message input type>" into the dbc file; The second information example includes a signal name, a start bit, a signal length, a scale factor, an offset, a unit, a conversion formula, a signal truth table, a physical minimum value, a physical maximum value, an attribute, an attribute value, a range, and a message ID; The second specified format includes: inputting the dbc file in the format of "<signal name>: <starting position>|<signal length>@<endian><signed or unsigned> (<scale factor>, <offset> [physical minimum value|physical maximum value]) "<unit>"", and then inputting the dbc file in the format of " "<attribute>" <message ID> <signal name> <attribute value>", inputting its conversion formula and range in the format of "<message ID> <signal name> <conversion formula> <range>" into the dbc file, and inputting the signal truth table in the format of "<message ID> <signal name> <key 1> <value 1> <key 2> <value 2>..." into the dbc file.
8. A device for converting a communication matrix into a dbc file, characterized in that: include: An acquisition module, used for acquiring the communication matrix; A conversion module, used for checking the communication matrix, and when the check passes, converting the communication matrix into two-dimensional table data; A processing module, used for processing the two-dimensional table data row by row to obtain information instances; A storage module is used to store the information instance in the dbc file.
9. A storage medium, characterized in that: The storage medium includes a stored program, wherein when the program is running, the device where the storage medium is located is controlled to execute the method for converting a communication matrix into a dbc file as claimed in any one of claims 1 to 7.
10. A computer device comprising a memory and a processor, wherein the memory is used to store information including program instructions, and the processor is used to control the execution of the program instructions, characterized in that: When the program instructions are loaded and executed by the processor, the steps of the method for converting a communication matrix into a dbc file as described in any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Generation method and device of DDS database file, electronic equipment and storage medium
CN120578626A