Intelligent enhanced judgment method for power system frequency stability based on domain adaptation
Through domain adaptation methods, combining source domain and target domain data, using temporal causal convolution and probabilistic sparse attention mechanisms, the accuracy problem of power system frequency response prediction is solved, the adaptability to changes in power grid operation mode and topology structure is improved, and the accuracy and real-time performance of frequency stability judgment are ensured.
Patent Information
- Application Number
- CN202411486249.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-23
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2044-10-23
AI Technical Summary
Existing technologies make it difficult to accurately predict frequency response in power systems, especially in situations such as large-scale renewable energy access and UHVDC transmission. The model cannot adapt to changes in grid operation mode and topology, resulting in inaccurate frequency stability judgment.
Using a domain adaptation method, combining the source domain and target domain datasets, a frequency parameter prediction network is constructed through temporal causal convolution and probabilistic sparse attention mechanism, and adversarial training is performed using the gradient reversal layer to improve the adaptability and accuracy of the model.
The model's adaptability to changes in grid operation mode and topology is improved, ensuring the accuracy and stability of frequency response predictions. It can identify grid frequency instability in advance and support real-time control of the grid.
Smart Images

Figure CN119397237B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of smart grid technology and relates to an artificial intelligence technology for frequency stability judgment that can adapt to changes in power system operation, and in particular to an intelligent enhanced judgment method for power system frequency stability based on domain adaptation. Background Art
[0002] Frequency stability assessment is a crucial element in ensuring power grid security. After a system experiences a major disturbance, rapidly monitoring the type and location of the disturbance and evaluating the dynamic characteristics of the frequency can help operators take timely emergency control measures to mitigate the impact. The dynamic process of the disturbed frequency response contains a wealth of information about the disturbance. Quantifying and predicting these characteristics is a key trend in the development of modern "dual-high" power grids. With the advancement of technologies such as large-scale renewable energy integration and ultra-high-voltage direct current (UHVDC) transmission, system equivalent inertia is decreasing, frequency offset is increasing, and the coupling between dynamic frequency response and power angle oscillation is intensifying, posing new challenges to frequency stability research and control.
[0003] Analysis of the frequency transient characteristics of existing power systems following disturbances primarily relies on physical models, including time-domain simulation, equivalent models, and linearization methods. Time-domain simulation solves the system's frequency response using high-order nonlinear differential equations; linearization methods simplify the system and calculate the dynamic frequency; and equivalent modeling methods, such as the ASF and SFR models, have been proposed. However, due to the diverse types of disturbances and complex system parameters in systems with a high proportion of renewable energy, traditional methods struggle to accurately predict the frequency response, resulting in significant prediction errors.
[0004] In recent years, machine learning-based frequency prediction has gained popularity. Deep learning methods can be used to analyze system input-output relationships from historical data, and they have been applied to load frequency control. While they offer the potential to accurately model nonlinear characteristics, data-driven approaches lack physical modeling, reducing the credibility of their predictions.
[0005] Combining physical models with data-driven approaches can improve prediction accuracy and reliability. Some studies [Bellizio F, Cremer JL, Sun M, et al. A causality based feature selection approach for data-driven dynamic security assessment [J]. Electric Power Systems Research, 2021 (Dec.): 201] use a series model to combine the two. Another study [Li Feng, Wang Qi, Hu Jianxiong, et al. Research Progress on Data and Knowledge Joint Driven Methods and Their Application Prospects in Power Systems [J]. Proceedings of the CSEE, 2021, 41(13): 4377-4390] uses data-driven methods to correct physical model parameters. However, these methods face challenges such as complexity and computational cost, and still require optimization and tuning.
[0006] At the same time, deep learning-based methods are highly dependent on the distribution of disturbed frequency response data. In the field of power systems, the constant changes in grid operation mode and topology can lead to significant differences in data distribution and characteristics. As a result, models trained on the source domain cannot accurately reflect the characteristics of the target domain, which affects the accuracy of the model trained on the source domain data in judging the frequency stability of the target domain. Summary of the Invention
[0007] In order to overcome the shortcomings of the above-mentioned prior art, the purpose of the present invention is to provide a domain-adaptive intelligent enhanced judgment method for power system frequency stability, in order to improve the adaptability of the model to changes in power grid operation mode and topology structure, ensure that the frequency response model parameter prediction network trained based on source domain data can be effectively migrated to the target domain data set, and ultimately improve the model's ability to perform online prediction of real-time response data of the power system.
[0008] In order to achieve the above object, the technical solution adopted by the present invention is:
[0009] A domain-adaptive intelligent enhanced judgment method for power system frequency stability includes the following steps:
[0010] Step 1: Combine the different fault types and operation modes of the two power grids to construct a dataset containing a number of evenly mixed source domain data and target domain data, where the source domain data and the target domain data are both power grid frequency response samples, respectively from the two power grids;
[0011] Step 2: Divide each power grid frequency response sample into frequency response data at the initial stage of disturbance and frequency response data at the later stage of disturbance according to the frequency deviation threshold;
[0012] Step 3: Normalize the initial frequency response data of the disturbance to the interval [0,1];
[0013] Step 4: Build a domain feature extraction network, using the normalized result of step 3 as input to extract the features of the time series data;
[0014] Step 5: Build a frequency parameter prediction network, take the feature vector extracted by the domain feature extraction network as input, process it based on the attention mechanism, and obtain the frequency response model parameters;
[0015] Step 6: Build a domain classifier network, take the feature vector extracted by the domain feature extraction network as input, and obtain the sample label output, indicating whether the sample belongs to the source domain or the target domain;
[0016] Step 7, construct the system loss function;
[0017] Step 8, calculating the frequency response curve prediction error based on the late frequency response data of the disturbance, and training using the gradient descent method until the model composed of each network converges;
[0018] Step 9: Input the frequency response model parameters obtained in step 5 into the frequency response model to predict the frequency response curve after the input time window;
[0019] Step 10: If the lowest point of the predicted frequency response curve exceeds the frequency stability judgment threshold, it is determined that the grid frequency is unstable; otherwise, the frequency is stable.
[0020] Compared with existing technologies, this invention incorporates temporal causal convolution and convolutional expansion coefficients into the domain feature extraction network. This overcomes the problems of CNN networks, such as their sensitivity to sparse data, information leakage when processing long time series, limited field of view, and difficulty extracting all temporal features. Furthermore, a probabilistic sparse attention mechanism and distillation process are incorporated into the frequency parameter prediction network, reducing the computational complexity of attention, the number of model parameters, and training time. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 It is a schematic diagram of an intelligent enhanced judgment method for power system frequency stability based on domain adaptation in an embodiment of the present invention.
[0022] Figure 2 Schematic diagram of a source domain data calculation model in an embodiment of the present invention.
[0023] Figure 3 Schematic diagram of the domain feature extraction network structure in an embodiment of the present invention.
[0024] Figure 4 Schematic diagram of temporal causal convolution of domain feature extraction network in an embodiment of the present invention.
[0025] Figure 5 Schematic diagram of temporal causal convolution with the introduction of expansion coefficient in an embodiment of the present invention.
[0026] Figure 6 Schematic diagram of the probabilistic sparse attention mechanism in the frequency parameter prediction network in an embodiment of the present invention.
[0027] Figure 7 Schematic diagram of a probabilistic sparse attention mechanism for introducing a distillation process into a frequency parameter prediction network in an embodiment of the present invention. DETAILED DESCRIPTION
[0028] The embodiments of the present invention are described in detail below with reference to the accompanying drawings and examples.
[0029] According to the above, due to the continuous changes in the operation mode and topology of the power system field, there will be significant differences in data distribution and characteristics. The model trained in the source domain based on the deep learning method cannot accurately reflect the characteristics of the target domain, and the prediction model trained using the offline generated frequency response samples cannot perform online prediction based on the real-time response data of the power system. The present invention introduces transfer learning into the power system stability judgment, and proposes an intelligent enhanced judgment method for power system frequency stability based on domain adaptation. Cross-domain consistency features are extracted through adversarial training, supplemented by supervised learning in the source domain and unsupervised learning in the target domain, which effectively improves the adaptability of the model to changes in the operation mode and topology of the power grid.
[0030] refer to Figure 1 The present invention provides a domain-adaptive intelligent enhanced judgment method for power system frequency stability, comprising the following steps:
[0031] Step 1: Combining the different fault types and operating modes of the two power grids, a dataset containing several evenly mixed source domain data and target domain data is constructed, where the data type is power grid frequency response samples, and the source domain data and target domain data come from the two power grids respectively.
[0032] In the embodiment of the present invention, the two power grids have different numbers of nodes and different power supplies. Figure 2 The example model for a low-frequency, small-node (102-node) model with both renewable energy and conventional power sources is shown. The obtained example is used as the source domain data. The target domain data is obtained from a standard test system for a high-proportion power electronic large grid with 10,000 nodes.
[0033] Specifically, in this embodiment, the source domain data is obtained from the calculation model of the coexistence of new energy and conventional power sources built by the present invention, using PSD-BPA simulation software. By setting different load levels, adjusting the output of new energy units and other units, and adding machine-cutting disturbances, a scenario in which new energy and conventional power sources fail through the tributary transmission system is constructed. In this embodiment, 8 types of machine-cutting disturbances are added. The target domain data is obtained from a high-proportion power electronic large-scale power grid 10,000-node standard test system, and different fault types and operating modes of the power grid are set. The source domain data and the target domain data are mixed in equal amounts to construct a data set X={x1,x2,…,x i ,…,x L}, where x i represents the ith grid frequency response sample, x i =(f i 1 ,f i 2 ,…,f i t ,…,f i T ), f i t Represents x i The frequency response at the tth moment in the t-th moment is the frequency response data corresponding to the node with the largest frequency deviation, and T is x i The sequence length.
[0034] Step 2: Set the frequency deviation threshold γ sh , each power grid frequency response sample is divided into two parts: the frequency response data at the initial stage of disturbance and the frequency response data at the later stage of disturbance, which can be expressed as:
[0035] in, The initial frequency response data of the disturbance is used as input in the frequency parameter prediction task. To perturb the frequency response data in the later stage, it is used to calculate the frequency response curve prediction error during the training process. The frequency response deviation does not exceed γ sh ,Right now Accordingly, the perturbation later frequency response data Expressed as: in, Representation sequence The distribution of source domain samples is different from that of target domain samples, that is, S(x)≠T(x), where S(x) is the distribution function of source domain data samples and T(x) is the distribution function of target domain data samples.
[0036] Frequency deviation threshold γsh Based on experience and experiments, it should generally be smaller than the frequency stability judgment threshold. In this embodiment, the frequency stability judgment threshold is set to 0.7 Hz, then γ sh Should be less than 0.7Hz, the experimental part of this invention takes γ sh is 0.4Hz.
[0037] Step 3: Disturb the initial frequency response data Normalized transformation to the interval [0,1].
[0038] In this example, the maximum-minimum normalization method is used. The purpose of normalization is to unify the data range. By mapping the data to the interval [0, 1], different data can have the same numerical range, avoiding the impact caused by differences in data scale. It also eliminates dimensionality effects: Normalization can eliminate the dimensionality effects of data, making comparison and analysis of data in different dimensions more accurate and reliable. It also improves model convergence speed: Normalizing the data can accelerate model convergence and improve training efficiency and performance.
[0039] Step 4: Build a domain feature extraction network with model parameters θ f , taking the normalized result of step 3 as input, extract the features of time series data.
[0040] The domain feature extraction network of the present invention is based on the CNN network. Specifically, the CNN network is used as the feature extraction network for time series data, and a causal convolution expansion layer is introduced to overcome the information leakage and network depth problems of the traditional CNN network in processing time series data. The specific structure is as follows Figure 3 As shown, the present invention adopts a four-channel parallel convolution structure with a total of four parallel causal expansion convolution branches. The convolution kernel of each branch is of different size. The convolution kernels of different sizes are used to achieve perception of different scales, thereby forming a multi-scale feature map. This enables the network to learn the local details and global relationships of the temporal input at the same time. Finally, the outputs of the four-channel parallel convolution are combined and the average pooling layer is used to obtain the output of the domain feature extraction network, that is, the extracted feature vector, which is expressed as domain feature f = G f (x;θ f ), where G f represents the domain feature extraction network, x is the input, θ f Extract network parameters for domain features.
[0041] Figure 3 The network structure of the domain feature extraction network is set as follows:
[0042]
[0043] That is, the four parallel causal expansion convolution branches are:
[0044] The first branch is CD_ConvNet with a convolution kernel size of 1×1;
[0045] The second branch is a CD_ConvNet with a convolution kernel size of 1×1 and a CD_ConvNet with a convolution kernel size of 1×3 connected in sequence;
[0046] The third branch is a CD_ConvNet with a convolution kernel size of 1×1 and a CD_ConvNet with a convolution kernel size of 1×5 connected in sequence;
[0047] The fourth branch is a CD_ConvNet with a maximum pooling layer of a window size of 1×3 and a convolution kernel size of 1×1 connected in sequence.
[0048] The purpose of adding a 1×1 convolution kernel to the branch in the present invention is to reduce the dimension of the feature channel, reduce the number of parameters and calculations, and realize cross-channel information fusion and linear combination of information between different channels.
[0049] The temporal causal convolutional network processes time series data in chronological order and does not use future information to affect current predictions or output results, thus avoiding information leakage and unreasonable predictions. The specific implementation method is as follows: introduce zero padding in the convolution kernel and use F k =(w1,w2,...,w k ) represents a one-dimensional causal convolution sliding window of size K, w i Represents the learnable weight value in the convolution kernel. For one-dimensional input sequence data X={x1,x2,...,x T}, then in x t The causal convolution calculation at The temporal causal convolution calculation process is as follows Figure 4 , the convolution kernel size of the causal convolution layer in the figure is 2. The temporal causal convolution network is constrained by the temporal relationship and predicts y t The network can only use the observation data {x1,x2…x t}, but cannot use the future time step data {x t+1 ,x t+2 ,...,x T The number of convolutional layers in a network determines the depth of historical information it can trace.
[0050] Like traditional convolution, the modeling length of time series in temporal causal convolution is limited by the size of the convolution kernel (sliding window). The calculation of its receptive field is performed layer by layer, and its recursive calculation is as follows: Where l n Indicates the receptive field size of the nth convolutional layer, ln-1 represents the receptive field of the n-1th layer, F n Indicates the size of the convolution kernel in the nth layer, s i Represents the sliding stride of the convolution kernel in layer i. Introducing the convolution expansion coefficient in a convolutional network allows for flexible control of the receptive field size while keeping the number of network layers relatively small. The indirect sampling mechanism ensures that the output of each convolution operation integrates a wider range of information dimensions.
[0051] like Figure 5 The detailed definition of the dilated convolutional network is as follows: for one-dimensional input sequence data X = {x1, x2, ..., x T}, in x t The causal convolution with a dilation coefficient of d is calculated as Where, F k =(w1,w2,...,w k ) represents a one-dimensional causal convolution sliding window of size K, w i Represents the learnable weight value in the convolution kernel. The causal dilation convolution of the present invention introduces the dilation coefficient into the temporal causal convolution network, and the calculation of its receptive field is as follows: In the formula, the size of each convolution kernel is fixed to K; the sliding step is fixed to 1; l n is the receptive field size of the nth convolutional layer; here, the expansion coefficient d of each layer is set as the number of network layers increases n The exponential growth of the basic expansion coefficient b of the network, that is, d n =b n ; When the input sequence length is T, if we want to achieve the receptive field covering all input data, that is, l n ≥T, the minimum number of layers n required can be solved as follows: Therefore, causal expansion convolution can reduce the number of convolutional network layers without sacrificing the size of the receptive field, alleviating the problems of overfitting and gradient disappearance in model training.
[0052] Step 5: Build a frequency parameter prediction network with the network parameter θ y , taking the feature vector extracted by the domain feature extraction network as input, it is processed based on the attention mechanism to obtain the frequency response model parameters.
[0053] The frequency parameter prediction network of the present invention includes a sequentially connected probabilistic sparse attention layer, a distillation layer, and an output layer. The probabilistic sparse attention layer further includes a sequentially connected probabilistic sparse attention mechanism and a feedforward neural network, and normalization is introduced at the output of each layer. The distillation layer further includes a sequentially connected one-dimensional convolutional layer, a normalization layer, an activation function, and a maximum pooling layer, which introduce positional encoding to the input of the frequency parameter prediction network. The predicted frequency response model parameters are finally obtained at the output layer after passing through the probabilistic sparse attention layer and the distillation layer.
[0054] The network structure of the frequency parameter prediction network is set as follows:
[0055]
[0056] Specifically, this step uses the Transformer attention network to predict the frequency parameters, and the input is the model G f The extracted feature vector is output as the frequency response model parameters, which can be expressed as: Θ = {R, D, ΔP, H, F H 、T R Where, R is the speed governor adjustment coefficient of the unit, D is the load frequency adjustment coefficient, ΔP is the disturbance power, H is the inertia time constant of the unit, F H is the high pressure cylinder power ratio, T R is the unit reheater time constant.
[0057] The core idea of the attention mechanism is to dynamically weight and aggregate information based on the importance of features in the input sequence. The frequency response data output by the domain feature extraction network has a fixed temporal relationship between the values. The attention mechanism does not explicitly model the order of the input sequence, so position encoding is introduced. This paper uses the sine and cosine functions used in the Transformer to generate periodic values as position encoding:
[0058]
[0059] Where: pos is the position number of each frequency feature in the domain feature extraction network output sequence, the position encoding of each feature is a vector, i represents the index of each element in this vector, d model is the position encoding vector dimension, which is equal to the embedding vector dimension. In this paper, d model = 512. The position encoding is added to the output sequence of the domain feature extraction network as the input of the attention mechanism module The time sequence and distance relationship of frequency characteristics can be characterized.
[0060] The Transformer model does not rely on a cyclic structure to process time series. Its attention mechanism can reduce the maximum length of the time series signal propagation path in the network to the theoretical shortest O(1). However, the Transformer-based attention mechanism is not efficient for long sequence input and output operations. For a time series of length L, its computational time complexity is O(L 2 ·d emb ), where d emb is the encoding dimension of the input. When a long time series is input, the stacking of J attention mechanism network layers makes the memory usage O(J·L 2 ), high memory consumption and occupancy will limit the scalability of the model for long sequence inputs. The present invention introduces a probabilistic sparse attention mechanism (ProbSparse Attention) to reduce the computational complexity of attention. The standard attention mechanism needs to calculate the correlation between all sequence positions. The probabilistic sparse attention mechanism only calculates the correlation between a part of the positions by introducing probabilistic sparsity, and the time and space computational complexity are reduced to O(L log L). In addition, a distillation process is introduced to the Transformer-based attention mechanism to distill longer input sequences into shorter sequences, and then perform attention calculations on the shorter sequences. This approach can effectively reduce the computational complexity and storage requirements of each layer, while reducing the number of parameters and training time of the model.
[0061] The frequency parameter prediction network structure based on the probabilistic sparse attention mechanism is as follows Figure 6 In long-time series prediction tasks, the dot-product attention calculation results used by the attention mechanism follow a long-tail distribution. This distribution means that only a small number of dot-product results between queries and keys significantly influence the final attention weight, while the majority of elements have little influence. Focusing on a small number of query-key pairs that significantly influence attention weights can reduce computational effort while maintaining model performance, accelerating model training and inference. The probabilistic sparse attention mechanism discovers queries that are both critical and sparse, and only calculates attention weights for these queries to improve computational efficiency.
[0062] The probabilistic sparse attention mechanism is as follows: The input of the attention mechanism is a tuple (Q, K, V), where is the query vector (query), is the key vector (key), is the value vector (value), d model is the encoding dimension of the input. The result of the dot-scaled attention calculation is as follows: q i ,k i ,vi They are the i-th row of the Q, K, and V matrices respectively, and the attention of the i-th query is as follows Where, k(q i ,k j ) is the exponential kernel function, Using exponential kernels in the attention mechanism can enhance the model to capture long-range dependencies between different elements in the input sequence, but this calculation requires quadratic time complexity and O(L Q L K ) has high memory usage. The distribution of attention probabilities is potentially sparse, and attention scores form a long-tail distribution, meaning that a small number of dot product pairs play a major role in attention. This paper introduces a probabilistic sparse attention mechanism that limits the interactions between each element and other elements by introducing sparsity constraints, thereby reducing computational complexity and memory usage.
[0063] The sparsity metric is defined as follows: the attention of the i-th query to the j-th key is the probability distribution p(k j |q i ), if the calculation of attention scores is mainly driven by certain dot product pairs, then these dot product pairs will make the attention distribution of the corresponding query non-uniform. If p(k j |q i ) is close to uniform distribution q(k j |q i )=1 / L K , which will cause the attention calculation result to become the sum of the value vector (V), and the output of the attention mechanism will lose its distinguishability and cannot effectively process the input data. Therefore, this paper uses KL divergence to measure the attention distribution p(k j |q i ) and uniform distribution q(k j |q i )=1 / L K The similarity of
[0064]
[0065] Remove the constant ln L K After that, the sparsity measure of the i-th query is defined in the probabilistic sparse attention layer as follows:
[0066]
[0067] Where q i represents the i-th row of the query vector Q, k j represents the jth row of the key vector K, d model Indicates q i and k jThe dimension of L K Indicates the number of query vectors and key vectors. If a query q i The calculated M(q i ,K) value is high, and its attention distribution p(k j |q i ) will become more diverse and more likely to capture significant dot product pairs in the long-tail attention distribution. But the complexity of the dot product pair is O(L Q L K ), and the calculation has the risk of numerical instability, the following method is used to optimize the calculation M(q i ,K).
[0068] Random sampling u = c ln L Q dot product pairs, where c is a constant sampling factor, and the Q after random sampling is defined as At this time, the attention calculation formula becomes The time complexity and space complexity of the attention mechanism are reduced to O(L K ln Q If the attention mechanism is extended to multiple attention heads, each attention head will receive a different sparse query-key pair, thus avoiding serious information loss.
[0069] Based on the empirical approximation method Replace the first term in the previous formula Because for every as well as All satisfy the formula After random sampling of Q, M(q i ,K) is the maximum value of Such as:
[0070]
[0071] The input lengths of the query vector Query and the key vector key are the same in the attention mechanism calculation, i.e. L K =L Q =L, making the total time complexity and space complexity of the probabilistic sparse attention mechanism O(L ln L).
[0072] As the network deepens, the model can gradually learn more abstract and advanced feature representations, so that the sequence information can be expressed more refinedly in subsequent layers. The present invention trims the time dimension of the input sequence before the next probabilistic sparse attention layer generates the feature map, so that the model focuses on the high-level features that play a dominant role and discards redundant features, that is, introduces a distillation mechanism for the probabilistic sparse attention layer. The distillation process of the distillation layer of the present invention is: perform one-dimensional convolution calculation on the feature map generated by the probabilistic sparse attention layer in the time dimension, set the sliding window size to 3, use the GELU activation function, and add a maximum pooling layer with a step size of 2 after the one-dimensional convolution layer. The calculation of the distillation process from the jth layer to the j+1th layer is as shown in Formula Y j+1 =MaxPool(GELU(Conv1d([Y j ]))), where Y j is the output of the j-th layer of probabilistic sparse attention, Conv1d(·) represents a one-dimensional convolution in the time dimension, and GELU(·) is an activation function based on the Gaussian error function. MaxPool(·) is a maximum pooling layer with a stride of 2, which is used to halve the length of the input sequence. The module structure of the probabilistic sparse attention mechanism added to the distillation process is as follows Figure 7 .
[0073] In addition, the present invention adopts the GELU activation function in the frequency parameter prediction network. Compared with RELU, the GELU activation function has smoother nonlinear characteristics, which helps to reduce the gradient disappearance problem and improve the fitting ability of the model. In addition, the GELU activation function can also better handle negative inputs, improving the performance and stability of the model. The calculation of the GELU activation function is as follows: GELU(x) = x*P(X≤x) = x*Φ(x), where Φ(x) is the probability function of the normal distribution, using the standard normal distribution N(0, 1) or the parameterized normal distribution N(μ, σ), and then obtaining μ and σ through training. For GELU(x) assumed to be a standard normal distribution, the present invention uses an approximate calculation method for GELU(x), as shown in the formula Where, and 0.044715 are the two adjustment coefficients of the GELU function. The GELU activation function not only performs better in avoiding the gradient vanishing problem, but also alleviates the problem of neuron death when RELU is used as the activation function.
[0074] Step 6: Build a domain classifier network with the model parameters being the domain feature vector f=G obtained in step 4 f (x;θ f ), input the domain feature vector f obtained in step 4 into the network to obtain the sample label output G d (f,θ d), indicating that the sample belongs to the source domain or the target domain. d represents the domain classifier network, θ d is the domain classifier network parameter, and f is the feature vector extracted by the domain feature extraction network.
[0075] The domain classifier is a binary classification model. In this module, the present invention uses a multi-layer perceptron (MLP) structure to calculate the classification error through the cross entropy loss function. The model structure of the domain classifier is as follows:
[0076] Layer Type Input Dimension Output dimension Parameter quantity Linear-1 128 256 33024 BatchNorm 256 256 512 ReLU 256 256 0 Linear-2 256 256 65792 BatchNorm 256 256 512 ReLU 256 256 0 Linear-3 256 128 32896 BatchNorm 128 128 256 ReLU 128 128 0 Linear-4 128 2 258
[0077] Step 7: Construct the system loss function:
[0078]
[0079] Among them, θ y For frequency parameter prediction network parameters, L y (.,.) represents the loss of the frequency parameter prediction network, G y represents the frequency parameter prediction network; L d (.,.) represents the loss of the domain classifier; and and They represent the loss of the frequency parameter prediction corresponding to the i-th sample and the loss of the domain classifier, y i is the frequency parameter label of the i-th sample (source domain data); d i is the label for the i-th sample, indicating whether it belongs to the source or target domain. A value of 0 indicates it belongs to the source domain, and a value of 1 indicates it belongs to the target domain. λ is a weight parameter that balances the importance of the two terms on the right side of the above formula. The domain feature extraction network strives to extract domain-invariant features that can be used to identify whether a sample belongs to the source or target domain. The domain classifier and feature extraction network perform adversarial learning to ensure that the domain feature extraction network captures shared features between the source and target domains, and that the feature distributions of the source and target domains are closer after mapping.
[0080] Step 8: Use the gradient descent method to obtain the saddle point of the following formula:
[0081]
[0082] in, Represent the parameters θ respectively f ,θ y ,θ d estimated value.
[0083] The present invention uses the standard stochastic gradient solver (SGD) to perform saddle point search, and f ,θ y ,θ d The update formula is as follows: Where μ is the learning rate. f When the domain classifier is used, a gradient reversal mechanism is introduced. A gradient reversal layer is added between the domain classifier and the domain feature extraction network to reverse the gradient direction of the domain classifier to the domain feature extraction network during the back propagation process, while maintaining the identity transformation during the forward propagation process. The mathematical expression of the gradient reversal layer is as follows: I is the gradient back-propagated from the domain classifier to the domain feature extraction network, which is multiplied by the dynamically changing parameter λ. Its expression is as follows: In the formula, p represents the relative value of the iteration number of the training process, that is, the ratio of the current iteration number to the total iteration number, and γ takes a constant value of 10. At the same time, the learning rate in domain adaptation also changes with the iteration number, as shown in the formula Where μ0 is the initial learning rate, which is set to 0.0001 in this paper; p represents the relative number of iterations in the training process; α and β are hyperparameters, which are set to α=10 and β=0.75 in this paper. Repeat steps 4-8 until the model converges.
[0084] Step 9: Input the frequency response model parameter Θ obtained in step 5 into the frequency response model to predict the frequency response curve after the input time window.
[0085] In this step, the frequency response model SFR is used as the mechanism module, and the predicted frequency curve is obtained based on the parameter identification results. The SFR model uses the form of low-order differential equations to describe the change of system frequency over time, and is an important method for predicting frequency response after disturbance. Based on the ASF model, the SFR model uses a simplified reheat turbine-speed governor link as the system equivalent prime mover-speed governor link. The model order does not change with the increase of system scale. It is suitable for the analysis and calculation of the frequency response process of large power grids and can quickly analyze the changing trend of system frequency. The SFR model of the equivalent single-machine system is a second-order system, and the frequency response expression is:
[0086]
[0087] Where, R is the speed governor adjustment coefficient of the unit, D is the load frequency adjustment coefficient, ΔP is the disturbance power, H is the inertia time constant of the unit, F H is the high pressure cylinder power ratio, T R is the time constant of the unit reheater, and other coefficients are related to the above parameters. After knowing the corresponding parameters, the frequency response curve of the system after disturbance can be calculated. H 、T R The frequency response model parameters Θ, namely Θ = {R, D, ΔP, H, F H 、T R}, which is the parameter predicted by the frequency parameter prediction model in this step. Km is the mechanical power gain coefficient, usually K m =1;ω n 、ω r are the natural frequency and damping frequency of the system calculated according to the frequency response model parameters; a and φ are the amplitude and angle parameters calculated according to the frequency response model parameters; ξ is the damping ratio, which is calculated as follows:
[0088]
[0089] This step uses the frequency parameter prediction model to predict Θ = {R, D, ΔP, H, F H 、T R}, the frequency response curve of the system after disturbance is calculated according to the frequency response expression Δf(t).
[0090] Step 10: Preliminary determination of frequency stability is performed based on whether the lowest point of the predicted frequency response curve exceeds a threshold (referenced to the national standard of ±0.7 Hz).
[0091] In this step, the lowest point of the predicted frequency response curve is compared with a threshold. Frequency stability is determined in advance based on whether the lowest point exceeds the threshold. If the lowest point exceeds the threshold, indicating excessive frequency deviation, the grid frequency is determined to be unstable, indicating a frequency stability issue. Otherwise, the frequency is stable. This early identification helps personnel take appropriate measures to prevent further frequency deviation and ensure stable grid operation.
[0092] Example Effect Description
[0093] In order to test the actual performance of the present invention, three training modes are set under the premise of using the same data samples as the embodiment: source domain training mode, target domain training mode and domain adaptive training mode. In terms of model structure setting, the source domain training mode and the target domain training mode remove the domain classifier, and only retain the domain feature extraction network and the frequency parameter prediction network for model training. In addition, in order to verify the influence of the causal expansion convolution network of the multi-convolution channel combination used in the domain feature extraction network of the present invention and the probabilistic sparse attention mechanism used in the frequency parameter prediction network on the target domain parameter prediction performance, an ablation experiment is set to verify the advantages of the model structure of the present invention. The present invention uses two indicators, mean absolute error MAE (mean absolute error) and mean absolute percentage error MAPE (mean absolute percentage error), to evaluate the parameter prediction accuracy. The experimental results of all control models and the present invention on the test set are shown in the following table.
[0094] Table 1 MAE and MAPE indicators of parameter prediction under different training modes
[0095]
[0096] Table 1 compares the MAE and MAPE indicators of parameter prediction in the source domain training mode, the target domain training mode, and the domain adaptation training mode. The domain adaptation method proposed in this paper can significantly reduce the error of frequency parameter identification of the model migrated to the target domain.
[0097] Table 2 MAE and MAPE indicators of different model structures in the target domain under domain adaptive training mode
[0098]
[0099] Table 2 compares the MAE and MAPE indicators of different model structures in the target domain under the domain adaptation mode. The experimental results show that the causal expansion convolutional network has a stronger feature extraction ability for time series data, and the probabilistic sparse attention mechanism can effectively improve the model's ability to focus on key information.
[0100] The present invention uses the following stability judgment quantitative index: classification accuracy r AR Indicates the proportion of all correctly identified samples to the total population, and the stable sample misjudgment rate r MR is the proportion of unstable samples in the actual stable samples, and the unstable sample recognition rate r LR is the proportion of unstable samples in the actual unstable samples. Based on the frequency parameter identification and response curve prediction results, the present invention performs stability judgment on the test sets from and target domains. The specific results are shown in Table 3.
[0101] Table 3 Frequency stability judgment results of different methods
[0102]
[0103]
[0104] From Table 3, we can see that the classification accuracy of the domain adaptation method proposed in this invention in the target domain (Experiment 7) is r AR =96.83%, stable sample false alarm rate r MR =2.94%, unstable sample recognition rate r LR =96.78%. Compared with the optimal indicator of Experiment 5 (supervised training in the target domain), the classification accuracy is reduced by 1.43%, the false alarm rate of stable samples is increased by 0.98%, and the recognition rate of unstable samples is reduced by 1.52%. Despite the performance degradation, the domain adaptation method proposed in this invention still shows effective transfer learning ability in the target domain; if the source domain is directly transferred to the target domain (Experiment 4), the classification accuracy r AR =52.61%, stable sample false alarm rate rMR =98.04%, unstable sample recognition rate r LR =62.38%, it is not feasible to directly transfer the model to the target domain; comparing experiments 3 and 6, it can be seen that the performance loss of the domain adaptation method proposed in this invention is small in the source domain, and the classification accuracy r AR Reduce by 0.30% and stabilize the sample false alarm rate r MR Increased by 1.72%, the recognition rate of unstable samples r LR No change.
[0105] Compared with the SFR model (physical model), the classification accuracy, stable sample false alarm rate and unstable sample recognition rate of the domain adaptation method in the source domain or target domain are all better than the SFR model.
[0106] In summary, the present invention proposes a frequency stability judgment method based on domain adaptation. The method uses the initial frequency response data of the disturbance as input, predicts the frequency response model parameters and the frequency response curve after the disturbance, and finally performs stability judgment. The method proposed in the present invention designs a domain feature extraction network and uses a causal expansion convolutional network to extract and learn the shared features between the source domain and the target domain. A frequency parameter prediction network is designed, and a probabilistic sparse attention network is used to identify frequency parameters. In addition, a gradient reversal layer is introduced to realize adversarial training of the domain classifier, thereby improving the model's migration ability in the target domain. It can ensure that the frequency parameter prediction network trained based on the source domain data can be effectively migrated to the target domain data set, effectively improving the model's adaptability to changes in power grid operation mode and topology.
Claims
1. A domain-adaptive intelligent enhanced judgment method for power system frequency stability, characterized in that: The steps include: Step 1: Combine the different fault types and operation modes of the two power grids to construct a dataset containing a number of evenly mixed source domain data and target domain data, where the source domain data and the target domain data are both power grid frequency response samples, respectively from the two power grids; Step 2: Divide each power grid frequency response sample into frequency response data at the initial stage of disturbance and frequency response data at the later stage of disturbance according to the frequency deviation threshold; Step 3: Normalize the initial frequency response data of the disturbance to the interval [0,1]; Step 4: Build a domain feature extraction network, using the normalized result of step 3 as input to extract the features of the time series data; Step 5: Build a frequency parameter prediction network, take the feature vector extracted by the domain feature extraction network as input, process it based on the attention mechanism, and obtain the frequency response model parameters; Step 6: Build a domain classifier network, take the feature vector extracted by the domain feature extraction network as input, and obtain the sample label output, indicating whether the sample belongs to the source domain or the target domain; Step 7, construct the system loss function; Step 8, calculating the frequency response curve prediction error based on the late frequency response data of the disturbance, and training using the gradient descent method until the model composed of each network converges; Step 9: Input the frequency response model parameters obtained in step 5 into the frequency response model to predict the frequency response curve after the input time window; Step 10: If the lowest point of the predicted frequency response curve exceeds the frequency stability judgment threshold, it is determined that the grid frequency is unstable; otherwise, the frequency is stable.
2. The method for intelligently enhancing the frequency stability of a power system based on domain adaptation according to claim 1 is characterized in that: In step 1, the two power grids have different numbers of nodes and different power sources; source domain data is obtained from a low-frequency example model in which new energy and conventional power sources coexist, and PSD-BPA simulation software is used to set different load levels, adjust the unit output, and add generator disconnection disturbances to build a scenario in which new energy and conventional power sources fail through the tributary transmission system; target domain data is obtained from a high-proportion power electronic large power grid 10,000-node standard test system, and different fault types and operating modes of the power grid are set.
3. The domain-adaptive intelligent enhanced judgment method for power system frequency stability according to claim 1 or 2, characterized in that: In step 1, the source domain data and the target domain data are mixed in equal amounts to construct the dataset, which can be expressed as: X={x1,x2,…,x i ,…,x L } where x i represents the ith grid frequency response sample, x i =(f i 1 ,f i 2 ,…,f i t ,…,f i T ), f i t Represents x i The frequency response at the tth moment is the frequency response data corresponding to the node with the largest frequency deviation, and T is x i The sequence length is , L is the number of samples; In step 2, the initial frequency response data of the disturbance is expressed as: The frequency response data after the disturbance is expressed as: in, γ sh is the frequency deviation threshold, Representation sequence The frequency deviation threshold is smaller than the frequency stability determination threshold.
4. The method for intelligently enhancing the frequency stability of a power system based on domain adaptation according to claim 1 is characterized in that: In step 4, the domain feature extraction network is based on the CNN network and adopts a four-channel parallel convolution structure. There are four parallel causal expansion convolution branches. The convolution kernel of each branch is of different sizes. The convolution kernels of different sizes are used to achieve perception of different scales, thereby forming a multi-scale feature map. Finally, the outputs of the four-channel parallel convolution are combined and the extracted feature vector f=G is obtained through the average pooling layer. f (x;θ f ), where G f represents the domain feature extraction network, x is the input, θ f Extract network parameters for domain features.
5. The method for intelligently enhancing the frequency stability of a power system based on domain adaptation according to claim 4 is characterized in that: The four parallel causal dilation convolution branches are: The first branch is CD_ConvNet with a convolution kernel size of 1×1; The second branch is a CD_ConvNet with a convolution kernel size of 1×1 and a CD_ConvNet with a convolution kernel size of 1×3 connected in sequence; The third branch is a CD_ConvNet with a convolution kernel size of 1×1 and a CD_ConvNet with a convolution kernel size of 1×5 connected in sequence; The fourth branch is a CD_ConvNet with a maximum pooling layer of a window size of 1×3 and a convolution kernel size of 1×1 connected in sequence.
6. The domain-adaptive intelligent enhanced judgment method for power system frequency stability according to claim 4 or 5, characterized in that: The causal dilation convolution introduces a dilation coefficient into the temporal causal convolutional network. The calculation of its receptive field is as follows: In the formula, the size of each convolution kernel is fixed to K; the sliding step is fixed to 1; l n is the receptive field size of the nth convolutional layer; the basic expansion coefficient of the network is b, and as the number of network layers increases, the expansion coefficient of each layer is d n Grow exponentially with b, i.e. d n =b n ; When the input sequence length is T, the receptive field covers all input data, that is, l n ≥T, the minimum number of layers n required to solve is as follows:
7. The domain-adaptive intelligent enhanced judgment method for power system frequency stability according to claim 1 is characterized in that: In step 5, the frequency parameter prediction network includes a probability sparse attention layer, a distillation layer, and an output layer connected in sequence; The probabilistic sparse attention layer includes a probabilistic sparse attention mechanism and a feedforward neural network connected in sequence, and normalization is introduced at the output of each layer. The distillation layer includes a one-dimensional convolution layer, a normalization layer, an activation function, and a maximum pooling layer connected in sequence. Position encoding is introduced into the input for the frequency parameter prediction network, and the predicted frequency response model parameters are finally obtained at the output layer after passing through the probabilistic sparse attention layer and the distillation layer in sequence, which is expressed as: Θ={R、D、ΔP、H、F H 、T R } Among them, R is the speed governor adjustment coefficient of the unit, D is the load frequency adjustment coefficient, ΔP is the disturbance power, H is the inertia time constant of the unit, F H is the high pressure cylinder power ratio, T R is the unit reheater time constant.
8. The domain-adaptive intelligent enhanced judgment method for power system frequency stability according to claim 7 is characterized in that: In the probabilistic sparse attention layer, the sparsity measure of the i-th query is defined as follows: Where q i represents the i-th row of the query vector Q, k j represents the jth row of the key vector K, d model Indicates q i and k j The dimension of L K Indicates the number of query vectors and key vectors; M(q i ,K) is calculated as follows: Random sampling u=c·lnL Q dot product pairs, where c is a constant sampling factor, and the Q after random sampling is defined as Q; Based on the empirical approximation method replace After random sampling of Q, M(q i ,K) is the maximum value of as follows: The input length of the query vector and the key vector is the same in the attention mechanism calculation, that is, L K =L Q =L, making the total time complexity and space complexity of the probabilistic sparse attention mechanism O(LlnL); The distillation process of the distillation layer is as follows: the feature map generated by the probabilistic sparse attention layer is subjected to a one-dimensional convolution calculation in the time dimension, the sliding window size is set to 3, the GELU activation function is used, and a maximum pooling layer with a stride of 2 is added after the one-dimensional convolution layer. The calculation of the distillation process from the jth layer to the j+1th layer is as follows: AND j+1 =MaxPool(GELU(Conv1d([Y j ]))) Where Y j is the output of the j-th layer of probabilistic sparse attention, Conv1d(·) represents a one-dimensional convolution in the time dimension, GELU(·) is an activation function based on the Gaussian error function, and MaxPool(·) is a maximum pooling layer with a stride of 2, which is used to halve the length of the input sequence.
9. The method for intelligently enhancing the frequency stability of a power system based on domain adaptation according to claim 1 is characterized in that: In step 6, the sample label output is expressed as: G d (f,θ d ) Among them, G d represents the domain classifier network, θ d is the domain classifier network parameter, f is the feature vector extracted by the domain feature extraction network; In step 7, the system loss function is expressed as: Among them, θ y For frequency parameter prediction network parameters, L y (.,.) represents the loss of the frequency parameter prediction network, G y represents the frequency parameter prediction network; L d (.,.) represents the loss of the domain classifier; and Represents the loss of the frequency parameter prediction corresponding to the i-th sample and the loss of the domain classifier, y i is the frequency parameter label of the i-th source domain data sample; d i is the label of the i-th sample belonging to the source domain or the target domain. 0 means it belongs to the source domain, and 1 means it belongs to the target domain. λ is the weight parameter that balances the importance of the two items on the right side of the above formula.
10. The domain-adaptive intelligent enhanced judgment method for power system frequency stability according to claim 1, characterized in that: In step 8, the saddle point of the following formula is obtained using the gradient descent method: in, Represent the parameters θ respectively f ,θ y ,θ d Repeat steps 4 to 8 until the model converges.
Citation Information
Patent Citations
Electric power system dominant instability mode identification method and system based on transfer learning
CN114330571A
Power grid frequency stability intelligent enhancement discrimination method based on model-data fusion driving
CN118281900A