Photovoltaic inverter imbalance fault diagnosis method based on improved data enhancement method
Through the improved generative adversarial network and data enhancement method, fault samples that are more consistent with the real data distribution are generated, which solves the problem of low fault diagnosis accuracy under the unbalanced data set of NPC three-level inverter and achieves higher fault identification accuracy.
Patent Information
- Application Number
- CN202510637563.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-16
- Publication Date
- 2025-09-12
AI Technical Summary
Existing deep learning-based NPC three-level inverter fault diagnosis methods have low accuracy on unbalanced datasets, and the fidelity and diversity of samples generated by generative adversarial networks are insufficient, making it difficult to effectively identify fault signals.
An improved data augmentation method is used to generate new fault samples through an improved generative adversarial network (ACGAN). The Wasserstein distance is combined with the gradient penalty mechanism and similarity loss. One-dimensional inverted convolutional layers and convolutional layers are used to extract features. Density-directional sampling (DDS) is used to select latent vectors to generate samples that are more consistent with the real data distribution.
It improves the fidelity and diversity of generated samples, improves the accuracy of fault diagnosis, and solves the problem of fault identification under unbalanced data sets.
Smart Images

Figure CN120632669A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of inverter fault diagnosis, and in particular to a photovoltaic inverter unbalance fault diagnosis method based on an improved data enhancement method. Background Art
[0002] As the conversion device in photovoltaic power generation systems, photovoltaic inverters play a vital role in the entire system. They convert the direct current (DC) generated by photovoltaic modules into alternating current (AC), making them a core component in photovoltaic power generation systems. Compared to traditional two-level inverters, NPC three-level inverters offer advantages such as high efficiency, low power device withstand voltage, and reduced electromagnetic interference. Therefore, they are widely used in photovoltaic power generation systems requiring efficient energy conversion. However, the increased number of levels complicates the topology of NPC three-level inverters, reducing system stability. This makes power switching devices more susceptible to failure, impacting the safe and stable operation of photovoltaic power generation systems. Even after a power switch failure in an NPC three-level inverter, the system can often continue to operate. However, if the fault is not diagnosed promptly, it can lead to secondary failures or even complete system failure. Therefore, fault diagnosis of NPC three-level inverters holds significant research significance and application value.
[0003] Due to deep learning's powerful automatic feature extraction capabilities, many NPC three-level inverter fault diagnosis methods are currently being developed based on deep learning. However, most existing deep learning-based methods assume balanced data, which is inconsistent with engineering application scenarios. In actual operation, normal conditions account for the vast majority of a device's lifespan, and the varying probabilities of various fault types make it difficult to obtain sufficient fault data for training. Unbalanced datasets can result in the trained diagnostic model being unable to effectively identify fault signals, significantly reducing fault diagnosis accuracy.
[0004] In recent years, using generative adversarial networks to generate fault data has become a practical way to solve the problem of unbalanced fault diagnosis, such as:
[0005] The existing public document "L. Ye, K. Zhang and B. Jiang, "Synergistic Feature Fusion With Deep Convolutional GAN for Fault Diagnosis in Imbalanced Rotating Machinery," in IEEE Transactions on Industrial Informatics, vol. 21, no. 2, pp. 1901-1910" proposes a new FFDCGAN model. First, a short-time Fourier transform is used to convert a one-dimensional time series signal into a two-dimensional time-frequency graph. Then, an FFDCGAN model is constructed and combined with transfer learning to generate fault samples. Finally, the fault samples and the original samples form an extended training set, which is used to train a deep convolutional neural network for fault classification. However, during the feature fusion process, this method, due to the use of transfer learning, may transfer useless or even harmful features from the source domain to the target domain, thereby reducing the quality of the generated samples.
[0006] Existing public literature "Z.Li, T.Zheng, Y.Wang, Z.Cao, Z.Guo and H.Fu, "A Novel Methodfor Imbalanced Fault Diagnosis of Rotating Machinery Based on Generative Adversarial Networks," in IEEE Transactions on Instrumentation and Measurement, vol.70, pp.1-17, 2021" First, this method converts the one-dimensional time series signal into a frequency domain signal through fast Fourier transform (FFT). Then, an ACWGAN-GP model is constructed to generate minority class samples. Finally, the generated samples are added to the original unbalanced dataset to expand the dataset and perform fault diagnosis. However, the diversity of the generated samples is still insufficient and the adaptability of the generated samples under different working conditions is not considered.
[0007] In summary, the existing technology has the following deficiencies:
[0008] 1. Existing methods mainly generate vibration signals, while relatively few studies have been conducted on generation methods for periodic electrical signals such as three-phase current signals.
[0009] 2. The fidelity and diversity of time series signals generated using traditional generative adversarial networks are insufficient, and the quality of generated samples under different working conditions is poor. Summary of the Invention
[0010] The technical problem to be solved by the present invention is the defect of the above-mentioned prior art, and a photovoltaic inverter unbalance fault diagnosis method based on an improved data augmentation method is provided. The generative adversarial network is improved, the fidelity and diversity of the generated samples are improved, and the fault diagnosis accuracy is improved.
[0011] To achieve the above object, the technical solution adopted by the present invention is as follows:
[0012] A photovoltaic inverter unbalance fault diagnosis method based on an improved data augmentation method includes the following steps:
[0013] Step 1, define the working states of the photovoltaic inverter, including 1 normal working state and I fault states, and select different bus voltages and load levels to form m groups of levels;
[0014] Step 2, collect the three-phase current data of the photovoltaic inverter in various working states under m groups of levels, and perform preprocessing to generate a real sample data set;
[0015] Step 3, extract real samples from the real sample set to form a training set, a validation set, and a test set. The ratio of the number of all normal samples in the training set, the number of real samples of each working state in the validation set, and the number of real samples of each working state in the test set is Y:1:1, where Y≥6, and the number of real samples of each working state in the validation set and the test set is the same; determine the number of normal samples in the training set and the number of each fault sample in the training set according to the set unbalance rate R, and form an unbalanced training set, and the number of each fault sample in the unbalanced training set is the same; R = N1 / N2, and (0<R≤1), where N1 is the number of each fault sample in the training set, and N2 is the number of normal samples in the training set;
[0016] Step 4, use the improved generative adversarial network to generate new fault samples, and supplement the new fault samples to the unbalanced training set to obtain a balanced training set. In this balanced training set, the number of training samples of each working state is the same;
[0017] Step 5, build a fault diagnosis model based on a convolutional neural network. This fault diagnosis model is composed of convolutional layer 1, pooling layer 1, convolutional layer 2, pooling layer 2, convolutional layer 3, pooling layer 3, fully connected layer 1, and fully connected layer 2 connected in series in sequence;
[0018] Step 6, use the balanced training set obtained in Step 4 to train the fault diagnosis model, use the validation set obtained in Step 3 to test the performance of the fault diagnosis model, and use the test set obtained in Step 3 to test the classification effect of the fault diagnosis model to complete the fault diagnosis task.
[0019] Preferably, the implementation process of the said Step 2 is:
[0020] Step 2.1: Build a photovoltaic inverter main circuit model on the Dspace semi-physical simulation platform, import the control code into the DSP-TMS320F28335 control chip, and implement photovoltaic inverter hardware-in-the-loop simulation;
[0021] Step 2.2: Simulate various operating states of the PV inverter at the m-level on the Dspace hardware-in-the-loop simulation platform, and perform sliding window sampling on the three-phase current signal data with a window size of 500, i.e., every 500 data points constitute an original sample.
[0022] Step 2.3: normalize the three-phase current signal data collected in step 2.2 and record it as a true sample;
[0023] Step 2.4: Repeat steps 2.2-2.3 until the real sample set is completed, where the number of real samples for each task is equal;
[0024] In step 2.5, the real samples obtained under normal working conditions are recorded as normal samples, and the real samples obtained under I fault conditions are recorded as fault samples; labels are assigned to the real samples, the normal samples are marked as 00, and then the I fault samples are numbered from 01 to 1 in sequence, for a total of I+1 labels.
[0025] Preferably, the implementation process of step 4 is:
[0026] Step 4.1: Build the improved auxiliary classification generative adversarial network ACGAN, including the generator and discriminator;
[0027] The generator includes the following structures connected in series along the input-output direction of the generator: a fully connected layer with an input dimension of 150 and an output dimension of 16000; a convolutional layer with a convolution kernel size of 4, an input channel number of 128, an output channel number of 64, a stride of 2, and a padding of 1; a convolutional layer with a convolution kernel size of 4, an input channel number of 64, an output channel number of 32, a stride of 2, and a padding of 1; a convolutional layer with a convolution kernel size of 3, an input channel number of 32, an output channel number of 12, and a padding of 1;
[0028] The discriminator includes the following structures connected in series along the input-output direction of the discriminator: a convolution layer with a convolution kernel size of 3, an input channel number of 12, an output channel number of 32, and a padding of 1; a convolution layer with a convolution kernel size of 4, an input channel number of 32, an output channel number of 64, a stride of 2, and a padding of 1; a convolution layer with a convolution kernel size of 4, an input channel number of 64, an output channel number of 128, a stride of 2, and a padding of 1; two parallel branches, a true or false branch including the following structures connected in series along the input-output direction of the true or false branch: a fully connected layer with an input dimension of 160050 and an output dimension of 64, a fully connected layer with an input dimension of 64 and an output dimension of 1, a classification branch including the following structures connected in series along the input-output direction of the classification branch: a fully connected layer with an input dimension of 160050 and an output dimension of 64, a fully connected layer with an input dimension of 64 and an output dimension of 12;
[0029] Step 4.2, construct the generator loss function and the discriminator loss function, and calculate the generator loss L G and the discriminator loss l D ;
[0030] In step 4.3, the adversarial network ACGAN is trained using the fault samples in the imbalanced training set until the adversarial network ACGAN reaches Nash equilibrium. The specific process is as follows:
[0031] Step 4.3.1, initialize the weights of the generator and discriminator;
[0032] In step 4.3.2, the generator and discriminator are trained alternately. The steps for training the discriminator are: inputting real samples, recalculating the discriminator loss, and updating the discriminator weights; the steps for training the generator are: inputting the latent vector obtained by density-directional sampling (DDS) and the fault sample label, generating samples and inputting them into the discriminator, recalculating the generator loss, and updating the generator weights.
[0033] Step 4.3.3: Alternately train the discriminator and generator according to the method in step 4.3.2 until the adversarial network ACGAN reaches Nash equilibrium.
[0034] In step 4.4, the trained generator is used to generate new fault samples, and the new fault samples are added to the unbalanced training set to obtain a balanced training set. In this balanced training set, the number of training samples for various working states is the same.
[0035] Preferably, the expressions of the generator loss function and the discriminator loss function in step 4.2 are as follows:
[0036]
[0037] Among them, L D is the discriminator loss, L G is the generator loss, s is the real sample, P data is the data distribution of s, D(s) is the probability that the discriminator judges s to be a true sample, is the expectation of the logarithmic probability that the discriminator judges s to be a true sample; To generate samples, P g for The data distribution, For the discriminator to judge is the probability of the true sample, For the discriminator to judge is the expectation of the logarithm of the true sample probability; is the interpolation sample obtained by random interpolation, for The data distribution, is the gradient penalty term, λ is the gradient penalty coefficient, For the discriminator to judge is the probability of the true sample, for right The gradient, for Interpolation samples The l2 norm of the gradient of , is an unweighted gradient penalty term, and the interpolation sample is generated by And the real sample s is calculated, ε is the weight parameter; label set Y = {y1, y2, ..., y k}, k is the number of labels, P(Y=y|s) is the conditional probability distribution of the real sample labels, is the expectation of the conditional probability distribution logarithm on the true sample label, To generate the conditional probability distribution on sample labels, is the expectation of the conditional probability distribution on the generated sample label; dtw_loss is the similarity loss, λ dtw is the weight coefficient of the similarity loss function; the similarity loss dtw_loss guides the generator to learn the time series structure of the real data by calculating the dynamic time warping DTW distance between the generated samples and the real samples.
[0038] Preferably, the process of obtaining the latent vector by density-directional sampling (DDS) in step 4.3 includes the following steps:
[0039] S1, calculate the mapping matrix
[0040] First, random sampling is performed to obtain a random vector z~N(0, 1), where z obeys the normal distribution and N represents the normal distribution; the random vector z and the label vector are input into the generator, and the output of the second inverted convolution layer of the generator is extracted as the hidden feature H v ; Then the hidden feature H v Flattened into a one-dimensional vector, principal component analysis is performed to obtain the projection feature p h ; Finally, the mapping matrix F is obtained by the least square method, F=(p h T p h ) -1 p h T z , where p h T For p h The transpose of
[0041] S2, density-directional sampling
[0042] First, the projection feature p h Perform kernel density estimation to calculate relative density Then set the density threshold RD min and RD max , remaining in the feasible region R: Features within Then the features falling in the feasible region R Perform principal component analysis, sort along the direction of the first principal component, and space n in the sorted feature set group Uniform sampling to obtain the features after sampling The formula is as follows:
[0043]
[0044] Where, is the feature that falls in the feasible region R the number of Features The set arranged in sequence along the main direction, n group For The sampling interval in n gen is the number of sampling points, i is an integer index, i×n gen For Select the i×nth gen features as sampling points, is the feature set after sampling;
[0045] Finally, through the mapping matrix F Converted to a latent vector v,
[0046] Preferably, the photovoltaic inverter in step 1 is a photovoltaic NPC three-level inverter, which is composed of three single-phase half-bridge inverters in parallel, each phase containing 4 power switch tubes, and the I fault state is 12 single switch tube open circuit faults, that is, I=12.
[0047] The beneficial effects produced by the present invention include:
[0048] 1. The imbalance fault diagnosis method of the present invention introduces the Wasserstein distance and gradient penalty mechanism into the loss function of the ACGAN model to avoid the problem of mode collapse. The similarity loss is introduced into the loss function of the ACGAN model to increase the measurement of the similarity between the generated samples and the real samples, making the generated data more consistent with the distribution of the real data.
[0049] 2. The generator of this invention uses a one-dimensional inverted convolution layer for upsampling to generate samples, and the discriminator uses a one-dimensional convolution layer to extract features, thereby distinguishing and classifying the generated samples and real samples, replacing the fully connected layer in the original ACGAN, and improving the quality of generated samples.
[0050] 3. Both traditional random sampling (RS) and the proposed density-directional sampling (DDS) are used to select latent vectors, which are then fed into the generator. The random sampling (RS) method randomly samples latent vectors from a standard Gaussian distribution. The DDS method of the present invention samples latent features along the first principal direction within the feasible region and converts these features into latent vectors. Using DDS instead of random sampling filters and selects the latent vectors based on density and directionality, improving the fidelity and diversity of the generated samples. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] Figure 1 1 is a flow chart of the imbalance fault diagnosis method of the present invention;
[0052] Figure 2 is an electrical topology diagram in an embodiment of the present invention;
[0053] Figure 3 It is the overall framework diagram of the imbalance fault diagnosis method of the present invention;
[0054] Figure 4 is a network structure diagram of a generator and a discriminator in an embodiment of the present invention;
[0055] Figure 5 4 is a structural diagram of a fault diagnosis model based on a convolutional neural network in an embodiment of the present invention. DETAILED DESCRIPTION
[0056] The technical solution of the present invention will be further described below with reference to the accompanying drawings.
[0057] Figure 1 is a flow chart of the imbalance fault diagnosis method of the present invention, Figure 3 This is the overall framework diagram of the unbalanced fault diagnosis method of the present invention, consisting of Figure 1 and Figure 3 It can be seen that the present invention comprises the following steps:
[0058] Step 1: Define the working state of the photovoltaic inverter, including one normal working state and one fault state, and select different bus voltages and load levels to form m groups of levels.
[0059] In this embodiment, the photovoltaic inverter is a photovoltaic NPC three-level inverter, which is composed of three single-phase half-bridge inverters in parallel, each phase includes four power switch tubes, and the I fault state is 12 single switch tube open circuit faults, that is, I=12. Figure 2 The electrical topology diagram of the embodiment of the present invention is given in FIG. In the figure, C1 and C2 are DC side filter capacitors, U dc is the DC power supply voltage, 0 is the midpoint of the DC side capacitor, L f is the filter inductance of the AC filter circuit, R L is the parasitic resistance of the filter inductor, C f is the filter capacitor of the AC filter circuit, R and L are the load resistance and inductance respectively. In addition, M = 8, that is, 8 groups are formed by selecting different bus voltages and load levels.
[0060] Step 2: Collect three-phase current data of the photovoltaic inverter in various working states at m levels and perform preprocessing to generate a real sample data set.
[0061] In this embodiment, the implementation process of step 2 is:
[0062] Step 2.1: Build a photovoltaic inverter main circuit model on the Dspace semi-physical simulation platform, import the control code into the DSP-TMS320F28335 control chip, and implement photovoltaic inverter hardware-in-the-loop simulation;
[0063] Step 2.2: Simulate various operating states of the PV inverter at the m-level on the Dspace hardware-in-the-loop simulation platform, and perform sliding window sampling on the three-phase current signal data with a window size of 500, i.e., every 500 data points constitute an original sample.
[0064] Step 2.3: normalize the three-phase current signal data collected in step 2.2 and record it as a true sample;
[0065] Step 2.4: Repeat steps 2.2-2.3 until the real sample set is completed, where the number of real samples for each task is equal;
[0066] Step 2.5: Denote the real samples obtained under normal working conditions as normal samples, and the real samples obtained under I kinds of fault states as fault samples; assign labels to the real samples. The normal samples are labeled as 00, and then the I kinds of fault samples are numbered from 01 to I in sequence, with a total of I + 1 labels.
[0067] In this embodiment, m = 8, that is, 8 groups of different bus voltages and load levels are simulated on the hardware-in-the-loop simulation platform, and the three-phase current signal data are obtained, including data of one normal working state and data of 12 kinds of fault states, as shown in Table 1 for details.
[0068] Table 1 Parameters of the hardware-in-the-loop simulation platform
[0069]
[0070] Step 3: Extract real samples from the real sample set to form a training set, a validation set, and a test set. The ratio of the number of all normal samples in the training set, the number of real samples of each working state in the validation set, and the number of real samples of each working state in the test set is Y:1:1, where Y ≥ 6, and the number of real samples of each working state in the validation set and the test set is the same; determine the number of normal samples in the training set and the number of each fault sample in the training set according to the set imbalance rate R, and form an imbalanced training set, and the number of each fault sample in the imbalanced training set is the same; R = N1 / N2, and (0 < R ≤ 1), where N1 is the number of each fault sample in the training set, and N2 is the number of normal samples in the training set.
[0071] In this embodiment, Y = 8, the number of normal samples in the training set is 800, and the number of real samples of each working state in the validation set and the test set is 100.
[0072] In this embodiment, there are 3 set imbalance rates R, which are 1 / 4, 1 / 20, and 1 / 40 respectively, and they form imbalanced training set A, imbalanced training set B, and imbalanced training set C respectively. The specific data is shown in Table 2.
[0073] Table 2 Sample quantities of the validation set, the test set, and the three imbalanced training sets
[0074]
[0075] Step 4: Use an improved generative adversarial network to generate new fault samples, and supplement the new fault samples into the imbalanced training set to obtain a balanced training set, in which the number of training samples of each working state is the same.
[0076] In this embodiment, the implementation process of Step 4 is as follows:
[0077] Step 4.1: Build an improved auxiliary classification generative adversarial network ACGAN, including a generator and a discriminator.
[0078] The generator includes the following structures connected in series along the input-output direction of the generator: a fully connected layer with an input dimension of 150 and an output dimension of 16000; an inverted convolution layer with a convolution kernel size of 4, an input channel number of 128, an output channel number of 64, a stride of 2, and a padding of 1; an inverted convolution layer with a convolution kernel size of 4, an input channel number of 64, an output channel number of 32, a stride of 2, and a padding of 1; a convolution layer with a convolution kernel size of 3, an input channel number of 32, an output channel number of 12, and a padding of 1.
[0079] The discriminator includes the following structures connected in series along the input-output direction of the discriminator: a convolution layer with a convolution kernel size of 3, 12 input channels, 32 output channels, and a padding of 1; a convolution layer with a convolution kernel size of 4, 32 input channels, 64 output channels, a stride of 2, and a padding of 1; a convolution layer with a convolution kernel size of 4, 64 input channels, 128 output channels, a stride of 2, and a padding of 1; two parallel branches, a true or false branch including the following structures connected in series along the input-output direction of the true or false branch: a fully connected layer with an input dimension of 160050 and an output dimension of 64, a fully connected layer with an input dimension of 64 and an output dimension of 1; a classification branch including the following structures connected in series along the input-output direction of the classification branch: a fully connected layer with an input dimension of 160050 and an output dimension of 64, and a fully connected layer with an input dimension of 64 and an output dimension of 12.
[0080] Step 4.2, construct the generator loss function and the discriminator loss function, and calculate the generator loss L G and the discriminator loss l D .
[0081] The expressions of the generator loss function and the discriminator loss function are as follows:
[0082]
[0083] Among them, L D is the discriminator loss, L G is the generator loss, s is the real sample, P data is the data distribution of s, D(s) is the probability that the discriminator judges s to be a true sample, is the expectation of the logarithmic probability that the discriminator judges s to be a true sample; To generate samples, P g for The data distribution, For the discriminator to judge is the probability of the true sample, For the discriminator to judge is the expectation of the logarithm of the true sample probability; is the interpolation sample obtained by random interpolation, for The data distribution, is the gradient penalty term, λ is the gradient penalty coefficient, For the discriminator to judge is the probability of the true sample, for right The gradient, for Interpolation samples The l2 norm of the gradient of , is an unweighted gradient penalty term, and the interpolation sample is generated by And the real sample s is calculated, ε is the weight parameter; label set Y = {y1, y2, ..., y k}, k is the number of labels, P(Y=y|s) is the conditional probability distribution of the real sample labels, is the expectation of the conditional probability distribution logarithm on the true sample label, To generate the conditional probability distribution on sample labels, is the expectation of the conditional probability distribution on the generated sample label; dtw_loss is the similarity loss, λ dtw is the weight coefficient of the similarity loss function; the similarity loss dtw_loss guides the generator to learn the time series structure of the real data by calculating the dynamic time warping DTW distance between the generated samples and the real samples.
[0084] The similarity loss dtw_loss is calculated as follows:
[0085]
[0086] Where M is a symmetric semi-positive definite matrix, called a Mahalanobis matrix; m represents the length of the time step in the real sample; n represents the length of the time step in the generated signal; r(i, j) represents the cumulative distance of the local distance on the path from (0, 0) to (i, j) in the distance matrix D; Represents the generated sample s and the real sample DTW distance; B represents the batch size.
[0087] In step 4.3, the adversarial network ACGAN is trained using the fault samples in the imbalanced training set until the adversarial network ACGAN reaches Nash equilibrium. The specific process is as follows:
[0088] Step 4.3.1, initialize the weights of the generator and discriminator;
[0089] In step 4.3.2, the generator and discriminator are trained alternately. The steps for training the discriminator are: inputting real samples, recalculating the discriminator loss, and updating the discriminator weights; the steps for training the generator are: inputting the latent vector obtained by density-directional sampling (DDS) and the fault sample label, generating samples and inputting them into the discriminator, recalculating the generator loss, and updating the generator weights.
[0090] Step 4.3.3: Alternately train the discriminator and generator according to the method in step 4.3.2 until the adversarial network ACGAN reaches Nash equilibrium.
[0091] In step 4.4, the trained generator is used to generate new fault samples, and the new fault samples are added to the unbalanced training set to obtain a balanced training set. In this balanced training set, the number of training samples for various working states is the same.
[0092] The process of obtaining the potential vector by density-directional sampling (DDS) includes the following steps:
[0093] S1, calculate the mapping matrix
[0094] First, random sampling is performed to obtain a random vector z~N(0, 1), where z obeys the normal distribution and N represents the normal distribution; the random vector z and the label vector are input into the generator, and the output of the second inverted convolution layer of the generator is extracted as the hidden feature H v ; Then the hidden feature H v Flattened into a one-dimensional vector, principal component analysis is performed to obtain the projection feature p h ; Finally, the mapping matrix F is obtained by the least square method, F=(p h T p h ) -1 p h T z, where p h T For p h The transpose of
[0095] S2, density-directional sampling
[0096] First, the projection feature p h Perform kernel density estimation to calculate relative density Then set the density threshold RD min and RD max , remaining in the feasible region R: Features within Then the features falling in the feasible region R Perform principal component analysis, sort along the direction of the first principal component, and space n in the sorted feature set group Uniform sampling to obtain the features after sampling The formula is as follows:
[0097]
[0098] Where, is the feature that falls in the feasible region R the number of Features The set arranged in sequence along the main direction, n group For The sampling interval in n gen is the number of sampling points, i is an integer index, i×n gen For Select the i×nth gen features as sampling points, is the feature set after sampling;
[0099] Finally, through the mapping matrix F Converted to a latent vector v,
[0100] Figure 4 This is the network structure diagram of the generator and discriminator in the present invention, composed of Figure 4 As can be seen, the input to the generator is the latent vector and the label vector. These two vectors are concatenated and converted to a 128×125 feature map through a fully connected layer. Next, the feature map passes through two inverted convolutional layers, which are gradually upsampled, increasing the timestep and reducing the number of channels. Specifically, the first inverted convolutional layer converts the feature map from 128 channels and 125 timesteps to 64 channels and 250 timesteps; the second inverted convolutional layer converts it to 32 channels and 500 timesteps. Finally, a convolutional layer reduces the number of channels to 3, outputting generated samples of size (3, 500). The input to the discriminator is the samples (including real and generated samples) and the label vector. The samples are first gradually downsampled through three convolutional layers, reducing the timestep and increasing the number of channels. Specifically, the first convolutional layer converts the feature map from 3 channels and 500 timesteps to 32 channels and 500 timesteps; the second convolutional layer converts it to 64 channels and 250 timesteps; and finally, the third convolutional layer converts it to 128 channels and 125 timesteps. After the last convolutional layer, the feature map is flattened into a one-dimensional vector and concatenated with the embedded label vector. The concatenated vector passes through two fully connected layers in the true / false branch to output the true / false result of the sample, and then passes through two fully connected layers in the classification branch to output the fault label.
[0101] Step 5: Build a fault diagnosis model based on convolutional neural network, which consists of convolution layer 1, pooling layer 1, convolution layer 2, pooling layer 2, convolution layer 3, pooling layer 3, fully connected layer 1 and fully connected layer 2 connected in series in sequence.
[0102] Figure 5 This is a structural diagram of the fault diagnosis model based on convolutional neural network of the present invention. Figure 5 It can be seen that the input of the fault diagnosis model is the balanced training set obtained in step 4, and the output of the fault diagnosis model is the fault classification result.
[0103] Step 6: Use the balanced training set obtained in step 4 to train the fault diagnosis model, use the validation set obtained in step 3 to test the performance of the fault diagnosis model, and use the test set obtained in step 3 to test the classification effect of the fault diagnosis model to complete the fault diagnosis task.
[0104] In this embodiment, calculations were performed using three different imbalance rates R, and the results are shown in Table 3. Compared with the imbalance fault classification results of traditional data augmentation methods such as WGAN-GP and ACGAN, the imbalance fault diagnosis method of the present invention has certain advantages.
[0105] Table 3 Comparison of unbalanced fault classification results
[0106]
Claims
1. A photovoltaic inverter unbalance fault diagnosis method based on an improved data enhancement method, characterized in that: It includes the following steps: Step 1: Define the working states of the photovoltaic inverter, including 1 normal working state and I fault states, and select different bus voltages and load levels to form m groups of levels; Step 2: Collect the three-phase current data of the photovoltaic inverter in various working states under m groups of levels, and perform preprocessing to generate a real sample data set; Step 3: Extract real samples from the real sample set to form a training set, a validation set and a test set. The ratio of the number of all normal samples in the training set, the number of real samples of each working state in the validation set, and the number of real samples of each working state in the test set is Y:1:1, where Y≥6, and the number of real samples of each working state in the validation set and the test set is the same; Determine the number of normal samples in the training set and the number of each fault sample in the training set according to the set imbalance rate R, and form an imbalanced training set, and the number of each fault sample in the imbalanced training set is the same; R = N1 / N2, and (0<R≤1), where N1 is the number of each fault sample in the training set, and N2 is the number of normal samples in the training set; Step 4: Use an improved generative adversarial network to generate new fault samples, and supplement the new fault samples to the imbalanced training set to obtain a balanced training set. In this balanced training set, the number of training samples of each working state is the same; Step 5: Build a fault diagnosis model based on a convolutional neural network. This fault diagnosis model consists of convolutional layer 1, pooling layer 1, convolutional layer 2, pooling layer 2, convolutional layer 3, pooling layer 3, fully connected layer 1 and fully connected layer 2 connected in series in sequence; Step 6: Use the balanced training set obtained in Step 4 to train the fault diagnosis model, use the validation set obtained in Step 3 to test the performance of the fault diagnosis model, and use the test set obtained in Step 3 to test the classification effect of the fault diagnosis model to complete the fault diagnosis task.
2. The photovoltaic inverter unbalance fault diagnosis method based on the improved data enhancement method according to claim 1 is characterized in that: The implementation process of Step 2 is as follows: Step 2.1: Establish a main circuit model of the photovoltaic inverter on the Dspace semi-physical simulation platform, import the control code into the DSP-TMS320F28335 control chip to achieve hardware-in-the-loop simulation of the photovoltaic inverter; Step 2.2: Simulate various working states of the photovoltaic inverter under m groups of levels on the Dspace semi-physical simulation platform, and perform sliding window sampling on the three-phase current signal data. The window size is 500, that is, every 500 data points form an original sample; Step 2.3: Normalize the three-phase current signal data collected in Step 2.2 and record it as a real sample; Step 2.4: Repeat Step 2.2 - Step 2.3 until the real sample set is completed, where the number of real samples of each work is equal; Step 2.5: Record the real samples obtained under normal working conditions as normal samples, and the real samples obtained in I fault states as fault samples; Assign labels to the real samples. The normal samples are marked as 00, and then the I fault samples are numbered from 01 to I in sequence, for a total of I+1 labels.
3. The photovoltaic inverter unbalance fault diagnosis method based on the improved data enhancement method according to claim 2 is characterized in that: The implementation process of Step 4 is as follows: Step 4.1: Build an improved auxiliary classification generative adversarial network ACGAN, including a generator and a discriminator; The generator includes the following structures connected in series along the input-output direction of the generator: a fully connected layer with an input dimension of 150 and an output dimension of 16000; a convolutional layer with a convolution kernel size of 4, an input channel number of 128, an output channel number of 64, a stride of 2, and a padding of 1; a convolutional layer with a convolution kernel size of 4, an input channel number of 64, an output channel number of 32, a stride of 2, and a padding of 1; a convolutional layer with a convolution kernel size of 3, an input channel number of 32, an output channel number of 12, and a padding of 1; The discriminator includes the following structures connected in series along the input-output direction of the discriminator: a convolution layer with a convolution kernel size of 3, an input channel number of 12, an output channel number of 32, and a padding of 1; a convolution layer with a convolution kernel size of 4, an input channel number of 32, an output channel number of 64, a stride of 2, and a padding of 1; a convolution layer with a convolution kernel size of 4, an input channel number of 64, an output channel number of 128, a stride of 2, and a padding of 1; two parallel branches, a true or false branch including the following structures connected in series along the input-output direction of the true or false branch: a fully connected layer with an input dimension of 160050 and an output dimension of 64, a fully connected layer with an input dimension of 64 and an output dimension of 1, a classification branch including the following structures connected in series along the input-output direction of the classification branch: a fully connected layer with an input dimension of 160050 and an output dimension of 64, a fully connected layer with an input dimension of 64 and an output dimension of 12; Step 4.2, construct the generator loss function and the discriminator loss function, and calculate the generator loss L G and the discriminator loss l D ; In step 4.3, the adversarial network ACGAN is trained using the fault samples in the imbalanced training set until the adversarial network ACGAN reaches Nash equilibrium. The specific process is as follows: Step 4.3.1, initialize the weights of the generator and discriminator; In step 4.3.2, the generator and discriminator are trained alternately. The steps for training the discriminator are: inputting real samples, recalculating the discriminator loss, and updating the discriminator weights; the steps for training the generator are: inputting the latent vector obtained by density-directional sampling (DDS) and the fault sample label, generating samples and inputting them into the discriminator, recalculating the generator loss, and updating the generator weights. Step 4.3.3: Alternately train the discriminator and generator according to the method in step 4.3.2 until the adversarial network ACGAN reaches Nash equilibrium. In step 4.4, the trained generator is used to generate new fault samples, and the new fault samples are added to the unbalanced training set to obtain a balanced training set. In this balanced training set, the number of training samples for various working states is the same.
4. The photovoltaic inverter unbalance fault diagnosis method based on the improved data enhancement method according to claim 3 is characterized in that: The expressions of the generator loss function and the discriminator loss function described in step 4.2 are as follows: Among them, L D is the discriminator loss, L G is the generator loss, s is the real sample, P data is the data distribution of s, D(s) is the probability that the discriminator judges s to be a true sample, is the expectation of the logarithmic probability that the discriminator judges s to be a true sample; To generate samples, Pg is The data distribution, For the discriminator to judge is the probability of the true sample, For the discriminator to judge is the expectation of the logarithmic value of the true sample probability; is the interpolation sample obtained by random interpolation, for The data distribution, is the gradient penalty term, λ is the gradient penalty coefficient, For the discriminator to judge is the probability of the true sample, for right The gradient, for Interpolation samples The L2 norm of the gradient of , is an unweighted gradient penalty term, and the interpolation sample is generated by And the real sample s is calculated, ε is the weight parameter; label set Y = {y1, y2, ..., y k }, k is the number of labels, P(Y=y|s) is the conditional probability distribution of the real sample labels, is the expectation of the conditional probability distribution logarithm on the true sample label, To generate the conditional probability distribution on sample labels, is the expectation of the conditional probability distribution on the generated sample label; dtw_loss is the similarity loss, λ dtw is the weight coefficient of the similarity loss function; the similarity loss dtw_loss guides the generator to learn the time series structure of the real data by calculating the dynamic time warping DTW distance between the generated samples and the real samples.
5. The photovoltaic inverter unbalance fault diagnosis method based on the improved data enhancement method according to claim 3 is characterized in that: The process of obtaining the latent vector by density-directional sampling (DDS) in step 4.3 includes the following steps: S1, calculate the mapping matrix First, random sampling is performed to obtain a random vector z~N(0,1), where z obeys the normal distribution and N represents the normal distribution; the random vector z and the label vector are input into the generator, and the output of the second inverted convolution layer of the generator is extracted as the hidden feature H v ; Then the hidden feature H v Flattened into a one-dimensional vector, the principal component analysis is performed to obtain the projection feature p h ; Finally, the mapping matrix F is obtained by the least square method, F=(p h T p h ) -1 p h T z, where p h T For p h The transpose of S2, density-directional sampling First, the projection feature p h Perform kernel density estimation to calculate relative density Then set the density threshold RD min and RD max , remaining in the feasible region R: Features within Then the features falling in the feasible region R Perform principal component analysis, sort along the direction of the first principal component, and space n in the sorted feature set group Uniform sampling to obtain the features after sampling The formula is as follows: Where, is the feature that falls in the feasible region R the number of Characterized by The set arranged in sequence along the main direction, n group For The sampling interval in n gen is the number of sampling points, i is an integer index, i×n gen For Select the i×nth gen features as sampling points, is the feature set after sampling; Finally, through the mapping matrix F Converted to a latent vector v, 6. The photovoltaic inverter unbalance fault diagnosis method based on the improved data enhancement method according to claim 1, characterized in that: The photovoltaic inverter in step 1 is a photovoltaic NPC three-level inverter, which is composed of three single-phase half-bridge inverters in parallel. Each phase contains four power switch tubes. The I fault state is 12 single switch tube open circuit faults, that is, I=12.