Transformer fusion spatiotemporal-VSG control method

Through the Transformer fusion of space-time-VSG control method, the Transformer encoder and decoder are used to predict active power and feedback frequency modulation, which solves the problems of low active power adjustment accuracy and long adjustment time in the traditional VSG control method, and achieves more efficient and accurate active power adjustment.

CN118971155BActive Publication Date: 2025-03-07SICHUAN UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411434931.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-15
Publication Date
2025-03-07
Estimated Expiration
2044-10-15

AI Technical Summary

Technical Problem

The traditional virtual synchronous generator (VSG) control method has low active power adjustment accuracy during the grid connection process, and the adjustment time is long, and the impact of space-time changes in multi-state variable parameters on the active power of the system is not fully considered.

Method used

Transformer fusion space-time-VSG control method is adopted to collect three-phase voltage, current and frequency data at the PCC, filter and power calculations are performed, and active power prediction is predicted using the Transformer encoder and the multi-head attention layer and feedforward network in the decoder, and the prediction results are fed back to the VSG active frequency control loop for frequency modulation.

Benefits of technology

It improves the accuracy and efficiency of VSG active power prediction, shortens the adjustment time, reduces power oscillation, and improves the system's anti-oscillation ability and power quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118971155B_ABST
    Figure CN118971155B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of electric power technology, and provides a Transformer fusion spatiotemporal-VSG control method, comprising: step 1, collecting three-phase voltage, three-phase current and frequency data at PCC; step 2, data filtering and denoising; step 3, power calculation, obtaining original active power and reactive power; step 4, sending the denoised voltage, current, frequency and active power after filtering into the Transformer fusion spatiotemporal power prediction structure, predicting through the multi-head attention layer and feedforward network in the Transformer encoder and decoder, and obtaining the predicted active power; step 5, VSG control; step 6, voltage and current dual-loop control. The present invention can better perform VSG active power prediction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of electric power technology, and in particular to a Transformer fusion space-time-VSG control method. Background Art

[0002] The virtual synchronous generator (VSG) provides dynamic response for the power system and enhances the stability of the power grid by simulating the damping and rotational inertia characteristics of a traditional synchronous generator.

[0003] In the process of connecting electricity to the grid, voltage, current and frequency will fluctuate instantaneously, causing system oscillation. At present, research on the stability of virtual synchronous generator grid connection mainly focuses on improving the active frequency part and the reactive voltage regulation part. Some scholars consider further optimizing VSG control by adjusting the moment of inertia and damping coefficient in the active frequency part. Some scholars reduce the system order by adding compensation links and adaptively adjust the parameters. Some scholars consider the coupling problem between virtual inertia and damping coefficient and adjust the coefficient through intelligent algorithms.

[0004] The above method considers virtual inertia and damping coefficient adjustment to improve the output power overshoot problem during grid connection. Although it has a certain effect on suppressing frequency fluctuations, the adjustment accuracy is not high and the adjustment time is long during application. Therefore, some researchers have also made corresponding improvements in the active frequency and reactive power regulation of virtual synchronous generators. The existing technology mainly reconstructs the control structure. Some scholars have designed nonlinear adaptive disturbance suppression control strategies, multi-objective feedback and optimal control of the system model, replacing the traditional double closed-loop control strategy. Some scholars consider the active-reactive dual loop coordination, establish an active-reactive coordinated controller in the form of negative feedback, introduce the coordinated control theory, and add the output results of active and reactive power to the control loop to reduce the output power of the virtual synchronous generator and improve the system's anti-oscillation ability. Some scholars have made improvements on traditional VSG control and proposed a feedforward compensation strategy, which can effectively suppress power oscillations during dynamic response. However, when considering the change of active frequency, the current power is often fed back to the active power regulation control loop, ignoring the influence of the spatiotemporal changes of multi-state variable parameters on the system active power, so further improvement is needed.

