A method for detecting and identifying power quality disturbances based on quantum variational algorithm

By processing power quality disturbance signals through the quantum variational algorithm, the problems of insufficient window resolution and low computational efficiency in the existing technology are solved, and efficient and accurate detection and identification of power quality disturbances are achieved, supporting fault handling.

CN120145101BActive Publication Date: 2025-09-09NORTH CHINA ELECTRIC POWER UNIV +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510092542.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-21
Publication Date
2025-09-09
Estimated Expiration
2045-01-21

AI Technical Summary

Technical Problem

Existing power quality disturbance detection methods have insufficient window resolution when processing non-stationary signals, and machine learning algorithms have insufficient computing speed and efficiency in power quality disturbance detection and identification, making it difficult to achieve accurate detection and time positioning.

Method used

A power quality disturbance detection method based on quantum variational algorithm is adopted to process power quality disturbance signals through the parallelism of quantum computing and quantum bit entanglement, including signal simulation, feature extraction, dimensionality reduction, quantum feature mapping, parameterized quantum circuit and second-order moment estimation to update parameters, so as to achieve accurate detection, identification and time positioning.

Benefits of technology

The calculation speed and efficiency of power quality disturbance detection are improved, achieving higher convergence speed and more accurate detection and identification effects, supporting subsequent problem location and fault handling.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120145101B_ABST
    Figure CN120145101B_ABST
Patent Text Reader

Abstract

The present invention relates to a method for detecting and identifying power quality disturbances based on hybrid classical quantum machine learning, comprising the following steps: S1: performing power quality signal simulation, feature extraction and data preprocessing through a preprocessing module; S2: distinguishing data with power quality disturbances from normal data through a power quality disturbance detection model; S3: identifying the specific type of disturbance in the data with power quality disturbances through a power quality disturbance identification model; S4: determining the start time, duration and end time of the disturbance based on the output result of the power quality disturbance identification model through a power quality disturbance time positioning model. The proposal of the present invention is an active exploration of quantum information science in the field of power quality disturbance detection and identification, and also provides a new opportunity for the application of quantum solutions in future power grids.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of electrical information technology, and in particular to a method for detecting and identifying power quality disturbances based on a quantum variational algorithm. Background Art

[0002] Power quality monitoring is a key tool for assessing power quality in power systems. It not only monitors voltage and current waveforms but also identifies harmonics, voltage sags, and voltage flicker. Power quality monitoring is crucial in today's power infrastructure, helping consumers and utility companies quickly identify and resolve power quality issues, thereby improving power system efficiency and reliability. In the industrial sector, for example, power quality monitoring helps factories monitor and record various disturbances. Power quality monitoring devices can be used at multiple points throughout the electrical infrastructure, or at the load level, to provide a comprehensive understanding of the power quality delivered to each load. Power quality monitoring is also crucial for data center management, helping to prevent losses caused by power outages. Power quality monitoring plays a key role in improving energy availability and reducing maintenance costs.

[0003] Power quality detection methods rely on time-domain and frequency-domain analysis methods and machine learning approaches. Detecting power quality disturbances involves two steps: feature extraction and classification of power quality disturbance signals. Feature extraction utilizes power quality indices such as frequency deviation, flicker, and voltage variation, and uses various signal processing algorithms to derive disturbance signatures. In recent years, signal analysis methods such as wavelet transforms, S transforms, Hilbert-Huang transforms, and Fourier transforms have been widely used in the field of power quality disturbance location and detection. The Fourier transform can obtain frequency domain information from time-domain signals, but it is only suitable for stationary, continuous signals. To address these issues, researchers have introduced time windows, resulting in the short-time Fourier transform (STFT), which is used to process non-stationary signals. However, the algorithm's fixed window size makes the window resolution insufficient for detecting non-stationary signals with varying frequencies. The wavelet transform overcomes the shortcomings of the STFT and is suitable for non-stationary disturbance signals, but its accuracy depends on the selected base wavelet and decomposition scale. The Hilbert-Huang transform is suitable for non-stationary or sudden change signals and has good results for complex non-stationary signals. However, it can suffer from severe endpoint effects, is prone to modal aliasing, and has poor noise immunity. The S transform uses a scalable, unique Gaussian window, offering finer resolution and more intuitive detection results.

[0004] After extracting the features of the power quality disturbance signal, a mapping relationship needs to be established from the space composed of the features to the space composed of the signal labels. The process of establishing this mapping relationship is the process of training the classification algorithm using the extracted features. Currently, algorithms used for power quality disturbance detection and identification mainly include those based on decision trees, neural networks, support vector machines, and deep learning.

[0005] With the development of quantum machine learning algorithms, we realize the unlimited potential of quantum algorithms in the application of power grids. To this end, this paper proposes a power quality disturbance detection and identification method based on quantum variational algorithm to solve the detection, classification and time positioning problems of power quality disturbances. Summary of the Invention

[0006] The purpose of this invention is to propose a method for detecting and identifying power quality disturbances based on a quantum variational algorithm. This method leverages the parallelism of quantum computing and the entanglement between qubits to effectively process power quality disturbance signals, achieving precise detection, identification, and temporal localization for subsequent problem location and troubleshooting. Compared to existing machine learning methods, this method offers advantages in computational speed, convergence rate, and efficiency.

[0007] To achieve the above object, the present invention provides the following solutions:

[0008] A method for detecting and identifying power quality disturbances based on a quantum variational algorithm comprises the following steps:

[0009] S1: Through the preprocessing module, power quality signal simulation, feature extraction and normalization are performed;

