Power quality disturbance signal compression reconstruction method based on compressed sensing

The signal is divided by sliding window, and the Gaussian random measurement matrix and iteratively updated sparse dictionary are used to compress and reconstruct the power quality perturbation signal, which solves the problem of low reconstruction accuracy caused by fixed dictionaries and achieves higher signal reconstruction accuracy.

CN119865187APending Publication Date: 2025-04-22CHINA TELECOM CLOUD TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411630445.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-14
Publication Date
2025-04-22

AI Technical Summary

Technical Problem

In the prior art, fixed dictionaries cannot be adjusted according to the specific electrical energy quality disturbance signal characteristics, resulting in sparse representations that are not accurate enough, which in turn leads to low reconstruction accuracy.

Method used

The signal is intercepted through the sliding window, divided into a first signal set and a second signal set, and the signals in the second signal set are compressed and sampled using a Gaussian random measurement matrix to generate a low-dimensional signal. Then, the initial dictionary is determined based on the first signal set, and through multiple iterative updates, a target sparse dictionary and a sparse coefficient matrix are generated for reconstruction of the low-dimensional signal.

Benefits of technology

By optimizing the sparse dictionary and sparse coefficient matrix, the original power quality signal can be restored more accurately, improving the accuracy of signal reconstruction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119865187A_ABST
    Figure CN119865187A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of power quality analysis and processing, and discloses a power quality disturbance signal compression reconstruction method based on compressed sensing, which comprises the following steps: intercepting a power quality disturbance signal based on a sliding window to obtain a signal matrix; dividing the signal matrix into a first signal set and a second signal set according to a preset proportion; performing compressed sampling on each signal in the second signal set based on a Gaussian random measurement matrix to obtain a corresponding low-dimensional signal; determining an initial dictionary based on the first signal set, and updating the initial dictionary to obtain a target sparse dictionary and a target sparse coefficient matrix; and reconstructing the low-dimensional signal based on the target sparse dictionary and the target sparse coefficient matrix to obtain a corresponding reconstructed signal, thereby obtaining a power quality signal. According to the method, the initial dictionary is determined by using the first signal set, the initial dictionary is updated, the updated sparse dictionary and sparse coefficient matrix are used for reconstruction, the original power quality signal is accurately recovered, and the reconstruction precision is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of power quality analysis and processing, and in particular to a method for compressing and reconstructing power quality disturbance signals based on compressed sensing. Background Art

[0002] With the access of a large number of distributed new power sources and nonlinear loads such as electric vehicles to the power grid, the power system is facing the challenges of increasing data volume and increasingly prominent power quality issues. In order to meet the demand for high-quality power supply, it is necessary to reconstruct the power quality disturbance signal and restore the original power quality signal containing disturbance information. By analyzing the original power quality signal, the disturbance can be analyzed and processed more accurately, and the power quality can be improved and controlled.

[0003] At present, signal reconstruction is usually carried out using compressed sensing theory. The core idea of ​​compressed sensing theory is that the signal is sparse or approximately sparse, that is, the signal has only a few non-zero coefficients under a suitable representation. The compressed reconstruction of power quality disturbance signals is achieved by using compressed dimension reduction, constructing a sparse dictionary, and reconstructing the signal in three steps.

[0004] However, the sparse dictionary in the above method uses a fixed dictionary, which is a matrix obtained by transforming a specific function, such as a DCT dictionary (Discrete Cosine Transform) and a DWT (Discrete Wavelet Transform) dictionary. The fixed dictionary cannot be adjusted according to the characteristics of the specific power quality disturbance signal, which may lead to inaccurate sparse representation and low reconstruction accuracy. Summary of the invention

[0005] In view of this, the present invention provides a method for compressing and reconstructing a power quality disturbance signal based on compressed sensing to solve the problem of low reconstruction accuracy.

[0006] In a first aspect, the present invention provides a method for compressing and reconstructing a power quality disturbance signal based on compressed sensing, the method comprising:

[0007] The power quality disturbance signal is intercepted based on the sliding window to obtain a signal matrix;

[0008] Dividing the signal matrix into a first signal set and a second signal set according to a preset ratio;

[0009] For each signal in the second signal set, compressively sample each signal based on a Gaussian random measurement matrix to obtain a low-dimensional signal corresponding to each signal;

[0010] Determine an initial dictionary based on the first signal set, update the initial dictionary, and obtain a target sparse dictionary and a target sparse coefficient matrix;

[0011] Each low-dimensional signal corresponding to the second signal set is reconstructed based on the target sparse dictionary and the target sparse coefficient matrix to obtain a reconstructed signal corresponding to each low-dimensional signal, and a power quality signal is obtained based on the reconstructed signal corresponding to each low-dimensional signal.

[0012] The method for compressing and reconstructing power quality disturbance signals based on compressed sensing provided by an embodiment of the present invention can intercept signals through a sliding window to intercept a signal matrix formed by multiple sub-signals, divide the signal matrix into a first signal set for training a dictionary and a second signal set for compressing and reconstructing, and for each signal in the second signal set, compressively sample each signal based on a Gaussian random measurement matrix to obtain a low-dimensional signal corresponding to each signal. Compared with reconstructing using high-dimensional signals, the amount of data is greatly reduced, and the storage and transmission costs are greatly reduced. The initial dictionary is determined by using the first signal set, and a target sparse dictionary that can accurately represent the signal can be generated by updating the initial dictionary. The optimization of the sparse dictionary enables the signal to more accurately restore the original information during reconstruction, thereby improving the quality of reconstruction. Finally, each low-dimensional signal is reconstructed using the optimized sparse dictionary and sparse coefficient matrix. Compared with using a fixed dictionary, the original power quality signal can be accurately restored, thereby improving the accuracy of signal reconstruction.

[0013] In an optional implementation, determining an initial dictionary based on the first signal set, updating the initial dictionary, and obtaining a target sparse dictionary and a target sparse coefficient matrix include:

[0014] For each low-dimensional signal corresponding to the second signal set, an improved SWOMP algorithm is used to perform sparse coding based on each low-dimensional signal, the initial dictionary and the sparse coefficient matrix of the second signal set to obtain a first round of updated sparse coefficient matrix;

[0015] Using the singular value decomposition method, based on each low-dimensional signal, the initial dictionary and the sparse coefficient matrix of the first round of update, the initial dictionary is updated to obtain the sparse dictionary of the first round of update;

[0016] Determine a first-round updated sparse representation error based on each low-dimensional signal, a first-round updated sparse coefficient matrix, and a first-round updated sparse dictionary;

[0017] The sparse dictionary updated in the first round is used as the initial dictionary for the next round of update, and the above process of determining the sparse coefficient matrix, sparse dictionary and sparse representation error is repeated until the sparse representation error is within the preset error range, thereby obtaining the target sparse dictionary and target sparse coefficient matrix.

[0018] The compressed sensing-based power quality disturbance signal compression and reconstruction method provided in the embodiment of the present invention can effectively find the sparse representation of the signal in the sparse dictionary by adopting the improved SWOMP algorithm, thereby reducing the number of atoms required for the sparse representation. The singular value decomposition method can effectively extract the main components in the sparse dictionary, remove redundant information, and improve the quality of the sparse dictionary. Through multiple rounds of iterative updates, the sparse dictionary and the sparse coefficient matrix are adaptively adjusted to finally obtain the target sparse dictionary and the target sparse coefficient matrix, thereby improving the reconstruction accuracy.

[0019] In an optional implementation, for each low-dimensional signal corresponding to the second signal set, an improved SWOMP algorithm is used to perform sparse coding based on each low-dimensional signal, the initial dictionary, and the sparse coefficient matrix of the second signal set to obtain a first round of updated sparse coefficient matrix, including:

[0020] Obtaining target threshold parameters and the first residual, observation matrix and atomic set obtained from the last encoding;

[0021] Based on the observation matrix obtained in the previous encoding and the first residual obtained in the previous encoding, an inner product of this encoding is obtained, and a maximum value of the inner product of this encoding is determined;

[0022] The atoms in the atomic set obtained in the previous encoding whose absolute value of the inner product is not less than the product of the target threshold parameter and the maximum inner product value constitute the pre-selected atomic support set for this encoding;

[0023] Based on the pre-selected atomic support set of this encoding, the observation matrix and the atomic set obtained in the previous encoding, the observation matrix and the atomic set of this encoding are updated to obtain the observation matrix and the atomic set of this encoding;