[0005] In terms of the spatiotemporal changes of multi-state variable parameters, neural network prediction is currently mostly used. Typical prediction models include convolutional neural networks, which have convolutional layers and pooling layers and can efficiently extract the features of data sequences. Based on simple neural networks, a recursive Transformer neural network relying on an attention mechanism is established. This network can effectively capture long-distance dependencies in texts and construct accurate final prediction sequences by globally searching for sequence features through a self-attention mechanism. In recent years, Transformer neural networks have been widely used in various fields, and have been improved in terms of structural types, pre-training methods, and application scenarios, and more intelligent structural forms have been derived, such as BERT bidirectional encoders, self-learning dynamic encoders for non-recursive models that are insensitive to position information, and self-attention AG models. In the power prediction scenario, some scholars have proposed a new time series Transformer model to predict the ultra-short-term output power of wind power generation, and some scholars have used Transformer encoders to predict the ultra-short-term photovoltaic power generation. However, the scenario applied to VSG active power prediction has not yet been proposed. Summary of the invention

[0006] The present invention provides a Transformer fusion spatiotemporal-VSG control method, which can better predict the active power of VSG.

[0007] According to the Transformer fusion spatiotemporal-VSG control method of the present invention, it comprises the following steps:

[0008] Step 1: Collect three-phase voltage, three-phase current and frequency data at the PCC;

[0009] Step 2: Data filtering and denoising;

[0010] Step 3: Power calculation to obtain original active power and reactive power;

[0011] Step 4: The denoised voltage, current, frequency and active power after filtering are sent to the Transformer fusion spatiotemporal power prediction structure, and predicted by the multi-head attention layer and feedforward network in the Transformer encoder and decoder to obtain the predicted active power;

[0012] Step 5: VSG control;

[0013] Step 6: Voltage and current dual-loop control.

[0014] Preferably, in step 1, discrete Fourier analysis is used to measure harmonic voltage and current data at the common connection point.

[0015] Preferably, in step 2, the three-phase voltage and three-phase current collected at the PCC point are filtered and denoised using a Kalman filter algorithm.

[0016] Preferably, in step 3, the filtered voltage and current data are subjected to power calculation according to the following formula to obtain active power and reactive power:

[0017] ;

[0018] in, is the d-axis denoised current after Park transformation, is the q-axis denoised current after Park transformation; is the d-axis denoised voltage after Park transformation, is the q-axis denoised voltage after Park transformation; , Represent the calculated values ​​of active power and reactive power respectively.

[0019] Preferably, in step 4, each encoder comprises two sub-layers: 1) a multi-head attention module; 2) a feed-forward network;

[0020] The two sub-layers are connected together through residual connection and layer normalization; the embedding vector containing the spatiotemporal encoding is first decomposed into multiple keys in the encoder. , Query ,value Group;

[0021] ;

[0022] in, is the learning parameter matrix for each group, X Represents the input sequence vector;

[0023] Each group is passed into the multi-head attention module, query All with key After comparison, the dot product calculation results in the unnormalized attention score, which is normalized using the following formula to obtain the attention weight. The weighted sum of each attention weight can obtain the historical and future values ​​of the current sequence.

[0024] ;

[0025] In the formula, Key The dimension of the vector;

[0026] The weighted sum of attention is reassembled and concatenated, and the output of the multi-head attention module is obtained after linear transformation:

[0027] ;

[0028] In the formula, is the weight matrix of the output result;

[0029] The second sub-layer feed-forward network of the encoder consists of the output of the multi-head attention through two linear transformations plus a tanh function:

[0030] ;

[0031] In the formula, is the activation function; is the embedding vector; is the deviation term of a linear transformation; is the weight matrix of a linear transformation; is the weight matrix of the quadratic linear transformation; is the deviation term of the quadratic linear transformation; is the output vector of the feedforward network;

[0032] After the output of the feedforward neural network, the input is added to the output through the residual connection, as shown in the following formula:

[0033] ;

[0034] In the formula, is the layer normalization function; is the output result of a linear process;

[0035] The above process is repeated in the encoder, and finally a sequence of multi-layer transformations is obtained.

[0036] Preferably, in step 5, considering the predicted active power, the VSG output active power is calculated according to the following formula:

[0037] ;

[0038] In the formula, is the active frequency setting value, is the active frequency control adjustment coefficient, is the difference between the output angular frequency and the reference value;