[0010] S2: Distinguish between data with power quality disturbances and normal data through a power quality disturbance detection model; the detection model includes: data dimensionality reduction, quantum feature mapping, parameterized quantum circuits, and second-order moment estimation to update parameters;

[0011] S3: Identify the specific type of disturbance in the data containing power quality disturbances through a power quality disturbance identification model; the identification model includes: data dimensionality increase, quantum feature mapping, parameterized quantum circuits, and second-order moment estimation to update parameters;

[0012] S4: Determine the start time, duration and end time of the disturbance according to the output results of the power quality disturbance identification model through the power quality disturbance time location model.

[0013] Optionally, in step S1, the power quality signal simulation method is:

[0014] Power quality disturbance data was generated using a simulation environment based on the IEEE Std 1159-2019 standard. The fundamental frequency of the disturbance model was 50 Hz. The generated power quality disturbance signals included:

[0015] The simulated power quality disturbances include 1 normal power quality fluctuation, 7 single power quality disturbances, and 9 composite power quality disturbances. The normal power quality disturbance signal includes: D0: normal power quality signal; the single power quality disturbance signal includes: D1: harmonics, D2: voltage sag, D3: voltage swell, D4: voltage interruption, D5: voltage flicker, D6: transient oscillation, D7: transient pulse; the composite power quality disturbance signal includes: D8: harmonics + voltage sag, D9: harmonics + voltage swell, D10: harmonics + voltage interruption, D11: harmonics + transient oscillation, D12: harmonics + transient pulse, D13: voltage sag + transient oscillation, D14: voltage sag + transient pulse, D15: voltage interruption + transient oscillation, D16: voltage interruption + transient pulse.

[0016] Preferably, in step S1, the power quality disturbance characteristics include:

[0017] F1: The proportion of the portion of the fundamental amplitude-time curve greater than 1.02 pu in the entire detection time; F2: The proportion of the portion of the fundamental amplitude-time curve less than 0.98 pu in the entire detection time; F3: The proportion of the portion of the fundamental amplitude-time curve less than 0.15 pu in the entire detection time; F4: The sum of the skewness of the low-order harmonics; F5: The sum of the skewness of the medium-order harmonics; F6: The sum of the standard deviations of the medium-order harmonics; F7: The sum of the kurtosis of the high-order harmonics; F8: The sum of the standard deviations of the high-order harmonics; F9: The average value of the total harmonic distortion rate.

[0018] Optionally, in step S1, the power quality signal feature extraction method is:

[0019] S transform. The S transform can be expressed as:

[0020]

[0021] S(τ,f) represents the result of S transformation, t is time, f is frequency, τ is the parameter that controls the time axis position of the Gaussian window, e -2πift is a complex function representing a complex exponential signal with frequency f.

[0022] Preferably, in step S1, the normalization process is performed as follows:

[0023] The data after feature extraction is mapped to the range between -π and π, with a mean of 0. This is shown in the following formula:

[0024]

[0025] In this process, X i Indicates the data of the column corresponding to the corresponding feature, Indicates the average value of the original column of data.

[0026] Preferably, in step S2, the method of data dimensionality reduction is:

[0027] First, the covariance matrix of the preprocessed power quality disturbance characteristics is calculated; the covariance matrix is ​​subjected to singular value decomposition to obtain a set of decomposed eigenvalues; the decomposed eigenvalues ​​are sorted from large to small, and the eigenvectors corresponding to the first several eigenvalues ​​are taken as the features after dimensionality reduction.

[0028] The steps to reduce the dimension of power quality disturbance data to n-dimension are as follows:

[0029] X is the normalized data, a is the number of samples, and the data point x i In the orthogonal basis u j The projection distance on The mean of the data in the previous processing is 0, that is, x center = 0. The variance of all data projected on this basis is Var j , as shown in the formula:

[0030]

[0031] The covariance matrix of X is recorded as S, as shown in the formula:

[0032]

[0033] Perform singular value decomposition (SVD) on the covariance matrix S, as shown in the formula:

[0034]

[0035] Among them, the column vectors of U and V are orthogonal to each other and have a modulus of 1. The covariance matrix S can also be decomposed into eigenvalues, so U is the set of new coordinates and μ is the set of eigenvalues. Then sort the eigenvalues ​​from large to small and take the eigenvectors corresponding to the first n eigenvalues ​​as the n new orthogonal bases {u1,u2,…,u n}, as the data after dimensionality reduction.

[0036] Preferably, in step S2, the method of the first quantum feature mapping is:

[0037] The first quantum coding circuit is used for feature mapping. The construction method of the first quantum coding circuit is as follows:

[0038] After the first quantum feature mapping, the reduced-dimensional classical data is encoded into the quantum bits. The first quantum encoding circuit consists of the following components:

[0039] Hadamard gate, phase gate RZ gate, controlled rotation gate CNOT gate; the number of quantum bits used in the first quantum coding circuit is the data dimension n after dimensionality reduction, and n is 2 in the application. The circuit structure of the first quantum coding circuit is:

[0040] Set all qubits to the initial state |0>; after each qubit passes through the Hadamard gate, the quantum state becomes a superposition state, as described by the formula below:

[0041]

[0042] Each qubit is passed through a phase gate, an RZ gate, to encode classical data into a quantum state. The parameter of the RZ gate is the data to be encoded. After passing through the RZ gate, the classical data is encoded into the quantum state. The physical meaning of the RZ gate is to rotate the qubit around the Z axis by a specified angle. The definition of the RZ gate is shown in the following formula, where θ represents the rotation angle around the Z axis:

[0043]

[0044] Finally, by adding a controlled rotation gate CNOT gate to each qubit in turn, the conditional flip between qubits is achieved. The role of the CNOT gate is to introduce entanglement between qubits. Its matrix representation is:

[0045]

[0046] The logic for adding the CNOT gate is:

[0047] Starting from the first quantum bit to the last quantum bit, controlled rotation gates (CNOT gates) are added in sequence: the previous quantum bit controls the conditional flipping of the next quantum bit, and the last quantum bit controls the conditional flipping of the first quantum bit.

[0048] Preferably, in step S2, the method for constructing the first parameterized quantum circuit is:

[0049] The first parameterized circuit consists of two identical cells connected front and back.

[0050] Optionally, each cell is constructed as follows:

[0051] Each cell uses 2 qubits, and a cell uses n G gates and 2n CNOT gates, where n is the number of qubits. In the first parameterized quantum circuit, n is 2. Each qubit is connected to a G gate, which is described by the following formula:

[0052]

[0053] Among them, α, β, and γ are all learnable parameters. The three parameters are used to describe the arbitrary rotation of the quantum bit on the Bloch sphere. α represents the amplitude, β and γ represent the two phase angles, i represents the imaginary number, and e iβ Euler's formula can be written as e iβ = cosβ + isinβ, which links the polar coordinate representation of complex numbers with trigonometric functions, e iγ The meaning of e iβ Same; each G gate contains three learnable parameters α, β, γ, which represent the rotation of the quantum bit around the x, y, and z axes on the Bloch sphere, and the initial parameters are randomly generated.

[0054] Then add the CNOT gate. The logic of adding the CNOT gate is: starting from the first quantum bit to the last quantum bit, add the controlled rotation gate CNOT gate in sequence: the previous quantum bit controls the conditional flipping of the next quantum bit, and the last quantum bit controls the conditional flipping of the first quantum bit.

[0055] Preferably, in step S2, the method for updating the parameters by second-order moment estimation is:

[0056] First, through quantum measurement, the quantum state after parameterized quantum circuit training is converted into classical data. The measurement method is:

[0057] Using the Pauli Z measurement for each qubit, we first construct the measurement Hamiltonian Hz, as shown in the following formula:

[0058]

[0059] The result of quantum measurement is e, which represents the expected energy after the quantum state measurement, as shown in the following formula:

[0060] e=<ψ′(X)|H z |ψ′(X)>

[0061] Here, |ψ′(X)> represents the quantum state after parameterized circuit training.

[0062] Secondly, the parameters are updated through second-order moment estimation. The parameter update method is as follows:

[0063] The parameter optimization goal is to find θ in the first parameterized quantum circuit to minimize the expected energy value; where θ represents the trainable parameter in the parameterized quantum circuit.

[0064] The model uses the Softmax cross entropy loss function commonly used in multi-classification tasks. First, the expected measurement value of the measured quantum circuit is calculated, denoted as E. Then the gradient is calculated. The gradient calculation formula is as follows:

[0065]

[0066] Next, calculate the first momentum matrix, denoted as v, and the second momentum matrix, denoted as m. The parameter update is shown in the following formula:

[0067]

[0068] Here, η represents the learning rate and t represents the time step.

[0069] Preferably, in step S3, the method of data dimension upgrading is:

[0070] Use the autoencoder to increase the dimension. The construction method of the autoencoder is:

[0071] The autoencoder includes an encoder and a decoder. The encoder receives the power quality disturbance features of the initial dimension and is connected to several hidden layers in sequence, each of which is followed by a Relu activation function. The decoder receives the output of the hidden layer as input and is connected to several hidden layers in sequence, each of which is followed by a Relu activation function.

[0072] The optimization goal of the autoencoder is to minimize the difference between the result and the input value. The loss function uses the mean square error and the optimizer uses the Adam optimizer.

[0073] Preferably, in step S3, the second quantum feature mapping method is:

[0074] The second quantum coding circuit is used to perform feature mapping and encode the dimension-upgraded data onto quantum bits. The construction method of the second quantum coding circuit is as follows:

[0075] The second quantum coding circuit includes: a Hadamard gate, a phase gate RZ gate, and a controlled rotation gate CNOT gate; the number of quantum bits used in the second quantum coding circuit is the data dimension n after dimensionality increase, and in this application, n is 16.

[0076] The circuit structure construction method of the second quantum coding circuit is:

[0077] The circuit construction method is the same as that of the first quantum coding circuit, so I will not go into details.

[0078] Preferably, in step S3, the second parameterized quantum circuit is constructed by:

[0079] The second parameterized circuit consists of 6 identical cells connected front and back.

[0080] Optionally, each cell is constructed as follows:

[0081] The cell construction method is similar to that of the first parameterized quantum circuit, so I will not elaborate on it in detail. The difference lies in the number of quantum bits n, which is set to 16 here.

[0082] Preferably, in step S3, the method for updating the parameters by second-order moment estimation is:

[0083] The method for updating parameters by estimating the second-order moment in step S2 is similar and will not be described in detail here. The difference lies in the number of qubits n, which is set to 16 here.

[0084] Preferably, in step S4, the power quality disturbance time location method is:

[0085] According to the identification results of each power quality disturbance sequence by the power quality disturbance identification model, the disturbance type of the current time step is compared with the type of the previous time step to determine whether the disturbance type has changed. If the disturbance type has not changed, the next time step is processed. When a change in the disturbance type is detected, the start and end time of the disturbance is recorded, and the occurrence range of the disturbance event is marked.

