Power grid harmonic suppression method of BiLSTM model based on attention mechanism

By introducing the BiLSTM model based on the attention mechanism and the dual-tree complex wavelet transform technology into the power grid, the characteristics of harmonic signals are extracted and processed, and combined with active filters to achieve harmonic suppression in the power grid, solving the problems of poor adaptability and parameter dependence of traditional methods. , improving the inhibitory effect and adaptability.

CN118539442APending Publication Date: 2024-08-23SHIJIAZHUANG TIEDAO UNIV
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410228024.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-02-29
Publication Date
2024-08-23

AI Technical Summary

Technical Problem

Traditional power grid harmonic suppression methods have poor adaptability to dynamic environments, require high accuracy of system parameters, and have poor applicability, making it difficult to effectively suppress harmonic pollution in the power grid.

Method used

The BiLSTM model based on the attention mechanism is used to convert the harmonic signal into a vector matrix through dual-tree complex wavelet transform, and the BiLSTM model is used to extract feature information, combined with the attention mechanism to calculate the phase and amplitude of the harmonic current and voltage, and finally through The active filter output suppresses current for harmonic suppression.

Benefits of technology

It improves the adaptability and robustness of the power grid harmonic suppression method, can effectively handle harmonics in different power environments, reduces dependence on precise parameters, and enhances the adaptability to dynamic changes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118539442A
    Figure CN118539442A
Patent Text Reader

Abstract

The invention relates to a power grid harmonic suppression method of a BiLSTM model based on an attention mechanism, and the method comprises the steps: obtaining original harmonic signal groups at a preset moment, and each original harmonic signal group comprises a plurality of original harmonic signals; processing the original harmonic signal group to obtain a vector matrix for representing harmonic current signals; taking the vector matrix as input, inputting the vector matrix into a BiLSTM model based on an attention mechanism, and outputting feature information of the vector matrix; feature information of the vector matrix is converted into probabilities through a linear layer and softmax normalization, harmonic information corresponding to the highest probability is output, and the harmonic information comprises harmonic current, the phase of harmonic voltage and the amplitude of harmonic; and calculating the phase and amplitude of the optimal suppression current of the power grid according to the harmonic information, and outputting the suppression current through the APF.
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 systems, and in particular to a power grid harmonic suppression method based on a BiLSTM model with an attention mechanism. Background Art

[0002] At present, a new power system based on new energy is being gradually constructed. The application of a large number of power electronic devices has also led to more serious harmonic pollution than traditional power systems. From the perspective of the system, harmonics will affect the safety and stability of the power system. For example, harmonic components may cause protection malfunction or resonance; from the perspective of equipment, harmonic components will accelerate insulation aging, increase losses, and reduce efficiency. Therefore, how to effectively suppress harmonics is particularly important.

[0003] There are three main methods for traditional power grid harmonic suppression: passive filters, active filters, and static VAR compensators. The main working principle of active filters is to sense the harmonic currents in the power grid and then suppress the harmonics by generating a suppression current with a phase opposite to the harmonic current. Passive power filters use resonance characteristics to block or absorb harmonics.

[0004] Therefore, the traditional grid harmonic suppression method has poor adaptability to the current dynamic environment. At the same time, this method has high requirements on the accuracy of system parameters and poor applicability. Summary of the invention

[0005] The technical problem to be solved by the present invention is to provide a power grid harmonic suppression method of a BiLSTM model based on an attention mechanism.

[0006] To solve the above problems, the technical solution adopted by the present invention is:

[0007] A method for suppressing power grid harmonics based on a BiLSTM model with an attention mechanism, the method comprising:

[0008] Step S10, obtaining an original harmonic signal group at a preset time, each of the original harmonic signal groups including a plurality of original harmonic signals;

[0009] Step S20, processing the original harmonic signal group to obtain a vector matrix for representing the harmonic current signal;

[0010] Step S30: taking the vector matrix as input, inputting it into the BiLSTM model based on the attention mechanism, and outputting feature information of the vector matrix;

[0011] Step S40, converting the feature information of the vector matrix into probability through a linear layer and softmax normalization, and outputting the harmonic information corresponding to the highest probability, wherein the harmonic information includes: phases of harmonic current and harmonic voltage, and amplitudes of harmonics;

[0012] Step S50: Calculate the phase and amplitude of the optimal suppression current of the power grid according to the harmonic information, and output the suppression current through the APF.