[0024] When the atom set encoded this time is inconsistent with the atom set obtained in the previous encoding, return to the step of obtaining the target threshold parameter and the first residual, the observation matrix and the atom set obtained in the previous encoding, until the atom set encoded this time is consistent with the atom set obtained in the previous encoding, and obtain the target observation matrix;

[0025] Solve based on each low-dimensional signal and target observation matrix to obtain a temporary sparse coefficient matrix for this encoding;

[0026] A first residual of this encoding is obtained based on the temporary sparse coefficient matrix of this encoding, each low-dimensional signal and the target observation matrix. When the first residual of this encoding is greater than a preset threshold, the process returns to the step of obtaining the target threshold parameter and the first residual, the observation matrix and the atomic set obtained in the previous encoding until the first residual of this encoding is not greater than the preset threshold, thereby obtaining an intermediate sparse coefficient matrix.

[0027] When the intermediate sparse coefficient matrix satisfies the mathematical expression formed by the sparse coefficient matrices of each low-dimensional signal, the initial dictionary and the second signal set, the intermediate sparse coefficient matrix is ​​used as the sparse coefficient matrix for the first round of updating.

[0028] The compressed sensing-based power quality disturbance signal compression reconstruction method provided by the embodiment of the present invention reflects the correlation between the observation matrix and the first residual by calculating the inner product. Selecting the maximum value helps to find the most relevant atom at present. By setting the target threshold parameter, the atoms that have important contributions to the signal representation can be effectively screened out to reduce redundancy. Each encoding updates the observation matrix and the atom set based on the latest pre-selected atomic support set, gradually approaching the optimal solution. With each encoding, the observation matrix and the atom set are continuously updated to better adapt to the characteristics of the signal. Through multiple iterations, the target observation matrix is ​​obtained until the atom set no longer changes. The target observation matrix is ​​solved using the target observation matrix, so that the temporary sparse coefficient matrix more accurately reflects the true components of the signal. The intermediate sparse coefficient matrix is ​​obtained by gradually reducing the residual through repeated iterative optimization. The final sparse coefficient matrix is ​​obtained by verifying whether the intermediate sparse coefficient matrix satisfies the mathematical expression, thereby improving the quality of the reconstructed signal.

[0029] In an optional implementation, obtaining a target threshold parameter includes:

[0030] Obtaining the threshold parameter, the second residual, the first temporary residual, and the second temporary residual obtained in the previous iteration;

[0031] Based on the threshold value parameter obtained in the previous round of iteration, determine the first adaptive parameter of the current round of iteration and the second adaptive parameter of the current round of iteration;

[0032] When the first adaptive parameter of the current iteration is within the preset parameter range, the first temporary residual obtained in the previous iteration is updated to obtain the first temporary residual of the current iteration; when the second adaptive parameter of the current iteration is within the preset parameter range, the second temporary residual obtained in the previous iteration is updated to obtain the second temporary residual of the current iteration;

[0033] Based on the first temporary residual of the current iteration, the second temporary residual of the current iteration and the second residual obtained in the previous iteration, an update is performed to obtain the second residual of the current iteration and the threshold parameter of the current iteration;

[0034] The above process of determining the first temporary residual, the second temporary residual, the second residual and the threshold parameter is repeated until a preset iteration stop condition is met, and a target threshold parameter is obtained.

[0035] The compressed sensing-based power quality disturbance signal compression and reconstruction method provided in an embodiment of the present invention ensures the continuity and coherence of the algorithm by utilizing the result of the previous round of iteration as the basis of the current round of iteration, determines the first adaptive parameter of the current round of iteration and the second adaptive parameter of the current round of iteration based on the threshold parameter obtained in the previous round of iteration, and iteratively updates the threshold parameter in combination with multiple information, so that atoms can be selected more accurately by dynamically adjusting the threshold parameter, thereby improving the accuracy of sparse representation and enhancing the adaptability.

[0036] In an optional implementation, the second residual of the current iteration and the threshold parameter of the current iteration are obtained by updating based on the first temporary residual of the current iteration, the second temporary residual of the current iteration, and the second residual obtained in the previous iteration, including:

[0037] Determine whether the first temporary residual of this iteration is greater than the second residual obtained in the previous iteration;

[0038] When the first temporary residual of the current iteration is not greater than the second residual obtained in the previous iteration, the second residual of the current iteration is made equal to the first temporary residual of the current iteration, and the threshold parameter of the current iteration is made equal to the first adaptive parameter of the current iteration; or,

[0039] When the first temporary residual of this round of iteration is greater than the second residual obtained in the previous round of iteration, the second residual of this round of iteration is made equal to the second residual obtained in the previous round of iteration, and the threshold parameter of this round of iteration is made equal to the threshold parameter obtained in the previous round of iteration.

[0040] The compressed sensing-based power quality disturbance signal compression and reconstruction method provided by the embodiment of the present invention ensures that the algorithm moves in the direction of reducing errors by updating the second residual and the threshold value parameter when the first temporary residual of the current iteration is not greater than the second residual obtained in the previous iteration. When the first temporary residual of the current iteration is greater than the second residual obtained in the previous iteration, retaining the previous good results can prevent the algorithm performance from degrading, thereby ensuring the stability and robustness of the algorithm. By dynamically adjusting the threshold value parameter, it is helpful to select atoms more accurately, thereby improving the reconstruction accuracy.

[0041] In an optional implementation, when the first temporary residual of the current iteration is not greater than the second residual obtained in the previous iteration, after making the second residual of the current iteration equal to the first temporary residual of the current iteration and making the threshold parameter of the current iteration equal to the first adaptive parameter of the current iteration, the method further includes:

[0042] Determine whether the second temporary residual of this round of iteration is greater than the second residual obtained in this round of iteration;

[0043] When the second temporary residual of the current iteration is not greater than the second residual obtained in the current iteration, the second residual of the current iteration and the threshold parameter are updated to make the second residual of the current iteration equal to the second temporary residual of the current iteration, and the threshold parameter of the current iteration equal to the second adaptive parameter of the current iteration; or,

[0044] When the second temporary residual of the current iteration is greater than the second residual obtained in the current iteration, the second residual of the current iteration and the threshold parameter of the current iteration are kept unchanged.

[0045] The compressed sensing-based power quality disturbance signal compression and reconstruction method provided by the embodiment of the present invention determines whether the second temporary residual of the current iteration is not greater than the updated second residual after updating after updating, so that the second residual and the threshold value parameter continue to be updated when it is not greater than, thereby ensuring that the algorithm moves in the direction of reducing errors. When the second temporary residual of the current iteration is greater than the updated second residual, retaining the previous good results can prevent the algorithm performance from degrading, thereby ensuring the stability and robustness of the algorithm. By dynamically adjusting the threshold value parameter, it is helpful to select atoms more accurately, thereby improving the reconstruction accuracy.

[0046] In an optional implementation, when the first temporary residual of the current iteration is greater than the second residual obtained in the previous iteration, the second residual of the current iteration is made equal to the second residual obtained in the previous iteration, and the threshold parameter of the current iteration is made equal to the threshold parameter obtained in the previous iteration, the method further includes:

[0047] Determine whether the second temporary residual of this iteration is greater than the second residual obtained in the previous iteration;

[0048] When the second temporary residual of the current iteration is not greater than the second residual obtained in the previous iteration, the second residual of the current iteration is made equal to the second temporary residual of the current iteration, and the threshold parameter of the current iteration is made equal to the second adaptive parameter of the current iteration; or,

[0049] When the second temporary residual of this round of iteration is greater than the second residual obtained in the previous round of iteration, the second residual of this round of iteration is made equal to the second residual obtained in the previous round of iteration, and the threshold parameter of this round of iteration is made equal to the threshold parameter obtained in the previous round of iteration.

[0050] In the compressed sensing-based power quality disturbance signal compression and reconstruction method provided by the embodiment of the present invention, since the first temporary residual of the current iteration is greater than the second residual of the previous iteration, that is, the second residual and the threshold parameter are not updated, it is judged whether the second temporary residual of the current iteration is not greater than the second residual of the previous iteration, so that the second residual and the threshold parameter are updated when it is not greater than, ensuring that the algorithm moves in the direction of reducing errors. When the second temporary residual of the current iteration is greater than the second residual of the previous iteration, retaining the previous good results can prevent the algorithm performance from degrading, thereby ensuring the stability and robustness of the algorithm. By dynamically adjusting the threshold parameter, it is helpful to select atoms more accurately, thereby improving the reconstruction accuracy.

