A power transaction electricity purchase quantity prediction method and device

CN121939368BActive Publication Date: 2026-10-27SICHUAN ELECTRIC POWER TRADING CENT CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202610387138.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-03-27
Publication Date
2026-10-27
Estimated Expiration
2046-03-27

AI Technical Summary

Technical Problem

然而,城市电网外购电量受多重复杂因素影响:一方面,城市内部分布式电源出力、负荷需求的时空波动直接影响电力供需缺口;另一方面,城市电网与外部电网的联络潮流受网络拓扑结构、线路参数及运行状态的物理约束,呈现出显著的网损特性和因果关联性

Benefits of technology

1、本发明通过构建城市电力图来刻画电网的拓扑结构,将发电节点、负荷节点和外部电网节点统一建模,充分考虑了电力系统的物理连接关系。同时,引入因果注意力机制来量化节点间的因果影响程度,使得模型能够识别对预测目标真正重要的信息源。从而提高预测结果的准确性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121939368B_ABST
    Figure CN121939368B_ABST
Patent Text Reader

Abstract

The present application relates to a kind of electric power transaction outsourcing electricity quantity prediction method and equipment, belong to electric power prediction technical field, including the following steps: obtaining node net injection power, outsourcing electricity quantity and line resistance, reactance parameter, constructs net injection power vector and node feature matrix.Based on reactance forms node admittance matrix, active power flow is calculated in combination with power vector;Based on resistance and reactance constructs net loss quadratic form matrix, solves causal influence coefficient vector, and then generates causal attention matrix in combination with active power flow.The matrix and node feature matrix are input into graph convolution network, obtain node causal embedding and converge as graph-level embedding vector.Graph-level embedding vector and outsourcing electricity quantity historical data are input into long short-term memory network, and the next time outsourcing electricity quantity prediction value is output.The present application introduces causal attention mechanism, quantifies the causal influence between nodes, so that the model focuses on key information source, and significantly improves the prediction accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to a method and equipment for predicting purchased electricity in power transactions, belonging to the field of power prediction technology. Background Technology

[0002] With the increasing scale of electricity transactions between urban power grids and external power grids, forecasting of purchased electricity has become a crucial aspect of power system dispatching, operation, and transaction decision-making. However, the purchased electricity volume of urban power grids is affected by multiple complex factors: on the one hand, the spatiotemporal fluctuations in the output of distributed power sources and load demand within the city directly affect the power supply-demand gap; on the other hand, the power flow between urban power grids and external power grids is subject to physical constraints due to network topology, line parameters, and operating status, exhibiting significant network loss characteristics and causal correlations.

[0003] Traditional power generation forecasting methods are mostly based on statistical models or single time series analysis, which are difficult to effectively characterize the inherent physical topology of the power system and the causal influence mechanisms between multiple nodes, resulting in limited forecast accuracy and a lack of interpretability. Therefore, there is an urgent need for a power generation forecasting technology that integrates the physical mechanisms of the power system with deep learning methods to achieve high-precision and interpretable forecasting of purchased power. Summary of the Invention

[0004] To address the problems existing in the prior art, this invention proposes a method and device for predicting purchased electricity in power transactions.

[0005] The technical solution of the present invention is as follows: On the one hand, the present invention provides a method for predicting the amount of electricity purchased in power transactions, comprising the following steps: Identify the internal and external power grid nodes in the city, and construct a city power map based on the internal and external power grid nodes; Obtain the net injected power of internal nodes, the purchased power of external grid nodes, and the reactance and resistance of the circuits between nodes; Construct the net injection power vector and node feature matrix of the city power map based on net injection power and purchased electricity; The nodal admittance matrix of the urban power map is constructed based on reactance, and the active power flow of the urban power map is obtained through the nodal admittance matrix and the net injected power vector. Based on resistance and reactance, an injection spatial network loss quadratic matrix is ​​constructed, and the causal influence coefficient vector of the urban power map is obtained through the injection spatial network loss quadratic matrix; The causal attention matrix of the urban power map is obtained based on the causal influence coefficient vector and active power flow. The causal attention matrix and node feature matrix are used as inputs to the GCN model, the node causal embedding matrix is ​​output, and the graph-level embedding vector is obtained through the node causal embedding matrix. The graph-level embedding vector and the purchased electricity volume are used as inputs to the LSTM model, and the output is the predicted value of the purchased electricity volume at the next time step.

[0006] Preferably, the internal nodes include power generation nodes and load nodes; Obtain the active power output of the power generation nodes and the active power demand of the load nodes, and obtain the net injected power of the internal nodes based on the active power output and active power demand.

