A power system power quality detection method, device and equipment

By improving the genetic algorithm for power system power quality detection, the problem of incomplete power quality detection in existing technologies has been solved, achieving comprehensive detection, avoiding equipment damage and production interruption, and reducing economic losses.

CN116466125BActive Publication Date: 2026-05-29GUANGDONG POWER GRID CO LTD +1

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
GUANGDONG POWER GRID CO LTD
Filing Date
2023-04-23
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

Existing power quality detection algorithms fail to comprehensively address all issues affecting power quality, leading to production interruptions and equipment damage, resulting in economic losses for factories.

Method used

An improved genetic algorithm is used to obtain the initial voltage waveform data points of the power system, calculate the target feature quantity, and compare it with the preset standard feature range to determine whether the power quality is abnormal, thus avoiding the detection of single problems.

Benefits of technology

Comprehensive power quality testing helps prevent equipment interruptions and damage, ensures production continuity, and reduces economic losses.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116466125B_ABST
    Figure CN116466125B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of power quality detection, and discloses a power system power quality detection method, device and equipment, in response to a received power quality detection request, corresponding to-be-detected power systems are determined, a plurality of initial voltage waveform data points of a distribution point associated with the to-be-detected power systems in a preset time period are acquired, based on an improved genetic algorithm, the to-be-detected power systems are calculated by using the plurality of initial voltage waveform data points to obtain a plurality of target characteristic quantities, and according to comparison results of each target characteristic quantity and a preset standard characteristic interval, whether the power quality of the to-be-detected power system is abnormal is determined; the existing algorithm does not comprehensively involve detection of all problems affecting the power quality, only detection of a single problem affecting the power quality, and the problems may cause interruption of production of such power equipment, damage of equipment, further influence production, and cause a technical problem of huge economic losses of a factory.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of power quality testing technology, and in particular to a method, apparatus and equipment for power system power quality testing. Background Technology

[0002] With continuous technological innovation and development, the power quality requirements of electrical equipment connected to the power system in various production lines, such as precision integrated chip manufacturing, are becoming increasingly stringent. Compared to traditional manufacturing, there are all kinds of power quality issues, including steady-state power quality problems such as high-order harmonics, voltage fluctuations and flicker, and transient power quality problems such as voltage dips, interruptions and other disturbances.

[0003] Existing algorithms are widely used in power quality detection. Since voltage sag is a particularly prominent power quality issue, algorithms such as Fourier transform, wavelet transform, and S-transform are commonly used for voltage sag detection. For voltage fluctuations and flicker, algorithms like Kalman filtering and Particle Swarm Optimization (PSO) are frequently employed. For voltage harmonic analysis, the Hilbert-Huang transform algorithm is commonly used. However, these algorithms do not comprehensively address all issues affecting power quality; they only detect single problems. This can lead to production interruptions and equipment damage, ultimately impacting production and causing significant economic losses to factories. Summary of the Invention

[0004] This invention provides a method, apparatus, and equipment for detecting power quality in power systems. It solves the technical problem that existing algorithms do not comprehensively cover all issues affecting power quality, but only detect single issues affecting power quality, which can lead to production interruptions and equipment damage, thereby affecting production and causing huge economic losses to factories.

[0005] The first aspect of this invention provides a power system power quality detection method, comprising:

[0006] In response to a received power quality detection request, determine the power system to be detected corresponding to the power quality detection request;

[0007] Acquire multiple initial voltage waveform data points of the distribution point associated with the power system to be detected within a preset time period;

[0008] Based on the improved genetic algorithm, multiple target feature quantities corresponding to the power system under test are calculated using multiple initial voltage waveform data points;

[0009] Based on the comparison results between each of the target feature quantities and its associated preset standard feature interval, it is determined whether the power quality of the power system to be detected is abnormal.

[0010] Optionally, the step of calculating multiple target feature quantities corresponding to the power system under test based on an improved genetic algorithm using multiple initial voltage waveform data points includes:

[0011] The basic parameters of the improved genetic algorithm are initialized, and multiple gene variable intervals are calculated using multiple initial voltage waveform data points.

[0012] Based on the number of data points in the initial voltage waveform data points, calculate the initial fitness value corresponding to each initial population in the improved genetic algorithm, and determine the corresponding encoding method;

[0013] Based on the multiple initial fitness values ​​and the multiple gene variable intervals, genetic operations are performed on each of the initial populations in the improved genetic algorithm to determine the corresponding multiple intermediate populations;

[0014] Calculate the target fitness values ​​corresponding to multiple intermediate populations, and select the intermediate population associated with the minimum value from the multiple target fitness values ​​as the target population;

[0015] Multiple gene values ​​within the target population are used as multiple target feature quantities.

[0016] Optionally, the step of initializing the basic parameters of the improved genetic algorithm and calculating the corresponding multiple gene variable intervals using multiple initial voltage waveform data points includes:

[0017] Initialize the basic parameters of the improved genetic algorithm;

[0018] A predetermined number of initial voltage waveform data points are arbitrarily selected from a plurality of initial voltage waveform data points as target voltage waveform data points;

[0019] Multiple sets of gene variables are generated by inputting sinusoidal voltage functions with the target voltage waveform data points described above.

[0020] Multiple gene variable intervals are determined by selecting the maximum and minimum values ​​of the gene variables from each group of gene variables as the two endpoints of the variable interval.

[0021] Optionally, the genetic operations include selection, crossover, and mutation operations. The step of performing genetic operations on each of the initial populations within the improved genetic algorithm based on multiple initial fitness values ​​and multiple gene variable intervals to determine the corresponding multiple intermediate populations includes:

[0022] Based on the roulette wheel algorithm, the selection operation is performed on each of the initial populations in the improved genetic algorithm according to multiple initial fitness values;

[0023] The crossover probability value is calculated using multiple initial fitness values, and the crossover operation is performed on each of the initial populations based on the comparison result between the crossover probability value and the associated preset crossover threshold.

[0024] Based on multiple gene variable intervals, a mutation probability value is calculated using multiple initial fitness values, and the mutation operation is performed on each initial population according to the comparison result of the mutation probability value and the associated preset mutation threshold.

[0025] When the selection operation, the crossover operation, and the mutation operation reach the preset iteration conditions, the corresponding multiple intermediate populations are determined.

[0026] Optionally, the step of performing the selection operation on each of the initial populations within the improved genetic algorithm based on the roulette wheel algorithm according to multiple initial fitness values ​​includes:

[0027] Calculate the sum of all the initial fitness values ​​to generate a fitness sum value;

[0028] Calculate the ratio between the initial fitness value associated with each initial population and the sum of fitness values ​​to generate selection probability values ​​corresponding to multiple initial populations;

[0029] Compare the selected probability values ​​with the preset standard probability values;

[0030] If the selection probability value is greater than the preset standard probability value, then the initial population associated with the selection probability value will be retained;

[0031] If the selection probability value is less than or equal to the preset standard probability value, then the initial population associated with the selection probability value is replaced.

[0032] Optionally, the step of calculating a crossover probability value using multiple initial fitness values, and performing the crossover operation on each of the initial populations based on the comparison result of the crossover probability value and an associated preset crossover threshold, includes:

[0033] Multiple initial fitness values ​​are input into a preset crossover probability value function model to generate corresponding crossover probability values;

[0034] Compare the crossover probability value with the associated preset crossover threshold;

[0035] If the crossover probability value is greater than the preset crossover threshold, then the crossover operation is performed on each of the initial populations;

[0036] If the crossover probability value is less than or equal to the preset crossover threshold, then the crossover operation is not performed on each of the initial populations.

[0037] Optionally, the step of calculating mutation probability values ​​based on multiple gene variable intervals using multiple initial fitness values, and performing the mutation operation on each of the initial populations according to the comparison results of the mutation probability values ​​and the associated preset mutation threshold, includes:

[0038] The initial fitness values ​​are input into a preset mutation probability value function model to generate corresponding mutation probability values.

[0039] Compare the mutation probability value with the associated preset mutation threshold;

[0040] If the mutation probability value is greater than the preset mutation threshold, then the mutation operation is performed on each of the initial populations based on the gene variable range;

[0041] If the mutation probability value is less than or equal to the preset mutation threshold, then the mutation operation is not performed on each of the initial populations.

[0042] Optionally, the step of determining whether the power quality of the power system to be detected is abnormal based on the comparison results between each of the target feature quantities and its associated preset standard feature intervals includes:

[0043] If any of the target feature quantities is not within the associated preset standard feature range, it is determined that the power quality of the power system under test is abnormal, and the power supply to the electrical equipment associated with the power system under test is stopped.

[0044] If all the target feature quantities are within the associated preset standard feature range, it is determined that the power quality of the power system to be tested is not abnormal, and power is supplied to the electrical equipment associated with the power system to be tested.

[0045] A second aspect of the present invention provides a power system power quality detection device, comprising:

[0046] A response module is used to respond to a received power quality detection request and determine the power system to be detected corresponding to the power quality detection request.

[0047] The initial voltage waveform data point module is used to acquire multiple initial voltage waveform data points of the distribution point associated with the power system to be detected within a preset time period;

[0048] The target feature module is used to calculate multiple target features of the power system under test based on an improved genetic algorithm using multiple initial voltage waveform data points.

[0049] The data processing module is used to determine whether the power quality of the power system to be detected is abnormal based on the comparison results between each of the target feature quantities and its associated preset standard feature intervals.

[0050] A third aspect of the present invention provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor performs the steps of the power system power quality detection method as described in any of the preceding claims.

[0051] As can be seen from the above technical solutions, the present invention has the following advantages:

[0052] In response to a received power quality detection request, the system identifies the power system to be detected and acquires multiple initial voltage waveform data points of the distribution points associated with the power system within a preset time period. Based on an improved genetic algorithm, multiple target feature quantities corresponding to the power system are calculated using these initial voltage waveform data points. The system determines whether the power quality of the power system is abnormal based on the comparison results between each target feature quantity and its associated preset standard feature interval. This addresses the technical problem that existing algorithms do not comprehensively detect all issues affecting power quality, only focusing on single issues, which can lead to production interruptions and equipment damage, resulting in significant economic losses for factories. By improving the automatic calculation method in the genetic algorithm, the system overcomes the traditional method of setting gene value ranges based on empirical values ​​and directly solves for voltage feature quantities to determine whether the voltage is abnormal. It also overcomes the problem of no solution in existing methods, thus guaranteeing an absolute solution. Attached Figure Description

[0053] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0054] Figure 1 This is a flowchart of the steps of a power system power quality detection method provided in Embodiment 1 of the present invention;

[0055] Figure 2 This is a flowchart of the steps of a power system power quality detection method provided in Embodiment 2 of the present invention;

[0056] Figure 3This is a flowchart of an embodiment of the present invention for solving sinusoidal voltage characteristic quantities using an improved genetic algorithm;

[0057] Figure 4 This is a schematic diagram of voltage waveform data point sampling provided in Embodiment 2 of the present invention;

[0058] Figure 5 This is a structural block diagram of a power system power quality detection device provided in Embodiment 3 of the present invention. Detailed Implementation

[0059] This invention provides a power system power quality detection method, apparatus, and equipment to address the technical problem that existing algorithms do not comprehensively cover all issues affecting power quality, but only detect single issues affecting power quality. This can lead to production interruptions and equipment damage for such electrical equipment, thereby affecting production and causing huge economic losses to factories.

[0060] To make the objectives, features, and advantages of this invention more apparent and understandable, the technical solutions of the embodiments of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the embodiments described below are only some embodiments of this invention, and not all embodiments. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this invention.

[0061] Please see Figure 1 , Figure 1 The flowchart illustrates the steps of a power system power quality detection method provided in Embodiment 1 of the present invention.

[0062] This invention provides a power system power quality detection method, comprising:

[0063] Step 101: In response to the received power quality detection request, determine the power system to be detected corresponding to the power quality detection request.

[0064] A power quality testing request refers to a request for power quality testing of the power system.

[0065] In this embodiment, in response to receiving a request for power quality testing of the power system, the request is read and the corresponding power system to be tested is obtained.

[0066] Step 102: Obtain multiple initial voltage waveform data points of the distribution points associated with the power system to be detected within a preset time period.

[0067] A distribution point refers to the point in the power system where electrical energy is transmitted to electrical equipment.

[0068] The preset time period refers to the preset data acquisition cycle, which can be set according to people's needs.

[0069] Initial voltage waveform data points refer to the voltage data points used to calculate the target characteristic quantities.

[0070] In this embodiment, multiple initial voltage waveform data points of the distribution point associated with the power system to be detected are acquired within a preset time period.

[0071] Step 103: Based on the improved genetic algorithm, multiple target feature quantities corresponding to the power system to be detected are calculated using multiple initial voltage waveform data points.

[0072] An improved genetic algorithm refers to a new genetic algorithm proposed based on the traditional genetic algorithm and combined with the obtained initial voltage waveform data points, which is used to solve for the characteristic quantities.

[0073] It is worth mentioning that the characteristic quantities refer to the four characteristic quantities of the sinusoidal voltage waveform. The target characteristic quantities include voltage amplitude, angular frequency, initial phase, and DC offset.

[0074] In this embodiment, based on an improved genetic algorithm, the feature quantities are calculated by combining the obtained initial voltage waveform data points to obtain multiple target feature quantities corresponding to the power system to be detected.

[0075] Step 104: Based on the comparison results of each target feature quantity with its associated preset standard feature interval, determine whether the power quality of the power system to be detected is abnormal.

[0076] The preset standard feature range refers to the standard threshold range used to determine whether the target feature quantity is abnormal.

[0077] In this embodiment, if any target feature quantity is not within the associated preset standard feature range, it is determined that the power quality of the power system under test is abnormal, and the power supply to the associated electrical equipment of the power system under test is stopped. If all target feature quantities are within the associated preset standard feature range, it is determined that the power quality of the power system under test is not abnormal, and the power supply to the associated electrical equipment of the power system under test is resumed.

