CN-122020184-A - Power flow calculation model-based training sample generation method and device
Abstract
The application provides a method and a device for generating a training sample based on a power flow calculation model, wherein the method comprises the steps of obtaining a basic sample; the method comprises the steps of carrying out random disturbance on parameters of indexes in operation conditions and corresponding disturbance on parameters of linkage indexes in the operation conditions, carrying out power flow calculation on disturbance samples by adopting a power flow calculation algorithm, determining voltages of all nodes and powers of all nodes in the disturbance samples and the power flow calculation result as training samples of a power flow calculation model when the power flow calculation result reaches a sample generation termination condition, carrying out optimal power flow calculation by adopting a basic sample and a power grid optimization target when the power flow calculation result does not reach the sample generation termination condition, and determining a power grid structure and the optimal operation condition as new basic samples so as to generate a power flow calculation result based on the new basic samples. And the generation efficiency of the training samples in the power flow calculation model is improved.
Inventors
- HUANG WENQI
- ZHAO ZIBIN
- Yu Shengcan
- YU JIAXI
- LI YUJIANG
- LI LICHENG
Assignees
- 北京怀柔实验室
- 南方电网新型电力系统(北京)研究院有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20260413
Claims (16)
- 1. A method for generating training samples based on a power flow calculation model, the method comprising: obtaining a basic sample, wherein the basic sample comprises a power grid structure and operation conditions thereof; Randomly perturbing the parameters of the index in the operation condition, correspondingly perturbing the parameters of the linkage index of the index in the operation condition, and determining the power grid structure and the perturbed operation condition as a perturbation sample; carrying out power flow calculation on the disturbance sample by adopting a power flow calculation algorithm to obtain a power flow calculation result; When the power flow calculation result reaches a sample generation termination condition, determining the voltage of all nodes and the power of all nodes in the disturbance sample and the power flow calculation result as training samples of a power flow calculation model; When the power flow calculation result does not reach the sample generation termination condition, adopting the basic sample and a power grid optimization target to perform optimal power flow calculation to obtain the optimal operation condition of the power grid structure, determining the power grid structure and the optimal operation condition as a new basic sample, and generating a power flow calculation result based on the new basic sample until the generated power flow calculation result reaches the sample generation termination condition.
- 2. The method of claim 1, wherein randomly perturbing the parameter of the indicator in the operating condition comprises: and randomly perturbing parameters of key indexes in the running conditions, wherein the key indexes are indexes used for indicating the load flow calculation boundary conditions in the running conditions.
- 3. The method of claim 2, wherein randomly perturbing the parameters of the key indicators in the operating conditions comprises: randomly perturbing one or more of node load, node admittance, and branch parameters in the operating condition; the performing corresponding disturbance on the parameters of the linkage index of the indexes in the running condition includes: When the node load is disturbed under a first preset condition, the node admittance is disturbed under a second preset condition; When the node admittance is disturbed under a second preset condition, the node load is disturbed under a first preset condition, wherein the first preset condition and the second preset condition are opposite in number, and the value of the first preset condition is larger than that of the second preset condition; when the resistor or the reactance in the branch parameter is disturbed, the corresponding disturbance is carried out on the resistor or the reactance in the branch parameter, wherein the ratio of the disturbed resistor to the reactance is within a preset range.
- 4. The method of claim 1, wherein after a corresponding perturbation of the parameter of the linked index of the index in the operating condition, the method further comprises: Judging whether index parameters in the disturbed operation conditions accord with the physical rules of the power grid structure; If yes, executing the step of carrying out power flow calculation on the disturbance sample by adopting a power flow calculation algorithm; If not, determining that the disturbance fails.
- 5. The method of claim 4, wherein determining whether the index parameter in the perturbed operating condition meets the physical rule of the grid structure comprises: When the node load is disturbed, judging whether the total variation of all the node loads is smaller than the total load of all the nodes at a preset percentage before the disturbance; When the node admittance is disturbed, judging whether the admittance matrix is symmetrical; when the resistor or reactance in the branch parameter is disturbed, whether the branch power flow does not exceed the line capacity limit is judged.
- 6. The method of claim 1, wherein the parameter perturbation of the index and the linked index thereof adopts the same random number generator, the parameter perturbation of the index without the linked relation adopts different random number generators, each random number generator is internally provided with a fixed seed, the random number generator uniformly generates random numbers in a set perturbation range based on the fixed seeds, the random perturbation is carried out on the parameter of the index in the operation condition, and the corresponding perturbation is carried out on the parameter of the linked index of the index in the operation condition, and the method comprises the following steps: Generating a first random number and a second random number based on fixed seeds in the random number generator corresponding to the index; Calculating a first disturbance value of the index by adopting the first random number, and disturbing parameters of the index by adopting the first disturbance value; and calculating a second disturbance value of the linkage index by adopting the second random number, and disturbing the parameter of the linkage index by adopting the second disturbance value.
- 7. The method according to claim 1, wherein the method further comprises: Responding to the branch fault number input in the configuration file, and randomly selecting a target branch from the power grid structure according to the branch fault number; determining a target fault scenario comprising the target branch from a plurality of fault scenarios, wherein each fault scenario comprises at least two branches with fault association; And performing fault processing on the target branch in the operating condition and other branches outside the target branch in the target fault scene to obtain a disturbance sample.
- 8. The method of claim 1, wherein prior to randomly perturbing the parameter of the indicator in the operating condition, the method further comprises: acquiring the total node number of the power grid structure; And configuring a corresponding number of processes for parameter disturbance, power flow calculation and sample storage in the generation process of each training sample based on the total node number, wherein the sample storage is used for storing the training samples, and the larger the total node number is, the larger the proportion of the parameter disturbance and the sample storage compared with the power flow calculation is.
- 9. The method of claim 8, wherein the method further comprises: Determining the generation speed of a training sample; And if the generation speed is smaller than the preset speed, distributing the parameter disturbance and the preset number of processes in the sample storage to the tide calculation so as to increase the generation speed of the next training sample.
- 10. The method of claim 8, wherein the process of parameter perturbation is allocated by a parameter perturbation process pool, the process of power flow calculation is allocated by a power flow calculation process pool, the process of sample storage is allocated by a sample storage process pool, and the power flow calculation process pool is an independent central processing unit CPU core process pool, and the configuring of a corresponding number of processes for parameter perturbation, power flow calculation and sample storage in the generating process of each training sample comprises: in the generation process of each training sample, the process of obtaining the maximum process number from the parameter disturbance process pool is distributed to the parameter disturbance, the process of obtaining the maximum process number from the power flow calculation process pool is distributed to the power flow calculation, and the process of obtaining the maximum process number from the sample storage process pool is distributed to the sample storage.
- 11. The method according to claim 10, wherein the method further comprises: acquiring the current CPU occupancy rate and the current memory usage amount; And adjusting the maximum process number in the parameter disturbance process pool, the power flow calculation process pool and the sample storage process pool according to the CPU occupancy rate and the memory usage amount, wherein the CPU occupancy rate and the memory usage amount are inversely related to the maximum process number.
- 12. The method according to any one of claims 1 to 11, wherein the number of disturbance samples is a plurality, the performing power flow calculation on the disturbance samples by using a power flow calculation algorithm to obtain a power flow calculation result includes: Carrying out power flow calculation on each disturbance sample by adopting a power flow calculation algorithm to obtain a plurality of power flow calculation results; the method further comprises the steps of: Determining a convergence result number and a non-convergence result number from the plurality of power flow calculation results; Calculating the convergence rate of the plurality of power flow calculation results based on the convergence result number and the non-convergence result number; When the convergence rate is larger than a preset rate value, determining that the plurality of power flow calculation results reach a sample generation termination condition; and when the convergence rate is smaller than or equal to a preset rate value, determining that the plurality of power flow calculation results do not reach a sample generation termination condition.
- 13. A device for generating training samples based on a power flow calculation model, the device comprising: the acquisition module is used for acquiring a basic sample, wherein the basic sample comprises a power grid structure and operation conditions thereof; The disturbance module is used for randomly disturbing the parameters of the index in the operation condition, correspondingly disturbing the parameters of the linkage index of the index in the operation condition, and determining the power grid structure and the disturbed operation condition as disturbance samples; The calculation module is used for carrying out power flow calculation on the disturbance sample by adopting a power flow calculation algorithm to obtain a power flow calculation result; The generation module is used for determining the voltage of all nodes and the power of all nodes in the disturbance sample and the power flow calculation result as training samples of a power flow calculation model when the power flow calculation result reaches a sample generation termination condition; And the generation module is further used for carrying out optimal power flow calculation by adopting the basic sample and a power grid optimization target when the power flow calculation result does not reach a sample generation termination condition, obtaining the optimal operation condition of the power grid structure, determining the power grid structure and the optimal operation condition as a new basic sample, and generating a power flow calculation result based on the new basic sample until the generated power flow calculation result reaches the sample generation termination condition.
- 14. A computer device comprising a memory, a processor and a computer program stored on the memory, characterized in that the processor executes the computer program to carry out the steps of the method of any one of claims 1 to 12.
- 15. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 12.
- 16. A computer program product comprising a computer program, characterized in that the computer program, when executed by a processor, implements the steps of the method of any one of claims 1 to 12.
Description
Power flow calculation model-based training sample generation method and device Technical Field The present application relates to the field of data processing technology, and in particular, to a method for generating a training sample based on a power flow calculation model, a device for generating a training sample based on a power flow calculation model, a computer device, a computer readable storage medium, and a computer program product. Background The power flow calculation refers to calculating the voltage of all nodes and the steady-state distribution condition of the power of all branches in the whole power grid according to a given power grid structure (where a power plant is, where a user is and how wires are connected) and operation conditions (how much power is generated by the power plant and how much power is used by the user) through a complex mathematical formula. With the development of smart grids, power flow calculation is performed through a deep learning model to become a hotspot. The deep learning model needs to be trained before it can be used for power flow calculation. While training the model requires the use of a large number of training samples. The power grid structure and the operation condition corresponding to different training samples are different. Each training sample includes a grid structure and a corresponding one of the operating conditions, and the calculated voltages at all nodes and the calculated powers at all branches in the grid structure. At present, training samples are generated mainly by acquiring a designated power grid structure and operating conditions thereof and randomly perturbing parameters of one or more indexes in the operating conditions. Randomly perturbing once to obtain an operating condition. And calculating by adopting a power flow calculation equation based on the designated power grid structure and the operation condition obtained at the time to obtain the voltages of all nodes and the powers of all branches in the power grid structure. The designated power grid structure, the running condition of the time and the voltage of all nodes and the power of all branches obtained by the calculation are one training sample. After performing a number of disturbances and corresponding power flow calculations, a number of training samples can be obtained. By changing the power grid structure and adopting the mode, more training samples can be obtained. However, the running condition is generated by adopting a parameter random disturbance mode of the index, and then the power flow calculation is performed, and in many cases, the problem that the calculation cannot be converged occurs. To obtain a specified number of training samples, more parameter perturbations are required for the operating conditions. In this way, the efficiency of generating a specified number of training samples in the power flow calculation model training is reduced. Disclosure of Invention It is an object of embodiments of the present application to provide a method for generating a training sample based on a power flow calculation model, a device for generating a training sample based on a power flow calculation model, a computer device, a computer readable storage medium and a computer program product for improving the efficiency of generating a training sample of a power flow calculation model. In order to solve the technical problems, the embodiment of the application provides the following technical scheme: The first aspect of the application provides a generation method of a training sample based on a power flow calculation model, which comprises the steps of obtaining a basic sample, wherein the basic sample comprises a power grid structure and an operation condition thereof, randomly perturbing parameters of indexes in the operation condition, correspondingly perturbing the parameters of linked indexes in the operation condition, determining the power grid structure and the perturbed operation condition as the perturbed sample, adopting a power flow calculation algorithm to carry out power flow calculation on the perturbed sample to obtain a power flow calculation result, determining voltages of all nodes and powers of all nodes in the perturbed sample and the power flow calculation result as the training sample of the power flow calculation model when the power flow calculation result reaches a sample generation termination condition, adopting the basic sample and a power grid optimization target to carry out optimal power flow calculation when the power flow calculation result does not reach the sample generation termination condition, obtaining the optimal operation condition of the power grid structure, determining the power grid structure and the optimal operation condition as a new basic sample, and generating the power flow calculation result based on the new basic sample until the generated power flow calculation result reaches the sample generation termination c