[0007] Preferably, the nodal admittance matrix of the urban power map is constructed based on reactance, and the specific steps are as follows: Obtain the adjacency matrix of the city's power grid; Determine the elements of the adjacency matrix; if they are 0, set the node admittance at the corresponding row and column index in the node admittance matrix to 0. If the value is 1, then the nodal admittance is obtained based on the row and column indices of the nodal admittance matrix, specifically: Regarding the nodal admittance matrix The nodal admittance of the diagonal of the non-central region is expressed by the formula: ; In the formula, Represents the first node in the admittance matrix. Line 1 Column nodal admittance, Indicates the first The node and the first The reactance of the circuit between nodes; Regarding the nodal admittance matrix The nodal admittance of the middiagonal is expressed by the formula: ; In the formula, Represents the first node in the admittance matrix. Line 1 The node admittance of the column.

[0008] Preferably, the active power flow of the urban power map is obtained through the nodal admittance matrix and the net injected power vector. The specific steps are as follows: Extracting the node admittance submatrix containing only internal nodes from the node admittance matrix. ; Extract the net injection vector of internal nodes that contains only internal nodes from the net injected power vector; The phase angle vector of the internal node is obtained based on the nodal admittance submatrix and the net injection vector of the internal node, expressed by the formula: ; In the formula, Indicates in The phase angle vector of the internal nodes at time t, Indicates in Net injection vector of internal nodes at time t; The node phase angle vector is obtained based on the internal node phase angle vector, expressed by the formula: ; In the formula, Indicates in The phase angle vector at time t, Represents the nodal phase angle vector transpose, Representing vectors transpose; The active power flow of the urban power map is obtained based on the nodal phase angle vector and reactance, and is expressed by the formula: ; In the formula, Indicates the first The node and the first Each node The ever-present trend of merit, Represents the nodal phase angle vector The Middle One in Voltage phase angle at time , Represents the nodal phase angle vector The Middle One in Voltage phase angle at time , Indicates the first The node and the first The reactance of the circuit between nodes.

[0009] Preferably, the causal influence coefficient vector of the urban power map is obtained by injecting a spatial network loss quadratic matrix. The specific steps are as follows: The phase angle spatial network loss quadratic matrix of the internal nodes is constructed based on resistance and reactance, and is expressed by the formula: ; In the formula, Represents the phase angle space network loss quadratic form matrix. Indicates the first The internal node and the first The resistance of the circuit between internal nodes, Indicates the first Standard basis vectors Indicates the first Standard basis vectors Indicates the external power grid node and the first The resistance of the circuit between internal nodes, Indicates the external power grid node and the first Reactance of the lines between internal nodes, This represents the set of edges between internal nodes. This represents the set of edges between internal nodes and external power grid nodes; The injection space loss quadratic form matrix of internal nodes is constructed based on the phase angle spatial network loss quadratic form matrix and the node admittance submatrix, and is expressed by the formula: ; In the formula, Represents the quadratic form matrix of the injection space network loss; The causal influence coefficient vector of internal nodes is obtained based on the quadratic form matrix of the injection space network loss and the net injection vector of internal nodes, expressed by the formula: ; In the formula, Indicates that the internal node is The vector of causal influence coefficients at time points. Represents a preset vector; Define the causal influence coefficient of external power grid nodes. Based on the causal influence coefficients of external power grid nodes and the causal influence coefficient vectors of internal nodes, obtain the causal influence coefficient vector of the urban power map, expressed by the formula: ; In the formula, Indicates the city's power map The vector of causal influence coefficients at time points. Indicates that the external power grid node is Causal influence coefficient at time point This indicates a splicing operation.

[0010] Preferably, the causal attention matrix of the urban power map is obtained based on the causal influence coefficient vector and active power flow. The specific steps are as follows: The causal attention coefficient is obtained based on the causal influence coefficient vector and active power flow, expressed by the formula: ; In the formula, Indicates the first The node and the first Each node Causal attention coefficient at any given moment express Activation function Represents the learnable parameter vector transpose, Vector of causal influence coefficients The Middle One in Causal influence coefficient at time point Vector of causal influence coefficients The Middle One in Causal influence coefficient at time point Vector of causal influence coefficients The Middle One in Causal influence coefficient at time point Indicates the first The node and the first Each node The ever-present trend of merit, Indicates the relationship with the first A set of nodes for which edges exist; A causal attention matrix is ​​constructed based on causal attention coefficients, expressed by the formula: ; In the formula, Representing the causal attention matrix The Middle Line 1 Listed Causal attention at every moment.

