Small sample ship fuel oil system fault diagnosis method
By using the twin Transformer encoder network and the improved K-nearest neighbor classifier in the fault diagnosis of marine fuel system, combined with the new loss function, the problem of low accuracy of fuel system fault diagnosis under small sample data is solved, and efficient fault feature extraction and classification is achieved.
Patent Information
- Application Number
- CN202411735982.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-29
- Publication Date
- 2025-04-18
AI Technical Summary
The existing fault diagnosis methods for ship fuel system are difficult to accurately classify under small sample data, and traditional methods require a large amount of fault data for training, resulting in low diagnostic accuracy in the actual application of the model.
The twin Transformer encoder network is used to extract the global multi-scale features of fuel system failure data, and combine the improved K-nearest neighbor classifier for fault classification. At the same time, a new loss function is designed to train the model to achieve accurate diagnosis of fuel system failures under small samples.
By extracting fault characteristics and classification, the problem of low diagnostic accuracy under small sample data is solved, and the diagnostic efficiency and accuracy of the model when there are few fault samples are improved.
Smart Images

Figure CN119848648A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a fault diagnosis method, in particular to a small sample ship fuel system fault diagnosis method. Background Art
[0002] As one of the core devices of the ship's power system, the operating status of the diesel engine determines the safety of the ship's navigation. Due to working environment factors such as high load, high temperature, and high pressure, diesel engines are often accompanied by the risk of failure. Once a failure occurs, it will cause huge property losses and endanger the personal safety of the crew in serious cases. Among all types of diesel engine failures, fuel system failures account for the largest proportion. Therefore, fault diagnosis research on the fuel system is the key to improving the reliability of diesel engines and ensuring the safe navigation of ships.
[0003] The traditional method of ship fuel system fault diagnosis mainly collects characteristic parameters that reflect the operating status of the system, and then processes and analyzes these parameters. Common characteristic parameters include diesel engine power, cylinder exhaust temperature, maximum explosion pressure, etc., which require staff to have rich work experience and background knowledge. However, due to the similarity of characteristic parameters of certain fuel system faults, there are problems such as false alarms through manual diagnosis alone. At the same time, the current popular fault diagnosis method based on deep learning requires a large amount of fault data for model learning. However, due to the sporadic nature of fuel system faults, in practice, only a small amount of fault data can be provided for model training, making it difficult for the model to mine enough features for learning under small samples, resulting in low model diagnosis accuracy. In addition, the existing small sample fault diagnosis methods have problems such as complex models, difficult parameter convergence, and huge computing resource requirements.
[0004] For example, the ship fuel system fault diagnosis method with publication number CN100552208C uses a sensor installed at the outlet of the fuel pump to measure the fuel pressure signal, then stores the fuel pressure signal in the signal evaluation database through signal conversion, and finally compares the signal conversion value with the set value in the database. If it is not within the set value range, the fuel system is operating abnormally, and it is necessary to manually check the operating status of each device in the fuel system in turn. However, this invention only uses a single fuel pressure signal to determine whether the fuel system is abnormal, which has problems such as missed reports and false reports, and requires manual troubleshooting one by one, and the diagnostic efficiency is not high. The diesel engine fuel system fault diagnosis method based on the least squares support vector machine with the publication number CN105319071B collects the vibration acceleration signals of the diesel engine under normal and various fault conditions, decomposes the signals using the inherent time scale decomposition algorithm, generates several rotation components and residual signals, and calculates the typical frequency domain characteristics of the first N-order rotation components as fault characteristics. At the same time, the penalty factor and kernel function of the least squares support vector machine are optimized using the differential evolution algorithm and the particle swarm optimization algorithm, and finally the fault characteristics are input into the optimized vector machine for fault diagnosis. However, the invention requires a large amount of fault data, which is often not met in practice. Summary of the invention
[0005] Purpose of the invention: In view of the above problems, the purpose of the present invention is to provide a small sample ship fuel system fault diagnosis method to achieve accurate classification of fuel system faults under small samples.
[0006] Technical solution: A small sample ship fuel system fault diagnosis method, characterized by comprising the following steps:
[0007] Step 1: Collect the thermal parameters of the fuel system under normal conditions and various fault conditions, pre-process the parameters and add fault labels accordingly to form a sample set;
[0008] Step 2: Normalize the sample set to eliminate the dimension effect;
[0009] Step 3: Build a ship fuel system fault diagnosis model, extract global multi-scale features through the twin Transformer encoder network, use the improved K-nearest neighbor classifier to classify faults, and output the final diagnosis results;
[0010] Step 4: Establish a loss function based on the characteristics of fuel system fault data, use the normalized sample set as the input of the model, and the fault label corresponding to the parameter as the expected output of the model. Combined with the loss function, the twin Transformer encoder network is trained to obtain the optimal parameters of the model using the loss function.
[0011] Step 5: Collect the thermal parameters of the current fuel system, construct the test samples through the methods in steps 1 and 2, input the test samples into the diagnostic model trained in step 4, and obtain the fault diagnosis results of the current fuel system.
[0012] Furthermore, in step one, the fault state types include supercharger failure, early injection, delayed injection, cooler failure, injector wear, and fuel supply pipe blockage failure; the thermal parameters include power, fuel consumption rate, maximum explosion pressure, mean effective pressure, compressor outlet pressure, compressor outlet temperature, intercooler exhaust temperature, cylinder exhaust temperature, intake manifold pressure, and exhaust manifold pressure.
[0013] Optimally, in step 1, 30 sets of parameters are collected for each fault state, and the parameters are preprocessed, abnormal data are eliminated based on the Raida criterion, and the standard deviation s of each parameter is calculated according to the Bessel formula, which is defined as:
[0014]
[0015] Where n is the number of parameters, x i is the current parameter, is the parameter average value, if Then determine x i outliers and removed.
[0016] Furthermore, in step 2, the normalization method used is maximum and minimum normalization, and the mathematical model is:
[0017]
[0018] Among them, X norm is the standardized data, X max is the maximum value in the original data, X min is the minimum value of the original data.
[0019] Furthermore, in step 3, the twin Transformer encoder is used as a feature extractor, and is composed of two parameter-sharing Transformer encoders. The number of encoder stacks is 6, the input data is a 1×10 vector, batch normalization is used for normalization, the batch size is 64, the number of multi-head attention is 8, and the forward feedback network consists of two fully connected layers connected by a ReLU activation function, where:
[0020] ReLU(x)=max(0,x).
[0021] Furthermore, in step 3, the improvement of the K-nearest neighbor classifier includes the following steps:
[0022] Step 1: Find the K nearest neighbors of the sample to be tested according to the Euclidean distance, where K is 3, then calculate the similarity between the samples, and normalize the similarity to obtain the attention coefficient;
[0023] Step 2: Calculate the weight of each neighbor to the sample to be tested through the attention mechanism, calculate the weighted result according to the weight, and determine the category of the sample to be tested according to the weighted result to obtain the improved KNN classifier.
[0024] The best case is that in step 1, the sample to be tested x and each of its neighbors x i The expression of the Euclidean distance between is:
[0025]
[0026] In the formula, f j is the feature of j samples, and n is the total number of features;
[0027] The formula for calculating the similarity between samples is:
[0028] Similarity(x i ,x)=Q T K i ;
[0029] In the formula, Q is the query matrix and K is the key value matrix;
[0030] The expression of the attention coefficient is:
[0031] s i =softmax(Similarity(x i ,x));
[0032] In the formula, s i is the normalized attention coefficient.
[0033] Optimally, in step 2, the expression of attention weight is:
[0034]
[0035] In the formula, α i is the sample to be tested x and each neighbor x i The weight between
[0036] The expression of the weighted result is:
[0037]
[0038] Where V is the calculated weighted voting result, l i is the category of the i-th neighbor;
[0039] The expression of the sample category to be tested is as follows:
[0040]
[0041] In the formula, is the category label of sample x.
[0042] Furthermore, in step 4, the mathematical model of the loss function designed for the characteristics of fuel system fault data is:
[0043]
[0044] Where Y i,j Represents the similarity label between two samples, α i,j represents the penalty coefficient when samples i and j belong to different fault types, is the similarity loss, To punish losses.
[0045] Furthermore, in step five, the fault label in step one is used as the expected output of the diagnostic model, and the label setting results include normal state F1, supercharger fault F2, injection advance F3, injection lag F4, cooler fault F5, injector wear F6, and fuel supply pipe blockage F7.
[0046] Beneficial effects: Compared with the prior art, the advantages of the present invention are:
[0047] 1. The present invention designs a new small sample fault diagnosis model, which can better extract fault features and classification, and solves the problem of low diagnostic accuracy when the model has few fault samples;
[0048] 2. The present invention designs a new loss function for the fault diagnosis model, which can enable the model to more accurately learn the subtle differences between sample pairs of similar categories, and improve the accuracy of distinguishing similar sample pairs and different sample pairs to a new level;
[0049] 3. The present invention collects fault data based on 6 common fuel system faults, so the method can perform multiple fault diagnosis under small samples. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 is a fault diagnosis flow chart of the present invention;
[0051] Figure 2 is a data processing flow chart of the present invention;
[0052] Figure 3 A schematic diagram of a fault diagnosis model constructed for the present invention. DETAILED DESCRIPTION
[0053] The present invention will be further described below in conjunction with the accompanying drawings and specific embodiments. It should be understood that these embodiments are only used to illustrate the present invention and are not used to limit the scope of the present invention.
[0054] A small sample ship fuel system fault diagnosis method, such as Figures 1 to 3 As shown, the following steps are included:
[0055] Step 1: Collect the thermal parameters of the ship's fuel system under normal conditions and different faults and perform preprocessing. The fault types are: turbocharger fault, early injection, delayed injection, cooler fault, injector wear, and fuel supply pipe blockage. The collected thermal parameters are: power, fuel consumption rate, maximum burst pressure, average effective pressure, compressor outlet pressure, compressor outlet temperature, intercooler exhaust temperature, cylinder exhaust temperature, intake manifold pressure, and exhaust manifold pressure. 30 groups of parameters are collected for each type of fault, and abnormal data is eliminated for the parameters. Then, labels are added according to the fault type corresponding to the parameters to form a sample set;
[0056] Step 2: Normalize the sample set to eliminate the dimension effect;
[0057] Step 3: Construct a ship fuel system fault diagnosis model, use two sets of parameter-sharing Transformer encoders as sub-networks of the twin network, and use them as feature extractors of the diagnosis model to extract global multi-scale features of input samples. At the same time, an improved K-nearest neighbor classifier is added on the basis of the standard twin network for fault classification.
[0058] Step 4: Design a new loss function based on the characteristics of fuel system fault data, use the normalized sample set as the input of the model, and the fault label corresponding to the data as the expected output of the model. Randomly extract 2 groups of samples from the sample set and train the model in combination with the loss function to find the optimal model parameters.
[0059] Step 5: Collect the thermal parameters of the current fuel system, construct the test samples using the same method as steps 1 and 2, and input the test samples into the fault diagnosis model trained in step 4 to obtain the fault diagnosis results of the current fuel system.
[0060] In step 1, the data is preprocessed to remove abnormal data based on the Raida criterion, and the standard deviation s of each parameter is calculated according to the Bessel formula, which is defined as:
[0061]
[0062] Where n is the number of parameters, x i is the current parameter, is the parameter average value, if Then determine x i outliers and removed;
[0063] The normalization method used in step 2 is maximum and minimum normalization, and its formula is as follows:
[0064]
[0065] Where X norm is the standardized data, X max is the maximum value in the original data, X min is the minimum value of the original data;
[0066] The fault diagnosis model constructed in step 3 is shown in Figure 3 , the steps are as follows:
[0067] (1) Use two parameter-sharing Transformer encoders to form a twin network and use it as a feature extractor;
[0068] (2) Add an improved K-nearest neighbor classifier based on the standard twin network.
[0069] The Transformer encoder in step (1) is composed of two encoders with the same structure stacked together. The input data is a 1×10 vector. Batch normalization is used for normalization, the batch size is 64, the number of multi-head attention is 8, and the forward feedback network consists of two fully connected layers connected by the ReLU activation function. The ReLU formula is as follows:
[0070] ReLU(x)=max(0,x);
[0071] In step (2), the K nearest neighbors of the sample to be tested are first found according to the Euclidean distance, and the number of nearest neighbors K is 3. Then the similarity between the samples is calculated, and the similarity is normalized to obtain the attention coefficient. Then, the weight of each neighbor to the sample to be tested is calculated through the attention mechanism. Finally, the weighted result is calculated according to the weight, and the category of the sample to be tested is determined according to the weighted result.
[0072] The solution is to find the relationship between the sample to be tested x and each neighbor x i The Euclidean distance formula between is as follows:
[0073]
[0074] Where: f j is the feature of j samples, and n is the total number of features.
[0075] The formula for calculating the similarity between samples is:
[0076] Similarity(x i ,x)=Q T K i ;
[0077] Where: Q is the query matrix and K is the key value matrix.
[0078] The expression for the attention coefficient is:
[0079] s i =softmax(Similarity(x i ,x));
[0080] Where: s i is the normalized attention coefficient.
[0081] The expression for attention weight is:
[0082]
[0083] Where: α i is the sample to be tested x and each neighbor x i The weight between
[0084] The expression for the weighted result is:
[0085]
[0086] Where: V is the calculated weighted voting result, l i is the category of the i-th neighbor.
[0087] The expression for finding the category of the sample to be tested is as follows:
[0088]
[0089] Where: is the category label of sample x.
[0090] Furthermore, the loss function designed for the characteristics of fuel system fault data in step 4 is constructed as follows:
[0091]
[0092] Where: Y i,j Represents the similarity label between two samples, α i,j It represents the penalty coefficient when samples i and j belong to different fault types. is the similarity loss, To penalize the loss, when two samples belong to different categories, if the network outputs R i,j If the value is not close to zero, a larger α is assigned i,j Values are used to increase the loss value during training, forcing the model to more accurately learn subtle differences between pairs of samples with similar categories.
[0093] The fault label in step 1 in step 5 is the expected output of the diagnostic model, and the label setting results are: normal state (F1), supercharger fault (F2), injection advance (F3), injection delay (F4), cooler fault (F5), injector wear (F6), and fuel supply pipe blockage (F7).
[0094] In view of the shortcomings and needs of existing fault diagnosis methods, the present invention proposes a small sample ship fuel system fault diagnosis method based on the combination of twin Transformer and improved K-nearest neighbor classifier. The Transformer encoder is used as a subnetwork of the twin network to construct a new twin network, and the collected thermal parameters of the fuel system are input into the above twin network. The global multi-scale features of the fault data are extracted through the twin Transformer encoder network, and the improved K-nearest neighbor classifier is used to output the diagnosis results based on the extracted features. At the same time, a new loss function is designed to train the model, thereby achieving accurate classification of fuel system faults under small samples.
Claims
1. A method for diagnosing a small sample ship fuel system fault, characterized in that The following steps are involved: Step 1: Collect the thermal parameters of the fuel system under normal conditions and various fault conditions, pre-process the parameters and add fault labels accordingly to form a sample set; Step 2: Normalize the sample set to eliminate the dimension effect; Step 3: Build a ship fuel system fault diagnosis model, extract global multi-scale features through the twin Transformer encoder network, use the improved K-nearest neighbor classifier to classify faults, and output the final diagnosis results; Step 4: Establish a loss function based on the characteristics of fuel system fault data, use the normalized sample set as the input of the model, and the fault label corresponding to the parameter as the expected output of the model. Combined with the loss function, the twin Transformer encoder network is trained to obtain the optimal parameters of the model using the loss function. Step 5: Collect the thermal parameters of the current fuel system, construct the test samples through the methods in steps 1 and 2, input the test samples into the diagnostic model trained in step 4, and obtain the fault diagnosis results of the current fuel system.
2. A method for diagnosing a small sample ship fuel system fault according to claim 1, characterized in that: In step one, the fault status types include supercharger fault, early injection, delayed injection, cooler fault, injector wear, and fuel supply pipe blockage fault; the thermal parameters include power, fuel consumption rate, maximum explosion pressure, mean effective pressure, compressor outlet pressure, compressor outlet temperature, intercooler exhaust temperature, cylinder exhaust temperature, intake manifold pressure, and exhaust manifold pressure.
3. A small sample ship fuel system fault diagnosis method according to claim 1 or 2, characterized in that: In step 1, 30 sets of parameters are collected for each fault state, and the parameters are preprocessed. Abnormal data are eliminated based on the Raida criterion, and the standard deviation s of each parameter is calculated according to the Bessel formula, which is defined as: Where n is the number of parameters, x i is the current parameter, is the parameter average value, if Then determine x i outliers and removed.
4. A method for diagnosing a small sample ship fuel system fault according to claim 1, characterized in that: In step 2, the normalization method used is maximum and minimum normalization, and the mathematical model is: Among them, X norm is the standardized data, X max is the maximum value in the original data, X min is the minimum value of the original data.
5. A method for diagnosing a small sample ship fuel system fault according to claim 1, characterized in that: In step 3, the twin Transformer encoder is used as a feature extractor, which is composed of two parameter-sharing Transformer encoders. The number of encoder stacks is 6, the input data is a 1×10 vector, batch normalization is used for normalization, the batch size is 64, the number of multi-head attention is 8, and the forward feedback network consists of two fully connected layers connected by the ReLU activation function, where: ReLU(x)=max(0,x).
6. A method for diagnosing a small sample ship fuel system fault according to claim 1, characterized in that: In step 3, the improvement of the K-nearest neighbor classifier includes the following steps: Step 1: Find the K nearest neighbors of the sample to be tested according to the Euclidean distance, where K is 3, then calculate the similarity between the samples, and normalize the similarity to obtain the attention coefficient; Step 2: Calculate the weight of each neighbor to the sample to be tested through the attention mechanism, calculate the weighted result according to the weight, and determine the category of the sample to be tested according to the weighted result to obtain the improved KNN classifier.
7. A method for diagnosing a small sample ship fuel system fault according to claim 6, characterized in that: In step 1, the sample to be tested x and each of its neighbors x i The expression of the Euclidean distance between is: In the formula, f j is the feature of j samples, and n is the total number of features; The formula for calculating the similarity between samples is: Similarity(x i ,x)=Q T K i ; In the formula, Q is the query matrix and K is the key value matrix; The expression of the attention coefficient is: s i =softmax(Similarity(x i ,x)); In the formula, s i is the normalized attention coefficient.
8. A method for diagnosing a small sample ship fuel system fault according to claim 6, characterized in that: In step 2, the expression of attention weight is: In the formula, α i is the sample to be tested x and each neighbor x i The weight between The expression of the weighted result is: Where V is the calculated weighted voting result, l i is the category of the i-th neighbor; The expression of the sample category to be tested is as follows: In the formula, is the category label of sample x.
9. A method for diagnosing a small sample ship fuel system fault according to claim 1, characterized in that: In step 4, the mathematical model of the loss function designed for the characteristics of fuel system fault data is: Where Y i,j Represents the similarity label between two samples, α i,j represents the penalty coefficient when samples i and j belong to different fault types, is the similarity loss, To punish losses.
10. A method for diagnosing a small sample ship fuel system fault according to claim 1, characterized in that: In step five, the fault label in step one is used as the expected output of the diagnostic model, and the label setting results include normal state F1, supercharger fault F2, injection advance F3, injection lag F4, cooler fault F5, injector wear F6, and fuel supply pipe blockage F7.
Citation Information
Patent Citations
Ship fuel oil system fault diagnosis method
CN100552208C
Fault Diagnosis Method of Diesel Engine Fuel System Based on Least Squares Support Vector Machine
CN105319071B