[0039] VSG output reactive power is calculated according to the following formula:

[0040] ;

[0041] In the formula, is the rated voltage; is the voltage proportionality coefficient; is the voltage integration coefficient; is the frequency variable in the complex function; is the actual reactive power output by the inverter; It is the rated reactive power output by the inverter.

[0042] Preferably, in step 6, the voltage amplitude and power angle information are obtained respectively through the active frequency control loop and reactive voltage control loop of the VSG, and the voltage amplitude and power angle information are used to generate PWM modulation signals through the voltage and current control layer, which are fed back to the main circuit to provide switching signals for the grid-connected inverter.

[0043] The present invention fully considers the denoised voltage and current after filtering, combines the historical active power to predict and estimate the future active power, and feeds it back to the VSG active frequency control loop for frequency modulation; the present invention fills the gap in the Transformer technology in the VSG active power prediction part, and can better solve the problems of low adjustment accuracy, large overshoot and long adjustment time in the traditional VSG control method during the grid connection process. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] Figure 1 It is a flow chart of a Transformer fusion spatiotemporal-VSG control method in an embodiment;

[0045] Figure 2 It is a VSG topology diagram in the embodiment;

[0046] Figure 3 It is a diagram of the structure of the spatiotemporal coding layer in the embodiment;

[0047] Figure 4 It is a VSG control topology diagram of Transformer fusion spatiotemporal power prediction in the embodiment;

[0048] Figure 5 Schematic diagram of the Transformer input vector in the embodiment;

[0049] Figure 6 Schematic diagram of the Transformer input vector key K, query Q, and value V in the embodiment;

[0050] Figure 7 A schematic diagram of a process for generating prediction probabilities in an embodiment;

[0051] Figure 8 This is a diagram of the Transformer fusion spatiotemporal power prediction structure in the embodiment;

[0052] FIG9 (a) is a fitting curve diagram of the training set prediction value and the true value of Transformer fusion spatiotemporal power prediction in the embodiment;

[0053] FIG9( b ) is a fitting curve diagram of the predicted value and the true value of the test set of Transformer fusion spatiotemporal power prediction in the embodiment;

[0054] Fig.10 is a histogram of the error between the predicted value and the true value in the embodiment;

[0055] Fig.11 It is a regression diagram between the predicted value and the true value in the embodiment;

[0056] FIG12( a ) is a comparison diagram of the active power response of the VSG output of the Transformer fused spatiotemporal-VSG and the traditional VSG output in the embodiment;

[0057] FIG12( b ) is a comparison diagram of the system frequency response of the Transformer fusion spatiotemporal-VSG and the traditional VSG output in the embodiment;

[0058] FIG13 (a) is a schematic diagram of the voltage harmonic content of a conventional VSG in an embodiment;

[0059] FIG13( b ) is a schematic diagram of the voltage harmonic content of the Transformer fusion spatiotemporal-VSG in an embodiment. DETAILED DESCRIPTION

[0060] In order to further understand the content of the present invention, the present invention is described in detail in conjunction with the accompanying drawings and embodiments. It should be understood that the embodiments are only for explaining the present invention and are not intended to limit it.

[0061] Example:

[0062] like Figure 1 As shown, this embodiment provides a Transformer fusion spatiotemporal-VSG control method, which includes the following steps:

[0063] Step 1: Collect three-phase voltage, three-phase current and system frequency data at the PCC;

[0064] Discrete Fourier analysis is used to measure the harmonic voltage and current data at the common connection point.

[0065] Step 2: Data filtering and denoising;

[0066] The Kalman filter algorithm is used to filter and denoise the collected three-phase voltage and three-phase current at the PCC point.

[0067] Step 3: Power calculation to obtain original active power and reactive power;

[0068] The filtered voltage and current data are used to calculate the power according to formula (12) to obtain the active power and reactive power.

[0069] Step 4: The denoised voltage, current, frequency and active power after filtering are sent to the Transformer fusion spatiotemporal power prediction structure, predicted by the multi-head attention layer and feedforward network in the Transformer encoder and decoder, and calculated according to formulas (4) to (10) to obtain the predicted active power.

