Electric energy quality disturbance detection and identification method based on quantum variation algorithm
Through the power quality disturbance detection method based on the quantum variation algorithm, the parallelism and entanglement of quantum computing are used to solve the problems of insufficient window resolution and poor noise resistance in the prior art, and efficient and accurate power quality disturbance detection and recognition are achieved.
Patent Information
- Application Number
- CN202510092542.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-21
- Publication Date
- 2025-06-13
- Estimated Expiration
- 2045-01-21
AI Technical Summary
When the existing power quality disturbance detection methods deal with frequency changes and non-stationary signals, the window resolution is insufficient, the accuracy depends on the basic wavelet and decomposition scale selection, and the noise resistance is poor.
The power quality perturbation detection and recognition method based on quantum variation algorithm is adopted, and the parallelism and entanglement of quantum computing are used to perform data dimensionality reduction, feature mapping, parametric quantum circuit training and second-order moment estimation update parameters to achieve accurate detection, identification and time positioning.
The calculation speed, convergence speed and calculation efficiency of power quality disturbance detection are improved, and the power quality disturbance signals can be processed more accurately, realizing time positioning and fault handling.
Smart Images

Figure CN120145101A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of electrical information technology, and particularly to a method for detecting and identifying power quality disturbances based on a quantum variational algorithm. Background Art
[0002] Power quality detection is a key means to evaluate the power quality in a power system. It can not only monitor voltage and current waveforms, but also identify problems such as harmonics, voltage sags, and voltage flickers existing in the power system. In today's power infrastructure, power quality detection is particularly important. It helps consumers and power companies quickly discover and solve power quality problems, thereby improving the efficiency and reliability of the power system. Taking the industrial field as an example, power quality detection can help factories monitor and record various interferences. Power quality monitoring devices can be used at multiple nodes of the entire electrical facility, or these devices can be used at the load level to comprehensively understand the power quality delivered to each load. Power quality detection is also of great significance for data center management and can prevent losses caused by power outages. Power quality detection 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 methods. Detecting power quality disturbances is divided into two steps, namely feature extraction and feature classification of power quality disturbance signals. Feature extraction is to use power quality indices, such as frequency deviation, flicker, voltage change and other indicators, to obtain disturbance features through various signal processing algorithms. In recent years, signal analysis methods such as wavelet transform, S transform, Hilbert-Huang transform, and Fourier transform have been widely applied in the field of power quality disturbance location and detection. The Fourier transform can obtain the frequency-domain information of a time-domain signal, but it is only suitable for stationary and continuous signals. To solve these problems, scholars introduced a time window to obtain the short-time Fourier transform for processing non-stationary signals. However, the window size of the algorithm is fixed, and the window resolution cannot meet the detection requirements when dealing with non-stationary signals with continuously changing frequencies. The wavelet transform overcomes the shortcomings of the short-time Fourier transform and is suitable for non-stationary disturbance signals, but its accuracy depends on the selected basis wavelet and decomposition scale. The Hilbert-Huang transform is suitable for non-stationary or abrupt signals and has a good effect on complex non-stationary signals, but it will have serious endpoint effects, is prone to mode mixing phenomena, and has poor anti-noise ability. The S transform uses a scalable and unique Gaussian window, with a more refined resolution and a more intuitive detection effect.
[0004] After extracting the features of the power quality disturbance signal, it is necessary to establish a mapping relationship from the space composed of features to the space composed of signal labels, and the process of establishing this mapping relationship is the process of training a classification algorithm using the extracted features. Currently, the algorithms used for power quality disturbance detection and identification mainly include algorithms based on decision trees, algorithms based on neural networks, algorithms based on support vector machines, algorithms based on deep learning, etc.
[0005] With the development of quantum machine learning algorithms, we have realized the infinite potential of quantum algorithms in the power grid. Therefore, the present invention proposes a method for power quality disturbance detection and identification based on quantum variational algorithms to solve the problems of power quality disturbance detection, classification, and time localization. Summary of the Invention
[0006] The object of the present invention is to propose a method for power quality disturbance detection and identification based on quantum variational algorithms. Utilize the parallelism of quantum computing and the entanglement between quantum bits to effectively process power quality disturbance signals, achieve accurate detection, identification, and time localization, so as to facilitate subsequent problem localization and fault handling. Compared with existing machine learning methods, it has the advantages of higher computing speed, convergence speed, and computing efficiency.
[0007] To achieve the above object, the present invention provides the following solutions:
[0008] A method for power quality disturbance detection and identification based on quantum variational algorithms, comprising the following steps:
[0009] S1: Through a preprocessing module, perform power quality signal simulation, feature extraction, and normalization processing;
[0010] S2: Through a power quality disturbance detection model, distinguish the data with power quality disturbances from the normal data; the detection model includes: data dimensionality reduction, quantum feature mapping, parameterized quantum circuit, and second-order moment estimation to update parameters;
[0011] S3: Through a power quality disturbance identification model, identify the specific type of disturbance in the data with power quality disturbances; the identification model includes: data dimensionality increase, quantum feature mapping, parameterized quantum circuit, and second-order moment estimation to update parameters;
[0012] S4: Through a power quality disturbance time localization model, according to the output result of the power quality disturbance identification model, determine the start time, duration, and end time of the disturbance.
[0013] Optionally, in step S1, the power quality signal simulation method is:
[0014] Through the IEEE Std 1159-2019 standard, power quality disturbance data is generated using a simulation environment, and the fundamental frequencies of the disturbance models are all 50 Hz. The simulated power quality disturbance signals include:
[0015] The simulated power quality disturbances include 1 type of normal power quality fluctuation, 7 types of single power quality disturbances, and 9 types of composite power quality disturbances. The normal power quality disturbance signal includes: D0: Normal power quality signal; The single power quality disturbance signals include: D1: Harmonics, D2: Voltage sag, D3: Voltage swell, D4: Voltage interruption, D5: Voltage flicker, D6: Transient oscillation, D7: Transient impulse; The composite power quality disturbance signals include: D8: Harmonics + Voltage sag, D9: Harmonics + Voltage swell, D10: Harmonics + Voltage interruption, D11: Harmonics + Transient oscillation, D12: Harmonics + Transient impulse, D13: Voltage sag + Transient oscillation, D14: Voltage sag + Transient impulse, D15: Voltage interruption + Transient oscillation, D16: Voltage interruption + Transient impulse.
[0016] Preferably, in step S1, the power quality disturbance characteristics include:
[0017] F1: The time ratio of the part greater than 1.02 p.u. in the fundamental wave amplitude time curve to the entire detection duration; F2: The time ratio of the part less than 0.98 p.u. in the fundamental wave amplitude time curve to the entire detection duration; F3: The time ratio of the part less than 0.15 p.u. in the fundamental wave amplitude time curve to the entire detection duration; F4: The sum of the skewness of low-order harmonics; F5: The sum of the skewness of medium-order harmonics; F6: The sum of the standard deviations of medium-order harmonics; F7: The sum of the kurtosis of high-order harmonics; F8: The sum of the standard deviations of high-order harmonics; F9: The average value of the total harmonic distortion rate.
[0018] Optionally, in step S1, the method for extracting the power quality signal characteristics is:
[0019] S transform. The S transform can be expressed as:
[0020]
[0021] S(τ,f) represents the result of the S transform, t is time, f is frequency, τ is the parameter controlling the position of the Gaussian window on the time axis, and e -2πift is a complex function representing a complex exponential signal with frequency f.
[0022] Preferably, in step S1, the normalization method is:
[0023] Map the data after feature extraction to the range between -π and π, and the mean value is 0. As shown in the following formula:
[0024]
[0025] During this processing, X i represents the data of the column corresponding to the corresponding feature, representing the average value of the original column of data.
[0026] Preferably, in step S2, the method of data dimensionality reduction is as follows:
[0027] First, calculate the covariance matrix of the preprocessed power quality disturbance features; perform singular value decomposition on the covariance matrix to obtain a set of decomposed eigenvalues; sort the decomposed eigenvalues from largest to smallest, and take the eigenvectors corresponding to the first several eigenvalues as the reduced-dimensional features.
[0028] The steps of reducing the power quality disturbance data to n dimensions are as follows:
[0029] X is the data after normalization processing, a is the number of samples of the data, and the data point x i The projection distance on the orthogonal basis u j is In the previous processing, the data mean was 0, that is, x center = 0. The variance of the projection of all data on this basis is Var j , as shown in the formula:
[0030]
[0031] The covariance matrix of X is denoted 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 pairwise orthogonal and have a modulus of 1. And the covariance matrix S can also be decomposed into eigenvalues. Therefore, U is a set of new coordinates, and μ is a set of eigenvalues. Then, sort the eigenvalues from largest to smallest, and take the eigenvectors corresponding to the first n eigenvalues as n new orthogonal bases {u 1 , u 2 , …, u n}, as the reduced-dimensional data.
[0036] Preferably, in step S2, the method of the first quantum feature mapping is as follows:
[0037] Use the first quantum encoding circuit for feature mapping, and the construction method of the first quantum encoding circuit is as follows:
[0038] After the first quantum feature mapping, the classical data after dimensionality reduction is encoded onto qubits. Among them, the components of the first quantum encoding circuit include:
[0039] Hadamard gate, phase gate RZ gate, controlled rotation gate CNOT gate; the number of qubits used in the first quantum encoding circuit is the dimensionality n of the data after dimensionality reduction, and n takes 2 in the application. The circuit structure construction method of the first quantum encoding 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, and the formula is described as follows:
[0041]
[0042] Pass each qubit through the phase gate 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 by a specified angle around the Z axis. 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 sequentially adding the controlled rotation gate CNOT gate to each qubit, conditional flipping between qubits is achieved. The role of the CNOT gate is to introduce entanglement between qubits, and its matrix representation form is:
[0045]
[0046] The addition logic of the CNOT gate is:
[0047] Starting from the first qubit to the last qubit, sequentially add the controlled rotation gate CNOT gate: the previous qubit controls the conditional flipping of the next qubit, and the last qubit controls the conditional flipping of the first qubit.
[0048] Preferably, in step S2, the construction method of the first parameterized quantum circuit is:
[0049] The circuit of the first parameterized quantity is composed of 2 identical cells connected in series front and back.
[0050] Optionally, the construction method of each cell is:
[0051] Each cell uses 2 qubits. One cell uses n G gates and 2n CNOT gates, where n is the number of qubits. In the first parameterized quantum circuit, n takes the value of 2. A G gate is connected after each qubit. The description of the G gate is shown by the following formula:
[0052]
[0053] where α, β, and γ are all learnable parameters, and any rotation of the qubit on the Bloch sphere is described by these three parameters. α represents the amplitude, β and γ represent two phase angles, i represents the imaginary unit, and e iβ can be written as e iβ = cosβ + isinβ by Euler's formula, which relates the polar coordinate representation of a complex number to trigonometric functions. The meaning of e iγ is the same as that of e iβ ; each G gate contains 3 learnable parameters α, β, and γ, representing the rotation of the qubit around the x, y, and z axes on the Bloch sphere, and the initial parameters are randomly generated.
[0054] CNOT gates are added later. The addition logic of the CNOT gates is as follows: starting from the first qubit to the last qubit, controlled rotation gates CNOT are added in sequence: the qubit in the previous position controls the conditional flip of the qubit in the next position, and the last qubit controls the conditional flip of the first qubit.
[0055] Preferably, in step S2, the method for updating the parameters by second moment estimation is as follows:
[0056] First, through quantum measurement, the quantum state after being trained by the parameterized quantum circuit is converted into classical data. The measurement method is as follows:
[0057] For each qubit, a Pauli Z measurement is used. First, the measurement Hamiltonian Hz is constructed as shown by the following formula:
[0058]
[0059] The result of the quantum measurement is e, which represents the expected energy obtained after measuring the quantum state, as shown by the following formula:
[0060] e = <ψ′(X)|H z |ψ′(X)>
[0061] where |ψ′(X)> represents the quantum state after being trained by the parameterized circuit.
[0062] Secondly, parameter update is performed through second moment estimation. The method for parameter update is as follows:
[0063] The optimization objective of the parameter 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, it calculates the expected measurement value of the measurement quantum circuit, denoted as E. Then it calculates the gradient, and the calculation formula of the gradient is as follows:
[0065]
[0066] Then it calculates the first momentum matrix, denoted as v, and the second momentum matrix, denoted as m. The update of the parameter is shown in the following formula:
[0067]
[0068] Where η represents the learning rate and t represents the time step.
[0069] Preferably, in step S3, the method of data dimensionality increase is:
[0070] Use an autoencoder for dimensionality increase, and the construction method of the autoencoder is:
[0071] The autoencoder includes: an encoder and a decoder; where the encoder receives the power quality disturbance features of the initial dimension and is sequentially connected to several hidden layers, and each layer is followed by a relu activation function. Among them, the decoder receives the output of the hidden layer as the input and is sequentially connected to several hidden layers, and each hidden layer is followed by a relu activation function.
[0072] The optimization objective 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] Perform feature mapping through the second quantum encoding circuit to encode the dimensionality-increased data onto qubits. The construction method of the second quantum encoding circuit is:
[0075] The second quantum encoding circuit includes: Hadamard gate, phase gate RZ gate, and controlled rotation gate CNOT gate; the number of qubits used in the second quantum encoding circuit is the dimensionality n of the dimensionality-increased data, and in this application, n takes 16.
[0076] The circuit structure construction method of the second quantum encoding circuit is:
[0077] It is the same as the circuit construction method of the first quantum encoding circuit and will not be elaborated here.
[0078] Preferably, in step S3, the method for constructing the second parameterized quantum circuit is as follows:
[0079] The circuit of the second parameterized quantity is composed of 6 identical cells connected in series before and after.
[0080] Optionally, the method for constructing each cell is as follows:
[0081] Similar to the method for constructing the cell of the first parameterized quantum circuit, it will not be elaborated here. The difference lies in the different number of qubits n, where n = 16 is taken here.
[0082] Preferably, in step S3, the method for updating the parameters by second-order moment estimation is as follows:
[0083] Similar to the method for updating the parameters by second-order moment estimation in step S2, it will not be elaborated here. The difference lies in the different number of qubits n, where n = 16 is taken here.
[0084] Preferably, in step S4, the method for locating the time of power quality disturbance is as follows:
[0085] According to the recognition results of each power quality disturbance sequence by the power quality disturbance recognition model, compare the disturbance type at the current time step with the type at the previous time step to determine whether the disturbance type has changed. If the disturbance type has not changed, continue to process the next time step. When it is detected that the disturbance type has changed, record the start and end times of the disturbance and mark the occurrence range of the disturbance event.
[0086] The present invention also proposes a power quality disturbance detection and recognition system based on the quantum variational algorithm, including:
[0087] A1: A signal extraction module for extracting the fluctuation signal in the power quality; A2: A preprocessing module for extracting features from the fluctuation signal using the S transform and preprocessing the extracted feature data; A3: A power quality disturbance detection module for dimensionality reduction of the feature data and detecting whether there is a power quality disturbance in the power quality fluctuation signal using the power quality disturbance detection model; A4: A power quality disturbance recognition module for dimensionality increase of the feature data and determining the type of disturbance that occurs for the power quality fluctuation signal with disturbance; A5: A time location module for determining the start and end times and the duration of the specific power quality disturbance according to the results of the power quality disturbance recognition model; A6: A data storage module for recording the power quality fluctuation data, feature data, power quality disturbance type, and the start and end times and the duration of the disturbance.
[0088] The beneficial effects of the present invention are:
[0089] The present invention uses emerging quantum machine learning algorithms and applies them to the field of power quality disturbances, proposing a method for detecting and identifying power quality disturbances based on quantum variational algorithms. First, the power quality fluctuation signals to be detected are simulated, and then the signals are subjected to feature extraction and preprocessing 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 are power quality disturbances. Next, the data determined to have power quality disturbances is input into the power quality disturbance identification model to obtain the types of disturbances that occur. Among them, both the power quality disturbance detection model and the power quality disturbance identification module are 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 times and the duration of the power quality disturbances are determined. The present invention utilizes the parallelism of quantum computing and the entanglement between quantum bits, enabling the model to effectively process power quality disturbance signals when facing power quality disturbance problems, achieving accurate detection and identification for 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. Description of the Drawings
[0090] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the embodiments. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0091] Figure 1 It is a flowchart of the method for detecting and identifying power quality disturbances based on quantum variational algorithms according to an embodiment of the present invention;
[0092] Figure 2 It is a schematic diagram of the first quantum encoding circuit of the power quality disturbance detection model according to an embodiment of the present invention;
[0093] Figure 3 It is a schematic diagram of the first parameterized electronic circuit of the power quality disturbance detection model according to an embodiment of the present invention;
[0094] Figure 4 It is a schematic diagram of the second quantum encoding circuit of the power quality disturbance identification model according to an embodiment of the present invention;
[0095] Figure 5 It is a 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 It is a schematic diagram of the autoencoder of the power quality disturbance identification model according to an embodiment of the present invention;
[0097] Figure 7This is the flowchart for locating the time of power quality disturbances in the embodiments of the present invention. Detailed implementation manners
[0098] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0099] To make the above objects, features, and advantages of the present invention more obvious and understandable, the present invention will be further described in detail below in conjunction with the accompanying drawings and specific implementation manners.
[0100] Embodiment 1:
[0101] A method for detecting and identifying power quality disturbances based on a quantum variational algorithm.
[0102] The flowchart of the embodiment is as Figure 1 shown. According to the IEEE Std 1159-2019 standard in this embodiment, normal power quality fluctuations and power quality data containing disturbances are simulated. Nine power quality features are designed to extract and preprocess the simulated power quality fluctuations. Then, through the power quality detection model, the data after preprocessing is first dimensionally reduced, and the data with 9 feature dimensions is dimensionally reduced to data with 2 feature dimensions. Then, the quantum variational algorithm is used to train the model. For the data identified as containing power quality disturbances, through the power quality disturbance identification model, the data after preprocessing is first dimensionally increased, and the data with 9 feature dimensions is dimensionally increased to data with 16 feature dimensions. Then, the quantum variational algorithm is used to train the model. Finally, through the power quality disturbance time location model, according to the results of the power quality disturbance identification model, the time when the disturbance occurs is divided.
[0103] The embodiment includes the following modules: S1: a preprocessing module; S2: a power quality disturbance detection module; S3: a power quality disturbance identification module; S4: a power quality disturbance time location module.
[0104] A further implementation manner lies in:
[0105] In step S1, according to the definition of the IEEE Standards Coordinating Committee in the international standard for power quality IEEE 1159-2019, 17 power quality fluctuations are simulated, including: 1 kind of normal power quality fluctuation, 7 kinds of single power quality disturbances, and 9 kinds of composite power quality disturbances.
[0106] Among them, the simulation of 7 kinds of single power quality disturbances includes:
[0107] D1: Harmonics; D2: Voltage Sag; D3: Voltage Surge; D4: Voltage Interruption; D5: Voltage Flicker; D6: Transient Oscillation; D7: Transient Pulse.
[0108] The basis for 7 types of single - simulation power quality disturbances is shown in Table 1 below:
[0109] Table 1 7 Types of Single Power Quality Disturbances
[0110]
[0111] In this embodiment, 9 types of composite power quality disturbances are also constructed, namely D8: Harmonics + Voltage Sag, D9: Harmonics + Voltage Surge, 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.
[0112] In step S1 of this embodiment, the basis for 9 types of feature extraction is as follows:
[0113] F1: The time ratio of the part greater than 1.02 p.u. in the fundamental wave amplitude - time curve to the entire detection duration; F2: The time ratio of the part less than 0.98 p.u. in the fundamental wave amplitude - time curve to the entire detection duration; F3: The time ratio of the part less than 0.15 p.u. in the fundamental wave amplitude - time curve to the entire detection duration; F4: The sum of low - order harmonic skewness; F5: The sum of medium - order harmonic skewness; F6: The sum of standard deviations of medium - order harmonics; F7: The sum of kurtosis of high - order harmonics; F8: The sum of standard deviations of high - order harmonics; F9: The average value of the total harmonic distortion rate. As shown in Table 2 below:
[0114] Table 2 Basis for 9 Types of Feature Extraction
[0115]
[0116]
[0117] In step S1 of this embodiment, the method of feature extraction is as follows:
[0118] Use the S - transform for feature extraction. The fundamental frequency of the disturbance is set to 50 HZ, and the S - transform of the square - integrable signal x(t) is defined by the following formula:
[0119]
[0120] $S(\tau,f)$ represents the result of the S transform, where $t$ is time, $f$ is frequency, $\omega$ is the Gaussian window, $\tau$ is the parameter controlling the position of the Gaussian window on the time axis, and $e^{j2\pi ft}$ is a complex exponential signal with frequency $f$. The S transform can ultimately be described as:
[0121]
[0122] In this embodiment, $x(wT)$ is introduced, where $w$ represents the discrete time sequence applied to $x(t)$, and $T$ represents the sampling time. The discrete Fourier transform is shown by 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 generation set. The S transform of the discrete time series $x(wT)$ is shown by the following formula:
[0125]
[0126] According to the changed discrete S transform formula, feature extraction is performed on the power quality disturbance signal. In step S1 of this embodiment, the data normalization method after feature extraction is:
[0127] Using normalization processing, all eigenvalues are mapped to the range from $-\pi$ to $\pi$, and the mean value of each feature data after normalization is 0. The mapping formula is shown as follows:
[0128]
[0129] In this processing, $X$ i represents the data of the column corresponding to the corresponding feature, represents the average value of the original column of data.
[0130] In step S2 of this embodiment, the method of feature dimensionality reduction is:
[0131] The purpose of feature dimensionality reduction is to reduce the computational overhead. In this embodiment, for 9 power quality disturbance feature dimensions, this embodiment needs to reduce it to two feature dimensions. That is, from the basis $\{F$ 1 , $F$ 2 , …, $F$ 9} changes to the basis $\{u$ 1 , $u$ 2}. In this embodiment, $m$ is called the number of samples of the data, and the average value of the samples is 0, that is, $\overline{X}$ center = 0, and the projection distance of the data point $X$ i on the orthogonal basis $\{u$ 1 , $u$ 2} is $x$ T ·$u$j The variance of the projection of all data 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 the {u j} corresponding to the maximum Var, and the covariance matrix of X after mean normalization is denoted as S, as shown in the following formula: 1 ,u 2}
[0134]
[0135] Then, the covariance matrix is subjected to singular value decomposition (SVD) as shown in the following formula:
[0136]
[0137] where the column vectors of U and V are orthogonal to each other in pairs and have a modulus of 1. And S can be subjected to eigenvalue decomposition. U is the set of new coordinates, and μ is the set of eigenvalues. In this embodiment, the eigenvalues are sorted from largest to smallest, and the eigenvectors corresponding to the first 2 eigenvalues are taken as the 2 new orthogonal bases {u 1 ,u 2 ,}. Through the above method, the data of 9 dimensions is reduced to the data of two dimensions.
[0138] In step S2 of this embodiment, the method of quantum feature mapping is as follows:
[0139] Use the first quantum encoding circuit for feature mapping. The first quantum encoding circuit is as Figure 2 shown.
[0140] The components of the first quantum encoding circuit include:
[0141] Hadamard gates, phase gates RZ gates, and controlled rotation gates CNOT gates;
[0142] In this embodiment, the method for constructing the circuit structure of the first quantum encoding circuit is as follows:
[0143] The circuit uses 2 qubits and constructs a circuit on the two qubits. First, all qubits are set to the initial state |0>; after each qubit passes through the Hadamard gate, the quantum state becomes a superposition state, and the formula is described as follows:
[0144]
[0145] Next, each qubit passes through the phase gate RZ gate, and classical data is encoded into the quantum state. The parameter of the RZ gate is the data to be encoded. After passing through the RZ gate, classical data is encoded into the quantum state. The physical meaning of the RZ gate is that the qubit rotates by a specified angle around the Z axis. 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 sequentially adding the controlled rotation gate CNOT gate to each qubit, the conditional flip between qubits is realized. The role of the CNOT gate is to introduce entanglement between qubits, and its matrix representation is:
[0148]
[0149] The addition logic of the CNOT gate is:
[0150] Starting from the first qubit to the last qubit, the controlled rotation gate CNOT gate is sequentially added: the qubit in the previous position controls the conditional flip of the qubit in the next position, and the last qubit controls the conditional flip of the first qubit.
[0151] In step S2 of this embodiment, the construction method of the first parameterized quantum circuit is:
[0152] As Figure 3 shown, the circuit of the first parameterized quantity is composed of 2 identical cells connected in series front and back.
[0153] The construction method of each cell is:
[0154] Each cell uses 2 qubits, and one cell uses 2 G gates and 2 CNOT gates. A G gate is connected after each qubit. The description of the G gate is shown in the following formula:
[0155]
[0156] Among them, α, β, and γ are all learnable parameters. Any rotation of the qubit on the Bloch sphere is described by three parameters. α represents the amplitude, β and γ represent two phase angles, i represents the imaginary number, and e iβ can be written as e iβ = cosβ + isinβ by Euler's formula, which relates the polar coordinate representation of a complex number to trigonometric functions. The meaning of e iγ is the same as that of e iβ ; each G gate contains 3 learnable parameters α, β, and γ, representing the rotation of the qubit around the x, y, and z axes on the Bloch sphere, and the initial parameters are randomly generated.
[0157] Add a CNOT gate after the G gate. The addition logic of the CNOT gate is as follows: starting from the first qubit to the last qubit, add controlled rotation gates CNOT gates in sequence. The qubit of the previous position controls the conditional flip of the qubit of the next position, and the qubit of the last position controls the conditional flip of the first qubit.
[0158] In step S2 of this embodiment, the method for parameter update is as follows:
[0159] Perform parameter update through second-order moment estimation. The steps for updating the parameters are as follows:
[0160] First, through quantum measurement, convert the quantum state into classical data. The specific operations are as follows:
[0161] Perform Pauli-Z measurement on each quantum. First, construct the Hamiltonian Hz for Pauli-Z measurement, as shown in the following formula:
[0162]
[0163] The result of the quantum measurement is e, which represents the expected energy obtained after measuring the quantum state, as shown in the following formula:
[0164] e = <ψ′(X)|H z |ψ′(X)>
[0165] Among them, |ψ′(X)> represents the quantum state after passing through the parameterized circuit. Then, based on the result of the quantum measurement, use the method of second-order moment estimation 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, calculate the expected measurement value of the measured quantum circuit, denoted as E, as shown in the following formula:
[0167]
[0168] After obtaining the expectation, in this embodiment, g represents 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. After calculating the gradient, update the parameters through 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 formulas are as follows:
[0171] mt ←0.9m t-1 +0.1g t
[0172]
[0173] The formula for updating the trainable parameter θ is as follows:
[0174]
[0175] Where η represents the learning rate, and in the model, η = 0.001 is taken.
[0176] In step S3 of this embodiment, the method for feature dimensionality elevation is:
[0177] Use an autoencoder to elevate the features, as Figure 6 shown. In this embodiment, 9 features of the power quality disturbance data are elevated to 16 features, aiming to improve the recognition accuracy. The construction method of the autoencoder is:
[0178] The autoencoder includes: an encoder and a decoder; among them, the encoder receives nine-dimensional power quality disturbance features and is sequentially connected to three hidden layers at the back. The first hidden layer contains 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 contains 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 as the final output of the encoder. Among them, the decoder receives a sixteen-dimensional input and is sequentially connected to three hidden layers at the back. The first hidden layer contains 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 contains 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 as the final output of the decoder. 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.
[0179] In step S3 of this embodiment, the method for quantum feature mapping is:
[0180] As Figure 4 shown, use the second quantum encoding circuit for quantum feature mapping.
[0181] The second quantum encoding circuit includes: Hadamard gate, phase gate RZ gate, controlled rotation gate CNOT gate; the number of qubits used is 16, and the circuit construction method is the same as that of the first quantum encoding circuit, so no more details will be elaborated.
[0182] In step S3 of this embodiment, the construction method of the second parameterized quantum circuit is as follows:
[0183] The circuit of the second parameterized quantity consists of 16 qubits and 6 identical cells connected in series before and after.
[0184] As Figure 5 shown, the construction method of each cell is similar to that of the cell of the first parameterized quantum circuit, and will not be elaborated here.
[0185] In step S3 of this embodiment, the method for updating the second moment estimation parameter is as follows:
[0186] Similar to the method for updating the second moment estimation parameter in step S2, it will not be elaborated here.
[0187] In step S4 of this embodiment, the method for locating the power quality disturbance time is as follows:
[0188] As Figure 7 shown, according to the recognition results of each power quality disturbance sequence by the power quality disturbance recognition model, compare the disturbance type at the current time step with the type at the previous time step to determine whether the disturbance type has changed. If the disturbance type has not changed, continue to process the next time step. When it is detected that the disturbance type has changed, record the start and end times of the disturbance and mark the occurrence range of the disturbance event.
[0189] Embodiment 2:
[0190] A power quality disturbance detection and recognition method based on the quantum variational algorithm,
[0191] Process 1: Simulate power quality fluctuations, including normal fluctuations and fluctuations with disturbances.
[0192] Process 2: Extract features from the simulated power quality fluctuations through the S-transform.
[0193] Process 3: Normalize the data after feature extraction.
[0194] Process 4: Perform dimensionality reduction on all the data after feature extraction.
[0195] Process 5: Perform quantum machine learning on the data after dimensionality reduction through the quantum variational algorithm, where the quantum variational algorithm includes quantum encoding, parameterized quantum circuit, quantum measurement, and parameter update.
[0196] Process 6: Perform dimensionality increase on the data identified as containing disturbances.
[0197] Process Seven: The data after dimensionality elevation undergoes quantum machine learning through the quantum variational algorithm, where the quantum variational algorithm includes quantum encoding, parameterized quantum circuits, quantum measurement, and parameter update.
[0198] Process Eight: Based on the recognition result of the perturbation, determine the start time, end time, and duration of the power quality perturbation.
[0199] Embodiment Three:
[0200] The present invention also provides a power quality perturbation detection and recognition system based on the quantum variational algorithm, including:
[0201] A1: A signal extraction module for extracting the fluctuation signal in the power quality;
[0202] A2: A preprocessing module that uses the S-transform to extract features from the fluctuation signal and preprocesses the extracted feature data;
[0203] A3: A power quality perturbation detection module that reduces the dimensionality of the feature data and uses the power quality perturbation detection model to detect whether there is a power quality perturbation in the power quality fluctuation signal;
[0204] A4: A power quality perturbation recognition module that elevates the dimensionality of the feature data and determines the type of perturbation that occurs for the power quality fluctuation signal with a perturbation;
[0205] A5: A time localization module that determines the start and end times and duration of a specific power quality perturbation based on the result of the power quality perturbation recognition model;
[0206] A6: A data storage module that records the power quality fluctuation data, feature data, the type of power quality perturbation, and the start and end times and duration of the perturbation.
[0207] The embodiments described above are only descriptions of the preferred embodiments of the present invention and do not limit the scope of the present invention. Without departing from the design spirit of the present invention, various deformations and improvements made by those of ordinary skill in the art to the technical solutions of the present invention shall fall within the protection scope determined 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 to distinguish the data with power quality disturbance and the normal data from the preprocessed power quality signal; 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; S3: identifying the specific type of disturbance in the data with power quality disturbance through a power quality disturbance identification model; the power quality disturbance identification model includes: data dimension upgrade, second quantum feature mapping, second parameterized quantum circuit and second-order moment estimation update parameter; S4: Determine the start time, duration and end time of the disturbance through the power quality disturbance time location model and according to the output result of the power quality disturbance identification model.
2. The method for detecting and identifying power quality disturbances based on quantum variational algorithm according to claim 1 is characterized in that: In step S1, the power quality signal is simulated, and the simulated signal includes: D0: normal power quality disturbance; D1: harmonic; 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 non-disturbance, 7 types of single power quality disturbances and 9 types of composite power quality disturbances.
3. The method for detecting and identifying power quality disturbances 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 controlling the time axis position of the Gaussian window, and 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.98pu in the entire detection time; F3: The proportion of the time when the fundamental amplitude time curve is less than 0.15pu in the entire detection time; F4: The sum of the skewness of low-order harmonics; F5: The sum of the skewness of medium-order harmonics; F6: The sum of the standard deviations of medium-order harmonics; F7: The sum of the kurtosis of high-order harmonics; F8: The sum of the standard deviations of high-order harmonics; F9: The average value of total harmonic distortion; In step S1, the method for normalization processing is: 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 Represents the data of the column corresponding to the corresponding feature, Represents 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 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 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 to transform the initial state |0> into a superposition state. At this time, the quantum state does not 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 is passed through the phase gate RZ gate. 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 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 realized 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.
6. The method for detecting and identifying power quality disturbances based on quantum variational algorithm according to claim 5 is characterized in that: In step S2, the method for constructing the first parameterized quantum circuit is: The first parameterized quantum circuit is composed of a number of 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 formula definition of the G gate is 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β It is expressed as e through Euler's formula iβ =cosβ+isinβ,e iβ The formula for the representation of complex numbers relates the polar coordinate representation to trigonometric functions, e iγ The meaning and iβ same; The three initial parameters of each G gate are randomly generated; the CNOT gate is connected after the G gate.
7. 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 updating the parameters by second-order moment estimation is: First, the quantum state is converted into classical data through quantum measurement, and then the parameters are optimized on a classical computer using the second-order moment estimation method based on the result of quantum measurement; wherein the quantum measurement method is: 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 result of quantum measurement 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 measured results, the gradient is calculated and the parameters are updated using the second-order moment estimation.
8. The method for detecting and identifying power quality disturbances 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.
9. The method for detecting and identifying power quality disturbances based on quantum variational algorithm according to claim 1 is characterized in that: In step S3, the method of the second quantum feature mapping 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; taking the |0> state as the initial state; First, the initial state |0> passes through the Hadamard gate to transform the initial state |0> into a superposition state; then, the superposition state passes through the phase gate RZ gate, and 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; finally, the conditional flip between quantum bits is realized through the controlled rotation gate CNOT; 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 by the second parameterized quantum circuit; In step S3, the method for constructing the second parameterized quantum circuit is: The second parameterized quantum circuit is composed of a number of identical cells, each cell is composed of n G gates and n CNOT gates, where n represents the number of quantum bits used in the quantum circuit; three initial parameters of each G gate are randomly generated; a CNOT gate is connected after the G gate; In step S3, the method of updating the parameters by second-order moment estimation is: First, the quantum state is converted into classical data through quantum measurement, and then the parameters are optimized on a classical computer using the second-order moment estimation method based on the result of the quantum measurement; wherein the quantum measurement method is: Pauli-Z measurement, and the quantum measurement result is the expected energy of the quantum circuit; Based on the measured results, the gradient is calculated and the parameters are updated using the second-order moment estimation.
10. The method for detecting and identifying power quality disturbances 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 recognition results of each power quality disturbance sequence by the power quality disturbance recognition 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, continue to process the next time step. 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
Quantum, biological, computer vision, and neural network systems for industrial internet of things
WO2022236064A2