Pumping unit fault diagnosis method and system based on channel attention and invariance learning
By constructing a fault diagnosis model based on channel attention and invariance learning, the problems of feature extraction limitations and domain offset in pumping unit fault diagnosis are solved, and high-accuracy cross-operating condition fault identification and real-time online monitoring are achieved.
Patent Information
- Application Number
- CN202510854432.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-25
- Publication Date
- 2025-10-03
- Estimated Expiration
- 2045-06-25
AI Technical Summary
Existing pumping unit fault diagnosis methods have limitations in feature extraction, which leads to model failure or domain shift. In addition, single-scale feature interaction is insufficient and conditional distribution mismatch results in low diagnostic accuracy.
A method based on channel attention and invariance learning is adopted to construct a fault diagnosis model through multi-scale channel attention unit, classifier, invariance feature learning unit and joint domain adaptation unit. Multi-scale convolution kernel is used to extract fault features, and the gradient inner product penalty term is introduced to constrain the optimization direction consistency of the model in the source domain and the target domain. The edge and conditional distribution are aligned through the joint domain adaptation unit.
The diagnostic accuracy of the fault diagnosis model has been improved, and it can identify faults in the pumping unit motor and reducer under different working conditions, output fault category and location information, and realize real-time online monitoring with a low false alarm rate.
Smart Images