[0011] Preferably, the causal attention matrix and node feature matrix are used as inputs to the GCN model. The specific steps are as follows: The adjacency matrix is ​​normalized to obtain a normalized adjacency matrix; The causal adjacency matrix is ​​constructed based on the normalized adjacency matrix and the causal attention matrix, and is expressed by the following formula: ; In the formula, Indicates in The causal adjacency matrix at time step, This represents element-wise multiplication. Represents the normalized adjacency matrix; The causal adjacency matrix and node feature matrix are used as inputs to the GCN model, and the output is a node causal embedding matrix. The GCN model adopts a two-layer graph convolution structure, and the first layer of graph convolution is expressed by the formula: ; In the formula, This indicates that the first layer of graph convolution in the GCN model is... Output at any moment express Activation function This represents the weight matrix of the first layer of graph convolution in the GCN model. Indicates in The node feature matrix at time step; The second-layer graph convolution is expressed by the formula: ; In the formula, Indicates in The causal embedding matrix of nodes at time step, This represents the weight matrix of the second layer graph convolution in the GCN model.

[0012] Preferably, the graph-level embedding vector is obtained through the node causal embedding matrix, and the specific steps are as follows: The internal graph-level embedding vector is obtained based on the node causal embedding vector of the internal nodes in the node causal embedding matrix, expressed by the formula: ; In the formula, Indicates in The internal graph-level embedding vector at time step, Represents the causal embedding matrix of nodes The Middle One in The causal embedding vector of the node at time step, Indicates a preset constant. Indicates the number of internal nodes; The external graph-level embedding vector is obtained based on the node causal embedding vector of the external power grid node in the node causal embedding matrix, expressed by the formula: ; In the formula, Indicates in The external graph-level embedding vector at time step 1. Represents the causal embedding matrix of nodes External power grid nodes in The causal embedding vector of the node at time step; The inner graph-level embedding vector and the outer graph-level embedding vector are concatenated to obtain the graph-level embedding vector, which can be expressed by the formula: ; In the formula, Indicates in The graph-level embedding vector at time step.

[0013] Preferably, the graph-level embedding vector and the purchased electricity volume are used as inputs to the LSTM model. The specific steps are as follows: A combined feature vector is constructed based on graph-level embedding vectors and purchased electricity, expressed by the formula: ; In the formula, Indicates in The combined feature vector at time step, Indicates in The time feature vector at time step 1. Indicates that the external power grid node is Purchased electricity at any time; The combined feature vector is used as the input to the LSTM model, and the output is the hidden state, expressed by the formula: ; In the formula, Indicates in The hidden state at all times Represents the hyperbolic tangent function. Indicates the output gate is in Output at any moment Indicates in Cellular state at any given moment; Based on the hidden state, a fully connected layer is used to obtain the predicted value of the purchased electricity at the next time step, expressed by the formula: ; In the formula, This represents the predicted value of purchased electricity at the next moment. This represents the weight matrix of the fully connected layer. This represents the bias vector of the fully connected layer.

[0014] In another aspect, the present invention also provides an electronic device having a computer program stored thereon, which, when executed by a processor, implements the method for predicting purchased electricity in power trading as described in any embodiment of the present invention.

[0015] The present invention has the following beneficial effects: 1. This invention characterizes the topology of the power grid by constructing an urban power map, unifying the modeling of generation nodes, load nodes, and external grid nodes, and fully considering the physical connections of the power system. Simultaneously, a causal attention mechanism is introduced to quantify the degree of causal influence between nodes, enabling the model to identify information sources that are truly important to the prediction target. This improves the accuracy of the prediction results.

[0016] 2. This invention employs graph convolutional networks to process urban power grid data, enabling it to learn high-order neighborhood features of nodes. By combining causal attention matrices and adjacency matrices, the model can adaptively adjust the weights of information transmission between different nodes, highlighting the influence of key nodes. This dynamic feature extraction mechanism allows the model to adapt to changes in the power grid's operating state, promptly reflecting load fluctuations, power output changes, and network topology adjustments in its feature representation.

[0017] 3. This invention introduces a Long Short-Term Memory (LSTM) network after the graph neural network to specifically handle the time dependence in the prediction of purchased electricity. By storing historical state information through memory units, the model can capture the long-term trend and periodicity of purchased electricity. Simultaneously, by combining the graph-level embedding vector with the temporal feature vector as input, spatial and temporal features work synergistically in the prediction, taking into account the real-time operating status and evolution trend of the power grid.

[0018] 4. This invention embeds explicit physical calculation processes into a deep learning framework, including steps such as constructing the node admittance matrix based on reactance, calculating active power flow, and constructing a quadratic network loss matrix. These physical quantity calculation processes conform to the operating mechanism of the power system, giving the model's prediction results a clear physical meaning. Attached Figure Description

[0019] Figure 1 This is a flowchart illustrating the implementation of the method in an embodiment of the present invention. Detailed Implementation

[0020] 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.

[0021] It should be understood that the step numbers used in the text are for ease of description only and are not intended to limit the order in which the steps are performed.

[0022] It should be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the invention. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.

[0023] The terms “comprising” and “including” indicate the presence of the described feature, whole, step, operation, element and / or component, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or collections thereof.