[0051] In an optional implementation, for each signal in the second signal set, before performing compressive sampling on each signal based on a Gaussian random measurement matrix to obtain a low-dimensional signal corresponding to each signal, the method further includes:

[0052] Constructing a measurement matrix based on a preset number of rows and a preset number of columns;

[0053] Each element in the measurement matrix is ​​made to obey a Gaussian distribution with a mean of zero and a variance of the inverse of a preset number of rows, thereby obtaining a Gaussian random measurement matrix.

[0054] The compressed sensing-based power quality disturbance signal compression and reconstruction method provided in an embodiment of the present invention determines the size of the measurement matrix, i.e., the number of rows and columns, so that each element in the measurement matrix obeys a Gaussian distribution with a mean of zero and a variance of the inverse of a preset number of rows. This is used for subsequent compressed sampling, significantly reducing the dimension of data processing, thereby reducing the computational complexity of subsequent reconstruction.

[0055] In a second aspect, the present invention provides a device for compressing and reconstructing a power quality disturbance signal based on compressed sensing, the device comprising:

[0056] An interception module is used to intercept the power quality disturbance signal based on a sliding window to obtain a signal matrix;

[0057] A division module, used for dividing the signal matrix into a first signal set and a second signal set according to a preset ratio;

[0058] A compression module, configured to perform compression sampling on each signal in the second signal set based on a Gaussian random measurement matrix to obtain a low-dimensional signal corresponding to each signal;

[0059] An updating module, configured to determine an initial dictionary based on the first signal set, update the initial dictionary, and obtain a target sparse dictionary and a target sparse coefficient matrix;

[0060] A reconstruction module is used to reconstruct each low-dimensional signal corresponding to the second signal set based on a target sparse dictionary and a target sparse coefficient matrix to obtain a reconstructed signal corresponding to each low-dimensional signal, and obtain a power quality signal based on the reconstructed signal corresponding to each low-dimensional signal.

[0061] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the computer instructions to execute the compressed sensing-based power quality disturbance signal compression and reconstruction method of the above-mentioned first aspect or any corresponding embodiment thereof.

[0062] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the compressed sensing-based power quality disturbance signal compression and reconstruction method of the above-mentioned first aspect or any corresponding embodiment thereof.

[0063] In a fifth aspect, the present invention provides a computer program product, comprising computer instructions, wherein the computer instructions are used to enable a computer to execute the compressed sensing-based power quality disturbance signal compression and reconstruction method of the above-mentioned first aspect or any corresponding embodiment. BRIEF DESCRIPTION OF THE DRAWINGS

[0064] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0065] Figure 1 is a flow chart of a method for compressing and reconstructing a power quality disturbance signal based on compressed sensing according to an embodiment of the present invention;

[0066] Figure 2 is a schematic diagram of a sliding window according to an embodiment of the present invention;

[0067] Figure 3 is a flow chart of an improved SWOMP algorithm according to an embodiment of the present invention;

[0068] Figure 4 is a flowchart of another method for compressing and reconstructing a power quality disturbance signal based on compressed sensing according to an embodiment of the present invention;

[0069] Figure 5 is a structural block diagram of a device for compressing and reconstructing power quality disturbance signals based on compressed sensing according to an embodiment of the present invention;

[0070] Figure 6 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0071] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are 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 those skilled in the art without creative work are within the scope of protection of the present invention.

[0072] The related technology uses compressed sensing theory to reconstruct signals, and realizes the compressed reconstruction of power quality disturbance signals by using compressed dimension reduction, constructing sparse dictionaries, and reconstructing signals in three steps. However, the sparse dictionary used in the related technology is a fixed dictionary, which cannot be adjusted according to the characteristics of the specific power quality disturbance signal, which may cause the sparse representation to be inaccurate, resulting in low reconstruction accuracy. The compressed sensing-based power quality disturbance signal compression reconstruction method provided by the embodiment of the present invention compresses and samples each signal through a Gaussian random measurement matrix to obtain a low-dimensional signal corresponding to each signal. Compared with the reconstruction using high-dimensional signals, the amount of data is greatly reduced, and the storage and transmission costs are greatly reduced. By using the first signal set to determine the initial dictionary, a target sparse dictionary that can accurately represent the signal can be generated by updating the initial dictionary. Each low-dimensional signal is reconstructed using the optimized sparse dictionary and sparse coefficient matrix, and the original power quality signal can be accurately restored, thereby improving the accuracy of signal reconstruction.

[0073] According to an embodiment of the present invention, an embodiment of a method for compressing and reconstructing a power quality disturbance signal based on compressed sensing is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in an order different from that shown here.

[0074] In this embodiment, a power quality disturbance signal compression reconstruction method based on compressed sensing is provided, which can be used in electronic equipment. Figure 1 is a flow chart of a method for compressing and reconstructing a power quality disturbance signal based on compressed sensing according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:

[0075] Step S101, intercepting the power quality disturbance signal based on the sliding window to obtain a signal matrix. Specifically, Figure 2 is a schematic diagram of a sliding window according to an embodiment of the present invention, such as Figure 2 As shown, the acquired power quality disturbance signal is intercepted into a matrix according to the sliding window, that is, the one-dimensional power quality disturbance signal is intercepted according to a certain window size, and overlap between two adjacent sliding windows is allowed. The obtained signal matrix includes N sub-signals. For the convenience of subsequent data processing, N is generally taken as a power of 2, such as 1024.

[0076] Step S102, dividing the signal matrix into a first signal set and a second signal set according to a preset ratio. Specifically, the signal matrix intercepted by the sliding window is divided into a first signal set for training the dictionary and a second signal set for compression and reconstruction according to a preset ratio. The preset ratio can be 7:3, which is only taken as an example and is not limited thereto.

[0077] Step S103, for each signal in the second signal set, compress and sample each signal based on the Gaussian random measurement matrix to obtain a low-dimensional signal corresponding to each signal. Specifically, the Gaussian random measurement matrix has a strong randomness, it is not related to most orthogonal bases or orthogonal dictionaries, and can reconstruct sparse signals with a high probability through a small number of measurement values. At the same time, since the signals in the second signal set are all high-dimensional signals, the high-dimensional signals are compressed based on the Gaussian random measurement matrix to reduce the space occupied by data generation, improve resource utilization, and remove redundant information while maintaining the basic quality of the data. Optionally, any high-dimensional signal in the second signal set can be compressed and sampled by the following formula (1) to obtain a low-dimensional signal.

[0078] y=φx(1)

[0079] Wherein, y represents a low-dimensional signal corresponding to any high-dimensional signal in the second signal set; φ represents a Gaussian random measurement matrix; and x represents the high-dimensional signal.

[0080] Step S104, determine the initial dictionary based on the first signal set, update the initial dictionary, and obtain a target sparse dictionary and a target sparse coefficient matrix. Specifically, compared with the use of a fixed dictionary in the related art, the initial dictionary in the embodiment of the present invention is selected from the first signal set of the power quality disturbance signal, and the K-SVD (K-Singular Value Decomposition, K-singular value decomposition) algorithm is used to perform multiple iterations based on the initial dictionary to obtain a target sparse dictionary that highly contains power quality disturbance signal information, and obtains a sparse representation of each low-dimensional signal, that is, a target sparse coefficient matrix.

[0081] Step S105, reconstruct each low-dimensional signal corresponding to the second signal set based on the target sparse dictionary and the target sparse coefficient matrix to obtain a reconstructed signal corresponding to each low-dimensional signal, and obtain a power quality signal based on the reconstructed signal corresponding to each low-dimensional signal. Specifically, since the second signal set includes multiple compressed low-dimensional signals, for any low-dimensional signal, based on the target sparse dictionary and the sparse coefficients corresponding to the low-dimensional signal in the target sparse coefficient matrix, the following formula (2) is used to reconstruct and obtain a reconstructed signal corresponding to the low-dimensional signal. By obtaining the reconstructed signal corresponding to each low-dimensional signal in the second signal set, these reconstructed signals are combined to form a total reconstructed signal matrix for representing the power quality signal.