Figure CN120354252B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of oil pumping unit fault diagnosis, and in particular to an oil pumping unit fault diagnosis method and system based on channel attention and invariance learning. Background Art
[0002] With the increasing intelligence of industrial equipment, fault diagnosis technology for mechanical equipment is gradually shifting from traditional manual judgment to automated and intelligent analysis. Oilfield pumping units, as core equipment for oil extraction, have motors and reducers operating under complex conditions of high loads and variable speeds for long periods of time. Failures are frequent and difficult to diagnose. However, existing fault diagnosis technology still has the following problems in practical applications:
[0003] Traditional methods rely on expert experience and signal processing techniques (such as Fourier transforms and wavelet analysis) to manually extract the time-frequency domain features of vibration signals (such as spectral peaks and envelope demodulation) to perform fault diagnosis. For example, in rotating machinery, coupling misalignment is typically manifested as twice the rotational frequency (such as 80 Hz) and its harmonic components (such as 120 Hz), while bearing faults are accompanied by characteristic frequencies (such as the rolling element passage frequency). However, this method relies on manual experience for feature extraction and requires pre-defined formulas for the fault characteristic frequencies. This makes it difficult to handle complex coupled faults (such as the coexistence of bearing damage and gear wear), and its generalization across operating conditions is poor. The vibration characteristics of the same fault vary significantly under different speeds and loads. For example, the spectral distribution shifts between 600 rpm and 1200 rpm. This can cause the fault diagnosis model to fail, making it impossible to obtain specific fault information, or the fault information obtained is incorrect or incomplete.
[0004] Although intelligent diagnosis methods based on convolutional neural networks (CNN) and residual networks (ResNet) can automatically extract features, their performance relies on the strict identical distribution assumption, requiring that the training data (source domain) and the test data (target domain) follow the same distribution. However, in actual industrial scenarios, the operating conditions of equipment are variable, leading to domain shift. For example, the vibration signal distribution of an oil pump motor under normal operating conditions (600 r / min) and fault conditions (1200 r / min) is significantly different, and the labels are highly dependent. Supervised learning requires a large amount of labeled data, and the labeling cost of target domain data is high (for example, if the equipment needs to be disassembled to verify the fault type).
[0005] In existing transfer learning, researchers have proposed the Unsupervised Domain Adaptation (UDA) method to alleviate domain shift, but there is still insufficient interaction between single-scale features. Traditional channel attention mechanisms (such as ECA) use a single convolution kernel to extract channel weights, which makes it difficult to capture multi-scale fault features, such as the weak high-frequency components of early bearing damage and the low-frequency impact of severe wear, and lack invariant feature learning. Existing methods only narrow domain differences through distribution alignment, and do not explicitly constrain the model to learn invariant features shared across working conditions, such as the envelope energy characteristics of bearing faults; there is also conditional distribution mismatch. Most adversarial training methods (such as DANN) only align the marginal distributions of the source domain and the target domain, ignoring the differences in category conditional distributions, such as the differences in spectral morphology of the same fault at different speeds. Summary of the Invention
[0006] In order to solve the problems that the feature extraction of existing pumping unit fault diagnosis methods has limitations or deviations from the actual extraction requirements, resulting in failure of the fault diagnosis model or domain shift, and the single-scale features used have insufficient interaction and conditional distribution mismatch, which ultimately leads to low diagnostic accuracy, the present invention proposes a pumping unit fault diagnosis method and system based on channel attention and invariance learning.
[0007] The technical solution adopted by the present invention is:
[0008] It includes the following steps:
[0009] S1. Collect the multi-condition vibration signals of the pumping unit motor and the multi-condition vibration signals of the reduction gearbox respectively, and construct a labeled source domain dataset and an unlabeled target domain dataset based on all the collected multi-condition vibration signals.
[0010] S2. Preprocess the labeled source domain dataset and the unlabeled target domain dataset respectively to obtain the labeled source domain dataset III and the unlabeled target domain dataset III.
[0011] S3. Build a fault diagnosis model, input the labeled source domain dataset III and the unlabeled target domain dataset III into the fault diagnosis model for training, output the fault category and location information, and obtain a trained fault diagnosis model.
[0012] The fault diagnosis model includes a multi-scale channel attention unit, a classifier, an invariant feature learning unit and a joint domain adaptation unit.
[0013] S4. Collect the multi-operating-condition vibration signals of the motor or the multi-operating-condition vibration signals of the reduction gearbox to be diagnosed, input the collected multi-operating-condition vibration signals into the fault diagnosis model trained in S3, and output the corresponding fault category and location information.
[0014] Furthermore, when collecting the multi-operating-condition vibration signals of the pumping unit motor and the multi-operating-condition vibration signals of the reduction gearbox in S1, the collection parameters are:
[0015] Sampling frequency: 20kHz.
[0016] Sampling signal length: A single sample contains 1024 data points, corresponding to a duration of 0.0512 seconds.
[0017] Working condition tag: The source domain data includes speed, load, and fault tags, and the fault tags include bearing outer ring damage and gear tooth breakage.
[0018] Furthermore, in S2, the labeled source domain dataset and the unlabeled target domain dataset are preprocessed to obtain the labeled source domain dataset III and the unlabeled target domain dataset III. The specific process is as follows:
[0019] S21. For each data sample in the labeled source domain dataset and the unlabeled target domain dataset, a wavelet threshold is used to eliminate high-frequency noise to obtain a labeled source domain dataset I and an unlabeled target domain dataset I. The wavelet threshold uses the DB4 wavelet basis and a 3-layer decomposition.
[0020] S22. Perform maximum and minimum value normalization on each data sample in the labeled source domain dataset I and the unlabeled target domain dataset I to obtain the labeled source domain dataset II and the unlabeled target domain dataset II.
[0021] S23. Add Gaussian noise and time-domain random cropping to each data sample in the labeled source domain dataset II and the unlabeled target domain dataset II to obtain a labeled source domain dataset III and an unlabeled target domain dataset III, where the signal-to-noise ratio (SNR) of the Gaussian noise is 20 dB.
[0022] Furthermore, in S3, a fault diagnosis model is constructed, and the labeled source domain dataset III and the unlabeled target domain dataset III are input into the fault diagnosis model for training, and the fault category and location information are output to obtain a trained fault diagnosis model. The specific process is as follows:
[0023] S31. Input the labeled source domain dataset III and the unlabeled target domain dataset III into the multi-scale channel attention unit for feature extraction, output the features corresponding to each data sample, and obtain the feature set of the labeled source domain dataset III and the feature set of the unlabeled target domain dataset III.
[0024] S32. Input the feature set of the labeled source domain data set III and the feature set of the unlabeled target domain data set III obtained in S31 into the classifier, output the predicted probability of the source domain data and the predicted probability of the target domain data respectively, and generate the pseudo label corresponding to the target domain data according to the predicted probability of the target domain data.
[0025] S33. Input the feature set of the labeled source domain dataset III and the feature set of the unlabeled target domain dataset III obtained in S31, as well as the predicted probability of the source domain data and the pseudo-label of the target domain data output by S32 into the invariant feature learning unit, calculate the source domain cross entropy loss based on the feature set of the labeled source domain dataset III and the predicted probability of the source domain data, calculate the target domain pseudo-label loss based on the feature set of the unlabeled target domain dataset III and the pseudo-label of the target domain data, and calculate the gradient inner product based on the source domain cross entropy loss and the target domain pseudo-label loss.
[0026] S34. Input the feature set of the labeled source domain dataset III and the feature set of the unlabeled target domain dataset III obtained in S31, as well as the predicted probability of the source domain data, the predicted probability of the target domain data and the pseudo-label of the target domain data output by S32 into the joint domain adaptation unit, use the conditional adversarial network to obtain the optimal domain discriminator loss function, generate the conditional distribution, and use the joint maximum mean difference for distribution alignment.
[0027] S35. The fault diagnosis model also includes a multi-objective joint optimization unit, which integrates the source domain cross entropy loss and gradient inner product obtained in S33, and the optimal domain discriminator loss function and distribution alignment obtained in S34 into the multi-objective joint optimization unit, and uses the integrated result as the total loss function of the fault diagnosis model.
[0028] S36: Based on the prediction probability of the target domain data outputted in S32, an entropy weighting strategy is added to filter the high-confidence target domain prediction results, and the fault category and location information are outputted. The specific process is as follows:
[0029] Calculate the entropy value based on the predicted probability of the target domain data :
[0030]
[0031] in, is the predicted probability of the target domain data.
[0032] According to the entropy Generate weights , filter the high-confidence target domain prediction results.
[0033] At this point, the trained fault diagnosis model is obtained.
[0034] Furthermore, the multi-scale channel attention unit in S31 includes, in sequence, convolution layer 1, batch normalization layer 1 (BN), ReLU activation layer 1, maximum pooling layer 1, Msk-ECA module, convolution layer 2, batch normalization layer 2, ReLU activation layer 2, maximum pooling layer 2, Msk-ECA module, convolution layer 3, batch normalization layer 3, ReLU activation layer 3, maximum pooling layer 3, Msk-ECA module, convolution layer 4, batch normalization layer 4, ReLU activation layer 4 and maximum pooling layer 4.
[0035] The Msk-ECA module includes a global average pooling layer, a multi-scale convolution interaction layer, a feature weighted fusion layer and a Sigmoid activation layer in sequence.
[0036] The global average pooling layer compresses the input feature map along the time dimension to generate a channel descriptor.
[0037] The multi-scale convolutional interaction layer is based on the channel descriptor and uses three one-dimensional convolution kernels of different sizes to extract channel interaction features in parallel.
[0038] The feature weighted fusion layer adds the channel interaction features to obtain added channel interaction features.
[0039] The Sigmoid activation layer generates a final channel weight by sigmoid activation of the added channel interaction features, uses the final channel weight to weight the feature map input by the global average pooling layer, outputs a channel weighted feature map, and obtains the corresponding features according to the channel weighted feature map.
[0040] Furthermore, in S33, the feature set of the labeled source domain dataset III and the feature set of the unlabeled target domain dataset III obtained in S31, as well as the predicted probability of the source domain data and the pseudo-label of the target domain data output by S32 are input into the invariant feature learning unit, and the source domain cross entropy loss is calculated based on the feature set of the labeled source domain dataset III and the predicted probability of the source domain data, the target domain pseudo-label loss is calculated based on the feature set of the unlabeled target domain dataset III and the pseudo-label of the target domain data, and the gradient inner product is calculated based on the source domain cross entropy loss and the target domain pseudo-label loss. The specific process is:
[0041] Calculate the source domain cross entropy loss based on the feature set of the labeled source domain dataset III obtained by S31 and the predicted probability of the source domain data output by S32 :
[0042]
[0043] in, Indicates the number of source domain data samples in the current batch, Indicates the total number of fault categories, represents the one-hot encoding of the true label of the i-th sample in the source domain dataset in the c-th category, Represents the classifier's predicted probability that the i-th data sample belongs to the c-th category.
[0044] The target domain pseudo-label loss is calculated based on the feature set of the unlabeled target domain dataset III obtained by S31 and the pseudo-label of the target domain data output by S32. :
[0045]
[0046] in, represents the number of target domain samples in the current batch, is the pseudo label of the jth sample in the target domain dataset in the cth category, Indicates the classifier for The predicted probability that the sample belongs to the cth class.
[0047] Calculate the source domain cross entropy loss and target domain pseudo-label loss Fault diagnosis model parameters The inner product of the gradient :
[0048]
[0049] in, represents the i-th trainable parameter in the fault diagnosis model.
[0050] Furthermore, in S34, the feature set of the labeled source domain dataset III and the feature set of the unlabeled target domain dataset III obtained in S31, as well as the predicted probability of the source domain data, the predicted probability of the target domain data, and the pseudo-label of the target domain data output by S32 are input into the joint domain adaptation unit, and the conditional adversarial network is used to obtain the optimal domain discriminator loss function, and the conditional distribution is generated, and the joint maximum mean difference is used for distribution alignment. The specific process is:
[0051] The corresponding feature vector is obtained based on the features in the feature set of the labeled source domain dataset III obtained by S31. The corresponding feature vector is obtained based on the features in the feature set of the unlabeled target domain dataset III obtained by S31. The two parts of the feature vectors and the predicted probability of the source domain data and the predicted probability of the target domain data output by S32 are input into the conditional adversarial network. The outer product of each feature vector and the corresponding predicted probability is calculated as the corresponding conditional feature to obtain all conditional features. Based on all conditional features, the domain discriminator is trained using the gradient reversal layer to obtain the optimal domain discriminator and the loss function of the optimal domain discriminator is calculated. , and generates the conditional distribution for each data sample.
[0052]
[0053] in, is the feature vector of the i-th source domain data feature, is the feature vector of the j-th target domain data feature, is the predicted probability of the i-th source domain data, is the predicted probability of the j-th target domain data, is the conditional feature of the i-th source domain data, is the conditional feature of the i-th target domain data, and D(·) is the output of the domain discriminator.
[0054] At the same time, based on the feature set of the labeled source domain dataset III and the feature set of the unlabeled target domain dataset III obtained in S31, the pseudo-label of the target domain data output by S32, and the conditional distribution of each data sample, the marginal distribution and conditional distribution of similar data samples in the source domain dataset and the target domain dataset are synchronously aligned using the joint maximum mean difference:
[0055]
[0056] in, Indicates distribution alignment, represents the sample set belonging to the cth category in the source domain dataset, represents the samples belonging to the cth category in the source domain dataset, represents the sample set belonging to the cth category in the target domain dataset, represents the samples belonging to the cth category in the target domain dataset, represents the number of samples of category c in the source domain dataset, represents the number of samples of category c in the target domain dataset, represents the Gaussian kernel mapping function, represents the norm in the RKHS space.
[0057] Furthermore, the total loss function of the fault diagnosis model in S35 is:
[0058]
[0059] in, 、 、 is the trade-off coefficient, =0.5, =1, =0.3, is the penalty factor, =0.1.
[0060] Furthermore, the alarm logic of the fault diagnosis model trained in S3 is:
[0061] When the predicted probability is maximum And entropy When the alarm is triggered, the first level alarm is triggered.
[0062] when or When the alarm is triggered, the second level warning is triggered.
[0063] A pumping unit fault diagnosis system based on channel attention and invariance learning includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, any step of a pumping unit fault diagnosis method based on channel attention and invariance learning is implemented.
[0064] The beneficial effects of the present invention are:
[0065] The present invention inputs preprocessed multi-operating-condition vibration signals of a pumping unit motor or a gearbox into a self-constructed fault diagnosis model. The fault diagnosis model comprises a multi-scale channel attention unit, a classifier, an invariant feature learning unit, a joint domain adaptation unit, and a multi-objective joint optimization unit. The multi-scale channel attention unit extracts features from the multi-operating-condition vibration signals. Using 3 / 5 / 7 multi-scale convolution kernels, it captures fault features in different frequency bands within the vibration signals, overcoming the insufficient feature coverage of traditional single-core attention mechanisms. The classifier outputs a predicted probability based on the features. The invariant feature learning unit introduces a gradient inner product penalty term to maximize gradient similarity, constraining the fault diagnosis model's optimization direction consistency in the source and target domains, and ensuring cross-operating-condition invariance of fault features. The joint domain adaptation unit integrates JMMD with conditional adversarial training to synchronously align the marginal distribution (overall feature distribution) with the conditional distribution (distribution of features of similar faults), addressing the mismatching problem caused by traditional methods that ignore class structure. The multi-objective joint optimization unit integrates the source domain cross entropy loss, gradient inner product, distribution alignment, and the optimal domain discriminator loss function obtained by the present invention as the overall loss function of the fault diagnosis model. This final fault diagnosis model is used to diagnose faults in the pumping unit motor and reducer, and outputs fault classification and location information. This configuration improves the diagnostic accuracy of the fault diagnosis model in multiple ways.
[0066] The present invention adopts lightweight 1DCNN and parallel attention calculation, and the single-sample inference time is less than 10ms. The present invention can be connected to the online monitoring system that supports the oil pumping unit to achieve real-time alarm. BRIEF DESCRIPTION OF THE DRAWINGS
[0067] Figure 1Schematic diagram of the multi-scale channel attention unit in the fault diagnosis model;
[0068] Figure 2 This is an example of the spectrum of a motor vibration fault signal. Figure 1 ;
[0069] Figure 3 This is an example of the spectrum of a motor vibration fault signal. Figure 2 ;
[0070] Figure 4 This is an example of the spectrum of a motor vibration fault signal. Figure 3 . DETAILED DESCRIPTION
[0071] Specific implementation method 1: Combination Figures 1-4 This embodiment describes a method for diagnosing oil pumping unit faults based on channel attention and invariance learning, which includes the following steps:
[0072] S1. Collect the multi-condition vibration signals of the pumping unit motor and the multi-condition vibration signals of the reduction gearbox respectively, and construct a labeled source domain dataset and an unlabeled target domain dataset based on all the collected multi-condition vibration signals.
[0073] One vibration accelerometer was deployed in both the axial and radial directions on the drive end of the pumping unit motor, and one in both the axial and radial directions on the non-drive end. The frequency response range of all vibration accelerometers was 5 Hz to 20 kHz. The vibration accelerometers installed on the motor collected the motor's multi-operating vibration signals. Furthermore, one vibration accelerometer was deployed in the radial direction on both the input shaft (high-speed end) and the output shaft (low-speed end) of the gearbox, and one was also deployed on the top of the gearbox housing. The vibration accelerometers installed on the gearbox collected the gearbox's multi-operating vibration signals. The collected multi-operating vibration signals were divided into a labeled source domain dataset and an unlabeled target domain dataset. All vibration accelerometers were fixed to the motor and gearbox using magnetic mounts to ensure that the sensor axis aligned with the vibration direction of the motor or gearbox. Shielded cables were used for signal cables to prevent electromagnetic interference.
[0074] When collecting multi-operating vibration signals, the present invention sets the sampling frequency to 20kHz. This covers the upper limit of 10kHz for bearing fault characteristic frequencies in motors and gearboxes, thereby achieving comprehensive, reliable, convenient, and rapid diagnosis. Sampling Signal Length: A single sample contains 1024 data points, corresponding to a duration of 0.0512 seconds. Operating Condition Tags: Source domain data must record speed (r / min), load (kW), and fault tags, including bearing outer race damage and gear tooth breakage.
[0075] S2. Preprocess the labeled source domain dataset and the unlabeled target domain dataset respectively to obtain the labeled source domain dataset III and the unlabeled target domain dataset III. The specific process is as follows:
[0076] S21. For each data sample in the labeled source domain dataset and the unlabeled target domain dataset, high-frequency noise is eliminated using a wavelet threshold to obtain a labeled source domain dataset I and an unlabeled target domain dataset I. The wavelet threshold uses a DB4 wavelet basis and a three-layer decomposition.
[0077] S22. Perform maximum and minimum normalization on each data sample in the labeled source domain dataset I and the unlabeled target domain dataset I to obtain the labeled source domain dataset II and the unlabeled target domain dataset II:
[0078]
[0079] in, Represents the data samples in the labeled source domain dataset I and the unlabeled target domain dataset II; Represents the data samples of the labeled source domain dataset I and the unlabeled target domain dataset II after normalization.
[0080] S23. Add Gaussian noise and temporal random cropping to each data sample in the labeled source domain dataset II and the unlabeled target domain dataset II to obtain a labeled source domain dataset III and an unlabeled target domain dataset III. The signal-to-noise ratio (SNR) of the Gaussian noise is 20 dB. The labeled source domain dataset III is the expanded labeled source domain dataset, and the unlabeled target domain dataset III is the expanded unlabeled target domain dataset.
[0081] S3. Build a fault diagnosis model. Input the labeled source domain dataset III and the unlabeled target domain dataset III into the fault diagnosis model for training. Output the fault category and location information to obtain a trained fault diagnosis model. The specific process is as follows:
[0082] The fault diagnosis model includes a multi-scale channel attention unit, a classifier, an invariant feature learning unit, a joint domain adaptation unit and a multi-objective joint optimization unit.
[0083] S31. Input the labeled source domain dataset III and the unlabeled target domain dataset III into the multi-scale channel attention unit for feature extraction, output the features corresponding to each data sample, and obtain the feature set of the labeled source domain dataset III and the feature set of the unlabeled target domain dataset III.
[0084] The multi-scale channel attention unit is composed of four layers of one-dimensional convolutional layers (1DCNN) and multi-scale kernel efficient channel attention modules (Msk-ECA) stacked alternately. The specific structure includes convolutional layer 1, batch normalization layer 1 (BN), ReLU activation layer 1, maximum pooling layer 1, Msk-ECA module, convolutional layer 2, batch normalization layer 2, ReLU activation layer 2, maximum pooling layer 2, Msk-ECA module, convolutional layer 3, batch normalization layer 3, ReLU activation layer 3, maximum pooling layer 3, Msk-ECA module, convolutional layer 4, batch normalization layer 4, ReLU activation layer 4 and maximum pooling layer 4. The specific parameters of the structure are as follows:
[0085] Convolutional layer 1: The convolution kernel size is 15, the number of channels is 16, and the stride is 2.
[0086] Convolutional layer 2: The convolution kernel size is 3, the number of channels is 32, and the stride is 1.
[0087] Max pooling layer 2: The pooling kernel is 2.
[0088] Convolutional layer 3: The convolution kernel size is 3, the number of channels is 64, and the stride is 1.
[0089] Convolutional layer 4: The convolution kernel size is 3, the number of channels is 128, and the stride is 1.
[0090] Max pooling layer 4: The pooling kernel is 2.
[0091] The Msk-ECA module includes a global average pooling layer, a multi-scale convolution interaction layer, a feature weighted fusion layer and a Sigmoid activation layer in sequence.
[0092] 1. Global average pooling layer: input feature map Compression along the time dimension to generate channel descriptors .
[0093] 2. Multi-scale convolution interaction layer: Based on the channel descriptor, three one-dimensional convolution kernels of different sizes are used ( Figure 1 k1, k2, k3) in parallel to extract channel interaction features , realizing multi-scale channel interaction, the channel interaction feature is the multi-scale feature.
[0094]
[0095] Among them, the convolution kernel size k is adaptively adjusted according to the number of channels C:
[0096]
[0097] Among them, γ and b are empirical parameters, γ=2, b=1, and odd means taking the nearest odd number.
[0098] 3. Feature weighted fusion layer: channel interaction features Add them together to get the added channel interaction features.
[0099] 4. Sigmoid activation layer: The added channel interaction features are activated by Sigmoid to generate the final channel weight :
[0100]
[0101] Using the final channel weight The feature map of the global average pooling layer input Perform weighting and output channel weighted feature map :
[0102]
[0103] in, is the Sigmoid function, Represents channel weighting. The corresponding features are obtained according to the channel weighted feature map.
[0104] The multi-scale channel attention layer of the present invention uses 3 / 5 / 7 multi-scale convolution kernels to capture fault characteristics in different frequency bands within the multi-condition vibration signal of each data sample, such as the high-frequency resonance of early bearing damage and the low-frequency impact of severe wear. The resulting multi-scale features can better represent the vibration signal and generate a more accurate feature map, which contains 256 high-dimensional features. This step of the present invention overcomes the insufficient feature coverage of traditional single-core attention mechanisms.
[0105] S32: Input the feature set of the labeled source domain dataset III and the feature set of the unlabeled target domain dataset III obtained in S31 into the classifier, and output the predicted probability of the source domain data respectively. And the predicted probability of the target domain data , according to the predicted probability of the target domain data , use the threshold to filter high confidence predictions to generate pseudo labels corresponding to the target domain data The threshold is set as the lower confidence limit ≥0.8, and the entropy value is capped ≤0.3.
[0106] S33, calculate the gradient inner product penalty term in the invariant feature learning unit (IFL) by taking the feature set of the labeled source domain dataset III and the unlabeled target domain dataset III obtained in S31, as well as the predicted probability of the source domain data and the pseudo label of the target domain data output by S32, and obtain the gradient inner product The specific process is:
[0107] Calculate the source domain cross entropy loss based on the feature set of the labeled source domain dataset III obtained by S31 and the predicted probability of the source domain data output by S32 :
[0108]
[0109] in, Indicates the number of source domain data samples in the current batch, Indicates the total number of fault categories, represents the one-hot encoding of the true label of the i-th sample in the source domain dataset in the c-th category, Represents the classifier's predicted probability that the i-th data sample belongs to the c-th category.
[0110] The target domain pseudo-label loss is calculated based on the feature set of the unlabeled target domain dataset III obtained by S31 and the pseudo-label of the target domain data output by S32. :
[0111]
[0112] in, represents the number of target domain samples in the current batch, is the pseudo label of the jth sample in the target domain dataset in the cth category, Indicates the classifier for The predicted probability that the sample belongs to the cth class.
[0113] Calculate the source domain cross entropy loss and target domain pseudo-label loss Fault diagnosis model parameters The inner product of the gradient :
[0114]
[0115] in, represents the i-th trainable parameter in the fault diagnosis model.
[0116] This step of the present invention maximizes gradient similarity by introducing a gradient inner product penalty term, constraining the fault diagnosis model to optimize in the same direction in both the source and target domains. This enhances feature invariance and ensures the invariance of fault features across operating conditions, such as the consistency of the envelope energy of a bearing outer race fault at different speeds. The present invention incorporates the gradient inner product as a regularization term into the total loss function, with a weight coefficient of 0.1.
[0117] S34. Input the feature set of the labeled source domain dataset III and the feature set of the unlabeled target domain dataset III obtained in S31, as well as the predicted probability of the source domain data, the predicted probability of the target domain data, and the pseudo-label of the target domain data output by S32 into the joint domain adaptation unit, use the conditional adversarial network to obtain the optimal domain discriminator loss function, and generate the conditional distribution of each data sample. Use the joint maximum mean difference to synchronously align the marginal distribution and conditional distribution of similar samples in the source domain dataset and the target domain dataset. The specific process is as follows:
[0118] The corresponding feature vector is obtained based on the features in the feature set of the labeled source domain dataset III obtained by S31. The corresponding feature vector is obtained based on the features in the feature set of the unlabeled target domain dataset III obtained by S31. The two parts of the feature vectors and the predicted probability of the source domain data and the predicted probability of the target domain data output by S32 are input into the conditional adversarial network. The outer product of each feature vector and the corresponding predicted probability is calculated as the corresponding conditional feature to obtain all conditional features. Based on all conditional features, the domain discriminator is trained using the gradient reversal layer (GRL) to obtain the optimal domain discriminator and the loss function of the optimal domain discriminator is calculated. , and generates the conditional distribution for each data sample.
[0119]
[0120] in, is the feature vector of the i-th source domain data feature, is the feature vector of the j-th target domain data feature, is the predicted probability of the i-th source domain data, is the predicted probability of the j-th target domain data, is the conditional feature of the i-th source domain data, is the conditional feature of the i-th target domain data, and D(·) is the output of the domain discriminator. The conditional adversarial network adopts classic methods such as CDAN (an extension of DANN).
[0121] At the same time, according to the feature set of the labeled source domain dataset III and the feature set of the unlabeled target domain dataset III obtained in S31, the pseudo label of the target domain data output by S32, and the conditional distribution of each data sample, the marginal distribution and conditional distribution of similar samples in the source domain dataset and the target domain dataset are synchronously aligned using the joint maximum mean discrepancy (JMMD) to narrow the feature distribution difference of similar samples in the source domain dataset and the target domain dataset, and the distribution is aligned. The expression is:
[0122]
[0123] in, represents the sample set belonging to the cth category in the source domain dataset, represents the samples belonging to the cth category in the source domain dataset, represents the sample set belonging to the cth category in the target domain dataset, represents the samples belonging to the cth category in the target domain dataset, represents the number of samples of category c in the source domain dataset, represents the number of samples of category c in the target domain dataset, Represents the Gaussian kernel mapping function, which maps the original features to the reproducing kernel Hilbert space (RKHS) to facilitate the distribution difference measurement. Represents the norm in the RKHS space, which is used to measure the distribution difference.
[0124] S35. Input the above-obtained source domain cross entropy loss, gradient inner product, distribution alignment and optimal domain discriminator loss function into the multi-objective joint optimization unit for integration, and use the integrated result as the total loss function of the fault diagnosis model. .
[0125]
[0126] in, 、 、 is the trade-off coefficient, =0.5, =1, =0.3, =0.1 is the penalty factor.
[0127] S36. Entropy weighting strategy: Calculate entropy value based on the predicted probability of target domain data , and generate weights , suppress the interference of low-confidence samples, filter the high-confidence target domain prediction results, and obtain a trained fault diagnosis model.
[0128] In this paper, a labeled source domain dataset III and an unlabeled target domain dataset III are fed into the constructed fault diagnosis model. Each batch of data is input in a batch size of 64, meaning that 64 samples are randomly selected from all data samples in the two datasets. The fault diagnosis model uses the Adam optimizer with an initial learning rate of 1e3 and a weight decay of 1e5.
[0129] The alarm logic of the fault diagnosis model trained in the present invention is:
[0130] When the predicted probability is maximum And entropy When the alarm is triggered, the first level alarm is triggered.
[0131] when or When the alarm is triggered, the second level warning is triggered.
[0132] This invention utilizes a gradient inner product penalty to constrain the direction of the gradients of the loss functions in the source and target domains, forcing the fault diagnosis model to learn features that are invariant across operating conditions. Joint Maximum Mean Divergence (JMMD) and a conditional adversarial network are used to align the marginal and conditional distributions of the source and target domains. An entropy-weighted strategy is used to select high-confidence target domain predictions and output fault classification and location information. This invention improves the diagnostic accuracy of the fault diagnosis model from multiple perspectives, addressing the shortcomings of manual and intelligent feature extraction.
[0133] S4. Collect the multi-operating-condition vibration signals of the motor or the multi-operating-condition vibration signals of the reduction gearbox to be diagnosed, input the collected multi-operating-condition vibration signals into the fault diagnosis model trained in S3, and output the corresponding fault category and location information.
[0134] The present invention can meet the needs of directly utilizing unlabeled target domain data (such as 1200r / min operating condition data of unknown faults) to perform diagnosis in oilfield pumping units (unsupervised cross-operating condition capability). It can also simultaneously identify coupling faults of components such as bearings, gears, and couplings, and ensure that the online diagnostic system using the present invention outputs results within 1 second with a false alarm rate of less than 5%, demonstrating real-time and reliability.
[0135] Specific implementation method 2: Combination Figures 1-4 To describe this embodiment, the oil pumping unit fault diagnosis system based on channel attention and invariance learning described in this embodiment specifically includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements any step of an oil pumping unit fault diagnosis method based on channel attention and invariance learning.
[0136] Specific implementation method three: refer to Figures 1-4 This embodiment further defines the pumping unit fault diagnosis system based on channel attention and invariance learning described in the second embodiment. In this embodiment, the alarm logic of the pumping unit fault diagnosis system based on channel attention and invariance learning is as follows:
[0137] When the predicted probability is maximum And entropy When the alarm is triggered, the first level alarm is triggered.
[0138] when or When the alarm is triggered, the second level warning is triggered.
[0139] Example 1
[0140] Fault diagnosis of pumping unit motor bearings under different working conditions:
[0141] (1) Scenario description:
[0142] Data from an oilfield pumping unit operating normally at 600 r / min is used as labeled source data, while data from a speed of 1200 r / min is used as unlabeled target data. At a certain moment, the motor's vibration signal suddenly increases to 7.5 mm / s (the ISO 108163 alarm threshold). This vibration signal is captured.
[0143] (2) Diagnostic process of fault diagnosis model:
[0144] 1. The acquired vibration signal is input into the multi-scale channel attention unit to extract features. The output results show that the last Msk-ECA module is significantly activated at channels 32, 64, and 128. This phenomenon corresponds to the characteristic frequency band of the bearing outer ring fault.
[0145] 2. After the invariance analysis of the invariance feature learning unit, the gradient inner product value reached 0.85 (the threshold is 0.8), indicating that there are invariant features across working conditions.
[0146] 3. After distribution alignment by the joint domain adaptation unit, the JMMD loss is reduced from the initial 0.62 to 0.18, and the conditional adversarial loss converges to 0.25.
[0147] 4. The fault diagnosis model outputs: "Bearing outer ring damage" (98.7% confidence level), and the fault is located at the motor drive end.
[0148] (3) Disassembly verification:
[0149] There is a peeling area (size 3×5mm) on the outer ring of the bearing of the motor, which is consistent with the diagnosis results.
[0150] Example 2
[0151] Combined fault diagnosis of reduction gear and coupling:
[0152] (1) Scenario description:
[0153] The gears in a pumping unit's gearbox are made of 20CrMnTi, and the coupling is an elastic pin type. A vibration accelerometer with a frequency response range of 0.5 Hz to 10 kHz is radially located on the gearbox's input shaft (high-speed end), and a vibration accelerometer with a frequency response range of 0.1 Hz to 2 kHz is radially located on the output shaft (low-speed end). A low-frequency vibration sensor with a frequency response range of 0.1 Hz to 2 kHz is located on the top of the housing. Under normal operating conditions, the gearbox rotates at 600 rpm and has a load power of 50 kW. Data from the gearbox at a speed of 900 rpm is used as the unlabeled target domain data. At this point, the gearbox's vibration signal exhibits multiple frequency components: 2× the rotational frequency of 60 Hz and 3× the rotational frequency of 240 Hz. This vibration signal is captured.
[0154] (2) Diagnostic process of fault diagnosis model:
[0155] 1. The acquired vibration signal was input into a multi-scale channel attention unit to extract features. The output results show that the last three-core branch (high-frequency analysis) of Msk-ECA captures a gear mesh frequency of 820 Hz, with an amplitude spike of 2.5 mm / s, accompanied by sidebands at ± the rotational frequency (900 / 60 = 15 Hz), indicating a localized gear tooth breakage. Under normal circumstances, the amplitude of the gear mesh frequency of 820 Hz is stable at 0.5-1.0 mm / s, without sideband modulation. The five-core branch (low-frequency analysis) extracts coupling misalignment features, with amplitudes increasing to 1.8 mm / s at 2 × the rotational frequency of 60 Hz and 1.2 mm / s at 3 × the rotational frequency of 90 Hz, indicating radial coupling deviation. Under normal circumstances, when the coupling is well aligned, the amplitude at 2 × the rotational frequency (2 × 900 / 60 = 30 Hz) is ≤ 0.3 mm / s.
[0156] 2. The fault diagnosis model outputs: "Partial gear tooth breakage, tooth length 3mm" (92.3% confidence level, exceeding the threshold of 90%) and "Coupling radial deviation 0.15mm" (88.5% confidence level).
[0157] (3) Maintenance measures:
[0158] After the gear was replaced, the 820 Hz amplitude dropped to 0.7 mm / s, and the sideband energy disappeared.
[0159] After adjusting the coupling alignment, the 2x speed amplitude dropped to 0.3 mm / s and the total RMS vibration value dropped to 2.1 mm / s (in line with ISO Class 1 standards).
[0160] The above examples are merely illustrative of the calculation model and process of the present invention and are not intended to limit the embodiments of the present invention. Persons skilled in the art will readily appreciate that other variations or modifications based on the above description are possible. This list of embodiments is not exhaustive; however, any obvious variations or modifications derived from the technical solution of the present invention remain within the scope of protection of the present invention.
Claims
1. A method for fault diagnosis of oil pumping units based on channel attention and invariance learning, characterized by: It includes the following steps: S1. Collect the multi-operating vibration signals of the pumping unit motor and the multi-operating vibration signals of the reduction gearbox respectively, and construct a labeled source domain dataset and an unlabeled target domain dataset based on all the collected multi-operating vibration signals. S2. Preprocess the labeled source domain dataset and the unlabeled target domain dataset respectively to obtain the labeled source domain dataset III and the unlabeled target domain dataset III; S3. Build a fault diagnosis model, input the labeled source domain dataset III and the unlabeled target domain dataset III into the fault diagnosis model for training, output the fault category and location information, and obtain a trained fault diagnosis model; The fault diagnosis model includes a multi-scale channel attention unit, a classifier, an invariant feature learning unit, and a joint domain adaptation unit. The specific process is as follows: S31. Input the labeled source domain dataset III and the unlabeled target domain dataset III into the multi-scale channel attention unit for feature extraction, output the features corresponding to each data sample, and obtain the feature set of the labeled source domain dataset III and the feature set of the unlabeled target domain dataset III; The multi-scale channel attention unit includes, in sequence, convolutional layer 1, batch normalization layer 1, ReLU activation layer 1, maximum pooling layer 1, Msk-ECA module, convolutional layer 2, batch normalization layer 2, ReLU activation layer 2, maximum pooling layer 2, Msk-ECA module, convolutional layer 3, batch normalization layer 3, ReLU activation layer 3, maximum pooling layer 3, Msk-ECA module, convolutional layer 4, batch normalization layer 4, ReLU activation layer 4 and maximum pooling layer 4; The Msk-ECA module includes a global average pooling layer, a multi-scale convolutional interaction layer, a feature weighted fusion layer and a Sigmoid activation layer in sequence; The global average pooling layer compresses the input feature map along the time dimension to generate a channel descriptor; The multi-scale convolution interaction layer is based on the channel descriptor and uses three one-dimensional convolution kernels of different sizes to extract channel interaction features in parallel; The feature weighted fusion layer adds the channel interaction features to obtain added channel interaction features; The Sigmoid activation layer generates a final channel weight by sigmoid activation on the added channel interaction features, uses the final channel weight to weight the feature map input by the global average pooling layer, outputs a channel weighted feature map, and obtains the corresponding feature according to the channel weighted feature map; S32. Input the feature set of the labeled source domain dataset III and the feature set of the unlabeled target domain dataset III obtained in S31 into the classifier, output the predicted probability of the source domain data and the predicted probability of the target domain data respectively, and generate a pseudo label corresponding to the target domain data according to the predicted probability of the target domain data; S33, inputting the feature set of the labeled source domain data set III and the feature set of the unlabeled target domain data set III obtained in S31, as well as the predicted probability of the source domain data and the pseudo-label of the target domain data output by S32 into the invariant feature learning unit, calculating the source domain cross entropy loss based on the feature set of the labeled source domain data set III and the predicted probability of the source domain data, calculating the target domain pseudo-label loss based on the feature set of the unlabeled target domain data set III and the pseudo-label of the target domain data, and calculating the gradient inner product of the source domain cross entropy loss and the target domain pseudo-label loss with respect to the fault diagnosis model parameters; S34: Input the feature set of the labeled source domain dataset III and the feature set of the unlabeled target domain dataset III obtained in S31, as well as the predicted probability of the source domain data, the predicted probability of the target domain data, and the pseudo-label of the target domain data output by S32 into the joint domain adaptation unit, use the conditional adversarial network to obtain the optimal domain discriminator loss function, and generate a conditional distribution. Use the joint maximum mean difference to perform distribution alignment. The specific process is as follows: The corresponding feature vector is obtained based on the features in the feature set of the labeled source domain dataset III obtained by S31. The corresponding feature vector is obtained based on the features in the feature set of the unlabeled target domain dataset III obtained by S31. The two parts of the feature vectors and the predicted probability of the source domain data and the predicted probability of the target domain data output by S32 are input into the conditional adversarial network. The outer product of each feature vector and the corresponding predicted probability is calculated as the corresponding conditional feature to obtain all conditional features. Based on all conditional features, the domain discriminator is trained using the gradient reversal layer to obtain the optimal domain discriminator and the loss function of the optimal domain discriminator is calculated. And generate the conditional distribution of each data sample; Among them, h i is the feature vector of the i-th source domain data feature, h j is the feature vector of the j-th target domain data feature, p i is the predicted probability of the i-th source domain data, p j is the predicted probability of the j-th target domain data, is the conditional feature of the i-th source domain data, is the conditional feature of the i-th target domain data, and D(·) is the output of the domain discriminator; At the same time, based on the feature set of the labeled source domain dataset III and the feature set of the unlabeled target domain dataset III obtained in S31, the pseudo-label of the target domain data output by S32, and the conditional distribution of each data sample, the marginal distribution and conditional distribution of similar data samples in the source domain dataset and the target domain dataset are synchronously aligned using the joint maximum mean difference: in, Indicates distribution alignment, represents the sample set belonging to the cth category in the source domain dataset, x i represents the samples belonging to the cth category in the source domain dataset, represents the sample set belonging to the cth class in the target domain dataset, x j represents the samples belonging to the cth category in the target domain dataset, represents the number of samples of category c in the source domain dataset, represents the number of samples of the cth class in the target domain dataset, φ(·) represents the Gaussian kernel mapping function, represents the norm in the RKHS space; S35, the fault diagnosis model also includes a multi-objective joint optimization unit, which inputs the source domain cross entropy loss and gradient inner product obtained in S33, and the optimal domain discriminator loss function and distribution alignment obtained in S34 into the multi-objective joint optimization unit for integration, and uses the integrated result as the total loss function of the fault diagnosis model; S36: Based on the prediction probability of the target domain data outputted in S32, an entropy weighting strategy is added to filter the high-confidence target domain prediction results, and the fault category and location information are outputted. The specific process is as follows: Calculate the entropy value H(p) based on the predicted probability of the target domain data: Among them, p c is the predicted probability of the target domain data; Generate weight w according to entropy value H(p) H =e -H(p) , filter the high-confidence target domain prediction results; At this point, the trained fault diagnosis model is obtained; S4. Collect the multi-operating-condition vibration signals of the motor or the multi-operating-condition vibration signals of the reduction gearbox to be diagnosed, input the collected multi-operating-condition vibration signals into the fault diagnosis model trained in S3, and output the corresponding fault category and location information.
2. The method for diagnosing oil pumping unit faults based on channel attention and invariance learning according to claim 1 is characterized in that: When collecting the multi-operating vibration signals of the pumping unit motor and the multi-operating vibration signals of the reduction gearbox in S1, the collection parameters are: Sampling frequency: 20kHz; Sampling signal length: A single sample contains 1024 data points, corresponding to a duration of 0.0512 seconds; Working condition tag: The source domain data includes speed, load, and fault tags, and the fault tags include bearing outer ring damage and gear tooth breakage.
3. The method for diagnosing oil pumping unit faults based on channel attention and invariance learning according to claim 1 is characterized in that: In S2, the labeled source domain dataset and the unlabeled target domain dataset are preprocessed to obtain the labeled source domain dataset III and the unlabeled target domain dataset III. The specific process is as follows: S21. For each data sample in the labeled source domain dataset and the unlabeled target domain dataset, a wavelet threshold is used to eliminate high-frequency noise to obtain a labeled source domain dataset I and an unlabeled target domain dataset I. The wavelet threshold uses a DB4 wavelet basis and a three-layer decomposition. S22, perform maximum and minimum normalization on each data sample in the labeled source domain dataset I and the unlabeled target domain dataset I to obtain the labeled source domain dataset II and the unlabeled target domain dataset II; S23. Add Gaussian noise and time-domain random cropping to each data sample in the labeled source domain dataset II and the unlabeled target domain dataset II to obtain a labeled source domain dataset III and an unlabeled target domain dataset III, where the signal-to-noise ratio (SNR) of the Gaussian noise is 20 dB.
4. The method for diagnosing oil pumping unit faults based on channel attention and invariance learning according to claim 1 is characterized in that: In the S33, the feature set of the labeled source domain data set III and the feature set of the unlabeled target domain data set III obtained in S31, as well as the predicted probability of the source domain data and the pseudo label of the target domain data output by S32 are input into the invariant feature learning unit, the source domain cross entropy loss is calculated according to the feature set of the labeled source domain data set III and the predicted probability of the source domain data, the target domain pseudo label loss is calculated according to the feature set of the unlabeled target domain data set III and the pseudo label of the target domain data, and the gradient inner product is calculated according to the source domain cross entropy loss and the target domain pseudo label loss. The specific process is: Calculate the source domain cross entropy loss based on the feature set of the labeled source domain dataset III obtained by S31 and the predicted probability of the source domain data output by S32 Where m represents the number of source domain data samples in the current batch, C represents the total number of fault categories, and y i,c represents the one-hot encoding of the true label of the i-th sample in the source domain dataset in the c-th category, p i,c represents the classifier's predicted probability that the i-th sample belongs to the c-th class; The target domain pseudo-label loss is calculated based on the feature set of the unlabeled target domain dataset III obtained by S31 and the pseudo-label of the target domain data output by S32. Where n represents the number of target domain samples in the current batch, is the pseudo label of the jth sample in the target domain dataset in the cth category, p j,c represents the classifier's predicted probability that the jth sample belongs to the cth class; Calculate the source domain cross entropy loss and target domain pseudo-label loss The gradient inner product of the fault diagnosis model parameter θ Among them, θ i represents the i-th trainable parameter in the fault diagnosis model.
5. The method for diagnosing oil pumping unit faults based on channel attention and invariance learning according to claim 4 is characterized in that: The total loss function of the fault diagnosis model in S35 is: Among them, λ1, λ2, and λ3 are weight coefficients, λ1 = 0.5, λ2 = 1, and λ3 = 0.3; α is the penalty factor, α = 0.
1.
6. The method for diagnosing oil pumping unit faults based on channel attention and invariance learning according to claim 1, characterized in that: The alarm logic of the fault diagnosis model trained in S3 is: When the predicted probability maximum P max When ≥0.95 and entropy value H(p)≤0.1, a level 1 alarm is triggered; When 0.8≤P max When ≤0.95 or 0.1≤H(p)≤0.3, the second level warning is triggered.
7. A pumping unit fault diagnosis system based on channel attention and invariance learning, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Mechanical fault diagnosis method under variable working condition based on nuclear sensitivity alignment network
CN115935187A
Gearbox cross-domain fault diagnosis method based on branch attention contrast transfer learning
CN118758594A