Dynamic frequency prediction method, system and device based on multi-head attention and medium

By adopting the combination method of multi-head attention mechanism and bidirectional long and short-term memory neural network in the power system, the timing and spatial characteristics of power grid data are extracted and merged, and the problems of model overfitting and frequency changes after new energy access in the power system frequency prediction are solved, and more accurate and stable frequency prediction is achieved.

CN119813271AInactive Publication Date: 2025-04-11PINGGAO GRP ENERGY STORAGE TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510294543.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-13
Publication Date
2025-04-11
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

When the existing power system frequency prediction methods face complex network structures and large data samples, the problem of model overfitting may occur, and it is difficult to effectively deal with the rapid changes in the power grid frequency after new energy is connected.

Method used

A dynamic frequency prediction method based on multi-head attention is adopted, by collecting and preprocessing power grid data, timing characteristics and spatial characteristics are extracted, and features are merged using multi-head attention mechanism to build a dynamic frequency prediction model for bidirectional long and short-term memory neural network.

Benefits of technology

It improves the accuracy and stability of grid frequency prediction, avoids model overfitting, can effectively handle the changes in grid frequency after new energy is connected, and improves the frequency stability of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119813271A_ABST
    Figure CN119813271A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of power system frequency prediction, and provides a dynamic frequency prediction method, system and device based on multi-head attention and a medium. The method comprises the following steps: collecting power grid data for preprocessing to obtain preprocessed power grid data; extracting attention time sequence features according to the preprocessed power grid data to obtain time sequence features; extracting attention spatial features from the preprocessed power grid data to obtain spatial features; combining the time sequence features and the space features to obtain space-time features; building a dynamic frequency prediction model of the bidirectional long and short time memory neural network according to the spatial-temporal characteristics to obtain a dynamic frequency model of the power system; and inputting a to-be-measured power grid data frequency into the power system dynamic frequency model for prediction to obtain a power system dynamic frequency prediction result. According to the method, the Bi-LSTM and the multi-head attention mechanism are combined, so that rapid analysis of frequency stability is realized, and rapid frequency response of a power grid is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of power system frequency prediction, and provides a dynamic frequency prediction method, system, device and medium based on multi-head attention. Background Art

[0002] Frequency is one of the important indicators that reflect the stable operation of the power system. Frequency stability refers to the ability of the power system to maintain or restore the system frequency to the allowable range without frequency oscillation or collapse after the power system is disturbed. When the power system encounters a certain degree of disturbance, the active power is no longer balanced. Due to the inertia of the power system itself, the frequency will not change suddenly. About 5 seconds after the disturbance occurs, it is the inertia response stage. The inertia source releases or absorbs energy to inject or extract active power into the system, slowing down the speed of frequency change in the disturbance; when the imbalance of active power is large and the primary frequency modulation exceeds the action dead zone, the primary frequency modulation begins to play a role, and the system frequency recovers, but it cannot return to the initial level. This process lasts about 20-30 seconds; in order to restore frequency stability, the system needs secondary frequency modulation to intervene to achieve zero-difference frequency regulation. This process starts about 30 seconds after the disturbance, and the frequency gradually recovers to near the rated value.

[0003] With the continuous construction and development of new power systems, after a large number of new energy sources represented by wind power and photovoltaic power are connected to the power grid, the randomness and volatility of meteorological factors will cause the irregular input and output of new energy stations, which is likely to cause a large impact on the active power balance of the power grid, thereby causing frequency deviation. At the same time, compared with traditional generators, the power electronics equipment of new energy units reduces the inertia response of the system, which greatly reduces the frequency regulation capability and standby power of the entire power grid, which is easy to cause frequency problems.