[0086] The present invention also proposes a power quality disturbance detection and identification system based on quantum variational algorithm, comprising:

[0087] A1: Signal extraction module, used to extract the fluctuation signal in power quality; A2: Preprocessing module, uses S transform to extract features of the fluctuation signal and preprocesses the extracted feature data; A3: Power quality disturbance detection module, reduces the dimension of the feature data, and uses the power quality disturbance detection model to detect whether there is power quality disturbance in the power quality fluctuation signal; A4: Power quality disturbance identification module, increases the dimension of the feature data, and determines the type of disturbance for the power quality fluctuation signal with disturbance; A5: Time positioning module, determines the start and end time and duration of the specific power quality disturbance based on the results of the power quality disturbance identification model; A6: Data storage module, records power quality fluctuation data, feature data, power quality disturbance type and the start and end time and duration of the disturbance.

[0088] The beneficial effects of the present invention are:

[0089] The present invention uses an emerging quantum machine learning algorithm and applies it to the field of power quality disturbances. It proposes a power quality disturbance detection and identification method based on a quantum variational algorithm. First, the power quality fluctuation signal to be detected is simulated, and then the signal is feature extracted and preprocessed to obtain power quality disturbance data. Then, the power quality disturbance data to be detected is input into the power quality disturbance detection model to determine whether there is a power quality disturbance. Then, the data determined to have a power quality disturbance is input into the power quality disturbance identification model to obtain the type of disturbance. Among them, the power quality disturbance detection model and the power quality disturbance identification module are both constructed based on the quantum variational algorithm method. Finally, based on the identification results of the power quality disturbance identification module, the start and end time and duration of the power quality disturbance are determined. The present invention utilizes the parallelism of quantitative calculations and the entanglement between quantum bits, so that the model can effectively process power quality disturbance signals when facing power quality disturbance problems, achieve accurate detection and identification, and facilitate subsequent problem location and fault handling. Compared with existing machine learning methods, it has the advantages of higher computing speed, convergence speed, and computing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0090] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0091] Figure 1 This is a flow chart of a method for detecting and identifying power quality disturbances based on a quantum variational algorithm according to an embodiment of the present invention;

[0092] Figure 2 This is a schematic diagram of a first quantum coding circuit of a power quality disturbance detection model according to an embodiment of the present invention;

[0093] Figure 3 Schematic diagram of a first parameterized electronic circuit of a power quality disturbance detection model according to an embodiment of the present invention;

[0094] Figure 4 This is a schematic diagram of the second quantum coding circuit of the power quality disturbance identification model according to an embodiment of the present invention;

[0095] Figure 5 Schematic diagram of the structure of a single Cell in the second parameterized quantum circuit according to an embodiment of the present invention;

[0096] Figure 6 Schematic diagram of an autoencoder for a power quality disturbance identification model according to an embodiment of the present invention;

[0097] Figure 7This is a flow chart of the time location of power quality disturbances according to an embodiment of the present invention. DETAILED DESCRIPTION

[0098] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.

[0099] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.

[0100] Example 1:

[0101] A method for detecting and identifying power quality disturbances based on quantum variational algorithm.

[0102] The flow chart of the embodiment is as follows Figure 1 As shown. This embodiment simulates normal power quality fluctuations and power quality data containing disturbances according to the IEEE Std 1159-2019 standard. Nine power quality features are designed to extract and preprocess the simulated power quality fluctuations. Then, the power quality detection model is used to first perform dimensionality reduction on the preprocessed data, reducing the data of 9 feature dimensions to data of 2 feature dimensions, and then the quantum variation algorithm is used to train the model. For the data containing power quality disturbances, the power quality disturbance identification model is used to first perform dimensionality increase on the preprocessed data, increasing the data of 9 feature dimensions to data of 16 feature dimensions, and then the quantum variation algorithm is used to train the model. Finally, the power quality disturbance time location model is used to divide the time when the disturbance occurs according to the results of the power quality disturbance identification model.

[0103] The embodiment includes the following modules: S1: pre-processing module; S2: power quality disturbance detection module; S3: power quality disturbance identification module; S4: power quality disturbance time location module.

[0104] A further embodiment is:

[0105] In step S1, according to the definition of the Institute of Electrical and Electronics Engineers Standardization Coordinating Committee in the international standard for power quality IEEE 1159-2019, 17 types of power quality fluctuations are simulated, including: 1 normal power quality fluctuation, 7 single power quality disturbances, and 9 composite power quality disturbances.

[0106] Among them, the simulation of 7 single power quality disturbances includes:

[0107] D1: harmonics; D2: voltage sag; D3: voltage swell; D4: voltage interruption; D5: voltage flicker; D6: transient oscillation; D7: transient pulse.

[0108] The basis for the seven single simulated power quality disturbances is shown in Table 1 below:

[0109] Table 1 Seven types of single power quality disturbances

[0110]

[0111] This embodiment also constructs 9 types of composite power quality disturbances, namely D8: harmonics + voltage sag, D9: harmonics + voltage swell, D10: harmonics + voltage interruption, D11: harmonics + transient oscillation, D12: harmonics + transient pulse, D13: voltage sag + transient oscillation, D14: voltage sag + transient pulse, D15: voltage interruption + transient oscillation, and D16: voltage interruption + transient pulse.

[0112] In step S1 of this embodiment, the basis for extracting the nine features is:

[0113] F1: The proportion of the time when the fundamental amplitude time curve is greater than 1.02 pu in the entire detection time; F2: The proportion of the time when the fundamental amplitude time curve is less than 0.98 pu in the entire detection time; F3: The proportion of the time when the fundamental amplitude time curve is less than 0.15 pu in the entire detection time; F4: The sum of the skewness of the low-order harmonics; F5: The sum of the skewness of the medium-order harmonics; F6: The sum of the standard deviations of the medium-order harmonics; F7: The sum of the kurtosis of the high-order harmonics; F8: The sum of the standard deviations of the high-order harmonics; F9: The average value of the total harmonic distortion rate. As shown in Table 2 below:

[0114] Table 2 9 feature extraction bases

[0115]

[0116]

[0117] In step S1 of this embodiment, the feature extraction method is:

[0118] Use S transform for feature extraction. The fundamental frequency of the disturbance is set to 50 Hz, and the S transform definition of the square-integrable signal x(t) is described by the following formula:

[0119]

[0120] S(τ,f) represents the result of S transform, t is time, f is frequency, is a Gaussian window, τ is the parameter that controls the time axis position of the Gaussian window, and is a complex function representing a complex exponential signal with a frequency of f. The S transform can be described as follows:

[0121]

[0122] This embodiment introduces x(wT), where w represents the discrete time series applied to x(t) and T represents the sampling time. The discrete Fourier transform is shown in the following formula:

[0123]

[0124] In the discrete case, the S transform is the projection of the vector defined by the time series x(wT) onto the vector generating set. The S transform of the discrete time series x(wT) is shown in the following formula:

[0125]

[0126] According to the modified discrete S transform formula, the power quality disturbance signal is subjected to feature extraction. In step S1 of this embodiment, the method for normalizing the data after feature extraction is:

[0127] Using normalization, all eigenvalues ​​are mapped to the range of -π to π, and after normalization, the mean of each feature data is 0. The mapping formula is as follows:

[0128]

[0129] In this process, X i Indicates the data of the column corresponding to the corresponding feature, Indicates the average value of the original column of data.

[0130] In step S2 of this embodiment, the feature dimension reduction method is:

[0131] The purpose of feature dimensionality reduction is to reduce computational overhead. In this embodiment, for the 9 power quality disturbance feature dimensions, this embodiment needs to reduce them to two feature dimensions. That is, the basis {F1, F2, ..., F9} is changed to the basis {u1, u2}. In this embodiment, m is the number of data samples, and the average value of the samples is 0, that is, X center =0, data point X i The projection distance on the orthogonal basis {u1,u2} is x T ·u j The variance of all data projected on this basis is Var j , as shown in the following formula:

[0132]

[0133] The purpose of dimensionality reduction in this embodiment is to find Var j The covariance matrix of {u1,u2} corresponding to the maximum value is recorded as S after the mean processing, as shown in the following formula:

[0134]

[0135] Then perform singular value decomposition (SVD) on the covariance matrix as shown in the following formula:

[0136]

[0137] The column vectors of U and V are orthogonal and have a modulus of 1. S can be decomposed into eigenvalues, where U is the set of new coordinates and μ is the set of eigenvalues. This embodiment sorts the eigenvalues ​​from largest to smallest, taking the eigenvectors corresponding to the first two eigenvalues ​​as the two new orthogonal bases {u1,u2}. This method reduces the nine-dimensional data to two dimensions.

[0138] In step S2 of this embodiment, the method of quantum feature mapping is:

[0139] The first quantum coding circuit is used for feature mapping. Figure 2 shown.

[0140] The first quantum coding circuit consists of:

[0141] Hadamard gate, phase gate RZ gate, controlled rotation gate CNOT gate;

[0142] In this embodiment, the circuit structure construction method of the first quantum coding circuit is:

[0143] The circuit uses two qubits and is constructed on these two qubits. All qubits are initially placed in the state |0>. After each qubit passes through a Hadamard gate, the quantum state becomes a superposition state, as described by the following formula:

[0144]

[0145] Next, each qubit is passed through a phase gate, an RZ gate, to encode the classical data into the quantum state. The parameter of the RZ gate is the data to be encoded. After passing through the RZ gate, the classical data is encoded into the quantum state. The physical meaning of the RZ gate is that the qubit rotates around the Z axis by a specified angle. The definition of the RZ gate is shown in the following formula, where θ represents the rotation angle around the Z axis:

[0146]

[0147] Finally, by adding a controlled rotation gate CNOT gate to each qubit in turn, the conditional flip between qubits is achieved. The role of the CNOT gate is to introduce entanglement between qubits. Its matrix representation is:

[0148]

[0149] The logic for adding the CNOT gate is:

[0150] Starting from the first quantum bit to the last quantum bit, controlled rotation gates (CNOT gates) are added in sequence: the previous quantum bit controls the conditional flipping of the next quantum bit, and the last quantum bit controls the conditional flipping of the first quantum bit.

[0151] In step S2 of this embodiment, the method for constructing the first parameterized quantum circuit is:

[0152] like Figure 3 As shown, the circuit of the first parameterized quantity is composed of two identical cells connected in front and back.

[0153] The construction method of each cell is:

[0154] Each cell uses 2 qubits, and a cell uses 2 G gates and 2 CNOT gates. Each qubit is connected to a G gate, and the description of the G gate is shown in the following formula:

[0155]