[0070] Step 5: VSG control;

[0071] Considering the predicted active power, the VSG output active power is calculated according to formula (16), and its reactive power is calculated according to formula (3).

[0072] Step 6: Voltage and current dual loop control;

[0073] The voltage amplitude and power angle information are obtained through the active frequency control loop and reactive voltage control loop of the VSG respectively. The voltage amplitude and power angle information generate PWM modulation signals through the voltage and current control layer, which are fed back to the main circuit to provide switching signals for the grid-connected inverter.

[0074] Principle of Virtual Synchronous Generator

[0075] Figure 2 The VSG structure diagram includes a grid-connected inverter, an LC filter, a line impedance, and a power grid. For an ideal voltage source ignoring internal impedance, and They are filter inductor and filter capacitor respectively. is the grid inductance, The grid side load.

[0076] In VSG, the rotor motion equation is the core part of the control. By introducing virtual damping and inertia, VSG has similar operating characteristics to synchronous generators. The equivalent rotor motion equation is expressed as:

[0077] ;

[0078] in, is the virtual inertia; is the virtual damping; is the angular frequency of the VSG output; is the reference value of the output angular frequency; For time; is the difference between the output angular frequency and the reference value; is the mechanical power of VSG; is the electromagnetic power of VSG; is the virtual internal potential power angle. The VSG active frequency control process can be expressed as:

[0079] ;

[0080] In the formula, is the active frequency setting value, It is the active frequency control adjustment coefficient.

[0081] The VSG reactive voltage control part can be regarded as the excitation regulation process, which is expressed as:

[0082] ;

[0083] In the formula, is the VSG output voltage; is the rated voltage; It is the pi controller part in the reactive voltage control loop; is the voltage proportionality coefficient; is the voltage integral coefficient; is the frequency variable in the complex function; is the actual reactive power output by the inverter; It is the rated reactive power output by the inverter.

[0084] Transformer fusion spatiotemporal power prediction

[0085] Transformer fusion spatiotemporal power prediction improves the encoder and decoder on the traditional Transformer prediction, adding the time coding sequence information expressed by the tanh function in the position encoding layer to make the position information spatiotemporal. In the traditional Transformer prediction, the encoder takes the process data of the time series as input, and the decoder generates the prediction value through the self-attention mechanism.

[0086] (1) Encoder

[0087] Each encoder consists of two sub-layers: 1) a multi-head attention module; 2) a feed-forward network.

[0088] The two sub-layers are connected together through residual connection and layer normalization. The embedding vector containing the spatiotemporal encoding is first decomposed into multiple key vectors in the encoder. , Query ,value group.

[0089] ;

[0090] in, is the learning parameter matrix for each group, X Represents the input sequence vector.

[0091] Each group is passed into the multi-head attention module, query All with key After comparison, the dot product calculation results in the unnormalized attention score, which is normalized using formula (5) to obtain the attention weight. The weighted sum of each attention weight can obtain the historical and future values ​​of the current sequence.

[0092] ;

[0093] In the formula, Key The dimensions of the vector.

[0094] The weighted sum of attention is recombined and concatenated, and the output result of the multi-head attention module is obtained after linear transformation.

[0095] ;

[0096] In the formula, is the weight matrix of the output result.

[0097] The second sub-layer feed-forward network of the encoder is mainly composed of the output of multi-head attention through two linear transformations plus a tanh function.

[0098] ;

[0099] In the formula, is the activation function; is the embedding vector; is the deviation term of a linear transformation; is the weight matrix of a linear transformation; is the weight matrix of the quadratic linear transformation; is the deviation term of the quadratic linear transformation. is the output vector of the feedforward network.

[0100] After the output of the feedforward neural network, the input is added to the output through the residual connection, as shown in Equation (8). The above process is repeated in the encoder, and finally a sequence of multi-layer transformations is obtained.

[0101] ;

[0102] In the formula, is the layer normalization function; This is the output result of a linear process.

[0103] (2) Decoder

