Data query method, device and electronic equipment
By dynamically adjusting the accuracy of data queries to adapt to the device display capabilities, the problems of slow and low efficiency of high-frequency variable query speed are solved, and efficient data query and display are achieved.
Patent Information
- Application Number
- CN202210579970.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-25
- Publication Date
- 2025-08-19
- Estimated Expiration
- 2042-05-25
AI Technical Summary
The existing data query solutions are slow, have large traffic and low efficiency when facing the query requirements of high-frequency variables, making them difficult to meet the production practice requirements in large data volume scenarios.
By pre-dividing the data into different accuracy according to the storage time interval, dynamically determining the accuracy of the query data based on the display capability of the device, generating a target curve for display, avoiding the acquisition of useless data that exceeds the display accuracy of the device.
It improves query speed, reduces hardware requirements and network traffic consumption, and maintains the user experience of observing data.
Smart Images

Figure CN117216124B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to data processing technology, and in particular to a data query method, device and electronic device. Background Art
[0002] For various industrial equipment with real-time monitoring requirements, the data generated and recorded during operation are of great value for condition monitoring, online diagnosis and offline analysis.
[0003] However, with the advancement of industrial control technology, the number of variables monitored during industrial equipment operation continues to increase, and data sampling frequency continues to accelerate, posing a severe challenge to historical queries on massive amounts of data. For example, for high-frequency data with sampling periods of milliseconds or less, a single variable can generate tens of thousands to millions of historical data items per day, and the amount of historical data generated annually can reach hundreds of millions.
[0004] However, existing conventional data query methods based on data indexing or sharding have disadvantages such as slow speed, large traffic, and low efficiency when facing query needs for high-frequency variables. They are basically unable to be used to query historical data of high-frequency variables and are difficult to meet the production practice requirements in large data volume scenarios. Summary of the Invention
[0005] The embodiments of the present application provide a data query method, device, and electronic device to solve the problem that existing data query solutions have difficulty in querying high-frequency variables.
[0006] In a first aspect, an embodiment of the present application provides a data query method, comprising:
[0007] Receive a data query instruction, wherein the data query instruction at least includes a query period and a variable identifier for indicating a target variable to be queried;
[0008] Determine the request time interval based on the time span of the query period and the pixel width of the curve;
[0009] determining, from the data storage area, a storage time interval that matches the request time interval as a target storage time interval, and querying target data of the target variable in the query period and the target storage time interval; wherein the data storage area pre-stores data of the target variable in at least two storage time intervals;
[0010] A target curve is generated based on the target data; wherein the number of pixels of the target curve is equal to the pixel width of the curve, and the time span between a preset number of pixels in the target curve matches the requested time interval.
[0011] In a possible implementation, the storage time interval includes a sampling time interval when performing data sampling and / or a statistical time interval when performing data statistics;
[0012] The data storage area pre-stores data of the target variable at at least two storage time intervals, including:
[0013] The data storage area pre-stores the original sampled data of the target variable at at least one sampling time interval, and statistical data obtained by performing statistics on the original sampled data at at least one statistical time interval; or
[0014] The data storage area stores in advance the original sampling data of the target variable at at least two sampling time intervals; or,
[0015] The data storage area pre-stores statistical data obtained by performing statistics on the original sampling data at at least two statistical time intervals for the target variable.
[0016] In a possible implementation, determining, from the data storage area, a storage time interval that matches the request time interval as the target storage time interval includes:
[0017] All storage time intervals with a time interval less than or equal to the request time interval are selected from the data storage area, and the storage time interval with the largest time interval is selected as the target storage time interval.
[0018] In a possible implementation, the statistical data at any statistical time interval in the data storage area is determined based on the original sampling data, or based on other statistical data with a time interval shorter than the own statistical time interval.
[0019] In a possible implementation, querying the target data of the target variable in the query period and the target storage time interval includes:
[0020] Determining a ratio of the request time interval to the target storage time interval;
[0021] According to the ratio, all or part of the data of the target variable in the query period and the target storage time interval is obtained as the target data.
[0022] In a possible implementation, the data of the target variable at different storage time intervals are independently stored in different data storage sub-areas;
[0023] After determining the ratio of the request time interval to the target storage time interval, the method further includes:
[0024] determining a target data storage sub-area for the target variable at the target storage time interval;
[0025] All or part of the data is acquired from the target data storage sub-area according to the ratio as the target data.
[0026] In a possible implementation, the data query instruction further includes a prefetch ratio. After determining the request time interval based on the time span of the query period and the pixel width of the curve, the method further includes:
[0027] Determining a prefetching time interval according to the requesting time interval and the prefetching ratio, wherein the prefetching time interval is less than the requesting time interval;
[0028] Determining a prefetch period based on the query period and the prefetch ratio, wherein the time span of the prefetch period is greater than the time span of the query period;
[0029] Determine a storage time interval that matches the pre-fetch time interval from the data storage area, and query pre-fetch data of the target variable in the storage time interval and the pre-fetch period;
[0030] When receiving an external instruction for instructing the target curve to translate or scale, if the curve change ratio indicated by the external instruction matches the pre-fetch ratio, updating the target curve according to the pre-fetch data;
[0031] Among them, the above-mentioned curve change ratio includes any one of the translation ratio, magnification ratio, and reduction ratio; the above-mentioned curve change ratio matches the above-mentioned pre-fetch ratio, including: the above-mentioned translation ratio is less than or equal to the above-mentioned pre-fetch ratio, or the above-mentioned magnification ratio is less than or equal to the above-mentioned pre-fetch ratio, or the above-mentioned reduction ratio is greater than or equal to the above-mentioned pre-fetch ratio.
[0032] In a possible implementation, after updating the target curve according to the pre-fetched data, the method further includes:
[0033] updating the prefetch ratio as an updated prefetch ratio according to any one of the translation ratio, the magnification ratio, and the reduction ratio, and determining an updated prefetch time interval and an updated prefetch period according to the updated prefetch ratio;
[0034] Determine a storage time interval that matches the updated pre-fetch time interval from the data storage area, and query updated pre-fetch data of the target variable in the storage time interval and the pre-fetch period.
[0035] In a second aspect, an embodiment of the present application provides a data query device, comprising:
[0036] An instruction receiving unit, configured to receive a data query instruction, wherein the data query instruction at least includes a query period and a variable identifier for indicating a target variable to be queried;
[0037] A time determination unit, configured to determine a request time interval based on the time span of the query period and the pixel width of the curve;
[0038] a data query unit, configured to determine, from a data storage area, a storage time interval that matches the request time interval as a target storage time interval, and query target data of the target variable during the query period and the target storage time interval; wherein the data storage area pre-stores data of the target variable during at least two storage time intervals;
[0039] A curve generating unit is used to generate a target curve based on the target data; wherein the number of pixels of the target curve is equal to the pixel width of the curve, and the time span between the preset number of pixels in the target curve matches the requested time interval.
[0040] In a third aspect, an embodiment of the present application further provides an electronic device, the electronic device comprising: a processor and a machine-readable storage medium;
[0041] The machine-readable storage medium stores machine-executable instructions that can be executed by the processor;
[0042] The processor is used to execute machine-executable instructions to implement the method steps disclosed above.
[0043] As can be seen from the above technical solution, in this embodiment, data is pre-divided into different precisions based on the storage time interval for storage, so that during the query process, the precision of the data to be obtained is dynamically determined based on the time range to be queried and the display capabilities of the device subsequently used to display the data curve, thereby querying and returning the data stored at the corresponding precision, and generating a corresponding curve based on the obtained data for display. In this embodiment, since the precision of the query data can be dynamically adjusted based on the display capabilities of the device, compared to conventional data query methods, it can avoid obtaining a large amount of useless data that exceeds the device display precision, improve query speed, and reduce hardware requirements; at the same time, since the precision of the obtained data is compatible with the display capabilities of the device, it does not affect the user experience when observing the data. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0045] Figure 1 A flow chart of the method provided in the embodiment of the present application;
[0046] Figure 2 A schematic diagram of data relationships provided in an embodiment of the present application;
[0047] Figure 3 A schematic diagram of the data query process provided in an embodiment of the present application;
[0048] Figure 4 A diagram of the device structure provided in an embodiment of the present application;
[0049] Figure 5 This is a structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0050] Exemplary embodiments will be described in detail herein, with examples illustrated in the accompanying drawings. In the following description, when referring to the drawings, identical numerals in different figures represent identical or similar elements, unless otherwise indicated. The embodiments described in the following exemplary embodiments are not intended to represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.
[0051] The terms used in this application are for the purpose of describing particular embodiments only and are not intended to limit this application. As used in this application and the appended claims, the singular forms "a," "an," "the," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
[0052] In order to enable those skilled in the art to better understand the technical solutions provided by the embodiments of the present application, and to make the above-mentioned purposes, features and advantages of the embodiments of the present application more obvious and easy to understand, the technical solutions in the embodiments of the present application are further described in detail below with reference to the accompanying drawings.
[0053] In the field of industrial control, data collection is required for various variables of industrial equipment during operation for various purposes, such as real-time status monitoring, online diagnosis, and offline analysis. Industrial equipment in this context includes wind turbines, chemical reactors, transformers, and any other equipment that requires monitoring or data collection. The variables to be collected can include wind speed, rotational speed, oil temperature, hydraulic pressure, power, and other variables required for industrial production control or equipment testing.
[0054] Data with a sampling period of milliseconds is generally referred to as high-frequency data, and variables that require high-frequency data collection are generally referred to as high-frequency variables. For example, a single high-frequency variable with a 20ms resolution generates 4.32 million historical data items per day (50 * 3600 * 24). If the storage period is 180 days, a single high-frequency variable with a 20ms resolution can generate a maximum of 777.6 million data items (4.32 million / day * 180 days).
[0055] Currently, commonly used historical data query methods mainly include creating time field index queries, establishing NoSQL databases for queries, and establishing time series databases for queries. Analysis shows that when facing queries on historical data with a large time span of billions, these data query methods will have serious defects such as long query time, low efficiency, and large network bandwidth usage due to the excessive proportion of time index information in the historical data and the total amount of data exceeding the performance limit. These problems basically cannot meet the requirements of querying data curves of high-frequency variables within 180 days.
[0056] In this regard, the present application provides a data query method to solve the above problems. Figure 1 , Figure 1 This is a flowchart of the method provided in an embodiment of the present application. For ease of understanding, this process uses the data query process of a single variable as an example. In actual use, data queries can be performed on any number of variables in the same manner. The sampling period of the variable can be in milliseconds or any higher or lower sampling level, which is not limited in this embodiment.
[0057] In this embodiment, the above process can be used to perform data query on any industrial production equipment such as wind turbines, chemical reactors, or other equipment with data collection and query requirements; and the query process can be specifically executed through any electronic device such as mobile phones, personal computers, servers, embedded industrial control equipment, etc. to realize data query and curve display, etc., which is not limited in this embodiment.
[0058] like Figure 1 As shown, the process may include the following steps:
[0059] Step 101: Receive a data query instruction, wherein the data query instruction at least includes a query period and a variable identifier for indicating a target variable to be queried.
[0060] In this embodiment, a device for executing a data query, such as a computer, performs a data query operation based on a received data query instruction for instructing the data query operation. The data query instruction includes at least a query period and a variable identifier, wherein the query period indicates the time range corresponding to the data that the user wishes to obtain, and the variable identifier is used to determine the target variable currently required by the user from multiple stored variables. When entering the query period, the user may directly enter specific start and end time points, or may select the period using a mouse, such as by selecting a box or sliding the mouse, based on a visual graphical interface or a displayed data curve, etc., and this embodiment does not limit this.
[0061] As a preferred embodiment, the data query instruction may also include a data type identifier for determining a specified data type from multiple data types, a prefetch ratio for indicating data prefetching to speed up subsequent queries, etc., which will be described in conjunction with subsequent specific embodiments and will not be repeated here.
[0062] Step 102: Determine the request time interval according to the time span of the query period and the pixel width of the curve.
[0063] In this embodiment, in order to dynamically obtain data with corresponding accuracy according to the display capability of the device, it is necessary to dynamically determine the request time interval based on the query period carried in the above data query instruction and the curve pixel width of the device.
[0064] Among them, the time span of the query period represents the length of time between the start time and the end time that the user needs to query. For example, the query period carried in a data query instruction is "start time = 2021-09-10 00:00, end time = 2021-09-17 00:00", then the corresponding time span is 7 days; the curve pixel width represents the number of horizontal pixel points of the curve generated based on the data obtained by the query, which corresponds to the display capability of the electronic device used for data query and display. For example, the window resolution actually used to display the curve in this device is horizontal * vertical = 1000*600, then its curve pixel width is 1000, and the curve generated based on the data obtained by the query can be composed of at least 1000 pixels.
[0065] In this embodiment, determining the request time interval based on the time span and the curve pixel width can refer to preliminarily determining the time span corresponding to each pixel in the subsequently generated curve based on the user's desired time span combined with the actual display capabilities of the device. The request time interval is the time span corresponding to each two or more pixels estimated during the data query request phase. For example, when the time span is 7 days, i.e., 7*24*60=10080 (minutes), and the curve pixel width is 1000, assuming that each pixel in the curve displays one piece of data, the request time interval can be 10080 / 1000=10.08 (minutes), i.e., preliminarily determining that the time span between each two pixels in the subsequently generated curve corresponds to approximately 10.08 minutes. At this time, the device will send a query request with a request time interval of 10.08 minutes to the backend. Because the actual data stored in the data storage area may not fully match the request time interval currently sent, the time span corresponding to each pixel in the subsequently generated curve may be adjusted based on the request time interval.
[0066] Among them, the above-mentioned sending of query request to the background can refer to sending query request to the background of this device, or it can refer to sending query request to other electronic devices independent of this device, such as servers, industrial computers, databases and other devices that establish connection with this device through the network. This embodiment does not limit this.
[0067] As an optional embodiment, the above request time interval calculation process assumes that one piece of historical data is displayed for each pixel in the curve, but in actual use it can also be adjusted according to needs. For example, when the amount of data is small or the curve displayed by a single pixel is too thin and unclear, one piece of data can also be displayed by N pixels, and the request time interval can be adjusted accordingly. This embodiment does not limit this.
[0068] Step 103: Determine a storage time interval that matches the request time interval from the data storage area as a target storage time interval, and query target data of the target variable in the query period and the target storage time interval.
[0069] In this embodiment, the data storage area pre-stores data for various variables, including the target variable, at various storage time intervals. The data storage area, which is the area used to store the corresponding data, can be located on the device itself or on another electronic device, such as a server or database, connected to the device via a network. The storage time interval represents the accuracy of data storage; shorter storage time intervals indicate higher data accuracy.
[0070] As an optional embodiment, the above-mentioned storage time interval may include a sampling time interval when data sampling is performed, and / or a statistical time interval when data statistics are performed; accordingly, the data storage area pre-stores original sampling data of each variable including the target variable at at least one sampling time interval, and statistical data obtained by performing statistics on the original sampling data at at least one statistical time interval; or, the data storage area pre-stores original sampling data of each variable including the target variable at at least two sampling time intervals; or, the data storage area pre-stores statistical data obtained by performing statistics on the original sampling data of each variable including the target variable at at least two statistical time intervals.
[0071] For example, if a variable has a sampling period of 20ms, the data directly sampled is the original sampled data for that variable with a sampling interval of 20ms. Based on this, if sampling statistics are performed on it, such as counting the maximum, minimum, average, peak-to-valley difference, and standard deviation within each second, the resulting data is the statistical data for that variable with a statistical interval of 1s. Similarly, statistical data for that variable can be obtained at any statistical interval. When the statistical data is divided into multiple data types, such as maximum and minimum values, the user can enter a data type identifier in the data query instruction to query data for the target variable under the specified data type.
[0072] Optionally, the data storage area may also additionally store or only store sampled data at a certain sampling time interval obtained by directly performing interval sampling on the original sampled data, etc. This embodiment does not limit this.
[0073] In this embodiment, there are multiple implementation methods for determining a storage time interval that matches a request time interval from a data storage area, and for querying target data of a target variable under the above-mentioned query period and target storage time interval. Several optional methods will be given in conjunction with specific embodiments later, which will not be described in detail here.
[0074] Step 104: Generate a target curve based on the target data.
[0075] In this embodiment, since the query is primarily for high-frequency data with a sampling period of milliseconds or less, it is difficult for users to perform fault time detection or status monitoring operations on industrial equipment using tables or other forms for data at this level. Therefore, it is necessary to generate a target curve based on the target data obtained in the query in step 103 for display, so that users can query historical status to find fault time, etc.; on this basis, data can also be displayed in the form of tables or other forms to assist users in viewing. The number of pixels in the generated target curve is equal to the pixel width of the above-mentioned curve, and the time span between the preset number of pixels in the above-mentioned target curve matches the above-mentioned request time interval.
[0076] In this embodiment, since after determining the request time interval in step 102, operations such as determining the storage time interval are required, the time span between the preset number of pixel points in the target curve actually displayed may change compared to the request time interval; therefore, the time span between the preset number of pixel points in the above-mentioned target curve matches the above-mentioned request time interval, which may include the time span between the preset number of pixel points being equal to the request time interval, or the time span being equal to the result of rounding up or down the request time interval, etc. This embodiment does not limit this.
[0077] So far, completed Figure 1 The process shown.
[0078] pass Figure 1 As can be seen from the process shown, in this embodiment, data is pre-divided into different precisions based on the storage time interval for storage, so that during the query process, the precision of the data to be obtained is dynamically determined based on the time range to be queried and the display capability of the device used to display the data curve, thereby querying and returning the data stored at the corresponding precision, and generating a corresponding curve based on the obtained data for display. In this embodiment, since the precision of the query data can be dynamically adjusted according to the display capability of the device, compared with the conventional data query method, it can avoid obtaining a large amount of useless data that exceeds the device display precision. Without significantly increasing the storage space and system computing power, it improves the query speed, reduces the hardware requirements, and greatly improves the query efficiency. At the same time, since the precision of the obtained data is compatible with the display capability of the device, it does not affect the user experience when observing the data.
[0079] In addition, when the device performing data query and the device for data storage are connected via a network, the above embodiment can also reduce network traffic consumption and bandwidth occupancy during query.
[0080] As an optional embodiment, in the preferred solution of the aforementioned step 103, the relationship between the original sampling data and the statistical data at different statistical time intervals can be as follows: Figure 2 shown.
[0081] See also Figure 2 , Figure 2 Schematic diagram of data relationships provided for the embodiments of this application: Figure 2 For a target variable with a sampling period of 20ms, the sampling time interval of its original sampling data is 20ms, 50 original sampling data are sampled per second, and 3000 original sampling data are sampled per minute.
[0082] At this time, you can set a statistical time interval to 1 second. That is, for the 50 original sampling data within a certain second, the maximum value, minimum value, average value, peak-to-valley difference, and standard deviation of these 50 data are counted respectively, and 5 statistical data with a statistical time interval of 1 second are obtained. In this way, 300 statistical data with a statistical time interval of 1 second can be obtained within 1 minute.
[0083] As an optional embodiment, the statistical data at any statistical time interval in the data storage area may be determined based on the original sampling data, or may be determined based on other statistical data with a time interval shorter than the own statistical time interval.
[0084] Among them, the calculation of statistical data is carried out synchronously with the collection of original sampling data. The statistical data can be cached for a period of time and then the cached content can be written to the data storage area in batches to improve data writing efficiency; or after the statistical data is determined, it can be written to the data storage area immediately to avoid the loss of cached content due to failures or power outages, thereby protecting data security.
[0085] Optionally, the data at the above-mentioned different storage time intervals (including sampling time intervals and statistical time intervals) can be stored independently in different data storage sub-areas. For example, the relevant data of the target variable with a storage time interval of 1 second is stored in the second-level data storage sub-area of the target variable, and the relevant data of the target variable with a storage time interval of 1 minute is stored in the minute-level data storage sub-area of the target variable, and so on, so that after the target storage time interval is determined later, the corresponding data storage sub-area can be used to obtain the corresponding data.
[0086] Among them, when the data is stored in a database, the above-mentioned data storage sub-area can be a data table in the database; when the data is stored in a file system, the above-mentioned data storage sub-area can be a data file in the file system, and so on, which is not limited in this embodiment; each data storage sub-area can store data of a single variable or multiple variables, and can store statistical results of a single or multiple data types. The data of a single variable in the same storage time interval can also be stored in multiple data storage sub-areas respectively, and so on, which is not limited in this embodiment.
[0087] So far, the Figure 2 In this embodiment, the number of original sampled data within one minute is 3,000. After calculating the five statistical data at the second and minute levels, only 305 additional data points need to be stored. This can achieve the effect of not having to temporarily calculate and determine based on the original sampled data when directly querying the minute-level data. While significantly reducing the amount of query data, it also takes up less additional storage space and can significantly improve query performance.
[0088] As a preferred embodiment, in the aforementioned step 103, determining a storage time interval that matches the above-mentioned request time interval from the data storage area as the target storage time interval can be achieved in the following manner: selecting all storage time intervals whose time intervals are less than or equal to the above-mentioned request time interval from the data storage area, and selecting the storage time interval with the largest time interval as the target storage time interval.
[0089] For example, the data storage area stores data of the target variable at storage time intervals of 20 milliseconds, 1 second, 1 minute, 1 hour, and 1 day, respectively. At this time, step 102 calculates and determines that the request time interval is 10.08 minutes. Then, all storage time intervals less than 10.08 minutes are selected, including the three storage time intervals of 20 milliseconds, 1 second, and 1 minute. Among them, the storage time interval with the largest time interval is the 1-minute storage time interval, which is used as the target storage time interval for subsequent query operations.
[0090] By determining the target storage time interval in the above manner, it is possible to avoid the situation where the target storage time interval is greater than the request time interval, resulting in the inability to ensure that each pixel point corresponds to a data point. It is also possible to avoid the situation where the target storage time interval is much smaller than the request time interval, resulting in the query data accuracy being too high and the total amount of data to be queried increasing, resulting in reduced query efficiency.
[0091] As an optional embodiment, after determining the target storage time interval, querying the target data of the target variable in the above-mentioned query period and target storage time interval can be achieved in the following way: determining the ratio of the request time interval and the target storage time interval; and obtaining all or part of the data of the target variable in the corresponding query period and target storage time interval based on the ratio as the target data.
[0092] For example, when the query period is from 2021-09-10 00:00 to 2021-09-17 00:00, the request interval is 10.08 minutes, the target storage interval is 1 minute, and the target variable data at different storage intervals is stored independently in different data storage sub-areas:
[0093] Based on the target storage time interval and the query period, determine one or more minute-level data storage sub-areas in the data storage area that contain statistical data of the target variable in the one-minute statistical interval between 2021-09-10 00:00 and 2021-09-17 00:00 as the target data storage sub-areas;
[0094] The ratio of the request time interval to the target storage time interval is determined to be 10.08;
[0095] Determine the starting position of the data point corresponding to the time of 2021-09-10 00:00 and the ending position of the data point corresponding to the time of 2021-09-17 00:00 in the target data storage sub-area, for a total of 7*24*60=10080 data points;
[0096] The above ratio 10.08 is approximately rounded to 10, and one data point out of every ten data points is returned from the above 10,080 data points. A total of 1,008 data points are obtained as target data.
[0097] The aforementioned selection of one data point out of every ten data points may be performed at a fixed interval, or may be determined statistically based on the type of data to be obtained. For example, when the maximum value of the query data is specified in the data query instruction, the maximum value of every ten adjacent maximum values may be selected and returned, thereby obtaining 1008 data points, and so on. This embodiment is not limited to this. Optionally, when the aforementioned ratio or the ratio approximately rounded to 1 is equal to 1, all data points determined based on the start and end points of the query period may be directly used as the aforementioned target data.
[0098] In order to enable those skilled in the art to better understand the technical solutions provided by the embodiments of the present application, the above data query method will be introduced below in conjunction with specific embodiments; in the actual query process, the user can repeatedly execute the above method steps to gradually narrow the time range of the fault from a larger time span until the fault moment is finally determined. The changes in the target curve generated during the repeated query process can be referred to Figure 3 The data query process is given as an example in FIG; It should be noted that, in order to simplify the calculation and facilitate understanding, some query periods involved below are approximately rounded, so Figure 3 The multiple curves shown in the figure are only used to schematically describe the process of data query and fault location. The time range displayed on the coordinate axis of each curve in the figure is not used as a limitation on the calculation process in the following embodiments.
[0099] As an optional embodiment, assume that a wind farm prototype A in Inner Mongolia experiences an abnormality. The user can locate the cause by running remote diagnostic software based on the above data query method to view the historical curves of related high-frequency variables for several days before and after the abnormality. The specific steps are as follows:
[0100] Step 111: The user enters the diagnostic software interface and prepares to query the wind speed data of prototype A within 13 days. The variable identifier corresponding to the wind speed, 0001, the start time, 2021-10-29 00:00, and the end time, 2021-11-11 00:00, are input into the software as data query instructions.
[0101] After receiving the data query instruction, the software determines that the area that can be used to display the data curve subsequently contains 1000 pixels horizontally, that is, the pixel width of the curve is 1000. Based on this, the request time interval can be calculated to be 13*24*60 / 1000=18.72 (minutes), that is, it is estimated that each pixel point in the subsequently generated curve corresponds to the average wind speed within 18.72 minutes, and the corresponding query request is sent to the background.
[0102] Optionally, when the above software is unable to obtain the pixel width of the curve due to system permissions or other reasons, it can also be implemented by using a preset value or a user-selected specified value, and this embodiment does not limit this; optionally, the above data query instruction can also specify a data type, for example, the data type can be selected as "average" to query the average wind speed; optionally, the above data query instruction can also include a prefetch ratio for indicating a data prefetch operation. Here, for the sake of clarity, the prefetch ratio is temporarily set to 0%.
[0103] In step 112, assuming that the sampling period of the wind speed variable is 20 milliseconds, and the data storage area stores raw sampled data with a sampling interval of 20 milliseconds and statistical data with statistical intervals of 1 second, 1 minute, 1 hour, 1 day, and 1 month, respectively; when the backend performs a data query based on the query request, in order to balance query accuracy and query efficiency, it will determine all storage time intervals in the data storage area with intervals less than 18.72 minutes and select the one with the largest interval as the target storage time interval, i.e., 1 minute.
[0104] The backend searches for the data storage sub-area 0001m where the minute-level statistical values of the target variable 0001 are located. It locates the data in the field corresponding to the average value from 2021-10-29 00:00 to 2021-11-11 00:00, a total of 18,720 data points.
[0105] 18.72 is approximately rounded down to 18, that is, among the 18720 average value data, one data point is returned every 17 data points, or the average value of every 18 adjacent data points is returned, and a total of 1040 data points are obtained.
[0106] In this embodiment, the diagnostic software only needs to return 1040 data points from 18720 data points to complete the data query. The software's response delay in this process is within 1 second. The conventional data query method requires searching 18720*50*60=56.16 million data points for the target variable with a sampling period of 20 milliseconds within 13 days. Therefore, this embodiment can significantly improve the query efficiency of high-frequency data.
[0107] In step 113, since 1040 data points are actually queried and cached in step 112, which is greater than the curve pixel width of 1000 and cannot be displayed, 1000 data points are selected from the above 1040 data points to generate the target curve.
[0108] In this embodiment, considering that the time range actually displayed by the curve has a slight increase or decrease compared to the query period input by the user, which basically does not affect the user experience, 1000 data points in the middle of the above 1040 data points are selected for display, and 20 data points at both ends are cached and retained and not displayed. The time is slightly adjusted to make the displayed time adapt to the curve. That is, based on the 13-day period requested by the user, about 6 hours of data are reduced on both sides, which can be used as a reference. Figure 3 The first curve is shown in .
[0109] In step 114, the user observes the curve obtained by the query and finds that the average wind speed around November 6 is abnormal, so the data between 2021-11-05 12:00 and 2021-11-06 12:00 is queried again; the request time interval of this query is 24*60 / 1000=1.44 (minutes), and the target storage time interval is still in minutes. Similarly, 1.44 is rounded to 1, and all 1440 data points are returned from the 1440 located data. The middle 1000 data points are selected to generate the target curve. The data on the left and right sides are reduced by about 3.67 hours compared to the time range of the request query, which can be approximated as a reference. Figure 3 The specific implementation process can refer to the above steps 112 and 113, which will not be repeated here.
[0110] Optionally, if the user finds that the required data is outside the left or right boundary, the user can control the curve translation by dragging the mouse or inputting commands. The diagnostic software determines whether it can directly generate the translated curve based on the data already in the cache or whether it must request data from the background again; for example, Figure 3 Based on the second curve shown in , it is shifted left by a distance corresponding to a duration of 3 hours. At this time, because the software cache has additional data of approximately 3.67 hours outside the left boundary, the shifted target curve can be generated directly based on the cached data without requesting data from the backend.
[0111] Optionally, the data type, curve pixel width, etc. used in the previous query can be used in each query process, or can be readjusted; for example, in the second query process mentioned above, the user can set the diagnostic software to full-screen display or enlarge the curve display area to increase the curve pixel width from 1000 to 1440, which just corresponds to the 1440 data points obtained from the cache. A new target curve can be generated directly, and the time axis width can be adjusted accordingly without having to request data from the background again.
[0112] Step 115: After the user has gone through the above query process, it is found that the average wind speed around 4:00 to 5:00 on November 6 is abnormal. Based on the query period, the user performs a query and obtains Figure 3 Repeat the above process to obtain the third curve shown in Figure 3 The fourth and fifth curves shown in are used to accurately obtain the time period where the abnormal data occurs.
[0113] In this embodiment, if Figure 3 As shown in the fifth curve, users can confirm that the abnormal data is located in the 500 milliseconds between 2021-11-05 04:47:56.8 and 2021-11-05 04:47:57.3, corresponding to 25 original sampling data points; optionally, on this basis, users can also call up specific numerical information within this range to more accurately locate the moment of the abnormality.
[0114] Optionally, when the query period range is small and the target storage time interval is equal to the sampling time interval, the original value of the sampled data can be directly returned when querying and returning data, or the maximum value or average value of several adjacent original values can be statistically returned. This embodiment does not limit this.
[0115] As an optional embodiment, the data query instruction may further include a prefetch ratio. The prefetch interval is determined based on the request interval and the prefetch ratio, and the prefetch period is determined based on the query period and the prefetch ratio. A storage interval matching the prefetch interval is then determined from the data storage area, and the prefetched data of the target variable within the storage interval and prefetch period is queried. The prefetch interval is shorter than the request interval, and the time span of the prefetch period is longer than the time span of the query period.
[0116] On this basis, when an external instruction for indicating the translation or scaling of the target curve is received, if the curve change ratio indicated by the external instruction matches the prefetch ratio, the target curve can be updated based on the prefetched data; wherein, the curve change ratio may include any one of a translation ratio, an enlargement ratio, and a reduction ratio; the curve change ratio matches the prefetch ratio, specifically meaning: the translation ratio is less than or equal to the prefetch ratio, or the enlargement ratio is less than or equal to the prefetch ratio, or the reduction ratio is greater than or equal to the prefetch ratio, and so on.
[0117] In this embodiment, a prefetch ratio can be set for each query to retrieve and cache additional data beyond that required for curve display. This allows subsequent user requests to pan or zoom the curve to be displayed directly based on the cached data. This avoids the need to resend requests to the backend and wait for a response, further improving query efficiency.
[0118] For example, assuming that in the second query process mentioned above, the input pre-fetch ratio is 50%, which means that during the query process, the data required for left and right translation by 50%, reduction or enlargement by 50% will be additionally obtained on the basis of the data queried when the pre-fetch ratio is not set. For example, for left and right translation, the query period 2021-11-05 12:00 to 2021-11-06 12:00 can be extended to 2021-11-05 00:00 to 2021-11-06 00:00 as the pre-fetch period, and the pre-fetch time interval is recalculated based on 24*(1+0.5*2)*60 / 1000=2.88 (minutes), and the corresponding pre-fetched data is queried. The same can be achieved for reduction or enlargement, which will not be repeated here.
[0119] After caching the prefetched data based on the above method, if an instruction is received to instruct the target curve to shift 30% to the left, since the shift ratio is smaller than the prefetch ratio, it can be determined that the cached prefetched data can meet the data required to generate the shifted curve. Therefore, the target curve can be updated directly based on the prefetched data without having to re-request data from the background.
[0120] Optionally, the above-mentioned prefetch ratio can be actively input or selected by the user, or it can be preset by default in the software; only the overall prefetch ratio can be set, or the enlargement prefetch ratio, reduction prefetch ratio, left shift prefetch ratio, right shift prefetch ratio, etc. can be set separately. This embodiment does not limit this.
[0121] As a preferred embodiment, after the target curve is updated based on the prefetched data, the prefetch ratio can be further updated based on any one of the above-mentioned translation ratio, magnification ratio, and reduction ratio as the updated prefetch ratio, and the updated prefetch time interval and the updated prefetch period are re-determined based on the updated prefetch ratio. A storage time interval matching the updated prefetch time interval is determined from the data storage area, and the updated prefetch data of the target variable under the storage time interval and prefetch period is queried.
[0122] In this embodiment, the pre-fetch ratio setting can be intelligently updated based on the user's previous zoom or pan operation to further improve query efficiency and optimize user experience. For example, upon receiving a user instruction to shift the target curve 80% to the right, the pre-fetch ratio can be set to 80% accordingly, so that the software can dynamically adapt to the user's operating habits by performing data pre-fetching operations at an additional 80% expansion ratio when querying data from the background. Preferably, the pre-fetch ratio can also be updated based on the user's recent multiple zoom or pan operations. For example, after the user performs operations of shifting 20%, 70%, and 30% to the left, the average of the shift ratios in the three operations can be taken as the pre-fetch ratio, that is, the pre-fetch ratio is updated to 40%, and so on. This embodiment does not limit this.
[0123] Optionally, whenever the target curve is updated and before the software receives subsequent data query instructions from the user, it can actively send a query request to the background based on the current display time range of the curve combined with the pre-fetch ratio to supplement the cached data for the adjusted curve, so that subsequent users can continue to display the curve based on the cached data after panning or zooming the curve, thereby improving query efficiency.
[0124] So far, combined Figure 3 This completes the introduction to the above specific embodiments.
[0125] The above describes the method provided in the embodiment of the present application. The following describes the device provided in the embodiment of the present application:
[0126] See also Figure 4 , Figure 4 This is a diagram of the device structure provided in the embodiment of this application. Figure 4 As shown, the device may include:
[0127] The instruction receiving unit 401 is configured to receive a data query instruction, wherein the data query instruction at least includes a query period and a variable identifier indicating a target variable to be queried;
[0128] A time determination unit 402 is configured to determine a request time interval based on the time span of the query period and the pixel width of the curve;
[0129] A data query unit 403 is configured to determine, from a data storage area, a storage time interval that matches the request time interval as a target storage time interval, and query target data of the target variable during the query period and the target storage time interval; wherein the data storage area pre-stores data of the target variable during at least two storage time intervals;
[0130] The curve generating unit 404 is configured to generate a target curve based on the target data; wherein the number of pixels of the target curve is equal to the pixel width of the curve, and the time span between a preset number of pixels in the target curve matches the requested time interval.
[0131] In a possible implementation, in the data query unit 403, the storage time interval includes a sampling time interval when performing data sampling and / or a statistical time interval when performing data statistics;
[0132] The data storage area pre-stores data of the target variable at at least two storage time intervals, including:
[0133] The data storage area pre-stores the original sampled data of the target variable at at least one sampling time interval, and statistical data obtained by performing statistics on the original sampled data at at least one statistical time interval; or
[0134] The data storage area stores in advance the original sampling data of the target variable at at least two sampling time intervals; or,
[0135] The data storage area pre-stores statistical data obtained by performing statistics on the original sampling data at at least two statistical time intervals for the target variable.
[0136] In a possible implementation, in the data query unit 403, determining the storage time interval that matches the request time interval from the data storage area as the target storage time interval includes:
[0137] All storage time intervals with a time interval less than or equal to the request time interval are selected from the data storage area, and the storage time interval with the largest time interval is selected as the target storage time interval.
[0138] In a possible implementation, in the data query unit 403 , the statistical data at any statistical time interval in the data storage area is determined based on the original sampling data, or based on other statistical data with a time interval shorter than the own statistical time interval.
[0139] In a possible implementation, in the data query unit 403, querying the target data of the target variable in the query period and the target storage time interval includes:
[0140] Determining a ratio of the request time interval to the target storage time interval;
[0141] According to the ratio, all or part of the data of the target variable in the query period and the target storage time interval is obtained as the target data.
[0142] In a possible implementation, in the data query unit 403 , the data of the target variable at different storage time intervals are independently stored in different data storage sub-areas;
[0143] After determining the ratio of the request time interval to the target storage time interval, the data query unit 403 is further configured to:
[0144] determining a target data storage sub-area for the target variable at the target storage time interval;
[0145] All or part of the data is acquired from the target data storage sub-area according to the ratio as the target data.
[0146] In a possible implementation, in the data query unit 403, the data query instruction further includes a prefetch ratio. After determining the request time interval based on the time span of the query period and the pixel width of the curve, the data query unit 403 is further configured to:
[0147] Determining a prefetching time interval according to the requesting time interval and the prefetching ratio, wherein the prefetching time interval is less than the requesting time interval;
[0148] Determining a prefetch period based on the query period and the prefetch ratio, wherein the time span of the prefetch period is greater than the time span of the query period;
[0149] Determine a storage time interval that matches the pre-fetch time interval from the data storage area, and query pre-fetch data of the target variable in the storage time interval and the pre-fetch period;
[0150] When receiving an external instruction for instructing the target curve to translate or scale, if the curve change ratio indicated by the external instruction matches the pre-fetch ratio, updating the target curve according to the pre-fetch data;
[0151] Among them, the above-mentioned curve change ratio includes any one of the translation ratio, magnification ratio, and reduction ratio; the above-mentioned curve change ratio matches the above-mentioned pre-fetch ratio, including: the above-mentioned translation ratio is less than or equal to the above-mentioned pre-fetch ratio, or the above-mentioned magnification ratio is less than or equal to the above-mentioned pre-fetch ratio, or the above-mentioned reduction ratio is greater than or equal to the above-mentioned pre-fetch ratio.
[0152] In a possible implementation, in the data query unit 403, after updating the target curve according to the pre-fetched data, the data query unit 403 is further configured to:
[0153] updating the prefetch ratio as an updated prefetch ratio according to any one of the translation ratio, the magnification ratio, and the reduction ratio, and determining an updated prefetch time interval and an updated prefetch period according to the updated prefetch ratio;
[0154] Determine a storage time interval that matches the updated pre-fetch time interval from the data storage area, and query updated pre-fetch data of the target variable in the storage time interval and the pre-fetch period.
[0155] So far, completed Figure 4 Structural description of the device shown.
[0156] The present application also provides Figure 4 The hardware structure of the device shown. Figure 5 , Figure 5 This is a structural diagram of an electronic device provided in an embodiment of the present application. Figure 5 As shown, the hardware structure may include: a processor and a machine-readable storage medium, the machine-readable storage medium storing machine-executable instructions that can be executed by the processor; the processor is used to execute the machine-executable instructions to implement the method disclosed in the above example of this application.
[0157] Based on the same application concept as the above method, an embodiment of the present application also provides a machine-readable storage medium, on which a number of computer instructions are stored. When the computer instructions are executed by a processor, the method disclosed in the above example of the present application can be implemented.
[0158] Exemplarily, the machine-readable storage medium may be any electronic, magnetic, optical, or other physical storage device that may contain or store information, such as executable instructions, data, and the like. For example, the machine-readable storage medium may be: RAM (Random Access Memory), volatile memory, non-volatile memory, flash memory, a storage drive (such as a hard disk drive), a solid-state drive, any type of storage disk (such as a CD, DVD, etc.), or similar storage media, or a combination thereof.
[0159] The systems, devices, modules, or units described in the above embodiments may be implemented by computer chips or entities, or by products having certain functions. A typical implementation device is a computer, which may be in the form of a personal computer, laptop computer, cellular phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email transceiver, game console, tablet computer, wearable device, or any combination of these devices.
[0160] For the convenience of description, the above devices are described as being divided into various units according to their functions. Of course, when implementing this application, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0161] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the embodiments of the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0162] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the steps in the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0163] Furthermore, these computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0164] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable device to implement the process. Figure 1 a process or multiple processes and / or boxes Figure 1 The steps for the function specified in one or more boxes.
[0165] The foregoing is merely an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application should all be included within the scope of the claims of the present application.
Claims
1. A data query method, characterized in that: The method comprises: receiving a data query instruction, wherein the data query instruction includes at least a query period and a variable identifier for indicating a target variable to be queried; Determining a request time interval based on the time span of the query period and the pixel width of the curve; Determining, from a data storage area, a storage time interval that matches the request time interval as a target storage time interval, and determining a ratio between the request time interval and the target storage time interval; obtaining, based on the ratio, all or part of the data of the target variable during the query period and the target storage time interval as target data; wherein the data storage area pre-stores data of the target variable during at least two storage time intervals; A target curve is generated based on the target data; wherein the number of pixels of the target curve is equal to the pixel width of the curve, and the time span between a preset number of pixels in the target curve matches the request time interval.
2. The method according to claim 1, characterized in that The storage time interval includes a sampling time interval when performing data sampling, and / or a statistical time interval when performing data statistics; The data storage area pre-stores data of the target variable at at least two storage time intervals, including: The data storage area pre-stores original sampled data of the target variable at at least one sampling time interval, and statistical data obtained by performing statistics on the original sampled data at at least one statistical time interval; or The data storage area pre-stores original sampling data of the target variable at at least two sampling time intervals; or, The data storage area pre-stores statistical data obtained by performing statistics on the original sampling data at at least two statistical time intervals for the target variable.
3. The method according to claim 1 or 2, characterized in that The determining, from the data storage area, a storage time interval that matches the request time interval as a target storage time interval includes: All storage time intervals with a time interval less than or equal to the request time interval are selected from the data storage area, and the storage time interval with the largest time interval is selected as the target storage time interval.
4. The method according to claim 2, characterized in that The statistical data at any statistical time interval in the data storage area is determined based on the original sampling data, or based on other statistical data with a time interval shorter than the own statistical time interval.
5. The method according to claim 1, wherein The data of the target variable at different storage time intervals are stored independently in different data storage sub-areas; After determining the ratio of the request time interval to the target storage time interval, the method further includes: determining a target data storage sub-region for the target variable at the target storage time interval; All or part of the data is acquired from the target data storage sub-area according to the ratio as the target data.
6. The method according to claim 1, characterized in that The data query instruction further includes a pre-fetch ratio. After determining the request time interval based on the time span of the query period and the pixel width of the curve, the method further includes: determining a prefetch time interval according to the request time interval and the prefetch ratio, wherein the prefetch time interval is less than the request time interval; Determining a prefetch period according to the query period and the prefetch ratio, wherein a time span of the prefetch period is greater than a time span of the query period; Determining a storage time interval that matches the pre-fetch time interval from the data storage area, and querying pre-fetched data of the target variable in the storage time interval and the pre-fetch period; When an external instruction for instructing the target curve to translate or scale is received, if the curve change ratio indicated by the external instruction matches the pre-fetch ratio, updating the target curve according to the pre-fetched data; Among them, the curve change ratio includes any one of a translation ratio, an enlargement ratio, and a reduction ratio; the curve change ratio matches the pre-fetch ratio, including: the translation ratio is less than or equal to the pre-fetch ratio, or the enlargement ratio is less than or equal to the pre-fetch ratio, or the reduction ratio is greater than or equal to the pre-fetch ratio.
7. The method according to claim 6, characterized in that After updating the target curve according to the pre-fetched data, the method further includes: updating the prefetch ratio according to any one of the translation ratio, the magnification ratio, and the reduction ratio as an updated prefetch ratio, and determining an updated prefetch time interval and an updated prefetch period according to the updated prefetch ratio; Determine a storage time interval that matches the updated pre-fetch time interval from the data storage area, and query updated pre-fetch data of the target variable under the storage time interval and the pre-fetch period.
8. A data query device, characterized in that: The device comprises: An instruction receiving unit, configured to receive a data query instruction, wherein the data query instruction includes at least a query period and a variable identifier for indicating a target variable to be queried; a time determination unit, configured to determine a request time interval according to a time span of the query period and a pixel width of the curve; a data query unit, configured to determine, from a data storage area, a storage time interval that matches the request time interval as a target storage time interval, determine a ratio between the request time interval and the target storage time interval, and obtain, based on the ratio, all or part of the data of the target variable during the query period and the target storage time interval as target data; wherein the data storage area pre-stores data of the target variable during at least two storage time intervals; A curve generating unit is used to generate a target curve based on the target data; wherein the number of pixel points of the target curve is equal to the pixel width of the curve, and the time span between a preset number of pixel points in the target curve matches the request time interval.
9. An electronic device, characterized in that: The electronic device includes: a processor and a machine-readable storage medium; The machine-readable storage medium stores machine-executable instructions that can be executed by the processor; The processor is configured to execute machine-executable instructions to implement the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Method and system of quickly drawing large data volume of curves in geological exploration
CN106570049A
Data processing apparatus, data processing method, and storage medium storing program
US20220079498A1