[0024] The term “and / or” refers to any combination of one or more of the associated listed items, as well as all possible combinations, and includes these combinations.

[0025] Example 1: See Figure 1 This embodiment provides a method for predicting the amount of electricity purchased in power transactions, including the following steps: S1. Power generation nodes are defined as power supply equipment that injects active power into the grid, such as thermal power plants, gas turbines, wind power plants, and photovoltaic power stations in the city. Load nodes are defined as electricity users that consume active power, such as industrial load users, commercial load users, and residential users in the city.

[0026] In this system, power generation nodes and load nodes are considered as internal nodes, while an external power grid node is set up. The external power grid node is a virtual node used to represent the connection point between the urban power grid and the external power grid, that is, the urban power grid purchases electricity from the external power grid through the external power grid node.

[0027] Identify the power generation nodes and load nodes in the city, and construct a city power graph based on these nodes and external power grid nodes. Construct edges using circuit connections and obtain the adjacency matrix of the city power graph.

[0028] S2. Obtain the active power output of the power generation nodes, the active power demand of the load nodes, the purchased electricity of the external grid nodes, and the reactance and resistance of the circuits between the nodes in the urban power map. Based on the active power output, active power demand, and purchased electricity, construct the net injected power vector and node feature matrix of the urban power map. The specific steps are as follows: S201. The net injected power of internal nodes is obtained based on the active power output of generation nodes and the active power demand of load nodes, expressed by the formula: ; In the formula, Indicates the first Internal nodes Net injection power at time, Indicates the first Internal nodes Contributing effort at all times, Indicates the first Internal nodes The active power demand at any given time is set to 0 if the internal node is a generating node, and 0 if the internal node is a load node. S202. Based on the net injected power and purchased electricity, construct the net injected power vector of the city's power map, expressed by the formula: ; In the formula, Indicates the city's power map The net injected power vector at time t. Indicates that the external power grid node is Purchased electricity at all times Indicates the number of internal nodes. Representing vectors transpose; S203. Construct a node feature matrix for the city's power map based on the net injected power and purchased electricity, expressed by the formula: ; ; In the formula, Indicates in The node feature matrix at time step 1. Indicates the first Each node The feature vector at time step, Indicates that the external power grid node is The feature vector at time step, i.e. , Represents the set of internal nodes.

[0029] In this embodiment, the default index of the external power grid node is... Therefore, the subscript is Time indicates an external power grid node, with the subscript being non-standard. Positive integers represent internal nodes.

[0030] S3. Normalize the adjacency matrix to obtain the normalized adjacency matrix, expressed by the formula: ; Converting the above formula to an element-level expression, it can be represented as follows: ; In the formula, Represents the normalized adjacency matrix. Degree matrix, Represents the adjacency matrix. Represents the th element in the normalized adjacency matrix. Line 1 Column elements, Represents the adjacency matrix of the nth element. Line 1 Column elements, The degree matrix represents the first Line 1 Column elements, The degree matrix represents the first Line 1 Column elements; The degree matrix is ​​expressed by the formula: ; The main purpose of normalizing the adjacency matrix is ​​to balance the influence of different node degrees in a graph convolutional network (GCN), preventing high-degree nodes from dominating feature updates during aggregation, while maintaining numerical stability. Normalization ensures that the contribution of each node's neighbors is inversely proportional to the node's degree during feature aggregation, thus preventing high-degree nodes from having an excessive impact and mitigating the vanishing or exploding gradient problem.

[0031] S4. Construct the node admittance matrix of the urban power graph based on the adjacency matrix and reactance. The specific steps are as follows: Determine the elements of the adjacency matrix. If they are 0, it means there is no edge between the two nodes. Further, set the node admittance of the corresponding row and column index in the node admittance matrix to 0. If the value is 1, it indicates that there is an edge between the two nodes. Further, based on the reactance, the node admittance is obtained from the corresponding row and column indices in the node admittance matrix, specifically as follows: Regarding the nodal admittance matrix The nodal admittance of the diagonal of the Central African Republic ( ), expressed as a formula: ; In the formula, Represents the first node in the admittance matrix. Line 1 Column nodal admittance, Indicates the first The node and the first The reactance of the circuit between nodes; Regarding the nodal admittance matrix Mid-diagonal nodal admittance ( ), expressed as a formula: ; In the formula, Represents the first node in the admittance matrix. Line 1 The node admittance of the column.

[0032] In this adjacency matrix, the diagonal elements are 0, and the off-diagonal elements are either 0 or 1. If two nodes are connected by a circuit, the value is 1; otherwise, it is 0.

[0033] This embodiment employs the DC power flow assumption to construct a DC power flow model, simplifying the AC power grid into a linear model to obtain active power flow. The DC power flow assumptions include: The line resistance is much smaller than the reactance, so the effect of resistance on active power flow can be ignored.