[0104] The decoder is responsible for converting the multi-layer transformation sequence generated by the encoder into the target sequence. Its overall structure is similar to that of the encoder. In addition to receiving the output sequence of the encoder, the decoder also synchronously processes the historical generation sequence information.

[0105] like Figure 3 As shown in the figure and Indicates voltage time encoding and voltage position encoding; and Indicates current time encoding and current position encoding; and Represents angular frequency time coding and angular frequency position coding; and represents power time encoding and power position encoding.

[0106] The spatiotemporal coding layer of the encoder and decoder encodes the time and spatial encoding Fusion is performed to obtain the fused spatiotemporal position encoding , whose expression is:

[0107]

[0108] The final output of the decoder is the probability distribution of each input vector obtained by linear transformation-softmax function processing of the previous layer output, and the value at the next moment is predicted based on this probability.

[0109] ;

[0110] Transformer fusion spatiotemporal power prediction uses the self-attention mechanism to find data patterns in the entire time scale, which can be used in power prediction to build a more accurate model.

[0111] Transformer Fusion Spatiotemporal-VSG Controller Design

[0112] The overall topological structure of the Transformer fusion spatiotemporal-VSG control method proposed in this embodiment is as follows: Figure 4 As shown in the figure, the main circuit includes a grid-connected inverter, an LC filter, a line impedance, and a power grid. The control loop includes a Kalman filter module, a Transformer fusion spatiotemporal power prediction module, a VSG control loop, and a voltage and current dual-loop control loop. is an ideal voltage source ignoring internal impedance; is the grid side current and voltage; the LC filter parameters are and is the grid inductance, is the grid side load; The three-phase current and three-phase voltage output by the inverter; is the denoised current and voltage after Kalman filtering; are the denoised current and voltage after Park transformation; Represent the calculated values ​​of active power and reactive power respectively; is the frequency reference value; is the VSG electromotive force; is the VSG power angle.

[0113] According to Kirchhoff's law, the mathematical model of the grid-connected inverter in the dq axis coordinate system after Park change can be obtained:

[0114] ;

[0115] is the d-axis denoised current after Park transformation, is the q-axis denoised current after Park transformation; is the d-axis denoised voltage after Park transformation, is the q-axis denoised voltage after Park transformation; is the grid side load, is the filter capacitor, and Grid-connected side Axis and Shaft voltage.

[0116] The control of the grid-connected inverter VSG mainly focuses on the regulation of active power and reactive power. Its input active power and reactive power are:

[0117] ;

[0118] Transformer fusion spatiotemporal power prediction module input vector , its feature dimension is 4, and its encoding process is as follows Figure 5 shown.

[0119] According to the Transformer encoding process, the input vector R1 is decomposed into key K, query Q, and value V, and the input vector after adding the spatiotemporal encoding is , the mathematical formula of this process is shown in formula (4). Figure 6 middle To learn the parameter matrix, according to the characteristics of the input vector, select The parameter matrix can be obtained in the end of Matrix. and Transposing the matrix and performing dot product calculation can get the correlation coefficient matrix , which describes the relationship between each element in the input vector R1 and the predicted power The correlation between them. After softmax normalization, the probability matrix can be obtained. The detailed process is as follows Figure 6 , Figure 7 shown.

[0120] This embodiment selects a 3-head 32-channel self-attention mechanism, and the output vector obtained in the encoder part After the tanh function and linear transformation in the feedforward network, the result of equation (14) is obtained. The output vector R will be transmitted to the decoder and the same operation as the encoder process will be performed. Finally, the softmax function is used to normalize equation (15) to obtain the predicted Value, Transformer structure is as follows Figure 8 shown.

[0121] ;

[0122] At this time, the improved VSG active frequency control process can be expressed as:

[0123] ;

[0124] The root mean square error (RMSE) is used as the evaluation indicator.

[0125] ;

[0126] In the above formula, represents the real power value at time t, It represents the predicted power value at time t. The smaller the RMSE value is, the better the prediction effect of the model is.

[0127] Experimental analysis

[0128] In order to verify the Transformer fusion space-time-VSG control structure proposed in this embodiment, a grid-connected simulation model is built on the Matlab / Simulink platform, and the parameters are given in Table 1.

