Historical data simulation method, system and equipment based on time ring and medium

By using the time ring -based cache method in historical data simulation, the circular cache historical data is used to at most time slots, and the data reads is used to read the data, which solves the problem of low data cache efficiency in the traditional method. Data simulation.

CN119377131AActive Publication Date: 2025-01-28GUANGZHOU SIE CONSULTING CO LTD +1
View PDF 12 Cites 0 Cited by

Patent Information

Application Number
CN202411428529.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-14
Publication Date
2025-01-28
Estimated Expiration
2044-10-14

AI Technical Summary

Technical Problem

In traditional historical data simulation methods, data cache uses ordered linked lists, resulting in an increase in the length of linked lists within a large time range, high memory occupancy and low search efficiency, which affects the simulation efficiency.

Method used

The historical data simulation method based on the time ring is used to cache historical data cycles into multiple time tanks in the time ring, and use the circle number attribute to determine the storage location of each historical data to achieve efficient data reading and simulation.

Benefits of technology

Improve the efficiency and accuracy of the data cache, reduce memory occupation, and improve simulation efficiency and data integrity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119377131A_ABST
    Figure CN119377131A_ABST
Patent Text Reader

Abstract

The invention provides a historical data simulation method, system and device based on a time ring and a medium, and the method comprises the steps: obtaining historical data, and circularly caching the historical data in each time slot in the time ring in sequence; wherein the time slots are connected end to end in the time ring to form a closed loop; calculating a corresponding loop number when each piece of historical data is cyclically cached to the time ring, and determining a loop number attribute corresponding to each piece of historical data according to the loop number; under the condition that a simulation request is obtained, a target time slot is determined according to the simulation request, all the time slots are sequentially and circularly traversed according to the specified direction from the target time slot, and the corresponding historical data in all the time slots are read according to the circle number attributes for simulation. Compared with a traditional ordered linked list, the time ring-based caching and reading mode is more efficient and accurate, so that the simulation efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data simulation technology, and in particular to a method, system, device and medium for simulating historical data based on a time loop. Background Art

[0002] Traditional historical data simulation generally collects historical data by setting the sampling frequency, caches all historical data in a specified location, and fetches the specified historical data for simulation when executing the simulation task. However, currently, data caches usually use ordered linked lists or ordered bidirectional linked lists to represent the passage of time. Assuming that the larger the time range of the collected historical data, the longer the linked list length, the higher the memory usage will be; and the time required to search and retrieve the specified historical data in the ordered linked list will also increase as the length of the linked list increases, thus affecting the simulation efficiency. Summary of the invention

[0003] The embodiment of the present invention provides a method, system, device and medium for simulating historical data based on a time ring to solve the problems existing in the related art. The technical solution is as follows:

[0004] In a first aspect, an embodiment of the present invention provides a historical data simulation method based on a time ring, comprising:

[0005] Obtain historical data, and sequentially cache each historical data in a circular manner into each time slot in the time loop; wherein each time slot is connected end to end in the time loop to form a closed loop;

[0006] Calculate the number of cycles corresponding to each historical data when it is cached in the time loop, and determine the circle number attribute corresponding to each historical data according to the number of cycles;

[0007] When a simulation request is obtained, the target time slot is determined according to the simulation request. Starting from the target time slot, each time slot is traversed in turn in a specified direction, and the corresponding historical data in each time slot is read according to the circle number attribute for simulation.

[0008] In one embodiment, it further includes:

[0009] Create a time ring, and divide the cache space of the time ring according to the preset specified number of slots to obtain multiple time slots;

[0010] Initialize the data in the cache space of each time slot, and initialize the circle number attribute corresponding to each historical data to zero.

[0011] In one implementation, obtaining historical data includes:

[0012] Obtaining collection conditions, including collection frequency and collection time range;

[0013] Obtain the corresponding historical data from the specified data source according to the collection conditions.

[0014] In one embodiment, sequentially cyclically caching each historical data into each time slot in the time ring includes:

[0015] Obtaining a preset simulation accuracy, and continuously grouping each historical data according to the simulation accuracy to obtain multiple time groups;

[0016] Traverse each time group and cache each time group into each time slot in turn.

[0017] In one embodiment, sequentially caching each time group cyclically into each time slot includes:

[0018] Traverse each time group, obtain the data time corresponding to the historical data in the time group, calculate the difference between the data time and the initial time, and obtain the time difference; the initial time is the time when the first historical data is cached to the time ring;

[0019] Calculate the time slot number of the current time slot based on the time difference, simulation accuracy, and the specified number of slots in the time loop;

[0020] The position of the current time slot in the time ring is determined according to the time slot number, and the time group corresponding to the data time is cached in the current time slot.

[0021] In one implementation, calculating the number of cycles corresponding to each historical data being cached in a time loop includes:

[0022] Divide the time difference by the simulation accuracy to obtain the span ratio;

[0023] The span ratio is divided by the specified number of slots in the time loop and rounded down to the number of cycles.

[0024] In one embodiment, reading the corresponding historical data in each time slot according to the circle number attribute to perform simulation includes:

[0025] Starting from the target time slot, read the historical data with the circle number attribute of zero in the target time slot and put it into the specified queue, and reduce the circle number attribute of other historical data in the target time slot by 1;

[0026] The other time slots in the time loop are read in a loop in the specified direction, and all historical data entered into the specified queue are assigned to the specified simulation interface in turn to complete the simulation presentation of historical data.

[0027] In a second aspect, an embodiment of the present invention provides a historical data simulation system based on a time loop, which executes the historical data simulation method based on a time loop as described above.

[0028] In a third aspect, an embodiment of the present invention provides an electronic device, the device comprising: a memory and a processor. The memory and the processor communicate with each other through an internal connection path, the memory is used to store instructions, the processor is used to execute the instructions stored in the memory, and when the processor executes the instructions stored in the memory, the processor executes the method in any one of the above-mentioned embodiments.

[0029] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, which stores a computer program. When the computer program runs on a computer, the method in any one of the above-mentioned embodiments is executed.

[0030] The advantages or beneficial effects of the above technical solution include at least:

[0031] The present invention stores historical data through a time ring with multiple time slots. Since the cache space in the time ring is divided into multiple time slots, and the time slots are connected end to end, each historical data can be cyclically cached in each time slot, and the circle number attribute is used to represent the number of cycles when each historical data is stored in the time ring. The circle number attribute is used to take out the relevant historical data in the time slot for simulation. Compared with the traditional ordered linked list, the caching and reading method based on the time ring of the present invention is more efficient and accurate, thereby improving the simulation efficiency.

[0032] The above summary is for illustrative purposes only and is not intended to be limiting in any way. In addition to the illustrative aspects, embodiments and features described above, further aspects, embodiments and features of the present invention will be readily apparent by reference to the accompanying drawings and the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] In the accompanying drawings, unless otherwise specified, the same reference numerals throughout the multiple drawings represent the same or similar parts or elements. These drawings are not necessarily drawn to scale. It should be understood that these drawings only depict some embodiments disclosed in the present invention and should not be regarded as limiting the scope of the present invention.

[0034] Figure 1 It is a flow chart of the historical data simulation method based on the time loop of the present invention;

[0035] Figure 2 A schematic diagram of the process of obtaining historical data according to the present invention;

[0036] Figure 3 It is a schematic diagram of the process flow of historical data simulation of the present invention;

[0037] Figure 4 is a schematic diagram of a time ring and its time slot of the present invention;

[0038] Figure 5 The structure block diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0039] In the following, only some exemplary embodiments are briefly described. As those skilled in the art will appreciate, the described embodiments may be modified in various ways without departing from the spirit or scope of the present invention. Therefore, the drawings and descriptions are considered to be exemplary and non-restrictive in nature.

[0040] Traditional historical data simulation generally collects historical data by setting a sampling frequency. However, since the sampling frequency is fixed, some simulation data may be missing due to the long sampling interval, making it impossible for the simulation to fully reproduce the historical scene. When a device failure occurs, historical data simulation cannot restore the complete scene at the time of the failure.

[0041] The embodiment of the present invention proposes a historical data simulation method based on a time loop, which can improve the integrity of simulation data and further improve the efficiency and accuracy of data cache, thereby improving simulation efficiency.

[0042] like Figure 1 As shown, the historical data simulation method based on the time loop specifically includes the following steps:

[0043] Step S1: Acquire historical data, and sequentially cache each historical data in a circular manner into each time slot in the time loop; wherein each time slot is connected end to end in the time loop to form a closed loop.