[0082] y=D final θ final (2)

[0083] Where y represents the reconstructed signal corresponding to any low-dimensional signal; D final represents the target sparse dictionary; θ final Represents the sparse coefficients corresponding to the low-dimensional signal in the target sparse coefficient matrix.

[0084] The method for compressing and reconstructing power quality disturbance signals based on compressed sensing provided by an embodiment of the present invention can intercept signals through a sliding window to intercept a signal matrix formed by multiple sub-signals, divide the signal matrix into a first signal set for training a dictionary and a second signal set for compressing and reconstructing, and for each signal in the second signal set, compressively sample each signal based on a Gaussian random measurement matrix to obtain a low-dimensional signal corresponding to each signal. Compared with reconstructing using high-dimensional signals, the amount of data is greatly reduced, and the storage and transmission costs are greatly reduced. The initial dictionary is determined by using the first signal set, and a target sparse dictionary that can accurately represent the signal can be generated by updating the initial dictionary. The optimization of the sparse dictionary enables the signal to more accurately restore the original information during reconstruction, thereby improving the quality of reconstruction. Finally, each low-dimensional signal is reconstructed using the optimized sparse dictionary and sparse coefficient matrix. Compared with using a fixed dictionary, the original power quality signal can be accurately restored, thereby improving the accuracy of signal reconstruction.

[0085] In this embodiment, a method for compressing and reconstructing a power quality disturbance signal based on compressed sensing is provided, which can be used for the above-mentioned electronic device. The method specifically includes the following steps:

[0086] Step S201: intercept the power quality disturbance signal based on the sliding window to obtain a signal matrix. Figure 1 Step S101 of the illustrated embodiment will not be described in detail here.

[0087] Step S202: Divide the signal matrix into a first signal set and a second signal set according to a preset ratio. Figure 1 Step S102 of the illustrated embodiment will not be described in detail here.

[0088] Step S203, constructing a measurement matrix based on a preset number of rows and a preset number of columns. Specifically, the preset number of rows should be smaller than the preset number of columns to achieve the purpose of signal compression. The value of the preset number of rows is affected by the reconstruction algorithm and sparse dictionary used in compression reconstruction. An excellent reconstruction algorithm or a suitable dictionary can make the preset number of rows obtain a smaller value when setting.

[0089] Step S204, make each element in the measurement matrix obey a Gaussian distribution with a mean of zero and a variance of the inverse of a preset number of rows, to obtain a Gaussian random measurement matrix. Specifically, the Gaussian random measurement matrix can be referred to in the following formula (3).

[0090]

[0091] Where i,j represents any element in the Gaussian random observation matrix; φ i,j represents a Gaussian random observation matrix; N represents the preset number of columns; M represents the preset number of rows.

[0092] Step S205: for each signal in the second signal set, compressively sample each signal based on the Gaussian random measurement matrix to obtain a low-dimensional signal corresponding to each signal. Figure 1 Step S103 of the illustrated embodiment will not be described in detail here.

[0093] Step S206, determining an initial dictionary based on the first signal set, updating the initial dictionary, and obtaining a target sparse dictionary and a target sparse coefficient matrix.

[0094] Specifically, the above step S206 includes:

[0095] Step S2061, for each low-dimensional signal corresponding to the second signal set, an improved SWOMP algorithm is used to perform sparse coding based on each low-dimensional signal, the initial dictionary and the sparse coefficient matrix of the second signal set to obtain a first round of updated sparse coefficient matrix.

[0096] In some optional implementations, the above step S2061 includes:

[0097] Step a1, obtain the target threshold value parameter and the first residual, observation matrix and atomic set obtained in the last encoding. Specifically, the improved SWOMP (Subspace Weighted Orthogonal Matching Pursuit) algorithm is used to perform sparse coding through steps a1 to a7. After improvement, the algorithm has the characteristics of no need to predict the signal sparsity, high reconstruction efficiency and high reconstruction accuracy, and optimizes the real-time and accuracy of power quality disturbance signal processing. When sparse coding is performed for the first time, the first residual is each low-dimensional signal, the observation matrix is ​​an empty set, the atomic set is an empty set, and the target threshold value parameter is 0. In the subsequent sparse coding process, iterative updates are performed based on the above values.

[0098] In some optional implementations, the step a1 of obtaining the target threshold parameter includes:

[0099] Step b1, obtain the threshold parameter, the second residual, the first temporary residual and the second temporary residual obtained in the previous iteration. Specifically, since the target threshold parameter is a fixed value of 0 when sparse coding is performed for the first time, the target threshold parameter for each encoding is determined through steps b1 to b4 starting from the second sparse coding. Among them, the initial value of the threshold parameter is 0, the initial values ​​of the first temporary residual and the second temporary residual are the same and as large as possible, and the initial value of the second residual is the difference between the low-dimensional signal and the product of the observation matrix and the sparse coefficient matrix obtained by the first sparse coding. Assuming that the current process is in any sparse coding process except the first sparse coding, in this sparse coding, in order to obtain the target threshold parameter, at least one iterative update is required, and any iteration is used as an example for explanation. First, respectively obtain the threshold parameter, the second residual, the first temporary residual and the second temporary residual obtained in the previous iteration.

[0100] Step b2, based on the threshold parameter obtained in the previous iteration, determine the first adaptive parameter of the current iteration and the second adaptive parameter of the current iteration. Specifically, assuming that the threshold parameter obtained in the previous iteration is -1, the first adaptive parameter of the current iteration is -1+a, and the second adaptive parameter is -1+b. Wherein, a and b are not equal, and a is greater than b, so as to ensure that the two adaptive parameters change dynamically with different step sizes during the iterative update process.

[0101] Step b3, when the first adaptive parameter of this round of iteration is within the preset parameter range, the first temporary residual obtained in the previous round of iteration is updated to obtain the first temporary residual of this round of iteration. When the second adaptive parameter of this round of iteration is within the preset parameter range, the second temporary residual obtained in the previous round of iteration is updated to obtain the second temporary residual of this round of iteration. Specifically, the preset parameter range can be (0,1), which is only taken as an example and is not limited to this. If the first adaptive parameter of this round of iteration is within the preset parameter range, the first temporary residual of this round of iteration can be calculated with reference to steps a2 to a7. That is, the first temporary residual obtained in the previous round of iteration is used as the first residual obtained in the previous encoding in step a2, so as to perform subsequent steps until the first residual of this encoding is obtained in step a7, and the first residual of this encoding is used as the first temporary residual of this round of iteration. The calculation process of the second temporary residual of this round of iteration refers to the first temporary residual of this round of iteration, which will not be repeated here.

[0102] It should be noted that first, it is determined whether the first adaptive parameter of this round of iteration is within the preset parameter range. If it is, the subsequent steps are executed. If it is not, the first adaptive parameter is incremented. Assuming that the first adaptive parameter at this time is -1+a, and the first adaptive parameter is not within the preset parameter range, the first adaptive parameter is increased by a step size again, that is, -1+a+a, and it is determined again whether the first adaptive parameter is within the preset parameter range. If it is, the subsequent steps are executed according to -1+a+a. If it is not, a step size is continued to be increased until the first adaptive parameter is within the preset parameter range. If the second adaptive parameter of this round of iteration is not within the preset parameter range, refer to the above process for adjustment.

[0103] Step b4, updating based on the first temporary residual of this round of iteration, the second temporary residual of this round of iteration and the second residual obtained in the previous round of iteration to obtain the second residual of this round of iteration and the threshold parameter of this round of iteration.

[0104] In some optional implementations, the above step b4 includes:

[0105] Step c1, judging whether the first temporary residual of the current iteration is greater than the second residual obtained in the previous iteration. Specifically, firstly judging whether the first temporary residual of the current iteration is greater than the second residual obtained in the previous iteration.

[0106] Step c2, when the first temporary residual of this round of iteration is not greater than the second residual obtained in the previous round of iteration, the second residual of this round of iteration is equal to the first temporary residual of this round of iteration, and the threshold parameter of this round of iteration is equal to the first adaptive parameter of this round of iteration. Specifically, if the first temporary residual of this round of iteration is not greater than the second residual obtained in the previous round of iteration, the second residual and the threshold parameter are updated, so that the second residual of this round of iteration is equal to the first temporary residual of this round of iteration, and the threshold parameter of this round of iteration is equal to the first adaptive parameter of this round of iteration, which ensures that the algorithm moves in the direction of reducing errors.