[0156] Among them, α, β, and γ are all learnable parameters. The three parameters are used to describe the arbitrary rotation of the quantum bit on the Bloch sphere. α represents the amplitude, β and γ represent the two phase angles, i represents the imaginary number, and e iβ Euler's formula can be written as e iβ = cosβ + isinβ, which links the polar coordinate representation of complex numbers with trigonometric functions, e iγ The meaning of e iβ Same; each G gate contains three learnable parameters α, β, γ, which represent the rotation of the quantum bit around the x, y, and z axes on the Bloch sphere, and the initial parameters are randomly generated.

[0157] Add CNOT gates after the G gate. The logic for adding CNOT gates is as follows: Starting from the first qubit and ending at the last qubit, add controlled rotation gates CNOT gates in sequence. The previous qubit controls the conditional flip of the next qubit, and the last qubit controls the conditional row flip of the first qubit.

[0158] In step S2 of this embodiment, the parameter updating method is:

[0159] Parameters are updated through second-order moment estimation. The steps for updating parameters are as follows:

[0160] First, through quantum measurement, the quantum state is converted into classical data. The specific operations are as follows:

[0161] To perform Pauli-Z measurement on each quantum, we first construct the Pauli-Z measurement Hamiltonian Hz, as shown in the following formula:

[0162]

[0163] The result of quantum measurement is e, which represents the expected energy after the quantum state measurement, as shown in the following formula:

[0164] e=<ψ′(X)|H z |ψ′(X)>

[0165] Here, |ψ′(X)> represents the quantum state after the parameterized circuit. Then, based on the results of quantum measurement, the second-order moment estimation method is used to perform parameter optimization on a classical computer. The optimization goal is to find θ in the parameterized quantum circuit to minimize the expected energy value e. The optimization method is as follows:

[0166] The model uses the Softmax cross entropy loss function commonly used in multi-classification tasks. First, the expected measurement value of the measured quantum circuit is calculated, denoted as E, as shown in the following formula:

[0167]

[0168] After obtaining the expectation, this embodiment uses g to represent the gradient in model training. The calculation formula of the gradient is as follows:

[0169]

[0170] Δθ represents the step size. In this embodiment, Δθ=0.001 is used. After calculating the gradient, the parameters are updated by second-order moment estimation. v represents the first-order moment estimation momentum matrix, and m represents the second-order moment estimation momentum matrix. The calculation formula is as follows:

[0171] m t ←0.9m t-1 +0.1g t

[0172]

[0173] The formula for updating the trainable parameters θ is as follows:

[0174]

[0175] Where η represents the learning rate, and η = 0.001 is taken in the model.

[0176] In step S3 of this embodiment, the feature dimension upgrade method is:

[0177] Use autoencoders to increase the dimension of features, such as Figure 6 In this embodiment, the 9 features of the power quality disturbance data are upgraded to 16 features in order to improve the recognition accuracy. The construction method of the autoencoder is as follows:

[0178] The autoencoder consists of an encoder and a decoder. The encoder receives nine-dimensional power quality disturbance features and is sequentially connected to three hidden layers. The first hidden layer consists of a fully connected layer with an input dimension of 9 and an output dimension of 32, followed by a Relu activation function. The second hidden layer consists of a fully connected layer with an input dimension of 32 and an output dimension of 64, followed by a Relu activation function. The third hidden layer is a fully connected layer with an input dimension of 64 and an output dimension of 16, which serves as the encoder's final output. The decoder receives a sixteen-dimensional input and is sequentially connected to three hidden layers. The first hidden layer consists of a fully connected layer with an input dimension of 16 and an output dimension of 64, followed by a Relu activation function. The second hidden layer consists of a fully connected layer with an input dimension of 64 and an output dimension of 32, followed by a Relu activation function. The third hidden layer is a fully connected layer with an input dimension of 32 and an output dimension of 9, which serves as the decoder's final output. The autoencoder's optimization goal is to minimize the difference between the output and the input value. The loss function uses mean squared error, and the optimizer uses the Adam optimizer.

[0179] In step S3 of this embodiment, the method of quantum feature mapping is:

[0180] like Figure 4 As shown, a second quantum coding circuit is used to perform quantum feature mapping.

[0181] The second quantum coding circuit includes: Hadamard gate, phase gate RZ gate, controlled rotation gate CNOT gate; the number of quantum bits used is 16, and the circuit construction method is the same as that of the first quantum coding circuit, so no further details will be given.

[0182] In step S3 of this embodiment, the method for constructing the second parameterized quantum circuit is:

[0183] The second parameterized circuit consists of 16 quantum bits and 6 identical cells connected in front and back.

[0184] like Figure 5 As shown, the construction method of each cell is similar to the cell construction method of the first parameterized quantum circuit, and will not be elaborated on.

[0185] In step S3 of this embodiment, the method for updating parameters by second-order moment estimation is:

[0186] The method of updating parameters by estimating the second-order moment in step S2 is similar and will not be described in detail.

[0187] In step S4 of this embodiment, the power quality disturbance time location method is:

[0188] like Figure 7 As shown in the figure, according to the identification results of each power quality disturbance sequence by the power quality disturbance identification model, the disturbance type of the current time step is compared with the type of the previous time step to determine whether the disturbance type has changed. If the disturbance type has not changed, the next time step is processed. When a change in the disturbance type is detected, the start and end time of the disturbance is recorded, and the occurrence range of the disturbance event is marked.

[0189] Example 2:

[0190] A method for detecting and identifying power quality disturbances based on quantum variational algorithm,