[0044] Before obtaining historical data, data configuration is required, and the configuration content includes data source configuration, data subscription, data subscription time range setting, data time accuracy setting, and data presentation method setting.

[0045] Specifically, users select data sources according to actual needs. The data sources can come from MySql, Oracle, SqlServer, Postgresql, Influxdb, TDengine, Hive, ClickHouse, Doris and other databases. During the data source configuration process, users enter information such as the host address, port, database name, data table, user name and password, and obtain the corresponding data source from the specified database based on the information as historical data for simulation.

[0046] At the same time, it supports the selection of different API data sources. Users can enter the API uniform resource locator url and corresponding request parameters to obtain the corresponding data source; it also supports the selection of Excel files as data sources. Users can upload Excel files and use the data in the Excel files as historical data for simulation.

[0047] Furthermore, the user inputs the equipment and measuring points for collecting simulation data, and enters the collection time range for collecting data as the conditions for data collection, which is equivalent to subscribing to data and setting the data subscription time range, so that the system can receive the updated content of the specified data source regularly or in real time according to the rules set by the user, thereby obtaining the required data source.

[0048] It should be noted that the purpose of the data time accuracy setting is to set the frequency of historical data collection and determine the time interval between each historical data collected. In addition, the user needs to enter the simulation accuracy, which refers to the degree of closeness between the output results of the simulation system and the actual situation when simulating real-world objects or processes. The unit of simulation accuracy is milliseconds, and the setting range of simulation accuracy is 100 to 10000. The lower the simulation accuracy value, the closer the simulation effect is to the historical data.

[0049] After completing the above configuration, you can start a series of operations such as data collection, data simulation, and data presentation.

[0050] Specifically, Figure 2 As shown, the corresponding collector is automatically selected according to the data source selected above, and the collection conditions are determined according to the above configuration, and the collection conditions include information such as data source, collection frequency, and collection time range; all pre-configured collection conditions are passed to the collector together, and the collector is executed to collect multiple historical data arranged in chronological order from the specified data source.

[0051] It should be noted that before starting data collection, a time loop needs to be created in advance to cache historical data; and the time loop can be regarded as a complete cache space; there are a fixed number of time slots evenly divided in the time loop, and the division of time slots can be regarded as dividing the complete cache space into multiple independent small cache spaces, and each time slot can store a certain amount of memory data.

[0052] When creating a time ring, the overall cache space of the time ring is divided according to a preset number of designated slots to obtain multiple time slots. In this embodiment, the time slots are evenly divided, the cache space of each time slot is the same, the time slots are sorted according to a circular distribution rule, and the front and rear time slots are connected end to end to form a closed-loop structure. The corresponding time slot number can also be pre-marked for each time slot according to its sorting position in the time ring to facilitate the subsequent positioning of the designated time slot according to the time slot number.

[0053] After creating the time ring, initialize the data in the cache space of each time slot, such as Figure 3As shown, it is ensured that no other irrelevant data is left in the time loop, and the circle number attribute corresponding to each historical data is initialized to zero, so that the number of cycles of the historical data stored in the time slot can be determined later by the circle number attribute.

[0054] In this embodiment, the data cache of the time ring is cyclic, that is, one or more historical data are stored from a specified time slot of the time ring, and one or more historical data are stored in the next time slot in the specified direction, and so on. In this embodiment, the data cache in the time ring is cyclic, that is, after completing the data cache of the first circle of time slots, continue to traverse the second circle of time slots, cache data in the second circle of time slots, and so on, until the stop cache condition is met, the cyclic cache operation is stopped, wherein the stop cache condition includes that all historical data have been stored, the memory of all time slots is full, or the cache is manually stopped.

[0055] For example, Figure 4 As shown in the figure, assuming that there are 60 time slots evenly divided in the time ring, the time slot numbers of the 60 time slots start from 0 and increase to 59; the historical data is stored starting from the time slot with time slot number 0, and then the historical data is stored in the time slot with time slot number 1, and then the historical data is stored in the time slot with time slot number 2, and so on. When the time slot with time slot number 59 completes the data cache, the historical data continues to be stored in the time slot with time slot number 0. The caching step is looped until the stop caching condition is met and the cyclic caching operation is stopped.