[0078] In this embodiment of the invention, in response to a received power quality detection request, the power system to be detected corresponding to the power quality detection request is determined. Multiple initial voltage waveform data points of the distribution points associated with the power system to be detected within a preset time period are acquired. Based on an improved genetic algorithm, multiple target feature quantities corresponding to the power system to be detected are calculated using these multiple initial voltage waveform data points. Based on the comparison results between each target feature quantity and its associated preset standard feature interval, it is determined whether the power quality of the power system to be detected is abnormal. This solves the technical problem that existing algorithms do not comprehensively cover all issues affecting power quality, but only detect single issues affecting power quality, which can lead to production interruptions and equipment damage, thus affecting production and causing huge economic losses to factories. By improving the automatic calculation method in the genetic algorithm, the traditional method of setting gene value ranges based on empirical values ​​is overcome. Furthermore, by directly solving for voltage feature quantities to determine whether the voltage is abnormal, the invention overcomes the problem of existing methods having no solution, thus ensuring that there is an absolute solution.

[0079] Please see Figure 2 , Figure 2 This is a flowchart illustrating the steps of a power system power quality detection method provided in Embodiment 2 of the present invention.

[0080] This invention provides a power system power quality detection method, comprising:

[0081] Step 201: In response to the received power quality detection request, determine the power system to be detected corresponding to the power quality detection request.

[0082] In this embodiment, the specific implementation process of step 201 is similar to that of step 101, and will not be repeated here.

[0083] Step 202: Obtain multiple initial voltage waveform data points of the distribution points associated with the power system to be detected within a preset time period.

[0084] It's worth noting that traditional power quality detection methods require collecting data over an entire cycle before performing the detection. In practical applications, a common approach is to use the least squares method for data fitting. However, during fitting, a large number of data points are acquired over the entire cycle. Furthermore, with the increasing number of data points used for fitting, the least squares method may fail to find a solution, meaning that characteristic quantities may not be derived. In this invention, the preset time period does not need to be the entire voltage cycle. In other words, the acquired data points do not need to cover the entire cycle to complete power quality detection. This is far superior to traditional power quality detection methods.

[0085] In this embodiment, the specific implementation process of step 202 is similar to that of step 102, and will not be repeated here.

[0086] Step 203: Based on the improved genetic algorithm, multiple target feature quantities corresponding to the power system to be detected are calculated using multiple initial voltage waveform data points.

[0087] Furthermore, step 203 may include the following sub-steps:

[0088] S11. Initialize the basic parameters of the improved genetic algorithm, and use multiple initial voltage waveform data points to calculate the corresponding multiple gene variable intervals.

[0089] It is worth mentioning that in traditional genetic algorithms, MaxGen, Psize, and the range of x values ​​for each gene on a chromosome are all set by empirical values. These empirical values ​​are obtained through extensive preliminary testing experiments and are manually estimated to be optimal. Furthermore, once set, these empirical values ​​cannot be adaptively adjusted according to actual needs. This invention improves upon the traditional empirical setting of the x value range for each gene on a chromosome by using an automatic calculation method, as detailed in S111-S114.

[0090] Furthermore, S11 may include the following sub-steps:

[0091] S111. Initialize the basic parameters of the improved genetic algorithm.