[0004] At present, the frequency prediction methods for power systems after disturbances mainly include physical model-based methods and artificial intelligence-based methods. Frequency prediction methods based on physical models include time series simulation method, equivalent model method and linearization analysis method. This type of method uses models and formulas to provide physical correlations between variables, and to a certain extent reveals the mechanism of the dynamic characteristics of power system frequency, but there is a problem that accuracy and computational complexity cannot be unified. The frequency prediction method based on artificial intelligence trains the machine learning model through historical samples to establish a post-disturbance frequency prediction model, which combines speed and accuracy, but may cause model overfitting when faced with complex network structures and a large number of data samples. Summary of the invention

[0005] The present invention aims to solve at least one of the technical problems existing in the related art. To this end, the present invention provides a dynamic frequency prediction method, system, device and medium based on multi-head attention, which can realize rapid analysis of frequency stability, rapid frequency response of power grid and improve the frequency stability of the system.

[0006] The present invention provides a dynamic frequency prediction method based on multi-head attention, comprising the following steps: S1: Collect power grid data and pre-process the power grid data to obtain pre-processed power grid data; S2: performing simulation according to the pre-processed power grid data, and extracting attention time series features to obtain time series features; S3: extracting the grid topology structure features from the preprocessed grid data, and extracting the attention space features to obtain the spatial features; S4: Combining the temporal features and spatial features to obtain spatiotemporal features; S5: Building a dynamic frequency prediction model of a bidirectional long short-term memory neural network according to the spatiotemporal characteristics to obtain a dynamic frequency model of the power system; S6: The historical frequency data of the power grid to be tested is input into the power system dynamic frequency model for prediction to obtain the power system dynamic frequency prediction result.

[0007] According to a dynamic frequency prediction method based on multi-head attention provided by the present invention, step S1 includes: S11: Collecting power grid data, where the power grid data includes historical power grid operation data and basic power grid data; The historical operation data of the power grid include source measurement data of wind power output, photovoltaic output, hydropower unit output, thermal power unit output, as well as load level, external power transmission data and system frequency; The basic power grid data includes power grid topology information; S12: sorting the collected power grid data in chronological order to obtain original power grid data; S13: filtering out the original power grid data whose length is less than the length threshold to obtain the filtered original power grid data; S14: Filling missing values ​​in the filtered original power grid data to obtain the pre-processed power grid data.

[0008] According to a dynamic frequency prediction method based on multi-head attention provided by the present invention, step S2 includes: S21: performing topology modeling according to the preprocessed power grid data, and performing parameter annotation on the power grid data after the topology modeling to obtain annotated data; S22: Perform PSS / E simulation on the annotated data to obtain a historical grid operation data matrix ; S23: Extracting attention features from the historical operation data matrix of the power grid to obtain time series features : in, is the time series feature query matrix, is the time series feature key matrix, is the time series eigenvalue matrix, is the weight matrix of the time series feature query matrix, is the weight matrix of the time series feature key matrix, is the weight matrix of the time series eigenvalue matrix, is the attention function, is the activation function, is the dimension of the time series feature key matrix, is the transpose of the matrix.

[0009] According to a dynamic frequency prediction method based on multi-head attention provided by the present invention, step S22 includes: A virtual inertia control module is added during PSS / E simulation. The virtual inertia control module dynamically adjusts the active power output according to the frequency change rate: in, is the virtual inertia power, which is used to adjust the active power output. is the active power droop coefficient, is the frequency change, is the virtual inertia coefficient, is the first derivative of frequency with respect to time; Increase the new energy output of the controller of the virtual inertia control module; When the virtual inertia control module controller's new energy output is reduced.

[0010] According to a dynamic frequency prediction method based on multi-head attention provided by the present invention, step S3 includes: S31: Extracting the grid topology structure features from the pre-processed grid data to obtain a grid topology structure feature matrix : in, The starting node With end node The impedance between is the starting node number, , End node number, , is the total number of system nodes; S32: Extracting attention features from the grid topology feature matrix to obtain spatial features : in, is the spatial feature query matrix, is the spatial characteristic bond matrix, is the spatial eigenvalue matrix, is the weight matrix of the spatial feature query matrix, is the weight matrix of the spatial feature key matrix, is the weight matrix of the spatial eigenvalue matrix, is the dimension of the time series feature key matrix.