[0056] Furthermore, each time slot uses an array to store historical data. Specifically, before each historical data is cyclically cached to each time slot, each historical data can be grouped in advance, and the multiple time groups obtained by grouping are continuous in time sequence, and the data grouping rule can be determined according to the preset simulation accuracy. For example, there are currently four historical data, and the difference between the four historical data is 1 second. Assuming that the simulation accuracy is 2 seconds, the first two historical data are grouped into a time group and stored in the same time slot, and the next two historical data are also grouped into a time group separately and stored in the next time slot to improve data caching efficiency.

[0057] Step S2: Calculate the number of cycles corresponding to each historical data when it is cached in the time loop, and determine the circle number attribute corresponding to each historical data according to the number of cycles.

[0058] Specifically, during the data caching process, the time slot number of the time slot in which data is being cached is recorded in real time and marked as the current time slot number. The change pattern of the current time slot number is analyzed. If the current time slot number gradually increases from 0 to 59, it means that the number of cache cycles is still the first cycle; when the current time slot number is converted from 59 to 0 for the first time, it means that the number of cache cycles has entered the second cycle; and so on.

[0059] When the cache circle number is the first circle, the circle number attributes of all historical data stored in the first circle time slot are assigned a value of 0; when the cache circle number is the second circle, the circle number attributes of all historical data stored in the second circle time slot are assigned a value of 1, and so on, until the cache stop condition is met and the circle number attribute assignment is stopped.

[0060] In this embodiment, in the process of traversing each time group and caching each practice group into the corresponding time slot, the data group being traversed is determined as the current time group, and the data time corresponding to the historical data in the current time group is determined, and the data time is the collection time of the historical data.

[0061] The calculation method of the circle number attribute of each historical data in the current time group is:

[0062] Calculate the data time of the current time group minus the initial time of the time ring to get the time difference; the initial time of the time ring is the time when the first historical data is cached to the time ring;

[0063] Divide the time difference by the simulation accuracy to obtain the span ratio;

[0064] The result of dividing the span ratio by the specified number of slots is rounded down to get the number of cycles, which is the circle number attribute of each historical data in the current time group.

[0065] The calculation expression of the circle attribute round is:

[0066]

[0067] Wherein, E is the data span time, which is the time difference obtained by subtracting the initial time of the time ring from the data time of the current time group, and the time difference is accurate to milliseconds;

[0068] P is the simulation accuracy;

[0069] 60 is the number of time slots in the time ring;

[0070] represents round down;

[0071] When the circle number attribute is less than or equal to 0, it means that this time group will be moved out and processed when the current time pointer reaches the current slot.

[0072] The calculation method of the time slot number N of the current time group cache to the time slot is:

[0073]

[0074] Among them, E is the data span time;

[0075] P is the simulation accuracy;

[0076] % is modulus;

[0077] Represents round down.

[0078] After calculating the circle number attribute round and the time slot number N, the position of the time slot in the time ring is determined according to the time slot number N, the current time group is cached in the time slot with the time slot number N, and the circle number attribute of each historical data in the current time group is marked as round.

[0079] like Figure 4 As shown, Figure 4 Three time groups are stored in the time slot with time slot number 1, each of which is composed of multiple historical data, and according to the number of cycles of the circular cache, the circle number attribute of the historical data in the first time group is round=0, the circle number attribute of the historical data in the second time group is round=1, and the circle number attribute of the historical data in the third time group is round=2.

[0080] Step S3: When a simulation request is obtained, a target time slot is determined according to the simulation request, and each time slot is traversed in turn in a specified direction starting from the target time slot, and the corresponding historical data in each time slot is read according to the circle number attribute for simulation.

[0081] It should be noted that the simulation request is initiated manually or automatically after the aforementioned data configuration and historical data caching are completed.

[0082] When a simulation request is received, the time loop is started. The pointer in the time loop passes through a time slot each time it moves. The current time of the time loop = the previous time + simulation accuracy.

[0083] When the time loop is started in this embodiment, the pointer on the time loop starts from the target time slot corresponding to the initial time, that is, from the target time slot with time slot number 0, reads the historical data with the circle number attribute of zero in the target time slot, and queues the historical data into the blocking queue. At the same time, the circle number attribute value of the historical data of other time groups in the target time slot is reduced by one to update the circle number attribute of each historical data. Afterwards, the pointer jumps to the next time slot in the specified direction (the pointer moves clockwise from time slot number 0 to the direction of time slot number 59), reads the historical data with the circle number attribute of zero in the next time slot, and queues it into the blocking queue, and so on, until the simulation stop condition is met.