[0107] Step c3, judging whether the second temporary residual of the current iteration is greater than the second residual obtained in the current iteration. Specifically, after the second residual and the threshold parameter are updated in step c2, since the second residual has been updated, it is necessary to judge the relationship between the second temporary residual of the current iteration and the second residual obtained in the current iteration.

[0108] Step c4, when the second temporary residual of the current iteration is not greater than the second residual obtained in the current iteration, the second residual of the current iteration and the threshold parameter are updated to make the second residual of the current iteration equal to the second temporary residual of the current iteration, and the threshold parameter of the current iteration equal to the second adaptive parameter of the current iteration. Specifically, if the second temporary residual of the current iteration is not greater than the second residual updated in step c2, the second residual and the threshold parameter are further updated to make the second residual of the current iteration equal to the second temporary residual of the current iteration, and the threshold parameter of the current iteration equal to the second adaptive parameter of the current iteration, thereby ensuring that the algorithm moves in the direction of reducing errors.

[0109] Step c5, when the second temporary residual of the current iteration is greater than the second residual obtained in the current iteration, the second residual of the current iteration and the second temporary residual of the current iteration are kept unchanged. Specifically, if the second temporary residual of the current iteration is greater than the second residual updated in step c2, the second residual and the threshold parameter are no longer updated, so that the second residual and the threshold parameter retain the values ​​updated in step c2.

[0110] Step c6, when the first temporary residual of this round of iteration is greater than the second residual obtained in the previous round of iteration, the second residual of this round of iteration is made equal to the second residual obtained in the previous round of iteration, and the threshold parameter of this round of iteration is made equal to the threshold parameter obtained in the previous round of iteration. Specifically, step c1 makes a judgment based on the relationship between the first temporary residual of this round of iteration and the second residual obtained in the previous round of iteration. If the first temporary residual of this round of iteration is greater than the second residual obtained in the previous round of iteration, the second residual and the threshold parameter are kept unchanged, and the good results before are retained to prevent the performance of the algorithm from being degraded.

[0111] Step c7, judging whether the second temporary residual of this iteration is greater than the second residual obtained in the previous iteration. Specifically, if the second residual and the threshold parameter are not updated in step c6, judging whether the second temporary residual of this iteration is greater than the second residual obtained in the previous iteration.

[0112] Step c8, when the second temporary residual of the current iteration is not greater than the second residual obtained in the previous iteration, the second residual of the current iteration is made equal to the second temporary residual of the current iteration, and the threshold parameter of the current iteration is made equal to the second adaptive parameter of the current iteration. Specifically, if the second temporary residual of the current iteration is not greater than the second residual obtained in the previous iteration, the second residual and the threshold parameter are updated, so that the second residual of the current iteration is equal to the second temporary residual of the current iteration, and the threshold parameter of the current iteration is equal to the second adaptive parameter of the current iteration, thereby ensuring that the algorithm moves in the direction of reducing errors.

[0113] Step c9, when the second temporary residual of the current iteration is greater than the second residual obtained in the previous iteration, the second residual of the current iteration is made equal to the second residual obtained in the previous iteration, and the threshold parameter of the current iteration is made equal to the threshold parameter obtained in the previous iteration. Specifically, if the second temporary residual of the current iteration is greater than the second residual obtained in the previous iteration, the second residual and the threshold parameter are not updated, and the values ​​of the previous iteration are retained, so as to prevent the performance of the algorithm from being degraded.

[0114] Step b5, repeat the above process of determining the first temporary residual, the second temporary residual, the second residual and the threshold parameter until the preset iteration stop condition is met, and the target threshold parameter is obtained. Specifically, the above steps b1 to b4 are repeated until the preset iteration stop condition is met, and the preset iteration stop condition can be that the number of iterations reaches a preset number of times, or the second residual is within a preset range, and the threshold parameter obtained by the last iteration is used as the target threshold parameter. By dynamically adjusting the threshold parameter, it is helpful to select atoms more accurately, thereby improving the reconstruction accuracy.

[0115] Step a2, based on the observation matrix obtained in the previous encoding and the first residual obtained in the previous encoding, the inner product of this encoding is obtained, and the maximum value of the inner product of this encoding is determined. Specifically, the inner product is determined by the following formula (4).

[0116]

[0117] Where u represents the inner product; represents the transposed matrix of the observation matrix obtained by the t-1th encoding; r t-1 represents the first residual obtained by the t-1th encoding; t represents the tth encoding.

[0118] Step a3, the atoms whose inner product absolute value is not less than the product of the target threshold parameter and the maximum inner product value in the atom set obtained in the previous encoding constitute the pre-selected atom support set for this encoding. Specifically, in order to reduce the computational complexity and optimize the dictionary learning at the same time, by focusing on optimizing the atoms that contribute most to the signal representation, that is, the pre-selected atom support set shown in the following formula (5), the selected atoms can better capture the main features of the signal, so that the final learned dictionary is more representative.

[0119] J = find(u t-1 ≥α*max(u))(5)

[0120] Where J represents the preselected atomic support set; u represents the inner product; u t-1 represents the inner product of the atomic set obtained by the t-1th encoding; α represents the target threshold parameter.

[0121] Step a4, based on the pre-selected atomic support set of this encoding, the observation matrix and the atomic set obtained in the previous encoding, the observation matrix and the atomic set of this encoding are updated to obtain the observation matrix and the atomic set of this encoding. Specifically, the union of the observation matrix obtained in the previous encoding and the pre-selected atomic support set of this encoding is used as the observation matrix of this encoding. The pre-selected atomic support set of this encoding replaces the atoms located at the same position in the atomic set obtained in the previous encoding to obtain the atomic set of this encoding.

[0122] Step a5, when the atom set of this encoding is inconsistent with the atom set obtained in the previous encoding, return to the step of obtaining the target threshold parameter and the first residual obtained in the previous encoding, the observation matrix and the atom set, until the atom set of this encoding is consistent with the atom set obtained in the previous encoding, and the target observation matrix is ​​obtained. Specifically, it is determined whether all atoms in the atom set obtained in this encoding and the previous encoding are consistent. If they are inconsistent, repeat the above steps a1 to a4 until the atom sets before and after the update are consistent, that is, no new atoms are selected at this time, and the observation matrix obtained by the last update is used as the target observation matrix.

[0123] Step a6, based on each low-dimensional signal and target observation matrix, solve to obtain a temporary sparse coefficient matrix for this encoding. Specifically, by solving the least squares solution of the following equation (6), that is, by solving the following variation (7) of equation (6), the temporary sparse coefficient matrix for this encoding is obtained.

[0124] Y=A final σ t (6)

[0125]

[0126] Where, t represents the tth encoding; σ t represents a temporary sparse coefficient matrix; Y represents the signal matrix composed of each low-dimensional signal; Represents the transposed matrix of the target observation matrix.

[0127] Step a7, based on the temporary sparse coefficient matrix of this encoding, each low-dimensional signal and the target observation matrix, the first residual of this encoding is obtained. When the first residual of this encoding is greater than the preset threshold, return to the step of obtaining the target threshold threshold parameter and the first residual, the observation matrix and the atomic set obtained in the previous encoding, until the first residual of this encoding is not greater than the preset threshold, and the intermediate sparse coefficient matrix is ​​obtained. Specifically, the first residual is calculated by the following formula (8). If the first residual is greater than the preset threshold, the above steps a1 to a7 are repeated until the first residual is not greater than the preset threshold, and the temporary sparse coefficient matrix calculated in the last encoding is used as the intermediate sparse coefficient matrix. Wherein, the preset threshold can be 1e-4, or other smaller values.

[0128] r=Y-σ t A final (8)

[0129] Where r represents the first residual; Y represents the signal matrix composed of each low-dimensional signal; t represents the tth encoding; σ t represents a temporary sparse coefficient matrix; represents the target observation matrix.

[0130] Step a8, when the intermediate sparse coefficient matrix satisfies the mathematical expression formed by the sparse coefficient matrices of each low-dimensional signal, the initial dictionary and the second signal set, the intermediate sparse coefficient matrix is ​​used as the sparse coefficient matrix for the first round of updating. Specifically, if the intermediate sparse coefficient matrix obtained in step a7 satisfies the following formula (9), the intermediate sparse coefficient matrix is ​​used as the target sparse coefficient matrix.