[0011] According to a dynamic frequency prediction method based on multi-head attention provided by the present invention, step S4 includes: The temporal features and spatial features are combined using a multi-head attention mechanism to obtain spatiotemporal features. : in, For the Features of the multi-head attention mechanism, is the feature ordinal of the multi-head attention mechanism, , is the total number of multi-head attention mechanism features, is the layer normalization function, is the attention function, For the The time series characteristics of For the The time series characteristics of is the concatenation function.

[0012] According to a dynamic frequency prediction method based on multi-head attention provided by the present invention, step S5 includes: S51: The bidirectional long short-term memory neural network includes an input layer, a bidirectional LSTM layer, a Dropout layer, and an output layer; Among them, the transfer function of the bidirectional LSTM layer is: in, For the moment The forward LSTM output of is the forward LSTM activation function, is the input layer forward propagation weight matrix, For the moment The spatiotemporal characteristics of is the weight matrix of the forward propagation itself, For the moment The forward LSTM output of time The backward LSTM output of is the backward LSTM activation function, is the input layer back propagation weight matrix, is the weight matrix of the back propagation itself, For the moment The backward LSTM output of For the moment The frequency prediction value of the final output gate, is the activation function of the concatenation of forward propagation and backward propagation, is the weight matrix for forward propagation to the output layer, is the weight matrix for back propagation to the output layer; S52: Calculate the mean square error of the prediction results: in, is the mean square error of the prediction results, is the total amount of data, is the actual value at the moment; like When , the model is discarded and retrained, where is the training threshold; like When , the model is retained to obtain the dynamic frequency model of the power system.

[0013] The present invention also provides a dynamic frequency prediction system based on multi-head attention, comprising: Data preprocessing module: collects power grid data and preprocesses the power grid data to obtain preprocessed power grid data; Spatiotemporal feature collection module: simulate the pre-processed power grid data, and extract the attention time series features to obtain the time series features; extract the power grid topology features from the pre-processed power grid data, and extract the attention time series features to obtain the spatial features; combine the time series features and the spatial features to obtain the spatiotemporal features; Model building module: building a dynamic frequency prediction model of a bidirectional long short-term memory neural network according to the spatiotemporal characteristics to obtain a dynamic frequency model of the power system; Frequency prediction module: The historical frequency data of the power grid to be tested is input into the power system dynamic frequency model for prediction to obtain the power system dynamic frequency prediction result.

[0014] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of a dynamic frequency prediction method based on multi-head attention as described in any one of the above are implemented.

[0015] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of a dynamic frequency prediction method based on multi-head attention as described in any one of the above.

[0016] The above one or more technical solutions in the embodiments of the present invention have at least one of the following technical effects: 1. To address the homogeneity problem of measured frequency operation data in the wide-area measurement system, the present invention not only uses the measured operation data in the wide-area measurement system, but also uses PSS / E software to perform dynamic time domain simulation based on the basic information of the power grid to achieve data enrichment, further provide rich data support for frequency issues, and prevent model overfitting.

[0017] 2. In view of the fact that the power system frequency is affected by various factors such as renewable energy fluctuations, load mutations, and changes in the power grid topology, the present invention uses a multi-head attention mechanism to extract features from both temporal and spatial features, analyzes frequency-related information globally, and effectively mines the diverse features of frequency data.

[0018] 3. The present invention uses a bidirectional long short-term memory neural network (Bi-LSTM) to build a frequency prediction model. Compared with the traditional LSTM, the bidirectional long short-term memory neural network (Bi-LSTM) can be trained not only from input to output, but also from output to input, which effectively improves the accuracy of frequency prediction.

[0019] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the technical solutions in the present invention or the prior art, 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 some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0021] Figure 1 It is a flow chart of the multi-head attention mechanism dynamic frequency prediction method provided by the present invention.

[0022] Figure 2 It is a structural block diagram of the multi-head attention mechanism dynamic frequency prediction device provided by the present invention.

