Multi-period optimal power flow rapid calculation method based on multi-task Transform
Based on the multi -task transformer's fast calculation method, the optimal trend problem of the multi -time period is decomposed into a child task, which solves the problem of solving difficulty and high calculation complexity in existing technologies. Energy and energy storage scenarios.
Patent Information
- Application Number
- CN202411362251.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-27
- Publication Date
- 2025-01-28
AI Technical Summary
The existing multi-time optimal trend solution methods have problems such as difficult to solve and high computational complexity, especially in large-scale problems including new energy and energy storage.
Adopt a multi -task transformer with a fast calculation method to decompose the solution problem of the optimal trend model into multiple sub -tasks, and solve it through multi -tasking transformer neural network. Learning with features.
It has significantly improved the calculation speed, simplifies the complexity of the problem, and is suitable for the participation of new energy and energy storage, and realizes the rapid computing and analysis of the optimal trend of the power system in multiple periods of time.
Smart Images

Figure CN119382140A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of power system operation cost calculation, and in particular to a multi-period optimal power flow fast calculation method based on a multi-task Transformer. Background Art
[0002] In the context of the current energy structure transformation and the increasing complexity of the power system, power flow optimization considering multiple time dimensions is helpful to improve the operating efficiency, dynamic response capability and economic operating cost of the power system. At the same time, multi-period optimal power flow analysis provides key technical support for the optimal operation of the power system and lays a solid foundation for building a sustainable and efficient new power system. However, as an extension of the optimal power flow, the multi-period optimal power flow is a large-scale, nonlinear mixed integer optimization problem. The scale of the problem will expand rapidly with the increase of the optimization time span, resulting in a sharp increase in the amount of calculation. Solving such problems requires efficient and powerful algorithms.
[0003] Existing methods for solving multi-period optimal power flow can generally be divided into two categories: 1) Model-driven methods: mathematically model the multi-period optimal power flow problem, and then use linear programming, nonlinear programming and other methods to directly solve the original problem. However, this type of method requires multiple iterative solutions, and the calculation time increases significantly with the increase in system scale. In linear programming, linearization is performed through nonlinear constraints, such as converting a nonlinear AC optimal power flow problem into a linear DC optimal power flow problem. Although the solution efficiency has been improved, the solution accuracy and quality cannot be fully guaranteed. 2) Data-driven methods: Utilizing the powerful nonlinear fitting ability of neural networks, by fitting the mapping relationship between input and output in historical data, the dependence on the mathematical model of multi-period optimal power flow is effectively reduced and the calculation efficiency is improved. Although the existing data-driven methods have high solution efficiency, they require a large amount of historical data as support. At the same time, the results obtained by the neural network do not meet the physical constraints, resulting in certain limitations. Summary of the invention
[0004] The purpose of the present invention is to provide a multi-period optimal power flow fast calculation method based on a multi-task Transformer, comprising the following steps:
[0005] 1) Obtain technical data of power system;
[0006] 2) Taking minimizing the operating cost as the objective function, a multi-period optimal power flow model considering conventional generators, new energy generators and energy storage equipment is constructed;
[0007] 3) Build a multi-task Transformer neural network;
[0008] 4) Using a multi-task Transformer neural network, the problem of solving the multi-period optimal power flow model is decomposed into multiple subtasks;
[0009] 5) Taking the power of new energy access to the power system and the load power as input, the optimal operation decision variables of the power system are solved, and then checked and corrected.
[0010] Furthermore, the power system technical data includes the power system network structure and power flow parameters.
[0011] Furthermore, the objective function of the multi-period optimal power flow model is as follows:
[0012]
[0013] Where N G It is a collection of conventional generator sets in the power system; C g (·) is the operating cost function of conventional generator sets in the power system; P g,t is the active power output of the generator; T is the dispatching period of the power system; N e It is a collection of energy storage devices in the power system; C e (·) is the operating cost function of the energy storage device; P ch,t is the charging power of the energy storage device; P dis,t is the discharge power of the energy storage device.
[0014] Furthermore, the constraints of the multi-period optimal power flow model include AC node power balance constraints, node voltage upper and lower limit constraints, conventional generator capacity constraints, new energy unit capacity constraints, conventional unit ramp rate constraints, energy storage equipment capacity constraints, energy storage charging and discharging power constraints, energy storage charge state change constraints, and line capacity constraints.
[0015] Furthermore, the AC node power balance constraint is as follows:
[0016]
[0017] Where P g,i,t and Q g,i,t are respectively the active and reactive power output by the conventional generator at AC node i at time t; P v,i,t and P w,i,t are the active power of wind power and photovoltaic units connected to the system at AC node i at time t; P ch,i,t and P dis,i,t are the charging power and discharging power of the energy storage device connected to the system at AC node i at time t; P d,i,t and Q d,i,tare the active and reactive load powers of AC node i at time t; N is the number of network nodes in the power system; V i,t and V j,t are the node voltages at AC node i and node j at time t; θ ij,t is the node phase angle between AC node i and node j at time t; g ij and b ij are the conductance and susceptance between AC node i and node j respectively;
[0018] The node voltage upper and lower limit constraints are as follows:
[0019]
[0020] In the formula, are the upper and lower limits of the voltage of the AC node i at time t;
[0021] The general generator capacity constraints are as follows:
[0022]
[0023] In the formula, They are respectively the active output of the generator P g,t The upper and lower limits of They are the generator reactive output Q g,t The upper and lower limits of
[0024] The capacity constraints of new energy units are as follows:
[0025]
[0026] In the formula, is the active output of the photovoltaic generator set P v,t The upper limit of is the reactive power output P of the wind turbine w,t The upper limit of N w 、N v is the number of wind and photovoltaic generators in the power system;
[0027] The ramp rate constraints for conventional units are as follows:
[0028] R D ≤P g,t -P g,t-1 ≤R U , g∈N G ,t∈T;(6)
[0029] In the formula, R U is the rate limit of the conventional generator set climbing upward; R Dis the rate limit of the conventional generator set climbing upward; P g,t-1 is the active output of the generator during period t-1;
[0030] The capacity constraints of energy storage equipment are as follows:
[0031]
[0032] In the formula, and are the maximum and minimum energy level limits of the energy storage device; E e,t is the energy level of the energy storage device at time t;
[0033] The charging and discharging power constraints of energy storage are as follows:
[0034]
[0035] In the formula, and are the maximum charging and discharging powers of the energy storage, respectively; Charging and discharging power of energy storage;
[0036] The charge state change constraints of energy storage are as follows:
[0037]
[0038] In the formula, E e,t and E e,t-1 are the energy level states of the energy storage device at time t and time t-1 respectively; η ch and η dis are the charging and discharging efficiencies of the energy storage device, respectively; and are the energy level limits at the initial moment of energy storage and at time T; E e,0 、E e,T is the energy level state of the energy storage device at the initial moment and at time T;
[0039] The line capacity constraints are as follows:
[0040]
[0041] Where P ij,t and Q ij,t are the active and reactive power of the line from node i to node j, is the maximum capacity of the line; B is the set of lines in the power system; P ji,t and Q ji,t are the active and reactive powers of the line from node j to node i, respectively.
[0042] Furthermore, the multi-task Transformer neural network includes an Embedding module, a TrainBlock module and a Projection module;
[0043] Among them, the Embeding module is implemented by a multi-layer perceptron;
[0044] The TrmBlock module consists of an L-layer Transformer encoder, which uses a multi-head attention mechanism to promote information interaction between features in different time periods, allowing the model to focus on local features of specific tasks with different attention weights, thereby achieving global information perception and differentiated feature learning in multi-task learning;
[0045] The Projection module uses a linear layer to decode and predict each time period task.
[0046] Furthermore, for a given optimization scheduling period T, the multi-task Transformer neural network decomposes the multi-period optimal power flow solution problem into n subtasks;
[0047] Among them, the multi-task Transformer neural network corresponding to the i-th subtask is as follows:
[0048]
[0049] In the formula, h cou is the shared input feature extracted by the fully connected neural network, X i is the specific feature of the i-th task period, including the access power of new energy and the load power; It is the fusion feature after the shared features and the specific task features are fused and encoded; It is the subtask of each period. It is the fusion feature of the l+1th layer and the Lth layer Transformer encoder; L is the number of Transformer encoder layers.
[0050] Furthermore, the multi-task Transformer neural network is trained using the power-flow training sample set;
[0051] The power-flow training sample set includes multiple groups of power-flow training samples, each group of power-flow training samples includes the power of new energy and load that randomly fluctuates within the range of 80% to 120% of the reference value input, and the output is the current optimal operation decision variable of the power system; the current optimal operation decision variable of the power system includes the output power of the optimal generator group, the charging and discharging power and state of the energy storage, the line power, the node voltage amplitude, and the phase angle.
[0052] Furthermore, when training the multi-task Transformer neural network, the loss function is as follows:
[0053]
[0054] In the formula, is the output predicted by the neural network; V is a set composed of the output power of the motor group, the charging and discharging power and state of the energy storage, the line power, the node voltage amplitude, and the phase angle; y label is the label value of the corresponding output; the label value includes the output power of the optimal generator group, the charging and discharging power and state of the energy storage, the line power, the node voltage amplitude, and the phase angle; is the loss function of the i-th task; w i is the loss weight of the i-th task; is the overall loss function value for all tasks.
[0055] Furthermore, the steps of obtaining the current optimal operation decision variables of the power system by taking the power of new energy access to the power system and the load power as input, and performing the inspection and correction include:
[0056] 5.1) Taking the power of new energy access to the power system and the load power as input, the multi-task Transformer neural network is solved to obtain the voltage amplitude and active power;
[0057] 5.2) Use formula (16) to scale the voltage amplitude and active power output by the multi-task Transformer neural network to ensure that the output of the neural network satisfies the inequality constraints of the multi-period optimal power flow model;
[0058]
[0059] In the formula, x i is the input label of node voltage amplitude and active power of all units, x i and are the corresponding minimum and maximum limits;
[0060] 5.3) Solve the AC power flow and calculate the remaining variables of the current optimal operation decision variables of the power system except voltage amplitude and active power;
[0061] During the solution process, if there is a violation of reactive power limit, the voltage variable is released from the PV node and the PV node is converted into a PQ node by reactive power limit;
[0062] 5.4) Verify the feasibility of the current optimal operation decision variables of the power system according to the multi-period optimal power flow model. If the current optimal operation decision variables of the power system meet all the constraints of the multi-period optimal power flow model, the current optimal operation decision variables of the power system are output as the final result. If not, proceed to step 5.5);
[0063] 5.5) Use the projection correction model to correct the current optimal operation decision variables of the power system;
[0064] The constraints of the projection correction model are the same as those of the multi-period optimal power flow model, and the objective function is as follows:
[0065]
[0066] In the formula, They are the generator active power, node voltage, energy storage discharge power and charging power predicted by the neural network. G,i 、V i , P dis,i , P ch,i It is the actual value of the generator active power, node voltage, discharge power and charging power of energy storage.
[0067] The technical effect of the present invention is unquestionable. The multi-period optimal power flow fast calculation method based on multi-task Transformer proposed in the present invention solves the problems of high solution difficulty and high computational complexity of existing multi-period optimal power flow solution methods in large-scale problems involving new energy and energy storage.
[0068] The present invention accelerates the solution process and simplifies the complexity of the problem by adopting a multi-task Transformer method. The present invention significantly improves the calculation speed while ensuring the calculation accuracy. It is suitable for scenarios involving new energy and energy storage, and can realize the rapid calculation and analysis of the optimal power flow in multiple time periods of the power system. BRIEF DESCRIPTION OF THE DRAWINGS
[0069] Figure 1 It is a schematic diagram of IEEE 118-node power system;
[0070] Figure 2 Schematic diagram of the framework structure of the multi-task Transformer neural network of the present invention;
[0071] Figure 3 It is a structural schematic diagram of the post-processing correction program of the present invention;
[0072] Figure 4This is a comparison chart of the mean absolute percentage error of the trained multi-task Transformer neural network and multiple neural network algorithms directly mapping the optimal solution of the power system under 2000 samples of new energy and load scenarios in an embodiment of the present invention;
[0073] Figure 5 This is a comparison chart of the calculation time of directly mapping the optimal solution of the multi-period optimal power flow of the power system based on the multi-task Transformer neural network under 2000 samples of new energy and load scenarios in an embodiment of the present invention and the calculation time of solving the multi-period optimal power flow based on the traditional IPOPT solver. DETAILED DESCRIPTION
[0074] The present invention is further described below in conjunction with the embodiments, but it should not be understood that the above subject matter of the present invention is limited to the following embodiments. Without departing from the above technical ideas of the present invention, various substitutions and changes are made according to the common technical knowledge and customary means in the art, which should all be included in the protection scope of the present invention.
[0075] Embodiment 1:
[0076] The multi-period optimal power flow fast calculation method based on multi-task Transformer includes the following steps:
[0077] 1) Obtain technical data of power system;
[0078] 2) Taking minimizing the operating cost as the objective function, a multi-period optimal power flow model considering conventional generators, new energy generators and energy storage equipment is constructed;
[0079] 3) Build a multi-task Transformer neural network;
[0080] 4) Using a multi-task Transformer neural network, the problem of solving the multi-period optimal power flow model is decomposed into multiple subtasks;
[0081] 5) Taking the power of new energy access to the power system and the load power as input, the optimal operation decision variables of the power system are solved, and then checked and corrected.
[0082] Embodiment 2:
[0083] A multi-period optimal power flow fast calculation method based on a multi-task Transformer, the technical content is the same as that of Example 1, and further, the power system technical data includes the power system network structure and power flow parameters.
[0084] Embodiment 3:
[0085] The multi-period optimal power flow fast calculation method based on the multi-task Transformer has the same technical content as any one of the embodiments 1-2. Furthermore, the objective function of the multi-period optimal power flow model is as follows:
[0086]
[0087] Where N G It is a collection of conventional generator sets in the power system; C g (·) is the operating cost function of conventional generator sets in the power system; P g,t is the active power output of the generator; T is the dispatching period of the power system; N e It is a collection of energy storage devices in the power system; C e (·) is the operating cost function of the energy storage device; P ch,t is the charging power of the energy storage device; P dis,t is the discharge power of the energy storage device.
[0088] Embodiment 4:
[0089] A multi-period optimal power flow fast calculation method based on a multi-task Transformer, the technical content is the same as any one of Examples 1-3. Furthermore, the constraints of the multi-period optimal power flow model include AC node power balance constraints, node voltage upper and lower limit constraints, conventional generator capacity constraints, new energy unit capacity constraints, conventional unit climbing rate constraints, energy storage equipment capacity constraints, energy storage charging and discharging power constraints, energy storage charge state change constraints, and line capacity constraints.
[0090] Embodiment 5:
[0091] The multi-period optimal power flow fast calculation method based on multi-task Transformer has the same technical content as any one of Embodiments 1-4. Furthermore, the AC node power balance constraint is as follows:
[0092]
[0093] Where P g,i,t and Q g,i,t are respectively the active and reactive power output by the conventional generator at AC node i at time t; P v,i,t and P w,i,t are the active power of wind power and photovoltaic units connected to the system at AC node i at time t; P ch,i,t and P dis,i,t are the charging power and discharging power of the energy storage device connected to the system at AC node i at time t; P d,i,t and Q d,i,t are the active and reactive load powers of AC node i at time t; N is the number of network nodes in the power system; Vi,t and V j,t are the node voltages at AC node i and node j at time t; θ ij,t is the node phase angle between AC node i and node j at time t; g ij and b ij are the conductance and susceptance between AC node i and node j respectively;
[0094] The node voltage upper and lower limit constraints are as follows:
[0095]
[0096] In the formula, are the upper and lower limits of the voltage of the AC node i at time t;
[0097] The general generator capacity constraints are as follows:
[0098]
[0099] In the formula, They are respectively the active output of the generator P g,t The upper and lower limits of They are the generator reactive output Q g,t The upper and lower limits of
[0100] The capacity constraints of new energy units are as follows:
[0101]
[0102] In the formula, is the active output of the photovoltaic generator set P v,t The upper limit of is the reactive power output P of the wind turbine w,t The upper limit of N w 、N v is the number of wind and photovoltaic generators in the power system;
[0103] The ramp rate constraints for conventional units are as follows:
[0104] R D ≤P g,t -P g,t-1 ≤R U , g∈N G ,t∈T;(6)
[0105] In the formula, R U is the rate limit of the conventional generator set climbing upward; R D is the rate limit of the conventional generator set climbing upward; P g,t-1 is the active output of the generator during period t-1;
[0106] The capacity constraints of energy storage equipment are as follows:
[0107]
[0108] In the formula, and are the maximum and minimum energy level limits of the energy storage device; E e,t is the energy level of the energy storage device at time t;
[0109] The charging and discharging power constraints of energy storage are as follows:
[0110]
[0111] In the formula, and are the maximum charging and discharging powers of the energy storage, respectively; Charging and discharging power of energy storage;
[0112] The charge state change constraints of energy storage are as follows:
[0113]
[0114] In the formula, E e,t and E e,t-1 are the energy level states of the energy storage device at time t and time t-1 respectively; η ch and η dis are the charging and discharging efficiencies of the energy storage device, respectively; and are the energy level limits at the initial moment of energy storage and at time T; E e,0 、E e,T is the energy level state of the energy storage device at the initial moment and at time T;
[0115] The line capacity constraints are as follows:
[0116]
[0117] Where P ij,t and Q ij,t are the active and reactive power of the line from node i to node j, is the maximum capacity of the line; B is the set of lines in the power system; P ji,t and Q ji,t are the active and reactive powers of the line from node j to node i, respectively.
[0118] Embodiment 6:
[0119] A multi-period optimal power flow fast calculation method based on a multi-task Transformer, the technical content of which is the same as any one of Embodiments 1-5, and further, the multi-task Transformer neural network includes an Embedding module, a TrainBlock module, and a Projection module;
[0120] Among them, the Embeding module is implemented by a multi-layer perceptron;
[0121] The TrmBlock module consists of an L-layer Transformer encoder, which uses a multi-head attention mechanism to promote information interaction between features in different time periods, allowing the model to focus on local features of specific tasks with different attention weights, thereby achieving global information perception and differentiated feature learning in multi-task learning;
[0122] The Projection module uses a linear layer to decode and predict each time period task.
[0123] Embodiment 7:
[0124] A multi-period optimal power flow fast calculation method based on a multi-task Transformer, the technical content of which is the same as any one of Embodiments 1-6, and further, for a given optimization scheduling period T, the multi-task Transformer neural network decomposes the multi-period optimal power flow solution problem into n subtasks;
[0125] Among them, the multi-task Transformer neural network corresponding to the i-th subtask is as follows:
[0126]
[0127] In the formula, h cou is the shared input feature extracted by the fully connected neural network, X i is the specific feature of the i-th task period, including the access power of new energy and the load power; It is the fusion feature after the shared features and the specific task features are fused and encoded; It is the subtask of each period. It is the fusion feature of the l+1th layer and the Lth layer Transformer encoder; L is the number of Transformer encoder layers.
[0128] Embodiment 8:
[0129] A multi-period optimal power flow fast calculation method based on a multi-task Transformer, the technical content is the same as any one of Embodiments 1-7, further, the multi-task Transformer neural network is trained by a power-power flow training sample set;
[0130] The power-flow training sample set includes multiple groups of power-flow training samples, each group of power-flow training samples includes the power of new energy and load that randomly fluctuates within the range of 80% to 120% of the reference value input, and the output is the current optimal operation decision variable of the power system; the current optimal operation decision variable of the power system includes the output power of the optimal generator group, the charging and discharging power and state of the energy storage, the line power, the node voltage amplitude, and the phase angle.
[0131] Embodiment 9:
[0132] The multi-period optimal power flow fast calculation method based on multi-task Transformer has the same technical content as any one of Embodiments 1-8. Furthermore, when the multi-task Transformer neural network is trained, the loss function is as follows:
[0133]
[0134] In the formula, is the output predicted by the neural network; V is a set composed of the output power of the motor group, the charging and discharging power and state of the energy storage, the line power, the node voltage amplitude, and the phase angle; y label is the label value of the corresponding output, which is obtained from the power-power flow training sample set, specifically the output power of the optimal generator group, the charging and discharging power and state of the energy storage, the line power, the node voltage amplitude, and the phase angle; is the loss function of the i-th task; w i is the loss weight of the i-th task; is the overall loss function value for all tasks.
[0135] Embodiment 10:
[0136] The multi-period optimal power flow fast calculation method based on multi-task Transformer has the same technical content as any one of Embodiments 1-9. Further, taking the access power of new energy sources and the load power of the power system as input, solving the current optimal operation decision variables of the power system, and performing the steps of checking and correcting include:
[0137] 5.1) Taking the power of new energy access to the power system and the load power as input, the multi-task Transformer neural network is solved to obtain the voltage amplitude and active power;
[0138] 5.2) Use formula (16) to scale the voltage amplitude and active power output by the multi-task Transformer neural network to ensure that the output of the neural network satisfies the inequality constraints of the multi-period optimal power flow model;
[0139]
[0140] In the formula, x i is the input label of node voltage amplitude and active power of all units, x i and are the corresponding minimum and maximum limits;
[0141] 5.3) Solve the AC power flow and calculate the remaining variables of the current optimal operation decision variables of the power system except voltage amplitude and active power;
[0142] During the solution process, if there is a violation of reactive power limit, the voltage variable is released from the PV node and the PV node is converted into a PQ node by reactive power limit;
[0143] 5.4) Verify the feasibility of the current optimal operation decision variables of the power system according to the multi-period optimal power flow model. If the current optimal operation decision variables of the power system meet all the constraints of the multi-period optimal power flow model, the current optimal operation decision variables of the power system are output as the final result. If not, proceed to step 5.5);
[0144] 5.5) Use the projection correction model to correct the current optimal operation decision variables of the power system;
[0145] The constraints of the projection correction model are the same as those of the multi-period optimal power flow model, and the objective function is as follows:
[0146]
[0147] In the formula, They are the generator active power, node voltage, energy storage discharge power and charging power predicted by the neural network. G,i 、V i , P dis,i , P ch,i It is the actual value of the generator active power, node voltage, discharge power and charging power of energy storage.
[0148] Embodiment 11:
[0149] Verification of the multi-period optimal power flow fast calculation method based on multi-task Transformer, the content is as follows:
[0150] like Figure 1 The IEEE118-node power system network shown in the figure has 5 photovoltaic power stations, 5 wind farms and 5 energy storage power stations connected to the system. The specific steps of the multi-period optimal power flow fast calculation method based on multi-task Transformer are as follows:
[0151] Step S1: Obtain relevant technical data of the power system, including the network structure and parameters of the power system, and then build a multi-period optimal power flow model considering conventional generator sets, new energy generator sets and energy storage equipment with minimization of operating costs as the objective function;
[0152] Step S2: The power of new energy access and load power of the power system are taken as input feature vectors, and the offline trained multi-task Transformer neural network is used to calculate and output the current optimal operation decision variables of the power system.
[0153] Step S3: According to the output decision variables, the solution results are checked and corrected through a post-processing correction program.
[0154] The multi-period optimal power flow model constructed in step S1 includes the following function model:
[0155] 1) Objective function, the expression is:
[0156]
[0157] Where N G It is a collection of conventional generator sets in the power system; C g (·) is the operating cost function of conventional generator sets in the power system; P g,t is the active power output of the generator; T is the dispatching period of the power system; N e It is a collection of energy storage devices in the power system; C e (·) is the operating cost function of the energy storage device; P ch,t is the charging power of the energy storage device; P dis,t is the discharge power of the energy storage device;
[0158] 2) AC node power balance constraint, the expression is:
[0159]
[0160] Where P g,i,t and Q g,i,t are respectively the active and reactive power output by the conventional generator at AC node i at time t; P v,i,t and P w,i,t are the active power of wind power and photovoltaic units connected to the system at AC node i at time t; P ch,i,t and P dis,i,t are the charging power and discharging power of the energy storage device connected to the system at AC node i at time t; P d,i,t and Q d,i,t are the active and reactive load powers of AC node i at time t; N is the number of network nodes in the power system; V i,t and Vj,t are the node voltages at AC node i and node j at time t; θ ij,t is the node phase angle between AC node i and node j at time t; g ij and b ij are the conductance and susceptance between AC node i and node j respectively; 3) The upper and lower limit constraints of node voltage, expressed as:
[0161]
[0162] In the formula, are the upper and lower limits of the voltage of the AC node i at time t;
[0163] 4) Conventional generator capacity constraint, expressed as:
[0164]
[0165] In the formula, They are the upper and lower limits of the active output of the generator respectively; They are the upper and lower limits of the reactive output of the generator respectively;
[0166] 5) New energy unit capacity constraint, the expression is:
[0167]
[0168] In the formula, It is the upper limit of the active output of the photovoltaic generator set; is the upper limit of the reactive power output of the wind turbine; N w 、N v is the number of wind and photovoltaic generators in the power system;
[0169] 6) The ramp rate constraint of conventional units is expressed as:
[0170] R D ≤P g,t -P g,t-1 ≤R U , g∈N G ,t∈T;
[0171] In the formula, R U is the rate limit of the conventional generator set climbing upward; R D It is the rate limit for conventional generator sets to climb upward;
[0172] 7) Energy storage equipment capacity constraint, expressed as:
[0173]
[0174] In the formula, and are the maximum and minimum energy level limits of the energy storage device; E e,t is the energy level of the energy storage device at time t;
[0175] 8) The charging and discharging power constraint of energy storage is expressed as:
[0176]
[0177] In the formula, and are the maximum charging and discharging powers of the energy storage, respectively;
[0178] 9) The charge state change constraint of energy storage is expressed as:
[0179]
[0180] In the formula, E e,t and E e,t-1 are the energy level states of the energy storage device at time t and time t-1 respectively; η ch and η dis are the charging and discharging efficiencies of the energy storage device, respectively; and They are the energy level limits at the initial moment of energy storage and at time T respectively;
[0181] 10) Line capacity constraint, the expression is:
[0182]
[0183] In the formula, and are the active and reactive power of the line between node i and node j, is the maximum capacity of the line; B is the collection of lines in the power system.
[0184] The multi-task Transformer neural network used in step S2 extracts shared information through a shared network layer, and then uses a multi-task layer of the Transformer neural network with temporal feature attention to efficiently decompose the complex multi-period optimal power flow problem into a series of independent subtasks, thereby achieving efficient and differentiated multi-task learning. It mainly includes three modules: Embedding module, TrainBlock module and Projection module, and its structure is shown in the attached figure. Figure 2 As shown. For a given optimization scheduling period T, it is decomposed into n subtasks, and the model expression of the i-th task is:
[0185]
[0186] In the formula, the Embeding module is implemented by a multilayer perceptron consisting of 3 layers of fully connected neural networks; h cou is the shared input feature extracted by the fully connected neural network, X i is the specific feature of the i-th task period, corresponding to the access power of new energy and the load power; It is a fusion feature after the shared feature and the specific task feature are fused and encoded; the TrmBlock module is a module composed of a 5-layer Transformer encoder, which uses a multi-head attention mechanism to promote information interaction between features in different time periods, so that the model can focus on the local features of specific tasks with different attention weights, thereby achieving global information perception and differentiated feature learning in multi-task learning; the Projection module uses 3 linear layers to decode and predict each time period task This process maps the processed features back to the output space of each task at each time step, providing specific predictions for each task after processing through multiple linear layers.
[0187] The samples of the multi-task Transformer neural network used in step S2 are generated by simulation method, and the generation method is:
[0188] For the random fluctuation of the power of new energy and load within the range of 80% to 120% of the benchmark value, 26,000 wind turbine and photovoltaic output scenes and corresponding load fluctuation values were selected, and the optimal power flow model of the time period under the current new energy power and load power injection was solved based on the IPOPT solver to obtain the optimal generator group output power, energy storage charging and discharging power and state, line power, node voltage amplitude, phase angle, etc.; all calculation results were sorted to obtain samples of deep neural networks, forming 20,000 training samples. The method of obtaining 2,000 test samples is the same as that of training samples.
[0189] When the multi-task Transformer neural network used in step S2 is trained offline, the mean square error function is used as the loss function, and the expression is:
[0190]
[0191] In the formula, is the output predicted by the neural network; V is a set consisting of the output power of the motor group, the charging and discharging power and state of the energy storage, the line power, the node voltage amplitude, the phase angle, etc.; y label is the label value for the output; is the loss function of the i-th task; w i is the loss weight of the i-th task; is the overall loss function value for all tasks.
[0192] In step S3, the solution is checked and corrected by a post-processing correction program according to the output decision variables, as shown in the attached figure. Figure 3 The specific method is as follows:
[0193] First, the inequality constraint is strictly incorporated into the training process of the neural network. The tanh activation function is used to output the scaled voltage amplitude and active power in the output layer to ensure that the output of the neural network satisfies the inequality constraint. The expression is:
[0194]
[0195] In the formula, x i is the input label of node voltage amplitude and active power of all units, x i and are the corresponding minimum and maximum limits;
[0196] After obtaining the active power and node voltage amplitude that satisfy all inequality constraints through the neural network, the remaining variables of the power system are obtained by AC power flow calculation. In the process of solving the AC power flow, if a violation of the reactive power limit is encountered, the voltage variable is released from the PV node and converted to the PQ node through the reactive power limit.
[0197] After that, the feasibility of the results is verified according to the multi-period optimal power flow model. If all constraints in the multi-period optimal power flow model are met, the results of the AC power flow calculation are considered final.
[0198] Otherwise, the output of the neural network will be used as the initial value of the multi-period optimal power flow model, and the final feasible solution will be calculated through a projection correction model. The objective function of the projection correction model is transformed into finding the feasible solution closest to the output of the neural network, and the remaining constraints are consistent with the multi-period optimal power flow model. It is usually faster than directly solving the original multi-period optimal power flow problem, especially when the initial point is close to the optimal. The expression of its objective function is:
[0199]
[0200] In the formula, They are the generator active power, node voltage, discharge power and charging power of energy storage predicted by the neural network.
[0201] Calculation results:
[0202] By comparing with other traditional methods on 2000 test samples, we can see the superiority of the proposed method. The comparison results are as follows: Figure 4As shown. Using the multi-period optimal power flow fast calculation method based on multi-task Transformer proposed by the present invention, the absolute average percentage errors of the active output of the generator, node voltage, and energy storage charge / discharge power of the multi-period optimal power flow are 0.09%, 0.008%, 0.98%, 1.34%, and 0.96%, respectively. Compared with other algorithms, the prediction errors are greatly reduced. It can be seen that the method adopted by the present invention can better guarantee the calculation accuracy.
[0203] like Figure 5 As shown, time t1 represents the duration required for AC power flow calculation; t2 represents the total solution time combining the prediction based on multi-task Transformer with power flow calculation; Feasi.Rate represents the physical constraint satisfaction rate of the solution result of each sample; Opt.Gap represents the gap between the solution result of each sample and the optimal solution. The multi-period optimal power flow fast calculation method based on multi-task Transformer proposed in the present invention has a solution time of 0.113 seconds, which is 1686 times faster than the traditional IPOPT solver method. At the same time, all samples 100% meet the physical constraints of the multi-period optimal power flow, and the optimality gap is 0.02%. Therefore, the multi-period optimal power flow fast calculation method based on multi-task Transformer proposed in the present invention significantly improves the calculation speed while the calculation accuracy does not drop significantly.
[0204] In summary, the multi-period optimal power flow fast calculation method based on multi-task Transformer proposed in the present invention accelerates the solution process and simplifies the complexity of the problem by adopting the multi-task Transformer method, significantly improving the calculation speed while ensuring the calculation accuracy. It is suitable for scenarios involving new energy and energy storage, and can realize the fast calculation and analysis of multi-period optimal power flow in power systems.
Claims
1. A fast multi-period optimal power flow calculation method based on multi-task Transformer, characterized by: The following steps are involved: 1) Obtain technical data of the power system. 2) Taking minimizing the operating cost as the objective function, a multi-period optimal power flow model considering conventional generators, new energy generators and energy storage equipment is constructed; 3) Build a multi-task Transformer neural network; 4) Using a multi-task Transformer neural network, the problem of solving the multi-period optimal power flow model is decomposed into multiple subtasks; 5) Taking the power of new energy access to the power system and the load power as input, the optimal operation decision variables of the power system are solved, and then checked and corrected.
2. The multi-period optimal power flow fast calculation method based on multi-task Transformer according to claim 1 is characterized in that: The technical data of the power system include the power system network structure and power flow parameters.
3. The multi-period optimal power flow fast calculation method based on multi-task Transformer according to claim 1 is characterized in that: The objective function of the multi-period optimal power flow model is as follows: Where N G It is a collection of conventional generator sets in the power system; C g (·) is the operating cost function of conventional generator sets in the power system; P g,t is the active power output of the generator; T is the dispatch period of the power system; N e It is a collection of energy storage devices in the power system; C e (·) is the operating cost function of the energy storage device; P ch,t is the charging power of the energy storage device; P dis,t is the discharge power of the energy storage device.
4. The multi-period optimal power flow fast calculation method based on multi-task Transformer according to claim 1 is characterized in that: The constraints of the multi-period optimal power flow model include AC node power balance constraints, node voltage upper and lower limit constraints, conventional generator capacity constraints, new energy unit capacity constraints, conventional unit ramp rate constraints, energy storage equipment capacity constraints, energy storage charging and discharging power constraints, energy storage charge state change constraints, and line capacity constraints.
5. The multi-period optimal power flow fast calculation method based on multi-task Transformer according to claim 4 is characterized in that: The AC node power balance constraints are as follows: Where P g,i,t and Q g,i,t are respectively the active and reactive power output by the conventional generator at AC node i at time t; P v,i,t and P w,i,t are the active power of wind power and photovoltaic units connected to the system at AC node i at time t; P ch,i,t and P dis,i,t are the charging power and discharging power of the energy storage device connected to the system at AC node i at time t; P d,i,t and Q d,i,t are the active and reactive load powers of AC node i at time t; N is the number of network nodes in the power system; V i,t and V j,t are the node voltages at AC node i and node j at time t; θ ij,t is the node phase angle between AC node i and node j at time t; g ij and b ij are the conductance and susceptance between AC node i and node j respectively; The node voltage upper and lower limit constraints are as follows: In the formula, are the upper and lower limits of the voltage of the AC node i at time t; The general generator capacity constraints are as follows: In the formula, They are respectively the active output of the generator P g,t The upper and lower limits of They are the generator reactive output Q g,t The upper and lower limits of The capacity constraints of new energy units are as follows: In the formula, is the active output of the photovoltaic generator set P v,t The upper limit of is the reactive power output P of the wind turbine w,t The upper limit of N w 、N v is the number of wind and photovoltaic generators in the power system; The ramp rate constraints for conventional units are as follows: R D ≤P g,t -P g,t-1 ≤R U ,g∈N G ,t∈T;(6) In the formula, R U is the rate limit of the conventional generator set climbing upward; R D is the rate limit of the conventional generator set climbing upward; P g,t-1 is the active output of the generator during period t-1; The capacity constraints of energy storage equipment are as follows: In the formula, and are the maximum and minimum energy level limits of the energy storage device; E e,t is the energy level of the energy storage device at time t; The charging and discharging power constraints of energy storage are as follows: In the formula, and are the maximum charging and discharging powers of the energy storage, respectively; Charging and discharging power of energy storage; The charge state change constraints of energy storage are as follows: In the formula, E e,t and E e,t-1 are the energy level states of the energy storage device at time t and time t-1 respectively; η ch and η dis are the charging and discharging efficiencies of the energy storage device, respectively; and are the energy level limits at the initial moment of energy storage and at time T; E e,0 、E e,T is the energy level state of the energy storage device at the initial moment and at time T; The line capacity constraints are as follows: Where P ij,t and Q ij,t are the active and reactive power of the line from node i to node j, is the maximum capacity of the line; B is the set of lines in the power system; P ji,t and Q ji,t are the active and reactive powers of the line from node j to node i, respectively.
6. The multi-period optimal power flow fast calculation method based on multi-task Transformer according to claim 1 is characterized by: The multi-task Transformer neural network includes an Embedding module, a TrainBlock module and a Projection module; Among them, the Embeding module is implemented by a multi-layer perceptron; The TrmBlock module consists of an L-layer Transformer encoder, which uses a multi-head attention mechanism to promote information interaction between features in different time periods, allowing the model to focus on local features of specific tasks with different attention weights, thereby achieving global information perception and differentiated feature learning in multi-task learning; The Projection module uses a linear layer to decode and predict each time period task.
7. The multi-period optimal power flow fast calculation method based on multi-task Transformer according to claim 6 is characterized by: For a given optimization scheduling period T, the multi-task Transformer neural network decomposes the multi-period optimal power flow solution problem into n subtasks; Among them, the multi-task Transformer neural network corresponding to the i-th subtask is as follows: In the formula, h cou is the shared input feature extracted by the fully connected neural network, X i is the specific feature of the i-th task period, including the access power of new energy and the load power; It is the fusion feature after the shared features and the specific task features are fused and encoded; It is the subtask of each period; It is the fusion feature of the l+1th layer and the Lth layer Transformer encoder; L is the number of Transformer encoder layers.
8. The multi-period optimal power flow fast calculation method based on multi-task Transformer according to claim 1 is characterized by: The multi-task Transformer neural network is trained using the power-flow training sample set; The power-flow training sample set includes multiple groups of power-flow training samples, each group of power-flow training samples includes the power of new energy and load that randomly fluctuates within the range of 80% to 120% of the reference value input, and the output is the current optimal operation decision variable of the power system; the current optimal operation decision variable of the power system includes the output power of the optimal generator group, the charging and discharging power and state of the energy storage, the line power, the node voltage amplitude, and the phase angle.
9. The multi-period optimal power flow fast calculation method based on multi-task Transformer according to claim 8 is characterized by: When training a multi-task Transformer neural network, the loss function is as follows: In the formula, is the output predicted by the neural network; V is a set composed of the output power of the motor group, the charging and discharging power and state of the energy storage, the line power, the node voltage amplitude, and the phase angle; y label is the label value of the corresponding output; the label value includes the optimal generator output power, energy storage charging and discharging power and status, line power, node voltage amplitude, and phase angle; is the loss function of the i-th task; w i is the loss weight of the i-th task; is the overall loss function value for all tasks.
10. The multi-period optimal power flow fast calculation method based on multi-task Transformer according to claim 1 is characterized in that: Taking the power of new energy access to the power system and the load power as input, solving the current optimal operation decision variables of the power system, and checking and correcting the steps include: 1) Taking the power of new energy access to the power system and the load power as input, the multi-task Transformer neural network is solved to obtain the voltage amplitude and active power; 2) Use formula (16) to scale the voltage amplitude and active power output by the multi-task Transformer neural network to ensure that the output of the neural network satisfies the inequality constraints of the multi-period optimal power flow model; In the formula, x i is the input label of node voltage amplitude and active power of all units, x i and are the corresponding minimum and maximum limits; It is the subtask of each period; 3) Solve the AC power flow and calculate the remaining variables of the current optimal operation decision variables of the power system except voltage amplitude and active power; During the solution process, if there is a violation of reactive power limit, the voltage variable is released from the PV node and the PV node is converted into a PQ node by reactive power limit; 4) Verify the feasibility of the current optimal operation decision variables of the power system according to the multi-period optimal power flow model. If the current optimal operation decision variables of the power system meet all the constraints of the multi-period optimal power flow model, the current optimal operation decision variables of the power system are output as the final result. If not, proceed to step 5); 5) Use the projection correction model to correct the current optimal operation decision variables of the power system; The constraints of the projection correction model are the same as those of the multi-period optimal power flow model, and the objective function is as follows: In the formula, are the generator active power, node voltage, energy storage discharge power and charging power predicted by the neural network; P G,i 、V i , P dis,i , P ch,i It is the actual value of the generator active power, node voltage, discharge power and charging power of energy storage.
Citation Information
Cited By
Deep learning optimal power flow solution vector correction method considering feasible region
CN119921336A