[0092] In this embodiment, the basic parameters of the genetic process are determined as follows: the maximum number of generations is set to MaxGen; the population size is Psize; the chromosome length is ChromLen; the chromosome crossover probability is Pc, with an initial value range of [0-1]; the chromosome mutation probability is Pm, with an initial value range of [0-1]; since the object of solution is the basic parameters (x0, x1, x2, x3) of a sine function, the chromosome length ChromLen = 4; the range of values ​​for each gene x (i.e., the four parameters x0, x1, x2, x3 of the sine voltage) is determined ([X... 0min ,X 0max ],[X 1min ,X 1max ],[X 2min ,X 2max ],[X 3min ,X 3max MaxGen and Psize are variables that determine the accuracy of the calculation results, but also the computation time. The larger the value of each x, the more accurate the calculation results, but the longer the computation time.

[0093] S112. Select a preset number of initial voltage waveform data points from multiple initial voltage waveform data points as target voltage waveform data points.

[0094] In this embodiment, multiple sets of data points (each set of data points includes time t and voltage value y) are randomly selected from the multiple initial voltage waveform data points sampled.

[0095] S113. Use the target voltage waveform data points as input sinusoidal voltage functions to generate multiple sets of gene variables.

[0096] In this embodiment, a sinusoidal voltage function is input using the target voltage waveform data points to generate multiple sets of gene variables.

[0097] S114. Select the maximum and minimum values ​​of the gene variables from each group of gene variables as the two endpoints of the variable interval to determine multiple gene variable intervals.

[0098] In practical applications, steps S111-S114 are as follows:

[0099] The expression for the sinusoidal voltage function is:

[0100] y=x0sin(x1t+x2)+x3 (1)

[0101] Voltage waveform data points within a certain range (this range can be set by the user, but does not need to cover the entire voltage cycle) are collected at regular intervals, with the number of collected voltage data points (n≥8).

[0102] (t i ,y i ), i = 0, 1, 2, 3, ..., n-1 (2)

[0103] According to the genetic algorithm, if we want to use the above point (2) to solve for the corresponding four target features in the form of equation (1), the following steps are required:

[0104] (1) By randomly selecting 4 sets of data points from the sampled voltage data points (each set of data points includes time t and voltage value y), and substituting the 4 sets of data points into formula (1) respectively, we obtain 4 equations, as shown below.

[0105] y1=x0sin(x1t1+x2)+x3

[0106] y2=x0sin(x1t2+x2)+x3

[0107] y3=x0sin(x1t3+x2)+x3

[0108] y4=x0sin(x1t4+x2)+x3

[0109] Based on the above four equations, the four gene variables x0, x1, x2, and x3 are solved.

[0110] (2) Repeat step (1) N times to obtain the solution values ​​of N sets of gene variables x0, x1, x2, x3.

[0111] (3) Find the minimum and maximum values ​​of each of the N sets of gene variables obtained. Use this to determine the range of the gene variables ([X...). 0min ,X 0max ],[X 1min ,X 1max ],[X 2min ,X 2max ],[X 3min ,X 3max ]).

[0112] S12. Based on the number of data points in the initial voltage waveform data points, calculate the initial fitness value corresponding to each initial population in the improved genetic algorithm, and determine the corresponding encoding method.

[0113] The formula for calculating the initial fitness value is:

[0114]

[0115] In the formula, g represents the nth population, with a value range of 1 to Psize, n is the number of initial voltage waveform data points in formula (2), and i represents the nth sampling point.

[0116] It is worth mentioning that for voltage waveform data points, the lower the adaptability value, the better.

[0117] The encoding method is determined based on the basic parameters (x0, x1, x2, x3) of the sine function, and the embodiment of the present invention adopts real number encoding.

[0118] In this embodiment, the initial fitness value corresponding to each initial population in the improved genetic algorithm is calculated based on the number of data points of the initial voltage waveform data points, and the corresponding encoding method is determined.

[0119] S13. Based on multiple initial fitness values ​​and multiple gene variable ranges, perform genetic operations on each initial population within the improved genetic algorithm to determine the corresponding multiple intermediate populations.

[0120] Furthermore, genetic operations include selection, crossover, and mutation operations, and S13 may include the following sub-steps:

[0121] S131. Based on the roulette wheel algorithm, perform selection operations on each initial population in the improved genetic algorithm according to multiple initial fitness values.

[0122] Furthermore, S131 may include the following sub-steps:

[0123] S1311. Calculate the sum of all initial fitness values ​​to generate a fitness sum value.

[0124] S1312. Calculate the ratio between the initial fitness value and the sum of fitness values ​​of each initial population association, and generate selection probability values ​​corresponding to multiple initial populations.

[0125] The formula for calculating the selection probability value is:

[0126] P i =Fit i / (∑Fit) (4)

[0127] In the formula, p i Fit represents the selection probability value of the i-th population being selected. i ∑Fit represents the fitness value of the i-th initial population, and ∑Fit represents the sum of fitness values ​​of each population.

[0128] It is worth mentioning that the selection probability value p i The larger the value, the higher the probability of it being retained.

[0129] S1313. Compare the probability values ​​of each option with the preset standard probability values.

[0130] A preset standard probability value is used as a probability threshold to determine whether the initial population needs to be retained.

[0131] S1314. If the selection probability value is greater than the preset standard probability value, the initial population associated with the selection probability value will be retained.

[0132] S1315. If the selection probability value is less than or equal to the preset standard probability value, the initial population associated with the selection probability value will be replaced.

[0133] In the specific implementation, S1313-S1315 are as follows:

[0134] For each population, a standard probability value d is preset. r (d r The range is 0 to 1), then use d r With P i In comparison, if P i >d r If the result is positive, it means that the population is preserved; otherwise, the population is randomly replaced by other superior populations.

[0135] In this embodiment, each selection probability value is compared with a preset standard probability value. If the selection probability value is greater than the preset standard probability value, the initial population associated with the selection probability value is retained. If the selection probability value is less than or equal to the preset standard probability value, the initial population associated with the selection probability value is replaced with other superior populations.

[0136] S132. Calculate the crossover probability value using multiple initial fitness values, and perform crossover operation on each initial population based on the comparison result between the crossover probability value and the associated preset crossover threshold.

[0137] Furthermore, S132 may include the following sub-steps:

[0138] S1321. Input multiple initial fitness values ​​into the preset crossover probability value function model to generate corresponding crossover probability values.

[0139] In practical implementation, to facilitate the method's implementation, the above process can be converted into a formulaic encapsulation. The pre-defined expression of the cross-probability value function model is as follows:

[0140]

[0141] In the formula, P C f represents the crossover probability value. max f is the maximum fitness value in the population. avg is the average fitness value of the population, f is the larger fitness value of the two individuals to be crossed, f' is the fitness value of the individual to be mutated, and k1, k2, k3, k4 are empirical constants. It is recommended that k1, k2, k3, k4 be 1, 0.5, 1, 0.5 respectively.

[0142] It is worth mentioning that the maximum value among the various initial fitness values ​​is selected as f. max The maximum fitness value in the population, and calculate f using all initial fitness values. avg Average fitness of the population.

[0143] In this embodiment, multiple initial fitness values ​​are used to calculate the maximum fitness value and the average fitness value of the population, and then input into a preset crossover probability value function model to calculate the crossover probability value.

[0144] S1322. Compare the crossover probability value with the preset crossover threshold.

[0145] The preset cross threshold refers to the threshold for determining whether to perform a cross operation.

[0146] In this embodiment, the crossover operation is performed based on the crossover probability value, that is, a preset crossover threshold r1 is generated before each operation, and the range of r1 is [0,1].

[0147] S1323. If the crossover probability value is greater than the preset crossover threshold, then perform the crossover operation on each initial population.

[0148] In this embodiment, when the crossover probability value is greater than the preset crossover threshold, a crossover operation is performed on each initial population.

[0149] S1324. If the crossover probability value is less than or equal to the preset crossover threshold, then crossover operation is not performed on each initial population.

[0150] It is worth mentioning the crossover operation. Using the real-number crossover method, the chromosomes a of the i-th population are... i and chromosome a of the j-th population j The crossover operation is performed on the l-th gene, specifically as follows:

[0151]

[0152] Where b is a random number in the range [0,1]; i, j, l are all randomly generated, that is, two parent generations are randomly selected, and then a gene is randomly selected, and crossover is performed according to equation (5). The values ​​of i and j are 1 to Psize, and the value of l is 0 to 3.

[0153] After applying formula (5), the chromosome a of the i-th population i and chromosome a of the j-th population j Things have changed.

[0154] In this embodiment, if the crossover probability value is less than or equal to the preset crossover threshold, the crossover operation is not performed on each initial population, and the process jumps back to S1321.

[0155] S133. Based on multiple gene variable ranges, calculate the mutation probability value using multiple initial fitness values, and perform mutation operations on each initial population according to the comparison results of the mutation probability value and the associated preset mutation threshold.

[0156] Furthermore, S133 may include the following sub-steps:

[0157] S1331. Input multiple initial fitness values ​​into the preset mutation probability value function model to generate the corresponding mutation probability values.

[0158] In practical implementation, to facilitate the method's implementation, the above process can be converted into a formulaic encapsulation. The expression of the mutation probability value function model is preset as follows:

[0159]

[0160] In the formula, P m f represents the mutation probability value. max f is the maximum fitness value in the population. avg is the average fitness value of the population, f is the larger fitness value of the two individuals to be crossed, f' is the fitness value of the individual to be mutated, and k1, k2, k3, k4 are empirical constants. It is recommended that k1, k2, k3, k4 be 1, 0.5, 1, 0.5 respectively.

[0161] It is worth mentioning that the maximum value among the various initial fitness values ​​is selected as f. max The maximum fitness value in the population, and calculate f using all initial fitness values. avg Average fitness of the population.

[0162] In this embodiment, multiple initial fitness values ​​are used to calculate the maximum fitness value and the average fitness value of the population, and then input into a preset mutation probability value function model to calculate the mutation probability value.

[0163] S1332. Compare the mutation probability value with the associated preset mutation threshold.

[0164] In this embodiment, the mutation operation is performed based on the crossover probability value, that is, a preset mutation threshold r2 is generated before each operation, and the range of r2 is [0,1].

[0165] S1333. If the mutation probability value is greater than the preset mutation threshold, then perform mutation operations on each initial population based on the gene variable range.

[0166] It's worth noting that performing mutation operations on each initial population based on gene variable ranges is necessary because gene mutation requires a range constraint. This constraint aims to improve efficiency and accuracy. During gene mutation, the mutation must occur within this range. Without this constraint, gene mutations become very divergent. For example, if the standard value is five, then the gene range constraint, say, is within -20 to 20. In this case, gene mutations will occur within this range. Without this range, the gene might be -100, -200, -300, or -400, requiring constant searching, resulting in lower efficiency and accuracy. In other words, gene mutation time would be very slow, and the results might be less than ideal.

[0167] In this embodiment, when the mutation probability value is greater than the preset mutation threshold, mutation operation is performed on each initial population based on the gene variable range.

[0168] It is worth mentioning the mutation operation. The mutation operation is performed on the l-th gene of the i-th chromosome, specifically as follows:

[0169]

[0170] Where a max It is gene a il The upper bound, a min It is gene a il The lower bound is f(g) = r2(1-g / MaxGen). 2r2 is a random number in the range [0,1], g is the current generation number, and r is a random number in the range [0,1].

[0171] The result of the mutation operation is that the i-th chromosome mutates.

[0172] S1334. If the mutation probability value is less than or equal to the preset mutation threshold, then no mutation operation will be performed on each initial population.

[0173] In this embodiment, when the mutation probability value is less than or equal to the preset mutation threshold, the mutation operation is not performed on each initial population, and the process jumps back to S1331.

[0174] It is worth mentioning that this invention employs an adaptive genetic algorithm. In traditional genetic algorithms, the values ​​of Pc and Pm are fixed. This means that both superior individuals (those with lower adaptability) and inferior individuals (those with higher adaptability) undergo crossover and mutation operations with the same probability. In voltage anomaly detection scenarios, this affects the algorithm's convergence speed, ultimately leading to reduced efficiency. Therefore, an adaptive genetic algorithm with adjustable Pc and Pm probabilities is used.

[0175] S134. When the selection operation, crossover operation, and mutation operation reach the preset iteration conditions, determine the corresponding multiple intermediate populations.

[0176] In this embodiment, when the selection, crossover, and mutation operations all meet the preset iteration conditions, the initial population is replaced and filtered through the selection, crossover, and mutation operations, generating multiple intermediate populations.

[0177] It is worth mentioning that the preset iteration condition refers to the adjustment setting of the maximum number of generations in the basic parameters of the initialization improved genetic algorithm to MaxGen.

[0178] Furthermore, S13 may also include the following sub-steps:

[0179] S135. When the selection, crossover, and mutation operations do not meet the preset iteration conditions, the process jumps to the step of performing the selection operation on each initial population in the improved genetic algorithm based on the roulette wheel algorithm and multiple initial fitness values.

[0180] S14. Calculate the target fitness values ​​corresponding to multiple intermediate populations, and select the intermediate population with the minimum target fitness value from the multiple target fitness values ​​as the target population.

[0181] It is worth mentioning that the formula for calculating the target fitness value is the same as the formula for calculating the initial fitness value in S12, and will not be repeated here.

[0182] In this embodiment, the target fitness value of the newly generated intermediate population is recalculated based on the newly generated intermediate population, and then the intermediate population with the smallest target fitness value is selected from all intermediate populations as the target population.

[0183] S15. Use multiple gene values ​​within the target population as multiple target feature quantities.

[0184] In this embodiment, the multiple gene values ​​within the target population at this time are used as multiple target features, and these target features are the optimal solution.

[0185] Step 204: If any target feature quantity is not within the associated preset standard feature range, it is determined that the power quality of the power system under test is abnormal, and the power supply to the associated electrical equipment of the power system under test is stopped.

[0186] In this embodiment, if any target feature quantity is not within the associated preset standard feature range, it is determined that the power quality of the power system under test is abnormal, and the power supply to the electrical equipment associated with the power system under test is stopped.

[0187] Step 205: If all target feature quantities are within the associated preset standard feature range, it is determined that the power quality of the power system to be tested is not abnormal, and power is supplied to the electrical equipment associated with the power system to be tested.

[0188] In this embodiment, if all target feature quantities are within the associated preset standard feature range, it is determined that the power quality of the power system to be tested is not abnormal, and power is supplied to the electrical equipment associated with the power system to be tested.

[0189] like Figure 3As shown, firstly, at least 8 voltage data points are collected according to the set frequency (these 8 data points do not need to be distributed throughout the entire voltage cycle; they can be collected within half a voltage cycle). Based on empirical values, the maximum number of generations (MaxGen), population size (Psize), chromosome length (ChromLen = 4), chromosome mutation probability (Pm), and adaptive constants (K1, K2, K3, and K4) are set. Then, the range of each gene (i.e., each feature) is calculated using an improved genetic algorithm; that is, the gene variable interval. Finally, the fitness value of each population is calculated (for voltage data, fitness is calculated as follows). A lower fit value indicates better performance, as the fit value reflects the accuracy of the calculated x0, x1, x2, x3 values. A lower fit value indicates greater accuracy. The selection operation aims to retain superior populations and replace inferior ones with superior ones. That is, it replaces populations with inaccurate x0, x1, x2, x3 values ​​with more accurate ones. The total population size remains unchanged. The crossover operation and calculation of the adaptive crossover probability (this step aims to allow chromosomes from the two populations to replace and recombine, producing new individuals; it is an important means of obtaining superior individuals) are then performed. The reason for this is that the crossover probability PC in traditional genetic algorithms is fixed after initialization. Both superior and inferior individuals undergo crossover with the same probability, which affects the algorithm's efficiency when calculating the four features. An adaptive algorithm, on the other hand, generates a new crossover probability each time a crossover operation is performed, based on the maximum fitness value and the average fitness value of the root population. This improves the algorithm's convergence speed and makes it more likely to obtain superior individuals. The algorithm also performs mutation operations and calculates adaptive mutation probabilities. (Mutation randomly changes the value of a gene in the population with a mutation probability Pm. The purpose is to ensure population diversity and avoid the loss of some gene information caused by selection and crossover operations. Adaptive mutation probabilities also generate a new mutation probability each time a mutation occurs, making the mutation diversity richer.) The algorithm checks if the number of generations reaches MaxGen. If not, selection, crossover, and mutation operations are repeated until MaxGen is reached. If MaxGen is reached, the evolution ends. The fitness values ​​of the remaining individuals are calculated, and the population with the smallest fitness value is selected. Its gene values ​​are the four features to be solved.

[0190] Specific application scenario examples

[0191] This invention can be specifically applied to power quality monitoring on the user side. For example, to ensure the normal operation of sensitive equipment, factories need to periodically monitor the power distribution points of the power supply system. The power supply voltage for the sensitive equipment is single-phase AC. Its standard expression is:

[0192]

[0193] Since ΔI reflects the offset of the sinusoidal waveform on the coordinate system, that is, whether the coordinate system shifts upward or downward. In factory power supply and distribution, the three elements of power quality are voltage, frequency and phase, so ΔI can be ignored. Among the three elements of power quality, phase refers to (2πft+φ). Since the initial phase φ is fixed, the consideration of phase is based on the consideration of frequency. Therefore, the initial phase φ can be excluded from the scope of power quality anomaly detection. The effective value of the standard supply voltage U is 220V, and the frequency f is 50Hz. Therefore, the expression for the supply voltage of sensitive equipment can be simplified to formula (2).

[0194]

[0195] According to the "Rules for Electricity Supply Business", under normal power system conditions, the allowable deviation of the power supply voltage for electricity users is +7% to -10% of the rated value, that is, the normal power supply voltage range is when the power supply voltage U is between 198 and 235.4V.

[0196] The standard GB / T 15945-1995, "Power Quality - Permissible Frequency Deviation of Power Systems", stipulates that the permissible frequency deviation of power systems is 0.2 Hz, that is, the range of f value is 49.8 to 50.2 Hz.

[0197] Solving for target features using an improved genetic algorithm:

[0198] Periodic initial voltage data points are sampled at the power distribution points of the factory power supply system. For example, if the sampling period is set to 10 seconds, data is sampled and detected every 10 seconds. Each sampling period lasts 10 milliseconds, and one data point is collected every 0.1 milliseconds, for a total of 100 data points, i.e., (t... i ,y i ), i=0,1,2,3,…,99, n=100, as follows Figure 4 As shown.

[0199] Initialize the basic parameters of the improved genetic algorithm and determine the basic parameters of the genetic algorithm process. Set the number of generations for solving the power quality characteristics of the distribution point to MaxGen = 500, the population size to Psize = 50, and since the characteristics to be solved are voltage U and frequency f, the chromosome length ChromLen = 2. Set the chromosome crossover probability to Pc = 0.7 and the mutation probability to Pm = 0.5.

[0200] In traditional genetic algorithms, the value range of each gene X (i.e., the two target features of electrical quality) on a chromosome is set by empirical values. These empirical values ​​are obtained through extensive prior testing and are manually estimated to be optimal. Furthermore, once set, these empirical values ​​cannot be adaptively adjusted according to actual needs. This patent improves upon the traditional empirical value setting method by using an automatic calculation method for the value range of each gene X on a chromosome. The steps of this method are as follows:

[0201] (1) By randomly selecting two sets of data points from the 100 initial voltage data points sampled in the middle (each set of data points includes time t and voltage value u), and substituting the two sets of data points into formula (1) respectively, we obtain two equations, as shown below.

[0202]

[0203] Based on the above formula (3), the two corresponding characteristic quantities can be solved.

[0204] (2) Repeat step (1) N times to obtain N sets of solution values ​​for characteristic quantities U and f.

[0205] (3) Find the minimum and maximum values ​​of each characteristic quantity among the N sets of characteristic quantities obtained, and use this to determine the range of variation of the characteristic quantities. The range of variation for voltage U is [145, 300], and the range of variation for frequency is [40, 55].

[0206] After initialization, each population contains one chromosome, and each chromosome contains two genes (i.e. two features). The value range of each gene X is within the range of the gene variables solved above.

[0207] The fitness value of each initial population is calculated using the function Fit(g):

[0208]

[0209] Where g represents the nth population.

[0210] Determine the encoding method. Since the objects to be solved are U and f, both of which are real numbers, real number encoding is adopted.

[0211] Selection of operation. For the collected voltage data points, the adaptability value (fit) represents the degree of approximation to the solved standard value; a lower fit value indicates greater accuracy. This solution uses the roulette wheel method, with the specific steps as follows:

[0212] (1) In each evolutionary process, the fitness value Fit of each population is first obtained according to the fitness value function (3). i

[0213] (2) Calculate the selection probability P for each population. i P i The larger the value, the higher the probability of it being retained, as shown in formula (4);

[0214] P i =Fit i / (∑Fit) (4)

[0215] pi Fit represents the probability of the i-th population being selected. i Let ∑Fit represent the fitness value of the i-th population, and let ∑Fit be the sum of the fitness values ​​of all populations.

[0216] (3) For each population, first generate a random number dr (dr ranges from 0 to 1), then use dr and P i In comparison, if P i If >dr, it means that the population is preserved; otherwise, the population is randomly replaced by other superior populations.

[0217] Crossover operation. Using real-number crossover, crossover is performed on chromosome a of the i-th population. i and chromosome a of the j-th population j The crossover operation is performed on the l-th gene, specifically as follows:

[0218]

[0219] Where b is a random number in the range [0,1]; i, j, l are all randomly generated, that is, two parent generations are randomly selected, and then a gene is randomly selected, and crossover is performed according to equation (5). The values ​​of i and j are 1 to 50, and the values ​​of l are 0 to 3.

[0220] Mutation operation. A mutation operation is performed on the l-th gene of the i-th chromosome, specifically...

[0221]

[0222] Where a max It is gene a il The upper bound, a min It is gene a il The lower bound is f(g) = r2(1-g / MaxGen). 2 r2 is a random number in the range [0,1], g is the current generation number, and r is a random number in the range [0,1].

[0223] Crossover and mutation operations are performed based on the crossover probability Pc and mutation probability Pm, respectively. Before each operation, a random number r is generated, ranging from [0,1]. When P(Pc or Pm) > r, crossover or mutation is performed. In traditional genetic algorithms, the values ​​of Pc and Pm are initially set to 0.7 and 0.5, respectively, and remain fixed throughout the algorithm's computation. This results in both superior individuals (lower adaptability) and inferior individuals (higher adaptability) undergoing crossover and mutation operations with the same probability. In voltage anomaly detection scenarios, this affects the algorithm's convergence speed, ultimately reducing its efficiency. Therefore, a genetic algorithm using adaptive Pc and Pm probabilities is adopted. The formula for calculating the adaptive Pc and Pm crossover probabilities is as follows:

[0224]

[0225] Among them, f max f is the maximum fitness value in the population. avg is the average fitness value of the population, f is the larger fitness value of the two individuals to be crossed, f' is the fitness value of the individual to be mutated, and k1, k2, k3, k4 are empirical constants. It is recommended that k1, k2, k3, k4 be 1, 0.5, 1, 0.5 respectively.

[0226] Two target features are determined. Following the steps above, the parameters of the genetic algorithm are first set, and then iterative operations of selection, crossover, and mutation are performed. The number of operations is MaxGen = 500 generations. After 500 iterations, the remaining population is the superior population. Finally, the fitness value (fit) of each population is calculated, and the population with the lowest fitness value (fit) is selected. The two gene values ​​of this population are the two target features. The two target features are 227V and 50.02Hz.

[0227] Determining whether power quality meets requirements is crucial. For sensitive electrical equipment in factory workshops, deviations in voltage and frequency can lead to reduced equipment performance and substandard product quality. Therefore, when either voltage or frequency exceeds a threshold, the power supply quality can be considered abnormal.

[0228] In this example, the calculated voltage value is 227V, which deviates from the standard value of 220V by 7V, and is a normal power supply voltage.

[0229] The calculated frequency value is 50.02Hz, which is within the allowable range of frequency deviation, so the frequency is normal.

[0230] Since both voltage and frequency values ​​are within the normal range, the power quality can be considered to meet the requirements.

[0231] In this embodiment of the invention, in response to a received power quality detection request, the power system to be detected corresponding to the power quality detection request is determined. Multiple initial voltage waveform data points of the distribution points associated with the power system to be detected within a preset time period are acquired. Based on an improved genetic algorithm, multiple target feature quantities corresponding to the power system to be detected are calculated using these multiple initial voltage waveform data points. Based on the comparison results between each target feature quantity and its associated preset standard feature interval, it is determined whether the power quality of the power system to be detected is abnormal. This solves the technical problem that existing algorithms do not comprehensively cover all issues affecting power quality, but only detect single issues affecting power quality, which can lead to production interruptions and equipment damage, thus affecting production and causing huge economic losses to factories. By improving the automatic calculation method in the genetic algorithm, the traditional method of setting gene value ranges based on empirical values ​​is overcome. Furthermore, by directly solving for voltage feature quantities to determine whether the voltage is abnormal, the invention overcomes the problem of existing methods having no solution, thus ensuring that there is an absolute solution.

[0232] Please see Figure 5 , Figure 5 This is a structural block diagram of a power system power quality detection device provided in Embodiment 3 of the present invention.

[0233] This invention provides a power system power quality detection device, comprising:

[0234] The response module 301 is used to respond to the received power quality detection request and determine the power system to be detected corresponding to the power quality detection request.

[0235] The initial voltage waveform data point module 302 is used to acquire multiple initial voltage waveform data points of the distribution point associated with the power system to be detected within a preset time period.

[0236] The target feature module 303 is used to calculate multiple target features of the power system under test based on an improved genetic algorithm and multiple initial voltage waveform data points.

[0237] The data processing module 304 is used to determine whether the power quality of the power system to be detected is abnormal based on the comparison results between each target feature quantity and its associated preset standard feature interval.

[0238] Optionally, the target feature module 303 includes:

[0239] The gene variable interval submodule is used to initialize the basic parameters of the improved genetic algorithm and calculate the corresponding multiple gene variable intervals using multiple initial voltage waveform data points.

[0240] The encoding method submodule is used to calculate the initial fitness value corresponding to each initial population in the improved genetic algorithm based on the number of data points of the initial voltage waveform data points, and to determine the corresponding encoding method.

[0241] The intermediate population submodule is used to perform genetic operations on each initial population in the improved genetic algorithm based on multiple initial fitness values ​​and multiple gene variable ranges, and to determine the corresponding multiple intermediate populations.

[0242] The target population submodule is used to calculate the target fitness values ​​corresponding to multiple intermediate populations, and select the intermediate population associated with the minimum target fitness value from the multiple target fitness values ​​as the target population.

[0243] The target feature determination submodule is used to use multiple gene values ​​within the target population as multiple target features.

[0244] Optionally, the gene variable interval submodule includes:

[0245] The initialization unit is used to initialize the basic parameters of the improved genetic algorithm.

[0246] The target voltage waveform data point unit is used to arbitrarily select a preset number of initial voltage waveform data points from multiple initial voltage waveform data points as target voltage waveform data points.

[0247] The gene variable unit is used to generate multiple sets of gene variables by taking the sinusoidal voltage function as input from each target voltage waveform data point.

[0248] The gene variable interval determination unit is used to select the maximum and minimum values ​​of the gene variables from each group of gene variables as the two endpoints of the variable interval, thereby determining multiple gene variable intervals.

[0249] Optionally, genetic operations include selection, crossover, and mutation operations, and the intermediate population submodule includes:

[0250] The selection operation unit is used to perform selection operations on each initial population in the improved genetic algorithm based on the roulette wheel algorithm and multiple initial fitness values.

[0251] The crossover operation unit is used to calculate the crossover probability value using multiple initial fitness values, and to perform the crossover operation on each initial population based on the comparison result of the crossover probability value and the associated preset crossover threshold.

[0252] The mutation operation unit is used to calculate the mutation probability value based on multiple gene variable ranges and multiple initial fitness values, and to perform mutation operation on each initial population according to the comparison result of the mutation probability value and the associated preset mutation threshold.

[0253] The intermediate population determination unit is used to determine multiple corresponding intermediate populations when the selection operation, crossover operation, and mutation operation reach the preset iteration conditions.

[0254] Optionally, the selection operation unit includes:

[0255] The fitness and value sub-unit is used to calculate the sum of all initial fitness values ​​and generate the fitness and value.

[0256] The selection probability value subunit is used to calculate the ratio between the initial fitness value and the sum of fitness values ​​associated with each initial population, and to generate selection probability values ​​corresponding to multiple initial populations.

[0257] The selection probability value comparison subunit is used to compare each selection probability value with a preset standard probability value.

[0258] The first comparison subunit is used to retain the initial population associated with the selection probability value if the selection probability value is greater than the preset standard probability value.

[0259] The second comparison subunit is used to replace the initial population associated with the selection probability value if the selection probability value is less than or equal to the preset standard probability value.

[0260] Optionally, the cross-operation unit includes:

[0261] The crossover probability value sub-unit is used to generate corresponding crossover probability values ​​by inputting multiple initial fitness values ​​into the preset crossover probability value function model.

[0262] The cross probability value comparison subunit is used to compare the cross probability value with the associated preset cross threshold.

[0263] The third comparison subunit is used to perform crossover operations on each initial population if the crossover probability value is greater than a preset crossover threshold.

[0264] The fourth comparison subunit is used to prevent crossover operations from being performed on each initial population if the crossover probability value is less than or equal to a preset crossover threshold.

[0265] Optionally, the mutation operation unit includes:

[0266] The mutation probability value sub-unit is used to generate corresponding mutation probability values ​​by inputting multiple initial fitness values ​​into the preset mutation probability value function model.

[0267] The mutation probability value comparison subunit is used to compare the mutation probability value with the associated preset mutation threshold.

[0268] The fifth comparison subunit is used to perform mutation operations on each initial population based on the gene variable range if the mutation probability value is greater than the preset mutation threshold.

[0269] The sixth comparison subunit is used to prevent mutation operations from being performed on each initial population if the mutation probability value is less than or equal to a preset mutation threshold.

[0270] Optionally, the data processing module 304 includes:

[0271] The first judgment submodule is used to determine that the power quality of the power system under test is abnormal if any target feature quantity is not within the associated preset standard feature range, and to stop supplying power to the electrical equipment associated with the power system under test.

[0272] The second judgment submodule is used to determine that the power quality of the power system under test is not abnormal if all target feature quantities are within the associated preset standard feature range, and to transmit power to the electrical equipment associated with the power system under test.

[0273] In this embodiment of the invention, in response to a received power quality detection request, the power system to be detected corresponding to the power quality detection request is determined. Multiple initial voltage waveform data points of the distribution points associated with the power system to be detected within a preset time period are acquired. Based on an improved genetic algorithm, multiple target feature quantities corresponding to the power system to be detected are calculated using these multiple initial voltage waveform data points. Based on the comparison results between each target feature quantity and its associated preset standard feature interval, it is determined whether the power quality of the power system to be detected is abnormal. This solves the technical problem that existing algorithms do not comprehensively cover all issues affecting power quality, but only detect single issues affecting power quality, which can lead to production interruptions and equipment damage, thus affecting production and causing huge economic losses to factories. By improving the automatic calculation method in the genetic algorithm, the traditional method of setting gene value ranges based on empirical values ​​is overcome. Furthermore, by directly solving for voltage feature quantities to determine whether the voltage is abnormal, the invention overcomes the problem of existing methods having no solution, thus ensuring that there is an absolute solution.

[0274] An electronic device according to an embodiment of the present invention includes: a memory and a processor, wherein the memory stores a computer program; when the computer program is executed by the processor, the processor performs a power system power quality detection method as described in any of the above embodiments.

[0275] The memory can be an electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read-Only Memory), EPROM, hard disk, or ROM. The memory has storage space for program code used to perform any of the method steps described above. For example, the storage space for program code may include individual program codes for implementing the various steps in the methods described above. This program code can be read from or written to one or more computer program products. These computer program products include program code carriers such as hard disks, compact discs (CDs), memory cards, or floppy disks. The program code may be compressed, for example, in a suitable form. When run by a computing processing device, this code causes the computing processing device to perform the various steps in the methods described above.

