Data Analysis Method and Device for Electricity Spot Market Clearing Based on Deep Learning
By constructing a clearing proxy model based on graph neural networks and a PTDF iterative correction module, the problems of slow computation speed of traditional methods and the inability of deep learning models to meet power grid security constraints are solved, thus realizing fast and safe clearing of electricity spot transactions.
Patent Information
- Application Number
- CN202611211925.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-11
- Publication Date
- 2026-11-17
AI Technical Summary
Traditional optimization methods have high computational complexity and long solution time, making it difficult to complete the clearing calculation of the electricity spot market within a limited time. Purely data-driven deep learning models cannot strictly meet the constraints of power grid safe operation and lack adaptive update capabilities.
A clearing proxy model based on graph neural network is constructed, combined with PTDF iterative correction module. The topology characteristics of the power grid are learned through graph attention network, the safety constraint is verified by DC power flow model, and the generator output is corrected through iterative correction module. The PTDF matrix is dynamically updated to meet the power grid safety constraints.
It enables the rapid generation of near-optimal initial clearing plans, ensuring the physical feasibility of the clearing results and the safety of power grid operation, reducing computation time, and improving the model's adaptability and prediction accuracy.
Smart Images

Figure CN123118205A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of electricity spot trading, and specifically to a data analysis method and apparatus for electricity spot trading clearing based on deep learning. Background Technology
[0002] Electricity spot market clearing is a core component of power grid dispatching and operation. Its task is to calculate the winning output of each generating unit and the marginal price of each node based on load forecasts, generator bid prices and technical parameters, and grid topology and line parameters, while ensuring that the clearing results meet the constraints of safe grid operation. Traditional clearing calculations mainly rely on physical model-based optimization methods, such as safety-constrained economic dispatch or DC optimal power flow models. These methods construct an optimization problem with the objective of minimizing generation costs, using line transmission capacity limits as constraints, and iteratively solve it using numerical optimization algorithms. However, with the large-scale grid connection of new energy sources and the increasing frequency of electricity market transactions, the requirements for computational timeliness in intraday rolling clearing or real-time clearing are becoming increasingly stringent. Traditional optimization methods, due to their high computational complexity and long solution time, are difficult to complete online calculations within the limited clearing time window.
[0003] In recent years, deep learning methods have been gradually introduced into the field of power system dispatching due to their powerful nonlinear fitting capabilities and efficient forward inference speed. These methods attempt to directly map input operating conditions to clearing results by training neural network models, replacing the time-consuming optimization process. However, purely data-driven deep learning proxy models have inherent limitations: their outputs cannot strictly meet the physical constraints necessary for safe grid operation, potentially leading to infeasible solutions such as line power flow exceeding limits. Directly applying these models to actual clearing would threaten grid security. Furthermore, existing proxy models lack adaptive update capabilities after changes in grid topology or operating modes, making it difficult to guarantee long-term prediction accuracy. To address these issues, a data analysis method and apparatus for power spot market clearing based on deep learning are proposed. Summary of the Invention
[0004] To address the shortcomings of existing technologies, this invention provides a data analysis method for electricity spot market clearing based on deep learning, comprising the following steps: Step S1: Obtain historical clearing data related to the electricity spot market, including grid topology, node load forecast data, generator unit declaration parameters, line parameters, and historical clearing results; Step S2: Construct a clearing agent model based on graph neural network, taking the node features of the power grid topology obtained from step S1 as input, and outputting an initial clearing plan. The initial clearing plan includes the winning output of each generator unit and the marginal electricity price of each node. Step S3: Based on the DC power flow model, under the conditions of ignoring line resistance, assuming that the voltage amplitude of each node is 1 per unit, and that the voltage phase angle difference between the two ends of the branch is extremely small and can be approximated as sinθ≈θ, the initial clearing plan is checked for safety constraints. Using the node load prediction data and line parameters obtained in step S1, the active power flow of each branch is calculated. For any branch, when the active power flow exceeds the upper limit of the transmission capacity contained in the line parameters in the forward direction, the forward excess is recorded. When the active power flow exceeds the lower limit of the transmission capacity contained in the line parameters in the reverse direction, the reverse excess is recorded. In other cases, it is recorded as zero. Thus, the branch power flow violation amount with direction is obtained. Step S4: If there are non-zero elements in the branch power flow violation limits, an iterative correction module for safety correction of generator output is initiated. The iterative correction module performs correction calculations based on the Power Transfer Distribution Factor (PTDF) matrix, i.e., it calculates the PTDF matrix. The PTDF matrix is used to describe the linear sensitivity relationship between changes in node injected power and changes in branch power flow. The iterative correction module uses the branch power flow violation limits and the PTDF matrix to solve for the generator output adjustment, corrects the generator output in the initial clearing plan, and re-verifies the safety constraints after each correction until all branch power flows do not exceed the limits or the preset maximum number of iterations is reached, thus obtaining a feasible clearing plan. Step S5: Based on the feasible clearing plan and the generator set declaration parameters obtained in step S1, update the marginal electricity price of each node using the power transfer sensitivity relationship represented by the PTDF matrix described in step S4, and output the final clearing result including the feasible clearing plan and the updated node marginal electricity price.
[0005] Furthermore, the clearing agent model based on graph neural networks constructed in step S2 adopts a graph attention network structure; in the (l+1)th layer, the embedding representation of any node v is obtained through the following process: Set the neighbor nodes of node v The l-th layer embedding representation of each neighbor node u and node v itself. and Each is associated with a learnable weight matrix. Multiplication is used to perform linear feature transformation; Calculate the attention coefficient between node v and each of its neighboring nodes u. This coefficient reflects the importance of neighboring node characteristics to node v, and its calculation formula is as follows: ; in, For a learnable attention vector, the symbol is... This represents a vector concatenation operation, where w is the set of neighboring nodes of node v. The index variables of all nodes in the array. Represents a set The l-th layer embedding representation of the w-th node in the middle; Using these attention coefficients as weights, the transformed features of all neighboring nodes and node v itself are summed in a weighted manner. Apply a nonlinear activation function to the summation result. Thus, the embedding representation of node v in the next layer is obtained. The mathematical expression for this process is: .
[0006] Furthermore, when constructing the clearing proxy model based on graph neural networks, a loss function is used to measure the deviation between the initial clearing plan output by the model and the actual clearing result. This loss function is constructed as follows: the initial clearing plan output by the model... The actual clearing result selected from the historical clearing results obtained in step S1 A comparison is made item by item, and the mean square error between the two is calculated as the fitting error term of the clearing result. Simultaneously, a DC power flow calculation is performed based on the initial clearing plan to obtain the power flow values of each branch j. The absolute value of the power flow exceeds the upper limit of the branch transmission capacity included in the line parameters obtained in step S1. The portion is used as the safety constraint violation quantity, and the safety constraint violation quantities of all branches are summed as the safety constraint penalty term; Finally, the fitting error term is combined with a preset penalty coefficient. The weighted safety constraint penalties are summed to form the total loss used for training, which is expressed as follows: ; Where N is the total number of training samples and B is the total number of power grid branches.
[0007] Furthermore, in step S4, the iterative correction module re-solves the system node voltage phase angle and branch active power flow based on the corrected power generation plan obtained in each iteration, and recalculates the PTDF matrix of each power generation node to each branch based on this new operating point, thereby dynamically updating the PTDF matrix for the next iteration; the corrected power generation plan output by the iterative correction module after iterative convergence is the feasible clearing plan.
[0008] Furthermore, in this iteration of the iterative correction module, the PTDF matrix obtained by dynamically updating in this iteration is utilized. The specific process for solving the generator output adjustment is as follows: The objective of eliminating branch power flow violations is constructed as an optimization problem. The objective function of this optimization problem consists of the weighted sum of squared residuals of power flow violations and a power balance penalty term. The power balance equation constraint is equivalently embedded through the penalty function, transforming the problem into an unconstrained form. Its objective function is expressed as: ; in, To reflect the importance of each branch, a diagonal weight matrix is used. A vector consisting of directional branch power flow violation limits. It is a column vector whose elements are all 1s. The norm is the penalty factor used to enforce the satisfaction of power balance constraints. Represents a weighted quadratic form ; By embedding power balance equation constraints equivalently using penalty functions, the optimization problem is transformed into an unconstrained form. Let the objective function be about The gradient is zero, so the generator output adjustment amount is obtained. The closed-form solution is expressed as follows: .
[0009] Furthermore, the process of updating the marginal electricity price of each node in step S5 includes: extracting the Lagrange multipliers obtained from the last iteration of the iterative correction module in solving the quadratic programming problem as the congestion shadow price of each branch. ; Based on the feasible clearing plan and the generator unit declaration parameters obtained in step S1, a DC optimal power flow model is constructed, and the marginal generation cost of the system is obtained by solving the model. ; For any node k in the network, update its marginal electricity price to the system's marginal generation cost. The sum of the congestion cost allocations of each congested branch; the congestion cost allocation of branch l is determined by the shadow price of congestion for that branch. Obtained by multiplying corresponding elements of the PTDF matrix; PTDF matrix uses symbolic representation This indicates that the elements of branch l corresponding to node k in the matrix are... A congested branch refers to a branch where the power flow reaches or exceeds the upper limit of the transmission capacity included in the line parameters obtained in step S1. This calculation is expressed as: ; in, This is the set of all branches where there is a blockage.
[0010] Furthermore, the method also includes: after the final clearing result is adopted and implemented by the electricity spot market, the grid status on which this market clearing is based, the generator unit declaration parameters obtained in step S1, the node load forecast data obtained in step S1, and the final clearing result confirmed by the actual market execution are used to form a new labeled training sample. This sample is added to the training dataset and the graph neural network clearing agent model is subjected to online incremental learning in order to continuously improve the model's prediction accuracy and adaptability to new operating modes.
[0011] Furthermore, the node load forecast data and grid topology in step S1 are derived from the ultra-short-term forecast information reported by the real-time electricity market. The method is applied to the intraday rolling clearing or real-time clearing of the electricity spot market to meet the time requirements of rapid clearing calculation.
[0012] A data analysis device for clearing electricity spot market transactions based on deep learning includes: The data acquisition module is used to acquire historical clearing data related to the electricity spot market, including grid topology, node load forecast data, generator unit declaration parameters, line parameters and historical clearing results; The clearing agent module is used to construct a clearing agent model based on graph neural networks. It takes the node features of the power grid topology obtained from the data acquisition module as input and outputs an initial clearing plan, which includes the winning output of each generator unit and the marginal electricity price of each node. The safety constraint verification module is used to verify the safety constraints of the initial clearing plan based on the DC power flow model, ignoring line resistance, assuming that the voltage amplitude of each node is 1 per unit, and that the voltage phase angle difference between the two ends of the branch is extremely small and can be approximated as sinθ≈θ. Using the node load prediction data and line parameters obtained by the data acquisition module, the active power flow of each branch is calculated. For any branch, when the active power flow exceeds the upper limit of the transmission capacity included in the line parameters in the forward direction, the forward excess is recorded; when the active power flow exceeds the lower limit of the transmission capacity included in the line parameters in the reverse direction, the reverse excess is recorded; otherwise, it is recorded as zero. Thus, the branch power flow violation amount with direction is obtained. The iterative correction module is used to initiate iterative correction based on the power transfer distribution factor (PTDF) matrix when there are non-zero elements in the branch power flow violation limit. The PTDF matrix is used to describe the linear sensitivity relationship between the node injection power change and the branch power flow change. Using the branch power flow violation limit and the PTDF matrix, the generator output adjustment is solved to correct the initial clearing and the planned generator output. After each correction, the safety constraints are re-verified until all branch power flows do not exceed the limit or the preset maximum number of iterations is reached, and a feasible clearing plan is obtained. The electricity price update module is used to update the marginal electricity price of each node based on the feasible clearing plan and the generator set declaration parameters obtained by the data acquisition module, using the power transfer sensitivity relationship represented by the PTDF matrix described in step S4, and output the final clearing result including the feasible clearing plan and the updated node marginal electricity price.
[0013] The present invention has the following advantages over the prior art: By constructing a two-layer hybrid architecture of "graph neural network surrogate model and PTDF iterative correction," the contradiction between the slow computation speed of traditional physical optimization models and the inability of pure data-driven models to strictly guarantee power grid safety constraints is fundamentally resolved. The graph neural network surrogate model fully leverages the efficient inference capabilities of deep learning to quickly generate an initial clearing plan close to the optimal solution. The iterative correction module, on the other hand, performs closed-loop verification and correction based on a rigorous physical model, ensuring that the final clearing result absolutely meets power grid safety constraints. The two modules work together to meet the timeliness requirements of real-time or intraday rolling clearing while ensuring the physical feasibility of the clearing result and the safety of power grid operation. A branch safety constraint penalty term calculated from DC power flow is creatively introduced into the loss function of the clearing surrogate model. This allows the model to not only fit historical clearing data during the training phase but also learn the physical operation laws of the power grid, effectively reducing the degree to which the initial clearing plan output by the model violates safety constraints. This reduces the amount of correction and the number of iterations in subsequent iterative corrections, further shortening the overall clearing time. In each iteration, the iterative correction module adjusts the current correction based on the corrected data. The system operating point is recalculated based on the power generation plan, and the PTDF matrix is dynamically updated based on this operating point, instead of using a fixed static sensitivity matrix. This effectively reflects the nonlinear characteristics of power transmission in the power grid, ensures the accuracy of each correction direction, and avoids correction oscillations or slow convergence caused by sensitivity mismatch. In the calculation of the nodal marginal price, the Lagrange multiplier is extracted from the optimization problem solved in the last iteration of the correction module as the congestion shadow price of each branch. Combined with the PTDF matrix, the congestion cost is accurately allocated to each node, resulting in a nodal marginal price that accurately reflects the degree and location of grid congestion. This provides clear price guidance for market participants and promotes the optimal allocation of power resources. At the same time, this invention supports constructing new training samples from the actual clearing results after each market clearing, and performing online incremental learning on the graph neural network proxy model. This enables the model to continuously adapt to changes in grid topology, load characteristic evolution, and generator bidding strategy adjustments, maintaining high prediction accuracy in long-term operation and overcoming the performance degradation problem of traditional offline training models due to operating mode drift. Attached Figure Description
[0014] Figure 1 This is the overall flowchart of the present invention. Detailed Implementation
[0015] To further illustrate the technical means and effects of the present invention in achieving its intended purpose, the following detailed description of the specific implementation methods, structures, features, and effects of the present invention, in conjunction with the accompanying drawings and preferred embodiments, is provided below.
[0016] like Figure 1 As shown, the data analysis method for clearing electricity spot transactions based on deep learning includes the following steps: Step S1: Obtain historical clearing data related to the electricity spot market, including grid topology, node load forecast data, generator unit declaration parameters, line parameters, and historical clearing results; Step S2: Construct a clearing agent model based on graph neural network, taking the node features of the power grid topology obtained from step S1 as input, and outputting an initial clearing plan. The initial clearing plan includes the winning output of each generator unit and the marginal electricity price of each node. Step S3: Based on the DC power flow model, under the conditions of ignoring line resistance, assuming that the voltage amplitude of each node is 1 per unit, and that the voltage phase angle difference between the two ends of the branch is extremely small and can be approximated as sinθ≈θ, the initial clearing plan is checked for safety constraints. Using the node load prediction data and line parameters obtained in step S1, the active power flow of each branch is calculated. For any branch, when the active power flow exceeds the upper limit of the transmission capacity contained in the line parameters in the forward direction, the forward excess is recorded. When the active power flow exceeds the lower limit of the transmission capacity contained in the line parameters in the reverse direction, the reverse excess is recorded. In other cases, it is recorded as zero. Thus, the branch power flow violation amount with direction is obtained. Step S4: If there are non-zero elements in the branch power flow violation limits, an iterative correction module for safety correction of generator output is initiated. The iterative correction module performs correction calculations based on the Power Transfer Distribution Factor (PTDF) matrix, i.e., it calculates the PTDF matrix. The PTDF matrix is used to describe the linear sensitivity relationship between changes in node injected power and changes in branch power flow. The iterative correction module uses the branch power flow violation limits and the PTDF matrix to solve for the generator output adjustment, corrects the generator output in the initial clearing plan, and re-verifies the safety constraints after each correction until all branch power flows do not exceed the limits or the preset maximum number of iterations is reached, thus obtaining a feasible clearing plan. Step S5: Based on the feasible clearing plan and the generator set declaration parameters obtained in step S1, update the marginal electricity price of each node using the power transfer sensitivity relationship represented by the PTDF matrix described in step S4, and output the final clearing result including the feasible clearing plan and the updated node marginal electricity price.
[0017] The clearing agent model based on graph neural networks constructed in step S2 adopts a graph attention network structure; in the (l+1)th layer, the embedding representation of any node v is obtained through the following process: Set the neighbor nodes of node v The l-th layer embedding representation of each neighbor node u and node v itself. and Each is associated with a learnable weight matrix. Multiplication is used to perform linear feature transformation; Calculate the attention coefficient between node v and each of its neighboring nodes u. This coefficient reflects the importance of neighboring node characteristics to node v, and its calculation formula is as follows: ; in, For a learnable attention vector, the symbol is... This represents a vector concatenation operation, where w is the set of neighboring nodes of node v. The index variables of all nodes in the array. Represents a set The l-th layer embedding representation of the w-th node in the middle; Using these attention coefficients as weights, the transformed features of all neighboring nodes and node v itself are summed in a weighted manner. Apply a nonlinear activation function to the summation result. Thus, the embedding representation of node v in the next layer is obtained. The mathematical expression for this process is: ; A clearing surrogate model is constructed using a graph attention network structure. Through the attention mechanism, the influence weights of different neighboring nodes on the central node in the power grid topology are adaptively learned. This can effectively capture the differences in the correlation strength between nodes in the power system. For example, at critical sections where grid congestion occurs frequently, nodes connected to heavily loaded lines will be automatically assigned larger attention coefficients due to their higher power flow sensitivity. This allows the model to focus on areas that significantly affect the clearing results when aggregating features. Compared with aggregation methods with fixed weights or no structure, this significantly improves the prediction accuracy and generalization ability of the surrogate model for unit bidding output and node marginal electricity price under complex operating conditions.
[0018] A power system consists of three nodes: node 1 and node 3 are generating nodes, and node 2 is a load node. The line connections are as follows: Node 1 is connected to Node 2 via line L12, and Node 2 is connected to Node 3 via line L23. At a certain operating moment, after processing the data obtained in step S1, the initial input feature vector of each node is 2-dimensional, representing the per-unit value of the net injected power and the per-unit value of the generation marginal cost (the marginal cost of the load node is set to 0).
[0019] Specifically, the setting is: Node 1 features ; Node 2 features ; Node 3 features .
[0020] The graph attention network employs a single-layer, single-head attention mechanism with a pre-set learnable weight matrix. The identity matrix and the attention vector are... Set as LeakyReLU activation function and ELU activation function ( The mathematical definitions of ) are as follows: ; ; in, This represents the input value of the activation function, which is the original attention score in the attention coefficient calculation, and the components of the aggregated vector after feature aggregation; The following calculation uses node 2 as the central node to compute its next layer of embedding representation. .
[0021] Neighbor set of node 2 It includes node 1, node 2 and node 3.
[0022] First, a linear feature transformation is performed on each neighboring node, because... Since it is an identity matrix, the transformed features are equal to the original features. Next, the attention coefficients of each neighbor to node 2 are calculated.
[0023] Taking neighbor node 1 as an example, the symbol This indicates a vector concatenation operation, which concatenates vectors... and Concatenating them yields a 4-dimensional vector. First calculate the raw score. Then, LeakyReLU activation is applied to the original score to obtain the activated attention score. : ; ; Similarly, the concatenated vector of neighbor node 2 (self-loop) is [-0.8, 0, -0.8, 0]. T The score is: ; ; The concatenated vector of neighbor node 3 is [-0.8, 0, 0.3, 0.5]. T The score is: ; ; The attention scores after activation are normalized using softmax, and the attention coefficients are calculated. The general calculation formula is: ; Substitute the numerical values to calculate the index value ; It can be seen that because the characteristics of nodes 1 and 3 differ significantly from those of node 2 and are numerically symmetrical, their attention weights are almost equal, while their self-loop weights are slightly lower. If the grid parameters are modified to change the injected power of node 1, the corresponding original score will change accordingly. Under most operating conditions, the attention coefficient corresponding to node 1 will change significantly, intuitively demonstrating that the model has the ability to adaptively respond to changes in the operating characteristics of nodes.
[0024] Finally, the weighted aggregation yields the next-level embedding representation of node 2. The aggregation result is denoted as... The ELU function is used as the output activation function. : ; ; Substitute into numerical calculation of aggregate vector In the following calculations, the attention coefficients are calculated using full-precision values: ; ; ; ; After the ELU activation function outputs, since both components are positive, the ELU degenerates into an identity mapping, ultimately... This embedding vector incorporates information from neighboring nodes, and the importance of each neighbor is differentially modeled. Subsequent network layers can further extract features to predict the clearing outcome. This example fully demonstrates the adaptive weight learning process of a graph attention network. In real-world electricity spot clearing, the model can automatically focus on key nodes that significantly impact branch power flow and electricity prices, thereby improving the accuracy of the surrogate model.
[0025] When constructing a clearing proxy model based on a graph neural network, a loss function is used to measure the deviation between the initial clearing plan output by the model and the actual clearing result. This loss function is constructed as follows: the initial clearing plan output by the model... The actual clearing result selected from the historical clearing results obtained in step S1 A comparison is made item by item, and the mean square error between the two is calculated as the fitting error term of the clearing result. Simultaneously, a DC power flow calculation is performed based on the initial clearing plan to obtain the power flow values of each branch j. The absolute value of the power flow exceeds the upper limit of the branch transmission capacity included in the line parameters obtained in step S1. The portion is used as the safety constraint violation quantity, and the safety constraint violation quantities of all branches are summed as the safety constraint penalty term; Finally, the fitting error term is combined with a preset penalty coefficient. The weighted safety constraint penalties are summed to form the total loss used for training, which is expressed as follows: ; Where N is the total number of training samples and B is the total number of power grid branches; By incorporating the mean squared error between the initial clearing plan and the actual historical clearing results into the loss function of the clearing proxy model training, and simultaneously performing DC power flow calculations based on the initial clearing plan, summing the portion of the power flow exceeding the transmission capacity limit of each branch and multiplying it by a penalty coefficient to serve as a safety constraint penalty term, the two are weighted and summed to form the total loss. This allows the model to not only learn clearing patterns from historical data during training but also be guided by the physical safety constraints of the power grid. This effectively reduces the degree of power flow exceeding the limit in the initial clearing plan output by the model, thereby alleviating the correction pressure on subsequent iterative correction modules, reducing the number of iterations, and improving the overall speed and feasibility of power spot market clearing calculations.
[0026] In a 3-node power system, nodes 1 and 3 are generating nodes, and node 2 is a load node. Line L12 connects node 1 and node 2, and line L23 connects node 2 and node 3. The per-unit reactance of both lines is 0.1, resistance is ignored, and the upper limit of the transmission capacity of each line is set to 0.5 pu. The net injected power of load node 2 is -0.8 pu (i.e., the load is 0.8 pu).
[0027] Take one sample from the training set, whose true historical clearing results are the winning bid outputs of units at nodes 1 and 3. (Unit: PU), this clearing result satisfies load balancing. Assume that in the current training iteration, the initial clearing plan output by the graph neural network surrogate model is... The default penalty coefficient α=10. In this example, the batch size N=1. At this time, the average coefficient does not affect the calculation result. The total number of power grid branches B=2.
[0028] First, calculate the fitting error term. Then, compare the model output with the actual force term by term to obtain the mean squared error: ; Next, calculate the safety constraint penalty.
[0029] According to the initial clearing plan Perform DC power flow calculations. In this example three-node radial network, according to the power balance relationship, the power injected from node 1 (0.55 pu) is sent to node 2 via line L12, and the power injected from node 3 (0.25 pu) is sent to node 2 via line L23, together satisfying the 0.8 pu load requirement of node 2.
[0030] Take node 2 as the reference node, and set its voltage phase angle. .
[0031] Based on the standard formula for DC power flow , To determine the branch reactance connecting node i and node j, the positive power flow direction is defined as the direction of increasing node numbers (i.e., the positive direction of L12 is 1→2, and the positive direction of L23 is 2→3). Calculate the branch power flow: Line L12, power flows from node 1 to node 2, with a value of 0.55 pu: ; For line L23, power flows from node 3 to node 2, meaning the actual flow direction is opposite to the defined positive direction, with a value of 0.25 pu. ; Comparison of absolute power flow values and transmission capacity limits for each branch: ; ; The safety constraint penalty is the sum of the violations of each branch road multiplied by the penalty coefficient: ; Adding the fitting error term to the penalty term yields the total loss for this training sample: ; As can be seen from the above calculations, the loss function incurs a penalty of 0.5 simply because the power flow of line L12 exceeds the capacity limit by 0.05 pu, which is much larger than the fitting error of 0.02. This drives the model parameters to be updated in the direction of reducing the power flow of that line during backpropagation, causing the output of node 1 in the next output initial clearing plan to tend to decrease, while the output of node 3 increases accordingly to meet load balance. Ultimately, this ensures that the initial clearing plan output by the model gradually meets the safety constraints. This mechanism injects physical model knowledge into the data-driven training process, effectively achieving a balance between prediction accuracy and grid security.
[0032] In step S4, the iterative correction module re-solves the system node voltage phase angle and branch active power flow based on the corrected power generation plan obtained in each iteration, and recalculates the PTDF matrix of each power generation node to each branch based on this new operating point, thereby dynamically updating the PTDF matrix for the next iteration; the corrected power generation plan output by the iterative correction module after iterative convergence is the feasible clearing plan. In each iteration, the iterative correction module recalculates the system node voltage phase angle and branch active power flow based on the current corrected power generation output plan, and dynamically updates the PTDF matrix of each power generation node to each branch accordingly. This ensures that the sensitivity information used in each calculation of the generator output adjustment is precisely matched with the actual operating point of the current power grid, effectively overcoming the correction direction deviation and convergence oscillation problems caused by the drift of the operating point due to the fixed sensitivity matrix. Especially when the power grid topology or operating mode changes significantly, this dynamic update mechanism can ensure that each correction is in the correct direction of eliminating violations, thereby accelerating the iterative convergence speed and improving the accuracy and robustness of the final feasible clearing plan.
[0033] 3-node system: Nodes 1 and 3 are generating nodes, node 2 is a load node, the reactance of lines L12 and L23 is 0.1 pu, resistance is ignored, the upper limit of line transmission capacity is 0.5 pu, the net injected power of load node 2 is -0.8 pu, and node 2 is set as the voltage phase angle reference node. The initial clearing plan output by the neural network surrogate model is... (Unit: pu) As shown in step S3, the active power flow of line L12 is 0.55 pu, exceeding the upper limit by 0.05 pu. The initial branch power flow violation vector is denoted as... (The positive direction is defined as before). Now, start the iterative correction module.
[0034] The general formula for the closed-form solution of the generator output adjustment in the k-th iteration of the iterative correction module is: ; in, This is the generator output adjustment vector for the k-th iteration. The PTDF matrix is calculated based on the current running point in the k-th iteration. To reflect the importance of each branch, a diagonal weight matrix is used. It is a column vector whose elements are all 1s. The penalty factor for power balance constraints. Let be the branch power flow violation vector in the k-th iteration. The penalty factor term in the formula... Its function is to embed the total output balance equation constraint of the generator sets into the objective function in the form of a penalty, so as to ensure that the sum of the output adjustment of each generator set is always zero during the iteration process, thereby maintaining the power balance of the system.
[0035] First iteration: Based on the initial planned operating point of power generation output, solve the node voltage phase angle and branch power flow to obtain the injected power of nodes 1 and 3 at the current operating point as 0.55 and 0.25, respectively.
[0036] Calculate the current PTDF matrix based on the DC power flow model. In this example three-node radial network, the power flow of line L12 has a sensitivity of 1 to the power injected into node 1 and a sensitivity of 0 to the power injected into node 3. The power flow sensitivity of line L23 to the injected power at node 1 is 0, and the sensitivity to the injected power at node 3 is -1. Therefore... .
[0037] Set the weight matrix Power balance penalty factor , Violation of the limit vector Substitute into the closed-form formula to calculate: ; ; ; The inverse of this second-order matrix can be obtained by analytical inversion, which yields the inverse matrix as follows: ; Penalty Factor When the value is sufficiently large, the solution approximates the increase or decrease of generator output by an equal amount, thereby maintaining power balance.
[0038] ; ; Engineering approximation is acceptable The sum of the components of pu is -0.025 + 0.025 = 0, which satisfies the power balance constraint and verifies the effect of the penalty function term. The revised power generation output plan is as follows: ; Based on the revised power output plan, the safety constraints were re-verified, resulting in a power flow of 0.525 pu for line L12, which still exceeds the upper limit of 0.025 pu. The power flow for line L23 was -0.275 pu, which did not exceed the limit. The violation vector was updated as follows: .
[0039] Second iteration: Based on the revised power generation output plan. The node voltage phase angles are recalculated, and the PTDF matrix is recalculated based on the new operating point. .
[0040] In this example, the network parameters are constant and a DC power flow model is used. However, this step ensures the real-time nature of sensitivity information in more general nonlinear scenarios.
[0041] Use the updated and violation of limits Solve for the generator output adjustment again: ; The revised power output plan is as follows: ; At this point, the power flow of line L12 decreased to 0.5125 pu, still slightly exceeding the limit. The iteration continued, with the output adjustment magnitude gradually decreasing in each iteration until the power flow of all branches did not exceed the limit, and finally converged to a feasible clearing plan. The total output remains at 0.8 pu, perfectly balanced with the load. This process fully demonstrates the closed-loop correction mechanism that recalculates the power flow, dynamically updates the PTDF matrix, and solves for the adjustment amount based on the current operating point in each iteration. Even in the simplified DC model where the PTDF value remains unchanged, this dynamic update step provides technical support for dealing with sensitivity changes caused by nonlinear factors such as network losses and voltage variations in the actual power grid, ensuring that the correction direction is always accurate and thus reliably converges to a feasible solution.
[0042] In this iteration of the iterative correction module, the PTDF matrix obtained by dynamically updating in this iteration is used. The specific process for solving the generator output adjustment is as follows: The objective of eliminating branch power flow violations is constructed as an optimization problem. The objective function of this optimization problem consists of the weighted sum of squared residuals of power flow violations and a power balance penalty term. The power balance equation constraint is equivalently embedded through the penalty function, transforming the problem into an unconstrained form. Its objective function is expressed as: ; in, To reflect the importance of each branch, a diagonal weight matrix is used. A vector consisting of directional branch power flow violation limits. It is a column vector whose elements are all 1s. The norm is the penalty factor used to enforce the satisfaction of power balance constraints. Represents a weighted quadratic form ; By embedding power balance equation constraints equivalently using penalty functions, the optimization problem is transformed into an unconstrained form. Let the objective function be about The gradient is zero, so the generator output adjustment amount is obtained. The closed-form solution is expressed as follows: ; By constructing the correction objective of eliminating branch power flow violations as an unconstrained optimization problem containing the weighted sum of squared residuals of power flow violations and a power balance penalty term, the generator output balance equation constraint is equivalently embedded into the objective function using the penalty function method. This transforms the solution of the constrained optimization problem into directly finding the gradient zero of the objective function with respect to the generator output adjustment, and deriving an analytical solution with a closed form. This allows for the rapid acquisition of the adjustment amount in each iteration without calling the numerical optimization solver, significantly reducing the computation time of a single iteration. At the same time, the introduction of the weight matrix W allows for differentiated weighting based on the importance or credibility of different branches, and the setting of the penalty factor ρ forces the balance between the total generator output and the load throughout the iteration. This makes the correction process physically meaningful, computationally stable and efficient, and is very suitable for engineering deployment in time-critical scenarios such as intraday rolling clearing or real-time clearing of the electricity spot market.
[0043] Continuing with the aforementioned 3-node system: Nodes 1 and 3 are power generation nodes, Node 2 is a load node, the reactance of lines L12 and L23 is 0.1 pu, the upper limit of transmission capacity is 0.5 pu, and the net injected power of Node 2 is -0.8 pu (i.e., the total system load is 0.8 pu). Currently, we are in an iteration of the iterative correction module, and the corrected power generation output plan is as follows: The branch power flow violation vector is obtained after security verification (pu). pu, the PTDF matrix calculated based on the current running point. Set the branch weight matrix Power balance penalty factor A column vector of all 1s .
[0044] First, the correction objective is constructed as an unconstrained optimization problem, with the objective function being: ; The first term is the weighted sum of squared residuals of power flow violation, which expands to a weighted quadratic form: ; The second term is the power balance penalty term. A heavy penalty is imposed on the total generator output adjustment that deviates from zero, thereby maintaining a real-time balance between power generation and load during the optimization process.
[0045] Let the objective function about The gradient is zero, that is... ,have to: ; After simplification, we obtain the normal equation: ; When the coefficient matrix When reversible, the generator output adjustment amount The closed-form solution is: ; Substitute the specific values and calculate each term of the matrix: ; ; ; ; Inverting the coefficient matrix yields the inverse matrix: ; Finally, the closed-form solution for the generator output adjustment is obtained: ; To obtain the Lagrange multipliers needed to calculate the marginal electricity price at the nodes in step S5, the above penalty function optimization problem is equivalently transformed into a standard quadratic programming problem, and the solution process is supplemented as follows. Reducing the power balance penalty term to explicit equality constraints, the original unconstrained optimization problem is equivalent to the following standard quadratic programming problem with equality constraints: ; ; Construct the Lagrangian function for this quadratic programming problem: ; in Equality constraints The corresponding Lagrange multipliers. According to the KKT conditions, let the Lagrange function be about... The partial derivatives are zero: ; Combined with constraints Solving for the Lagrange multipliers The calculation formula is: ; Substitute specific values Its inverse matrix is still the identity matrix, calculated as follows: ; ; ; The Lagrange multiplier The corresponding physical meaning is the shadow price of the power balance constraint, whose absolute value of 0.025 is consistent with the engineering approximate amplitude of the adjustment amount in the aforementioned penalty function method. In this example, only the power balance equality constraint exists. Similarly, when branch power flow inequality constraints exist, the Lagrange multipliers corresponding to each blocked branch can be extracted. This is used in step S5 for the calculation of the nodal marginal electricity price decomposition.
[0046] After engineering approximation pu; Exact solution to the sum of components The approximate sum of the components -0.025 + 0.025 = 0, all of which satisfy the power balance constraint. Applying this adjustment to the current power generation output plan yields the corrected output. The power flow rate (PU) of line L12 was verified to be reduced to 0.525 PU, halving the violation rate. This process fully demonstrates the computational flow of constructing unconstrained optimization using the penalty function method and directly obtaining closed-form solutions through differentiation. It also supplements the process of equivalently transforming the penalty function method into standard quadratic programming and extracting Lagrange multipliers, providing a complete theoretical connection for subsequent nodal marginal electricity price calculations. This avoids the iterative overhead of online solving of constrained quadratic programming, significantly improving iterative correction efficiency. Furthermore, the configurability of the weight matrix and penalty factor allows this method to flexibly adapt to the differentiated control requirements for branch safety margins and power balance accuracy under different grid operation modes.
[0047] The process of updating the marginal electricity price of each node in step S5 includes: extracting the Lagrange multipliers obtained from solving the quadratic programming problem in the last iteration of the iterative correction module as the congestion shadow price of each branch. ; Based on the feasible clearing plan and the generator unit declaration parameters obtained in step S1, a DC optimal power flow model is constructed, and the marginal generation cost of the system is obtained by solving the model. ; For any node k in the network, update its marginal electricity price to the system's marginal generation cost. The sum of the congestion cost allocations of each congested branch; the congestion cost allocation of branch l is determined by the shadow price of congestion for that branch. Obtained by multiplying corresponding elements of the PTDF matrix; PTDF matrix uses symbolic representation This indicates that the elements of branch l corresponding to node k in the matrix are... A congested branch refers to a branch where the power flow reaches or exceeds the upper limit of the transmission capacity included in the line parameters obtained in step S1. This calculation is expressed as: ; in, This is the set of all branches where there is a blockage. By directly extracting the Lagrange multipliers generated during the final iteration of the iterative correction module in solving the quadratic programming problem as the shadow price of each congested branch, and then using the system marginal generation cost and the PTDF matrix to accurately allocate the congestion cost to each node, the system marginal generation cost is obtained by solving the DC optimal power flow model. The congestion shadow price of each branch reuses the intermediate calculation results of the iterative correction module, avoiding the need to repeatedly solve the complete DC optimal power flow model with security constraints in the electricity price calculation stage to obtain the congestion shadow price. This significantly reduces the complexity and time consumption of the electricity price calculation stage. This electricity price signal can accurately reflect the difference in generation cost of different nodes due to grid security constraints, providing clear economic incentives for market participants, guiding power investment and load distribution towards optimization in the direction of alleviating grid congestion, thereby improving the overall resource allocation efficiency of the electricity market.
[0048] Continuing with the aforementioned 3-node system and supplementing the generator set application parameters: Nodes 1 and 3 are generating nodes, Node 2 is a load node, the reactance of lines L12 and L23 is 0.1 pu, the upper limit of transmission capacity is 0.5 pu, and the net injected power of Node 2 is -0.8 pu. The marginal cost of generator set application at Node 1 is 200 yuan / MWh, and the marginal cost of generator set application at Node 3 is 300 yuan / MWh. After correction by the clearing surrogate model prediction and iterative correction module based on graph neural networks, the feasible clearing plan is as follows: At this point, the power flow of line L12 is exactly 0.5 pu, reaching the transmission capacity limit, and it is a congested branch. The power flow of line L23 is -0.3 pu, which is not exceeding the limit. In the final iteration of the iterative correction module to solve the quadratic programming problem, the Lagrange multiplier corresponding to the power flow constraint of line L12 is... Yuan / MWh, this value reflects the marginal scarcity value of the L12 line capacity constraint.
[0049] To obtain the system's marginal power generation cost A DC optimal power flow model is constructed based on a feasible clearing plan and generator unit declaration parameters. This model uses the minimum generation cost as its objective function, considering node power balance constraints, generator unit output upper and lower limit constraints, and branch power flow limit constraints. Its standard mathematical form is: ; ; ; ; ; ; Among them, branch tidal currents and Based on the DC power flow model, it is expressed as a linear function of node-injected power, given by the PTDF matrix: .
[0050] In feasible clearing plan Below, the power flow of line L12 is 0.5 pu, which reaches the upper limit and is a blocked branch; the power flow of line L23 is -0.3 pu, and its absolute value of 0.3 does not reach the upper limit, so this constraint is not a tight constraint.
[0051] Solve this DC optimal power flow model, the objective function value is Yuan.
[0052] System marginal generation cost Defined as the Lagrange multiplier for the nodal power balance constraint, under this optimal solution, if the load increases by 1 unit (i.e., from 0.8 to 0.81), since line L12 is already full, the new load must be borne by node 3, increasing the total cost by 300 yuan. Therefore, the system's marginal generation cost... =300 yuan / MWh.
[0053] The PTDF matrix elements corresponding to each node are determined with node 2 as the reference node: the transfer distribution factor of node 1 to line L12. The transfer distribution factor of line L23 ; Transfer distribution factor of node 3 to line L12 The transfer distribution factor of line L23 ; The transfer distribution factor of reference node 2 for any branch is 0. Line L23 is not congested, so its congestion shadow price is zero, and only the congestion cost needs to be allocated to the congested branch L12.
[0054] The formula for calculating the marginal electricity price at each node is as follows: ; in Here is the set of branches where there is obstruction. Substitute in specific values: Marginal electricity price at node 1: ; Marginal electricity price at node 2: ; Marginal electricity price at node 3: ; Calculation results show that, because node 1 is located at the sending end of the congested line, its marginal electricity price is 100 yuan / MWh higher than the system's marginal generation cost, accurately reflecting the additional cost caused by its increased power generation exacerbating the line congestion. Node 3 is located at the receiving end of the congested line, and its electricity price is equal to the system's marginal generation cost. Node 2, as a load center, has an electricity price that represents the system's marginal cost; however, if load growth may lead to increased congestion, this price signal will guide the load-side response. This example fully demonstrates the process of rapidly decomposing and calculating the node's marginal electricity price using the Lagrange multipliers and PTDF matrix generated by the iterative correction process. This avoids a secondary solution to the complete DC optimal power flow model and significantly improves the overall efficiency of clearing calculations while ensuring that the electricity price signal accurately reflects the grid congestion state.
[0055] The method also includes: after the final clearing result is adopted and implemented by the electricity spot market, the grid status on which this market clearing is based, the generator unit declaration parameters obtained in step S1, the node load forecast data obtained in step S1, and the final clearing result confirmed by the actual market execution are used to form a new labeled training sample. This sample is added to the training dataset and the graph neural network clearing agent model is subjected to online incremental learning in order to continuously improve the model's prediction accuracy and adaptability to new operating modes. After each final clearing result is adopted and implemented by the electricity spot market, the grid operating conditions, generator unit declaration parameters, node load data, and the final clearing result confirmed by the actual market execution are used to construct new labeled training samples. These samples are added to the training dataset and used for online incremental learning of the graph neural network clearing proxy model. This allows the model to continuously track the slow drift of actual operating modes such as grid topology changes, load characteristic evolution, and generator unit bidding strategy adjustments, thus maintaining the predictive accuracy of the clearing proxy model in long-term operation.
[0056] Continuing with the aforementioned 3-node system: Nodes 1 and 3 are power generation nodes, Node 2 is a load node, the reactance of lines L12 and L23 is 0.1 pu, and the upper limit of transmission capacity is 0.5 pu.
[0057] In a certain electricity spot market clearing, the prior information available before the clearing was: the load forecast value for node 2 was -0.8 pu; The marginal cost of the generator unit at node 1 is RMB 200 / MWh, and the upper and lower limits of output are 0.8 pu and 0 p.u., respectively. The marginal cost of the generator unit at node 3 is RMB 300 / MWh, and the upper and lower limits of output are 0.8 pu and 0 p.u., respectively.
[0058] After prediction and iterative correction by the graph neural network surrogate model, the final clearing result is that node 1 has a winning output of 0.5 pu and node 3 has a winning output of 0.3 pu. The marginal electricity price of node 1 is 400 yuan / MWh, and the marginal electricity prices of nodes 2 and 3 are both 300 yuan / MWh. This clearing result was adopted by the market and actually implemented. After confirmation, a new labeled training sample was formed.
[0059] The input features of this training sample are encoded into feature vectors for each node based on grid operating conditions, generating unit declaration information, and load information available before clearing. This example organizes the feature vectors of each node into three dimensions, representing the lower limit of generating unit output, the upper limit of generating unit output, and the marginal cost of generating unit declaration (the upper and lower limits of output and the marginal cost of load nodes are both set to 0, and their net injected power is placed as a negative value in the lower limit of output dimension): ; ; ; The sample labels represent the final clearing results confirmed by actual market execution, i.e., the winning output of each generator unit: ; The power grid topology is stored in the form of an adjacency matrix, which, together with the node features mentioned above, constitutes a complete training sample input.
[0060] After adding the new sample to the training dataset, the graph neural network agent model is subjected to online incremental learning. Let the current model parameters be... The loss function for the new sample follows the previously defined form, including a safety constraint penalty term. For a single sample batch N=1, its expression is: ; in For the model with current parameters The forward propagation output of the new sample input features, where α is the safety constraint penalty coefficient and B is the total number of power grid branches. The active power flow of the j-th branch is obtained by DC power flow calculation based on the initial clearing plan output by the model. Let η be the upper limit of the transmission capacity of the j-th branch. Set the learning rate η = 0.001 and update the model parameters using gradient descent: ; In actual deployment, you can choose to fine-tune each new sample sequentially, or accumulate multiple new samples to form a small batch and then perform incremental updates to balance learning efficiency and computational overhead.
[0061] In this example, the new sample reflects the operating state of line L12 reaching its transmission capacity limit, i.e., the output of node 1 is limited to 0.5 pu.
[0062] Without incremental learning, the prediction accuracy of the offline-trained model will gradually decrease as future grid load growth leads to more frequent occurrences of similar congestion scenarios. However, by incorporating this sample into incremental learning, the model parameters are specifically adjusted, enhancing its ability to fit operating modes near congestion sections. This allows the model to provide an initial clearing plan that is closer to the actual feasible domain when encountering similar operating modes during subsequent clearing, thereby maintaining the prediction accuracy and adaptability of the clearing surrogate model in long-term operation.
[0063] The node load forecast data and grid topology in step S1 are derived from the ultra-short-term forecast information reported by the real-time electricity market. The method is applied to the intraday rolling clearing or real-time clearing of the electricity spot market to meet the time requirements of rapid clearing calculation. By limiting the sources of node load forecast data and grid topology to ultra-short-term forecast information reported by the real-time rolling electricity market, and specifying that this method is applied to the intraday rolling clearing or real-time clearing of the electricity spot market, the load information and grid operating status on which the clearing calculation is based are highly consistent with the actual operating conditions of the current situation and the short term to come. This avoids the deviations that may exist based on day-ahead forecasts or offline data, thereby ensuring the accuracy and feasibility of the clearing results. At the same time, the combination of the fast reasoning capability of the graph neural network surrogate model and the efficient closed-loop solution calculation of the iterative correction module enables the entire process from data acquisition to the output of the final clearing result to be completed in a very short time. This meets the stringent requirements of intraday rolling clearing or real-time clearing for computational timeliness and strongly supports the high-frequency safe and economical dispatch of the electricity market.
[0064] The following example illustrates this. The example scenario continues the aforementioned 3-node system: Nodes 1 and 3 are generation nodes, Node 2 is a load node, and the reactance of lines L12 and L23 is 0.1 pu, with a transmission capacity limit of 0.5 pu for both. The declared marginal cost of the generator unit at Node 1 is 200 yuan / MWh, with output limits of 0.8 pu and 0 p.u. respectively; the declared marginal cost of the generator unit at Node 3 is 300 yuan / MWh, with output limits of 0.8 pu and 0 p.u. respectively. A provincial electricity spot market adopts an intraday rolling clearing mechanism, initiating a clearing calculation every 15 minutes, requiring clearing to be completed and dispatch instructions issued within 2 minutes. At the current time of 10:00, real-time rolling ultra-short-term load forecast data from the electricity market shows that the predicted net power injection at Node 2 in the future period is -0.8 pu; simultaneously, the grid topology, obtained from the real-time state estimation module, confirms a radial connection of Node 1-Node 2-Node 3, with no equipment maintenance or faults. The above data was obtained in step S1.
[0065] In step S2, the graph neural network clearing agent model has been trained using a graph attention network structure. During the forward inference phase, each layer's computation involves only the calculation of attention weights between nodes, linear transformations, and non-linear activations. For a 3-node network, the computational cost is approximately tens of floating-point operations, taking about 0.5 milliseconds on a general-purpose CPU. The model outputs an initial clearing plan. The initial output of pu remains consistent.
[0066] Step S3 performs safety constraint verification based on the DC power flow model. The calculated active power flow of line L12 is 0.55 pu, exceeding the transmission capacity limit by 0.05 pu. The power flow of line L23 is -0.25 pu, which does not exceed the limit. The initial branch power flow violation vector is obtained. .
[0067] Step S4 starts the iterative correction module. The PTDF matrix at the current running point is: Set the weight matrix Penalty factor Each iteration uses the closed-form solution formula. Solving for the generator output adjustment requires solving a 2×2 linear equation system and updating the output, which takes approximately 20 microseconds. After three iterations, the adjustments for each iteration are as follows: After cumulative adjustments, all branch power flows satisfy the constraints, resulting in a feasible clearing plan. The total output power is maintained at 0.8 pu, which is completely balanced with the load.
[0068] Step S5 updates the marginal electricity price at the nodes and extracts the Lagrange multipliers from the last iteration of the iterative correction module. Yuan / MWh serves as the shadow price of congestion, representing the marginal cost of power generation in the system. The marginal electricity price at node 1 is calculated to be 400 yuan / MWh using the PTDF matrix, while the marginal electricity prices at nodes 2 and 3 are both 300 yuan / MWh.
[0069] From acquiring data in step S1 to outputting the final clearing result in step S5, the entire calculation process takes approximately 1.5 seconds, which is far lower than the market's 2-minute clearing time window requirement. This verifies the high timeliness and engineering feasibility of the method of this invention in intraday rolling clearing scenarios.
[0070] A data analysis device for clearing electricity spot market transactions based on deep learning includes: The data acquisition module is used to acquire historical clearing data related to the electricity spot market, including grid topology, node load forecast data, generator unit declaration parameters, line parameters and historical clearing results; The clearing agent module is used to construct a clearing agent model based on graph neural networks. It takes the node features of the power grid topology obtained from the data acquisition module as input and outputs an initial clearing plan, which includes the winning output of each generator unit and the marginal electricity price of each node. The safety constraint verification module is used to verify the safety constraints of the initial clearing plan based on the DC power flow model, ignoring line resistance, assuming that the voltage amplitude of each node is 1 per unit, and that the voltage phase angle difference between the two ends of the branch is extremely small and can be approximated as sinθ≈θ. Using the node load prediction data and line parameters obtained by the data acquisition module, the active power flow of each branch is calculated. For any branch, when the active power flow exceeds the upper limit of the transmission capacity included in the line parameters in the forward direction, the forward excess is recorded; when the active power flow exceeds the lower limit of the transmission capacity included in the line parameters in the reverse direction, the reverse excess is recorded; otherwise, it is recorded as zero. Thus, the branch power flow violation amount with direction is obtained. The iterative correction module is used to initiate iterative correction based on the power transfer distribution factor (PTDF) matrix when there are non-zero elements in the branch power flow violation limit. The PTDF matrix is used to describe the linear sensitivity relationship between the node injection power change and the branch power flow change. Using the branch power flow violation limit and the PTDF matrix, the generator output adjustment is solved to correct the initial clearing and the planned generator output. After each correction, the safety constraints are re-verified until all branch power flows do not exceed the limit or the preset maximum number of iterations is reached, and a feasible clearing plan is obtained. The electricity price update module is used to update the marginal electricity price of each node based on the feasible clearing plan and the generator set declaration parameters obtained by the data acquisition module, using the power transfer sensitivity relationship represented by the PTDF matrix described in step S4, and output the final clearing result including the feasible clearing plan and the updated node marginal electricity price.
[0071] The above are merely preferred embodiments of the present invention and are not intended to limit the present invention in any way. Although the present invention has been disclosed above with reference to preferred embodiments, it is not intended to limit the present invention. Any person skilled in the art can make some modifications or alterations to the above-disclosed technical content to create equivalent embodiments without departing from the scope of the present invention. Any simple modifications, equivalent changes and alterations made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the scope of the present invention.
Claims
1. A data analysis method for clearing electricity spot transactions based on deep learning, characterized in that, Includes the following steps: Step S1: Obtain historical clearing data related to the electricity spot market, including grid topology, node load forecast data, generator unit declaration parameters, line parameters, and historical clearing results; Step S2: Construct a clearing agent model based on graph neural network, taking the node features of the power grid topology obtained from step S1 as input, and outputting an initial clearing plan. The initial clearing plan includes the winning output of each generator unit and the marginal electricity price of each node. Step S3: Based on the DC power flow model, under the conditions of ignoring line resistance, assuming that the voltage amplitude of each node is 1 per unit, and meeting the preset requirements, the initial clearing plan is checked for safety constraints. Using the node load prediction data and line parameters obtained in step S1, the active power flow of each branch is calculated. For any branch, when the active power flow exceeds the upper limit of the transmission capacity contained in the line parameters in the forward direction, the forward excess is recorded. When the active power flow exceeds the lower limit of the transmission capacity contained in the line parameters in the reverse direction, the reverse excess is recorded. In other cases, it is recorded as zero. Thus, the branch power flow violation amount with direction is obtained. Step S4: If there are non-zero elements in the branch power flow violation limits, an iterative correction module for safety correction of generator output is initiated. The iterative correction module performs correction calculations based on the power transfer distribution factor matrix, that is, it performs correction calculations on the PTDF matrix. The PTDF matrix is used to describe the linear sensitivity relationship between node injection power changes and branch power flow changes. The iterative correction module uses the branch power flow violation limits and the PTDF matrix to solve the generator output adjustment amount, corrects the generator output in the initial clearing plan, and re-verifies the safety constraints after each correction until all branch power flows do not exceed the limits or reach the preset maximum number of iterations, thus obtaining a feasible clearing plan. Step S5: Based on the feasible clearing plan and the generator set declaration parameters obtained in Step S1, update the marginal electricity price of each node using the linear sensitivity relationship represented by the PTDF matrix described in Step S4, and output the final clearing result including the feasible clearing plan and the updated node marginal electricity price.
2. The data analysis method for power spot market clearing based on deep learning according to claim 1, characterized in that: The clearing agent model based on graph neural networks constructed in step S2 adopts a graph attention network structure; in the (l+1)th layer, the embedding representation of any node v is obtained through the following process: Set the neighbor nodes of node v The l-th layer embedding representation of each neighbor node u and node v itself. and Each is associated with a learnable weight matrix. Multiplication is used to perform linear feature transformation; Calculate the attention coefficient between node v and each neighbor node u. The attention coefficient reflects the importance of the neighbor node features to node v. Using these attention coefficients as weights, the transformed features of all neighboring nodes and node v itself are summed in a weighted manner to obtain the summation result; Apply a nonlinear activation function to the summation result to obtain the embedding representation of node v in the next layer.
3. The data analysis method for power spot market clearing based on deep learning according to claim 1, characterized in that: When constructing a clearing agent model based on graph neural networks, a loss function is used to measure the deviation between the initial clearing plan output by the model and the actual clearing result. The loss function is constructed in the following way: the initial clearing plan output by the model is compared item by item with the actual clearing result selected from the historical clearing results obtained in step S1, and the mean square error between the two is calculated as the clearing result fitting error term. At the same time, a DC power flow calculation is performed according to the initial clearing plan to obtain the power flow value of each branch. The portion of the absolute value of the power flow that exceeds the upper limit of the branch transmission capacity included in the line parameters obtained in step S1 is taken as the safety constraint violation amount. The safety constraint violation amounts of all branches are summed as the safety constraint penalty item. Finally, the fitting error term is added to a safety constraint penalty term weighted by a preset penalty coefficient to form the total loss used for training.
4. The data analysis method for power spot market clearing based on deep learning according to claim 3, characterized in that: In each iteration, the iterative correction module in step S4 re-solves the system node voltage phase angle and branch active power flow based on the corrected power generation plan obtained in this iteration, and recalculates the PTDF matrix of each power generation node to each branch based on this new operating point, thereby dynamically updating the PTDF matrix for the next iteration; the corrected power generation plan output by the iterative correction module after iterative convergence is the feasible clearing plan.
5. The data analysis method for power spot market clearing based on deep learning according to claim 4, characterized in that: In this iteration of the iterative correction module, the specific process of solving the generator output adjustment amount using the PTDF matrix dynamically updated in this iteration is as follows: the correction objective of eliminating branch power flow violation is constructed as an optimization problem. The objective function of this optimization problem is composed of the weighted sum of squared residuals of power flow violation and the power balance penalty term. The power balance equation constraint is equivalently embedded through the penalty function, so that the problem is transformed into an unconstrained form. By embedding power balance equation constraints equivalently using penalty functions, the optimization problem is transformed into an unconstrained form. Set the gradient of the objective function with respect to the generator output adjustment to zero, and then obtain the generator output adjustment.
6. The data analysis method for power spot market clearing based on deep learning according to claim 5, characterized in that: The process of updating the marginal electricity price of each node in step S5 includes: extracting the Lagrange multipliers obtained from solving the quadratic programming problem in the last iteration of the iterative correction module as the congestion shadow price of each branch. ; Based on the feasible clearing plan and the generator unit declaration parameters obtained in step S1, a DC optimal power flow model is constructed, and the marginal generation cost of the system is obtained by solving the model. ; For any node k in the network, update its marginal electricity price to the system's marginal generation cost. The sum of the congestion cost allocations of each congested branch; the congestion cost allocation of branch l is determined by the shadow price of congestion for that branch. Obtained by multiplying corresponding elements of the PTDF matrix; In the PTDF matrix, the elements of branch l corresponding to node k are: A congested branch refers to a branch where the power flow reaches or exceeds the upper limit of the transmission capacity included in the line parameters obtained in step S1. This calculation is expressed as: ; in, This is the set of all branches where there is a blockage.
7. The data analysis method for power spot market clearing based on deep learning according to claim 6, characterized in that: This also includes, after the final clearing result is adopted and implemented by the electricity spot market, using the grid status on which this market clearing is based, the generator unit declaration parameters obtained in step S1, the node load forecast data obtained in step S1, and the final clearing result confirmed by the actual market execution to form a new labeled training sample. This sample is added to the training dataset and used for online incremental learning of the graph neural network clearing agent model to continuously improve the model's prediction accuracy and adaptability to new operating modes.
8. The data analysis method for power spot market clearing based on deep learning according to claim 7, characterized in that: The node load forecast data and grid topology in step S1 are derived from the ultra-short-term forecast information reported by the real-time electricity market. The method is applied to the intraday rolling clearing or real-time clearing of the electricity spot market to meet the time requirements of rapid clearing calculation.
9. A data analysis device for clearing electricity spot transactions based on deep learning, applied in any one of the methods of claims 1-8, characterized in that: include: The data acquisition module is used to acquire historical clearing data related to the electricity spot market, including grid topology, node load forecast data, generator unit declaration parameters, line parameters and historical clearing results; The clearing agent module is used to construct a clearing agent model based on graph neural networks. It takes the node features of the power grid topology obtained from the data acquisition module as input and outputs an initial clearing plan, which includes the winning output of each generator unit and the marginal electricity price of each node. The safety constraint verification module is used to verify the safety constraints of the initial clearing plan based on the DC power flow model, ignoring line resistance, assuming that the voltage amplitude of each node is 1 per unit, and that the voltage phase angle difference between the two ends of the branch is extremely small and can be approximated as sinθ≈θ. Using the node load prediction data and line parameters obtained by the data acquisition module, the active power flow of each branch is calculated. For any branch, when the active power flow exceeds the upper limit of the transmission capacity included in the line parameters in the forward direction, the forward excess is recorded; when the active power flow exceeds the lower limit of the transmission capacity included in the line parameters in the reverse direction, the reverse excess is recorded; otherwise, it is recorded as zero. Thus, the branch power flow violation amount with direction is obtained. The iterative correction module is used to initiate iterative correction based on the power transfer distribution factor matrix when there are non-zero elements in the branch power flow violation limit. That is, it performs correction calculation on the PTDF matrix, which is used to describe the linear sensitivity relationship between the node injection power change and the branch power flow change. Using the branch power flow violation limit and the PTDF matrix, the generator output adjustment is solved to correct the initial clearing and the planned generator output. After each correction, the safety constraints are re-verified until all branch power flows do not exceed the limit or the preset maximum number of iterations is reached, and a feasible clearing plan is obtained. The electricity price update module is used to update the marginal electricity price of each node based on the feasible clearing plan and the generator set declaration parameters obtained by the data acquisition module, using the power transfer sensitivity relationship represented by the PTDF matrix described in step S4, and output the final clearing result including the feasible clearing plan and the updated node marginal electricity price.
