Data storage method and apparatus, data reading method and apparatus, and server
By optimizing CAN bus data storage in the server according to vehicle identification code, collection time, and vehicle model information, the problem of resource consumption of vehicle parsing data was solved, and the efficiency and accuracy of data query and retrieval were improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- YINWANG INTELLIGENT TECHNOLOGIES CO LTD
- Filing Date
- 2025-03-06
- Publication Date
- 2026-06-05
AI Technical Summary
The process of parsing CAN bus data consumes a large amount of computing resources, affecting driving safety and the efficiency and accuracy of server database management.
The CAN bus data collected from the same vehicle at different times is stored in different data blocks of different files in the same partition of the server, and the corresponding relationship is stored. The data storage method is optimized, and queries and readings are performed based on vehicle identification code, collection time and vehicle model information.
It improves the efficiency and accuracy of server data querying and retrieval, reduces the burden on vehicle data parsing, and enhances data processing capabilities.
Smart Images

Figure CN122152209A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data storage, and more specifically, to a data storage method and apparatus, a data reading method and apparatus, and a server. Background Technology
[0002] As smart cars become more widely used in daily life, users expect them and their related devices to bring a more comfortable and intelligent experience. Against this backdrop, the demand for in-vehicle network data transmission capabilities has seen explosive growth.
[0003] Currently, Controller Area Network (CAN) bus technology is a widely used in-vehicle network data transmission technology. During vehicle operation, a large amount of CAN bus data is continuously generated and recorded. This CAN bus data is parsed and stored in the vehicle's internal storage devices or a server's database for subsequent querying and retrieval. However, parsing CAN bus data requires significant computing resources, which may reduce the vehicle's data processing capabilities and potentially affect driving safety and vehicle reliability. Furthermore, as the amount of data stored in the database continues to increase, the difficulty of managing the database on the server also increases, further impacting the efficiency and accuracy of server data querying and retrieval. Summary of the Invention
[0004] This application provides a data storage method and apparatus, a data reading method and apparatus, and a server, which can optimize the storage method of CAN bus data, thereby improving the efficiency and accuracy of server querying and reading data.
[0005] In a first aspect, a data storage method is provided, the method comprising: acquiring first CAN bus data of a first vehicle and first data information corresponding to the first CAN bus data, and second CAN bus data and second data information corresponding to the second CAN bus data, wherein the first data information includes: a first vehicle identification code and a first acquisition time of the first CAN bus data, and the second data information includes: the first vehicle identification code and a second acquisition time of the second CAN bus data, wherein the first acquisition time is different from the second acquisition time; writing the first CAN bus data into a first data block and storing a first correspondence relationship, wherein the first data block is located in a first file of a first partition of a server, and the first correspondence relationship includes: the correspondence between the first vehicle identification code and the first acquisition time and the storage location of the first data block; writing the second CAN bus data into a second data block and storing a second correspondence relationship, wherein the second data block is located in a second file of the first partition, and the second correspondence relationship includes: the correspondence between the first vehicle identification code and the second acquisition time and the storage location of the second data block.
[0006] In this embodiment, CAN bus data collected from the same vehicle at different times can be stored in different data blocks of different files within the same partition of the server, with corresponding relationships maintained. This optimizes the storage of CAN bus data. During subsequent data queries and retrievals, the server can quickly query and retrieve data based on the vehicle identification number, the data collection time, and the stored relationships, avoiding the need to query and retrieve data from the entire database. This improves the efficiency and accuracy of server data retrieval. Furthermore, the first vehicle can directly upload the raw data of both the first and second CAN bus data, eliminating the need for the vehicle to parse the first and second CAN bus data, thus enhancing the vehicle's data processing capabilities.
[0007] In conjunction with the first aspect, in some implementations of the first aspect, the method further includes: writing the first CAN bus data stored in the first data block and the second CAN bus data stored in the second data block into a third data block, and storing a third correspondence; wherein the third data block is located in a third file of the first partition, and the third correspondence includes: the correspondence between the first vehicle identification code and the storage location of the third data block.
[0008] In this embodiment, the first CAN bus data stored in the first data block and the second CAN bus data stored in the second data block can be written into the third data block. This allows CAN bus data collected from the same vehicle to be centrally stored in the same file, reducing the number of files in the first partition and thus improving data query and retrieval efficiency.
[0009] In conjunction with the first aspect, in some implementations of the first aspect, before storing the third correspondence, the method further includes: determining that the first acquisition time and the second acquisition time are within a first time range.
[0010] In this embodiment of the application, by setting the first time range, it is possible to avoid merging CAN bus data collected outside the first time range into the third data block of the third file, thereby effectively controlling the number of files in the first partition after data merging, and also helping to further improve the efficiency of data query and reading.
[0011] In conjunction with the first aspect, in some implementations of the first aspect, the first data information and the second data information further include the first identification information of the first vehicle model, the first correspondence further includes the correspondence between the first identification information and the storage location of the first data block, and the second correspondence further includes the correspondence between the first identification information and the storage location of the second data block.
[0012] In this embodiment of the application, when setting the first and second correspondences, the first identification information of the first vehicle model is also taken into account. This facilitates subsequent data retrieval based on the vehicle identification code, the data collection time, the vehicle model's identification information, and the stored correspondences, further improving the accuracy of data retrieval and reading.
[0013] Secondly, a data reading method is provided, the method comprising: acquiring a first reading instruction of a first vehicle, the first reading instruction including a second vehicle identification code and a third acquisition time of data; when the second vehicle identification code matches the first vehicle identification code and the third acquisition time is equal to the first acquisition time, selecting a first correspondence in a data file list and reading first CAN bus data from a first data block based on the first correspondence, or when the second vehicle identification code matches the first vehicle identification code and the third acquisition time is equal to the second acquisition time, selecting a second correspondence in the data file list and reading second CAN bus data from a second data block based on the second correspondence; wherein the first data block is located in a first file of a first partition of a server, the first correspondence including the correspondence between the first vehicle identification code and the first acquisition time and the storage location of the first data block, the second data block is located in a second file of the first partition, the second correspondence including the correspondence between the first vehicle identification code and the second acquisition time and the storage location of the second data block, and the second acquisition time being different from the first acquisition time.
[0014] In this embodiment, when the server reads data, it can select a matching relationship from the data file list based on the vehicle identification code and the data collection time, and then read the corresponding data from the first data block or the second data block based on that relationship. This avoids the server having to query and read data from the entire database, thereby improving the efficiency and accuracy of server data querying and reading.
[0015] In conjunction with the second aspect, in some implementations of the second aspect, before reading the first CAN bus data from the first data block based on the first correspondence, the method further includes: selecting a third correspondence in the data file list, and not reading the first CAN bus data from the third data block based on the third correspondence; or before reading the second CAN bus data from the second data block based on the second correspondence, the method further includes: selecting the third correspondence in the data file list, and not reading the second CAN bus data from the third data block based on the third correspondence; wherein the third data block is located in a third file of the first partition, and the third correspondence includes: the correspondence between the first vehicle identification code and the storage location of the third data block.
[0016] In this embodiment, the server can prioritize reading data from a third data block with higher data concentration based on the first read command sent by the vehicle. If no data is found in the third data block, the server can then read data from the first or second data block. This optimized data reading mechanism effectively reduces the probability of data read failures.
[0017] In conjunction with the second aspect, in some implementations of the second aspect, before reading the first CAN bus data from the first data block based on the first correspondence, or reading the second CAN bus data from the second data block based on the second correspondence, the method further includes: obtaining a second time range for data storage of the first data block and the second data block; and determining that the moment of reading the first CAN bus data or the second CAN bus data falls within the second time range.
[0018] In this embodiment, after writing the CAN bus data from the first and second data blocks into the third data block, setting a second time range can effectively manage the duration of the CAN bus data in the first and second data blocks, thereby effectively reducing data storage costs. Furthermore, it avoids querying and retrieving data from the first or second data block after the CAN bus data stored in the first and second data blocks has been cleared, thus further improving the efficiency and accuracy of data querying and retrieval.
[0019] In conjunction with the second aspect, in some implementations of the second aspect, the first reading instruction further includes: second identification information indicating the vehicle model; the first correspondence further includes: a correspondence between the first identification information of the first vehicle model and the storage location of the first data block; the second correspondence further includes: a correspondence between the first identification information and the storage location of the second data block; before reading the first CAN bus data from the first data block based on the first correspondence, or reading the second CAN bus data from the second data block based on the second correspondence, the method further includes: determining that the second identification information and the first identification information match.
[0020] In this embodiment of the application, when setting the first and second correspondences, the first identification information of the first vehicle model is also taken into account. In this way, the server can further improve the accuracy of data query and retrieval by querying and retrieving data based on the vehicle identification code, the data collection time, the vehicle model identification information, and the stored correspondences.
[0021] Thirdly, a data storage device is provided, the device comprising: an acquisition unit and a processing unit; the acquisition unit is configured to acquire first CAN bus data of a first vehicle and first data information corresponding to the first CAN bus data, and second CAN bus data and second data information corresponding to the second CAN bus data, the first data information including: a first vehicle identification code and a first acquisition time of the first CAN bus data, the second data information including: a first vehicle identification code and a second acquisition time of the second CAN bus data, the first acquisition time being different from the second acquisition time; the processing unit is configured to: write the first CAN bus data into a first data block and store a first correspondence, the first data block being located in a first file of a first partition of a server, the first correspondence including: the correspondence between the first vehicle identification code and the first acquisition time and the storage location of the first data block; write the second CAN bus data into a second data block and store a second correspondence, the second data block being located in a second file of the first partition, the second correspondence including: the correspondence between the first vehicle identification code and the second acquisition time and the storage location of the second data block.
[0022] For a description of the beneficial effects of the third aspect, please refer to the description of the beneficial effects of the first aspect, which will not be repeated here.
[0023] In conjunction with the third aspect, in some implementations of the third aspect, the processing unit is further configured to write the first CAN bus data stored in the first data block and the second CAN bus data stored in the second data block into a third data block, and store a third correspondence; wherein the third data block is located in a third file of the first partition, and the third correspondence includes: the correspondence between the first vehicle identification code and the storage location of the third data block.
[0024] In conjunction with the third aspect, in some implementations of the third aspect, the processing unit is further configured to determine that the first acquisition time and the second acquisition time are within a first time range.
[0025] In conjunction with the third aspect, in some implementations of the third aspect, the first data information and the second data information further include the first identification information of the first vehicle model, the first correspondence further includes the correspondence between the first identification information and the storage location of the first data block, and the second correspondence further includes the correspondence between the first identification information and the storage location of the second data block.
[0026] Fourthly, a data reading device is provided, the device comprising: an acquisition unit and a processing unit; the acquisition unit is configured to acquire a first reading instruction of a first vehicle, the first reading instruction including: a second vehicle identification code and a third acquisition time of the data; the processing unit is configured to: when the second vehicle identification code matches the first vehicle identification code and the third acquisition time is equal to the first acquisition time, select a first correspondence in a data file list and read first CAN bus data from a first data block based on the first correspondence, or when the second vehicle identification code matches the first vehicle identification code and the third acquisition time is equal to the second acquisition time, select a second correspondence in the data file list and read second CAN bus data from a second data block based on the second correspondence; wherein, the first data block is located in a first file of a first partition of a server, the first correspondence includes: the correspondence between the first vehicle identification code and the first acquisition time and the storage location of the first data block, the second data block is located in a second file of the first partition, the second correspondence includes: the correspondence between the first vehicle identification code and the second acquisition time and the storage location of the second data block, and the second acquisition time is different from the first acquisition time.
[0027] For a description of the beneficial effects in the fourth aspect, please refer to the description of the beneficial effects in the second aspect, which will not be repeated here.
[0028] In conjunction with the fourth aspect, in some implementations of the fourth aspect, the processing unit is further configured to select a third correspondence in the data file list and, based on the third correspondence, not read the first CAN bus data from the third data block, or select the third correspondence in the data file list and, based on the third correspondence, not read the second CAN bus data from the third data block; wherein the third data block is located in the third file of the first partition, and the third correspondence includes: the correspondence between the first vehicle identification code and the storage location of the third data block.
[0029] In conjunction with the fourth aspect, in some implementations of the fourth aspect, the acquisition unit is further configured to acquire a second time range for the preset data storage of the first data block and the second data block; the processing unit is further configured to determine that the moment of reading the first CAN bus data or the second CAN bus data falls within the second time range.
[0030] In conjunction with the fourth aspect, in some implementations of the fourth aspect, the first reading instruction further includes: indicating the second identification information of the vehicle model; the first correspondence further includes: the correspondence between the first identification information of the first vehicle model and the storage location of the first data block; the second correspondence further includes: the correspondence between the first identification information and the storage location of the second data block; the processing unit is further configured to determine that the second identification information and the first identification information match.
[0031] Fifthly, a data storage device is provided, comprising: at least one processor and a memory, wherein the at least one processor is coupled to the memory and is configured to read and execute instructions in the memory, such that the device implements the method in any of the implementations of the first aspect described above.
[0032] In a sixth aspect, a data reading device is provided, comprising: at least one processor and a memory, wherein the at least one processor is coupled to the memory for reading and executing instructions in the memory, such that the device implements the method in any of the implementations of the second aspect described above.
[0033] In a seventh aspect, a computer-readable storage medium is provided, the computer-readable storage medium storing program code that, when the computer program code is run on a computer, causes the computer to perform the method in any one of the implementations of the first or second aspect described above.
[0034] Eighthly, a chip is provided, the chip including circuitry for performing the method in any one of the implementations of the first or second aspect described above.
[0035] Ninthly, a computer program product is provided, the computer product including a computer program that, when the computer program is run by a processor, causes the method in any of the implementations of the first or second aspect to be executed.
[0036] In a tenth aspect, a server is provided, comprising: a data storage device according to any implementation of the third aspect above and a data reading device according to any implementation of the fourth aspect above. Attached Figure Description
[0037] Figure 1 This is a functional schematic diagram of a vehicle provided in an embodiment of this application;
[0038] Figure 2 This is a schematic diagram illustrating data interaction between a vehicle and a server, provided in an embodiment of this application.
[0039] Figure 3 This is a flowchart illustrating data writing and data reading provided in an embodiment of this application;
[0040] Figure 4 This is a schematic flowchart illustrating a data storage method provided in an embodiment of this application;
[0041] Figure 5 This is a schematic flowchart illustrating another data reading method provided in an embodiment of this application;
[0042] Figure 6 This is a schematic flowchart illustrating a data writing process provided in an embodiment of this application;
[0043] Figure 7 This is a schematic flowchart illustrating a data reading method provided in an embodiment of this application;
[0044] Figure 8 This is an illustrative flowchart of another data writing method provided in an embodiment of this application;
[0045] Figure 9 This is an illustrative flowchart illustrating another data reading method provided in an embodiment of this application;
[0046] Figure 10 This is an illustrative flowchart illustrating another data writing and data reading method provided in an embodiment of this application;
[0047] Figure 11 This is a schematic diagram of a data storage or data reading device provided in an embodiment of this application;
[0048] Figure 12 This is a schematic diagram of another data storage or data reading device provided in an embodiment of this application. Detailed Implementation
[0049] In the description of the embodiments of this application, unless otherwise stated, " / " means "or", for example, A / B can mean A or B; "and / or" in this document is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. In this application, "at least one" means one or more, and "more" means two or more. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or multiple items. For example, at least one of a, b, or c can represent: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or multiple.
[0050] The use of prefixes such as "first" and "second" in this application embodiment is solely for distinguishing different descriptive objects and does not limit the position, order, priority, quantity, or content of the described objects. The use of ordinal numbers and other prefixes to distinguish descriptive objects in this application embodiment does not constitute a limitation on the described objects. The description of the described objects is found in the claims or the context of the embodiments, and the use of such prefixes should not constitute unnecessary restrictions.
[0051] The technical solutions in this application will now be described with reference to the accompanying drawings.
[0052] Figure 1 This is a functional schematic diagram of a vehicle provided in an embodiment of this application.
[0053] like Figure 1 As shown, the vehicle 100 involved in this application may include multiple subsystems, such as a sensing system 120, a computing platform 130, and a communication system 140. Optionally, the vehicle 100 may include more or fewer subsystems, and each subsystem may include one or more components. In addition, each subsystem and component of the vehicle 100 can be interconnected via wired or wireless means.
[0054] The perception system 120 may include several sensors for sensing information about the environment surrounding the vehicle 100. For example, the perception system 120 may include a positioning system, which may be a global positioning system (GPS), a BeiDou system, or another positioning system. The perception system 120 may include one or more of the following: an inertial measurement unit (IMU), a rain sensor, a humidity and temperature sensor, a lidar, a millimeter-wave radar, an ultrasonic radar, and a camera device.
[0055] Some or all of the functions of vehicle 100 can be controlled by computing platform 130. Computing platform 130 may include processors 131 to 13n (n being a positive integer). A processor is a circuit with signal processing capabilities. In one implementation, the processor can be a circuit with instruction read and execute capabilities, such as a central processing unit (CPU), microprocessor, graphics processing unit (GPU) (which can be understood as a type of microprocessor), or digital signal processor (DSP). In another implementation, the processor can implement certain functions through the logical relationships of hardware circuits. These logical relationships are fixed or reconfigurable. For example, the processor may be a hardware circuit implemented using an application-specific integrated circuit (ASIC) or a programmable logic device (PLD), such as an FPGA. In reconfigurable hardware circuits, the process of the processor loading a configuration document and configuring the hardware circuit can be understood as the process of the processor loading instructions to implement some or all of the functions of the aforementioned units. Furthermore, the processor can also be a hardware circuit designed for artificial intelligence, which can be understood as an ASIC, such as a neural network processing unit (NPU), tensor processing unit (TPU), deep learning processing unit (DPU), etc. In addition, the computing platform 130 may also include a memory for storing instructions. Some or all of the processors 131 to 13n can call the instructions in the memory to implement the corresponding functions.
[0056] The computing platform 130 can control the functions of the vehicle 100 based on inputs received from various subsystems (e.g., the sensing system 120). In some embodiments, the computing platform 130 can be used to provide control over many aspects of the vehicle 100 and its subsystems.
[0057] The communication system 140 can be used to connect various control units in the vehicle to enable coordinated operation of functions such as driving, braking and entertainment. It also supports the interaction between the vehicle 100 and external devices to improve safety and driving experience.
[0058] Optionally, the above components are just an example. In actual applications, the components in each of the above modules may be added or deleted as needed.
[0059] The vehicle 100 in this application may include: road vehicles, water vehicles, air vehicles, industrial equipment, agricultural equipment, or entertainment equipment, etc. For example, vehicle 100 may be a means of transportation (such as commercial vehicles, passenger cars, motorcycles, flying cars, trains, etc.), industrial vehicles (such as forklifts, trailers, tractors, etc.), engineering vehicles (such as excavators, bulldozers, cranes, etc.), agricultural equipment (such as lawnmowers, harvesters, etc.), amusement equipment, toy vehicles, etc. The embodiments of this application do not specifically limit the type of vehicle.
[0060] Figure 2 This is a schematic diagram illustrating data interaction between a vehicle and a server, as provided in an embodiment of this application.
[0061] like Figure 2 As shown, vehicle 100 can establish a wireless connection with server 200 to achieve remote data transmission and interaction. Vehicle 100 can acquire CAN bus data via wired or wireless connection and upload the CAN bus data to server 200 via wireless communication technology. Server 200 can receive and store this data for subsequent data querying and retrieval. For example, when vehicle 100 sends a data read command to server 200, server 200 can retrieve the stored data based on the data read command, generate corresponding query results, and then return the query results and read data to vehicle 100 via wireless connection, thereby realizing remote data query and feedback functions. This mechanism ensures real-time data interaction between the vehicle and the server, providing technical support for remote monitoring, vehicle management, and intelligent applications.
[0062] Optionally, the aforementioned wireless connection methods may include, but are not limited to, 3G / 4G connection, WiFi connection, Bluetooth connection, WiMAX connection, Zigbee connection, ultrawideband (UWB) connection, and other known or future wireless connection methods.
[0063] It should be noted that, Figure 2 The number of servers 200 shown is exemplary, and those skilled in the art can set up any number of servers based on the needs of technical implementation.
[0064] It should also be noted that, Figure 2 The functions of the vehicles and servers shown are merely illustrative, intended to provide an intuitive understanding of the implementation principles of data storage and retrieval methods, and do not constitute any limitation. Those skilled in the art can modify them according to specific practical needs. Figure 2 The functions of the vehicles and servers shown can be flexibly adjusted. For example, new modules can be added to support more complex functional requirements, some modules can be removed to simplify system design, or existing modules can be replaced to use newer modules or hardware.
[0065] As described in the background section, CAN bus technology remains a widely used in-vehicle network data transmission technology. Figure 3 As shown, during vehicle use, a large amount of CAN bus data is continuously generated and recorded. After being parsed, this CAN bus data will be stored in the vehicle's internal storage device or the server's database for subsequent querying and retrieval.
[0066] However, parsing CAN bus data requires significant computing resources, which may reduce the vehicle's data processing capabilities and potentially impact driving safety and vehicle reliability. Furthermore, the increasing volume of data stored in the database makes database management more difficult for the server, further affecting the efficiency and accuracy of server data retrieval and reading.
[0067] This application provides a data storage method and apparatus, a data reading method and apparatus, and a server, which can optimize the storage method of CAN bus data, thereby improving the efficiency and accuracy of server querying and reading data.
[0068] Figure 4 This is a schematic flowchart illustrating a data storage method provided in an embodiment of this application. The execution entity of method 400 can be a server, which can be... Figure 2 In the server 200, method 400 may include steps S401 to S403.
[0069] S401, acquire the first CAN bus data of the first vehicle and the first data information corresponding to the first CAN bus data, as well as the second CAN bus data and the second data information corresponding to the second CAN bus data.
[0070] The first data information includes the first acquisition time of the first vehicle identification code and the first CAN bus data; the second data information includes the second acquisition time of the first vehicle identification code and the second CAN bus data, and the first acquisition time is different from the second acquisition time.
[0071] S402, write the first CAN bus data into the first data block and store the first correspondence.
[0072] The first data block is located in the first file of the first partition of the server, and the first correspondence includes the correspondence between the first vehicle identification code and the first collection time and the storage location of the first data block.
[0073] Optionally, when setting up a database on the server, the first data block can be located in the first file of the first partition of the database. Further, optionally, when the amount of data stored on the server is large, the database can be replaced by a data lake. The data lake can be understood as a large-scale storage system for storing CAN bus data, supporting subsequent data querying, data processing, data analysis and data mining.
[0074] Optionally, the storage location of the first data block can be understood as: the storage path of the first data block on the server, that is, the partition and file where the first data block is located. The above data storage method can be understood as a data storage method that relies on software systems for management and organization.
[0075] S403: Write the second CAN bus data into the second data block and store the second correspondence.
[0076] The second data block is located in the second file of the first partition. The second correspondence includes the correspondence between the first vehicle identification code and the second acquisition time, and the storage location of the second data block. The storage location and storage method of the second data block can be referred to the corresponding description of the first data block.
[0077] Based on the aforementioned data storage method, CAN bus data collected from the same vehicle at different times can be stored in different data blocks of different files within the same partition of the server, with corresponding relationships maintained. This optimizes CAN bus data storage, allowing the server to quickly query and retrieve data based on the vehicle identification number, data collection time, and stored relationships during subsequent queries and retrievals. This avoids the need for the server to query and retrieve data from the entire database, thus improving the efficiency and accuracy of server data retrieval. Furthermore, the first vehicle can directly upload the raw data from both the first and second CAN bus data sources, eliminating the need for the vehicle to parse both data and improving its data processing capabilities.
[0078] According to some embodiments, after step S403, method 400 further includes: writing the first CAN bus data stored in the first data block and the second CAN bus data stored in the second data block into a third data block, and storing a third correspondence; wherein the third data block is located in a third file of the first partition, and the third correspondence includes: the correspondence between the storage location of the first vehicle identification code and the third data block.
[0079] Based on the above data storage method, the first CAN bus data stored in the first data block and the second CAN bus data stored in the second data block can be written into the third data block. In this way, CAN bus data collected from the same vehicle can be centrally stored in the same file, reducing the number of files in the first partition, thereby further improving data query and retrieval efficiency.
[0080] Optionally, the storage location and storage method of the third data block can refer to the description of the first data block.
[0081] Optionally, the third data block can be the first data block or the second data block, or the third data block can be a data block different from the first data block and the second data block.
[0082] Optionally, the first to third correspondences can be stored in a list of data files in the server's file system.
[0083] Optionally, after the first CAN bus data and the second CAN bus data are written to the third data block, the first CAN bus data stored in the first data block and the second CAN bus data stored in the second data block can be deleted immediately. Alternatively, a data aging period (i.e., a time range for data storage in the first and second data blocks) can be set, and the first CAN bus data stored in the first data block and the second CAN bus data stored in the second data block can be deleted after the data storage time range expires.
[0084] Optionally, the time range for data storage in the first data block and the second data block can be the same or different.
[0085] Optionally, when the first CAN bus data and the second CAN bus data are written into the third data block, and the first CAN bus data in the first data block and the second CAN bus data in the second data block are not deleted, the server can either query and read the first CAN bus data and the second CAN bus data in the third data block based on the third correspondence, or query and read the first CAN bus data in the first data block based on the first correspondence, or query and read the second CAN bus data in the second data block based on the second correspondence.
[0086] According to some embodiments, before storing the third correspondence, method 400 further includes: determining that the first acquisition time and the second acquisition time are within a first time range.
[0087] Based on the above data storage method, by setting the first time range, it is possible to avoid merging CAN bus data collected outside the first time range into the third data block of the third file. This can effectively control the number of files in the first partition after data merging, and also help to further improve the efficiency of data query and reading.
[0088] For example, the first acquisition time is 8:30, the second acquisition time is 8:40, and the first time range is from 7:00 to 9:00. The first CAN bus data and the second CAN bus data can be written into the third data block and the third correspondence can be stored.
[0089] According to some embodiments, the first data information and the second data information also include first identification information of the first vehicle model, the first correspondence relationship also includes: the correspondence between the first identification information and the storage location of the first data block, and the second correspondence relationship also includes: the correspondence between the first identification information and the storage location of the second data block.
[0090] Based on the aforementioned data storage method, when setting the first and second correspondences, the first identification information of the first vehicle model was also taken into account. This approach facilitates subsequent data retrieval based on the vehicle identification code, data collection time, vehicle model identification information, and stored correspondences, further improving the accuracy of data retrieval and reading.
[0091] Optionally, the first identification information may include at least one of the following: vehicle brand, model, body color, vehicle production date, vehicle configuration, and version.
[0092] It should be understood that method 400 is an example of the server writing CAN bus data collected by the first vehicle. When multiple vehicles upload CAN bus data to the server, the server can also write CAN bus data into the corresponding data block based on the data information corresponding to the CAN bus data.
[0093] Figure 5 This is a schematic flowchart illustrating another data reading method provided in this application embodiment. The execution entity of method 500 can be a server, which can be... Figure 2 In the server 200, method 500 can be executed after method 400 has been completed. Method 500 may include steps S501 to S502.
[0094] S501, Obtain the first read command for the first vehicle.
[0095] The first reading instruction includes the second vehicle identification code and the third collection time of the data.
[0096] Optionally, the first vehicle can detect the user's first input and generate a first reading instruction based on the first input; further optionally, the first input can be the user's touchscreen input, voice input, or physical button input.
[0097] S502, if the second vehicle identification code matches the first vehicle identification code and the third acquisition time is equal to the first acquisition time, select the first correspondence in the data file list and read the first CAN bus data from the first data block based on the first correspondence; or if the second vehicle identification code matches the first vehicle identification code and the third acquisition time is equal to the second acquisition time, select the second correspondence in the data file list and read the second CAN bus data from the second data block based on the second correspondence.
[0098] The first data block is located in the first file of the first partition of the server. The first correspondence includes the correspondence between the first vehicle identification code and the first collection time and the storage location of the first data block. The second data block is located in the second file of the first partition. The second correspondence includes the correspondence between the first vehicle identification code and the second collection time and the storage location of the second data block. The second collection time is different from the first collection time.
[0099] Based on the above data reading method, when the server reads data, it can select a matching relationship from the data file list based on the vehicle identification number and the data collection time, and then read the corresponding data from the first or second data block based on that relationship. This avoids the server having to query and read data from the entire database, thereby improving the efficiency and accuracy of server data querying and reading.
[0100] Optionally, matching the second vehicle identification code with the first vehicle identification code can be understood as: the second vehicle identification code and the first vehicle identification code are completely identical, or the degree of matching between the second vehicle identification code and the first vehicle identification code is greater than a preset value.
[0101] According to some embodiments, in step S502, before reading the first CAN bus data from the first data block based on the first correspondence, method 500 further includes: selecting a third correspondence in the data file list, and not reading the first CAN bus data from the third data block based on the third correspondence; or in step S502, before reading the second CAN bus data from the second data block based on the second correspondence, method 500 further includes: selecting a third correspondence in the data file list, and not reading the second CAN bus data from the third data block based on the third correspondence.
[0102] The third data block is located in the third file of the first partition, and the third correspondence includes the correspondence between the storage location of the first vehicle identification code and the third data block.
[0103] Based on the above data reading method, the server can prioritize reading data from the third data block, which has a higher data concentration, based on the first read command sent by the vehicle. If no data is found there, the server will then read data from the first or second data block. In this way, by optimizing the data reading mechanism, the probability of data reading failure can be effectively reduced.
[0104] According to some embodiments, in step S502, before reading the first CAN bus data from the first data block based on the first correspondence, or reading the second CAN bus data from the second data block based on the second correspondence, method 500 further includes: obtaining a second time range for data storage of the first data block and the second data block; and determining that the moment of reading the first CAN bus data or the second CAN bus data falls within the second time range.
[0105] Based on the above data reading method, after writing the CAN bus data from the first and second data blocks into the third data block, the storage time of the CAN bus data in the first and second data blocks can be effectively managed by setting a second time range, thereby effectively reducing data storage costs. On the other hand, it avoids querying data in the first or second data block after the CAN bus data stored in the first and second data blocks has been cleared, thus further improving the efficiency and accuracy of data querying and reading.
[0106] For example, if the second time range is 30 days from the current time, then when the time of reading the data is within 30 days from the current time, the first CAN bus data can be read from the first data block based on the first correspondence, or the second CAN bus data can be read from the second data block based on the second correspondence.
[0107] According to some embodiments, the first reading instruction further includes: second identification information indicating the vehicle model; the first correspondence further includes: the correspondence between the first identification information of the first vehicle model and the storage location of the first data block; the second correspondence further includes: the correspondence between the first identification information and the storage location of the second data block; in step S502, before reading the first CAN bus data from the first data block based on the first correspondence, or reading the second CAN bus data from the second data block based on the second correspondence, method 500 further includes: determining that the second identification information and the first identification information match.
[0108] Optionally, the first identification information may include at least one of the following: vehicle brand, model, body color, vehicle production date, vehicle configuration, and version.
[0109] Optionally, matching the first identification information and the second identification information can be understood as: the first identification information and the second identification information are the same, for example, the brand and model of the vehicle are exactly the same.
[0110] Figure 6 This is a schematic flowchart of a data writing process provided in an embodiment of this application. Method 600 can be a detailed description of the CAN bus data writing process in method 400. Method 600 can include steps S601 to S606.
[0111] S601 acquires multiple CAN bus data collected from multiple vehicles.
[0112] Among them, multiple vehicles may include the first vehicle, and correspondingly, multiple CAN bus data may include the first CAN bus data, the second CAN bus data, and CAN bus data collected by other vehicles.
[0113] Optionally, multiple vehicles can upload multiple CAN bus data collected to the server, and the server can obtain multiple CAN bus data accordingly.
[0114] Alternatively, multiple CAN bus data can also be referred to as the raw data of the CAN bus.
[0115] S602 partitions multiple CAN bus data.
[0116] For example, multiple CAN bus data can be distributed to multiple files in multiple partitions of the data lake based on the vehicle identification code and data acquisition time corresponding to multiple CAN bus data.
[0117] S603 controls the first batch writing device to write multiple CAN bus data into the data blocks of files in multiple partitions.
[0118] The first batch writing device can refer to a hardware or software tool that can write data to a target storage medium (e.g., data blocks) in batches, which can be used to improve data writing efficiency and reduce server system overhead.
[0119] Optionally, in the above process, the data writing duration (aging cycle) can be configured. For example, a preset number of CAN bus data can be written to the data lake every minute. One partition in the data lake generates 60 files per hour, and these files are stored for 10 days. That is, the CAN bus data in the data block can last for 10 days, thus enabling the above data writing method to have the characteristics of high writing concurrency, independent file writing, and timely data writing to the data lake.
[0120] S604, obtain the real-time file path of the file system.
[0121] For example, this step can be understood as writing multiple CAN bus data into multiple data blocks and then obtaining the real-time file path that can query the multiple CAN bus data (which can be indicated by the correspondence in the data file list); where the file system can be understood as the underlying storage method of the data lake, and the data lake is a data management architecture built on top of the file system, providing richer data processing and query capabilities.
[0122] Optionally, the above file system may support at least one of the following: object storage service (OBS), simple storage service (S3), Hadoop distributed file system, and local disk.
[0123] S605 controls the second batch writing device to periodically merge real-time file paths.
[0124] For example, the server can periodically read the files generated in step S603 and merge these files into a new file through the second batch writing device, so that the CAN bus data collected by the same vehicle is aggregated into the same data block. For example, in method 400, the CAN bus data stored in the first data block and the second data block is written into the third data block.
[0125] Optionally, the server can sort the CAN bus data according to the vehicle identification code and data acquisition time, and merge the real-time file paths in the order of data acquisition.
[0126] Optionally, the second batch writing device can merge different files in the same partition into a new file. For example, in method 400, the CAN bus data stored in the first data block and the second data block are written into the third data block, and the first file and the second file in the first partition are merged into the third file. The second batch writing device can also merge different files in different partitions into a new file. For example, the data stored in the first data block of the first file in the first partition and the data stored in the fourth data block of the fourth file in the second partition are written into the fifth data block of the fifth file in the first partition.
[0127] S606, obtain the merged file path of the file system.
[0128] For example, this step can be understood as merging the data in multiple data blocks and obtaining the merged file path that can query multiple CAN bus data (the corresponding relationship in the data file list can be used as an indication).
[0129] In this embodiment, during the CAN bus data storage process, the vehicle does not need to parse the raw CAN bus data in real time, and the server does not need to maintain a database. Furthermore, the aforementioned CAN bus data writing process optimizes the CAN bus data storage method, thereby improving the efficiency and accuracy of server data retrieval and reading. On the other hand, periodically merging real-time file paths allows for more centralized CAN bus data storage, reducing the number of files in different partitions of the data lake, thus improving data retrieval efficiency.
[0130] Figure 7 This is a schematic flowchart of a data reading method provided in an embodiment of this application. Method 700 can be a detailed description of the CAN bus data query and reading process in method 500. Method 700 can be executed after method 600. Method 700 can include steps S701 to S708.
[0131] S701, the query engine performs data queries.
[0132] For example, after receiving a read command, the query engine in the server can perform a data query based on the vehicle identification number, the collection time of the CAN bus data, and metadata information.
[0133] S702, query the merged file path of the file system.
[0134] For example, the query engine can perform a query in the merged file path (the storage location of the data blocks to be written after the file is merged) based on the vehicle identification number, the collection time of the CAN bus data, and metadata information.
[0135] S703, determine whether data has been retrieved.
[0136] For example, if data is retrieved, step S706 can be performed; otherwise, step S704 can be performed.
[0137] S704 queries the real-time file path of the file system.
[0138] For example, if no data is found by merging file paths, a second query can be performed based on the real-time file paths before merging, thereby effectively reducing the probability of data reading failure.
[0139] S705, determine whether data has been retrieved.
[0140] For example, if the retrieved data is available, step S706 can be performed; otherwise, step S708 can be performed.
[0141] S706, the parser obtains the parsing rules.
[0142] For example, the parser in the server can obtain parsing rules from the database container (DBC) management module and parse the CAN bus data according to the signal granularity. The DBC management module is responsible for parsing and managing the message format of the CAN bus data, making the use of CAN data more standardized and efficient.
[0143] S707, the parser parses the data.
[0144] For example, the parser can parse the queried data based on parsing rules, thereby reading the data.
[0145] S708 returns the data read result.
[0146] For example, the server can return the data reading result to the vehicle to inform the vehicle whether the data reading was successful and the specific content of the data read.
[0147] In this embodiment, during the data reading process, data is preferentially queried from the merged file path where data concentration is higher. If no data is found, data is then queried from the real-time file path before file merging. This method supports overlapping backup data, ensuring that real-time data query is not affected even if the second batch writing device fails, thus improving query efficiency and accuracy, and consequently increasing the response speed of read commands. Furthermore, the aforementioned data reading method supports parsing the queried CAN bus data according to signal granularity (e.g., signal length, start bit, and data format), ensuring accurate reading of the required data from complex CAN bus data.
[0148] Figure 8 This is an illustrative flowchart of another data writing method provided in this application embodiment. The flowchart can be a detailed description of the data writing process in method 600, which can be executed by a partitioning device, a first batch writing device, and a second batch writing device in the server.
[0149] like Figure 8 As shown, the partitioning device can calculate the storage path of CAN bus data based on the vehicle's VIN and the data acquisition time. The vehicle can include vehicle A and vehicle B, and vehicle A or vehicle B can be the first vehicle in the aforementioned embodiment. The CAN bus data can include: data 1 to data n of vehicle A and data 1 to data n of vehicle B, where n is a positive integer, and each data can correspond to one CAN bus data. The data acquisition time includes: the acquisition time point n of data n of vehicle A and the acquisition time point n of data n of vehicle B.
[0150] For example, the partitioning device can partition data 1 to data n based on information such as VIN, data acquisition time, and vehicle model. For instance, the VIN can be hashed and partitioned using the data acquisition time, with the partitioning format being: hash(VIN) + year / month / day / hour; or, for another example, the VIN can be hashed and partitioned using the vehicle model ID and data acquisition time, with the partitioning format being: vehicle model ID + hash(VIN) + year / month / day / hour.
[0151] After partitioning data 1 to data n, the first batch writing device can write the corresponding data into the data blocks of the corresponding partition's file. The first batch writing device supports configuring the data write interval in seconds; for example, it can write every 10 seconds, every 30 seconds, every 60 seconds, etc., and the data write interval can be flexibly adjusted according to the real-time requirements of the data. During the data writing process, data collected from different vehicles can be assigned to different threads for processing, so that data of the same type can be written to the same file in the same partition. For example, if thread A obtains 10,000 data points collected by vehicle A, during data writing, these data can be stored in file 1 of partition A, file 1 of partition B, and file 1 of partition C. Similarly, if thread B obtains 10,000 data points collected by vehicle B, during data writing, these data can be stored in file 2 of partition A, file 2 of partition B, and file 3 of partition C. The number of threads can be flexibly configured; for example, 10 threads or 20 threads can be configured. The more threads configured, the more files the first batch writing device will generate each time, and the less data will be written to each file. Optionally, the data written by the first batch of writing devices can be configured with a storage period. For example, if the storage period is configured to 30 days, it means that the data in the written data blocks will be cleaned up after 30 days.
[0152] For example, please continue to refer to Figure 8 After the first batch of data writing process by the write device, data 1 and data 2 of car A are written to data block 1 of file 1 in partition 1, and data 1 and data 2 of car B are written to data block 2 of file 1 in partition 1. Data 3 and data 4 of car A are written to data block 3 of file 2 in partition 1, and data 3 and data 4 of car B are written to data block 4 of file 2 in partition 1.
[0153] After the first batch writing device completes the data writing, the second batch writing device can periodically read the files and merge the data scattered across multiple files into a new file. For example, the second batch writing device reads file 100 from file 1 to file 100 in partition 1, generating file 1 to file 3 in partition 1. The size of the merged file is configurable; for example, the size can be set to less than or equal to 1GB. Optionally, the data written by the second batch writing device can be configured for a storage period; for example, a storage period of one year indicates that the written data blocks will be cleaned up after one year.
[0154] For example, please continue to refer to Figure 8 After a second batch of data writing processes, the data stored in data block 1 of file 1 and data block 3 of file 2 can be written into data block 1 of file 3, and the data stored in data block 2 of file 1 and data block 4 of file 2 can be written into data block 2 of file 3.
[0155] In this embodiment, the storage method of CAN bus data can be optimized by writing the CAN bus data into the data blocks of the corresponding file. During subsequent data retrieval, it is not necessary to traverse the entire file; traversing only a portion of the data blocks is sufficient to retrieve the data. Furthermore, using a second batch writing device can reduce the number of files, which helps reduce the use of computing resources during reading, thereby improving data query and retrieval efficiency.
[0156] It should be noted that the above data storage methods support data writing to OBS, S3, HDFS, and local disks. The first and second batch writing devices can integrate software development kits (SDKs) for different file systems to support writing data to different file systems through configuration. For different types of data, appropriate storage media can be selected based on the characteristics of each data type. For example, data requiring real-time writing and fast reading can be stored on a local high-speed hard drive; while large batches of data with low access frequency can be transferred to OBS. In this way, storage costs and performance can be optimized based on data access needs and storage scale.
[0157] Figure 9 This is an illustrative flowchart of another data reading method provided in this application embodiment. The flowchart can be a detailed description of the data reading process in method 700, which can be executed by the query engine, parser, and DBC management module in the server.
[0158] The query engine can determine the partition to be queried based on the VIN, data acquisition time, and signal name in the read command. Specifically, the query engine can first search the partition files written by the second batch writing device, find a matching correspondence in the data file list, and distribute the matching correspondence to multiple parsers for parsing. If the parser obtains the data, it returns the data read result to the vehicle; otherwise, the query engine can search the partition files written by the first batch writing device, find a matching correspondence in the data file list, and distribute the matching correspondence to multiple parsers for parsing.
[0159] For example, such as Figure 8 As shown, the query engine determines that the partition to be queried is partition 1, obtains the data file list from file 1 to file n in partition 1, and finds the file path of the matching corresponding data block 1 (the data block to be queried). Parser 1 can filter out the address information of data block 1 based on the correspondence provided by the query engine, and thus parse data block 1. After parsing the CAN bus data in data block 1, parser 1 can decompress the CAN bus data to obtain the data version information, and obtain the corresponding parsing rules according to the version information to parse the data. Then, the parsed data is returned to the query engine, which can send the parsed data to the vehicle. Similarly, other parsers among multiple parsers can also perform the above process. The parsing rules can be provided by the DBC management module, and the parsing rules can be defined according to signal granularity, so that the parsing process can be accurate to a single signal level to adapt to the query and processing needs of different types of data.
[0160] In this embodiment, during the data reading process, the query engine, parser, and DBC management module in the server work together to improve the efficiency and accuracy of data querying and reading, thereby increasing the response speed to read commands. Furthermore, the aforementioned data reading process supports parsing the queried CAN bus data at the signal granularity, ensuring that the required data can be accurately read from complex CAN bus data.
[0161] Figure 10 This is an illustrative flowchart of another data writing and data reading method provided in the embodiments of this application. Method 1000 can be a detailed description of the data writing and data reading process of methods 400 and 500. Method 1000 can include steps S1001 to S1007.
[0162] S1001: Obtain CAN bus data reported by the vehicle.
[0163] Optionally, the CAN bus data may include CAN bus data collected by different vehicles at different times.
[0164] S1002, calculate the partitioned storage path of CAN bus data.
[0165] For example, the partitioned storage path of the CAN bus data can be determined based on the VIN of the CAN bus data and the data acquisition time, that is, the partition, file and data block to which the CAN bus data is written can be determined.
[0166] S1003, the first batch of data is written by the writing device.
[0167] For example, such as Figure 10 As shown, the first batch writing device can write data 1 and data 2 of car A into data block 1 of file 1 in partition 1, write data 1 and data 2 of car B into data block 2 of file 1 in partition 1, write data 3 and data 4 of car A into data block 3 of file 2 in partition 1, and write data 3 and data 4 of car B into data block 4 of file 2 in partition 1.
[0168] S1004, the second batch writing device writes data.
[0169] For example, such as Figure 10 As shown, the second batch writing device can write the data of car A1, car A2, car A3 and car A4 into data block 1 of file 3 in partition 1, and write the data of car B1, car B2, car B3 and car B4 into data block 2 of file 3 in partition 1.
[0170] S1005, the portal website or operation and maintenance system obtains the read command.
[0171] Optionally, the read command may include the VIN and the data acquisition time.
[0172] S1006, query engine calculates partitions and retrieves file list.
[0173] For example, the query engine can obtain a list of files and find matching correspondences based on the VIN and the data acquisition time, thereby determining the storage path of the data block to be queried.
[0174] S1007, the parser reads data according to the parsing rules.
[0175] Alternatively, the parser can obtain parsing rules from the DBC management module.
[0176] Optionally, after the parser obtains the data, it can send the data to the query engine, which then returns the data to the vehicle.
[0177] In this embodiment, during CAN bus data storage, the vehicle does not need to parse the data in real time, and the server does not need to maintain a database. This optimizes the CAN bus data storage method and improves the efficiency and accuracy of server data querying and retrieval. During data retrieval, the query engine, parser, and DBC management module in the server work together to improve the efficiency and accuracy of data querying and retrieval, thereby increasing the response speed of read commands.
[0178] It should be understood that, in the various embodiments of this application, unless otherwise specified or in case of logical conflict, the terms and / or descriptions between the various embodiments are consistent and can be referenced by each other, and the technical features in different embodiments can be combined to form new embodiments according to their inherent logical relationships.
[0179] Figure 11 This is a schematic diagram of a data storage or data reading device provided in an embodiment of this application. The device 1100 may include an acquisition unit 1110, a storage unit 1120, and a processing unit 1130. The acquisition unit 1110 is used to acquire instructions and / or data, the storage unit 1120 is used to implement corresponding storage functions and store corresponding instructions and / or data, and the processing unit 1130 is used to perform data processing so that the device 1100 implements the aforementioned data storage method or data reading method.
[0180] According to some embodiments, when the device 1100 has a data storage function, the device 1100 includes: an acquisition unit 1110 and a processing unit 1130; the acquisition unit 1110 is used to acquire first CAN bus data of a first vehicle and first data information corresponding to the first CAN bus data, and second data information corresponding to the second CAN bus data, the first data information including: a first vehicle identification code and a first acquisition time of the first CAN bus data, the second data information including: a first vehicle identification code and a second acquisition time of the second CAN bus data, the first acquisition time being different from the second acquisition time; the processing unit 1130 is used to: write the first CAN bus data into a first data block and store a first correspondence, the first data block being located in a first file of a first partition of a server, the first correspondence including: the correspondence between the first vehicle identification code and the first acquisition time and the storage location of the first data block; write the second CAN bus data into a second data block and store a second correspondence, the second data block being located in a second file of a first partition, the second correspondence including: the correspondence between the first vehicle identification code and the second acquisition time and the storage location of the second data block.
[0181] In one possible implementation, the processing unit 1130 is further configured to write the first CAN bus data stored in the first data block and the second CAN bus data stored in the second data block into the third data block, and store the third correspondence; wherein the third data block is located in the third file of the first partition, and the third correspondence includes: the correspondence between the storage location of the first vehicle identification code and the third data block.
[0182] In one possible implementation, the processing unit 1130 is further configured to determine that the first acquisition time and the second acquisition time are within a first time range.
[0183] In one possible implementation, the first data information and the second data information further include the first identification information of the first vehicle model, the first correspondence relationship further includes the correspondence between the first identification information and the storage location of the first data block, and the second correspondence relationship further includes the correspondence between the first identification information and the storage location of the second data block.
[0184] According to some embodiments, when the device 1100 has a data reading function, the device 1100 includes: an acquisition unit 1110 and a processing unit 1130; the acquisition unit 1110 is used to acquire a first reading instruction of a first vehicle, the first reading instruction including: a second vehicle identification code and a third acquisition time of the data; the processing unit 1130 is used to: when the second vehicle identification code matches the first vehicle identification code and the third acquisition time is equal to the first acquisition time, select a first correspondence in the data file list, and read first CAN bus data from the first data block based on the first correspondence, or when the second vehicle identification code matches the first vehicle identification code, the processing unit 1130 is used to: select a first correspondence in the data file list ... CAN bus identification code, the processing unit 1130 is used to: select a first correspondence in the data file list and read first CAN bus data from the first data block based on the first CAN bus identification code, the processing unit 1130 is used to: select a first correspondence in the data file list and read first CAN bus data from the first data block based on the first CAN bus identification code, the processing unit 1130 is used to: select a first correspondence in the data file list and read first CAN bus data from the first data block based on the first CAN bus identification code, the processing If the vehicle identification code matches and the third acquisition time is equal to the second acquisition time, the second correspondence is selected in the data file list, and the second CAN bus data is read from the second data block based on the second correspondence. The first data block is located in the first file of the first partition of the server, and the first correspondence includes the correspondence between the first vehicle identification code and the first acquisition time and the storage location of the first data block. The second data block is located in the second file of the first partition, and the second correspondence includes the correspondence between the first vehicle identification code and the second acquisition time and the storage location of the second data block. The second acquisition time is different from the first acquisition time.
[0185] In one possible implementation, the processing unit 1130 is further configured to select a third correspondence in the data file list and read the first CAN bus data from the third data block based on the third correspondence, or select a third correspondence in the data file list and read the second CAN bus data from the third data block based on the third correspondence; wherein the third data block is located in the third file of the first partition, and the third correspondence includes: the correspondence between the storage location of the first vehicle identification code and the third data block.
[0186] In one possible implementation, the acquisition unit 1110 is further configured to acquire a second time range for the preset data storage of the first data block and the second data block; the processing unit 1130 is further configured to determine that the moment of reading the first CAN bus data or the second CAN bus data falls within the second time range.
[0187] In one possible implementation, the first read instruction further includes: second identification information indicating the vehicle model; the first correspondence further includes: the correspondence between the first identification information of the first vehicle and the storage location of the first data block; the second correspondence further includes: the correspondence between the first identification information and the storage location of the second data block; the processing unit 1130 is also used to determine that the second identification information and the first identification information match.
[0188] According to some embodiments, the device 1100 may have both data storage function and data reading function.
[0189] Figure 12 This is a schematic diagram of another data storage or data reading device provided in an embodiment of this application.
[0190] The device 1200 includes a memory 1210, a processor 1220, and a communication interface 1230. The memory 1210, processor 1220, and communication interface 1230 are connected via an internal connection path. The memory 1210 stores instructions, and the processor 1220 executes the instructions stored in the memory 1210 to control the communication interface 1230 to acquire information, enabling the device 1200 to implement the aforementioned data storage method or data retrieval method. Optionally, the memory 1210 can be coupled to the processor 1220 via an interface, or it can be integrated with the processor 1220.
[0191] It should be noted that the communication interface 1230 described above uses a transceiver device, such as, but not limited to, a transceiver. The communication interface 1230 may also include an input / output interface.
[0192] The processor 1220 stores one or more computer programs, which include instructions. When the instructions are executed by the processor 1220, the device 1200 performs the data storage method or data retrieval method in the above embodiments.
[0193] In implementation, each step of the above method can be completed by the integrated logic circuitry of the hardware in the processor 1220 or by instructions in software form. The method disclosed in the embodiments of this application can be directly implemented by a hardware processor, or by a combination of hardware and software modules in the processor. The software modules can reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. This storage medium is located in memory 1210, and the processor 1220 reads the information in memory 1210 and, in conjunction with its hardware, completes the steps of the above method. To avoid repetition, detailed descriptions are not provided here.
[0194] Optionally, Figure 12 The memory 1210 in the middle can achieve Figure 11 Storage unit 1120 in the middle, Figure 12 The processor 1220 in the middle can achieve Figure 11 Processing unit 1130 in the middle, Figure 12 The communication interface 1230 in the middle can achieve Figure 11 The acquisition unit 1110 in the middle.
[0195] This application also provides a computer-readable storage medium storing program code that, when executed on a computer, causes the computer to perform the above-described... Figures 4 to 10 The method shown in any one of them.
[0196] This application also provides a computer program product, which includes a computer program that, when run, causes the computer to perform the above-described actions. Figures 4 to 10 The method shown in any one of them.
[0197] This application embodiment also provides a chip, including: a circuit, the circuit being used to perform the above... Figures 4 to 10 The method shown in any one of them.
[0198] This application embodiment also provides a server, the server comprising: as shown in the example Figure 11 or Figure 12 The apparatus shown.
[0199] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0200] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0201] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0202] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0203] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0204] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0205] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A data storage method, characterized in that, The method includes: Acquire first CAN bus data of the first vehicle and first data information corresponding to the first CAN bus data, and second CAN bus data and second data information corresponding to the second CAN bus data. The first data information includes: the first vehicle identification code and the first acquisition time of the first CAN bus data. The second data information includes: the first vehicle identification code and the second CAN bus data and the second acquisition time of the second CAN bus data. The first acquisition time is different from the second acquisition time. The first CAN bus data is written into the first data block and a first correspondence is stored. The first data block is located in the first file of the first partition of the server. The first correspondence includes the correspondence between the first vehicle identification code and the first acquisition time and the storage location of the first data block. The second CAN bus data is written into the second data block and a second correspondence is stored. The second data block is located in the second file of the first partition. The second correspondence includes the correspondence between the first vehicle identification code and the second acquisition time and the storage location of the second data block.
2. The method as described in claim 1, characterized in that, The method further includes: Write the first CAN bus data stored in the first data block and the second CAN bus data stored in the second data block into the third data block, and store the third correspondence relationship; The third data block is located in the third file of the first partition, and the third correspondence includes the correspondence between the storage location of the first vehicle identification code and the third data block.
3. The method as described in claim 2, characterized in that, Before storing the third correspondence, the method further includes: The first acquisition time and the second acquisition time are determined to be within a first time range.
4. The method according to any one of claims 1 to 3, characterized in that, The first data information and the second data information also include the first identification information of the first vehicle model. The first correspondence also includes the correspondence between the first identification information and the storage location of the first data block. The second correspondence also includes the correspondence between the first identification information and the storage location of the second data block.
5. A data reading method, characterized in that, The method includes: Obtain the first reading instruction for the first vehicle, the first reading instruction including: the second vehicle identification code and the third acquisition time of the data; If the second vehicle identification code matches the first vehicle identification code, and the third acquisition time equals the first acquisition time, a first correspondence is selected from the data file list, and the first CAN bus data is read from the first data block based on the first correspondence, or... When the second vehicle identification code matches the first vehicle identification code and the third acquisition time is equal to the second acquisition time, the second correspondence is selected in the data file list, and the second CAN bus data is read from the second data block based on the second correspondence. The first data block is located in the first file of the first partition of the server, and the first correspondence includes the correspondence between the first vehicle identification code and the first collection time and the storage location of the first data block. The second data block is located in the second file of the first partition, and the second correspondence includes the correspondence between the first vehicle identification code and the second collection time and the storage location of the second data block. The second collection time is different from the first collection time.
6. The method as described in claim 5, characterized in that, Before reading the first CAN bus data from the first data block based on the first correspondence, the method further includes: selecting a third correspondence from the data file list, and if the first CAN bus data is not read from the third data block based on the third correspondence, or... Before reading the second CAN bus data from the second data block based on the second correspondence, the method further includes: selecting the third correspondence from the data file list, and not reading the second CAN bus data from the third data block based on the third correspondence; The third data block is located in the third file of the first partition, and the third correspondence includes the correspondence between the storage location of the first vehicle identification code and the third data block.
7. The method as described in claim 6, characterized in that, Before reading first CAN bus data from a first data block based on the first correspondence, or reading second CAN bus data from a second data block based on the second correspondence, the method further includes: Obtain the second time range for the preset data storage of the first data block and the second data block; The moment when reading the first CAN bus data or the second CAN bus data is determined to be within the second time range.
8. The method according to any one of claims 5 to 7, characterized in that, The first read instruction further includes: second identification information indicating the vehicle model; the first correspondence further includes: the correspondence between the first identification information of the first vehicle model and the storage location of the first data block; the second correspondence further includes: the correspondence between the first identification information and the storage location of the second data block. Before reading first CAN bus data from a first data block based on the first correspondence, or reading second CAN bus data from a second data block based on the second correspondence, the method further includes: The second identification information and the first identification information are determined to match.
9. A data storage device, characterized in that, The device includes: an acquisition unit and a processing unit; The acquisition unit is used to acquire the first CAN bus data of the first vehicle and the first data information corresponding to the first CAN bus data, as well as the second CAN bus data and the second data information corresponding to the second CAN bus data. The first data information includes: the first vehicle identification code and the first acquisition time of the first CAN bus data. The second data information includes: the first vehicle identification code and the second CAN bus data and the second acquisition time of the second CAN bus data. The first acquisition time is different from the second acquisition time. The processing unit is used for: The first CAN bus data is written into the first data block and a first correspondence is stored. The first data block is located in the first file of the first partition of the server. The first correspondence includes the correspondence between the first vehicle identification code and the first acquisition time and the storage location of the first data block. The second CAN bus data is written into the second data block and a second correspondence is stored. The second data block is located in the second file of the first partition. The second correspondence includes the correspondence between the first vehicle identification code and the second acquisition time and the storage location of the second data block.
10. The apparatus as claimed in claim 9, characterized in that, The processing unit is further configured to write the first CAN bus data stored in the first data block and the second CAN bus data stored in the second data block into a third data block, and store a third correspondence relationship; The third data block is located in the third file of the first partition, and the third correspondence includes the correspondence between the storage location of the first vehicle identification code and the third data block.
11. The apparatus as claimed in claim 10, characterized in that, The processing unit is further configured to determine that the first acquisition time and the second acquisition time are within a first time range.
12. The apparatus as claimed in any one of claims 9 to 11, characterized in that, The first data information and the second data information also include the first identification information of the first vehicle model. The first correspondence also includes the correspondence between the first identification information and the storage location of the first data block. The second correspondence also includes the correspondence between the first identification information and the storage location of the second data block.
13. A data reading device, characterized in that, The device includes: an acquisition unit and a processing unit; The acquisition unit is used to acquire a first reading instruction of the first vehicle, the first reading instruction including: the second vehicle identification code and the third acquisition time of the data; The processing unit is used for: If the second vehicle identification code matches the first vehicle identification code, and the third acquisition time equals the first acquisition time, a first correspondence is selected from the data file list, and the first CAN bus data is read from the first data block based on the first correspondence, or... When the second vehicle identification code matches the first vehicle identification code and the third acquisition time is equal to the second acquisition time, the second correspondence is selected in the data file list, and the second CAN bus data is read from the second data block based on the second correspondence. The first data block is located in the first file of the first partition of the server, and the first correspondence includes the correspondence between the first vehicle identification code and the first collection time and the storage location of the first data block. The second data block is located in the second file of the first partition, and the second correspondence includes the correspondence between the first vehicle identification code and the second collection time and the storage location of the second data block. The second collection time is different from the first collection time.
14. The apparatus as claimed in claim 13, characterized in that, The processing unit is further configured to select a third correspondence in the data file list and, based on the third correspondence, not read the first CAN bus data from the third data block, or select the third correspondence in the data file list and, based on the third correspondence, not read the second CAN bus data from the third data block; The third data block is located in the third file of the first partition, and the third correspondence includes the correspondence between the storage location of the first vehicle identification code and the third data block.
15. The apparatus as claimed in claim 14, characterized in that, The acquisition unit is further configured to acquire a second time range for the preset data storage of the first data block and the second data block; The processing unit is further configured to determine that the moment when reading the first CAN bus data or the second CAN bus data falls within the second time range.
16. The apparatus as claimed in any one of claims 13 to 15, characterized in that, The first read instruction further includes: second identification information indicating the vehicle model; the first correspondence further includes: the correspondence between the first identification information of the first vehicle model and the storage location of the first data block; the second correspondence further includes: the correspondence between the first identification information and the storage location of the second data block. The processing unit is further configured to determine whether the second identification information matches the first identification information.
17. A data storage device, characterized in that, The device includes a processor and a memory, the processor being coupled to the memory, the memory being used to store computer programs or instructions, and the processor being used to execute the computer programs or instructions in the memory, such that the method of any one of claims 1 to 4 is performed.
18. A data reading device, characterized in that, The device includes a processor and a memory, the processor being coupled to the memory, the memory being used to store computer programs or instructions, and the processor being used to execute the computer programs or instructions in the memory, such that the method of any one of claims 5 to 8 is performed.
19. A chip, characterized in that, The chip includes circuitry for performing the method as described in any one of claims 1 to 8.
20. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores program code that, when executed on a computer, causes the computer to perform the method as described in any one of claims 1 to 8.
21. A computer program product, characterized in that, The computer product includes a computer program that, when run, causes the computer to perform the method as described in any one of claims 1 to 8.
22. A server, characterized in that, It includes the data storage device as described in any one of claims 9 to 12 and the data reading device as described in any one of claims 13 to 16, or it includes the data storage device as described in claim 17 and the data reading device as described in claim 18.