[0023] Figure 3 It is a structural schematic diagram of the electronic device provided by the present invention.

[0024] Reference numerals: 101. Data preprocessing module; 102. Spatiotemporal feature collection module; 103. Model building module; 104. Frequency prediction module; 810. Processor; 820. Communication interface; 830. Memory; 840. Communication bus. DETAILED DESCRIPTION

[0025] In order to make the purpose, technical scheme and advantages of the present invention clearer, the technical scheme in the present invention will be clearly and completely described below. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present invention. The following embodiments are used to illustrate the present invention, but cannot be used to limit the scope of the present invention.

[0026] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the embodiments of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.

[0027] Combine the following Figures 1 to 3 The present invention is described.

[0028] like Figure 1 As shown, Figure 1 The flowchart of the multi-head attention mechanism dynamic frequency prediction method provided by the present invention includes the following steps: S1: Collect power grid data and preprocess the power grid data to obtain preprocessed power grid data; S2: performing simulation according to the pre-processed power grid data, and extracting attention time series features to obtain time series features; S3: extracting the grid topology structure features from the preprocessed grid data, and extracting the attention space features to obtain the spatial features; S4: Combining the temporal features and spatial features to obtain spatiotemporal features; S5: Building a dynamic frequency prediction model of a bidirectional long short-term memory neural network according to the spatiotemporal characteristics to obtain a dynamic frequency model of the power system; S6: The historical frequency data of the power grid to be tested is input into the power system dynamic frequency model for prediction to obtain the power system dynamic frequency prediction result.

[0029] Specifically, step S1 includes: S11: Collecting power grid data, where the power grid data includes historical power grid operation data and basic power grid data; The historical operation data of the power grid includes source measurement data of wind power output, source measurement data of photovoltaic output, source measurement data of hydropower unit output, source measurement data of thermal power unit output, nuclear measurement data of load level, nuclear measurement data of external power transmission and system frequency; The basic power grid data includes power grid topology information; S12: sorting the collected power grid data in chronological order to obtain original power grid data; S13: filtering out the original power grid data whose length is less than the length threshold to obtain the filtered original power grid data; S14: Filling missing values ​​in the filtered original power grid data to obtain the pre-processed power grid data.

[0030] The embodiment of the present invention uses the SAITS model (Self-attention based imputation for timeseries) to fill missing values.

[0031] Optionally, wavelet transform (Daubechies-4 wavelet basis) is used to reduce the noise of the power grid data and remove high-frequency noise components.

[0032] The main reasons for the change in system frequency include the volatility of new energy output represented by wind and solar power, fault disconnection of traditional generator sets, failure of key transmission channels, sudden load changes, etc. In actual power systems, the system frequency is usually maintained within a reasonable range. There are many scenarios affected by fluctuations in new energy output and load levels, while there are fewer scenarios of system frequency disturbances caused by generator failures and transmission line failures. The present invention solves the problems of insufficient sample sets and sample imbalance in the data through a dynamic time domain simulation method. In order to improve the robustness and generalization of the model, based on the PSS / E simulation software, the dynamic frequency simulation of the power system is carried out for large-scale new energy generation, low system load and small-scale new energy generation, high system load. At the same time, faults such as generator disconnection, transmission channel interruption and sudden load increase are set to provide a rich data set for subsequent model building.

[0033] Specifically, step S2 includes: S21: performing topology modeling according to the preprocessed power grid data, and performing parameter annotation on the power grid data after the topology modeling to obtain annotated data; S22: Perform PSS / E simulation on the annotated data to obtain a historical grid operation data matrix ; A virtual inertia control module is added during PSS / E simulation. The virtual inertia control module dynamically adjusts the active power output according to the frequency change rate: in, is the virtual inertia power, which is used to adjust the active power output. is the active power droop coefficient, is the frequency change, is the virtual inertia coefficient, is the first derivative of frequency with respect to time; Increase the new energy output of the controller of the virtual inertia control module; When the virtual inertia control module controller's new energy output is reduced.