[0084] The simulation stop condition may be when all historical data are read, manually stopped or other conditions. The reading of historical data can be paused at any time during the simulation process according to actual needs, and the pointer of the time ring also stops rotating during the pause process.

[0085] Combination Figure 3 As shown, another thread then takes out queue elements from the blocking queue in sequence, and assigns the elements to the current simulation interface, which simulates and presents historical data according to the element assignments. Since the data collected in this embodiment is completed under the specified collection conditions, the collected historical data is continuous and complete, and the data cached in the time loop is also complete, so the complete data at that time can be viewed at any time.

[0086] Furthermore, at any time, the pointer of the time loop will point to a time slot, in which the time error of all historical data with round=0 must be less than the simulation accuracy. Therefore, when the simulation is paused, the error between the time of all historical data on the simulation interface and the pause time of the historical simulation must be less than the simulation accuracy, thereby improving the simulation accuracy.

[0087] Furthermore, when it is necessary to find historical data at any specified time point within the acquisition time range, a corresponding simulation request can be initiated. After receiving the simulation request, the time slot number N1 and the circle number attribute round1 corresponding to the specified time point are calculated according to the specified time point, and the time slot where the historical data at the specified time point is stored is determined according to the time slot number N1, and the time slot is determined as the target time slot. Starting from the target time slot, historical data with a circle number attribute of round1 in the time slot and subsequent time slots are read, and after reading the historical data, the circle number attributes of other remaining historical data in the time slot are updated, and so on. This satisfies the need to simulate historical data starting from any time point in the complete acquisition time range, thereby improving the flexibility of historical data simulation.

[0088] This embodiment reduces the loss of simulation data due to insufficient sampling frequency or technical limitations through a more efficient data collection mechanism; and stores historical data through a time ring with multiple time slots. Since the cache space in the time ring is divided into multiple time slots, and the time slots are connected end to end, each historical data can be cyclically cached in each time slot, and the circle number attribute is used to represent the number of cycles when each historical data is stored in the time ring. The circle number attribute is used to retrieve relevant historical data in the time slot for simulation. Compared with the traditional ordered linked list, the caching and reading method of the time ring of the present invention is more efficient and accurate, thereby improving the simulation efficiency.

[0089] Another embodiment of the present invention provides a time-loop-based historical data simulation system, which executes the time-loop-based historical data simulation method as described above.

[0090] It should be noted that the functions of the various modules of the system of the embodiment of the present invention can be found in the corresponding description of the above method, which will not be repeated here.

[0091] Another embodiment of the present invention provides an electronic device, Figure 5 Figure 2 shows a block diagram of the electronic device. Figure 5 As shown, the electronic device includes: a memory 100 and a processor 200, wherein the memory 100 stores a computer program that can be run on the processor 200. When the processor 200 executes the computer program, the historical data simulation method based on the time loop in the above embodiment is implemented. The number of the memory 100 and the processor 200 can be one or more.

[0092] The electronic device also includes:

[0093] The communication interface 300 is used to communicate with external devices and perform data exchange transmission.

[0094] If the memory 100, the processor 200 and the communication interface 300 are implemented independently, the memory 100, the processor 200 and the communication interface 300 can be connected to each other through a bus and communicate with each other. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc.

[0095] Optionally, in a specific implementation, if the memory 100, the processor 200 and the communication interface 300 are integrated on a chip, the memory 100, the processor 200 and the communication interface 300 can communicate with each other through an internal interface.

[0096] An embodiment of the present invention provides a computer-readable storage medium storing a computer program, which implements the method provided in the embodiment of the present invention when executed by a processor.

[0097] An embodiment of the present invention further provides a chip, which includes a processor for calling and executing instructions stored in the memory from the memory, so that a communication device equipped with the chip executes the method provided by the embodiment of the present invention.

[0098] An embodiment of the present invention also provides a chip, including: an input interface, an output interface, a processor and a memory, wherein the input interface, the output interface, the processor and the memory are connected via an internal connection path, and the processor is used to execute the code in the memory. When the code is executed, the processor is used to execute the method provided by the embodiment of the invention.

[0099] It should be understood that the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc. It is worth noting that the processor may be a processor supporting the advanced RISC machines (ARM) architecture.

