A Deep Learning-Based Primary Frequency Regulation Optimization Method for Power Systems
By combining deep learning and reinforcement learning, a primary frequency regulation optimization method for power systems is constructed. This method resolves the contradiction between response speed and optimization accuracy in power systems and addresses the security risks of online learning. It achieves efficient and stable power grid frequency regulation, ensuring that the system can quickly return to reliable control when frequency instability occurs.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-30
- Publication Date
- 2026-03-10
AI Technical Summary
Existing technologies in power systems suffer from a contradiction between response speed and optimization accuracy, security risks in online learning, and limitations in multi-objective optimization, making it difficult to meet millisecond-level control requirements and rapid protection during frequency changes.
By constructing a power system primary frequency regulation optimization method based on deep learning, a TCN-GRU hybrid network is used to extract spatiotemporal features. A dual time-scale update mechanism is established by combining a deep reinforcement learning decision layer and a PID neural network with a time-varying forgetting factor. A safety verification module is also set up to achieve adaptive control and fast protection.
It improves the primary frequency regulation response speed and control accuracy when the power grid frequency fluctuates, ensures the stability and safety of the system in dynamic environments, and realizes adaptive control and fast return to reliable control mode.
Smart Images

Figure CN120896185B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of power optimization technology, and in particular relates to a method for optimizing primary frequency regulation of power systems based on deep learning. Background Technology
[0002] In the field of industrial process control, the integration of traditional PID control with emerging intelligent algorithms has become a key research direction for improving system performance. Although existing technologies have attempted to combine deep reinforcement learning (DRL) with PID control, significant technical bottlenecks still exist in terms of real-time performance, safety, and adaptability.
[0003] Current industrial control systems mainly face three major technical shortcomings:
[0004] The contradiction between response speed and optimization accuracy: Traditional PID control has strong real-time performance but fixed parameters, while DRL algorithm requires a large amount of training data and has a high response delay (usually >1 second), making it difficult to meet the millisecond-level control requirements.
[0005] Security risks in online learning: When the system experiences a frequency change of |Δf|>0.3Hz (Δf is the deviation between the measured frequency and the set value), the existing DRL controller lacks a fast protection mechanism.
[0006] Limitations of multi-objective optimization: Traditional methods optimize dynamic response (such as overshoot), steady-state accuracy (such as IAE), and energy consumption indicators separately.
[0007] The above background technical analysis reveals the key technological gaps in the current field of intelligent control, providing a clear direction for technical improvement of the innovative solution of this invention. By establishing a dual-timescale mechanism and a dynamic security protection system, the performance bottlenecks of existing technologies can be effectively overcome. Summary of the Invention
[0008] The purpose of this invention is to provide a power system primary frequency regulation optimization method based on deep learning. By extracting features from complex power grid operating state data, processing the time series dependencies of these features through deep learning, capturing the trend of power grid frequency changes, and applying DRL technology to explore the optimal control strategy, the method adjusts the PID controller parameters in a dynamic environment to achieve adaptive control. The PID neural network automatically corrects the weights according to the error, so that the control quantity continuously approaches the control target value. This solves the problems of the contradiction between response speed and optimization accuracy and the safety hazards of online learning.
[0009] To solve the above-mentioned technical problems, the present invention is achieved through the following technical solution:
[0010] This invention relates to a deep learning-based method for optimizing primary frequency regulation in power systems, comprising the following steps:
[0011] Step S01: Collect the status data of the hydropower unit in the power grid, construct a three-dimensional feature tensor and extract spatiotemporal features through a TCN-GRU hybrid network;
[0012] Step S02: Construct a deep reinforcement learning decision layer, define the action space and reward function;
[0013] Step S03: Construct a PID neural network with a time-varying forgetting factor and output dynamic weights;
[0014] Step S04: Establish a dual-timescale update mechanism;
[0015] Step S05: Set up a safety verification module. When the system frequency deviation exceeds the threshold, switch to the traditional PID mode.
[0016] As a preferred technical solution, the specific process for constructing the three-dimensional feature tensor in step S01 is as follows:
[0017] Step S11: Using the power system grid-source coordinated primary frequency regulation optimization device, obtain 28 types of electrical parameters of key nodes (≥500 bus nodes) across the entire domain with a sampling period of 0.1 seconds. The 28 types of electrical parameters include real-time measured values such as frequency deviation Δf, unit active power, guide vane opening, head, tie line power flow, and voltage.
[0018] Step S12: Use a sliding time window to extract 60 seconds of continuous data to form an initial data cube. The specific formula is as follows: In the formula, For the number of nodes, T=60 (time frames), D=28 (feature dimension);
[0019] Step S13: Perform dynamic z-score standardization on each of the 28 feature classes to prevent future data leakage. The formula for dynamic z-score standardization is: ;
[0020] In the formula, This represents the standardized eigenvalues. Indicates spatial dimension index, Indicates a time-dimensional index. Indicates the feature dimension index. This represents the original measured electrical parameters. Indicates the dynamic mean. This represents the moving average calculated for feature d over a time window t. Indicates the dynamic standard deviation. This represents the moving standard deviation of feature d over time window t. It represents a very small positive number and is used to prevent the denominator from being zero;
[0021] Step S14: Reconstruct the normalized data into a three-dimensional tensor. For missing node data, use graph attention mechanism to perform electrical distance-weighted interpolation.
[0022] Step S15: Inject power grid topology constraints through the graph layer and verify the integrity of the tensor; the integrity of the tensor is verified by random mask reconstruction, verifying that the contribution of frequency-related features is ≥85%, and when the node data missing rate is >30%, trigger tensor completion based on PARAFAC decomposition: ;
[0023] In the formula, R is the rank of the decomposition (take R=8). For outer product operation, These represent the factor vectors of the first dimension, the second dimension, and the third dimension, respectively.
[0024] As a preferred technical solution, in step S14, when the data is reconstructed into a three-dimensional tensor, the preprocessed two-dimensional table (columns: node ID + 28 features, rows: timestamp) is converted into a hierarchical structure, with the timestamp as the first dimension, the node ID as the second dimension, and the feature values filled as the third dimension; missing node data is imputed using a graph attention mechanism, and the node weights are calculated based on electrical distance, using the following formula: In the formula, , where a and W are node features, and are learnable parameters; the interpolated node data is converted into a dense tensor.
[0025] As a preferred technical solution, the specific process for extracting spatiotemporal features using the TCN-GRU hybrid network in step S01 is as follows:
[0026] Step TG01: TCN uses a three-level dilated convolutional layer with an exponentially increasing porosity, and each layer has a fixed number of 3 convolutional kernels;
[0027] Layer 1: dilation=1 (ordinary causal convolution), receptive field covers 3 time steps;
[0028] Layer 2: dilation=2, receptive field expanded to 7 steps (3+2×(3−1)3+2×(3−1));
[0029] Layer 3: dilation=4, receptive field reaches 15 steps (7+4×(3−1)7+4×(3−1));
[0030] Maintaining the time dimension unchanged through zero-padding;
[0031] Step TG02: After adjusting the number of channels in each TCN output through a 1*1 convolution, add it to the input. The calculation formula is as follows: ;
[0032] In the formula, For model output, The number of channels in the TCN output is adjusted using a 1x1 convolution. For learnable projection matrices, Input for the model;
[0033] Step TG03: Convert the 3D tensor output by TCN Folded along the time axis into a two-dimensional matrix Spatial node features are used as input features for GRU;
[0034] Step TG04: A bidirectional GRU is used to capture forward and backward temporal dependencies. The hidden layer dimension is set to 2D (D is the input feature dimension), and spatiotemporal attention is added to the output gate. The formula is: ;
[0035] In the formula, These are learnable parameters;
[0036] Step TG05: Predict the frequency deviation of the next time step in the time dimension and reconstruct the features of randomly occluded nodes in the spatial dimension. After pre-training, freeze the TCN layer in time and only fine-tune the GRU part.
[0037] As a preferred technical solution, in step S02, the deep reinforcement learning decision layer adopts the dual-delay DDPG algorithm framework; wherein, the state space includes the normalized frequency deviation history sequence, the unit regulation capacity margin, and the regional ACE index; the unit regulation capacity margin and the regional ACE index are concatenated into a 2D vector, which together with the frequency deviation history sequence constitutes a 62-dimensional state space; the action space is defined as the PID parameter correction amount. Using an Actor network, the input... Output PID parameter correction amount The output layer is activated with tanh and scaled to [-0.2, 0.2].
[0038] The reward function is defined as follows: ;
[0039] In the formula, This is a frequency stability term; For unit margin terms, To control the cost term, different control objectives are balanced by dynamically adjusting the weights.
[0040] As a preferred technical solution, in step S03, the PID neural network with a time-varying forgetting factor includes an input layer, a hidden layer, and an output layer;
[0041] The input nodes of the input layer include the current time error, the error change rate, and the control quantity of the previous time step; the input data is normalized.
[0042] The hidden layer adopts a three-layer fully connected architecture; wherein, the first hidden layer receives input through three neurons and is activated using LeakyReLU, the second hidden layer is activated using LeakyReLU through five neurons, and the third hidden layer is used as a pre-output transition layer through three neurons.
[0043] The output layer outputs Three time-varying parameters are used, the output range is constrained by the Sigmoid function, and a forgetting factor is introduced. .
[0044] As a preferred technical solution, in step S03, after the dynamic weights are output, the network weights are periodically fine-tuned using the DRL decision results; during the fine-tuning, a state space containing the control error of the last 15 seconds and the weight sensitivity features is constructed, and a constrained weight adjustment vector is generated using the PPO algorithm; subsequently, stability is ensured through the Lyapunov exponent verification module, and a momentum-accelerated incremental update strategy is injected into the main network, while the experience replay pool implements priority sampling to optimize learning efficiency.
[0045] As a preferred technical solution, in step S04, the dual time-scale update mechanism includes a fast cycle and a slow cycle;
[0046] When the update mechanism adopts a fast cycle (100ms), the sensor error, rate of change and actuator feedback are acquired synchronously. The dynamic weight is output by using PIDNN forward calculation, and the control quantity is generated by combining the forgetting factor. Hardware timer interrupt is used to ensure cycle stability and a 20% time margin is reserved.
[0047] When the update mechanism uses a slow cycle (5 minutes), a performance evaluation is performed first, aggregating indicators such as MAE and overshoot over 3000 control cycles to construct the DRL state vector. The DRL state vector includes error statistics, control quantity distribution, and network weight snapshots. The DRL agent outputs the policy gradient. Asynchronously update the hidden layer weights of PIDNN And verify the stability of the updated model in the simulation environment; where, For the new weights, For the old weight, For learning rate, is the Hadamard product, and mask is the mask vector.
[0048] As a preferred technical solution, in step S05, a hardware interrupt is used to collect the frequency signal in real time, calculate the moving average frequency value to eliminate noise interference, and update the absolute value of the system frequency deviation every 100ms; when the absolute value of the system frequency deviation is detected to be greater than 0.3Hz (0.2Hz~0.5Hz can be set) for 3 consecutive times, the DRL controller output is immediately frozen, the preset traditional PID parameters are activated, and the analog output channel is switched to the PID dedicated port.
[0049] As a preferred technical solution, when the security verification module performs mode recovery, it must simultaneously meet the following conditions: the absolute value of the system frequency deviation is less than 0.2Hz, there is no over-limit alarm, and manual switching back to DRL mode is performed after manual confirmation.
[0050] The present invention has the following beneficial effects:
[0051] This invention extracts features from complex power grid operation status data, processes the time-series dependencies of these features through deep learning, captures the trend of power grid frequency changes, applies DRL technology to explore the optimal control strategy, adjusts PID controller parameters in a dynamic environment to achieve adaptive control, and the PID neural network automatically corrects the weights according to the error, so that the control quantity continuously approaches the control target value. This improves the primary frequency regulation response speed and control accuracy of hydropower units when the power grid frequency fluctuates, and achieves more efficient and stable primary frequency regulation performance.
[0052] This invention achieves 15-step long-range dependency capture through a combination of [1,2,4] hole rates, which is superior to the stepwise propagation of traditional RNNs. At the same time, TCN focuses on local time models, and GRU handles global spatiotemporal interactions, improving computational efficiency and training convergence speed.
[0053] This invention achieves autonomous evolution by continuously executing conventional control through a PID neural network in the bottom-level real-time control loop, and generating constrained weight fine-tuning quantities through a near-end policy optimization algorithm based on the state characteristics statistically obtained from sliding window in the top-level decision loop. After passing through a safety verification module, the weights are injected into the main network using a momentum-accelerated incremental update strategy. At the same time, the experience replay pool implements priority trajectory sampling to ensure that the learning process achieves incremental parameter optimization while ensuring system stability, ultimately forming an autonomous evolution closed loop of "online evaluation - safe decision-making - smooth migration".
[0054] This invention establishes a dual-timescale update mechanism: the control quantity is output in real time by the PIDNN during the fast cycle (100ms), and the strategy is updated by the DRL agent during the slow cycle (5min). A safety verification module is set up, which switches to the traditional PID mode when |Δf|>0.3Hz (0.2Hz~0.5Hz can be set), and uses dual verification (frequency threshold + duration) to avoid malfunctions and ensure that the system can quickly return to a reliable control mode when the frequency is unstable.
[0055] Of course, any product implementing this invention does not necessarily need to achieve all of the advantages described above at the same time. Attached Figure Description
[0056] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. 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.
[0057] Figure 1 This is a flowchart of a deep learning-based power system primary frequency regulation optimization method according to the present invention. Detailed Implementation
[0058] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0059] Furthermore, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.
[0060] To make the purpose, technical solution, and advantages of this application clearer, the following description is provided in conjunction with the appendix. Figure 1 The present application will be further described in detail below with reference to embodiments. It should be understood that the specific embodiments described herein are for illustrative purposes only and are not intended to limit the scope of the application.
[0061] Please see Figure 1 As shown, this invention is a method for optimizing primary frequency regulation in a power system based on deep learning, comprising the following steps:
[0062] Step S01: Collect the status data of the hydropower unit in the power grid, construct a three-dimensional feature tensor and extract spatiotemporal features through a TCN-GRU hybrid network;
[0063] Step S02: Construct a deep reinforcement learning decision layer, define the action space and reward function;
[0064] Step S03: Construct a PID neural network with a time-varying forgetting factor and output dynamic weights;
[0065] Step S04: Establish a dual-timescale update mechanism;
[0066] Step S05: Set up a safety verification module. When the system frequency deviation exceeds the threshold, switch to the traditional PID mode.
[0067] In step S1, the specific process for constructing the three-dimensional feature tensor is as follows:
[0068] Step S11: Using the power system grid-source coordinated primary frequency regulation optimization device, obtain 28 types of electrical parameters of key nodes (≥500 bus nodes) across the entire domain with a sampling period of 0.1 seconds. The 28 types of electrical parameters include real-time measured values such as frequency deviation Δf, unit active power, guide vane opening, head, tie line power flow, and voltage.
[0069] Step S12: Use a sliding time window to extract 60 seconds of continuous data to form an initial data cube. The specific formula is as follows: In the formula, For the number of nodes, T=60 (time frames), D=28 (feature dimension);
[0070] Step S13: Perform dynamic z-score standardization on each of the 28 feature classes to prevent future data leakage. The formula for dynamic z-score standardization is: ;
[0071] In the formula, This represents the standardized eigenvalues. Indicates spatial dimension index, Indicates a time-dimensional index. Indicates the feature dimension index. This represents the original measured electrical parameters. Indicates the dynamic mean. This represents the moving average calculated for feature d over a time window t. Indicates the dynamic standard deviation. This represents the moving standard deviation of feature d over time window t. It represents a very small positive number and is used to prevent the denominator from being zero;
[0072] Step S14: Reconstruct the normalized data into a three-dimensional tensor. For missing node data, use graph attention mechanism to perform electrical distance-weighted interpolation.
[0073] Step S15: Inject power grid topology constraints through the graph base layer and verify the integrity of the tensor.
[0074] In step S14, when the data is reconstructed into a three-dimensional tensor, the preprocessed two-dimensional table (column: node ID + 28 features, row: timestamp) is converted into a hierarchical structure, with the timestamp as the first dimension (sampled and aligned at a frame rate of 1 second), the node ID as the second dimension (spatial layout of key nodes in the entire network), and the feature values filled as the third dimension (spatial layout of key nodes in the entire network).
[0075] The missing node data is imputed using a graph attention mechanism, and the node weights are calculated based on electrical distance, as shown in the following formula: In the formula, denoted as node features, a and W are learnable parameters; the imputed node data is converted into a dense tensor.
[0076] Verify the tensor dimension and check the integrity of the three-dimensional structure: strictly match the sampling rate in the time dimension (e.g., a 60-second time window corresponds to 600 frames), cover all key nodes in the spatial dimension (e.g., 500 bus nodes), and ensure that all 28 types of parameters are included and in a fixed order in the feature dimension.
[0077] In step S01, the specific process of extracting spatiotemporal features using the TCN-GRU hybrid network is as follows:
[0078] Step TG01: TCN uses a three-level dilated convolutional layer with an exponentially increasing porosity, and each layer has a fixed number of 3 convolutional kernels;
[0079] Layer 1: dilation=1 (ordinary causal convolution), receptive field covers 3 time steps;
[0080] Layer 2: dilation=2, receptive field expanded to 7 steps (3+2×(3−1)3+2×(3−1));
[0081] Layer 3: dilation=4, receptive field reaches 15 steps (7+4×(3−1)7+4×(3−1));
[0082] Maintaining the time dimension unchanged through zero-padding;
[0083] Step TG02: After adjusting the number of channels in each TCN output through a 1*1 convolution, add it to the input. The calculation formula is as follows: ;
[0084] In the formula, For model output, The number of channels in the TCN output is adjusted using a 1x1 convolution. For learnable projection matrices, Input for the model;
[0085] Step TG03: Convert the 3D tensor output by TCN Folded along the time axis into a two-dimensional matrix Spatial node features are used as input features for GRU;
[0086] Step TG04: A bidirectional GRU is used to capture forward and backward temporal dependencies. The hidden layer dimension is set to 2D (D is the input feature dimension), and spatiotemporal attention is added to the output gate. The formula is: ;
[0087] In the formula, These are learnable parameters;
[0088] Step TG05: Predict the frequency deviation of the next time step in the time dimension and reconstruct the features of randomly occluded nodes in the spatial dimension. After pre-training, freeze the TCN layer in time and only fine-tune the GRU part.
[0089] In step S02, the deep reinforcement learning decision layer adopts the dual-delay DDPG algorithm framework; the state space includes the normalized frequency deviation history sequence, unit regulation capacity margin, and regional ACE index; the unit regulation capacity margin and regional ACE index are concatenated into a 2D vector, which together with the frequency sequence constitutes a 62-dimensional state space; the action space is defined as the PID parameter correction amount. Using an Actor network, the input... Output PID parameter correction amount The output layer is activated with tanh and scaled to [-0.2, 0.2].
[0090] The reward function is defined as follows: ;
[0091] In the formula, This is a frequency stability term; For unit margin terms, To control the cost term, different control objectives are balanced by dynamically adjusting the weights.
[0092] In step S03, the PID neural network with a time-varying forgetting factor is constructed, including an input layer, a hidden layer, and an output layer;
[0093] The input layer input nodes include the current time error, the rate of change of error, and the control quantity from the previous time step; the input data is normalized.
[0094] The hidden layer adopts a three-layer fully connected architecture; the first hidden layer receives input through three neurons and is activated using LeakyReLU, the second hidden layer is activated using LeakyReLU through five neurons, and the third hidden layer is a pre-output transition layer through three neurons.
[0095] Output layer output Three time-varying parameters are used, the output range is constrained by the Sigmoid function, and a forgetting factor is introduced. .
[0096] In step S03, after the dynamic weights are output, the network weights are periodically fine-tuned using the DRL decision results. During fine-tuning, a state space containing the control error and weight sensitivity features of the most recent 15 seconds is constructed, and a constrained weight adjustment vector is generated using the PPO algorithm. Subsequently, stability is ensured through the Lyapunov exponential verification module, and the incremental update strategy accelerated by momentum is injected into the main network. At the same time, the experience replay pool implements priority sampling to optimize learning efficiency.
[0097] In step S03, after the dynamic weights are output, the network weights are periodically fine-tuned using the DRL decision results. During fine-tuning, the PID neural network continuously executes conventional control in the bottom-level real-time control loop (millisecond level). In the top-level decision loop (15-second cycle), the DRL agent generates constrained weight fine-tuning values based on the state characteristics (including error integral, control variable volatility, weight sensitivity, etc.) statistically obtained from the sliding window, using the Proximal Policy Optimization (PPO) algorithm. After passing through the safety verification module (including Lyapunov exponent verification and control variable mutation detection), the weights are injected into the main network using a momentum-accelerated incremental update strategy. At the same time, the experience replay pool implements priority trajectory sampling to ensure that the learning process achieves incremental parameter optimization while ensuring system stability, ultimately forming an autonomous evolutionary closed loop of "online evaluation - safe decision-making - smooth migration".
[0098] For example, a policy update is triggered every 15 seconds: historical state transfer data is sampled from the experience pool; frequency stability is ensured through Lyapunov constraint verification; the frequency modulation coefficient correction is output; and the PI parameter is updated incrementally using an adaptive learning rate (initially 0.001).
[0099] In step S04, the dual-timescale update mechanism includes a fast cycle and a slow cycle;
[0100] When the update mechanism adopts a fast cycle (100ms), the sensor error, rate of change and actuator feedback are acquired synchronously. The dynamic weight is output by using PIDNN forward calculation, and the control quantity is generated by combining the forgetting factor. Hardware timer interrupt is used to ensure cycle stability and a 20% time margin is reserved.
[0101] When the update mechanism uses a slow cycle (5 minutes), a performance evaluation is performed first, aggregating indicators such as MAE and overshoot over 3000 control cycles to construct the DRL state vector. The DRL state vector includes error statistics, control quantity distribution, and network weight snapshots. The DRL agent outputs the policy gradient. Typically derived from policy gradient calculation, it represents the optimization direction and asynchronously updates the hidden layer weights of the PIDNN. And verify the stability of the updated model in the simulation environment; where, The new weights are generated by combining the new parameter values with the updated values. These are the old weights, i.e., the original parameter values of the hidden layers of the neural network. The learning rate is used to control the step size of weight updates, preventing excessively large adjustments. The Hadamard product represents the element-wise multiplication of two vectors. The mask is a mask vector, usually a binary matrix, used to selectively disable or enable updates to specific weights, such as freezing some parameters in a stability guarantee mechanism.
[0102] In step S05, a hardware interrupt is used to acquire the frequency signal in real time, calculate the moving average frequency value to eliminate noise interference, and update the absolute value of the system frequency deviation every 100ms. When the absolute value of the system frequency deviation is detected to be greater than 0.3Hz (0.2Hz~0.5Hz can be set) for 3 consecutive times, the DRL controller output is immediately frozen, the preset traditional PID parameters are activated, and the analog output channel is switched to the PID dedicated port.
[0103] When the safety verification module performs mode recovery, it must simultaneously meet the following conditions: the absolute value of the system frequency deviation is less than 0.2Hz, there are no over-limit alarms, and manual switching back to DRL mode is performed after manual confirmation. This mechanism avoids malfunctions through dual verification (frequency threshold + duration) and ensures that the system can quickly return to a reliable control mode when the frequency is unstable.
[0104] It is worth noting that the various units included in the above system embodiments are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be achieved; in addition, the specific names of each functional unit are only for easy differentiation and are not used to limit the scope of protection of the present invention.
[0105] Furthermore, those skilled in the art will understand that all or part of the steps in the methods of the above embodiments can be implemented by a program instructing related hardware, and the corresponding program can be stored in a computer-readable storage medium.
[0106] The preferred embodiments of the present invention disclosed above are merely illustrative of the invention. These preferred embodiments do not exhaustively describe all details, nor do they limit the invention to the specific implementations described. Clearly, many modifications and variations can be made based on the content of this specification. This specification selects and specifically describes these embodiments to better explain the principles and practical applications of the invention, thereby enabling those skilled in the art to better understand and utilize the invention. The invention is limited only by the claims and their full scope and equivalents.
Claims
1. A deep learning-based power system primary frequency modulation optimization method, characterized in that, The method comprises the following steps: Step S01: Collecting the state data of the hydroelectric generating set running in the power grid, constructing a three-dimensional feature tensor and extracting the space-time features through a TCN-GRU hybrid network; Step S02: Constructing a deep reinforcement learning decision layer, defining an action space and a reward function; In the step S02, the deep reinforcement learning decision layer adopts a double-delay DDPG algorithm framework; wherein, a state space includes a normalized frequency deviation historical sequence, a unit regulation capacity margin, and a regional ACE index; the unit regulation capacity margin and the regional ACE index are spliced into a 2-dimensional vector, and together with the frequency deviation historical sequence, form a 62-dimensional state space; an action space is defined as a PID parameter correction amount The reward function is defined as ; In the formula, is a frequency stability term; is a unit margin term, is a control cost term; different control objectives are balanced by dynamically adjusting the weight; Step S03: Constructing a PID neuron network with a time-varying forgetting factor, and outputting dynamic weights; In the step S03, the PID neuron network with the time-varying forgetting factor comprises an input layer, a hidden layer and an output layer; The input nodes of the input layer comprise an error at the current moment, a rate of change of the error and a control amount at the previous moment; the input data is normalized; The hidden layer adopts a three-layer full connection architecture; wherein the first hidden layer receives the input through three neurons, uses LeakyReLU activation, the second hidden layer passes through five neurons and uses LeakyReLU activation, and the third hidden layer passes through three neurons as a transition layer before output; The output layer outputs Three time-varying parameters, using Sigmoid function to constrain the output range, introduce forgetting factor ; In the step S03, after the dynamic weights are output, the network weights are periodically fine-tuned through the DRL decision result; when fine-tuning, a state space comprising the control error in the last 15 seconds and the weight sensitivity features is constructed, a PPO algorithm is used to generate a weight adjustment vector with constraints; then, a Lyapunov index verification module is used to ensure stability, a momentum accelerated incremental update strategy is used to inject the main network, and a priority sampling optimization learning efficiency is implemented through an experience replay pool; Step S04: Establishing a double-time-scale updating mechanism; In the step S04, the double-time-scale updating mechanism comprises a fast cycle and a slow cycle; When the updating mechanism adopts the fast cycle, the sensor error, the rate of change and the actuator feedback are synchronously acquired, the dynamic weights are output through the forward calculation of the PIDNN, and the control amount is generated in combination with the forgetting factor; When the updating mechanism adopts the slow cycle, performance evaluation is performed first, the indicators of 3000 control cycles are aggregated, a DRL state vector is constructed, a policy gradient is output by a DRL agent, the hidden layer weights of the PIDNN are asynchronously updated, and the stability of the updated model in the simulation environment is verified; Step S05: Setting a safety check module, when the system frequency deviation is greater than a threshold value, switching to a traditional PID mode.
2. The deep learning-based power system primary frequency regulation optimization method of claim 1, wherein, In the step S01, the specific process of constructing the three-dimensional feature tensor is as follows: Step S11: Through a power system grid-source collaborative primary frequency modulation optimization device, 28 types of electrical parameters of the global key nodes are acquired at a sampling period of 0.1 seconds; Step S12: A sliding time window is used to intercept 60 seconds of continuous data to form an initial data cube; Step S13: The 28 types of features are respectively subjected to dynamic z-score standardization processing; Step S14: The normalized data is reconstructed into a three-dimensional tensor, and for the missing node data, a graph attention mechanism is used for weighted interpolation based on electrical distance; Step S15: The graph convolution layer is used to inject the power grid topology constraint, and the integrity of the tensor is verified.
3. The deep learning-based power system primary frequency regulation optimization method of claim 2, wherein, In the step S14, when the data is reconstructed into a three-dimensional tensor, the preprocessed two-dimensional table is converted into a hierarchical structure, the timestamp is taken as the first dimension, the node ID is taken as the second dimension, and the characteristic value is filled in as the third dimension; the missing node data is interpolated by using a graph attention mechanism, and the node weight is calculated based on the electrical distance, and the interpolated node data is converted into a dense tensor.
4. The deep learning-based power system primary frequency regulation optimization method of claim 1, wherein, In the step S01, the specific process of extracting the space-time feature by the TCN-GRU hybrid network is as follows: Step TG01: The TCN adopts a three-level dilated convolution layer, and the hole rate increases exponentially, and the convolution kernel is fixed at 3 in each layer; Step TG02: The output of each level of TCN is added to the input after adjusting the channel number by 1*1 convolution; Step TG03: The three-dimensional tensor output by the TCN is folded into a two-dimensional matrix along the time axis, and the spatial node feature is taken as the input feature of the GRU; Step TG04: The bidirectional GRU is used to capture the forward and backward time dependence, the hidden layer dimension is set to 2D, and the output gate increases the space-time attention; Step TG05: The time dimension is used to predict the next time frequency deviation, and the spatial dimension is used to reconstruct the randomly masked node feature.
5. The deep learning-based power system primary frequency regulation optimization method of claim 1, wherein, In the step S05, the frequency signal is collected in real time by using a hardware interrupt, the moving average frequency value is calculated to eliminate noise interference, the absolute value of the system frequency deviation is updated once every 100ms, and when the absolute value of the system frequency deviation is greater than 0.3Hz for three times in succession, the output of the DRL controller is immediately frozen, the preset traditional PID parameter is activated, and the analog output channel is switched to the PID special port.
6. The deep learning-based power system primary frequency regulation optimization method of claim 1, wherein, When the safety check module restores the mode, the absolute value of the system frequency deviation must be less than 0.2Hz, there is no overrun alarm, and the DRL mode is manually switched back after manual confirmation.
Citation Information
Patent Citations
Power grid frequency cooperative control method based on knowledge-data hybrid driving algorithm
CN114597916A
Network anomaly traffic detection method based on hybrid space-time neural network
CN117829201A