[0034] Specifically, the quantitative indicators of the embodiment of the present invention are: Simulation time range: 10 seconds before the disturbance event to 60 seconds after the disturbance (covering the inertia response, primary frequency modulation and secondary frequency modulation stages).

[0035] Step length: 0.01 second (to meet the needs of capturing high-frequency dynamic processes).

[0036] Perturbation type and parameters: New energy output fluctuation: random fluctuation amplitude of wind and solar output is ±15% rated capacity (simulating typical fluctuation scenarios).

[0037] Generator tripping failure: Randomly select 1-3 thermal power units, and the tripping capacity accounts for 5%-20% (according to the typical N-1 / N-2 fault setting of the power grid).

[0038] Sudden increase / decrease in load: Load change rate ±10%-20% (sudden change within 5s).

[0039] Transmission line interruption: Randomly disconnect 1-2 high-voltage transmission lines (voltage level of 220kV and above).

[0040] S23: Extracting attention features from the historical operation data matrix of the power grid to obtain time series features : in, is the time series feature query matrix, is the time series feature key matrix, is the time series eigenvalue matrix, is the weight matrix of the time series feature query matrix, is the weight matrix of the time series feature key matrix, is the weight matrix of the time series eigenvalue matrix, is the activation function, is the dimension of the time series feature key matrix, is the transpose of the matrix.

[0041] The benefits of doing this are: to address the problem of homogeneity of measured frequency operation data in the wide-area measurement system, the present invention not only uses the measured operation data in the wide-area measurement system, but also uses PSS / E software to perform dynamic time domain simulation based on the basic information of the power grid to achieve data enrichment, further providing rich data support for frequency issues and preventing model overfitting.

[0042] Specifically, step S3 includes: S31: Extracting the grid topology structure features from the pre-processed grid data to obtain a grid topology structure feature matrix : in, The starting node With end node The impedance between is the starting node number, , End node number, , is the total number of system nodes; S32: Extracting attention features from the grid topology feature matrix to obtain spatial features : in, is the spatial feature query matrix, is the spatial characteristic bond matrix, is the spatial eigenvalue matrix, is the weight matrix of the spatial feature query matrix, is the weight matrix of the spatial feature key matrix, is the weight matrix of the spatial eigenvalue matrix, is the dimension of the time series feature key matrix.

[0043] The benefits of doing this are: in view of the fact that the power system frequency is affected by various factors such as renewable energy fluctuations, load mutations, and changes in the grid topology, the present invention uses a multi-head attention mechanism to extract features from both temporal and spatial features, analyzes frequency-related information globally, and effectively mines the diverse features of frequency data.

[0044] Specifically, step S4 includes: The temporal features and spatial features are combined using a multi-head attention mechanism to obtain spatiotemporal features. : in, For the Features of the multi-head attention mechanism, is the feature ordinal of the multi-head attention mechanism, , is the total number of multi-head attention mechanism features, is the layer normalization function, is the attention function, For the The time series characteristics of For the The time series characteristics of is the concatenation function.

[0045] Considering that the dynamic frequency of the power system is a time series prediction problem, the present invention selects a bidirectional long short-term memory neural network to build a prediction model, uses the spatiotemporal features extracted by the multi-head attention mechanism as the input features of the Bi-LSTM neural network, and uses the system frequency as the output. Bi-LSTM contains two independent LSTM structures, which perform forward and reverse learning on the input dynamic frequency spatiotemporal features. Through bidirectional training, it fully obtains past and future information of dynamic frequency features, effectively improves the model's dependency, and improves the accuracy of model frequency prediction.