[0034] The per-unit value of the voltage amplitude at all nodes is 1.

[0035] The phase angle difference between the nodes is very small, making .

[0036] S5. Obtain the active power flow of the urban power map based on the node admittance matrix and net injected power vector. The specific steps are as follows: S501. Extract the node admittance submatrix containing only internal nodes from the node admittance matrix. ; S502. Extract the net injection vector of internal nodes containing only internal nodes from the net injected power vector, expressed by the formula: ; In the formula, Indicates in Net injection vector of internal nodes at time t; S503. Based on the node admittance submatrix and the net injection vector of the internal nodes, obtain the phase angle vector of the internal nodes, expressed by the formula: ; In the formula, Indicates in The phase angle vector of the internal nodes at time t; S504. Obtain the node phase angle vector based on the internal node phase angle vector, expressed by the formula: ; In the formula, Indicates in The phase angle vector at time t, Represents the nodal phase angle vector transpose, Representing vectors transpose; In power flow calculations, a node must be selected as a voltage phase angle reference point because power is only related to the phase angle difference, and the absolute phase angle itself has no physical meaning. In this embodiment, the external grid node is set as the reference node, and its phase angle is fixed at 0, which is equivalent to defining the origin of the phase angle coordinates of the entire system at the external grid node.

[0037] S505. Active power flow in urban power maps is obtained based on node phase angle vectors and reactance, expressed by the formula: ; In the formula, Indicates the first The node and the first Each node The ever-present trend of merit, Represents the nodal phase angle vector The Middle One in Voltage phase angle at time , Represents the nodal phase angle vector The Middle One in The voltage phase angle at a given moment.

[0038] S6. Construct a quadratic form matrix of phase angle spatial network loss for internal nodes based on the resistance and reactance. Obtain the causal influence coefficient vector of the urban power map through the quadratic form matrix of phase angle spatial network loss, the node admittance sub-matrix, and the net injection vector of internal nodes. The specific steps are as follows: S601. Based on the aforementioned resistance and reactance, construct the phase angle spatial network loss quadratic matrix of the internal nodes, expressed by the formula: ; In the formula, Represents the phase angle space network loss quadratic form matrix. Indicates the first The internal node and the first The resistance of the circuit between internal nodes, Indicates the first There are standard basis vectors, standard basis vectors The Middle One element is 1 and the rest are 0. Indicates the first Standard basis vectors Indicates the external power grid node and the first The resistance of the circuit between internal nodes, Indicates the external power grid node and the first Reactance of the lines between internal nodes, This represents the set of edges between internal nodes. This represents the set of edges between internal nodes and external power grid nodes; S602. Construct the injection space loss quadratic matrix based on the phase angle spatial network loss quadratic matrix and the node admittance submatrix, expressed by the formula: ; In the formula, Represents the quadratic form matrix of the injection space network loss; S603. Obtain the causal influence coefficient vector based on the quadratic matrix of the injection space network loss and the net injection vector of the internal nodes, expressed by the formula: ; In the formula, Indicates that the internal node is The vector of causal influence coefficients at time points. This represents a preset vector, where all elements are 1; S604. Define the causal influence coefficient of external power grid nodes as 0. Based on the causal influence coefficients of external power grid nodes and the causal influence coefficient vectors of internal nodes, obtain the causal influence coefficient vector of the urban power map, expressed by the formula: ; In the formula, Indicates the city's power map The vector of causal influence coefficients at time points. Indicates that the external power grid node is Causal influence coefficient at time point This indicates a splicing operation.

[0039] S7. Obtain the causal attention matrix of the urban power map based on the causal influence coefficient vector and active power flow. The specific steps are as follows: S701. Based on the causal influence coefficient vector of the urban power map and the active power flow, the causal attention coefficient is obtained, expressed by the formula: ; In the formula, Indicates the first The node and the first Each node Causal attention coefficient at any given moment express Activation function Represents the learnable parameter vector transpose, Vector of causal influence coefficients The Middle One in Causal influence coefficient at time point Vector of causal influence coefficients The Middle One in Causal influence coefficient at time point Vector of causal influence coefficients The Middle One in Causal influence coefficient at time point Indicates the first The node and the first Each node The ever-present trend of merit, Indicates the relationship with the first A set of nodes for which edges exist; S702. Construct a causal attention matrix based on causal attention coefficients, expressed by the formula: ; In the formula, Representing the causal attention matrix The Middle Line 1 Listed Causal attention at every moment.