[0013] As an implementation mode of the invention, the step S10 includes: using a Hall current sensor to measure the current signal in the power grid, and obtaining a plurality of discrete original harmonic signals by sampling with a 12-bit analog-to-digital converter.

[0014] As an embodiment of the invention, step S20 includes:

[0015] Step S201: for each of the original harmonic signals, the original harmonic signal is processed by dual-tree complex wavelet transform to obtain complex coefficients, and then the complex coefficients are converted into input vectors;

[0016] Step S202: Obtain the vector matrix based on a plurality of input vectors of the original harmonic signals.

[0017] As an implementation of the invention, in step S201, the method for obtaining complex coefficients includes:

[0018] Step S2011: Decompose the original harmonic signal group, wherein, in the decomposition process, the wavelet coefficients and scaling coefficients of the dual-tree complex wavelet transform are obtained using the following formula:

[0019]

[0020] Among them, Re represents the real part, Lm represents the imaginary part, j is the transformation scale, k is the position index, and d j (t) is the wavelet coefficient, c j (t) is the scaling factor, n is a positive integer;

[0021] Step S2012: Use the dual-tree complex wavelet transform algorithm to obtain complex coefficients, so that tree 1 generates the real part and tree 2 generates the imaginary part. In the reconstruction process, the signal is reconstructed according to the wavelet coefficients and scaling coefficients obtained above, and the complex coefficients x'(t) are obtained using the following formula:

[0022] As an implementation mode of the invention, in step S201, the complex coefficients are converted into the input vector X=[x1, x2, ...., x n ]:

[0023] x'(t)=r*exp(i,θ)

[0024] Among them, r represents the amplitude (modulus); θ represents the phase angle of the signal.

[0025] As an implementation mode of the invention, in the step S202, the vector matrix is ​​obtained based on the input vector of each of the original harmonic signals;

[0026] Among them, each row of the vector matrix represents the vector representation of each of the original harmonic signals in the original harmonic signal group, and each column of the vector matrix represents the signal characteristics of each of the original harmonic signals in the harmonic signal group, and the signal characteristics include: amplitude, phase angle, frequency information, and timing information.

[0027] As an embodiment of the invention, step S30 includes:

[0028] Step S301: Use the following formula to obtain the sequence M in the forward LSTM and the backward LSTM:

[0029] m t =w*concat(tanh(C_t),tanh(C_t-1))+b t ;

[0030] Where m t is the output hidden layer state, b t is the bias term, w is the weight;

[0031] Step S302: m t Input into the Attention layer and output the weight information K of different positions through the following formula:

[0032]

[0033]

[0034] As an embodiment of the invention, step S50 includes:

[0035] Step S501, calculating the phase and amplitude of the optimal suppression current in the power grid according to the phase of the harmonic current and harmonic voltage, and the amplitude of the harmonics;

[0036] Step S502: input the phase and amplitude of the optimal suppression current into the active power filter, and output the optimal suppression current through the active power filter to complete the harmonic suppression task.

[0037] The beneficial effects of adopting the above technical solution are:

[0038] The power grid harmonic suppression method of the BiLSTM model based on the attention mechanism provided by the present invention uses a dual-tree complex wavelet transform algorithm to process the data set into an input form suitable for use by a neural network, and uses two parallel filters to convert the waveform signal into a digital signal, and then converts the digital signal into a vector to represent the characteristics of the harmonic signal for further processing and analysis. The dual-tree complex wavelet transform has a good signal extraction function, can handle data inhomogeneity well, and has stronger robustness.

[0039] The present invention introduces a BiLSTM model based on an attention mechanism to realize the function of harmonic signal prediction. In BiLSTM, a bidirectional network is used to maintain dependencies such as the order of vectors, fully explore the internal connections of harmonic vectors at different times, and improve the utilization rate of data. The attention mechanism is used to distinguish the importance of features in feature vectors, while also ensuring that key information is not lost. By integrating BiLSTM and the attention mechanism, the network has a relatively strong learning ability, can autonomously learn the relationship between harmonic currents and harmonic voltages in the power grid system, capture its dynamic characteristics, and also improve the adaptability of the neural network to the dynamically changing harmonic environment, and the network model based on deep learning does not require precise parameters, the network can learn directly from the data, and has stronger adaptability to different power environments. The active power filter used at the same time can adapt to the needs of harmonic suppression under different power grids and load conditions, and meet the processing of harmonic suppression problems under different power environments. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] Figure 1 The present invention is a flowchart of a method for suppressing power grid harmonics based on a BiLSTM model of an attention mechanism.

