CN-122021557-A - Conversion method, conversion device and computer readable storage medium for real vehicle log
Abstract
The application discloses a conversion method, a conversion device and a computer readable storage medium of a real vehicle log, wherein the method comprises the steps of obtaining a target hexadecimal real vehicle log and a json file corresponding to the target hexadecimal real vehicle log, wherein the json file is constructed based on buried point variables in the target hexadecimal real vehicle log; and outputting the data of the target position in the target hexadecimal real vehicle log to a preset csv file according to the json file so as to generate a corresponding csv format table file. Therefore, the method is based on json files to translate and output the data of the corresponding position of the target hexadecimal real vehicle log into the csv files, the self-adaptive analysis of the real vehicle log can be realized according to the actual length of the real vehicle log, and the conversion accuracy and conversion efficiency of the real vehicle log are improved.
Inventors
- LIU YING
- ZHANG HENG
- CHEN FEI
- LI JIANCAI
Assignees
- 奇瑞汽车股份有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20260106
Claims (10)
- 1. A method for converting a real vehicle log, the method comprising: Acquiring a target hexadecimal real vehicle log and a json file corresponding to the target hexadecimal real vehicle log, wherein the json file is constructed based on buried point variables in the target hexadecimal real vehicle log; And outputting the data of the target position in the target hexadecimal real vehicle log to a preset csv file according to the json file to generate a corresponding csv format table file.
- 2. The method for converting a real vehicle log according to claim 1, wherein obtaining a target hexadecimal real vehicle log comprises: Creating a file selection window based on tkinter libraries to receive a file selection instruction input by a user through the file selection window; calling a real vehicle log compressed file according to the file selection instruction; And reading the real vehicle log compressed file to obtain the target hexadecimal real vehicle log.
- 3. The method for converting a real vehicle log according to claim 1, wherein outputting the data of the target location in the target hexadecimal real vehicle log to a preset csv file according to the json file to generate a corresponding csv format table file, includes: Identifying a log format based on the json file; And outputting the data of the target position in the target hexadecimal real vehicle log to a preset csv file according to the log format so as to generate a corresponding csv format table file.
- 4. The method for converting a real vehicle log according to claim 3, wherein identifying a log format based on the json file comprises: reading file content of the json file; And determining a unique identifier and an expected data length of the target hexadecimal real vehicle log according to the file content to obtain the log format.
- 5. The method for converting a real vehicle log according to claim 4, wherein determining the expected data length of the target hexadecimal real vehicle log from the file content comprises: identifying a signal array in the json file according to the file content, wherein the signal array comprises a plurality of units; Identifying variable names in the units and data types corresponding to each variable, and identifying variable byte lengths of the corresponding variables according to the variable types so as to calculate and obtain the byte lengths corresponding to the units; The expected data length is calculated from the byte lengths of a plurality of the units.
- 6. The method for converting a real vehicle log according to claim 5, wherein outputting the data of the target location in the target hexadecimal real vehicle log to a preset csv file according to the log format to generate a table file in the corresponding csv format comprises: Carrying out data analysis and structuring treatment on the target hexadecimal real vehicle log according to the log format so as to construct a target data list; And reading and writing the data in the target data list into the preset csv file to generate the table file.
- 7. The method for converting a real vehicle log according to claim 6, wherein the data parsing and structuring process is performed on the target hexadecimal real vehicle log according to the log format to construct a target data list, including: performing byte-by-byte scanning on the target hexadecimal real vehicle log according to the unique identifier in the log format to identify a log line boundary; Determining the actual data length of each log line according to the log line boundary, and converting the binary time stamp of each log line into a standard time stamp to obtain a formatted time stamp; Reading corresponding row log data according to the actual data length or the expected data length, and adjusting the row log data in a small-end sequence mode to obtain a target data sequence of each row log; matching a target variable corresponding to the log format according to the byte position index of a target data sequence of each row of logs, and carrying out standard formatting on corresponding fields in the target data sequence based on the variable name and the variable byte length of the target variable to obtain a structured field sequence of each row of logs; Sequentially increasing numbers are carried out on each row of logs, and corresponding data records are constructed based on the formatted time stamp and the structured field sequence of each row of logs so as to obtain the target data list.
- 8. The method of claim 7, further comprising, after determining the actual data length of the first row of logs in the target hexadecimal real-vehicle log according to the log row boundary: when the actual data length is smaller than the expected data length, performing neglect processing on the excess variable in the log format; and under the condition that the actual data length is greater than the expected data length, identifying a structured field sequence corresponding to a data sequence which does not exceed the expected data length according to the log format, and marking the data sequence which exceeds the expected data length with placeholder data to obtain a corresponding extra data sequence so as to construct a corresponding data record based on the formatting timestamp, the structured field sequence and the extra data sequence of each row of log to obtain the target data list.
- 9. A device for converting real vehicle logs, the device comprising: The system comprises an acquisition module, a storage module and a storage module, wherein the acquisition module is used for acquiring a target hexadecimal real vehicle log and a json file corresponding to the target hexadecimal real vehicle log, wherein the json file is constructed based on buried point variables in the target hexadecimal real vehicle log; And the control module is used for outputting the data of the target position in the target hexadecimal real vehicle log to a preset csv file according to the json file so as to generate a corresponding csv format table file.
- 10. A computer readable storage medium, characterized in that a computer program is stored in the computer readable storage medium, wherein the computer program, when being executed by a processor, implements the steps of the conversion method of real vehicle logs according to any one of claims 1 to 8.
Description
Conversion method, conversion device and computer readable storage medium for real vehicle log Technical Field The present application relates to the field of real vehicle log conversion technologies, and in particular, to a real vehicle log conversion method, a real vehicle log conversion device, and a computer readable storage medium. Background With the rapid development of the automobile industry and the continuous improvement of the living standard of people, more and more products are driven to the hands of users, automobile manufacturers are responsible for the quality of the products, and real-time data of the after-market vehicles during running are recorded for checking the problems for the users so as to respond in time according to the on-site conditions of the problems when the clients feed back the problems, thereby ensuring the experience of the clients. Therefore, the method of parsing the log file and converting the real-vehicle run-time data into a development engineer readable file is also indispensable. However, the existing log conversion method is slow in conversion speed, and the conversion efficiency is reduced. Disclosure of Invention The present application aims to solve at least one of the technical problems in the related art to some extent. Therefore, a first object of the present application is to provide a method for converting a real vehicle log, which translates and outputs data corresponding to a target hexadecimal real vehicle log into a csv file based on json file, so as to realize adaptive analysis of the real vehicle log according to the actual length of the real vehicle log, and improve the conversion accuracy and conversion efficiency of the real vehicle log. The second objective of the present application is to provide a device for converting real vehicle logs. A third object of the present application is to propose a computer readable storage medium. In order to achieve the above purpose, an embodiment of a first aspect of the present application provides a method for converting a real vehicle log, which includes obtaining a target hexadecimal real vehicle log and a json file corresponding to the target hexadecimal real vehicle log, wherein the json file is constructed based on a buried point variable in the target hexadecimal real vehicle log, and outputting data of a target position in the target hexadecimal real vehicle log to a preset csv file according to the json file to generate a corresponding csv format table file. According to the method for converting the real vehicle log, firstly, the target hexadecimal real vehicle log and the json file corresponding to the target hexadecimal real vehicle log are obtained, wherein the json file is constructed based on the buried point variable in the target hexadecimal real vehicle log, and then the data of the target position in the target hexadecimal real vehicle log is output to the preset csv file according to the json file so as to generate the corresponding csv format table file. Therefore, the method is based on json files to translate and output the data of the corresponding position of the target hexadecimal real vehicle log into the csv files, the self-adaptive analysis of the real vehicle log can be realized according to the actual length of the real vehicle log, and the conversion accuracy and conversion efficiency of the real vehicle log are improved. In addition, the method for converting the real vehicle log according to the embodiment of the application may further have the following additional technical features: According to one embodiment of the application, acquiring the target hexadecimal real vehicle log comprises creating a file selection window based on tkinter libraries to receive a file selection instruction input by a user through the file selection window, calling a real vehicle log compressed file according to the file selection instruction, and reading the real vehicle log compressed file to acquire the target hexadecimal real vehicle log. According to one embodiment of the application, outputting the data of the target position in the target hexadecimal real vehicle log to a preset csv file according to the json file to generate a corresponding csv format table file comprises identifying the log format based on the json file, and outputting the data of the target position in the target hexadecimal real vehicle log to the preset csv file according to the log format to generate the corresponding csv format table file. According to one embodiment of the application, the log format is identified based on the json file, which comprises the steps of reading the file content of the json file, and determining the unique identifier and the expected data length of the target hexadecimal real vehicle log according to the file content to obtain the log format. According to one embodiment of the application, the expected data length of the target hexadecimal real-vehicle log is determined according to