[0191] Process 1: Simulate power quality fluctuations, including normal fluctuations and disturbance fluctuations.

[0192] Process 2: Extract features of the simulated power quality fluctuations through S-transformation.

[0193] Process 3: Normalize the data after feature extraction.

[0194] Process 4: Perform dimensionality reduction on the data after all feature extraction.

[0195] Process 5: The reduced-dimensional data is subjected to quantum machine learning using a quantum variational algorithm, which includes quantum coding, parameterized quantum circuits, quantum measurement, and parameter updates.

[0196] Process 6: Perform dimensionality increase on the data identified to contain disturbances.

[0197] Process 7: The data after dimensionality increase is subjected to quantum machine learning through the quantum variational algorithm, where the quantum variational algorithm includes quantum coding, parameterized quantum circuits, quantum measurement and parameter update.

[0198] Process 8: Based on the disturbance identification results, determine the start time, end time and duration of the power quality disturbance.

[0199] Example 3:

[0200] The present invention also provides a power quality disturbance detection and identification system based on a quantum variational algorithm, comprising:

[0201] A1: Signal extraction module, used to extract fluctuation signals in power quality;

[0202] A2: Preprocessing module, which uses S-transform to extract features from the fluctuation signal and preprocesses the extracted feature data;

[0203] A3: Power quality disturbance detection module, which reduces the dimension of feature data and uses the power quality disturbance detection model to detect whether there is power quality disturbance in the power quality fluctuation signal;

[0204] A4: Power quality disturbance identification module, which performs dimension upgrade on feature data and determines the type of disturbance for power quality fluctuation signals with disturbances;

[0205] A5: Time location module, which determines the start and end time and duration of a specific power quality disturbance based on the results of the power quality disturbance identification model;

[0206] A6: Data storage module, records power quality fluctuation data, characteristic data, power quality disturbance type and the start and end time and duration of the disturbance.

[0207] The embodiments described above are merely descriptions of preferred embodiments of the present invention and are not intended to limit the scope of the present invention. Without departing from the spirit of the present invention, various modifications and improvements made to the technical solutions of the present invention by persons skilled in the art should fall within the scope of protection defined by the claims of the present invention.

Claims

1. A method for detecting and identifying power quality disturbances based on quantum variational algorithm, characterized in that: The following steps are involved: S1: Through the preprocessing module, power quality signal simulation, feature extraction and normalization are performed; S2: Using the power quality disturbance detection model, the pre-processed power quality signal is used to distinguish between data with power quality disturbance and normal data. The power quality disturbance detection model includes: data dimension reduction, first quantum feature mapping, first parameterized quantum circuit and second-order moment estimation update parameter; In step S2, the method of the first quantum feature mapping is: The function of the first quantum feature mapping is to convert the classical data after dimensionality reduction into a quantum state representation, thereby mapping the classical data to the quantum state, and taking the |0> state as the initial state; First, the initial state |0> passes through the Hadamard gate, transforming the initial state |0> into a superposition state. At this time, the quantum state does not yet contain the data to be encoded; the formula for the initial state |0> passing through the Hadamard gate is expressed as: Next, the superposition state passes through a phase gate, the RZ gate, whose parameter is the data to be encoded. After passing through the RZ gate, the classical data is encoded into the quantum state. The physical meaning of the RZ gate is that the quantum bit rotates around the Z axis at a specified angle. The definition of the RZ gate is shown in the following formula, where θ represents the rotation angle around the Z axis: Finally, the conditional flipping between quantum bits is achieved through the controlled rotation gate CNOT, which is used to introduce entanglement between quantum bits. The matrix representation of the CNOT gate is: After the above steps are completed, the classical data is represented by n entangled quantum bits, where n represents the number of quantum bits used in the quantum circuit; In step S2, the method for constructing the first parameterized quantum circuit is: The first parameterized quantum circuit consists of several identical cells, each of which consists of n G gates and n CNOT gates, where n represents the number of quantum bits used in the quantum circuit; the formula of the G gate is defined as follows: Among them, α, β, and γ are all learnable parameters. The formula uses three parameters to describe any rotation of the quantum bit r around the X, Y, and Z axes. i represents an imaginary number, α represents the amplitude, and β and γ represent two phase angles; e iβ Expressed as e through Euler's formula iβ =cosβ+isinβ,e iβ The formula of the representation connects the polar coordinate representation of complex numbers with trigonometric functions, e iγ The meaning of e iβ same; The three initial parameters of each G gate are randomly generated; the CNOT gate is connected after the G gate; In step S2, the method for updating the parameters by second-order moment estimation is: First, quantum states are converted into classical data through quantum measurement. Then, based on the results of quantum measurement, parameter optimization is performed on a classical computer using the second-order moment estimation method. The quantum measurement method is as follows: Perform Pauli-Z measurement on n qubits, where n represents the number of qubits used in the quantum circuit. First, construct the Hamiltonian H using Pauli-Z measurement. z , as shown in the following formula: The quantum measurement result is the expected energy of the quantum circuit, represented by e, as shown in the following formula: Among them, |ψ′(X)> represents the quantum state after parameterized circuit, |ψ(X)> represents the state after quantum feature mapping, and U(θ) represents the quantum circuit with parameters; Based on the measurement results, the gradient is calculated and the parameters are updated using the second-order moment estimation; S3: Identifying the specific type of disturbance in the data containing the power quality disturbance using a power quality disturbance identification model; the power quality disturbance identification model includes: data dimensionality increase, second quantum feature mapping, second parameterized quantum circuit, and second-order moment estimation update parameter; In step S3, the second quantum feature mapping method is: The role of quantum feature mapping is to convert the classical data after dimensionality increase into quantum state representation, thereby mapping the classical data to the quantum state; the |0> state is taken as the initial state; First, the initial state |0> passes through a Hadamard gate, transforming the initial state |0> into a superposition state. Next, the superposition state passes through a phase gate RZ gate, whose parameter is the data to be encoded. After passing through the RZ gate, the classical data is encoded into the quantum state. Finally, a controlled rotation gate CNOT is used to achieve conditional flipping between quantum bits. After the above steps are completed, the classical data is represented by n entangled quantum bits, where n represents the number of quantum bits used in the second parameterized quantum circuit; In step S3, the second parameterized quantum circuit is constructed as follows: The second parameterized quantum circuit is composed of several identical cells, each of which is composed of n G gates and n CNOT gates, where n represents the number of quantum bits used in the quantum circuit; the three initial parameters of each G gate are randomly generated; and a CNOT gate is connected after the G gate; In step S3, the method for updating the parameters by second-order moment estimation is: First, quantum states are converted into classical data through quantum measurement. Then, the results of the quantum measurement are used to optimize parameters on a classical computer using the second-order moment estimation method. The quantum measurement method is Pauli-Z measurement, and the quantum measurement result is the expected energy of the quantum circuit. Based on the measurement results, the gradient is calculated and the parameters are updated using the second-order moment estimation; S4: Determine the start time, duration and end time of the disturbance according to the output result of the power quality disturbance identification model through the power quality disturbance time location model.