[0046] Specifically, step S5 includes: S51: The bidirectional long short-term memory neural network includes an input layer, a bidirectional LSTM layer, a Dropout layer, and an output layer; Among them, the transfer function of the bidirectional LSTM layer is: in, For the moment The forward LSTM output of is the forward LSTM activation function, is the input layer forward propagation weight matrix, For the moment The spatiotemporal characteristics of is the weight matrix of the forward propagation itself, For the moment The forward LSTM output of time The backward LSTM output of is the backward LSTM activation function, is the input layer back propagation weight matrix, is the weight matrix of the back propagation itself, For the moment The backward LSTM output of For the moment The frequency prediction value of the final output gate, is the activation function of the concatenation of forward propagation and backward propagation, is the weight matrix for forward propagation to the output layer, is the weight matrix for back propagation to the output layer; In this embodiment of the present invention, the Dropout layer is set to 0.2 to prevent overfitting.

[0047] Optionally, the bidirectional long short-term memory neural network of the present invention can be added with a time distribution wrapper layer to process the output step by time.

[0048] S52: Calculate the mean square error of the prediction results: in, is the mean square error of the prediction results, is the total amount of data, is the actual value at the moment; like When , the model is discarded and retrained, where is the training threshold; like When , the model is retained to obtain the dynamic frequency model of the power system.

[0049] In the embodiment of the present invention, the loss function of the model is the mean absolute error function, which is optimized using the Adam optimizer, the training batch size is 128, and the activation function is the ReLU function.

[0050] The method provided by the present invention combines Bi-LSTM with a multi-head attention mechanism to achieve rapid analysis of frequency stability, rapid frequency response of the power grid, improve the frequency stability of the system, and prevent frequency collapse, which has important theoretical significance.

[0051] The present invention uses a bidirectional long short-term memory neural network (Bi-LSTM) to build a frequency prediction model. Compared with the traditional LSTM, the bidirectional long short-term memory neural network (Bi-LSTM) can be trained not only from input to output, but also from output to input, which effectively improves the accuracy of frequency prediction.

[0052] Figure 2 A dynamic frequency prediction system based on multi-head attention provided by the present invention comprises: Data preprocessing module 101: collects power grid data, and preprocesses the power grid data to obtain preprocessed power grid data; The spatiotemporal feature collection module 102: performs simulation according to the pre-processed power grid data, and extracts the attention time series features to obtain the time series features; extracts the power grid topology features from the pre-processed power grid data, and extracts the attention time series features to obtain the spatial features; combines the time series features and the spatial features to obtain the spatiotemporal features; Model building module 103: building a dynamic frequency prediction model of a bidirectional long short-term memory neural network according to the spatiotemporal characteristics to obtain a dynamic frequency model of the power system; Frequency prediction module 104: inputting historical frequency data of the power grid to be tested into the power system dynamic frequency model for prediction to obtain the power system dynamic frequency prediction result.

[0053] Figure 3 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 3 As shown, the electronic device may include: a processor 810, a communication interface 820, a memory 830 and a communication bus 840, wherein the processor 810, the communication interface 820, and the memory 830 communicate with each other through the communication bus 840. The processor 810 may call the logic instructions in the memory 830 to execute a dynamic frequency prediction method based on multi-head attention, the method comprising: S1: collecting power grid data, and preprocessing the power grid data to obtain the preprocessed power grid data; S2: performing simulation according to the pre-processed power grid data, and extracting attention time series features to obtain time series features; S3: extracting the grid topology structure features from the preprocessed grid data, and extracting the attention space features to obtain the spatial features; S4: Combining the temporal features and spatial features to obtain spatiotemporal features; S5: Building a dynamic frequency prediction model of a bidirectional long short-term memory neural network according to the spatiotemporal characteristics to obtain a dynamic frequency model of the power system; S6: The historical frequency data of the power grid to be tested is input into the power system dynamic frequency model for prediction to obtain the power system dynamic frequency prediction result.

[0054] In addition, the logic instructions in the above-mentioned memory 830 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0055] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which is implemented when the computer program is executed by a processor to perform the above-mentioned method for dynamic frequency prediction based on multi-head attention, the method comprising: S1: Collect power grid data and preprocess the power grid data to obtain preprocessed power grid data; S2: performing simulation according to the pre-processed power grid data, and extracting attention time series features to obtain time series features; S3: extracting the grid topology structure features from the preprocessed grid data, and extracting the attention space features to obtain the spatial features; S4: Combining the temporal features and spatial features to obtain spatiotemporal features; S5: Building a dynamic frequency prediction model of a bidirectional long short-term memory neural network according to the spatiotemporal characteristics to obtain a dynamic frequency model of the power system; S6: The historical frequency data of the power grid to be tested is input into the power system dynamic frequency model for prediction to obtain the power system dynamic frequency prediction result.

