Adaptive PID CPPS transient stability control method based on Transform space-time fusion
By adopting an adaptive PID control method based on Transformer spatiotemporal fusion, the CPPS network delay is predicted in real time and the PID controller parameters are switched, which solves the transient stability problem caused by random network delay in CPPS, realizes high-precision delay prediction and transient stability control, and adapts to the stochastic characteristics of CPPS.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SICHUAN UNIV
- Filing Date
- 2025-12-09
- Publication Date
- 2026-05-01
AI Technical Summary
Existing technologies are insufficient to effectively address transient stability issues caused by random network delays in cyber-physical power systems (CPPS), especially due to random delays, packet loss, and confusion in wide-area measurement signal transmission, which can lead to degradation of controller transient performance or even system instability.
An adaptive PID control method based on Transformer spatiotemporal fusion is adopted. By constructing a Transformer spatiotemporal fusion prediction model, the network delay is predicted in real time, and the PID controller parameters are switched according to the delay interval to achieve transient stable control of CPPS.
It improves the prediction accuracy and transient stability control effect of CPPS random delay, reduces the transient oscillation amplitude after disturbance, speeds up the system recovery time, adapts to the randomness characteristics of CPPS network delay, and is feasible for practical engineering applications.
Smart Images

Figure CN121967274A_ABST
Abstract
Description
A Transformer-based Spatiotemporal Fusion Adaptive PID CPPS Transient Stability Control Method Technical Field
[0001] This invention relates to the field of power technology, and in particular to a CPPS transient stability control method based on Transformer spatiotemporal fusion adaptive PID. Background Technology
[0002] With the deep integration of information technology and physical power systems, modern power systems have evolved into Cyber-Physical Power Systems (CPPS). CPPS relies on wide-area measurement signals (such as data from synchronous phasor measurement units, PMUs) for monitoring and control. However, wide-area signal transmission suffers from random network delays (ranging from a few milliseconds to hundreds of milliseconds). The randomness of these delays is affected by factors such as the type of PMU, communication network interaction, and data transmission protocols, and may also be accompanied by problems such as packet loss and packet corruption. These problems can severely degrade the transient performance of CPPS controllers and even lead to system instability. Therefore, addressing random network delays has become a key requirement for transient stability control in CPPS.
[0003] Existing technologies mainly address this problem through two approaches: first, designing delay-damping controllers (such as using the Pade approximation method to approximate the delay element as a transfer function, or designing a wide-area damping controller (WADC) using linear matrix inequalities) to enhance the controller's delay damping capability; second, compensating for the delay (such as the classic Smith predictor and improved Smith predictors) by constructing a feedback loop that correlates the system's physical dynamics with the delay value to eliminate the delay's impact. However, existing technologies have significant drawbacks: they do not fundamentally solve the adaptation problem of "random unknown delays" in CPPS, and they heavily rely on detailed system models (which are difficult to obtain in complex power grids). Furthermore, most compensation schemes only address "fixed delays," making it difficult to cover the dynamic delay variations encountered in actual CPPS operation. Summary of the Invention
[0004] This invention provides a transient stability control method for CPPS based on Transformer spatiotemporal fusion and adaptive PID. It proposes an integrated solution of Transformer spatiotemporal fusion prediction and adaptive PID control to address the transient stability problem caused by random network delay in CPPS.
[0005] To achieve the above objectives, the present invention adopts the following technical solution: a CPPS transient stability control method based on Transformer spatiotemporal fusion adaptive PID, comprising: Step 1: acquiring historical network delay data during CPPS operation; Step 2: constructing a Transformer spatiotemporal fusion prediction model, which includes an encoder and a decoder. The encoder contains a multi-head attention module and a feedforward network, and the multi-head attention module and the feedforward network are sequentially connected through residual connections and layer normalization. In addition to the same multi-head attention module and feedforward network as the encoder, the decoder also contains an additional encoder-decoder attention layer. During the model input stage, the time code and spatial code are fused to form a spatiotemporal fusion position code, which is used as the input to the Transformer spatiotemporal fusion prediction model; Step 3: training the Transformer spatiotemporal fusion prediction model using historical network delay data, so that the trained model... The model has the ability to predict CPPS network latency in real time. Step 4: Analyze the range of network latency changes during CPPS operation, divide the range into multiple latency intervals, and for each latency interval, determine a set of PID controller parameters adapted to the latency of that interval through CPPS transient stability simulation, thus completing the preset grouping of PID controller parameters. Step 5: During the actual operation of CPPS, input the real-time collected CPPS operation data into the trained Transformer spatiotemporal fusion prediction model, and use this model to predict the current CPPS network latency in real time. Step 6: Based on the current CPPS network latency predicted in Step 5, determine the latency interval to which it belongs, and based on the preset grouping of PID controller parameters, switch the PID controller parameters to the preset PID controller parameters corresponding to that latency interval. Step 7: Regulate the CPPS operation state through the PID controller with switched parameters to achieve transient stability control of CPPS.
[0006] In this specification, in step two, when the multi-head attention module of the Transformer spatiotemporal fusion prediction model encoder is working, it first decomposes the input spatiotemporal fusion position code into multiple sets of query vectors, key vectors, and value vectors through a linear transformation. Then, it calculates the dot product of each set of query vectors and the corresponding key vector to obtain the initial attention score. Subsequently, it processes the initial attention score using a normalization function, and then weights and sums the processed attention score with the corresponding value vector to obtain the single-head attention output. Finally, it concatenates all the single-head attention outputs and performs a linear transformation to obtain the final output of the multi-head attention module.
[0007] In this specification, in step two, when the decoder of the Transformer spatiotemporal fusion prediction model is working, it simultaneously receives the feature sequence output by the encoder and the historically generated delay prediction sequence. First, it mines the correlation information in the historical prediction sequence through the internal multi-head attention module, then establishes the mapping relationship between the correlation information and the encoder feature sequence through the encoder and decoder attention layers, and finally inputs the mapped information into the feedforward network for processing. After the processing result is adjusted by linear transformation and normalization function, the network delay prediction value of the current CPPS is obtained.
[0008] In this manual, in step four, when dividing the delay interval, the transient response characteristics of CPPS under different network delays are used as the basis. The rotor speed fluctuation amplitude and active power overshoot are selected as the core evaluation indicators. By comparing the threshold changes of the indicators corresponding to different delays, the boundaries of each delay interval are determined to ensure that the switching of PID controller parameters corresponding to adjacent delay intervals will not cause a sudden change in the transient performance of CPPS.
[0009] In this manual, in step four, when determining the PID controller parameters through CPPS transient stability simulation, the proportional coefficient, integral coefficient, and derivative coefficient of the PID controller are adjusted sequentially using the control variable method. The objective function is to minimize the CPPS transient recovery time and the overshoot. The optimal PID controller parameter combination corresponding to each delay interval is selected, and the parameter combination is stored in the preset group of PID controller parameters.
[0010] In this manual, in step one, when acquiring historical network delay data, delay data during wide-area signal transmission is collected using the synchronous phasor measurement device in the CPPS. The collection scenario covers typical operating conditions. Abnormal pulse interference is removed from the collected raw delay data using the moving average method to obtain standardized historical network delay data.
[0011] In this specification, in step two, the construction process of the spatiotemporal fusion location code is as follows: the time code is calculated by the difference between the acquisition time of the delayed sequence and the initial acquisition time, and the spatial code is obtained by transforming the geographical coordinates of the signal acquisition node. The time code and the spatial code are concatenated by dimension and then normalized to finally form the spatiotemporal fusion location code required for the input of the Transformer spatiotemporal fusion prediction model.
[0012] In this specification, the adaptive PID CPPS transient stability control method based on Transformer spatiotemporal fusion also includes a fault scenario adaptation step: when a three-phase ground short-circuit fault occurs in the CPPS, after the fault is cleared, the fault type and fault clearing time information are added to the real-time collected CPPS operating data. The supplemented operating data is then input into the trained Transformer spatiotemporal fusion prediction model to correct the prediction result of the current network delay. Finally, the PID controller parameters are switched based on the corrected prediction delay.
[0013] In this manual, in step three, when training the Transformer spatiotemporal fusion prediction model, the mean squared error is used as the model's loss function. The model's parameters are iteratively updated using the Adam optimizer. After every 100 rounds of training, an independent test set is used to verify the model's prediction accuracy. When the prediction error of the test set is lower than a preset threshold for 5 consecutive rounds, the model training is stopped.
[0014] In this specification, the adaptive PID CPPS transient stability control method based on Transformer spatiotemporal fusion also includes a model iterative optimization step: every preset period, the actual network delay data of CPPS in that period and the predicted delay data at the corresponding time are combined to form a new training sample, and the new training sample is added to the historical network delay data to incrementally train the Transformer spatiotemporal fusion prediction model to adapt to the long-term changes in the network delay characteristics of CPPS.
[0015] In summary, the present invention has at least the following beneficial effects: excellent delay prediction accuracy: the spatiotemporal fusion prediction model based on Transformer can effectively capture the temporal series pattern and spatial correlation characteristics of network delay, the prediction results have a high degree of fit with the actual delay, the error distribution is concentrated and close to the zero error benchmark, the model has high confidence in the delay prediction, and can achieve high-precision mapping of CPPS random delay.
[0016] Significant transient stability control effect: Compared with delay-free compensation control and traditional wide-area damping control, the adaptive PID control strategy combined with Transformer prediction can more significantly reduce the transient oscillation amplitude of CPPS after disturbance, accelerate the oscillation decay speed, greatly shorten the system recovery time, and effectively suppress low-frequency oscillation of the system.
[0017] High adaptability to various scenarios and high engineering value: This control strategy does not require online adjustment of PID parameters (it only switches preset parameter groups by delay intervals), avoids dependence on complex system models, can effectively compensate for time delay phase differences in information transmission, adapts to the randomness characteristics of CPPS network delay, and has the feasibility and applicability for practical engineering applications. Attached Figure Description
[0018] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0019] Figure 1 is a schematic diagram of the CPPS transient stability control method based on Transformer spatiotemporal fusion adaptive PID involved in this invention.
[0020] Figure 2 is a schematic diagram of the topology of the single-machine simulation of CPPS with small disturbances involved in this invention.
[0021] Figure 3 is a schematic diagram of the control block diagram of the adaptive PID CPPS transient stability control method based on Transformer spatiotemporal fusion involved in this invention.
[0022] Figure 4 is a schematic diagram of the Transformer encoder involved in this invention.
[0023] Figure 5 is a schematic diagram of the training set prediction curve involved in this invention.
[0024] Figure 6 is a schematic diagram of the test set prediction curve involved in this invention.
[0025] Figure 7 is a schematic diagram of the error histogram between the predicted value and the actual value involved in this invention.
[0026] Figure 8 is a schematic diagram of the active power control curve of the 30ms delay generator involved in this invention.
[0027] Figure 9 is a schematic diagram of the rotor angular velocity curve of the 30ms delay generator involved in this invention.
[0028] Figure 10 is a schematic diagram of the rotor angle curve of the 30ms delay generator involved in this invention.
[0029] Figure 11 is a schematic diagram of the active power control curve of the 50ms delay generator involved in this invention.
[0030] Figure 12 is a schematic diagram of the rotor angular velocity curve of the 50ms delay generator involved in this invention.
[0031] Figure 13 is a schematic diagram of the rotor angle curve of the 30ms delay generator involved in this invention. Detailed Implementation
[0032] In the following description, only certain exemplary embodiments are briefly described. As those skilled in the art will recognize, the described embodiments can be modified in various ways without departing from the spirit or scope of the embodiments of the invention. Therefore, the drawings and description are considered to be exemplary in nature and not restrictive.
[0033] The following disclosure provides many different implementations or examples for carrying out different structures of the embodiments of the present invention. To simplify the disclosure of the embodiments of the present invention, specific examples of components and arrangements are described below. Of course, these are merely examples and are not intended to limit the embodiments of the present invention. Furthermore, reference numerals and / or reference letters may be repeated in different examples of the embodiments of the present invention; such repetition is for simplification and clarity and does not in itself indicate a relationship between the various implementations and / or arrangements discussed.
[0034] The embodiments of the present invention will now be described in detail with reference to the accompanying drawings.
[0035] As shown in Figure 1, this embodiment provides a CPPS transient stability control method based on Transformer spatiotemporal fusion adaptive PID, including: Step 1: Obtaining historical network delay data during CPPS operation; Step 2: Constructing a Transformer spatiotemporal fusion prediction model, which includes an encoder and a decoder. The encoder contains a multi-head attention module and a feedforward network, and the multi-head attention module and the feedforward network are sequentially connected through residual connections and layer normalization. In addition to the same multi-head attention module and feedforward network as the encoder, the decoder also contains an additional encoder-decoder attention layer. During the model input stage, the time code and spatial code are fused to form a spatiotemporal fusion position code, which is used as the input to the Transformer spatiotemporal fusion prediction model; Step 3: Training the Transformer spatiotemporal fusion prediction model using historical network delay data, so that the trained model possesses... The system has the capability to predict CPPS network latency in real time. Step 4: Analyze the range of network latency variation during CPPS operation, divide the latency into multiple intervals based on this range, and for each interval, determine a set of PID controller parameters adapted to that interval's latency through CPPS transient stability simulation, completing the preset grouping of PID controller parameters. Step 5: During actual CPPS operation, input the real-time collected CPPS operation data into the trained Transformer spatiotemporal fusion prediction model, and use this model to predict the current CPPS network latency in real time. Step 6: Based on the current CPPS network latency predicted in Step 5, determine its corresponding latency interval, and based on the preset grouping of PID controller parameters, switch the PID controller parameters to the preset PID controller parameters corresponding to that latency interval. Step 7: Regulate the CPPS operating state using the PID controller with switched parameters to achieve transient stability control of the CPPS.
[0036] In some embodiments, in step two, when the multi-head attention module of the Transformer spatiotemporal fusion prediction model encoder is working, it first decomposes the input spatiotemporal fusion position code into multiple sets of query vectors, key vectors, and value vectors through a linear transformation. Then, it calculates the dot product of each set of query vectors and the corresponding key vector to obtain the initial attention score. Subsequently, it processes the initial attention score using a normalization function, and then weights and sums the processed attention score with the corresponding value vector to obtain the single-head attention output. Finally, it concatenates all the single-head attention outputs and performs a linear transformation to obtain the final output of the multi-head attention module.
[0037] In some embodiments, during step two, when the decoder of the Transformer spatiotemporal fusion prediction model is working, it simultaneously receives the feature sequence output by the encoder and the historically generated delay prediction sequence. First, it mines the correlation information in the historical prediction sequence through the internal multi-head attention module, then establishes a mapping relationship between the correlation information and the encoder feature sequence through the encoder and decoder attention layers, and finally inputs the mapped information into the feedforward network for processing. After the processing result is adjusted by linear transformation and normalization function, the network delay prediction value of the current CPPS is obtained.
[0038] In some embodiments, in step four, when dividing the delay interval, the transient response characteristics of CPPS under different network delays are used as the basis, and the rotor speed fluctuation amplitude and active power overshoot are selected as the core evaluation indicators. By comparing the indicator change thresholds corresponding to different delays, the boundaries of each delay interval are determined to ensure that when the PID controller parameters corresponding to adjacent delay intervals are switched, it will not cause a sudden change in the transient performance of CPPS.
[0039] In some embodiments, in step four, when determining the PID controller parameters through CPPS transient stability simulation, the proportional coefficient, integral coefficient, and derivative coefficient of the PID controller are adjusted sequentially using the control variable method. The objective function is to minimize the CPPS transient recovery time and the overshoot. The optimal PID controller parameter combination corresponding to each delay interval is selected, and the parameter combination is stored in the preset group of PID controller parameters.
[0040] In some embodiments, in step one, when acquiring historical network delay data, delay data during wide-area signal transmission is collected using the synchronous phasor measurement device in the CPPS. The collection scenario covers typical operating conditions. Abnormal pulse interference is removed from the collected raw delay data using the moving average method to obtain standardized historical network delay data.
[0041] In some embodiments, in step two, the construction process of the spatiotemporal fusion location code is as follows: the time code is calculated by the difference between the acquisition time of the delayed sequence and the initial acquisition time, and the spatial code is obtained by transforming the geographical coordinates of the signal acquisition node. The time code and the spatial code are concatenated by dimension and then normalized to finally form the spatiotemporal fusion location code required for the input of the Transformer spatiotemporal fusion prediction model.
[0042] In some embodiments, the CPPS transient stability control method based on Transformer spatiotemporal fusion adaptive PID further includes a fault scenario adaptation step: when a three-phase ground short-circuit fault occurs in the CPPS, after the fault is cleared, the fault type and fault clearing time information are supplemented into the real-time collected CPPS operating data, the supplemented operating data is input into the trained Transformer spatiotemporal fusion prediction model to correct the prediction result of the current network delay, and then the PID controller parameters are switched based on the corrected prediction delay.
[0043] In some embodiments, in step three, when training the Transformer spatiotemporal fusion prediction model, the mean squared error is used as the loss function of the model, and the parameters of the model are updated iteratively through the Adam optimizer. After every 100 rounds of training, an independent test set is used to verify the prediction accuracy of the model. When the prediction error of the test set for 5 consecutive rounds is lower than a preset threshold, the model training is stopped.
[0044] In some embodiments, the CPPS transient stability control method based on Transformer spatiotemporal fusion adaptive PID further includes a model iterative optimization step: every preset period, the actual network latency data of CPPS within that period and the predicted latency data at the corresponding time are combined to form a new training sample, the new training sample is added to the historical network latency data, and the Transformer spatiotemporal fusion prediction model is incrementally trained to adapt to the long-term changes in the CPPS network latency characteristics.
[0045] The technical concept of this invention is as follows: a standalone cyber-physical system with network communication delay, wherein the circuit model of the parameters is shown in Figure 2. The system parameters are: , , Pm=1.11 H=5 , , , , , , .
[0046] in, This is the per-unit value of the direct-axis synchronous reactance. This is the per-unit value of the direct-axis transient reactance. The per-unit values are: quadrature-axis synchronous reactance and Pm mechanical input power. H is the direct-axis open-circuit transient time constant (in seconds), and H is the inertial time constant (in seconds). This refers to the per-unit value of the reference angular frequency or rated electrical angular velocity. Generator stator leakage reactance, For the generator armature resistance, For the excitation system gain, The time constant of the excitation system (unit: seconds). The initial per-unit value of the terminal voltage is [value to be filled in]. Voltage reference value per unit.
[0047] The transient stability simulation results of the fault point setting system, where a three-phase ground fault occurs at 0.1 seconds and the faulted line is disconnected after 0.1 seconds, are compared with those of the traditional power system, which has the same fault disconnection time. This is because it is impossible to set the disconnection time based on the random network delay time.
[0048] A network system is an integration of communication, computing, and control systems, while a physical system is a regional power system where devices are electrically connected. In a CPPS (Power Conversion System-on-Platform), the power network and communication network form a dynamic, bidirectional support relationship through a cross-layer coupling mechanism. The power network provides energy security and information infrastructure for the operation of communication equipment; the communication network undertakes real-time monitoring and control commands for the power system's operating status. A single-machine infinite bus system is a basic model for studying power system dynamics and control. This invention uses a single-machine infinite bus system as the research object for its physical power system, and the block diagram of the CPPS including network delay simulation is shown in Figure 3.
[0049] Using Matlab and Truetime 2.0, a cyber-physical power system was simulated, and the power system model was established as an infinite-scale system with information transmission delay. The main modules of the single-machine infinite-scale system structural model include a synchronous generator, an excitation system, and an infinite-scale model.
[0050] Network latency was simulated using the TrueTime2.0 module, with a data transmission rate of 80kb / s and a minimum data frame size of 5 bytes. The initial active power input of the generator during startup remained at 0.7376 pu. The fault point setting system experienced a three-phase ground fault at 0.1s, and the fault line was disconnected 0.1s later. The initial active power input of the generator during startup was 0.8 pu. The total simulation duration was 5s, considering the impact of network latency on the dynamic characteristics and stability after fault disconnection under the same fault disconnection time.
[0051] (1) Adaptive PID control based on Transformer fusion spatiotemporal prediction. Transformer fusion spatiotemporal network delay prediction. The Transformer model is a deep learning architecture based on attention mechanism. Its powerful parallel computing ability and strong modeling ability for sequence data have made it widely used in prediction tasks. The Transformer fusion spatiotemporal prediction encoder takes the time series process data as input, and the decoder generates the prediction value through self-attention mechanism.
[0052] Each encoder contains two sub-layers: a multi-head attention module and a feedforward network. These two sub-layers are connected together via residual connections and layer normalization. Positional encoding is introduced to preserve the temporal order information in the time series data, thereby improving prediction accuracy.
[0053] Time-coded Sec t and spatial encoding Pos xy The fusion process yields the fused spatiotemporal positional encoding input, expressed as: (1) Transformer introduces query Q, key K and value V. For input X, through three different linear transformations, it is first decomposed into multiple groups containing key K, query Q and value V. This is called multi-head.
[0054] (2) Where X is the input vector; Let be the learning parameter matrix for group i.
[0055] In each group fed into the multi-head attention module, the query Q is compared with the key K, and the dot product is used to obtain the unnormalized attention score. A weighted summation of each attention weight yields the historical and future values of the current sequence, which is also the output of any head. =Attention( ).
[0056] (3) In the formula, Let K be the dimension of the key vector K. It is introduced to prevent the gradient of the softmax function from vanishing due to an excessively large dot product.
[0057] The outputs of all the heads are weighted and concatenated, and then the final output is obtained through linear transformation, as shown in formula (4), which is represented as Z(X).
[0058] (4) In the formula, This is the weight matrix of the output result.
[0059] Each encoder module contains multiple attention heads and a feedforward neural network, both of which have residual connections and layer normalization. The decoder block additionally contains encoder and decoder attention layers. The encoder output is: Encoder(X) = layerNorm(X + MultiHead(X)) + FFN(X); (5) where the feedforward network consists of two layers. The first layer uses ReLU to perform a nonlinear transformation on the result, and the second layer uses layerNorm() as the layer normalization function. The output is obtained by using the linear transformation FFN(X), as shown in formula (6).
[0060] (6) In equation (6), ReLU() is the activation function; X is the embedding vector; This is the weight matrix for a linear transformation; This is the deviation term for a linear transformation; This is the weight matrix for the quadratic linear transformation; This is the deviation term of the quadratic linear transformation.
[0061] After the feedforward neural network outputs, the input is added to the output through a residual connection, as shown in Equation (5). The above process is repeated in the encoder to finally obtain a multi-layer transformation sequence.
[0062] The Transformer encoder, as shown in Figure 4, converts the multi-layer transform sequence generated by the encoder into the target sequence. Its overall structure is similar to that of the encoder. In addition to receiving the encoder's output sequence, the decoder also processes historical generated sequence information synchronously. The decoder's final output is the probability distribution of each input vector obtained by processing the previous layer's output through a linear transform—the softmax function. This probability is used to predict the transmission delay of the next time-step value information.
[0063] (8) Adaptive PID Control Based on Delay Prediction of Transformer Fusion Spatiotemporal Model The control block diagram of the adaptive PID control based on delay prediction of Transformer fusion spatiotemporal model is shown in Figure 7. The cyber-physical power system is simulated using Matlab and Truetime 2.0, and the power system model is established as a single-machine infinite bus system with information transmission delay. The main modules of the single-machine infinite bus system structure model include a synchronous generator, an excitation system, and an infinite bus model.
[0064] Network latency was simulated using the TrueTime2.0 module, with a data transmission rate of 80kb / s and a minimum data frame size of 5 bytes. Network latency segments from the CPPS were used as historical data to train the Transformer model. The initial active power input of the generator during startup remained 0.7376 pu. A three-phase ground fault occurred at 0.1s, and the fault line was cleared after 0.1s. The total simulation duration was 5s, considering the impact of network latency on the dynamic characteristics and stability after fault clearing, under the same fault clearing time.
[0065] Because the number of packet loss, bit error, and retransmission occurrences is relatively small, and the network latency mainly consists of delays in data acquisition and network transmission, the rate of change in network latency is not significant. Therefore, this patent employs periodic parameter adjustments. Through extensive simulation experiments, based on the system's amplitude and stability, the latency time is divided into several different intervals, each corresponding to a set of pre-designed PID parameters (Kp, Ki, Kd). During system operation, the appropriate parameter set is selected based on the predicted latency time to adapt to different latency conditions. This implementation is relatively simple, requiring no online parameter adjustment, only online switching. The core requirement is the accuracy of the network latency prediction. This patent, based on the transformer, achieves an absolute error of less than 1.5% for over 95% of the network latency prediction samples, indicating that the model has high prediction confidence.
[0066] The technical effects of this invention are as follows: (1) To verify the effectiveness of the Transformer prediction model, the Transformer prediction results are used to form a training set and a test set based on historical delay data, and the prediction error is analyzed.
[0067] Figure 5 shows the test curves of the training set, indicating that the predicted curves of the training set have good consistency with the true values in terms of delay fluctuation trends and amplitude changes. The training set verifies the high accuracy of Transformer fusion spatiotemporal prediction. Figure 6 shows that the dynamic range (0.03-0.06s) of the delay prediction curves of the test set and the measured delay curves highly overlap, indicating a significant fit.
[0068] Figure 7 further quantifies the model accuracy through the prediction error histogram. The error distribution exhibits a typical normal distribution, with the peak histogram of the error close to the zero error baseline. The absolute error of more than 95% of the samples is less than 1.5%, indicating that the model has high prediction confidence.
[0069] (2) Simulation Results of Transformer-Based Adaptive PID Transient Stability Control for CPPS To verify the effectiveness of the proposed Transformer model-integrated prediction PID adaptive control strategy, simulation results were analyzed for a single-machine CPPS. The Transformer prediction program was encapsulated as a module and connected to the input port of the communication system. The designed adaptive PID controller was then connected to the prediction module. The system sampling period was set to 5ms. To compare the active power of the synchronous generator under communication time delay conditions (… ), rotor speed ( ) and rotor angle ( The transient characteristics of the three parameters were analyzed. The amplitudes with and without control were compared through time-domain simulation, and the adaptive control strategy using Transformer model fusion and wide-area damping control were also compared. Figures 8, 9, and 10 show the active power (with a delay of 30ms) ), rotor speed ( ) and rotor angle ( The transient curves of the active power () are compared. Figures 11, 12, and 13 show the active power () with a delay of 50ms. ), rotor speed ( ) and rotor angle ( A comparison chart of transient curves.
[0070] Comparing the simulation curves of active power, system angular velocity, and rotor angle in Figures 8 and 9, it can be seen that the curve without the compensator has a larger oscillation amplitude and the system is less stable. With the addition of the Transformer adaptive PID controller, the transient amplitude decreases and the system oscillation decays faster. Moreover, under the control of the adaptive PID, the system recovers stability in 4 seconds, indicating that the adaptive PID control strategy based on Transformer fusion spatiotemporal prediction has a good control effect.
[0071] Under different control conditions, the peak values of different indicators during the 0.1-second recovery after a 0.1-second large disturbance are compared. It can be seen that the adaptive PID control of the Transformer is less effective than the system's wide-area damping control. Furthermore, the proposed control strategy results in a shorter system recovery time, while the other two control methods still fail to achieve stability after 5 seconds. This verifies that the control strategy can better suppress low-frequency oscillations and has a better effect on controlling information transmission delays in cyber-physical power systems. Table 1 shows the peak values of the curves for different control methods with a 30-ms delay. Table 2 shows the peak values of the curves for different control methods with a 50-ms delay.
[0072] Table 1. Peak performance indicators of different control methods for a 30ms delay Table 2. Peak performance indicators of different control methods for a 50ms delay. This invention predicts communication delay using historical information transmission delay data. Simulation verification shows that the peak histogram of the error between the predicted and actual values is close to the zero-error baseline, and the absolute error of over 95% of the samples is less than 1.5%, indicating high prediction confidence and high-precision approximation in modeling linear delay mapping relationships, fully demonstrating the engineering applicability of the proposed algorithm. The designed adaptive PID controller based on the Transformer spatiotemporal fusion model predictive network system can adaptively adjust the PID controller parameters. Because the number of packet loss errors and retransmissions is infrequent, the predicted communication delay value is divided into different delay ranges corresponding to PID parameters. The parameters are switched to the appropriate proportional, integral, and derivative parameter groups based on the currently predicted delay time, realizing the prediction and adaptive PID control of the Transformer network transmission delay time. This method can effectively compensate for the time delay phase difference during information transmission, thereby controlling the delay randomness of the cyber-physical power system.
[0073] By using the Matlab platform for co-simulation analysis, the results after control are compared with the experimental results without delay compensation. The results show that the adaptive PID controller based on Transformer fusion spatiotemporal prediction has good transient stability characteristics, indicating that the proposed method can significantly improve the transient stability of the system, thus proving the feasibility and practicality of the method.
[0074] The embodiments described above are for illustrative purposes only and are not intended to limit the invention. Therefore, any changes in numerical values or substitutions of equivalent elements should still fall within the scope of this invention.
[0075] The above detailed description will enable those skilled in the art to understand that the present invention can indeed achieve the aforementioned objectives and has complied with the provisions of the Patent Law.
[0076] Although preferred embodiments of the invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the invention. The above descriptions are merely preferred embodiments of the invention and are not intended to limit the invention. It should be noted that any modifications, equivalent substitutions, and improvements made within the spirit and principles of the invention should be included within the scope of protection of the invention.
[0077] It should be noted that the above description of the process is for illustrative purposes only and does not limit the scope of this specification. Those skilled in the art can make various modifications and changes to the process under the guidance of this specification. However, these modifications and changes remain within the scope of this specification.
[0078] The basic concepts have been described above. Obviously, for those skilled in the art who have read this application, the above disclosure is merely illustrative and does not constitute a limitation of this application. Although not explicitly stated herein, those skilled in the art may make various modifications, improvements, and corrections to this application. Such modifications, improvements, and corrections are suggested in this application, and therefore, such modifications, improvements, and corrections still fall within the spirit and scope of the exemplary embodiments of this application.
[0079] Furthermore, this application uses specific terms to describe its embodiments. For example, "an embodiment," "one embodiment," and / or "some embodiments" refer to a particular feature, structure, or characteristic related to at least one embodiment of this application. Therefore, it should be emphasized and noted that "an embodiment," "one embodiment," or "an alternative embodiment" mentioned twice or more in different positions in this specification do not necessarily refer to the same embodiment. In addition, certain features, structures, or characteristics in one or more embodiments of this application can be appropriately combined.
[0080] Furthermore, those skilled in the art will understand that aspects of this application can be described and illustrated through several patentable types or situations, including any new and useful combination of processes, machines, products, or substances, or any new and useful improvements thereof. Therefore, aspects of this application can be implemented entirely in hardware, entirely in software (including firmware, resident software, microcode, etc.), or a combination of hardware and software. All of the above hardware or software can be referred to as a “unit,” “module,” or “system.” Furthermore, aspects of this application can take the form of a computer program product embodied in one or more computer-readable media, wherein computer-readable program code is contained therein.
[0081] The computer program code required for the operation of each part of this application can be written in any one or more programming languages, including object-oriented programming languages such as Java, Scala, Smalltalk, Eiffel, JADE, Emerald, C++, C#, VB.NET, and Python; general programming languages such as C; Visual Basic, Fortran2103, Perl, COBOL2102, PHP, and ABAP; dynamic programming languages such as Python, Ruby, and Groovy; or other programming languages. This program code can run entirely on the user's computer, or as a standalone software package on the user's computer, or partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the latter case, the remote computer can be connected to the user's computer via any network, such as a local area network (LAN) or wide area network (WAN), or connected to an external computer (e.g., via the Internet), or in a cloud computing environment, or used as a service such as Software as a Service (SaaS).
[0082] Furthermore, unless expressly stated in the claims, the order of processing elements and sequences, the use of numbers and letters, or other names described in this application are not intended to limit the order of the processes and methods of this application. Although some currently considered useful embodiments of the invention have been discussed in the foregoing disclosure by way of various examples, it should be understood that such details are for illustrative purposes only, and the appended claims are not limited to the disclosed embodiments; rather, the claims are intended to cover all modifications and equivalent combinations that conform to the substance and scope of the embodiments of this application. For example, although the implementation of the various components described above can be embodied in a hardware device, it can also be implemented as a purely software solution, such as an installation on an existing server or mobile device.
[0083] Similarly, it should be noted that, in order to simplify the description of the present application and thus aid in the understanding of one or more embodiments of the invention, the foregoing description of the embodiments of the present application sometimes combines multiple features into a single embodiment, drawing, or description thereof. However, this approach of the present application should not be construed as reflecting an intention that the claimed subject matter requires more features than expressly recited in each claim. Rather, the subject of the invention should possess fewer features than in any single embodiment described above.
Claims
1. A CPPS transient stability control method based on Transformer spatiotemporal fusion adaptive PID, characterized in that, include: Step 1: Obtain historical network latency data during CPPS operation; Step 2: Construct a Transformer spatiotemporal fusion prediction model. This model includes an encoder and a decoder. The encoder incorporates a multi-head attention module and a feedforward network, which are sequentially connected via residual connections and layer normalization. The decoder, in addition to the same multi-head attention module and feedforward network as the encoder, also includes an additional encoder-decoder attention layer. During the model input phase, temporal and spatial codes are fused to form a spatiotemporal fusion positional code, which is then used as the input to the Transformer spatiotemporal fusion prediction model. Step 3: Train the Transformer spatiotemporal fusion prediction model using historical network latency data, enabling the trained model to predict CPPS network latency in real time. Step 4: Analyze the variation range of network latency during CPPS operation. The process involves several steps: First, the network latency of the CPPS is divided into multiple delay intervals based on the range of change. For each delay interval, a set of PID controller parameters adapted to the latency of that interval is determined through CPPS transient stability simulation, thus completing the preset grouping of PID controller parameters. Second, during the actual operation of the CPPS, the real-time collected CPPS operating data is input into the trained Transformer spatiotemporal fusion prediction model, which predicts the current network latency of the CPPS in real time. Third, based on the network latency of the current CPPS predicted in Step 5, the corresponding delay interval is determined. Based on the preset grouping of PID controller parameters, the parameters of the PID controller are switched to the preset PID controller parameters corresponding to that delay interval. Fourth, the operating state of the CPPS is regulated by the PID controller with switched parameters to achieve transient stability control of the CPPS.
2. The CPPS transient stability control method based on Transformer spatiotemporal fusion adaptive PID according to claim 1, characterized in that, In step two, when the multi-head attention module of the Transformer spatiotemporal fusion prediction model encoder is working, it first decomposes the input spatiotemporal fusion position code into multiple sets of query vectors, key vectors, and value vectors through a linear transformation. Then, it calculates the dot product of each set of query vectors and the corresponding key vector to obtain the initial attention score. Subsequently, it processes the initial attention score using a normalization function, and then weights and sums the processed attention score with the corresponding value vector to obtain the single-head attention output. Finally, it concatenates all the single-head attention outputs and performs a linear transformation to obtain the final output of the multi-head attention module.
3. The CPPS transient stability control method based on Transformer spatiotemporal fusion and adaptive PID according to claim 1, characterized in that, In step two, when the decoder of the Transformer spatiotemporal fusion prediction model is working, it simultaneously receives the feature sequence output by the encoder and the historically generated delay prediction sequence. First, it mines the correlation information in the historical prediction sequence through the internal multi-head attention module. Then, it establishes a mapping relationship between the correlation information and the encoder feature sequence through the attention layer of the encoder and decoder. Finally, it inputs the mapped information into the feedforward network for processing. After the processing result is adjusted by linear transformation and normalization function, the network delay prediction value of the current CPPS is obtained.
4. The CPPS transient stability control method based on Transformer spatiotemporal fusion and adaptive PID according to claim 1, characterized in that, In step four, when dividing the delay intervals, the transient response characteristics of CPPS under different network delays are used as the basis. The rotor speed fluctuation amplitude and active power overshoot are selected as the core evaluation indicators. By comparing the threshold changes of the indicators corresponding to different delays, the boundaries of each delay interval are determined to ensure that the switching of PID controller parameters corresponding to adjacent delay intervals will not cause a sudden change in the transient performance of CPPS.
5. The CPPS transient stability control method based on Transformer spatiotemporal fusion adaptive PID according to claim 1, characterized in that, In step four, when determining the PID controller parameters through CPPS transient stability simulation, the proportional coefficient, integral coefficient, and derivative coefficient of the PID controller are adjusted sequentially using the control variable method. The objective function is to minimize the CPPS transient recovery time and the overshoot. The optimal PID controller parameter combination corresponding to each delay interval is selected and stored in the preset group of PID controller parameters.
6. The CPPS transient stability control method based on Transformer spatiotemporal fusion adaptive PID according to claim 1, characterized in that, In step one, when acquiring historical network delay data, the delay data during wide-area signal transmission is collected through the synchronous phasor measurement device in CPPS. The collection scenario covers typical operating conditions. The moving average method is used to remove abnormal pulse interference from the collected raw delay data to obtain standardized historical network delay data.
7. The CPPS transient stability control method based on Transformer spatiotemporal fusion adaptive PID according to claim 1, characterized in that, In step two, the construction process of the spatiotemporal fusion location code is as follows: the time code is calculated by the difference between the acquisition time of the delayed sequence and the initial acquisition time, and the spatial code is obtained by transforming the geographical coordinates of the signal acquisition node. The time code and the spatial code are concatenated by dimension and then normalized to finally form the spatiotemporal fusion location code required for the input of the Transformer spatiotemporal fusion prediction model.
8. The CPPS transient stability control method based on Transformer spatiotemporal fusion adaptive PID according to claim 1, characterized in that, It also includes a fault scenario adaptation step: when a three-phase ground short-circuit fault occurs in the CPPS, after the fault is cleared, the fault type and fault clearing time information are added to the real-time collected CPPS operation data. The supplemented operation data is then input into the trained Transformer spatiotemporal fusion prediction model to correct the prediction result of the current network latency. Finally, the PID controller parameters are switched based on the corrected prediction latency.
9. The CPPS transient stability control method based on Transformer spatiotemporal fusion adaptive PID according to claim 1, characterized in that, In step three, when training the Transformer spatiotemporal fusion prediction model, mean squared error is used as the model's loss function. The model's parameters are updated iteratively through the Adam optimizer. After every 100 rounds of training, an independent test set is used to verify the model's prediction accuracy. When the prediction error of the test set is lower than a preset threshold for 5 consecutive rounds, the model training is stopped.
10. The CPPS transient stability control method based on Transformer spatiotemporal fusion adaptive PID according to claim 1, characterized in that, It also includes a model iteration and optimization step: every preset period, the actual network latency data of CPPS within that period and the predicted latency data at the corresponding time are combined to form a new training sample. The new training sample is then added to the historical network latency data to incrementally train the Transformer spatiotemporal fusion prediction model in order to adapt to the long-term changes in the latency characteristics of the CPPS network.