[0276] Those skilled in the art will clearly 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.

[0277] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection between apparatuses or units through some interfaces, and may be electrical, mechanical, or other forms.

[0278] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0279] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0280] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for detecting power quality in a power system, characterized in that, include: In response to a received power quality detection request, determine the power system to be detected corresponding to the power quality detection request; Acquire multiple initial voltage waveform data points of the distribution point associated with the power system to be detected within a preset time period; Based on the improved genetic algorithm, multiple target feature quantities corresponding to the power system under test are calculated using multiple initial voltage waveform data points; The step of calculating multiple target feature quantities corresponding to the power system under test based on an improved genetic algorithm using multiple initial voltage waveform data points includes: The basic parameters of the improved genetic algorithm are initialized, and multiple gene variable intervals are calculated using multiple initial voltage waveform data points. Based on the number of data points in the initial voltage waveform data points, calculate the initial fitness value corresponding to each initial population in the improved genetic algorithm, and determine the corresponding encoding method; Based on the multiple initial fitness values ​​and the multiple gene variable intervals, genetic operations are performed on each of the initial populations in the improved genetic algorithm to determine the corresponding multiple intermediate populations; Calculate the target fitness values ​​corresponding to multiple intermediate populations, and select the intermediate population associated with the minimum value from the multiple target fitness values ​​as the target population; Multiple gene values ​​within the target population are used as multiple target feature quantities; The steps of initializing the basic parameters of the improved genetic algorithm and calculating the corresponding multiple gene variable intervals using multiple initial voltage waveform data points include: Initialize the basic parameters of the improved genetic algorithm; A predetermined number of initial voltage waveform data points are arbitrarily selected from a plurality of initial voltage waveform data points as target voltage waveform data points; Multiple sets of gene variables are generated by inputting sinusoidal voltage functions with the target voltage waveform data points described above. From each group of gene variables, the maximum and minimum values ​​of the gene variables are selected as the two endpoints of the variable interval to determine multiple gene variable intervals; Based on the comparison results between each of the target feature quantities and its associated preset standard feature interval, it is determined whether the power quality of the power system to be detected is abnormal.