[0040] S8. Construct a causal adjacency matrix based on the normalized adjacency matrix and the causal attention matrix. Use the causal adjacency matrix and the node feature matrix as input to the GCN model, and output the node causal embedding matrix. The specific steps are as follows: S801. Construct a causal adjacency matrix based on the normalized adjacency matrix and the causal attention matrix, expressed by the formula: ; In the formula, Indicates in The causal adjacency matrix at time step, This represents element-wise multiplication; S802. The causal adjacency matrix and node feature matrix are used as inputs to the GCN model, and the output is the node causal embedding matrix. The GCN model adopts a two-layer graph convolution structure. The first layer of graph convolution is expressed by the formula: ; In the formula, This indicates that the first layer of graph convolution in the GCN model is... Output at any moment express Activation function This represents the weight matrix of the first layer of graph convolution in the GCN model; The second-layer graph convolution is expressed by the formula: ; In the formula, Indicates in The causal embedding matrix of nodes at time step, This represents the weight matrix of the second layer graph convolution in the GCN model.

[0041] S9. Obtain the graph-level embedding vector based on the node causal embedding matrix. The specific steps are as follows: S901. Obtain the internal graph-level embedding vector based on the node causal embedding vector of the internal nodes in the node causal embedding matrix, expressed by the formula: ; In the formula, Indicates in The internal graph-level embedding vector at time step, Represents the causal embedding matrix of nodes The Middle One in The causal embedding vector of the node at time step, This represents a preset constant used to prevent the denominator from being zero; S902. Obtain the external graph-level embedding vector based on the node causal embedding vector of the external power grid node in the node causal embedding matrix, expressed by the formula: ; In the formula, Indicates in The external graph-level embedding vector at time step 1. Represents the causal embedding matrix of nodes External power grid nodes in The causal embedding vector of the node at time step; S903. Concatenate the inner graph-level embedding vector and the outer graph-level embedding vector to obtain the graph-level embedding vector, expressed by the formula: ; In the formula, Indicates in The graph-level embedding vector at time step.

[0042] S10. Using the graph-level embedding vector and the purchased electricity amount as input to the LSTM model, the predicted purchased electricity amount for the next time step is output. The specific steps are as follows: S1001. Construct a combined feature vector based on graph-level embedding vectors and purchased electricity, expressed by the formula: ; In the formula, Indicates in The combined feature vector at time step, Indicates in The time feature vector includes a holiday / holiday flag (1 if it is a holiday, 0 otherwise), a month flag (value 1-12), a day of the week flag (value 1-7), and an hour flag (value 0-23). (Which hour of the day does the time belong to?) S1002. Use the combined feature vector as the input to the LSTM model; The input gate of the LSTM model is expressed by the formula: ; In the formula, Indicates the input gate is in Output at any moment This represents the Sigmoid activation function. This represents the weight matrix of the input gate. This represents the cyclic weight matrix of the input gate. Indicates in The hidden state at all times This represents the bias vector of the input gate; The forget gate in the LSTM model is expressed by the formula: ; In the formula, Indicates the forgetting gate is Output at any moment The weight matrix represents the forget gate. This represents the circular weight matrix of the forget gate. The bias vector representing the forget gate; The output gate of the LSTM model is expressed by the formula: ; In the formula, Indicates the output gate is in Output at any moment This represents the weight matrix of the output gate. This represents the cyclic weight matrix of the output gate. This represents the bias vector of the output gate; The candidate cell states of the LSTM model are expressed by the following formula: ; In the formula, Indicates in The state of candidate cells at any given time. The weight matrix representing the candidate cell state. Represents the hyperbolic tangent function. The cyclic weight matrix representing the candidate cell state. A bias vector representing the state of a candidate cell; The cell state of the LSTM model is expressed by the formula: ; In the formula, Indicates in Cellular state at any given moment Indicates in Cellular state at any given moment; The hidden states output by the LSTM model are expressed by the formula: ; In the formula, Indicates in The hidden state at any given moment; S1003. Based on the hidden state, a fully connected layer is used to obtain the predicted value of the purchased electricity at the next moment, expressed by the formula: ; In the formula, This represents the predicted value of purchased electricity at the next moment. This represents the weight matrix of the fully connected layer. This represents the bias vector of the fully connected layer.

[0043] Example 2: This embodiment provides an electronic device that stores a computer program, which, when executed by a processor, implements the method for predicting purchased electricity in power transactions as described in any embodiment of the present invention.

[0044] Those skilled in the art will recognize that the units and algorithm steps described in the embodiments disclosed herein can be implemented using electronic hardware, computer software, or a combination of electronic hardware and software. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0045] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0046] In the several embodiments provided in this application, any function, if implemented as a software functional unit and sold or used as an independent product, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0047] The above description is merely an embodiment of the present invention and does not limit the patent scope of the present invention. Any equivalent structural or procedural transformations made based on the content of the present invention's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of the present invention.

Claims

