Message query method and device based on vehicle message index
By using vehicle message indexing technology in the vehicle message query system, the existing database solution solves the problem of high resource consumption and complex operation and maintenance when processing a large number of vehicle messages, and achieves fast and stable message query efficiency.
Patent Information
- Application Number
- CN202411531589.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-30
- Publication Date
- 2025-03-14
AI Technical Summary
When processing a large number of vehicle messages, existing database solutions rely on distributed databases or big data technology, resulting in high resource consumption, complex operation and maintenance, and expensive cost, making it difficult to ensure the efficiency of message query.
The message query method based on the vehicle message index is adopted. By obtaining the target page number specified by the user and the preset number of messages per page in the message query page, the target message sequence number is determined, and the message generation time is found in the pre-created vehicle message index, and then the message is found and displayed in the file system.
Quick query of packets can be achieved without relying on the database, ensuring the stability and efficiency of packet queries, and reducing resource consumption and operation and maintenance complexity.
Smart Images

Figure CN119622120A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of message processing, and in particular to a message query method and device based on vehicle message indexing. Background Art
[0002] With the popularization of modern intelligent vehicles, vehicles continuously package the collected signals and upload them to the server in the form of messages. The server stores or manages these messages for subsequent query and use.
[0003] However, a large number of cars will generate a large amount of data at a high frequency. Existing database solutions usually rely on distributed databases or big data related technologies. Although these technologies can handle large-scale data, they are highly dependent on servers. Distributed databases require a large amount of computing resources and storage resources, while big data technologies require complex cluster management and operation and maintenance, which not only brings extremely high resource costs, but also increases the complexity and cost of operation and maintenance. In addition, as the amount of data continues to grow, the scalability and performance of the database are also facing bottlenecks. It is difficult to guarantee the efficiency of message queries through distributed databases or big data related technologies. Summary of the invention
[0004] In view of the above problems, an embodiment of the present application proposes a message query method and device based on vehicle message indexing.
[0005] In a first aspect of the implementation of the present application, a message query method based on a vehicle message index is first provided, characterized in that the method comprises:
[0006] In the message query page, obtain the target page number and the preset number of messages per page specified by the user, and determine the target message sequence number according to the target page number and the number of messages per page;
[0007] In the pre-created vehicle message index, searching for the generation time of the message corresponding to the target message sequence number according to the target message sequence number;
[0008] Searching for a message corresponding to the target message sequence number in a preset file system according to the generation time of the message corresponding to the target message sequence number;
[0009] The message corresponding to the target message sequence number is written into the message query page, and the message query page is displayed to the user.
[0010] Optionally, the vehicle message index is created in the following manner:
[0011] Acquire several messages generated by the vehicle, and use the date on which any of the messages is generated as the target message generation date;
[0012] Obtaining a number of messages generated by the vehicle on the target message generation date;
[0013] Determining the generation time of several messages on the target message generation date and the total number of messages on the target message generation date according to several messages generated by the vehicle on the target message generation date;
[0014] Creating a date message index according to the generation time of several messages in the target message generation date and the total number of messages in the target message generation date;
[0015] Create a month message index according to the date message index;
[0016] Create a year message index according to the month message index;
[0017] The year message index is used as the vehicle message index.
[0018] Optionally, the creating a date message index according to the generation time of several messages in the target message generation date and the total number of messages in the target message generation date includes:
[0019] Sorting the plurality of messages generated by the vehicle in the target message generation date according to the generation time of the messages;
[0020] Grouping the plurality of messages generated by the vehicle on the sorted target message generation date according to the generation time interval of the messages to obtain a plurality of message groups, wherein the generation time interval between adjacent messages in any of the message groups is not greater than a preset threshold, and the generation time interval between adjacent messages in any of the message groups is the same;
[0021] Obtaining the total number of message groups and the number of messages in several message groups on the target message generation date;
[0022] Determine a message group with the largest number of messages according to the number of messages in the message groups;
[0023] Determine the required first memory capacity according to the total number of the messages in the message group with the largest number of messages;
[0024] In the target message generation date, if the generation time interval between adjacent messages in any of the message groups is the same as the generation time interval between adjacent messages in any of the remaining message groups, then determining that the message cycle type of the target message generation date is a fixed cycle, and taking the generation time interval between adjacent messages in any of the message groups as the first cycle value;
[0025] Obtaining the generation time corresponding to the earliest generated message in any of the message groups and the start time of the target message generation date;
[0026] Determine the time offset data between the generation time corresponding to the earliest message generated in the message group and the start time of the target message generation date according to the generation time corresponding to the earliest message generated in the message group and the start time of the target message generation date;
[0027] In the case where the message cycle type of the target message generation date is a fixed cycle, the total number of message groups in the target message generation date, the total number of messages in the target message generation date, the message cycle type, the first cycle value, and the first memory capacity are used as the first date index header data of the target message generation date;
[0028] Taking the time offset data and the number of messages in any of the message groups as a set of first date index content data;
[0029] The first date index header data and several groups of the first date index content data are combined to form the date message index.
[0030] Optionally, the creating a date message index according to the generation time of several messages in the target message generation date and the total number of messages in the target message generation date further includes:
[0031] If the generation time interval of the adjacent messages in any of the message groups is different from the generation time interval of the adjacent messages in any of the other message groups, then determining that the message cycle type of the target message generation date is a non-fixed cycle, and taking the generation time interval between the adjacent messages in any of the message groups as the second cycle value of the message group;
[0032] Determining a second memory capacity required to store the second period value according to the second period value;
[0033] In the case where the message cycle type of the target message generation date is a non-fixed cycle, the total number of message groups in the target message generation date, the total number of messages in the target message generation date, the message cycle type, the second memory capacity, and the first memory capacity are used as second date index header data of the target message generation date;
[0034] Taking the time offset data, the second period value and the number of messages in any of the message groups as a set of second date index content data;
[0035] The second date index header data and several groups of the second date index content data are combined to form the date message index.
[0036] Optionally, creating a monthly message index according to the date message index includes:
[0037] The month in which the target message is generated is used as the target message generation month;
[0038] Determine the number of dates included in the target message generation month;
[0039] Determine the total number of messages in the target message generation month according to the plurality of date message indexes;
[0040] Determine a third memory capacity required to store the date message index according to the plurality of date message indexes;
[0041] Determine a daily data length list according to the third memory capacity and the number of dates included in the target message generation month;
[0042] The total number of messages in the target message generation month, the number of dates included in the target message generation month, the third memory capacity, and the daily data length list are used as month index header data;
[0043] Taking any one of the date message indexes as a set of month index content data;
[0044] The month index header data and several groups of the month index content data are combined to form the month message index.
[0045] Optionally, creating a year message index according to the month message index includes:
[0046] The year in which the target message is generated is used as the target message generation year;
[0047] Determine the number of months included in the target message generation year;
[0048] Determine the total number of messages in the target message generation year according to the message indexes of the months;
[0049] Determine a fourth memory capacity required to store the monthly message index according to the plurality of monthly message indexes;
[0050] Determine a monthly data length list according to the fourth memory capacity and the number of months included in the target message generation year;
[0051] The total number of messages in the target message generation year, the fourth memory capacity, and the monthly data length list are used as year index header data;
[0052] Taking any one of the monthly message indexes as a set of year index content data;
[0053] The year index header data and several groups of the year index content data are combined to form the year message index, wherein the name of the year message index includes the frame number of the vehicle.
[0054] Optionally, searching, in the pre-created vehicle message index, according to the target message sequence number, for a generation time of a message corresponding to the target message sequence number, comprises:
[0055] In the year message index, obtain several groups of the month message indexes in the year index content data;
[0056] In the plurality of groups of the monthly message indexes, querying the target month message index corresponding to the target message sequence number according to the total number of messages in the target message generation month in the plurality of groups of the monthly index header data and the target message sequence number, wherein the target message sequence number represents the generation time sequence of the target message in the vehicle target message generation year;
[0057] In the target month message index, obtain several groups of date message indexes in the month index content data;
[0058] In the plurality of groups of the date message indexes, querying the target date message index corresponding to the target message sequence number according to the total number of message groups in the target message generation date in the plurality of groups of the first date index header data or the total number of message groups in the target message generation date in the plurality of groups of the second date index header data and the target message sequence number;
[0059] In the target date message index, determining the target message cycle type corresponding to the target message sequence number according to the message cycle type in the first date index header data or the message cycle type in the second date index header data in the target date message index;
[0060] In the case where the target message period type is a fixed period, obtaining the first period value in several groups of first date index content data and first date index header data in the target date message index;
[0061] Querying the first target date index content data corresponding to the target message sequence number according to the number of messages in the plurality of groups of the first date index content data and the target message sequence number;
[0062] Acquire the time offset data and the number of messages in the first target date index content data;
[0063] The generation time of the message corresponding to the target message sequence number is determined according to the first period value in the target date message index, the time offset data in the first target date index content data, and the message quantity.
[0064] Optionally, searching, in the pre-created vehicle message index, according to the target message sequence number, for a generation time of a message corresponding to the target message sequence number, further includes:
[0065] In the case where the target message period type is a non-fixed period, obtaining a plurality of groups of second date index content data in the target date message index;
[0066] Querying the second target date index content data corresponding to the target message sequence number according to the number of messages in the plurality of groups of the second date index content data and the target message sequence number;
[0067] Acquire the time offset data, the second period value and the number of messages in the second target date index content data;
[0068] The generation time of the message corresponding to the target message sequence number is determined according to the time offset data in the second target date index content data, the second period value and the number of messages.
[0069] In a second aspect of the implementation of the present application, a message query device based on a vehicle message index is also provided, characterized in that the device comprises:
[0070] A query data acquisition module is used to obtain a target page number and a preset number of messages per page specified by a user in a message query page, and determine a target message sequence number according to the target page number and the number of messages per page;
[0071] A message generation time search module, used to search for the generation time of the message corresponding to the target message sequence number in the pre-created vehicle message index according to the target message sequence number;
[0072] A message search module, used to search for a message corresponding to the target message sequence number in a preset file system according to the generation time of the message corresponding to the target message sequence number;
[0073] The message display module is used to write the message corresponding to the target message sequence number into the message query page and display the message query page to the user.
[0074] In the third aspect of the implementation of the present application, there is also provided an electronic device, characterized in that it includes a processor, a memory, and a computer program stored in the memory and capable of running on the processor, and when the computer program is executed by the processor, it implements the message query method based on the vehicle message index as described above.
[0075] In the fourth aspect of the implementation of the present application, a computer-readable storage medium is also provided, characterized in that a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the message query method based on the vehicle message index as described above is implemented.
[0076] The embodiments of the present application have the following advantages:
[0077] In an embodiment of the present application, the target page number and the preset number of messages per page specified by the user are obtained in the message query page, the target message sequence number is determined according to the target page number and the number of messages per page, the generation time of the message corresponding to the target message sequence number is searched according to the target message sequence number in the pre-created vehicle message index, the message corresponding to the target message sequence number is searched in the preset file system according to the generation time of the message corresponding to the target message sequence number, the message corresponding to the target message sequence number is written to the message query page, and the message query page is displayed to the user. The present application completes the message query by searching the generation time of the message through the pre-created vehicle message index, and can realize fast message query without relying on the database, thereby ensuring the stability of the message query and improving the efficiency of the message query. BRIEF DESCRIPTION OF THE DRAWINGS
[0078] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art.
[0079] Figure 1 It is a flowchart of a message query method based on vehicle message indexing provided by an embodiment of the present application;
[0080] Figure 2 It is a structural diagram of a vehicle message index provided by an embodiment of the present application;
[0081] Figure 3 It is a structural diagram of a message query device based on vehicle message indexing provided in one embodiment of the present application. DETAILED DESCRIPTION
[0082] In order to make the purpose, technical scheme and advantages of the embodiments of the present invention clearer, the embodiments of the present invention will be described in detail below in conjunction with the accompanying drawings. However, it can be understood by those skilled in the art that in the embodiments of the present invention, many technical details are proposed in order to enable readers to better understand the present invention. However, even without these technical details and various changes and modifications based on the following embodiments, the technical scheme claimed in the present invention can also be implemented. The division of the following embodiments is for the convenience of description and should not constitute any limitation on the specific implementation of the present invention. The various embodiments can be combined and referenced with each other without contradiction.
[0083] When a smart car is online, it usually packages and uploads the collected signals to the server every 10 seconds. The server can save these messages by vehicle and time dimensions. In some low-cost solutions, the messages will be packaged and compressed in the form of files and saved in the file system. Then, how to quickly count the status of these messages requires a special index file to manage.
[0084] It should be noted that a smart car may refer to a car equipped with various sensors, computing devices and communication modules, which can collect data such as vehicle status and environmental information in real time and upload it to a server via a network. In the embodiment of the present application, the vehicle may be a smart car.
[0085] The smart car being online may refer to the smart car being in a networked state and being able to communicate with the server. In the embodiment of the present application, the message can be uploaded only when the smart car is online.
[0086] The signals collected by the smart car can be data such as vehicle status, driving behavior, environmental perception, etc. obtained through various sensors (such as GPS, camera, radar, etc.). In the embodiment of the present application, the signals collected by the smart car can be used as the content of the message.
[0087] A message may refer to a unit of data transmitted during a communication process. A message generally contains information about the sender and receiver, data content, and some control information (such as a header, a tail, etc.) to ensure the correct transmission and processing of data. In an embodiment of the present application, a message index may be established to enable rapid query of message content.
[0088] The file system may be a system for managing files and directories, and is responsible for the storage, retrieval and management of files. In an embodiment of the present application, the file system may be used to store messages.
[0089] Reference Figure 1 , showing a step flow chart of a message query method based on vehicle message indexing provided by an embodiment of the present application.
[0090] It should be noted that the vehicle message index can be established based on the messages regularly uploaded to the server by the vehicle, and is used for the management or query of the messages of this vehicle. In the embodiment of the present application, the query of the vehicle message can be realized through the vehicle message index.
[0091] In an embodiment of the present application, the message query method can be a paging query. When processing a large amount of data, the result set is divided into multiple smaller parts (i.e., "pages") for display or processing. This can improve query efficiency, reduce memory usage, and facilitate users to browse and operate data. In an embodiment of the present application, a paging query of messages can be implemented in the message query page based on the vehicle message index.
[0092] The method may specifically include the following steps:
[0093] Step 101: in a message query page, obtain a target page number and a preset number of messages per page specified by a user, and determine a target message sequence number according to the target page number and the number of messages per page.
[0094] In the embodiment of the present application, the message query page can be a page for users to query messages through a web page or an application program interface. The user can enter query conditions on the page, such as the target page number and the number of messages per page, to obtain the required message data.
[0095] The target page number may be a page number input or selected by the user in the message query page, indicating the page number of the message data that the user wishes to view.
[0096] The number of messages per page may refer to the number of messages displayed per page that is preset in the message query system.
[0097] The target message sequence number may refer to a message sequence number calculated based on the target page number specified by the user and the preset number of messages per page. This sequence number is used to locate and obtain the message data required by the user. The target message sequence number may be one or more. There is a one-to-one correspondence between the target message sequence number and the number of messages per year according to the order in which they are generated.
[0098] In an embodiment of the present application, the target page number specified by the user and the preset number of messages per page can be obtained in the message query page, and the target message sequence number can be determined based on the target page number and the number of messages per page, where the number of messages per page can be pre-set or specified by the user.
[0099] In the specific implementation, the user can enter "3" on the message query page to indicate that he wants to view the message data on page 3. The system presets 10 messages to be displayed per page, so each page will contain 10 message data. If the user specifies the target page number as 3 and the number of messages per page is 10, then the target message sequence number will start from the 21st message (assuming that the page number starts counting from 1).
[0100] In the message query page of this application, the user specifies the target page number and the preset number of messages per page, and the system can calculate the target message sequence number based on these parameters, thereby locating and obtaining the message data required by the user. This paging query mechanism allows users to efficiently browse and query a large amount of message data.
[0101] Step 102: In the pre-created vehicle message index, search for the generation time of the message corresponding to the target message sequence number according to the target message sequence number.
[0102] In an embodiment of the present application, the generation time of the message corresponding to the target message sequence number may refer to the timestamp when the message is created or collected, which is used to record the moment when the message is generated.
[0103] In an embodiment of the present application, the generation time of the message corresponding to the target message sequence number can be searched in the pre-created vehicle message index according to the target message sequence number. The vehicle message index includes the number of messages corresponding to the message sequence number and the generation time of the message corresponding to the message sequence number.
[0104] This application can quickly find and obtain the generation time of the message corresponding to the target message sequence number according to the target message sequence number. This indexing mechanism makes the retrieval and query of message data efficient and can quickly respond to user query requests.
[0105] Step 103: Searching for a message corresponding to the target message sequence number in a preset file system according to the generation time of the message corresponding to the target message sequence number.
[0106] In an embodiment of the present application, the message corresponding to the target message sequence number can be searched in a preset file system according to the generation time of the message corresponding to the target message sequence number. The preset file system may include a plurality of messages and the generation time corresponding to each message, and the corresponding message can be found in the preset file system according to the generation time corresponding to each message.
[0107] The search mechanism based on generation time in this application makes the retrieval and query of message data efficient and can quickly respond to the query request of the user. In this way, the system can effectively manage and access a large amount of message data stored in the file system.
[0108] Step 104: write the message corresponding to the target message sequence number into the message query page, and display the message query page to the user.
[0109] In an embodiment of the present application, the message corresponding to the target message sequence number can be written into a message query page, and the message query page can be displayed to the user. Among them, the message corresponding to the target message sequence number can refer to the message data or message content corresponding to the target message sequence number. This message data or message content can include signal information collected by the vehicle, such as vehicle status, driving behavior, environmental perception, etc.
[0110] In an embodiment of the present application, the target page number and the preset number of messages per page specified by the user are obtained in the message query page, the target message sequence number is determined according to the target page number and the number of messages per page, the generation time of the message corresponding to the target message sequence number is searched according to the target message sequence number in the pre-created vehicle message index, the message corresponding to the target message sequence number is searched in the preset file system according to the generation time of the message corresponding to the target message sequence number, the message corresponding to the target message sequence number is written to the message query page, and the message query page is displayed to the user. The present application completes the message query by searching the generation time of the message through the pre-created vehicle message index, and can realize fast query of the message without relying on the database, thereby ensuring the stability of the message query and improving the efficiency of the message query.
[0111] In an optional embodiment of the present application, the vehicle message index is created in the following manner:
[0112] S12: Acquire several messages generated by the vehicle, and use the date on which any message is generated as the target message generation date;
[0113] S13: Acquire a number of messages generated by the vehicle on the target message generation date;
[0114] S14: determining the generation time of the plurality of messages on the target message generation date and the total number of the messages on the target message generation date according to the plurality of messages generated by the vehicle on the target message generation date;
[0115] S15: creating a date message index according to the generation time of several messages in the target message generation date and the total number of messages in the target message generation date;
[0116] S16: Creating a month message index according to the date message index;
[0117] S17: Creating a year message index according to the month message index;
[0118] S18: Use the year message index as the vehicle message index.
[0119] It should be noted that the target message generation date may refer to a date value used to identify the message generation date in the process of creating a vehicle message index. The target message generation date may be used to classify and index message data by date. In an embodiment of the present application, a message index may be constructed based on the message data uploaded by the vehicle in the target message generation date. In an optional embodiment of the present application, the target message generation date may be the latest date.
[0120] In an embodiment of the present application, the date message index may be a message index structure classified by date, the month message index may be a message index structure classified by month, and the year message index may be a message index structure classified by year.
[0121] In the embodiment of the present application, several messages generated by the vehicle can be obtained, and the date on which any message is generated is used as the target message generation date. Then, several messages generated by the vehicle on the target message generation date are obtained, wherein the several messages generated by the vehicle on the target message generation date may be all messages generated by the vehicle on the target message generation date.
[0122] The generation time of the plurality of messages on the target message generation date and the total number of messages on the target message generation date are determined according to the plurality of messages generated by the vehicle on the target message generation date.
[0123] Then, a date message index is created according to the generation time of several messages in the target message generation date and the total number of messages in the target message generation date.
[0124] Then, based on the date message index, create a month message index, and then based on the month message index, create a year message index, and finally use the year message index as the vehicle message index.
[0125] In a specific implementation, a vehicle message index may be generated for each vehicle every year, and the file name may include the data year and the vehicle frame number, such as LAM2839423_2024; since messages are continuously generated, the index file will also be continuously updated.
[0126] The index file is divided into three levels: year, month, and day. Each vehicle generates an index file every year, which contains data for 12 months; each month contains data corresponding to all days of the month.
[0127] Through this hierarchical index creation method, the system can efficiently manage and retrieve vehicle message data, thereby realizing rapid data query and statistics. This index mechanism enables users to easily obtain and operate a large amount of message data stored in the system.
[0128] In an optional embodiment of the present application, the step S15 includes:
[0129] S21: sorting the plurality of messages generated by the vehicle on the target message generation date according to the generation time of the messages.
[0130] In an embodiment of the present application, several messages generated by the vehicle on the target message generation date may be sorted according to the generation time of the messages.
[0131] In a specific implementation, all messages of the day may be collected and sorted according to the collection time.
[0132] S22: Grouping the plurality of messages generated by the vehicle on the sorted target message generation date according to the message generation time interval to obtain a plurality of message groups, wherein the generation time interval between adjacent messages in any of the message groups is not greater than a preset threshold, and the generation time interval between adjacent messages in any of the message groups is the same.
[0133] In an embodiment of the present application, several messages generated by the vehicle on the sorted target message generation date can be grouped according to the message generation time interval to obtain several message groups, wherein the generation time interval between adjacent messages in any message group is not greater than a preset threshold, and the generation time interval between adjacent messages in any message group is the same. The preset threshold can be set according to actual conditions. The message generation time interval can be the difference between the generation time of any message and the generation time of the adjacent message before or after it.
[0134] In the specific implementation, the time interval of message generation, that is, the messages with a time difference of no more than 60 seconds, can be grouped into the same group. The messages are split according to the time difference between adjacent messages in the group to ensure that the time difference between adjacent messages in each group is the same. A group is a frame of data.
[0135] S23: Obtain the total number of message groups and the number of messages in several message groups on the target message generation date.
[0136] In the embodiment of the present application, the total number of message groups and the number of messages in several message groups on the target message generation date can be obtained, wherein the number of messages in several message groups can be the number of messages in each message group in several message groups.
[0137] S24: Determine a message group with the largest number of messages according to the number of messages in the message groups.
[0138] In the embodiment of the present application, the message group with the largest number of messages can be determined according to the number of messages in the message groups. In other words, the message group with the largest number of messages can be determined according to the number of messages in each message group in the message groups.
[0139] S25: Determine the required first memory capacity according to the total number of the messages in the message group with the largest number of messages.
[0140] In the embodiment of the present application, the required first memory capacity can be determined according to the total number of messages in the message group with the largest number of messages. The first memory capacity can be the number of bits occupied by the value defining the number of messages, or can be understood as the memory capacity required to store the total number of messages in the message group with the largest number of messages. The first memory capacity can be determined according to the total number of messages in the message group with the largest number of messages, or can be set by itself.
[0141] In a specific implementation, the group with the largest number of messages can be recorded, the number of bits occupied by the message number value can be taken, recorded as variable z and written into the header file.
[0142] S26: In the target message generation date, if the generation time interval between adjacent messages in any of the message groups is the same as the generation time interval between adjacent messages in any of the remaining message groups, then determine that the message cycle type of the target message generation date is a fixed cycle, and use the generation time interval between adjacent messages in any of the message groups as the first cycle value.
[0143] In an embodiment of the present application, in the target message generation date, if the generation time interval between adjacent messages in any message group is the same as the generation time interval between adjacent messages in any other message group, then the message cycle type of the target message generation date is determined to be a fixed cycle, and the generation time interval between adjacent messages in any message group is used as the first cycle value. The first cycle value can represent the generation time interval between adjacent messages among all messages in all message groups on the target message generation date, and the generation time interval between adjacent messages among all messages is the first cycle value.
[0144] In the specific implementation, the time difference of adjacent messages in the group can be calculated. If all the time differences are the same, it is a fixed period. In the case of a fixed period, this value occupies 6 bits, indicating the number of seconds of the collection period
[0145] S27: Obtain the generation time corresponding to the earliest generated message in any of the message groups and the start time of the target message generation date.
[0146] In the embodiment of the present application, the generation time corresponding to the earliest generated message in any message group and the start time of the target message generation date can be obtained, wherein the start time of the target message generation date can start from 0 o'clock.
[0147] S28: Determine the time offset data between the generation time corresponding to the earliest message in the message group and the start time of the target message generation date according to the generation time corresponding to the earliest message in the message group and the start time of the target message generation date.
[0148] In an embodiment of the present application, the time offset data between the generation time corresponding to the earliest message in the message group and the start time of the target message generation date can be determined according to the generation time corresponding to the earliest message in the message group and the start time of the target message generation date. The time offset data can represent the difference between the generation time corresponding to the message and the start time of the target message generation date, and accordingly, the generation time corresponding to the message can be calculated according to the time offset data and the start time of the target message generation date.
[0149] S29: When the message cycle type of the target message generation date is a fixed cycle, the total number of message groups in the target message generation date, the total number of messages in the target message generation date, the message cycle type, the first cycle value, and the first memory capacity are used as the first date index header data of the target message generation date.
[0150] In an embodiment of the present application, when the message cycle type of the target message generation date is a fixed cycle, the total number of message groups in the target message generation date, the total number of messages in the target message generation date, the message cycle type, the first cycle value, and the first memory capacity can be used as the first date index header data of the target message generation date. The first date index header data can refer to the header data in the date message index of the target message generation date when the message cycle type of the target message generation date is a fixed cycle.
[0151] S30: taking the time offset data and the number of messages in any of the message groups as a group of first date index content data.
[0152] In the embodiment of the present application, the time offset data and the number of messages in any message group can be used as a group of first date index content data. Wherein, the first date index content data is the content data (frame content) in the date message index of the target message generation date when the message cycle type of the target message generation date is a fixed cycle.
[0153] S31: Combining the first date index header data and several groups of the first date index content data to form the date message index.
[0154] In the embodiment of the present application, the first date index header data and several groups of first date index content data can be combined to form a date message index. The date message index can be a message index of the target message generation date when the message period type of the target message generation date is a fixed period.
[0155] In an optional embodiment of the present application, the step S15 further includes:
[0156] S41: If the generation time interval between adjacent messages in any of the message groups is different from the generation time interval between adjacent messages in any of the other message groups, determine that the message cycle type of the target message generation date is a non-fixed cycle, and use the generation time interval between adjacent messages in any of the message groups as the second cycle value of the message group.
[0157] In an embodiment of the present application, if the generation time interval of adjacent messages in any message group is different from the generation time interval of adjacent messages in any other message group, the message cycle type of the target message generation date is determined to be a non-fixed cycle, and the generation time interval between adjacent messages in any message group is used as the second cycle value of the message group. Wherein, in the case where the messages of the target message generation date are non-fixed cycles, the generation time interval between messages of the same message group is fixed, but the generation time interval of messages between different message groups may be different. The second cycle value refers to the generation time interval of messages in each message group. Each message group has a corresponding second cycle value.
[0158] S42: Determine a second memory capacity required to store the second period value according to the second period value.
[0159] In the embodiment of the present application, the second memory capacity required to store the second cycle value can be determined according to the second cycle value. The second memory capacity refers to the number of bits required to store the second cycle value, which can be determined according to the second cycle value or set by itself.
[0160] S43: When the message cycle type of the target message generation date is a non-fixed cycle, the total number of message groups in the target message generation date, the total number of messages in the target message generation date, the message cycle type, the second memory capacity, and the first memory capacity are used as second date index header data of the target message generation date.
[0161] In an embodiment of the present application, when the message cycle type of the target message generation date is a non-fixed cycle, the total number of message groups in the target message generation date, the total number of messages in the target message generation date, the message cycle type, the second memory capacity, and the first memory capacity are used as the second date index header data of the target message generation date. The second date index header data may refer to the header data in the date message index of the target message generation date when the message cycle type of the target message generation date is a non-fixed cycle.
[0162] S44: taking the time offset data, the second period value and the number of messages in any of the message groups as a set of second date index content data;
[0163] In an embodiment of the present application, the time offset data, the second period value and the number of messages in any of the message groups may be used as a set of second date index content data. The second date index header data may refer to content data (frame content) in the date message index of the target message generation date when the message period type of the target message generation date is a non-fixed period.
[0164] S45: Combining the second date index header data and several groups of the second date index content data to form the date message index.
[0165] In the embodiment of the present application, the second date index header data and several groups of second date index content data can be combined to form a date message index. The date message index can also be a message index of the target message generation date when the message period type of the target message generation date is a non-fixed period.
[0166] In the specific implementation, you can refer to Figure 2 Build a date message index. Figure 2 A schematic diagram of the structure of a vehicle message index provided by an embodiment of the present application is shown.
[0167] The date index file represents daily data, that is, index data for each day.
[0168] Each vehicle can go online for 1 hour 4 times a day, with a fixed message every 10 seconds. The index data generated every day is = header (1B+2B+11b)+frame (17b+9b)*4=18B, where b represents bit, B represents byte, and 1Byte=8bit.
[0169] The date index file is divided into a data header and each frame content, as described below:
[0170] The data header contains the following five parts of information.
[0171] (1) v byte: number of frames. It can indicate how many frames the data of the day contains. For a fixed message cycle, the number of frames can represent the number of times the vehicle goes online. In the embodiment of the present application, the number of frames can be the total number of message groups in the target message generation date.
[0172] The frame number occupies a variable byte, which actually occupies 1 to 4 bytes. The specific rules are as follows: the left 2 bits are defined as an identifier with a value range of [0,3], indicating that the number of bytes occupied is [1,4]. The corresponding valid bits after the queue identifier are 6, 14, 22, and 30, and the actual values that can be represented are 63, 16383, 4194303, and 1073741823.
[0173] The rules for variable bytes in other positions, such as the number of messages, are the same.
[0174] (2) v bytes: number of messages. The number of messages can represent the total number of messages on that day. The number of messages is a variable byte, and the rules for variable bytes are as described above. In the embodiment of the present application, the number of messages can be the total number of messages described in the target message generation date.
[0175] (3) 1 bit: message period type. The message period type, if 1, indicates a fixed message period, and no message period needs to be set in the frame; if 0, indicates a non-fixed message period, and a message period value needs to be set in the frame. In the embodiment of the present application, the message period type can be the above message period type, indicating a fixed period or a non-fixed period.
[0176] (4) 3 bits: length X (bits) or 6 bits: fixed period (seconds). Message collection period value, if the message period type is 1, it is a fixed period, then this value occupies 6 bits, indicating the number of seconds of the collection period, if the period type is 0, it is a non-fixed period, the value here is equivalent to defining the variable x, indicating the number of bits occupied by the message period length definition in the frame. In the embodiment of the present application, when the message period type of the target message generation date is a fixed period, here is 6 bits: fixed period (seconds), at this time the fixed period (seconds) can be the first period value in the embodiment of the present application.
[0177] When the message period type of the target message generation date is a non-fixed period, it is 3 bits here: length X (bits), and at this time, length X (bits) can be the second memory capacity in the embodiment of the present application.
[0178] (5) 4 bits: The length y (bits) may represent the number of bits occupied by the value defining the number of messages in the frame. In the embodiment of the present application, the length y (bits) may be the first memory capacity.
[0179] Each frame contains the following three parts of information. The content of each frame can indicate how many messages have been collected continuously in a certain collection cycle from a certain time point. Each frame contains the following content:
[0180] (1) 17 bits: intraday time offset. 17 bits are used to represent the start time of each frame message, in seconds, representing the number of seconds starting from 0:00 on the day. In the embodiment of the present application, the intraday time offset can be time offset data.
[0181] (2) X bit: message period (optional) If the message period type is 1 fixed period, there is no such content here. If it is 0 non-fixed period, the x (header definition) bit here represents the message period value in this frame, in seconds. In the embodiment of the present application, when the message period type of the target message generation date is fixed period, there is no such content here.
[0182] When the message period type of the target message generation date is a non-fixed period, the X bit here is: message period (optional), and the message period (optional) can be the second period value in the embodiment of the present application.
[0183] (3) y bits: number of messages. This indicates how many messages are contained in this frame. The number of bits y of the number of messages comes from the 4 bits defined in the data header: length y (bits). In the embodiment of the present application, the number of messages here may refer to the number of messages in this frame, that is, the number of messages in this message group.
[0184] In the specific implementation, in order to avoid frequent updates of the index file, the index file can be updated once a day, that is, the data of the previous day is written on T+1. Before writing the index file data, create a binary stream to write data into it.
[0185] In the specific implementation, all the messages of the day can be collected, sorted and grouped according to the collection time, and the messages with a time difference of no more than 60 seconds are grouped into the same group; then the time difference of adjacent messages in the group is calculated. If all the time differences are the same, it is a fixed period, recorded as variable x, otherwise, it is a non-fixed period, and the group is split according to the time difference of adjacent messages to ensure that the time difference of adjacent messages in each group is the same. At the same time, the maximum time difference is taken, and all the occupancy is calculated and recorded as variable y. Finally, a group is a frame of data. The group with the largest number of messages is recorded, and the number of bits occupied by its message number value is taken and recorded as variable z; the frame number, message number, cycle type, cycle value (x or y), and message number length (z) are written into the binary stream as headers respectively;
[0186] Each group is then assembled into frame data, that is, the first message of the group is taken, and the time is converted into the number of seconds after 0:00 on the day, recorded as variable a. If it is a non-fixed period, the adjacent messages in the group are taken, the time difference is calculated, recorded as variable b, and the number of messages in the group is counted, recorded as variable c. Finally, if it is a fixed period, variables a and c are written into the binary stream, otherwise variables a, b, and c are written into the binary stream.
[0187] Finally, in the binary stream, the data of the day can generate a binary array for subsequent use.
[0188] In an optional embodiment of the present application, the step S16 includes:
[0189] S51: taking the month in which the target message generation date occurs as the target message generation month;
[0190] S52: Determine the number of dates included in the target message generation month;
[0191] S53: Determine the total number of messages in the target message generation month according to the plurality of date message indexes;
[0192] S54: determining a third memory capacity required for storing the date message index according to the plurality of date message indexes;
[0193] S55: Determine a daily data length list according to the third memory capacity and the number of dates included in the target message generation month;
[0194] S56: taking the total number of messages in the target message generation month, the number of dates included in the target message generation month, the third memory capacity, and the daily data length list as month index header data;
[0195] S57: taking any one of the date message indexes as a set of month index content data;
[0196] S58: Combining the month index header data and several groups of the month index content data to form the month message index.
[0197] It should be noted that the target message generation month can be the month in which the target message generation date is located, and can also be understood as the month in which data creation or data update is required. In the embodiment of the present application, the creation of the monthly message index can be implemented according to the target message generation month.
[0198] The number of dates included in the target message generation month may refer to the number of days in the current month. In an embodiment of the present application, the number of days in the current month may be written into the header file of the monthly message index.
[0199] In an embodiment of the present application, the month in which the target message generation date lies can be used as the target message generation month, the number of dates included in the target message generation month can be determined, the total number of messages in the target message generation month can be determined based on a number of date message indexes, the third memory capacity required to store the date message indexes can be determined based on the number of date message indexes, and the daily data length list can be determined based on the third memory capacity and the number of dates included in the target message generation month.
[0200] The total number of messages in the target message generation month, the number of dates included in the target message generation month, the third memory capacity, and the daily data length list are used as month index header data, and any date message index is used as a group of month index content data. The month index header data and several groups of month index content data are combined to form a month message index.
[0201] The third memory capacity may be the number of bits required to store the date message index, and may be determined according to the size of the date message index, or may be set by the user.
[0202] The daily data length list can store the data length of each day in the target message generation month. The number of rows or columns of the daily data length list can be the number of dates in the target message generation month. Correspondingly, the number of columns or rows of the daily data length list can be the data length of the corresponding date in the target message generation month.
[0203] In the specific implementation, you can refer to Figure 2 Build the monthly message index. Figure 2 A schematic diagram of the structure of a vehicle message index provided by an embodiment of the present application is shown.
[0204] Monthly data can be obtained by packaging all day numbers in a month together to form a data packet. Assuming that the vehicle is online for 30 days per month, the monthly data is 30*18B=540B.
[0205] Monthly data is also divided into data header and data content, as explained below:
[0206] The data header of the monthly data includes the following four parts: information that can be used to define the data packet of the current month.
[0207] (1) V bytes: the number of messages, which can represent the total number of messages in the month. The total number of messages in the month is also a variable byte. The rules of the variable bytes can refer to the above-mentioned rules of the variable bytes. In the embodiment of the present application, the total number of messages in the month can be the total number of messages in the target message generation month.
[0208] (2) 2 digits: Day, which can represent the number of days in the month. The values 0, 1, 2, and 3 respectively represent that there are 28, 29, 30, and 31 days in the month. In the embodiment of the present application, the day can be the number of dates included in the month in which the target message is generated.
[0209] (3) 5 bits: Length X (bits) defines a variable x bits, which can be used to represent the number of bits occupied by the data length value of each day of the month. In the embodiment of the present application, Length X (bits) can be the third memory capacity.
[0210] (4) X*Days: Daily data length list. It can be a list with a length equal to the number of days in the month; one value for each day, which indicates the number of bytes occupied by the data on that day. In the embodiment of the present application, the daily data length list can include the data length of each day in the target message generation month.
[0211] The data content of the monthly data may be the data accumulation of all days of the month. The data of each day is aligned by bytes and spliced by date. In the embodiment of the present application, the data content of the monthly data may be several groups of monthly index content data, each group of monthly index content data represents a message index of any date of the month.
[0212] In the specific implementation, the monthly data can be updated, that is, the monthly index file can be updated, the data of the dates before the current month can be read, and then the newly generated daily data can be attached, and the monthly data header can be recalculated, and finally the binary array of the data packet of the current month can be regenerated.
[0213] In an optional embodiment of the present application, the step S17 includes:
[0214] S61: taking the year in which the target message is generated as the target message generation year;
[0215] S62: Determine the number of months included in the target message generation year;
[0216] S63: Determine the total number of messages in the target message generation year according to the message indexes of the months;
[0217] S64: determining a fourth memory capacity required for storing the monthly message index according to the plurality of monthly message indexes;
[0218] S65: Determine a monthly data length list according to the fourth memory capacity and the number of months included in the target message generation year;
[0219] S66: taking the total number of messages in the target message generation year, the fourth memory capacity, and the monthly data length list as year index header data;
[0220] S67: taking any one of the monthly message indexes as a set of year index content data;
[0221] S68: Combine the year index header data and several groups of year index content data to form the year message index, wherein the name of the year message index includes the vehicle frame number of the vehicle.
[0222] It should be noted that the target message generation year can be the year of the target message generation month, and can also be understood as the year in which data creation or data update is required. In the embodiment of the present application, the creation of the year message index can be implemented according to the target message generation year.
[0223] The number of months included in the target message generation year can refer to the number of months in that year, can be preset to 12 months, or can be set according to the actual message writing situation. In an embodiment of the present application, the monthly data length list can be determined according to the number of months included in the target message generation year.
[0224] In an embodiment of the present application, the year in which the target message generation month occurs can be used as the target message generation year, the number of months included in the target message generation year can be determined, the total number of messages in the target message generation year can be determined based on several monthly message indexes, the fourth memory capacity required to store the monthly message index can be determined based on several monthly message indexes, and the monthly data length list can be determined based on the fourth memory capacity and the number of months included in the target message generation year.
[0225] The total number of messages in the target message generation year, the fourth memory capacity, and the monthly data length list are used as year index header data, and any month's message index is used as a group of year index content data. The year index header data and several groups of year index content data are combined to form a year message index, wherein the name of the year message index includes the vehicle frame number.
[0226] Among them, the fourth memory capacity can be the number of bits required to store the month message index, which can be determined according to the size of the month message index, and can also be set by the user.
[0227] The monthly data length list can store the data length of each month in the target message generation year. The number of rows or columns of the monthly data length list can be the number of months included in the target message generation year. Correspondingly, the number of columns or rows of the monthly data length list can be the data length of the corresponding month included in the target message generation year.
[0228] In the specific implementation, you can refer to Figure 2 Build the year message index. Figure 2 A schematic diagram of the structure of a vehicle message index provided by an embodiment of the present application is shown.
[0229] Yearly data can refer to the data of all months of the year packaged together to form a data package. This data package is the final file. Assuming that the monthly data is 540B, the file size is 540*120=6480B, that is, the index data of each vehicle per year is about 6k, which can be smaller after compression.
[0230] The year data packet is divided into a header and a content part:
[0231] The year data header consists of the following three parts:
[0232] (1) V bytes: number of messages. The number of messages here indicates the total number of messages in the year. The number of messages here is also a variable byte. The variable byte rule can refer to the above variable byte rule. In the embodiment of the present application, the number of messages here can be the total number of messages in the target message generation year.
[0233] (2) 5 bits: Length X (bits). Length X (bits) defines a variable whose value can represent the number of bits occupied by the length value of each month's data. In the embodiment of the present application, Length X (bits) can be the fourth memory capacity.
[0234] (3) The monthly data length list may be a list with a length of 12, and each value represents the number of bytes occupied by the corresponding month's data. In the embodiment of the present application, the monthly data length list may include the data length of each month in the target message generation year.
[0235] The year data content may be the content of the data packets of the 12 months of the year, which are byte aligned and spliced together in order. In the embodiment of the present application, the year data content may be several groups of year index content data, each group of year index content data representing the message index of any month of the year.
[0236] In the specific implementation, the annual data can be updated, that is, the annual message index is updated, the data of the months before the current month are read, and then the newly generated monthly data is attached, and the annual data header is re-read, and finally the binary data of the annual data packet is regenerated, and the data is overwritten and saved to the original file (if there is no original file, a new file is created).
[0237] In an optional embodiment of the present application, step 102 includes:
[0238] S71: In the year message index, obtain several groups of the month message indexes in the year index content data.
[0239] In an embodiment of the present application, several groups of month message indexes in the year index content data can be obtained in the year message index.
[0240] S72: In several groups of the monthly message indexes, query the target month message index corresponding to the target message sequence number according to the total number of messages in the target message generation month in several groups of the monthly index header data and the target message sequence number, wherein the target message sequence number represents the generation time sequence of the target message in the vehicle target message generation year.
[0241] In an embodiment of the present application, the target month message index corresponding to the target message sequence number can be queried in several groups of monthly message indexes based on the total number of messages in the target message generation month and the target message sequence number in the several groups of monthly index header data, wherein the target message sequence number represents the generation time sequence of the target message in the vehicle target message generation year.
[0242] In a specific implementation, the number of messages per month can be obtained based on the total number of messages in the target message generation month in several groups of month index header data. Since the target message sequence number represents the generation time sequence of the target message in the vehicle target message generation year, that is, the target message sequence number can represent the generation sequence number of the target message in the vehicle target message generation year. According to the number of messages per month, determine in which month the message corresponding to the target message sequence number is generated, take this month as the target month, and obtain the message index of the target month.
[0243] S73: In the target month message index, obtain several groups of date message indexes in the month index content data.
[0244] In an embodiment of the present application, several groups of date message indexes in the month index content data may be obtained in the target month message index.
[0245] S74: In several groups of the date message indexes, query the target date message index corresponding to the target message sequence number according to the total number of message groups in the target message generation date in several groups of the first date index header data or the total number of message groups in the target message generation date in several groups of the second date index header data and the target message sequence number.
[0246] In an embodiment of the present application, the target date message index corresponding to the target message sequence number can be queried in several groups of date message indexes based on the total number of message groups in the target message generation date in several groups of first date index header data or the total number of message groups in the target message generation date in several groups of second date index header data and the target message sequence number.
[0247] In a specific implementation, the number of messages generated per day can be obtained according to the date message index in several groups of date message indexes corresponding to the target month message index. Since the target message sequence number represents the generation time sequence of the target message in the vehicle target message generation year, it is possible to determine on which day the message corresponding to the target message sequence number is generated, take this day as the target date, and obtain the message index of the target date.
[0248] S75: In the target date message index, determine the target message cycle type corresponding to the target message sequence number according to the message cycle type in the first date index header data or the message cycle type in the second date index header data in the target date message index.
[0249] In an embodiment of the present application, the target message cycle type corresponding to the target message sequence number can be determined in the target date message index according to the message cycle type in the first date index header data or the message cycle type in the second date index header data in the target date message index.
[0250] In a specific implementation, the target message cycle type of the target date can be determined according to the message cycle type in the header data of the determined target date message index. The target message cycle type of the target date can be a fixed cycle or a non-fixed cycle.
[0251] S76: When the target message period type is a fixed period, in the target date message index, obtain the first period value in several groups of first date index content data and first date index header data.
[0252] In the embodiment of the present application, when the target message period type is a fixed period, in the target date message index, several groups of first date index content data and first period values in the first date index header data are obtained.
[0253] In a specific implementation, when the target message period type is a fixed period, the frame data in the target date message index and the first period value in the header data are obtained.
[0254] S77: Query the first target date index content data corresponding to the target message sequence number according to the number of messages in the plurality of groups of the first date index content data and the target message sequence number.
[0255] In the embodiment of the present application, the first target date index content data corresponding to the target message sequence number can be queried according to the number of groups of messages in the groups of first date index content data and the target message sequence number.
[0256] In a specific implementation, the number of messages in the frame data in the target date message index can be obtained. Since the target message sequence number represents the generation time sequence of the target message in the vehicle target message generation year, it is possible to determine in which frame or frames the message corresponding to the target message sequence number is generated, and use this frame or frames as the first target date index content data.
[0257] S78: Acquire the time offset data and the number of messages in the first target date index content data.
[0258] In the embodiment of the present application, the time offset data and the number of messages in the first target date index content data may be obtained.
[0259] In a specific implementation, the first target date index content data may be obtained, that is, the intra-day time offset and the number of messages in the message frame corresponding to the target message sequence number.
[0260] S79: Determine the generation time of the message corresponding to the target message sequence number according to the first period value in the target date message index, the time offset data in the first target date index content data, and the message quantity.
[0261] In an embodiment of the present application, the generation time of the message corresponding to the target message sequence number can be determined according to the first period value in the target date message index, the time offset data in the first target date index content data, and the number of messages.
[0262] In a specific implementation, the generation time of the earliest message in the target message sequence number can be calculated based on the first period in the message header and the intraday time offset and the number of messages in the message frame in the date index file corresponding to the target message sequence number, and then the generation time of the remaining messages of the target message sequence number can be calculated based on the first period value. If the messages corresponding to the target message sequence number are in different frames, the above method can also be used to calculate the generation time of the message corresponding to the target message sequence number.
[0263] In the specific implementation, the generation time of the message corresponding to the target message number can be found according to the number of messages in the header files of different levels in the message index. In the case of a fixed message cycle, for example, the target message number is 101-110, there are 1000 messages in a year, 20 messages in January, and 200 messages in February, then the 101-110 messages are generated in February. If there are 80 messages on the 1st of February and 50 messages on the 2nd, then the 101-110 messages are generated on February 2nd. If there is only one frame on the 2nd, the generation time of the first message in the corresponding frame in the date index file of February 2nd is known according to the intraday time offset, and then the generation time of the remaining 9 messages is calculated according to the message cycle. The generation time of the message corresponding to the target message number can be obtained.
[0264] In an optional embodiment of the present application, the step 102 further includes:
[0265] S81: When the target message period type is a non-fixed period, obtaining several groups of second date index content data in the target date message index.
[0266] In the embodiment of the present application, when the target message period type is a non-fixed period, several groups of second date index content data can be obtained in the target date message index.
[0267] In a specific implementation, when the target message period type is a non-fixed period, several frames of data of the target date message index can be obtained.
[0268] S82: Query the second target date index content data corresponding to the target message sequence number according to the number of messages in the plurality of groups of the second date index content data and the target message sequence number.
[0269] In the embodiment of the present application, the second target date index content data corresponding to the target message sequence number can be queried according to the number of messages in several groups of second date index content data and the target message sequence number.
[0270] In a specific implementation, the number of messages in the frame data in the target date message index can be obtained. Since the target message sequence number represents the generation time sequence of the target message in the vehicle target message generation year, it is possible to determine in which frame or frames the message corresponding to the target message sequence number is generated, and use this frame or frames as the second target date index content data.
[0271] S83: Acquire the time offset data, the second period value and the number of messages in the second target date index content data.
[0272] In the embodiment of the present application, the time offset data, the second period value and the number of messages in the second target date index content data may be obtained.
[0273] In a specific implementation, the second target date index content data may be obtained, that is, the intra-day time offset, the second period value, and the number of messages in the message frame corresponding to the target message sequence number.
[0274] S84: Determine the generation time of the message corresponding to the target message sequence number according to the time offset data in the second target date index content data, the second period value and the number of messages.
[0275] In the embodiment of the present application, the generation time of the message corresponding to the target message sequence number can be determined according to the time offset data, the second period value and the number of messages in the second target date index content data.
[0276] In a specific implementation, the generation time of the earliest message in the target message sequence number can be calculated based on the second period value in the message header and the intraday time offset and the number of messages in the message frame in the date index file corresponding to the target message sequence number, and then the generation time of the remaining messages of the target message sequence number is calculated based on the second period value. If the messages corresponding to the target message sequence number are in different frames, the above method is used to calculate the first frame of the message corresponding to the target message sequence number. When calculating the remaining frames, the generation time of the messages corresponding to the remaining target message sequence numbers in the remaining frames is re-determined, and then the generation time of the remaining messages is calculated based on the second period value of the remaining frames.
[0277] In the specific implementation, the generation time of the message corresponding to the target message number can be found according to the number of messages in the header files of different levels in the message index. In the case of non-fixed message cycle, for example, the target message number is 101-110, there are 1000 messages in a year, 20 messages in January, and 200 messages in February, then the 101-110 messages are generated in February. If there are 80 messages on the 1st of February and 30 messages on the 2nd, then the 101-110 messages are generated on February 2nd. If there are 2 frames on the 2nd, the first frame has 25 messages and the second frame has 5 messages. According to the intraday time offset of the 21st message in the first frame corresponding to the date index file of February 2nd, the generation time of the first of the 10 messages is known, and then the generation time of messages 2-4 is calculated according to the message cycle in the first frame. Based on the intraday time offset of the first message in the second frame corresponding to the date index file on February 2, the generation time of the fifth of the 10 messages is known, and then the generation time of messages 6-10 is calculated based on the message cycle in the second frame.
[0278] In an embodiment of the present application, the target page number and the preset number of messages per page specified by the user are obtained in the message query page, the target message sequence number is determined according to the target page number and the number of messages per page, the generation time of the message corresponding to the target message sequence number is searched according to the target message sequence number in the pre-created vehicle message index, the message corresponding to the target message sequence number is searched in the preset file system according to the generation time of the message corresponding to the target message sequence number, the message corresponding to the target message sequence number is written to the message query page, and the message query page is displayed to the user. The present application completes the message query by searching the generation time of the message through the pre-created vehicle message index, and can realize fast query of the message without relying on the database, thereby ensuring the stability of the message query and improving the efficiency of the message query.
[0279] Reference Figure 3 , shows a schematic diagram of the structure of a message query device based on vehicle message indexing provided by an embodiment of the present application, the device comprising:
[0280] The query data acquisition module 301 is used to obtain the target page number and the preset number of messages per page specified by the user in the message query page, and determine the target message sequence number according to the target page number and the number of messages per page;
[0281] A message generation time search module 302 is used to search for the generation time of the message corresponding to the target message sequence number in the pre-created vehicle message index according to the target message sequence number;
[0282] A message search module 303, used to search for a message corresponding to the target message sequence number in a preset file system according to the generation time of the message corresponding to the target message sequence number;
[0283] The message display module 304 is used to write the message corresponding to the target message sequence number into the message query page, and display the message query page to the user.
[0284] In an optional embodiment of the present application, the vehicle message index is created in the following manner:
[0285] Acquire several messages generated by the vehicle, and use the date on which any of the messages is generated as the target message generation date;
[0286] Obtaining a number of messages generated by the vehicle on the target message generation date;
[0287] Determining the generation time of several messages on the target message generation date and the total number of messages on the target message generation date according to several messages generated by the vehicle on the target message generation date;
[0288] Creating a date message index according to the generation time of several messages in the target message generation date and the total number of messages in the target message generation date;
[0289] Create a month message index according to the date message index;
[0290] Create a year message index according to the month message index;
[0291] The year message index is used as the vehicle message index.
[0292] In an optional embodiment of the present application, the creating a date message index according to the generation time of several messages in the target message generation date and the total number of messages in the target message generation date includes:
[0293] Sorting the plurality of messages generated by the vehicle in the target message generation date according to the generation time of the messages;
[0294] Grouping the plurality of messages generated by the vehicle on the sorted target message generation date according to the generation time interval of the messages to obtain a plurality of message groups, wherein the generation time interval between adjacent messages in any of the message groups is not greater than a preset threshold, and the generation time interval between adjacent messages in any of the message groups is the same;
[0295] Obtaining the total number of message groups and the number of messages in several message groups on the target message generation date;
[0296] Determine a message group with the largest number of messages according to the number of messages in the message groups;
[0297] Determine the required first memory capacity according to the total number of the messages in the message group with the largest number of messages;
[0298] In the target message generation date, if the generation time interval between adjacent messages in any of the message groups is the same as the generation time interval between adjacent messages in any of the remaining message groups, then determining that the message cycle type of the target message generation date is a fixed cycle, and taking the generation time interval between adjacent messages in any of the message groups as the first cycle value;
[0299] Obtaining the generation time corresponding to the earliest generated message in any of the message groups and the start time of the target message generation date;
[0300] Determine the time offset data between the generation time corresponding to the earliest message generated in the message group and the start time of the target message generation date according to the generation time corresponding to the earliest message generated in the message group and the start time of the target message generation date;
[0301] In the case where the message cycle type of the target message generation date is a fixed cycle, the total number of message groups in the target message generation date, the total number of messages in the target message generation date, the message cycle type, the first cycle value, and the first memory capacity are used as the first date index header data of the target message generation date;
[0302] Taking the time offset data and the number of messages in any of the message groups as a set of first date index content data;
[0303] The first date index header data and several groups of the first date index content data are combined to form the date message index.
[0304] In an optional embodiment of the present application, the creating a date message index according to the generation time of several messages in the target message generation date and the total number of messages in the target message generation date further includes:
[0305] If the generation time interval of the adjacent messages in any of the message groups is different from the generation time interval of the adjacent messages in any of the other message groups, then determining that the message cycle type of the target message generation date is a non-fixed cycle, and taking the generation time interval between the adjacent messages in any of the message groups as the second cycle value of the message group;
[0306] Determining a second memory capacity required to store the second period value according to the second period value;
[0307] In the case where the message cycle type of the target message generation date is a non-fixed cycle, the total number of message groups in the target message generation date, the total number of messages in the target message generation date, the message cycle type, the second memory capacity, and the first memory capacity are used as second date index header data of the target message generation date;
[0308] Taking the time offset data, the second period value and the number of messages in any of the message groups as a set of second date index content data;
[0309] The second date index header data and several groups of the second date index content data are combined to form the date message index.
[0310] In an optional embodiment of the present application, the step of creating a monthly message index according to the date message index includes:
[0311] The month in which the target message is generated is used as the target message generation month;
[0312] Determine the number of dates included in the target message generation month;
[0313] Determine the total number of messages in the target message generation month according to the plurality of date message indexes;
[0314] Determine a third memory capacity required to store the date message index according to the plurality of date message indexes;
[0315] Determine a daily data length list according to the third memory capacity and the number of dates included in the target message generation month;
[0316] The total number of messages in the target message generation month, the number of dates included in the target message generation month, the third memory capacity, and the daily data length list are used as month index header data;
[0317] Taking any one of the date message indexes as a set of month index content data;
[0318] The month index header data and several groups of the month index content data are combined to form the month message index.
[0319] In an optional embodiment of the present application, the step of creating a year message index according to the month message index includes:
[0320] The year in which the target message is generated is used as the target message generation year;
[0321] Determine the number of months included in the target message generation year;
[0322] Determine the total number of messages in the target message generation year according to the message indexes of the months;
[0323] Determine a fourth memory capacity required to store the monthly message index according to the plurality of monthly message indexes;
[0324] Determine a monthly data length list according to the fourth memory capacity and the number of months included in the target message generation year;
[0325] The total number of messages in the target message generation year, the fourth memory capacity, and the monthly data length list are used as year index header data;
[0326] Taking any one of the monthly message indexes as a set of year index content data;
[0327] The year index header data and several groups of the year index content data are combined to form the year message index, wherein the name of the year message index includes the frame number of the vehicle.
[0328] In an optional embodiment of the present application, the message generation time search module 302 includes:
[0329] A month message index acquisition module, used to acquire, in the year message index, several groups of the month message indexes in the year index content data;
[0330] A target month message index acquisition module is used to query the target month message index corresponding to the target message sequence number in a plurality of groups of the month message indexes according to the total number of messages in the target message generation month in a plurality of groups of the month index header data and the target message sequence number, wherein the target message sequence number represents the generation time sequence of the target message in the vehicle target message generation year;
[0331] A date message index acquisition module, used to acquire several groups of date message indexes in the target month index content data in the target month message index;
[0332] A target date message index acquisition module, used to query the target date message index corresponding to the target message sequence number in several groups of the date message indexes according to the total number of message groups in the target message generation date in several groups of the first date index header data or the total number of message groups in the target message generation date in several groups of the second date index header data and the target message sequence number;
[0333] a target message cycle type determination module, configured to determine, in the target date message index, a target message cycle type corresponding to the target message sequence number according to the message cycle type in the first date index header data or the message cycle type in the second date index header data in the target date message index;
[0334] A first period value module, configured to obtain, in the target date message index, a plurality of groups of first date index content data and the first period value in the first date index header data when the target message period type is a fixed period;
[0335] A first target content data acquisition module, configured to query the first target date index content data corresponding to the target message sequence number according to the number of messages in the plurality of groups of the first date index content data and the target message sequence number;
[0336] A first time offset data acquisition module, used to acquire the time offset data and the number of messages in the first target date index content data;
[0337] The first generation time calculation module is used to determine the generation time of the message corresponding to the target message sequence number according to the first period value in the target date message index, the time offset data in the first target date index content data, and the message quantity.
[0338] In an optional embodiment of the present application, the message generation time search module 302 further includes:
[0339] A second date index content data acquisition module, used for acquiring several groups of second date index content data in the target date message index when the target message period type is a non-fixed period;
[0340] A second target date index content data acquisition module, used for searching the second target date index content data corresponding to the target message sequence number according to the number of messages in several groups of the second date index content data and the target message sequence number;
[0341] A second time offset data acquisition module, used to acquire the time offset data, the second period value and the number of messages in the second target date index content data;
[0342] The second generation time calculation module is used to determine the generation time of the message corresponding to the target message sequence number according to the time offset data in the second target date index content data, the second period value and the number of messages.
[0343] An embodiment of the present application also provides an electronic device, characterized in that it includes a processor, a memory, and a computer program stored in the memory and capable of running on the processor, and when the computer program is executed by the processor, it implements the message query method based on vehicle message index as described above.
[0344] An embodiment of the present application further provides a computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the message query method based on the vehicle message index as described above is implemented.
[0345] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0346] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0347] Those skilled in the art will appreciate that the embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0348] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0349] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0350] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0351] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.
[0352] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "including one..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the above elements.
[0353] The message query method and device based on vehicle message indexing are introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for general technical personnel in this field, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A message query method based on vehicle message index, characterized in that: The method comprises: In the message query page, obtain the target page number and the preset number of messages per page specified by the user, and determine the target message sequence number according to the target page number and the number of messages per page; In the pre-created vehicle message index, searching for the generation time of the message corresponding to the target message sequence number according to the target message sequence number; Searching for a message corresponding to the target message sequence number in a preset file system according to the generation time of the message corresponding to the target message sequence number; The message corresponding to the target message sequence number is written into the message query page, and the message query page is displayed to the user.
2. The method according to claim 1, characterized in that The vehicle message index is created in the following way: Acquire several messages generated by the vehicle, and use the date on which any of the messages is generated as the target message generation date; Obtaining a number of messages generated by the vehicle on the target message generation date; Determining the generation time of several messages on the target message generation date and the total number of messages on the target message generation date according to several messages generated by the vehicle on the target message generation date; Creating a date message index according to the generation time of several messages in the target message generation date and the total number of messages in the target message generation date; Create a month message index according to the date message index; Create a year message index according to the month message index; The year message index is used as the vehicle message index.
3. The method according to claim 2, characterized in that The creating a date message index according to the generation time of several messages in the target message generation date and the total number of messages in the target message generation date includes: Sorting the plurality of messages generated by the vehicle in the target message generation date according to the generation time of the messages; Grouping the plurality of messages generated by the vehicle on the sorted target message generation date according to the generation time interval of the messages to obtain a plurality of message groups, wherein the generation time interval between adjacent messages in any of the message groups is not greater than a preset threshold, and the generation time interval between adjacent messages in any of the message groups is the same; Obtaining the total number of message groups and the number of messages in several message groups on the target message generation date; Determine a message group with the largest number of messages according to the number of messages in the message groups; Determine the required first memory capacity according to the total number of the messages in the message group with the largest number of messages; In the target message generation date, if the generation time interval between adjacent messages in any of the message groups is the same as the generation time interval between adjacent messages in any of the remaining message groups, then determining that the message cycle type of the target message generation date is a fixed cycle, and taking the generation time interval between adjacent messages in any of the message groups as the first cycle value; Obtaining the generation time corresponding to the earliest generated message in any of the message groups and the start time of the target message generation date; Determine the time offset data between the generation time corresponding to the earliest message generated in the message group and the start time of the target message generation date according to the generation time corresponding to the earliest message generated in the message group and the start time of the target message generation date; In the case where the message cycle type of the target message generation date is a fixed cycle, the total number of message groups in the target message generation date, the total number of messages in the target message generation date, the message cycle type, the first cycle value, and the first memory capacity are used as the first date index header data of the target message generation date; Taking the time offset data and the number of messages in any of the message groups as a set of first date index content data; The first date index header data and several groups of the first date index content data are combined to form the date message index.
4. The method according to claim 3, characterized in that The step of creating a date message index according to the generation time of several messages in the target message generation date and the total number of messages in the target message generation date further includes: If the generation time interval of the adjacent messages in any of the message groups is different from the generation time interval of the adjacent messages in any of the other message groups, then determining that the message cycle type of the target message generation date is a non-fixed cycle, and taking the generation time interval between the adjacent messages in any of the message groups as the second cycle value of the message group; Determining a second memory capacity required to store the second period value according to the second period value; In the case where the message cycle type of the target message generation date is a non-fixed cycle, the total number of message groups in the target message generation date, the total number of messages in the target message generation date, the message cycle type, the second memory capacity, and the first memory capacity are used as second date index header data of the target message generation date; Taking the time offset data, the second period value and the number of messages in any of the message groups as a set of second date index content data; The second date index header data and several groups of the second date index content data are combined to form the date message index.
5. The method according to claim 4, characterized in that The step of creating a month message index according to the date message index includes: The month in which the target message is generated is used as the target message generation month; Determine the number of dates included in the target message generation month; Determine the total number of messages in the target message generation month according to the plurality of date message indexes; Determine a third memory capacity required to store the date message index according to the plurality of date message indexes; Determine a daily data length list according to the third memory capacity and the number of dates included in the target message generation month; The total number of messages in the target message generation month, the number of dates included in the target message generation month, the third memory capacity, and the daily data length list are used as month index header data; Taking any one of the date message indexes as a set of month index content data; The month index header data and several groups of the month index content data are combined to form the month message index.
6. The method according to claim 5, characterized in that The step of creating a year message index according to the month message index includes: The year in which the target message is generated is used as the target message generation year; Determine the number of months included in the target message generation year; Determine the total number of messages in the target message generation year according to the message indexes of the months; Determine a fourth memory capacity required to store the monthly message index according to the plurality of monthly message indexes; Determine a monthly data length list according to the fourth memory capacity and the number of months included in the target message generation year; The total number of messages in the target message generation year, the fourth memory capacity, and the monthly data length list are used as year index header data; Taking any one of the monthly message indexes as a set of year index content data; The year index header data and several groups of the year index content data are combined to form the year message index, wherein the name of the year message index includes the frame number of the vehicle.
7. The method according to claim 6, characterized in that The step of searching, in the pre-created vehicle message index, the generation time of the message corresponding to the target message sequence number according to the target message sequence number comprises: In the year message index, obtain several groups of the month message indexes in the year index content data; In the plurality of groups of the monthly message indexes, querying the target month message index corresponding to the target message sequence number according to the total number of messages in the target message generation month in the plurality of groups of the monthly index header data and the target message sequence number, wherein the target message sequence number represents the generation time sequence of the target message in the vehicle target message generation year; In the target month message index, obtain several groups of date message indexes in the month index content data; In the plurality of groups of the date message indexes, querying the target date message index corresponding to the target message sequence number according to the total number of message groups in the target message generation date in the plurality of groups of the first date index header data or the total number of message groups in the target message generation date in the plurality of groups of the second date index header data and the target message sequence number; In the target date message index, determining the target message cycle type corresponding to the target message sequence number according to the message cycle type in the first date index header data or the message cycle type in the second date index header data in the target date message index; In the case where the target message period type is a fixed period, obtaining the first period value in several groups of first date index content data and first date index header data in the target date message index; Querying the first target date index content data corresponding to the target message sequence number according to the number of messages in the plurality of groups of the first date index content data and the target message sequence number; Acquire the time offset data and the number of messages in the first target date index content data; The generation time of the message corresponding to the target message sequence number is determined according to the first period value in the target date message index, the time offset data in the first target date index content data, and the message quantity.
8. The method according to claim 7, characterized in that The method further comprises searching, in the pre-created vehicle message index, the generation time of the message corresponding to the target message sequence number according to the target message sequence number, and further comprising: In the case where the target message period type is a non-fixed period, obtaining a plurality of groups of second date index content data in the target date message index; Querying the second target date index content data corresponding to the target message sequence number according to the number of messages in the plurality of groups of the second date index content data and the target message sequence number; Acquire the time offset data, the second period value and the number of messages in the second target date index content data; The generation time of the message corresponding to the target message sequence number is determined according to the time offset data in the second target date index content data, the second period value and the number of messages.
9. A message query device based on vehicle message index, characterized in that: The device comprises: A query data acquisition module is used to obtain a target page number and a preset number of messages per page specified by a user in a message query page, and determine a target message sequence number according to the target page number and the number of messages per page; A message generation time search module, used to search for the generation time of the message corresponding to the target message sequence number in the pre-created vehicle message index according to the target message sequence number; A message search module, used to search for a message corresponding to the target message sequence number in a preset file system according to the generation time of the message corresponding to the target message sequence number; The message display module is used to write the message corresponding to the target message sequence number into the message query page and display the message query page to the user.
10. An electronic device, characterized in that: The invention comprises a processor, a memory and a computer program stored in the memory and capable of running on the processor, wherein when the computer program is executed by the processor, the message query method based on vehicle message index as described in any one of claims 1 to 8 is implemented.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the message query method based on vehicle message indexing according to any one of claims 1 to 8 is implemented.
Citation Information
Cited By
Time sequence data management method and device, electronic equipment and storage medium
CN121412178A
A time series data management method and device, electronic equipment, and storage medium
CN121412178B