2. The power system power quality detection method according to claim 1, characterized in that, The genetic operations include selection, crossover, and mutation. The step of performing genetic operations on each initial population within the improved genetic algorithm based on multiple initial fitness values ​​and multiple gene variable intervals to determine corresponding intermediate populations includes: Based on the roulette wheel algorithm, the selection operation is performed on each of the initial populations in the improved genetic algorithm according to multiple initial fitness values; The crossover probability value is calculated using multiple initial fitness values, and the crossover operation is performed on each of the initial populations based on the comparison result between the crossover probability value and the associated preset crossover threshold. Based on multiple gene variable intervals, a mutation probability value is calculated using multiple initial fitness values, and the mutation operation is performed on each initial population according to the comparison result of the mutation probability value and the associated preset mutation threshold. When the selection operation, the crossover operation, and the mutation operation reach the preset iteration conditions, the corresponding multiple intermediate populations are determined.

3. The power system power quality detection method according to claim 2, characterized in that, The step of performing the selection operation on each initial population within the improved genetic algorithm based on the roulette wheel algorithm according to multiple initial fitness values ​​includes: Calculate the sum of all the initial fitness values ​​to generate a fitness sum value; Calculate the ratio between the initial fitness value associated with each initial population and the sum of fitness values ​​to generate selection probability values ​​corresponding to multiple initial populations; Compare the selected probability values ​​with the preset standard probability values; If the selection probability value is greater than the preset standard probability value, then the initial population associated with the selection probability value will be retained; If the selection probability value is less than or equal to the preset standard probability value, then the initial population associated with the selection probability value is replaced.

