Dynamic data sampling method and system, computer equipment and computer program product
By dynamically updating the sampling mapping relationship configuration and data table information, the problem of reduced storage efficiency and query efficiency caused by multiplication of sampled data in traditional power systems is solved, and more efficient storage space utilization and data table activation are achieved.
Patent Information
- Application Number
- CN202411748488.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-29
- Publication Date
- 2025-03-21
AI Technical Summary
The storage efficiency and query efficiency of historical data in traditional power systems are greatly reduced due to the doubling of sampled data, resulting in the generation of redundant columns and waste of storage space.
Data sampling and storage are realized by dynamically updating the sampling mapping relationship configuration and enabled data table information according to changes in the sampling configuration information. The specific steps include obtaining the target signal set to be sampled and the configured sampling mapping relationship set, updating the sampling mapping configuration information, and sampling and storing data based on the updated configuration information and data table information.
Improve the efficiency of storage space utilization and data table activation efficiency, avoiding the generation of redundant columns and waste of storage space.
Smart Images

Figure CN119669227A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the technical field of substation automation, and in particular, relates to a data dynamic sampling method, system, computer equipment and computer program product. Background Art
[0002] Since the traditional way of storing historical data of power systems uses relational databases, the storage efficiency and query efficiency are greatly reduced as the sampling data doubles during continuous expansion. Therefore, most power monitoring system manufacturers abandon relational databases and gradually turn to time series databases to store large amounts of historical sampling data.
[0003] At present, most power monitoring system manufacturers store historical sampling data by creating a fixed number of super tables / sub-tables based on business volume, and then use a one-to-one "sampling point-column" method to store them. As a result, when the sampling point is deleted, the corresponding column remains idle, and when a new sampling point is added, storage starts from a new column. In extreme cases, after a large number of sampling points are deleted between different sampling tasks, a large number of redundant columns may be generated, wasting a lot of storage space. Summary of the invention
[0004] In view of this, the embodiments of the present application provide a data dynamic sampling method, system, computer device and computer program product to dynamically update the sampling mapping relationship configuration and enabled data table information according to the changes in the sampling configuration information, and then perform data sampling and storage, which can not only improve the storage space utilization efficiency, but also improve the data table activation efficiency.
[0005] A first aspect of an embodiment of the present application provides a data dynamic sampling method, comprising:
[0006] Acquire a first target signal set to be sampled according to the sampling configuration information;
[0007] According to the current sampling mapping configuration information, obtaining a second target signal set having a configured sampling mapping relationship;
[0008] When the first target signal set and the second target signal set are different, updating the current sampling mapping configuration information to obtain new sampling mapping configuration information;
[0009] In the process of updating the current sampling mapping configuration information, the currently enabled data table information is updated to obtain new enabled data table information;
[0010] Data sampling is performed based on the new sampling mapping configuration information and the new enabled data table information, and the sampled data is stored.
[0011] In an implementation manner of the first aspect, updating the current sampling mapping configuration information to obtain new sampling mapping configuration information includes:
[0012] Marking a second target signal that meets a first preset condition as a target signal to be deleted, wherein the first preset condition is that the second target signal is in the second target signal set and is not in the first target signal set;
[0013] Deleting the sampling mapping configuration record of each target signal to be deleted in the current sampling mapping configuration information;
[0014] Marking a first target signal that meets a second preset condition as a target signal to be added, wherein the second preset condition is that the signal is in the first target signal set and is not in the second target signal set;
[0015] A sampling mapping configuration record is added in the current sampling mapping configuration information for each of the target signals to be added.
[0016] In an implementation manner of the first aspect, adding a sampling mapping configuration record for each target signal to be added in the current sampling mapping configuration information includes:
[0017] Determine the signal identifier, signal name and signal type of each sampling mapping configuration record corresponding to the target signal to be added;
[0018] Based on the signal type and sampling period of each target signal to be added, configure a target super table for the sampling mapping configuration record corresponding to each target signal to be added;
[0019] Based on the interval identifier, the device identifier and the target super table of each target signal to be added, a target sub-table is configured for the sampling mapping configuration record corresponding to each target signal to be added;
[0020] sequentially configuring column indexes for the sampling mapping configuration records corresponding to each group of target signals to be added; the group of target signals to be added are target signals to be added that are configured with the same target super table and the same target sub-table;
[0021] The corresponding sampling mapping configuration record is added for each target signal to be added in the current sampling mapping configuration information to obtain new sampling mapping configuration information.
[0022] In an implementation of the first aspect, configuring a target super table for recording the sampling mapping configuration corresponding to each target signal to be added based on the signal type and sampling period of each target signal to be added includes:
[0023] Searching a first super table in currently enabled data table information based on the signal type and sampling period of the target signal to be added;
[0024] If the first super table is found, configuring the first super table as the target super table of the sampling mapping configuration record corresponding to the target signal to be added;
[0025] If the first super table is not found, a new super table is enabled according to the signal type of the signal to be added, and is configured as the target super table of the sampling mapping configuration record corresponding to the target signal to be added.
[0026] In an implementation of the first aspect, sequentially configuring column indexes for the sampling mapping configuration records corresponding to each group of target signals to be added includes:
[0027] Determine a column usage identifier stream for each group of target signals to be added according to the target super table and the target sub-table of the sampling mapping configuration records corresponding to each group of target signals to be added;
[0028] Starting from the position of the first identifier of the duty identifier in the column usage identifier stream, column indexes are sequentially configured for the sampling mapping configuration records corresponding to each group of target signals to be added.
[0029] In an implementation manner of the first aspect, in the process of updating the current sampling mapping configuration information, updating the currently enabled data table information to obtain new enabled data table information includes:
[0030] If a target sub-table is newly added in the sampling mapping configuration information, then a new activation record of the target sub-table is added to the currently activated data table information;
[0031] Confirming the target sub-table and column index corresponding to each of the target signals to be deleted;
[0032] Based on the target sub-table and the column index, updating the column usage identifier stream of the target sub-table, setting the corresponding bit sequence to an occupied identifier, and accumulating the number of deleted columns of the target sub-table from 0;
[0033] According to the number of each group of signals to be added, the column usage identifier stream of the target sub-table corresponding to each group of target signals to be added is updated, and the corresponding bit sequence is set to the occupied identifier; the group of signals to be added is configured with the same target super-table and the same target sub-table;
[0034] updating the number of used columns of each target sub-table in the currently enabled data table information according to the number of deleted columns of each target sub-table and the number of a group of to-be-added signals corresponding to each target sub-table;
[0035] The updating of the currently enabled data table information is completed to obtain new enabled data table information.
[0036] In an implementation manner of the first aspect, the performing data sampling based on the new sampling mapping configuration information and the new enabled data table information, and storing the sampled data includes:
[0037] When the timer is started, based on the new sampling mapping configuration information and the new enabled data table information, the target signal whose sampling period can divide the time of the timer is sampled and stored at the position corresponding to the column index in the target subtable of the corresponding target supertable.
[0038] A second aspect of an embodiment of the present application provides a data dynamic sampling system, including:
[0039] A first target signal module, used to obtain a first target signal set to be sampled according to sampling configuration information;
[0040] A second target signal module, configured to obtain a second target signal set having a configured sampling mapping relationship according to current sampling mapping configuration information;
[0041] A first updating module, configured to update the current sampling mapping configuration information to obtain new sampling mapping configuration information when the first target signal set and the second target signal set are different;
[0042] A second updating module, configured to update the currently enabled data table information in the process of updating the current sampling mapping configuration information to obtain new enabled data table information;
[0043] The sampling and storage module is used to perform data sampling based on the new sampling mapping configuration information and the new enabled data table information, and store the sampled data.
[0044] A third aspect of an embodiment of the present application provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method described in the first aspect when executing the computer program.
[0045] A fourth aspect of the embodiments of the present application provides a computer program product, including a computer program, wherein when the computer program is executed, the method described in the first aspect is executed.
[0046] The beneficial effect of the first aspect of the embodiment of the present application is: by obtaining a first target signal set to be sampled according to the sampling configuration information, and obtaining a second target signal set with a configured sampling relationship according to the current sampling configuration information, when the first target signal set and the second target signal set are different, the current sampling mapping configuration information is updated, and then based on the updated sampling mapping configuration information and the currently enabled data table information, the enabled data table information is updated; after the above update is completed, data sampling is performed according to the updated sampling mapping configuration information and the enabled data table information, and the sampled data is stored, so as to dynamically update the sampling mapping configuration information and the enabled data table information according to the changes in the sampling configuration information, and then perform data sampling and storage, which can not only improve the utilization efficiency of the storage space, but also improve the enabling efficiency of the data table.
[0047] It can be understood that the beneficial effects of the second to fourth aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0049] Figure 1 It is a schematic diagram of the implementation process of the data dynamic sampling method provided in the embodiment of the present application;
[0050] Figure 2 It is an entity relationship diagram of the data dynamic sampling method provided in the embodiment of the present application;
[0051] Figure 3 It is a schematic diagram of a data dynamic sampling system provided in an embodiment of the present application;
[0052] Figure 4 is an example diagram of a computer device provided in an embodiment of the present application;
[0053] Figure 5 It is a schematic diagram of a computer program product provided in an embodiment of the present application. DETAILED DESCRIPTION
[0054] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0055] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.
[0056] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0057] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.
[0058] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0059] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0060] The embodiment of the present application provides a data dynamic sampling method, which is used to update the sampling mapping relationship configuration and the enabled data table information according to the change of the sampling configuration information, and then perform data sampling and storage, which not only improves the utilization efficiency of the storage space, but also improves the efficiency of enabling the data table. The data dynamic sampling method provided by the embodiment of the present application obtains the first target signal set to be sampled according to the sampling configuration information, and obtains the second target signal set of the configured sampling relationship according to the current sampling configuration information. When the first target signal set and the second target signal set are different, the current sampling mapping configuration information is updated, and then based on the updated sampling mapping configuration information and the currently enabled data table information, the enabled data table information is updated. After the above update is completed, data sampling is performed according to the updated sampling mapping configuration information and the enabled data table information, and the sampled data is stored, so as to dynamically update the sampling mapping configuration information and the enabled data table information according to the change of the sampling configuration information, and then perform data sampling and storage, which can not only improve the utilization efficiency of the storage space, but also improve the efficiency of enabling the data table.
[0061] like Figure 1 As shown, the embodiment of the present application provides a data dynamic sampling method, including:
[0062] Step S11: Acquire a first target signal set to be sampled according to sampling configuration information.
[0063] In the application, sampling configuration is performed automatically or manually based on the sampling flag according to the sampling task. For example, the sampling flag of the signal to be sampled in this sampling task in the sampling configuration information is set to yes, and the sampling flags of the remaining signals are set to no. Then, according to the sampling flags of each signal, the first target signal set to be sampled is obtained from the sampling configuration information. The first target signal set includes multiple signals to be sampled.
[0064] In the application, the sampling configuration information includes a sampling configuration table, which includes signal identification, signal name, signal type, sampling identification, sampling period, interval identification, and device identification. The signal identification is the unique identification of the signal; the signal type includes telemetry, remote sensing, and remote pulse; the sampling identification indicates whether the signal needs to be sampled; the interval is part of the substation and is a level in the power system automation structure. The interval ID uniquely identifies the interval described by the signal; the device refers to the identification of the power secondary equipment. An interval can include multiple devices, and a device can have multiple signals.
[0065] As shown in Table 1, an example of a sampling configuration table provided in an embodiment of the present application is:
[0066]
[0067] Step S12: acquiring a second target signal set having a configured sampling mapping relationship according to the current sampling mapping configuration information.
[0068] In the application, the current sampling mapping configuration information includes the sampling mapping relationship of the signal to be sampled by the most recent sampling task. The sampling mapping relationship includes the data table information storing the sampling data of each signal, such as the super table, sub-table and column position in the sub-table storing each sampled signal. If the sampling task is executed for the first time, the sampling mapping configuration information is empty.
[0069] In the application, the data table storing the sampled data of each signal is a time series database type.
[0070] Step S13: When the first target signal set and the second target signal set are different, update the current sampling mapping configuration information to obtain new sampling mapping configuration information.
[0071] In applications, the signals that need to be sampled in each sampling task may change. For example, there are new sampling signals, and there is no corresponding sampling mapping relationship in the sampling mapping configuration information, and the sampling mapping relationship needs to be configured for the new sampling signal; or this sampling task reduces some signals that need to be sampled compared to the previous sampling task, and there are redundant sampling mapping relationships in the sampling mapping configuration information, resulting in the storage location in the corresponding data table being occupied but no actual data is stored.
[0072] In applications, each sampling task may have only new signals to be sampled, or only some signals sampled last time are removed, or both.
[0073] It can be understood that, for the first sampling task, the sampling mapping configuration information is empty, and all signals to be sampled are newly added signals to be sampled.
[0074] Step S14: in the process of updating the current sampling mapping configuration information, the currently enabled data table information is updated to obtain new enabled data table information.
[0075] In the application, as shown in Table 2, the enabled data table information includes the super table identifier, the sub table identifier, the signal type, the sampling period, the number of used columns, and the column usage identifier stream. The number of used columns is the total number of used columns in the sub table under the super table, and the column usage identifier stream is used to indicate the distribution of used columns.
[0076]
[0077] In the application, the enabled data table information includes the information of the enabled super table and the sub-tables in the super table (that is, the super table and sub-table sub-information that are not empty), such as the super table name and the sub-table name; and the occupancy of the sub-tables in each super table, such as the total number of occupied columns and the location information of the specific occupied columns.
[0078] Step S15: performing data sampling based on the new sampling mapping configuration information and the new enabled data table information, and storing the sampled data.
[0079] In the application, the signal to be sampled in this sampling task is sampled based on the new sampling mapping configuration information and the new enabled data table information, and the sampled data is stored in the corresponding data table.
[0080] In one embodiment, updating the current sampling mapping configuration information to obtain new sampling mapping configuration information includes:
[0081] Step S131, marking a second target signal that meets a first preset condition as a target signal to be deleted, wherein the first preset condition is that the second target signal is in a set of the second target signals and is not in a set of the first target signals;
[0082] Step S132: Delete the sampling mapping configuration record of each target signal to be deleted in the current sampling mapping configuration information.
[0083] In the application, the second target signal set includes signals for which sampling mapping relationships have been configured in the most recent sampling task. By comparing the first signal set and the second signal set, the signal to be deleted that meets the first preset condition can be obtained. The signal to be deleted is not a signal that needs to be sampled in this sampling task, so its sampling mapping configuration record in the sampling mapping configuration information is deleted to release the space occupied by its sampling mapping relationship, such as the data column in the subtable, and reduce redundancy in data storage.
[0084] Step S133, marking the first target signal that meets the second preset condition as a target signal to be added, wherein the second preset condition is that the first target signal is in the first target signal set and is not in the second target signal set;
[0085] Step S134: adding a sampling mapping configuration record for each of the target signals to be added in the current sampling mapping configuration information.
[0086] In the application, the first signal set includes the signal to be sampled, and by comparing the first signal set and the second signal set, the signal to be added that meets the second preset condition can be obtained. The signal to be added is a signal to be sampled that is newly added to this sampling task compared to the previous sampling task. There is no sampling mapping configuration record containing the corresponding sampling mapping relationship in the sampling mapping configuration information. In order to support subsequent sampling and store the sampled data, it is necessary to configure the sampling mapping relationship for the signal to be added, and add the corresponding sampling mapping configuration record in the sampling mapping configuration information.
[0087] In the application, first delete the sampling mapping configuration information, and then configure the sampling mapping.
[0088] In one embodiment, the step S134, adding a sampling mapping configuration record for each target signal to be added in the current sampling mapping configuration information, includes:
[0089] Step S1341: Determine the signal identifier, signal name and signal type of each sampling mapping configuration record corresponding to the target signal to be added.
[0090] In the application, the sampling mapping configuration information includes a sampling mapping configuration table, which includes multiple sampling mapping configuration records, each of which indicates a sampling mapping relationship of a signal. Each sampling mapping configuration record includes fields such as signal identifier, signal name, target super table, target sub table, column index and signal type.
[0091] As shown in Table 3, an example of a sampling mapping configuration table provided in an embodiment of the present application is as follows:
[0092]
[0093] In the application, the signal identifier, signal name and signal type of each sampling mapping configuration record corresponding to the target signal to be added can be directly queried in the sampling configuration table according to the signal identifier of the signal to be added to obtain the corresponding signal identifier, signal name and signal type.
[0094] Step S1342: configuring a target super table for a sampling mapping configuration record corresponding to each target signal to be added based on the signal type and sampling period of each target signal to be added.
[0095] In the application, according to the signal identifier of the target signal to be added, the corresponding signal type and sampling period are obtained from the sampling configuration table, and the sampling mapping configuration record corresponding to each target signal to be added is configured for the target super table according to the signal type and sampling period. In the application, each super table and its sub-tables correspond to a unique signal type and a sampling period.
[0096] Step S1343: configuring a target sub-table for the sampling mapping configuration record corresponding to each target signal to be added based on the interval identifier, the device identifier and the target super-table of each target signal to be added.
[0097] In the application, a target sub-table is configured for each target signal to be added based on the interval identifier, device identifier and target super-table of each target signal to be added, so that signals under the same sub-table come from the same device in the same interval.
[0098] Step S1344, sequentially configuring column indexes for the sampling mapping configuration records corresponding to each group of target signals to be added; the group of target signals to be added are target signals to be added that are configured with the same target super table and the same target sub-table.
[0099] In the application, the column index is used to indicate the column position sequence of the signal in the sub-table collection amount. Each group of target signals to be added is stored in the same target sub-table. By sequentially configuring the column index for each group of target signals to be added, the uniqueness of the column position sequence indicated by the column index can be guaranteed.
[0100] Step S1345: Add the corresponding sampling mapping configuration record for each target signal to be added in the current sampling mapping configuration information to obtain new sampling mapping configuration information.
[0101] In the application, after determining the signal identifier, signal name, signal type, target super table, target subtable and column index in the sampling mapping configuration record of each target signal to be added, the sampling mapping configuration information is updated by adding the sampling mapping configuration record to the sampling mapping configuration information.
[0102] In one embodiment, the step S1342, configuring a target super table for recording the sampling mapping configuration corresponding to each target signal to be added based on the signal type and sampling period of each target signal to be added, includes:
[0103] Step S13421, searching a first super table in currently enabled data table information based on the signal type and sampling period of the target signal to be added;
[0104] In an application, a super table corresponds to a unique combination of signal type and sampling period.
[0105] Step S13422: If the first super table is found, the first super table is configured as a target super table for the sampling mapping configuration record corresponding to the target signal to be added.
[0106] In the application, the super table can be determined according to the signal type and sampling period. Since the signal type and sampling period of the signal to be sampled in the current sampling task are the same as those of the signal to be sampled in the previous sampling task, the super table corresponding to the same signal type and sampling period has been enabled. Therefore, if the first super table can be found, the first super table is configured as the target super table to which the sampling mapping configuration record corresponding to the target signal is to be added.
[0107] Step S13423: If the first super table is not found, a new super table is enabled according to the signal type of the signal to be added, and is configured as the target super table of the sampling mapping configuration record corresponding to the target signal to be added.
[0108] In the application, if the first super table is not found, a new super table is activated, the signal type corresponding to the super table is the signal type of the signal to be added, and the sampling period corresponding to the super table is the sampling period of the signal to be added.
[0109] In the application, when multiple signals to be added have the same signal type and the same sampling period, after a new super table is enabled, it is configured as the target super table for multiple signals to be added. In specific implementation, by matching the signal type and sampling period of the signals to be added, the signals with the same signal type and sampling period can be classified into one type of signals, and each type of signal only configures a super table once according to the signal type and sampling period.
[0110] In one embodiment, the step S1344 sequentially configures column indexes for each group of sampling mapping configuration records corresponding to the target signal to be added, including:
[0111] Step S13441, according to the target super table and the target sub table of the sampling mapping configuration record corresponding to each group of target signals to be added, determine the column usage identifier stream of each group of target signals to be added. Step S13442, starting from the position of the first identifier of the duty identifier in the column usage identifier stream, sequentially configure column indexes for the sampling mapping configuration record corresponding to each group of target signals to be added.
[0112] In the application, according to the target super table and the target sub table, the column usage identifier stream can be obtained from the currently enabled data table information, and the duty identifier in the column usage identifier stream indicates that the column is not used. Starting from the position of the first identifier of the duty identifier in the column usage identifier stream, the column index is sequentially configured for each group of sampling mapping configuration records corresponding to the target signal to be added, so as to configure a unique column index for each signal to be added.
[0113] In one embodiment, in step S14, in the process of updating the current sampling mapping configuration information, updating the currently enabled data table information to obtain new enabled data table information includes:
[0114] Step S141: If a target sub-table is newly added in the sampling mapping configuration information, a new activation record of the target sub-table is added to the currently activated data table information.
[0115] In the application, the newly added target subtable in the sampling mapping configuration information is a subtable under the newly enabled super table, and an enabling record of the newly added target subtable is added to the enabled data table information.
[0116] Step S142, confirming the target sub-table and column index corresponding to each of the target signals to be deleted.
[0117] Step S143: based on the target sub-table and the column index, update the column usage flag stream of the target sub-table, set the corresponding bit sequence to the occupancy flag, and accumulate the number of deleted columns of the target sub-table from 0.
[0118] In applications, the occupancy flag is used to indicate that the column of the corresponding bit sequence is not occupied, and the occupation flag can be 0 or other identifiers different from the occupation flag.
[0119] In the application, after deleting the sampling mapping configuration record of each target signal to be deleted in the current sampling mapping configuration information in step S132, steps S142 and S143 are executed to timely update the column information of the enabled data table that is changed from an occupied flag to an empty flag after deleting the sampling configuration record of the target signal to be deleted, so that the subsequent signals to be added can use the columns in the enabled data table in a front-end principle. The number of deleted columns obtained by accumulating the number of deleted columns of the target sub-table starting from 0 is the total number of columns.
[0120] Step S144, according to the number of each group of signals to be added, update the column usage identifier stream of the target sub-table corresponding to each group of target signals to be added, and set the corresponding bit sequence to the occupied identifier; the group of signals to be added is configured with the same target super-table and the same target sub-table.
[0121] In an application, the occupied flag is used to indicate that a column of a corresponding bit sequence is occupied. The occupied flag can be set to 1, or an identifier different from the vacant flag.
[0122] Step S145 , updating the number of used columns of each target sub-table in the currently enabled data table information according to the number of deleted columns of each target sub-table and the number of a group of to-be-added signals corresponding to each target sub-table.
[0123] In the application, the number of used columns of each target subtable is subtracted from the number of deleted columns, and then added with the number of signals in a group of to-be-added signals corresponding to the target subtable, so as to update the number of used columns of each target subtable.
[0124] In the application, in step S134, in the process of adding a sampling mapping configuration record for each target signal to be added in the current sampling mapping configuration information, after completing the sampling mapping configuration of each group of signals to be added, the above steps S144 and S145 are executed.
[0125] Step S146, completing the update of the currently enabled data table information to obtain new enabled data table information. In one embodiment, the step S15, performing data sampling based on the new sampling mapping configuration information and the new enabled data table information, and storing the sampled data, includes:
[0126] Step S151, when the timer is started, based on the new sampling mapping configuration information and the new enabled data table information, the target signal whose sampling period can divide the time of the timer is sampled, and the sampled data is stored in the position corresponding to the column index in the target subtable of the corresponding target supertable.
[0127] In the application, the timer is started, and then based on the sampling mapping configuration information and the enabled data table information, the target signal whose sampling period can divide the time of the timer is sampled. As the timer counts, multiple sampling of the target signal in each sampling period is achieved, and the sampled data is stored in the position corresponding to the column index of the corresponding target subtable.
[0128] In the application, the target signals collected by the power collection device are obtained through the Supervisory Control and Data Acquisition (SCADA) system, such as the voltage, current, temperature and other target signals of transformers, busbars, switches, knife switches and other equipment.
[0129] In this application, the target subtable is a type of time series database that records data in chronological order, including timestamp, collection amount (each collection signal), interval identifier and device identifier, as shown in Table 4:
[0130]
[0131] like Figure 2As shown, it is an entity relationship (ER, Entity-Relationship) diagram of the data dynamic sampling method provided in an embodiment of the present application, wherein the rectangular box is the entity, the elliptical box is the attribute of the entity, the red oval is the primary key identifier, and the blue oval is the foreign key identifier.
[0132] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0133] The present application also provides a data dynamic sampling system for executing the steps in the above data dynamic sampling method embodiment. The data dynamic sampling system can be a virtual appliance in a computer device, run by a processor of the computer device, or can be the computer device itself.
[0134] like Figure 3 As shown, the embodiment of the present application provides a data dynamic sampling system 300, including:
[0135] A first target signal module 301, configured to obtain a first target signal set to be sampled according to sampling configuration information;
[0136] The second target signal module 302 is used to obtain a second target signal set with a configured sampling mapping relationship according to the current sampling mapping configuration information;
[0137] A first updating module 303, configured to update the current sampling mapping configuration information to obtain new sampling mapping configuration information when the first target signal set and the second target signal set are different;
[0138] A second updating module 304 is used to update the currently enabled data table information to obtain new enabled data table information during the process of updating the current sampling mapping configuration information;
[0139] The sampling and storage module 305 is used to perform data sampling based on the new sampling mapping configuration information and the new enabled data table information, and store the sampled data.
[0140] In one embodiment, the first updating module 303 is used to:
[0141] Marking a second target signal that meets a first preset condition as a target signal to be deleted, wherein the first preset condition is that the second target signal is in the second target signal set and is not in the first target signal set;
[0142] Deleting the sampling mapping configuration record of each target signal to be deleted in the current sampling mapping configuration information;
[0143] Marking a first target signal that meets a second preset condition as a target signal to be added, wherein the second preset condition is that the signal is in the first target signal set and is not in the second target signal set;
[0144] A sampling mapping configuration record is added in the current sampling mapping configuration information for each of the target signals to be added.
[0145] In one embodiment, the first updating module 303 is used to:
[0146] Determine the signal identifier, signal name and signal type of each sampling mapping configuration record corresponding to the target signal to be added;
[0147] Based on the signal type and sampling period of each target signal to be added, configure a target super table for the sampling mapping configuration record corresponding to each target signal to be added;
[0148] Based on the interval identifier, the device identifier and the target super table of each target signal to be added, a target sub-table is configured for the sampling mapping configuration record corresponding to each target signal to be added;
[0149] sequentially configuring column indexes for the sampling mapping configuration records corresponding to each group of target signals to be added; the group of target signals to be added are target signals to be added that are configured with the same target super table and the same target sub-table;
[0150] The corresponding sampling mapping configuration record is added for each target signal to be added in the current sampling mapping configuration information to obtain new sampling mapping configuration information.
[0151] In one embodiment, the first updating module 303 is used to:
[0152] Searching a first super table in currently enabled data table information based on the signal type and sampling period of the target signal to be added;
[0153] If the first super table is found, configuring the first super table as the target super table of the sampling mapping configuration record corresponding to the target signal to be added;
[0154] If the first super table is not found, a new super table is enabled according to the signal type of the signal to be added, and is configured as the target super table of the sampling mapping configuration record corresponding to the target signal to be added.
[0155] In one embodiment, the first updating module 303 is used to:
[0156] Determine a column usage identifier stream for each group of target signals to be added according to the target super table and the target sub-table of the sampling mapping configuration records corresponding to each group of target signals to be added;
[0157] Starting from the position of the first identifier of the duty identifier in the column usage identifier stream, column indexes are sequentially configured for the sampling mapping configuration records corresponding to each group of target signals to be added.
[0158] In one embodiment, the second updating module 304 is used to:
[0159] If a target sub-table is newly added in the sampling mapping configuration information, then a new enabling record of the target sub-table is added to the currently enabled data table information; confirming the target sub-table and column index corresponding to each target signal to be deleted;
[0160] Based on the target sub-table and the column index, updating the used column usage identifier stream of the target sub-table, setting the corresponding bit sequence as the occupied identifier, and accumulating the number of deleted columns of the target sub-table from 0;
[0161] According to the number of each group of signals to be added, the used column usage identifier stream of the target sub-table corresponding to each group of target signals to be added is updated, and the corresponding bit sequence is set as the occupied identifier; the group of signals to be added is configured with the same target super-table and the same target sub-table;
[0162] updating the number of used columns of each target sub-table in the currently enabled data table information according to the number of deleted columns of each target sub-table and the number of a group of to-be-added signals corresponding to each target sub-table;
[0163] The updating of the currently enabled data table information is completed to obtain new enabled data table information.
[0164] In one embodiment, the sampling and storage module 305 is used to:
[0165] When the timer is started, based on the new sampling mapping configuration information and the new enabled data table information, the target signal whose sampling period can divide the time of the timer is sampled and stored at the position corresponding to the column index in the target subtable of the corresponding target supertable.
[0166] In applications, each module in the data dynamic sampling system may be a software program module, or may be implemented through different logic circuits integrated in a processor, or may be implemented through multiple distributed processors.
[0167] Figure 4 This is a schematic diagram of the structure of a computer device provided in one embodiment of the present application. Figure 4As shown, the computer device 4 of this embodiment includes: at least one processor 40 ( Figure 4 Only one is shown in the figure) a processor, a memory 41, and a computer program 42 stored in the memory 41 and executable on the at least one processor 40, and when the processor 40 executes the computer program 42, the steps in any of the above-mentioned data dynamic sampling method embodiments are implemented.
[0168] The computer device 4 may be a desktop computer, a notebook, a palm computer or other computing device. The computer device may include, but is not limited to, a processor 40 and a memory 41. Those skilled in the art will appreciate that Figure 4 It is only an example of the computer device 4 and does not constitute a limitation on the computer device 4. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, it may also include input and output devices, network access devices, etc.
[0169] The processor 40 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. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0170] In some embodiments, the memory 41 may be an internal storage unit of the computer device 4, such as a hard disk or memory of the computer device 4. In other embodiments, the memory 41 may also be an external storage device of the computer device 4, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the computer device 4. Further, the memory 41 may also include both an internal storage unit and an external storage device of the computer device 4. The memory 41 is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as the program code of the computer program, etc. The memory 41 may also be used to temporarily store data that has been output or is to be output.
[0171] It should be noted that the information interaction, execution process, etc. between the above-mentioned devices / units are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.
[0172] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0173] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the above-mentioned method embodiments can be implemented.
[0174] like Figure 5 As shown, an embodiment of the present application provides a computer program product 5, including a computer program 50. When the computer program 50 is executed, the data dynamic sampling method described above is executed.
[0175] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device that can carry the computer program code to the device / terminal device, a recording medium, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electric carrier signal, a telecommunication signal, and a software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.
[0176] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0177] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0178] In the embodiments provided in the present application, it should be understood that the disclosed data dynamic sampling system and method can be implemented in other ways. For example, the data dynamic sampling system embodiments described above are merely schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0179] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0180] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A data dynamic sampling method, characterized in that: include: Acquire a first target signal set to be sampled according to the sampling configuration information; According to the current sampling mapping configuration information, obtaining a second target signal set having a configured sampling mapping relationship; When the first target signal set and the second target signal set are different, updating the current sampling mapping configuration information to obtain new sampling mapping configuration information; In the process of updating the current sampling mapping configuration information, the currently enabled data table information is updated to obtain new enabled data table information; Data sampling is performed based on the new sampling mapping configuration information and the new enabled data table information, and the sampled data is stored.
2. The data dynamic sampling method according to claim 1, characterized in that: The updating of the current sampling mapping configuration information to obtain new sampling mapping configuration information includes: Marking a second target signal that meets a first preset condition as a target signal to be deleted, wherein the first preset condition is that the second target signal is in the second target signal set and is not in the first target signal set; Deleting the sampling mapping configuration record of each target signal to be deleted in the current sampling mapping configuration information; Marking a first target signal that meets a second preset condition as a target signal to be added, wherein the second preset condition is that the signal is in the first target signal set and is not in the second target signal set; A sampling mapping configuration record is added in the current sampling mapping configuration information for each of the target signals to be added.
3. The data dynamic sampling method according to claim 2, characterized in that: The adding a sampling mapping configuration record for each target signal to be added in the current sampling mapping configuration information includes: Determine the signal identifier, signal name and signal type of each sampling mapping configuration record corresponding to the target signal to be added; Based on the signal type and sampling period of each target signal to be added, configure a target super table for the sampling mapping configuration record corresponding to each target signal to be added; Based on the interval identifier, the device identifier and the target super table of each target signal to be added, a target sub-table is configured for the sampling mapping configuration record corresponding to each target signal to be added; sequentially configuring column indexes for the sampling mapping configuration records corresponding to each group of target signals to be added; the group of target signals to be added are target signals to be added that are configured with the same target super table and the same target sub-table; The corresponding sampling mapping configuration record is added for each target signal to be added in the current sampling mapping configuration information to obtain new sampling mapping configuration information.
4. The data dynamic sampling method according to claim 3, characterized in that: The configuring a target super table for recording the sampling mapping configuration corresponding to each target signal to be added based on the signal type and sampling period of each target signal to be added includes: Searching a first super table in currently enabled data table information based on the signal type and sampling period of the target signal to be added; If the first super table is found, configuring the first super table as the target super table of the sampling mapping configuration record corresponding to the target signal to be added; If the first super table is not found, a new super table is enabled according to the signal type of the signal to be added, and is configured as the target super table of the sampling mapping configuration record corresponding to the target signal to be added.
5. The data dynamic sampling method according to claim 3, characterized in that: The configuring column indexes in sequence for the sampling mapping configuration records corresponding to each group of target signals to be added includes: Determine a column usage identifier stream for each group of target signals to be added according to the target super table and the target sub-table of the sampling mapping configuration records corresponding to each group of target signals to be added; Starting from the position of the first identifier of the duty identifier in the column usage identifier stream, column indexes are sequentially configured for the sampling mapping configuration records corresponding to each group of target signals to be added.
6. The data dynamic sampling method according to any one of claims 2 to 5, characterized in that: In the process of updating the current sampling mapping configuration information, the currently enabled data table information is updated to obtain new enabled data table information, including: If a target sub-table is newly added in the sampling mapping configuration information, then a new enabling record of the target sub-table is added to the currently enabled data table information; confirming the target sub-table and column index corresponding to each target signal to be deleted; Based on the target sub-table and the column index, updating the used column usage identifier stream of the target sub-table, setting the corresponding bit sequence as the occupied identifier, and accumulating the number of deleted columns of the target sub-table from 0; According to the number of each group of signals to be added, the used column usage identifier stream of the target sub-table corresponding to each group of target signals to be added is updated, and the corresponding bit sequence is set as the occupied identifier; the group of signals to be added is configured with the same target super-table and the same target sub-table; updating the number of used columns of each target sub-table in the currently enabled data table information according to the number of deleted columns of each target sub-table and the number of a group of to-be-added signals corresponding to each target sub-table; The updating of the currently enabled data table information is completed to obtain new enabled data table information.
7. The data dynamic sampling method according to claim 6, characterized in that: The performing data sampling based on the new sampling mapping configuration information and the new enabled data table information, and storing the sampled data, includes: When the timer is started, based on the new sampling mapping configuration information and the new enabled data table information, the target signal whose sampling period can divide the time of the timer is sampled and stored at the position corresponding to the column index in the target subtable of the corresponding target supertable.
8. A data dynamic sampling system, characterized in that: include: A first target signal module, used to obtain a first target signal set to be sampled according to sampling configuration information; A second target signal module, configured to obtain a second target signal set having a configured sampling mapping relationship according to current sampling mapping configuration information; A first updating module, configured to update the current sampling mapping configuration information to obtain new sampling mapping configuration information when the first target signal set and the second target signal set are different; A second updating module, configured to update the currently enabled data table information in the process of updating the current sampling mapping configuration information to obtain new enabled data table information; The sampling and storage module is used to perform data sampling based on the new sampling mapping configuration information and the new enabled data table information, and store the sampled data.
9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer program product, characterized in that The invention comprises a computer program, which, when executed, enables the method according to any one of claims 1 to 7 to be performed.