1. A method for predicting the amount of electricity purchased in power transactions, characterized in that, Includes the following steps: Identify the internal and external power grid nodes in the city, and construct a city power map based on the internal and external power grid nodes; Obtain the net injected power of internal nodes, the purchased power of external grid nodes, and the reactance and resistance of the circuits between nodes; Construct the net injection power vector and node feature matrix of the city power map based on net injection power and purchased electricity; The nodal admittance matrix of the urban power map is constructed based on reactance, and the active power flow of the urban power map is obtained through the nodal admittance matrix and the net injected power vector. Based on resistance and reactance, an injection spatial network loss quadratic matrix is ​​constructed, and the causal influence coefficient vector of the urban power map is obtained through the injection spatial network loss quadratic matrix; The causal attention matrix of the urban power map is obtained based on the causal influence coefficient vector and active power flow. The causal attention matrix and node feature matrix are used as inputs to the GCN model, the node causal embedding matrix is ​​output, and the graph-level embedding vector is obtained through the node causal embedding matrix. The graph-level embedding vector and the purchased electricity volume are used as inputs to the LSTM model, and the output is the predicted value of the purchased electricity volume at the next time step.

2. The method for predicting purchased electricity in power transactions according to claim 1, characterized in that, The internal nodes include power generation nodes and load nodes; Obtain the active power output of the power generation nodes and the active power demand of the load nodes, and obtain the net injected power of the internal nodes based on the active power output and active power demand.

3. The method for predicting purchased electricity in power transactions according to claim 1, characterized in that, The nodal admittance matrix of the urban power map is constructed based on reactance. The specific steps are as follows: Obtain the adjacency matrix of the city's power grid; Determine the elements of the adjacency matrix; if they are 0, set the node admittance at the corresponding row and column index in the node admittance matrix to 0. If the value is 1, then the nodal admittance is obtained based on the row and column indices of the nodal admittance matrix, specifically: Regarding the nodal admittance matrix The nodal admittance of the diagonal of the non-central region is expressed by the formula: ; In the formula, Represents the th node in the admittance matrix Line 1 Column nodal admittance, Indicates the first The node and the first The reactance of the circuit between nodes; Regarding the nodal admittance matrix The nodal admittance of the middiagonal is expressed by the formula: ; In the formula, Represents the th node in the admittance matrix Line 1 The node admittance of the column.

4. The method for predicting purchased electricity in power transactions according to claim 1, characterized in that, The active power flow of the city's power map is obtained through the nodal admittance matrix and the net injected power vector. The specific steps are as follows: Extracting the node admittance submatrix containing only internal nodes from the node admittance matrix. ; Extract the net injection vector of internal nodes that contains only internal nodes from the net injected power vector; The phase angle vector of the internal node is obtained based on the nodal admittance submatrix and the net injection vector of the internal node, expressed by the formula: ; In the formula, Indicates in The phase angle vector of the internal nodes at time t, Indicates in Net injection vector of internal nodes at time t; The node phase angle vector is obtained based on the internal node phase angle vector, expressed by the formula: ; In the formula, Indicates in The node phase angle vector at time t, Represents the phase angle vector of the nodes transpose, Representing vectors Transpose of; The active power flow of the urban power map is obtained based on the nodal phase angle vector and reactance, and is expressed by the formula: ; In the formula, Indicates the first The node and the first Each node The ever-present trend of merit, Represents the phase angle vector of the nodes The Middle One in Voltage phase angle at time t, Represents the phase angle vector of the nodes The Middle One in Voltage phase angle at time t, Indicates the first The node and the first The reactance of the circuit between nodes.

5. The method for predicting purchased electricity in power transactions according to claim 4, characterized in that, The causal influence coefficient vector of the urban power map is obtained by injecting a spatial network loss quadratic matrix. The specific steps are as follows: The phase angle spatial network loss quadratic matrix of the internal nodes is constructed based on resistance and reactance, and is expressed by the formula: ; In the formula, Represents the phase angle spatial network loss quadratic form matrix. Indicates the first The internal node and the first The resistance of the circuit between internal nodes, Indicates the first Standard basis vectors Indicates the first Standard basis vectors Indicates the external power grid node and the first The resistance of the circuit between internal nodes, Indicates the external power grid node and the first Reactance of the lines between internal nodes, This represents the set of edges between internal nodes. This represents the set of edges between internal nodes and external power grid nodes; The injection space loss quadratic form matrix of internal nodes is constructed based on the phase angle spatial network loss quadratic form matrix and the node admittance submatrix, and is expressed by the formula: ; In the formula, Represents the quadratic form matrix of the injection space network loss; The causal influence coefficient vector of internal nodes is obtained based on the quadratic form matrix of the injection space network loss and the net injection vector of internal nodes, expressed by the formula: ; In the formula, Indicates that the internal node is The vector of causal influence coefficients at time points. Represents a preset vector; Define the causal influence coefficient of external power grid nodes. Based on the causal influence coefficients of external power grid nodes and the causal influence coefficient vectors of internal nodes, obtain the causal influence coefficient vector of the urban power map, expressed by the formula: ; In the formula, Indicates the city's power map The vector of causal influence coefficients at time points. Indicates that the external power grid node is Causal influence coefficient at time point This indicates a splicing operation.