[0056] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0057] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0058] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these 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 invention.

[0059] It should be noted that the embodiments of the present disclosure may be implemented by hardware, software, or a combination of software and hardware. The hardware portion may be implemented using dedicated logic: the software portion may be stored in a memory and executed by an appropriate instruction execution system such as a microprocessor or dedicated design hardware. Those skilled in the art will appreciate that the above-described apparatus and methods may be implemented using computer executable instructions and / or contained in a processor control code, such as a programmable memory or a data carrier such as an optical or electronic signal carrier providing such code.

[0060] In addition, although the operation of the method of the present disclosure is described in a particular order in the accompanying drawings, this does not require or imply that these operations must be performed in this particular order, or that all the operations shown must be performed to achieve the desired result. On the contrary, the steps depicted in the flow chart can change the order of execution. Additionally or alternatively, some steps can be omitted, multiple steps can be combined into one step for execution, and / or one step can be decomposed into multiple steps for execution. It should also be noted that the features and functions of two or more devices according to the present disclosure can be embodied in one device. Conversely, the features and functions of a device described above can be further divided into being embodied by multiple devices.

[0061] Although the present disclosure has been described with reference to several specific embodiments, it is to be understood that the disclosure is not limited to the specific embodiments disclosed.

Claims

1. A dynamic frequency prediction method based on multi-head attention, characterized in that: The following steps are involved: S1: Collect power grid data and preprocess the power grid data to obtain preprocessed power grid data; S2: performing simulation according to the pre-processed power grid data, and extracting attention time series features to obtain time series features; S3: extracting the grid topology structure features from the preprocessed grid data, and extracting the attention space features to obtain the spatial features; S4: Combining the temporal features and spatial features to obtain spatiotemporal features; S5: Building a dynamic frequency prediction model of a bidirectional long short-term memory neural network according to the spatiotemporal characteristics to obtain a dynamic frequency model of the power system; S6: The historical frequency data of the power grid to be tested is input into the power system dynamic frequency model for prediction to obtain the power system dynamic frequency prediction result.

2. According to claim 1, a dynamic frequency prediction method based on multi-head attention is characterized in that: Step S1 includes: S11: Collecting power grid data, where the power grid data includes historical power grid operation data and basic power grid data; The historical operation data of the power grid include source measurement data of wind power output, photovoltaic output, hydropower unit output, thermal power unit output, as well as load level, external power transmission data and system frequency; The basic power grid data includes power grid topology information; S12: sorting the collected power grid data in chronological order to obtain original power grid data; S13: filtering out the original power grid data whose length is less than the length threshold to obtain the filtered original power grid data; S14: Filling missing values ​​in the filtered original power grid data to obtain the pre-processed power grid data.

3. According to the method of claim 1, the dynamic frequency prediction method based on multi-head attention is characterized in that: Step S2 includes: S21: performing topology modeling according to the preprocessed power grid data, and performing parameter annotation on the power grid data after the topology modeling to obtain annotated data; S22: Perform PSS / E simulation on the annotated data to obtain a historical grid operation data matrix ; S23: Extracting attention features from the historical operation data matrix of the power grid to obtain time series features : in, is the time series feature query matrix, is the weight matrix of the time series feature query matrix, is the time series feature key matrix, is the weight matrix of the time series feature key matrix, is the time series eigenvalue matrix, is the weight matrix of the time series eigenvalue matrix, is the activation function, is the dimension of the time series feature key matrix, is the transpose of the matrix.