[0131]

[0132] Among them, γ represents the intermediate sparse coefficient matrix; Y represents the signal matrix composed of each low-dimensional signal; D first represents the initial dictionary; K represents the sparse coefficient matrix of the second signal set; Q0 represents sparsity; || ||0 represents the calculation of L0 norm.

[0133] In some optional embodiments, Figure 3 is a flow chart of an improved SWOMP algorithm according to an embodiment of the present invention, such as Figure 3As shown, firstly, the target threshold parameter is obtained through the process of the dotted box on the right. More specifically, multiple iterations are required to determine the target threshold parameter in each sparse coding, and any one of the iterations is used as an example for explanation. First, the threshold parameter, the second residual, the first temporary residual and the second temporary residual of the previous iteration are obtained, and then the first adaptive parameter and the second adaptive parameter are obtained. It is preferred to determine whether the first adaptive parameter is within the preset parameter range. If so, the first temporary residual is calculated. If not, the first adaptive parameter is adjusted until it is within the preset parameter range. The adjustment process is performed in Figure 3 Not shown in the figure. The processing process of the second adaptive parameter is the same as above. Then, it is determined whether the first temporary residual is not greater than the second residual of the previous iteration. If not, the second residual and threshold parameter obtained in the previous iteration are updated. Then, it is determined whether the second adaptive parameter is not greater than the second residual after the above update. If not, the second residual and threshold parameter are updated again based on the above update. If greater, it is determined whether the preset iteration stop condition is met. If the first temporary residual is greater than the second residual of the previous iteration, it is not updated. It is determined whether the second temporary residual is not greater than the second residual of the previous iteration. If not, the second residual and threshold parameter are updated. If greater, it is determined whether the preset iteration stop condition is met. When determining whether the preset iteration stop condition is met, if it is met, the threshold parameter obtained by the last update is used as the target threshold parameter. If not, it is returned to continue the iteration.

[0134] Step S2062, using singular value decomposition method, based on each low-dimensional signal, the initial dictionary and the sparse coefficient matrix of the first round of update, the initial dictionary is updated to obtain the sparse dictionary of the first round of update. Specifically, using singular value decomposition method, by solving the following formula (10), the sparse dictionary is obtained. Optionally, the singular value decomposition method is an existing algorithm, and solving by singular value decomposition method is an existing technology, which will not be repeated here.

[0135]

[0136] Among them, D l represents the sparse dictionary updated in the first round; Y represents the signal matrix composed of each low-dimensional signal; D first represents the initial dictionary; ε l Represents the sparse coefficient matrix of the lth round update.

[0137] Step S2063, based on each low-dimensional signal, the sparse coefficient matrix of the first round of update and the sparse dictionary of the first round of update, determine the sparse representation error of the first round of update. Specifically, determine the product between the sparse coefficient matrix of the first round of update and the sparse dictionary of the first round of update, and use the difference between the low-dimensional signal and the product as the sparse representation error of the first round of update.

[0138] Step S2064, the sparse dictionary updated in the first round is used as the initial dictionary for the next round of update, and the above process of determining the sparse coefficient matrix, the sparse dictionary and the sparse representation error is repeated until the sparse representation error is within the preset error range, and the target sparse dictionary and the target sparse coefficient matrix are obtained. Specifically, it is determined whether the sparse representation error of the first round of update is within the preset error range. If not, the sparse dictionary updated in the first round is used as the initial dictionary for the next round of update, and the above steps S2061 to S2063 are repeated for updating until the sparse representation error is within the preset error range, and the sparse dictionary and sparse coefficient matrix in the last update process are used as the target sparse dictionary and target sparse coefficient. By adopting the improved SWOMP algorithm, the sparse representation of the signal in the sparse dictionary can be effectively found, thereby reducing the number of atoms required for the sparse representation. The singular value decomposition method can effectively extract the main components in the sparse dictionary, remove redundant information, and improve the quality of the sparse dictionary. Through multiple rounds of iterative updates, the sparse dictionary and sparse coefficient matrix are adaptively adjusted to finally obtain the target sparse dictionary and target sparse coefficient matrix, thereby improving the accuracy of reconstruction.

[0139] Step S207, reconstruct each low-dimensional signal based on the target sparse dictionary and the target sparse coefficient matrix to obtain a reconstructed signal corresponding to each low-dimensional signal, and obtain a power quality signal based on the reconstructed signal corresponding to each low-dimensional signal. Figure 1 Step S105 of the illustrated embodiment will not be described in detail here.

[0140] In some optional embodiments, Figure 4 is a flowchart of another method for compressing and reconstructing a power quality disturbance signal based on compressed sensing according to an embodiment of the present invention. Figure 4 As shown, the power quality disturbance signal is intercepted and divided by a sliding window to obtain a first signal set and a second signal set. Then, the high-dimensional signal in the second signal set is compressed and sampled based on the Gaussian random observation matrix to obtain a low-dimensional signal. The random signal in the first signal set is used as the initial dictionary, and the K-SVD algorithm is used to adaptively update the dictionary. During the update process, the improved SWOMP algorithm is used for sparse coding to obtain the target sparse dictionary, and the sparse representation of each signal in the second signal set is obtained, that is, the target sparse coefficient matrix.

[0141] The method for compressing and reconstructing power quality disturbance signals based on compressed sensing provided by an embodiment of the present invention can intercept signals through a sliding window to intercept a signal matrix formed by multiple sub-signals, divide the signal matrix into a first signal set for training a dictionary and a second signal set for compressing and reconstructing, and for each signal in the second signal set, compressively sample each signal based on a Gaussian random measurement matrix to obtain a low-dimensional signal corresponding to each signal. Compared with reconstructing using high-dimensional signals, the amount of data is greatly reduced, and the storage and transmission costs are greatly reduced. The initial dictionary is determined by using the first signal set, and a target sparse dictionary that can accurately represent the signal can be generated by updating the initial dictionary. The optimization of the sparse dictionary enables the signal to more accurately restore the original information during reconstruction, thereby improving the quality of reconstruction. Finally, each low-dimensional signal is reconstructed using the optimized sparse dictionary and sparse coefficient matrix. Compared with using a fixed dictionary, the original power quality signal can be accurately restored, thereby improving the accuracy of signal reconstruction.

[0142] In this embodiment, a device for compressing and reconstructing power quality disturbance signals based on compressed sensing is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and will not be repeated hereafter. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0143] This embodiment provides a power quality disturbance signal compression and reconstruction device based on compressed sensing, such as Figure 5 As shown, including:

[0144] The interception module 501 is used to intercept the power quality disturbance signal based on the sliding window to obtain a signal matrix.

[0145] The division module 502 is used to divide the signal matrix into a first signal set and a second signal set according to a preset ratio.

[0146] The compression module 503 is used to perform compression sampling on each signal in the second signal set based on the Gaussian random measurement matrix to obtain a low-dimensional signal corresponding to each signal.

[0147] The updating module 504 is used to determine an initial dictionary based on the first signal set, update the initial dictionary, and obtain a target sparse dictionary and a target sparse coefficient matrix.

[0148] The reconstruction module 505 is used to reconstruct each low-dimensional signal corresponding to the second signal set based on the target sparse dictionary and the target sparse coefficient matrix to obtain a reconstructed signal corresponding to each low-dimensional signal, and obtain a power quality signal based on the reconstructed signal corresponding to each low-dimensional signal.

[0149] In some optional implementations, the updating module 504 includes:

[0150] The encoding unit is used to use an improved SWOMP algorithm to perform sparse encoding on each low-dimensional signal corresponding to the second signal set based on each low-dimensional signal, an initial dictionary and a sparse coefficient matrix of the second signal set to obtain a first round of updated sparse coefficient matrix.

[0151] The updating unit is used to update the initial dictionary by adopting the singular value decomposition method based on each low-dimensional signal, the initial dictionary and the sparse coefficient matrix of the first round of update to obtain the sparse dictionary of the first round of update.

[0152] The first determination unit is used to determine the sparse representation error of the first round of update based on each low-dimensional signal, the sparse coefficient matrix of the first round of update and the sparse dictionary of the first round of update.