[0041] Figure 2 It is a framework diagram of the overall implementation process of the present invention.

[0042] Figure 3 It is a principle diagram of the one-dimensional dual-tree complex wavelet transform algorithm of the present invention.

[0043] Figure 4 Schematic diagram of the principle framework of the BiLSTM model based on the attention mechanism of the present invention. DETAILED DESCRIPTION

[0044] In order to make the objectives, technical solutions and advantages of the present invention more clear, the present invention is clearly and completely described below in conjunction with specific embodiments.

[0045] The embodiment of the present invention provides a method for suppressing power grid harmonics based on a BiLSTM model of an attention mechanism, the method comprising:

[0046] Step S10, obtaining an original harmonic signal group at a preset time;

[0047] Wherein, each of the original harmonic signal groups includes a plurality of original harmonic signals;

[0048] In this step, a Hall current sensor is used to measure the current signal in the power grid, and a plurality of discrete original harmonic signals are obtained by sampling through a 12-bit analog-to-digital converter. The plurality of original harmonic signals together constitute an original harmonic signal group.

[0049] Of course, after obtaining the current signal, if the change value of the harmonic current is greater than a certain multiple of the fundamental wave, harmonic suppression needs to be performed. The multiple corresponding to different power systems is uncertain, and is usually 5%-10%.

[0050] Step S20, processing the original harmonic signal group to obtain a vector matrix for representing the harmonic current signal;

[0051] This step includes:

[0052] Step S201: for each of the original harmonic signals, the original harmonic signal is processed by a dual-tree complex wavelet transform to obtain a complex coefficient;

[0053] In the present invention, in order to extract more accurate signal features, the dual-tree complex wavelet transform algorithm uses different filters for different processing layers of the input current signal, uses a Farras filter in the first layer, and uses a six-tap Q-shift filter in the remaining decomposition layers; in addition, when performing the first decomposition, the filters of the two trees should be exactly spaced apart so that the data missed by tree 1 during the sampling process can be collected by tree 2, for example: when performing the first decomposition, the two filters work together to process so that the data missed by tree 1 during the sampling can be collected by tree 2, and at the same time, the filters of the two trees are set with a delay of half a sampling period to prevent deviations in subsequent decompositions; in addition, the filters on the two trees are set with a delay of half a sampling period to prevent deviations in subsequent decompositions.

[0054] In this step, the method of obtaining the complex coefficients includes:

[0055] Step S2011, decomposing the original harmonic signal.

[0056] In the decomposition process, the wavelet coefficients and scaling coefficients of the dual-tree complex wavelet transform are obtained using the following formula:

[0057]

[0058] Among them, Re represents the real part, Lm represents the imaginary part, j is the transformation scale, k is the position index, and d j (t) is the wavelet coefficient, cj (t) is the scaling factor, n is a positive integer;

[0059] Step S2012: Use the dual-tree complex wavelet transform algorithm to obtain complex coefficients, so that tree 1 generates the real part and tree 2 generates the imaginary part. In the reconstruction process, the signal is reconstructed according to the wavelet coefficients and scaling coefficients obtained above, and the complex coefficients x'(t) are obtained using the following formula:

[0060] In the traditional dual-tree complex wavelet transform, the same filter is used on the two trees, so that the dual-tree complex wavelet transform has better approximation performance and shift invariance. However, this limits the flexibility of the dual-tree complex wavelet transform, and it cannot be effectively adjusted when facing different signals. In addition, repeated signal features will be calculated during the calculation, resulting in the problem of computational redundancy. Therefore, in the present invention, different filters are used for the two trees of the dual-tree complex wavelet transform. Among them, the two filters are jointly designed to ensure that the two filters have good matching in frequency response and time domain characteristics. At the same time, necessary correction strategies are adopted to control the phase deviation between the two filters. In this way, while ensuring accurate signal extraction, flexible and changeable signal data can be better processed.