4. A dynamic frequency prediction method based on multi-head attention according to claim 3, characterized in that: Step S22 includes: A virtual inertia control module is added during PSS / E simulation. The virtual inertia control module dynamically adjusts the active power output according to the frequency change rate: in, is the virtual inertia power, which is used to adjust the active power output. is the active power droop coefficient, is the frequency change, is the virtual inertia coefficient, is the first derivative of frequency with respect to time; Increase the new energy output of the controller of the virtual inertia control module; When the virtual inertia control module controller's new energy output is reduced.

5. The method for dynamic frequency prediction based on multi-head attention according to claim 3, characterized in that: Step S3 includes: S31: Extracting the grid topology structure features from the pre-processed grid data to obtain a grid topology structure feature matrix : in, The starting node With end node The impedance between is the starting node number, , End node number, , is the total number of system nodes; S32: Extracting attention features from the grid topology feature matrix to obtain spatial features : in, is the spatial feature query matrix, is the weight matrix of the spatial feature query matrix, is the spatial characteristic bond matrix, is the weight matrix of the spatial feature key matrix, is the spatial eigenvalue matrix, is the weight matrix of the spatial eigenvalue matrix, is the dimension of the time series feature key matrix.

6. A dynamic frequency prediction method based on multi-head attention according to claim 5, characterized in that: Step S4 includes: The temporal features and spatial features are combined using a multi-head attention mechanism to obtain spatiotemporal features. : in, For the Features of the multi-head attention mechanism, is the feature ordinal of the multi-head attention mechanism, , is the total number of multi-head attention mechanism features, is the layer normalization function, is the attention function, For the The time series characteristics of For the The time series characteristics of is the concatenation function.

7. A dynamic frequency prediction method based on multi-head attention according to claim 6, characterized in that: Step S5 includes: S51: The bidirectional long short-term memory neural network includes an input layer, a bidirectional LSTM layer, a Dropout layer, and an output layer; Among them, the transfer function of the bidirectional LSTM layer is: in, For the moment The forward LSTM output of is the forward LSTM activation function, is the input layer forward propagation weight matrix, For the moment The spatiotemporal characteristics of is the weight matrix of the forward propagation itself, For the moment The forward LSTM output of time The backward LSTM output of is the backward LSTM activation function, is the input layer back propagation weight matrix, is the weight matrix of the back propagation itself, For the moment The backward LSTM output of For the moment The frequency prediction value of the final output gate, is the activation function of the concatenation of forward propagation and backward propagation, is the weight matrix for forward propagation to the output layer, is the weight matrix for back propagation to the output layer; S52: Calculate the mean square error of the prediction results: in, is the mean square error of the prediction results, is the total amount of data, is the actual value at the moment; like When , the model is discarded and retrained, where is the training threshold; like When , the model is retained to obtain the dynamic frequency model of the power system.

8. A dynamic frequency prediction system based on multi-head attention, used to execute a dynamic frequency prediction method based on multi-head attention as claimed in any one of claims 1 to 7, characterized in that: include: Data preprocessing module: collects power grid data and preprocesses the power grid data to obtain preprocessed power grid data; A spatiotemporal feature collection module: performs simulation according to the pre-processed power grid data, and extracts attention time series features to obtain time series features; Extracting the topological structure features of the power grid data after the preprocessing, and extracting the attention time series features to obtain the spatial features; Combining the temporal features and the spatial features to obtain spatiotemporal features; Model building module: building a dynamic frequency prediction model of a bidirectional long short-term memory neural network according to the spatiotemporal characteristics to obtain a dynamic frequency model of the power system; Frequency prediction module: The historical frequency data of the power grid to be tested is input into the power system dynamic frequency model for prediction to obtain the power system dynamic frequency prediction result.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps of a dynamic frequency prediction method based on multi-head attention as described in any one of claims 1 to 7 are implemented.

10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of a dynamic frequency prediction method based on multi-head attention as described in any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • New energy power system frequency prediction method considering PMU dynamic perception

    CN115693663A

  • Power system transient frequency stability prediction method, system, medium and equipment

    CN117937521A