[0153] The second determination unit is used to use the sparse dictionary updated in the first round as the initial dictionary for the next round of update, repeat the above process of determining the sparse coefficient matrix, sparse dictionary and sparse representation error until the sparse representation error is within a preset error range, and obtain the target sparse dictionary and target sparse coefficient matrix.

[0154] In some optional implementations, the encoding unit includes:

[0155] The first acquisition subunit is used to acquire a target threshold value parameter and a first residual error, a measurement matrix and an atomic set obtained in the last encoding.

[0156] The first determination subunit is used to obtain the inner product of this encoding based on the observation matrix obtained in the previous encoding and the first residual obtained in the previous encoding, and determine the maximum value of the inner product of this encoding.

[0157] The second determining subunit is used to form the pre-selected atomic support set for this encoding with atoms whose inner product absolute value is not less than the product of the target threshold parameter and the maximum inner product value in the atomic set obtained in the previous encoding.

[0158] The third determination subunit is used to update the observation matrix and the atomic set of the current encoding based on the pre-selected atomic support set of the current encoding, the observation matrix and the atomic set obtained in the previous encoding, to obtain the observation matrix and the atomic set of the current encoding.

[0159] The fourth determination subunit is used to return to the step of obtaining the target threshold value parameter and the first residual, observation matrix and atomic set obtained in the previous encoding when the atomic set encoded this time is inconsistent with the atomic set obtained in the previous encoding, until the atomic set encoded this time is consistent with the atomic set obtained in the previous encoding, and the target observation matrix is ​​obtained.

[0160] The fifth determination subunit is used to solve based on each low-dimensional signal and target observation matrix to obtain a temporary sparse coefficient matrix for this encoding.

[0161] The sixth determination subunit is used to obtain the first residual of this encoding based on the temporary sparse coefficient matrix of this encoding, each low-dimensional signal and the target observation matrix. When the first residual of this encoding is greater than a preset threshold, it returns to the step of obtaining the target threshold threshold parameters and the first residual, observation matrix and atomic set obtained in the previous encoding, until the first residual of this encoding is no greater than the preset threshold, and an intermediate sparse coefficient matrix is ​​obtained.

[0162] The seventh determination subunit is used to use the intermediate sparse coefficient matrix as the sparse coefficient matrix for the first round of update when the intermediate sparse coefficient matrix satisfies the mathematical expression formed by the sparse coefficient matrices of each low-dimensional signal, the initial dictionary and the second signal set.

[0163] In some optional implementations, the first acquisition subunit includes:

[0164] The encoding unit is further used to obtain the threshold parameter, the second residual, the first temporary residual and the second temporary residual obtained in the previous round of iteration.

[0165] The encoding unit is further used to determine the first adaptive parameter of the current iteration and the second adaptive parameter of the current iteration based on the threshold parameter obtained in the previous iteration.

[0166] The encoding unit is also used to update the first temporary residual obtained in the previous round of iteration when the first adaptive parameter of the current round of iteration is within the preset parameter range, so as to obtain the first temporary residual of the current round of iteration; and to update the second temporary residual obtained in the previous round of iteration when the second adaptive parameter of the current round of iteration is within the preset parameter range, so as to obtain the second temporary residual of the current round of iteration.

[0167] The encoding unit is further used to update based on the first temporary residual of the current iteration, the second temporary residual of the current iteration and the second residual obtained in the previous iteration to obtain the second residual of the current iteration and the threshold parameter of the current iteration.

[0168] The encoding unit is further used to repeat the above process of determining the first temporary residual, the second temporary residual, the second residual and the threshold parameter until a preset iteration stop condition is met to obtain a target threshold parameter.

[0169] In some optional implementations, the encoding unit includes:

[0170] The encoding unit is further used to determine whether the first temporary residual of the current iteration is greater than the second residual obtained in the previous iteration.

[0171] The encoding unit is further configured to make the second residual of the current iteration equal to the first temporary residual of the current iteration and the threshold parameter of the current iteration equal to the first adaptive parameter of the current iteration when the first temporary residual of the current iteration is not greater than the second residual obtained in the previous iteration.

[0172] The encoding unit is also used to make the second residual of this round of iteration equal to the second residual obtained in the previous round of iteration when the first temporary residual of this round of iteration is greater than the second residual obtained in the previous round of iteration, and make the threshold parameter of this round of iteration equal to the threshold parameter obtained in the previous round of iteration.

[0173] In some optional implementations, after the encoding unit, the device further includes:

[0174] The first judgment module is used to judge whether the second temporary residual of this round of iteration is greater than the second residual obtained in this round of iteration.

[0175] The first parameter determination module is used to update the second residual and threshold parameter of the current iteration when the second temporary residual of the current iteration is not greater than the second residual obtained in the current iteration, so that the second residual of the current iteration is equal to the second temporary residual of the current iteration, and the threshold parameter of the current iteration is equal to the second adaptive parameter of the current iteration. Or,

[0176] The second parameter determination module is used to keep the second residual of the current round of iteration and the second temporary residual of the current round of iteration unchanged when the second temporary residual of the current round of iteration is greater than the second residual obtained in the current round of iteration.

[0177] In some optional implementations, after the encoding unit, the device further includes:

[0178] The second judgment module is used to judge whether the second temporary residual of the current iteration is greater than the second residual obtained in the previous iteration.

[0179] The third parameter determination module is used to make the second residual of the current iteration equal to the second temporary residual of the current iteration and the threshold parameter of the current iteration equal to the second adaptive parameter of the current iteration when the second temporary residual of the current iteration is not greater than the second residual obtained in the previous iteration. Or,

[0180] The fourth parameter determination module is used to make the second residual of this round of iteration equal to the second residual obtained in the previous round of iteration when the second temporary residual of this round of iteration is greater than the second residual obtained in the previous round of iteration, and to make the threshold parameter of this round of iteration equal to the threshold parameter obtained in the previous round of iteration.

[0181] In some optional implementations, before the compression module 503, the device further includes:

[0182] The construction module is used to construct a measurement matrix based on a preset number of rows and a preset number of columns.

[0183] The determination module is used to make each element in the measurement matrix obey a Gaussian distribution with a mean of zero and a variance of the inverse of a preset number of rows, thereby obtaining a Gaussian random measurement matrix.

[0184] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.

[0185] The compressed sensing-based power quality disturbance signal compression and reconstruction device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above-mentioned functions.

[0186] The embodiment of the present invention also provides a computer device having the above Figure 5 The device shown is a compressed sensing-based power quality disturbance signal compression and reconstruction device.

[0187] See also Figure 6 , Figure 6 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Figure 6 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 6 A processor 10 is taken as an example.

[0188] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.

[0189] The memory 20 stores instructions executable by at least one processor 10, so that at least one processor 10 executes the method shown in the above embodiment.

[0190] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0191] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.

[0192] The computer device also includes an input device 30 and an output device 40. The processor 10, the memory 20, the input device 30 and the output device 40 may be connected via a bus or other means. Figure 6 The example of connecting through bus is taken in the following.

[0193] The input device 30 can receive input digital or character information, and generate key signal input related to the user settings and function control of the computer device, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator bar, one or more mouse buttons, a trackball, a joystick, etc. The output device 40 may include a display device, an auxiliary lighting device (e.g., an LED) and a tactile feedback device (e.g., a vibration motor), etc. The above-mentioned display device includes but is not limited to a liquid crystal display, a light emitting diode, a display and a plasma display. In some optional embodiments, the display device can be a touch screen.

[0194] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.

[0195] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of the computer program instruction in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc., and accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium accessible to the computer.

[0196] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.

Claims

1. A method for compressing and reconstructing power quality disturbance signals based on compressed sensing, characterized in that: The method comprises: The power quality disturbance signal is intercepted based on the sliding window to obtain a signal matrix; Dividing the signal matrix into a first signal set and a second signal set according to a preset ratio; For each signal in the second signal set, compressively sample each signal based on a Gaussian random measurement matrix to obtain a low-dimensional signal corresponding to each signal; Determine an initial dictionary based on the first signal set, update the initial dictionary, and obtain a target sparse dictionary and a target sparse coefficient matrix; Based on the target sparse dictionary and the target sparse coefficient matrix, each low-dimensional signal corresponding to the second signal set is reconstructed to obtain a reconstructed signal corresponding to each low-dimensional signal, and a power quality signal is obtained based on the reconstructed signal corresponding to each low-dimensional signal.