[0061] The correction strategy is as follows: the two selected filters have similar frequency response characteristics but different phases, and then the phase response of one filter is set to the negative value of the other filter to form an orthogonal basis. If this phase relationship is not satisfied, an additional phase deviation can be introduced at the output of one filter (multiplied by a complex exponent) to achieve it.

[0062] Then, the complex coefficients are converted into the input vector X=[x1, x2, ...., x n ]:

[0063] x'(t)=r*exp(i,θ)

[0064] Among them, r represents the amplitude (modulus); θ represents the phase angle of the signal.

[0065] Step S202: Obtain the vector matrix based on a plurality of input vectors of the original harmonic signals.

[0066] In this step, the vector matrix is ​​obtained based on the input vector of each of the original harmonic signals;

[0067] Among them, each row of the vector matrix represents the vector representation of each of the original harmonic signals in the original harmonic signal group, and each column of the vector matrix represents the signal characteristics of each of the original harmonic signals in the harmonic signal group, and the signal characteristics include: amplitude, phase angle, frequency information, and timing information.

[0068] Step S30: taking the vector matrix as input, inputting it into the BiLSTM model based on the attention mechanism, and outputting feature information of the vector matrix;

[0069] After the input layer is the BiLSTM layer. The frequency of the harmonic is an integer multiple of the fundamental frequency, so the harmonic signal has a certain correlation between each period, and the harmonic signal has a time sequence, so an improved BiLSTM is used here. The harmonic signal is divided into different segments according to certain parameters, and the output of the conventional BiLSTM at the current moment is calculated by the input at the current moment and the hidden layer state at the previous moment. In the present invention, the output of the current state is not only calculated by the input at the current moment and the hidden layer state at the previous moment, but also includes multiple hidden layer states in the forward or backward direction for calculation, that is, when calculating the data, not only the data is processed according to a single moment, but also the data is processed in a segmented manner in cycles. In this way, the relationship between periodic signals can be analyzed more advantageously, and more advantageous information of the data can be mined.

[0070] Step S301: In this step, this layer consists of a forward LSTM, a backward LSTM, and an output state connection layer. The following formula can be used to obtain the sequence m in the forward LSTM and the backward LSTM: t :

[0071] m t =w*concat(tanh(C_t),tanh(C_t-1))+b t ;

[0072] Where m t is the output hidden layer state, b t is the bias term, w is the weight, C_t and C_t-1 are the input matrix at the current moment and the hidden layer state matrix at the previous moment;

[0073] Step S302: After BiLSTM, there is the Attention layer. The Attention layer can give different weights to different eigenvalues ​​of the vector to distinguish the importance of different features, so as to make the result more accurate. The Attention layer uses the output of the BiLSTM layer mt as input and converts m t Input into the Attention layer, and output the weight information K of different positions in this layer through the following formula:

[0074]

[0075]

[0076] Step S40, converting the feature information of the vector matrix into probability through a linear layer and softmax normalization, and outputting the harmonic information corresponding to the highest probability, wherein the harmonic information includes: phases of harmonic current and harmonic voltage, and amplitudes of harmonics;

[0077] The final output of the decoder is passed through a linear layer to obtain a longer vector. The linear layer here is a fully connected neural network, and then converted into probability through softmax normalization. Finally, the harmonic current corresponding to the highest probability is selected as the output of this time step.

[0078] Step S50: Calculate the phase and amplitude of the optimal suppression current of the power grid according to the harmonic information, and output the suppression current through the APF.

[0079] This step includes:

[0080] Step S501, calculating the phase and amplitude of the optimal suppression current in the power grid according to the phase of the harmonic current and harmonic voltage, and the amplitude of the harmonics;

[0081] After obtaining the phase and amplitude information of harmonic current and harmonic voltage according to the above steps, the phase and amplitude of the optimal suppression current can be derived and finally the optimal suppression current can be output based on this information to achieve harmonic suppression. The phase and amplitude of the optimal suppression current in the power grid can be obtained by the commonly used method in the prior art. For example, refer to the journal paper: A Control Method of Shunt Active Power Filter for System-wide Harmonic Suppression Based on Complex-valued Neural Network[C], 2020IEEE 9thInternational Power Electronics and Motion Control Conference(IPEMC2020-ECCEAsia).IEEE, 2020:1543-1548.

[0082] Step S502: input the phase and amplitude of the optimal suppression current into the active power filter, and output the optimal suppression current through the active power filter to complete the harmonic suppression task.