4. The power system power quality detection method according to claim 2, characterized in that, The step of calculating a crossover probability value using multiple initial fitness values, and performing the crossover operation on each of the initial populations based on the comparison result of the crossover probability value and an associated preset crossover threshold, includes: Multiple initial fitness values ​​are input into a preset crossover probability value function model to generate corresponding crossover probability values; Compare the crossover probability value with the associated preset crossover threshold; If the crossover probability value is greater than the preset crossover threshold, then the crossover operation is performed on each of the initial populations; If the crossover probability value is less than or equal to the preset crossover threshold, then the crossover operation is not performed on each of the initial populations.

5. The power system power quality detection method according to claim 2, characterized in that, The steps of calculating mutation probability values ​​based on multiple gene variable intervals and multiple initial fitness values, and performing mutation operations on each of the initial populations according to the comparison results of the mutation probability values ​​and associated preset mutation thresholds, include: The initial fitness values ​​are input into a preset mutation probability value function model to generate corresponding mutation probability values. Compare the mutation probability value with the associated preset mutation threshold; If the mutation probability value is greater than the preset mutation threshold, then the mutation operation is performed on each of the initial populations based on the gene variable range; If the mutation probability value is less than or equal to the preset mutation threshold, then the mutation operation is not performed on each of the initial populations.