[0129] Table 1 System parameters

[0130]

[0131] A comparative analysis is conducted on the traditional VSG control and Transformer fusion space-time-VSG control under the same operating conditions to compare the grid-connected output power, frequency change, and voltage harmonic content.

[0132] Figure 9 (a) and Figure 9 (b) are the predicted value and true value fitting curves of Transformer fusion spatiotemporal power prediction. According to the real-time voltage, current, frequency and power collected by the system, the output power is predicted using the Transformer fusion spatiotemporal algorithm. Figure 9 (a) shows that the training set predicted value curve has a good close fit with the true value curve, and the numerical range of the prediction result, that is, the predicted output power range, is about 1.47~1.49 kW. Figure 9 (b) shows that the test set predicted curve and the true value curve have basically the same change trend, with a high degree of fit. Combining the comprehensive performance of the training set and the test set, it can be concluded that the proposed Transformer fusion spatiotemporal-VSG control structure has good learning performance, strong expressiveness, and high accuracy.

[0133] Fig.10 The error histogram between the predicted value and the true value shows an approximate normal distribution shape, indicating that the error between most predicted values ​​and the true value is small. Its center is close to the zero error line, and the histogram has high left-right symmetry, the error is relatively concentrated, and multiple features indicate that the model prediction value is relatively accurate. Fig.11 This is the regression diagram of the predicted value and the true value. The data are mostly close to the regression line. According to formula (16), the RMSE value of the model can be calculated to be 0.992, and the model fitting effect is good.

[0134] Figure 12 (a) and Figure 12 (b) are comparison diagrams of the VSG output power response and system frequency response under Transformer fusion spatiotemporal-VSG control and traditional VSG control. As shown in Figure 12 (a), when the system is connected to the grid at 0 s, the traditional VSG control strategy has a large power oscillation at the moment of grid connection, and gradually recovers to stability after 0.3s, with an output power of 1kW. The system power overshoot under the Transformer fusion spatiotemporal-VSG control strategy is reduced by 57.6% compared with the traditional VSG control strategy, and the adjustment time is shortened by 33%, with an output power of 1.48kW. In terms of frequency response, as shown in Figure 12 (b), the grid-connected operation will have a certain impact on the system frequency. For the system under the traditional VSG control strategy, the frequency fluctuation amplitude is larger. The system frequency reaches 53 Hz with a maximum overshoot of 6% at 0.02s, and the frequency recovers to 50 Hz after 0.25s. The system frequency response using the Transformer fusion space-time-VSG control strategy is greatly improved, and the frequency recovery time is greatly shortened. The system is connected to the grid at 0 s, the system frequency suddenly changes to 52 Hz at 0.02s, and the frequency recovers to 50 Hz after 0.15s. By comparison, it can be concluded that the Transformer fusion space-time-VSG control proposed in this embodiment inputs more power to the grid, providing good power support and frequency response for the grid.

[0135] Figure 13 (a) and Figure 13 (b) analyze the voltage harmonic content of the traditional VSG control and the Transformer fusion space-time-VSG control system. The voltage harmonic content in the traditional VSG control is 0.68%, and the voltage harmonic content in the Transformer fusion space-time-VSG control system is significantly reduced to 0.15%, and the power quality is improved. It is proved that the method based on Transformer fusion space-time-VSG control has low harmonic characteristics, which is more advantageous in practical applications, can effectively reduce interference to the power grid and improve power quality.

[0136] The present invention and its embodiments are described schematically above, and the description is not restrictive. The drawings show only one embodiment of the present invention, and the actual structure is not limited thereto. Therefore, if a person skilled in the art is inspired by it and designs a structural method and an embodiment similar to the technical solution without creativity without departing from the purpose of the invention, they shall all fall within the protection scope of the present invention.

Claims