6. The method for predicting purchased electricity in power transactions according to claim 5, characterized in that, The causal attention matrix of the urban power map is obtained based on the causal influence coefficient vector and active power flow. The specific steps are as follows: The causal attention coefficient is obtained based on the causal influence coefficient vector and active power flow, expressed by the formula: ; In the formula, Indicates the first The node and the first Each node Causal attention coefficient at any given moment express Activation function Represents the learnable parameter vector transpose, Vector representing causal influence coefficients The Middle One in Causal influence coefficient at time point Vector representing causal influence coefficients The Middle One in Causal influence coefficient at time point Vector representing causal influence coefficients The Middle One in Causal influence coefficient at time point Indicates the first The node and the first Each node The ever-present trend of merit, Indicates the relationship with the first A set of nodes for which edges exist; A causal attention matrix is ​​constructed based on causal attention coefficients, expressed by the formula: ; In the formula, Representing the causal attention matrix The Middle Line 1 Listed Causal attention at every moment.

7. The method for predicting purchased electricity in power transactions according to claim 6, characterized in that, The causal attention matrix and node feature matrix are used as inputs to the GCN model. The specific steps are as follows: The adjacency matrix is ​​normalized to obtain a normalized adjacency matrix; The causal adjacency matrix is ​​constructed based on the normalized adjacency matrix and the causal attention matrix, and is expressed by the following formula: ; In the formula, Indicates in The causal adjacency matrix at time step, This represents element-wise multiplication. Represents the normalized adjacency matrix; The causal adjacency matrix and node feature matrix are used as inputs to the GCN model, and the output is a node causal embedding matrix. The GCN model adopts a two-layer graph convolution structure, and the first layer of graph convolution is expressed by the formula: ; In the formula, This indicates that the first layer of graph convolution in the GCN model is... Output at any moment express Activation function This represents the weight matrix of the first layer of graph convolution in the GCN model. Indicates in The node feature matrix at time step; The second-layer graph convolution is expressed by the formula: ; In the formula, Indicates in The causal embedding matrix of nodes at time step, This represents the weight matrix of the second layer graph convolution in the GCN model.

8. The method for predicting purchased electricity in power transactions according to claim 7, characterized in that, The specific steps for obtaining graph-level embedding vectors using the node causal embedding matrix are as follows: The internal graph-level embedding vector is obtained based on the node causal embedding vector of the internal nodes in the node causal embedding matrix, expressed by the formula: ; In the formula, Indicates in The internal graph-level embedding vector at time step, Represents the causal embedding matrix of nodes The Middle One in The causal embedding vector of the node at time step, Indicates a preset constant. Indicates the number of internal nodes; The external graph-level embedding vector is obtained based on the node causal embedding vector of the external power grid node in the node causal embedding matrix, expressed by the formula: ; In the formula, Indicates in The external graph-level embedding vector at time step 1. Represents the causal embedding matrix of nodes External power grid nodes in The causal embedding vector of the node at time step; The inner graph-level embedding vector and the outer graph-level embedding vector are concatenated to obtain the graph-level embedding vector, which can be expressed by the formula: ; In the formula, Indicates in The graph-level embedding vector at time step.

9. The method for predicting purchased electricity in power transactions according to claim 8, characterized in that, Using the graph-level embedding vector and purchased electricity as input to the LSTM model, the specific steps are as follows: A combined feature vector is constructed based on graph-level embedding vectors and purchased electricity, expressed by the formula: ; In the formula, Indicates in The combined feature vector at time step, Indicates in The time feature vector at time step 1. Indicates that the external power grid node is Purchased electricity at any time; The combined feature vector is used as the input to the LSTM model, and the output is the hidden state, expressed by the formula: ; In the formula, Indicates in The hidden state at all times Represents the hyperbolic tangent function. Indicates the output gate is in Output at any moment Indicates in Cellular state at any given moment; Based on the hidden state, a fully connected layer is used to obtain the predicted value of the purchased electricity at the next time step, expressed by the formula: ; In the formula, This represents the predicted value of purchased electricity at the next moment. This represents the weight matrix of the fully connected layer. This represents the bias vector of the fully connected layer.

10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the method for predicting purchased electricity in power transactions as described in any one of claims 1 to 9.

Citation Information

Patent Citations

  • Distributed energy output high-precision prediction model

    CN121546563A

  • Machine learning architectures with sub-quadratic iterator modules

    US12265913B1