2. The method for detecting and identifying power quality disturbances based on quantum variational algorithm according to claim 1, characterized in that: In step S1, the power quality signal is simulated, and the simulated signal includes: D0: Normal power quality disturbance; D1: Harmonics; D2: Voltage sag; D3: Voltage swell; D4: Voltage interruption; D5: Flicker; D6: Transient oscillation; D7: Transient pulse; D8 Harmonics + voltage sag; D9 Harmonics + voltage swell; D10 Harmonics + voltage interruption; D11 Harmonics + transient oscillation; D12 Harmonics + transient pulse; D13 Voltage sag + transient oscillation; D14 Voltage sag + transient pulse; D15 Voltage interruption + transient oscillation; D16 Voltage interruption + transient pulse; A total of 17 types of power quality fluctuations are simulated, including 1 type of no disturbance, 7 types of single power quality disturbances and 9 types of composite power quality disturbances.

3. The power quality disturbance detection and identification method based on quantum variational algorithm according to claim 1 is characterized in that: In step S1, the method for performing feature extraction and normalization processing on the simulated power quality signal is: The method for extracting features of the simulated power quality signal is to use S-transformation; The S transform is expressed as: Among them, S(τ,f) represents the result of S transformation, t is time, f is frequency, τ is the parameter for controlling the time axis position of the Gaussian window, e -2πift is a complex function representing a complex exponential signal with frequency f; The feature basis for extracting the features of the simulated power quality signal is: F1: The proportion of the time when the fundamental amplitude time curve is greater than 1.02 pu to the entire detection time; F2: The proportion of the time when the fundamental amplitude time curve is less than 0.98 pu in the entire detection time; F3: The proportion of the time when the fundamental amplitude time curve is less than 0.15 pu in the entire detection time; F4: The sum of the skewness of the low-order harmonics; F5: The sum of the skewness of the medium-order harmonics; F6: The sum of the standard deviations of the medium-order harmonics; F7: The sum of the kurtosis of the high-order harmonics; F8: The sum of the standard deviations of the high-order harmonics; F9: The average value of the total harmonic distortion rate; In step S1, the normalization process is performed as follows: The feature data extracted by S-transform is scaled to the range between 0 and π; the mapping formula is as follows: Among them, X i Indicates the data of the column corresponding to the corresponding feature, Indicates the average value of this column of data.

4. The method for detecting and identifying power quality disturbances based on quantum variational algorithm according to claim 1 is characterized in that: In step S2, the method of data dimensionality reduction is: First, the covariance matrix of the preprocessed power quality signal is calculated; the covariance matrix is ​​subjected to singular value decomposition to obtain a set of decomposed eigenvalues; the decomposed eigenvalues ​​are sorted from large to small, and the eigenvectors corresponding to the first several eigenvalues ​​are taken as the features after dimensionality reduction.

5. The power quality disturbance detection and identification method based on quantum variational algorithm according to claim 1 is characterized in that: In step S3, the method of data dimension upgrading is: Use unsupervised learning of autoencoders to increase the dimension of data; the autoencoder consists of an encoder and a decoder; the encoder maps the data to a latent representation space and extracts data features; The decoder restores the latent representation to data that is as close as possible to the original input; The loss function uses mean square error and the optimizer uses Adam optimizer.

6. The power quality disturbance detection and identification method based on quantum variational algorithm according to claim 1 is characterized in that: In step S4, the time positioning method for power quality is: According to the identification results of each power quality disturbance sequence by the power quality disturbance identification model, the disturbance type of the current time step is compared with the type of the previous time step to determine whether the disturbance type has changed. If the disturbance type has not changed, the next time step is processed. When a change in the disturbance type is detected, the start and end time of the disturbance is recorded, and the occurrence range of the disturbance event is marked.

Citation Information

Patent Citations

  • Electric energy quality disturbance detection and identification method based on quantum support vector machine

    CN118627951A

  • Power quality disturbance identification method based on data driving

    CN119226863A