1. Transformer fusion spatiotemporal-VSG control method, characterized by: The following steps are involved: Step 1: Collect three-phase voltage, three-phase current and frequency data at the PCC; Step 2: Data filtering and denoising; Step 3: Power calculation to obtain original active power and reactive power; Step 4: The denoised voltage, current, frequency and active power after filtering are sent to the Transformer fusion spatiotemporal power prediction structure, and predicted by the multi-head attention layer and feedforward network in the Transformer encoder and decoder to obtain the predicted active power; In step 4, each encoder consists of two sub-layers: 1) a multi-head attention module; 2) Feedforward network; The two sub-layers are connected together through residual connection and layer normalization; the embedding vector containing the spatiotemporal encoding is first decomposed into multiple groups containing key K, query Q, and value V in the encoder; Among them, W i Q , W i K , W i V is the learning parameter matrix for each group, X represents the input sequence vector; When each group is passed into the multi-head attention module, the query Q is compared with the key K, and the dot product is calculated to obtain the unnormalized attention score, which is normalized using the following formula to obtain the attention weight; the weighted sum of each attention weight can obtain the historical and future values ​​of the current sequence; Where, d k is the dimension of the key K vector; The weighted sum of attention is reassembled and concatenated, and the output of the multi-head attention module is obtained after linear transformation: MHead(Q,K,V)=Concat(head1,...,head H )W O Where W O is the weight matrix of the output result; The second sub-layer feed-forward network of the encoder consists of the output of the multi-head attention through two linear transformations plus a tanh function: In the formula, tanh() is the activation function; X=Q=K=V is the embedding vector; δ1 is the bias term of a linear transformation; is the weight matrix of a linear transformation; is the weight matrix of the quadratic linear transformation; δ2 is the bias term of the quadratic linear transformation; X″ is the output vector of the feedforward network; After the output of the feedforward neural network, the input is added to the output through the residual connection, as shown in the following formula: Where, LayerNorm() is the layer normalization function; is the output result of a linear process; The above process is repeated in the encoder, and finally a sequence of multi-layer transformations is obtained; Step 5: VSG control; Step 6: Voltage and current dual-loop control.

2. The Transformer fusion spatiotemporal-VSG control method according to claim 1, characterized in that: In step 1, discrete Fourier analysis is used to measure the harmonic voltage and current data at the common connection point.

3. The Transformer fusion spatiotemporal-VSG control method according to claim 2, characterized in that: In step 2, the Kalman filter algorithm is used to filter and denoise the collected three-phase voltage and three-phase current at the PCC point.

4. The Transformer fusion spatiotemporal-VSG control method according to claim 3, characterized in that: In step 3, the filtered voltage and current data are used to calculate the power according to the following formula to obtain the active power and reactive power: Among them, i * o_d is the d-axis denoised current after Park transformation, i * o_q is the q-axis denoised current after Park transformation; v * o_d is the d-axis denoised voltage after Park transformation, v * o_q is the q-axis denoised voltage after Park transformation; P0 * ,Q0 * Represent the calculated values ​​of active power and reactive power respectively.

5. The Transformer fusion spatiotemporal-VSG control method according to claim 4, characterized in that: In step 5, considering the predicted active power, the VSG output active power is calculated according to the following formula: P t * =P ref -K ω Give Where P ref is the active frequency setting value, K ω is the active frequency control adjustment coefficient, Δω is the difference between the output angular frequency and the reference value; VSG output reactive power is calculated according to the following formula: In the formula, U0 is the rated voltage; K p is the voltage proportionality coefficient; K i is the voltage integral coefficient; s is the frequency variable in the complex function; Q e The actual reactive power output by the inverter; Q ref It is the rated reactive power output by the inverter.

6. The Transformer fusion spatiotemporal-VSG control method according to claim 5, characterized in that: In step 6, the voltage amplitude and power angle information are obtained through the active frequency control loop and reactive voltage control loop of the VSG respectively. The voltage amplitude and power angle information generate PWM modulation signals through the voltage and current control layer, which are fed back to the main circuit to provide switching signals for the grid-connected inverter.

Citation Information

Patent Citations

  • DFIG virtual synchronous machine low voltage ride through method and device, electronic equipment and medium

    CN111725837A

  • VSC converter model prediction control method and system considering unbalanced filter inductance

    CN113890090A