[0100] Further, optionally, the above-mentioned memory may include a read-only memory and a random access memory, and may also include a non-volatile random access memory. The memory may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may include a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may include a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available. For example, static RAM (SRAM), dynamic random access memory (DRAM), synchronous DRAM (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM) and direct rambus RAM (DR RAM).

[0101] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function according to the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium.

[0102] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine different embodiments or examples described in this specification and the features of different embodiments or examples, unless they are contradictory.

[0103] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In the description of the present invention, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.

[0104] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of various changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

Claims

1. A historical data simulation method based on a time loop, characterized in that: include: Acquire historical data, and sequentially cache each of the historical data in a loop into each time slot in the time ring; wherein each of the time slots is connected end to end in the time ring to form a closed loop; Calculating the number of cycles corresponding to each of the historical data when it is cached in the time loop, and determining the circle number attribute corresponding to each of the historical data according to the number of cycles; When a simulation request is obtained, a target time slot is determined according to the simulation request, and starting from the target time slot, each time slot is traversed in turn in a loop in a specified direction, and the corresponding historical data in each time slot is read according to the circle number attribute for simulation.

2. The historical data simulation method based on time loop according to claim 1 is characterized in that: Also includes: Creating the time ring, and dividing the cache space of the time ring according to a preset number of designated slots to obtain a plurality of the time slots; Data is initialized for the cache space of each time slot, and the circle number attribute corresponding to each historical data is initialized to zero.

3. The historical data simulation method based on time loop according to claim 1 is characterized in that: The acquisition of historical data includes: Acquiring acquisition conditions, wherein the acquisition conditions include an acquisition frequency and an acquisition time range; The corresponding historical data is obtained from the specified data source according to the collection conditions.

4. The historical data simulation method based on time loop according to claim 1 is characterized in that: The sequentially cyclically caching each of the historical data into each time slot in the time ring includes: Obtaining a preset simulation accuracy, and continuously grouping each of the historical data according to the simulation accuracy to obtain a plurality of time groups; Each of the time groups is traversed, and each of the time groups is circularly cached into each of the time slots in turn.

5. The historical data simulation method based on time loop according to claim 4 is characterized in that: The sequentially cyclically caching each of the time groups into each of the time slots includes: Traverse each of the time groups, obtain the data time corresponding to the historical data in the time group, calculate the difference between the data time and the initial time, and obtain the time difference; wherein the initial time is the time when the first historical data is cached in the time ring; Calculate the time slot number of the current time slot according to the time difference, the simulation accuracy and the specified number of slots of the time ring; The position of the current time slot in the time ring is determined according to the time slot number, and the time group corresponding to the data time is cached in the current time slot.

6. The method for simulating historical data based on a time loop according to claim 5, characterized in that: The calculating of the number of cycles corresponding to each of the historical data being cached in the time loop comprises: Dividing the time difference by the simulation accuracy to obtain a span ratio; The result of dividing the span ratio by the specified number of slots is rounded down to obtain the number of cycles.

7. The historical data simulation method based on time loop according to claim 1 is characterized in that: The reading of the historical data corresponding to each of the time slots according to the circle number attributes for simulation includes: Starting from the target time slot, read the historical data whose circle number attribute is zero in the target time slot and put it into the designated queue, and reduce the circle number attribute of other historical data in the target time slot by 1; Other time slots in the time ring are read in a circular manner in the specified direction, and all the historical data queued into the specified queue are assigned to the specified simulation interface in sequence to complete the simulation presentation of historical data.

8. A historical data simulation system based on a time loop, characterized in that: Execute the historical data simulation method based on the time loop as described in any one of claims 1 to 7.

9. An electronic device, characterized in that: include: A processor and a memory, wherein the memory stores instructions, and the instructions are loaded and executed by the processor to implement the historical data simulation method based on the time loop as claimed in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method for simulating historical data based on a time loop according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Processing a data array with a meandering scanning order using a circular buffer memory

    CN101147396A

  • Traffic control strategy hardware-in-loop simulation system and method based on multi-sensors

    CN106056905A

  • Data writing method, apparatus and device of ring buffer, and medium

    CN108491333A

  • High-speed data packet acquisition method and device

    CN109120665A

  • Handling ring buffer updates

    CN113614698A