Claims

1. A power grid harmonic suppression method based on BiLSTM model with attention mechanism, It is characterized in that The method comprises: Step S10, obtaining an original harmonic signal group at a preset time, each of the original harmonic signal groups including a plurality of original harmonic signals; Step S20, processing the original harmonic signal group to obtain a vector matrix for representing the harmonic current signal; Step S30: taking the vector matrix as input, inputting it into the BiLSTM model based on the attention mechanism, and outputting feature information of the vector matrix; Step S40, converting the feature information of the vector matrix into probability through a linear layer and softmax normalization, and outputting the harmonic information corresponding to the highest probability, wherein the harmonic information includes: phases of harmonic current and harmonic voltage, and amplitudes of harmonics; Step S50: Calculate the phase and amplitude of the optimal suppression current of the power grid according to the harmonic information, and output the suppression current through the APF.

2. According to the BiLSTM model based on the attention mechanism of claim 1, It is characterized in that The step S10 includes: using a Hall current sensor to measure the current signal in the power grid, and obtaining a plurality of discrete original harmonic signals by sampling with a 12-bit analog-to-digital converter.

3. According to the BiLSTM model based on the attention mechanism of claim 1, It is characterized in that Step S20 includes: Step S201: for each of the original harmonic signals, the original harmonic signal is processed by dual-tree complex wavelet transform to obtain complex coefficients, and then the complex coefficients are converted into input vectors; Step S202: Obtain the vector matrix based on a plurality of input vectors of the original harmonic signals.

4. According to claim 3, a method for suppressing power grid harmonics using a BiLSTM model based on an attention mechanism, It is characterized in that In step S201, the method for obtaining complex coefficients includes: Step S2011: Decompose the original harmonic signal group, wherein, in the decomposition process, the wavelet coefficients and scaling coefficients of the dual-tree complex wavelet transform are obtained using the following formula: Among them, Re represents the real part, Lm represents the imaginary part, j is the transformation scale, k is the position index, and d j (t) is the wavelet coefficient, c j (t) is the scaling factor, n is a positive integer; Step S2012: Use the dual-tree complex wavelet transform algorithm to obtain complex coefficients, so that tree 1 generates the real part and tree 2 generates the imaginary part. In the reconstruction process, the signal is reconstructed according to the wavelet coefficients and scaling coefficients obtained above, and the complex coefficients x'(t) are obtained using the following formula:

5. According to claim 2, a method for suppressing power grid harmonics using a BiLSTM model based on an attention mechanism, It is characterized in that In step S201, the complex coefficients are converted into the input vector X=[x 1 ,x 2 ,....,x n ]: x'(t)=r*exp(i,θ) Among them, r represents the amplitude (modulus); θ represents the phase angle of the signal.

6. A method for suppressing power grid harmonics based on a BiLSTM model with an attention mechanism according to claim 2, It is characterized in that In the step S202, the vector matrix is ​​obtained based on the input vector of each of the original harmonic signals; Among them, each row of the vector matrix represents the vector representation of each of the original harmonic signals in the original harmonic signal group, and each column of the vector matrix represents the signal characteristics of each of the original harmonic signals in the harmonic signal group, and the signal characteristics include: amplitude, phase angle, frequency information, and timing information.

7. According to claim 1, a method for suppressing power grid harmonics using a BiLSTM model based on an attention mechanism, It is characterized in that Step S30 includes: Step S301: Use the following formula to obtain the sequence M in the forward LSTM and the backward LSTM: m t =w*concat(tanh(C_t),tanh(C_t-1))+b t ; Where m t is the output hidden layer state, b t is the bias term, w is the weight; Step S302: m t Input into the Attention layer and output the weight information K of different positions through the following formula:

8. According to claim 1, a method for suppressing power grid harmonics using a BiLSTM model based on an attention mechanism, It is characterized in that Step S50 includes: Step S501, calculating the phase and amplitude of the optimal suppression current in the power grid according to the phase of the harmonic current and harmonic voltage, and the amplitude of the harmonics; Step S502: input the phase and amplitude of the optimal suppression current into the active power filter, and output the optimal suppression current through the active power filter to complete the harmonic suppression task.

Citation Information

Cited By

  • S2G charging station harmonic current detection and UPQC suppression method fusing wavelet transform and LVQ neural network

    CN120522438A