6. The power system power quality detection method according to claim 1, characterized in that, The step of determining whether the power quality of the power system to be detected is abnormal based on the comparison results between each of the target feature quantities and its associated preset standard feature intervals includes: If any of the target feature quantities is not within the associated preset standard feature range, it is determined that the power quality of the power system under test is abnormal, and the power supply to the electrical equipment associated with the power system under test is stopped. If all the target feature quantities are within the associated preset standard feature range, it is determined that the power quality of the power system to be tested is not abnormal, and power is supplied to the electrical equipment associated with the power system to be tested.

7. A power system power quality detection device, characterized in that, The power system power quality detection device is used to implement the power system power quality detection method as described in any one of claims 1-6, and the power system power quality detection device includes: A response module is used to respond to a received power quality detection request and determine the power system to be detected corresponding to the power quality detection request. The initial voltage waveform data point module is used to acquire multiple initial voltage waveform data points of the distribution point associated with the power system to be detected within a preset time period; The target feature module is used to calculate multiple target features of the power system under test based on an improved genetic algorithm using multiple initial voltage waveform data points. The data processing module is used to determine whether the power quality of the power system to be detected is abnormal based on the comparison results between each of the target feature quantities and its associated preset standard feature intervals.

8. An electronic device, characterized in that, The device includes a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor causes the processor to perform the steps of the power system power quality detection method as described in any one of claims 1-6.