2. The method according to claim 1, characterized in that: The determining an initial dictionary based on the first signal set, updating the initial dictionary, and obtaining a target sparse dictionary and a target sparse coefficient matrix includes: For each low-dimensional signal corresponding to the second signal set, using an improved SWOMP algorithm, sparse coding is performed based on each low-dimensional signal, the initial dictionary and the sparse coefficient matrix of the second signal set to obtain a first round of updated sparse coefficient matrix; Using a singular value decomposition method, based on each low-dimensional signal, the initial dictionary and the sparse coefficient matrix updated in the first round, the initial dictionary is updated to obtain a sparse dictionary updated in the first round; Determining a first-round updated sparse representation error based on each low-dimensional signal, the first-round updated sparse coefficient matrix, and the first-round updated sparse dictionary; The sparse dictionary updated in the first round is used as the initial dictionary for the next round of updating, and the above process of determining the sparse coefficient matrix, sparse dictionary and sparse representation error is repeated until the sparse representation error is within a preset error range, thereby obtaining the target sparse dictionary and the target sparse coefficient matrix.

3. The method according to claim 2, characterized in that For each low-dimensional signal corresponding to the second signal set, an improved SWOMP algorithm is used to perform sparse coding based on each low-dimensional signal, the initial dictionary and the sparse coefficient matrix of the second signal set to obtain a first round of updated sparse coefficient matrix, including: Obtaining target threshold parameters and the first residual, observation matrix and atomic set obtained from the last encoding; Based on the observation matrix obtained in the previous encoding and the first residual obtained in the previous encoding, an inner product of this encoding is obtained, and a maximum value of the inner product of this encoding is determined; The atoms whose inner product absolute value in the atomic set obtained in the previous encoding is not less than the product of the target threshold parameter and the maximum inner product value constitute the pre-selected atomic support set for this encoding; Based on the pre-selected atomic support set of this encoding, the observation matrix and the atomic set obtained in the previous encoding, the observation matrix and the atomic set of this encoding are updated to obtain the observation matrix and the atomic set of this encoding; When the atom set encoded this time is inconsistent with the atom set obtained in the previous encoding, return to the step of obtaining the target threshold parameter and the first residual, the observation matrix and the atom set obtained in the previous encoding, until the atom set encoded this time is consistent with the atom set obtained in the previous encoding, and obtain the target observation matrix; Solving based on each low-dimensional signal and the target observation matrix to obtain a temporary sparse coefficient matrix for this encoding; Based on the temporary sparse coefficient matrix of the current encoding, each low-dimensional signal and the target observation matrix, a first residual of the current encoding is obtained. When the first residual of the current encoding is greater than a preset threshold, the process returns to the step of obtaining the target threshold parameter and the first residual obtained in the previous encoding, the observation matrix and the atomic set until the first residual of the current encoding is not greater than the preset threshold, thereby obtaining an intermediate sparse coefficient matrix. When the intermediate sparse coefficient matrix satisfies the mathematical expression formed by the sparse coefficient matrices of each low-dimensional signal, the initial dictionary and the second signal set, the intermediate sparse coefficient matrix is ​​used as the sparse coefficient matrix for the first round of updating.

4. The method according to claim 3, characterized in that: The step of obtaining a target threshold parameter includes: Obtaining the threshold parameter, the second residual, the first temporary residual, and the second temporary residual obtained in the previous iteration; Based on the threshold value parameter obtained in the previous round of iteration, determine the first adaptive parameter of the current round of iteration and the second adaptive parameter of the current round of iteration; When the first adaptive parameter of the current iteration is within the preset parameter range, the first temporary residual obtained in the previous iteration is updated to obtain the first temporary residual of the current iteration; when the second adaptive parameter of the current iteration is within the preset parameter range, the second temporary residual obtained in the previous iteration is updated to obtain the second temporary residual of the current iteration; Based on the first temporary residual of the current iteration, the second temporary residual of the current iteration and the second residual obtained in the previous iteration, an update is performed to obtain the second residual of the current iteration and the threshold parameter of the current iteration; The above process of determining the first temporary residual, the second temporary residual, the second residual and the threshold parameter is repeated until a preset iteration stop condition is met, thereby obtaining the target threshold parameter.

5. The method according to claim 4, characterized in that The updating based on the first temporary residual of the current iteration, the second temporary residual of the current iteration and the second residual obtained in the previous iteration to obtain the second residual of the current iteration and the threshold parameter of the current iteration includes: Determine whether the first temporary residual of this iteration is greater than the second residual obtained in the previous iteration; When the first temporary residual of the current iteration is not greater than the second residual obtained in the previous iteration, the second residual of the current iteration is made equal to the first temporary residual of the current iteration, and the threshold parameter of the current iteration is made equal to the first adaptive parameter of the current iteration; or, When the first temporary residual of this round of iteration is greater than the second residual obtained in the previous round of iteration, the second residual of this round of iteration is made equal to the second residual obtained in the previous round of iteration, and the threshold parameter of this round of iteration is made equal to the threshold parameter obtained in the previous round of iteration.

6. The method according to claim 5, characterized in that After making the second residual of the current iteration equal to the first temporary residual of the current iteration and making the threshold parameter of the current iteration equal to the first adaptive parameter of the current iteration when the first temporary residual of the current iteration is not greater than the second residual obtained in the previous iteration, the method further comprises: Determine whether the second temporary residual of this round of iteration is greater than the second residual obtained in this round of iteration; When the second temporary residual of the current iteration is not greater than the second residual obtained in the current iteration, the second residual of the current iteration and the threshold parameter are updated to make the second residual of the current iteration equal to the second temporary residual of the current iteration, and the threshold parameter of the current iteration equal to the second adaptive parameter of the current iteration; or, When the second temporary residual of the current iteration is greater than the second residual obtained in the current iteration, the second residual of the current iteration and the threshold parameter of the current iteration are kept unchanged.

7. The method according to claim 5, characterized in that In the case where the first temporary residual of the current iteration is greater than the second residual obtained in the previous iteration, the second residual of the current iteration is made equal to the second residual obtained in the previous iteration, and the threshold parameter of the current iteration is made equal to the threshold parameter obtained in the previous iteration, the method further includes: Determine whether the second temporary residual of this iteration is greater than the second residual obtained in the previous iteration; When the second temporary residual of the current iteration is not greater than the second residual obtained in the previous iteration, the second residual of the current iteration is made equal to the second temporary residual of the current iteration, and the threshold parameter of the current iteration is made equal to the second adaptive parameter of the current iteration; or, When the second temporary residual of this round of iteration is greater than the second residual obtained in the previous round of iteration, the second residual of this round of iteration is made equal to the second residual obtained in the previous round of iteration, and the threshold parameter of this round of iteration is made equal to the threshold parameter obtained in the previous round of iteration.

8. The method according to claim 1, characterized in that Before performing compressive sampling on each signal in the second signal set based on a Gaussian random measurement matrix to obtain a low-dimensional signal corresponding to each signal, the method further includes: Constructing a measurement matrix based on a preset number of rows and a preset number of columns; Each element in the measurement matrix is ​​made to obey a Gaussian distribution with a mean of zero and a variance of the inverse of the preset number of rows, so as to obtain the Gaussian random measurement matrix.

9. A device for compressing and reconstructing power quality disturbance signals based on compressed sensing, characterized in that: The device comprises: An interception module is used to intercept the power quality disturbance signal based on a sliding window to obtain a signal matrix; A division module, used for dividing the signal matrix into a first signal set and a second signal set according to a preset ratio; A compression module, configured to perform compression sampling on each signal in the second signal set based on a Gaussian random measurement matrix to obtain a low-dimensional signal corresponding to each signal; An updating module, configured to determine an initial dictionary based on the first signal set, update the initial dictionary, and obtain a target sparse dictionary and a target sparse coefficient matrix; A reconstruction module is used to reconstruct each low-dimensional signal corresponding to the second signal set based on the target sparse dictionary and the target sparse coefficient matrix to obtain a reconstructed signal corresponding to each low-dimensional signal, and obtain a power quality signal based on the reconstructed signal corresponding to each low-dimensional signal.

10. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the compressed sensing-based power quality disturbance signal compression and reconstruction method according to any one of claims 1 to 8 by executing the computer instructions.