Data-driven predictive maintenance method for digital welding machines

ABSTRACT Digital welding machine (DWM) is an advanced tool for material forming. The lifespan and health status of DWMs are closely related to the safety and reliability. To address the problem of low accuracy in the lifespan prediction of DWMs, a model based on immune algorithm (IA) and long short-term memory network (LSTM) with attention mechanism is proposed. First, the degradation characteristic indicators of the lifespan of DWMs are evaluated and selected. Then, a health index is constructed using linear regression to quantitatively reflect the lifespan status of DWMs. The optimized model is used to predict the remaining lifespan, and compared with various models using 5 indicators. Finally, predictive maintenance of DWMs is carried out based on product inspection and production scheduling. the optimal solution for the objective function is obtained to calculate the best predictive maintenance method for the digital welding machine.During the lifespan prediction process, the optimized model has a 20% decrease in root mean square error and a 35.8% decrease in mean square error compared to the traditional LSTM model. The average absolute error is decreased by 14.2% and the average absolute percentage error is closer to 0, while the coefficient of determination increases by 23%. By combining with actual production line arrangements, maintenance of DWMs can be performed at the most appropriate time to minimize maintenance costs.


INTRODUCTION
In recent years, digital welding machines have become an important welding tool in the field of material forming [1,2].The ship digital welding system communicates with the digital welder through a network communication module, and real-time collects welding production-related data and analysis results to achieve digital control of the welder.As the complexity of the digital welding system increases, the requirements for the reliability and stability of the digital welder are also increasing.Predictive management of the remaining service life of the digital welder has also received attention [3].During the welding process, the health status of the digital welder is affected by many factors such as power supply voltage, welding process, and workpiece surface condition [4][5][6], and equipment failure of the digital welder can affect the ship's production schedule and increase production costs.Therefore, predicting the remaining service life of the digital welder and regularly maintaining it can effectively reduce the risk of equipment damage and downtime.
As the device systems become increasingly complex, the requirement for device stability also increases, so the importance of predictive maintenance for devices is self-evident.At present, there are three main methods for predictive maintenance of equipment: prediction based on reliability statistical probability, prediction based on physical model, and prediction based on data-driven method.
The prediction method based on reliability statistical probability analyzes historical fault information to predict equipment failure rate based on probability [7].This method does not require a lot of research on device systems and data collection during operation.Through long-term reliability experiments, the corresponding probability functions are constructed.The probability of equipment failure conforms to the "bathtub curve".In the initial operating stage, the device components may have run-in and assembly errors, and the equipment failure rate may be relatively high.However, after running for a period of time, the equipment failure rate will decrease and become stable for a period of time.As the device usage time increases, the components in the device will gradually age, which may cause the failure rate to rise again.The prediction method based on reliability statistical probability mainly includes Bayesian method, Hidden Markov Model (HMM), and fuzzy prediction, etc. Kang et al. [8] combined the characteristics of ground-penetrating radar and proposed a pre-processing method for observation data based on fuzzy evaluation, and established an initial fuzzy evaluation method based on expert knowledge.By combining fuzzy logic and expert knowledge, overfitting of data under limited conditions was avoided, and the prediction accuracy of the ground-penetrating radar model was effectively improved.Ma et al. [9] proposed using the gray Markov combination model to predict the interval between equipment failures for weapons and equipment, which is a difficult task.YANG et al. [10] used the Bayesian algorithm to update historical records and equipment status evaluation results in real-time, constructed the degradation degree index of the equipment, calculated the remaining service life of the equipment based on the degradation model, and then established the objective function of the remaining service life probability density function and expected loss rate to obtain the optimal predictive maintenance strategy.The method based on reliability statistical probability is suitable for simple equipment but not for expensive equipment that contains thousands of parts, as it is difficult to carry out large-scale experiments and statistics.This method is relatively simple and easy to operate, but lacks consideration of environmental factors during operation, resulting in lower accuracy and no learning and memory capability to predict equipment service life.
The prediction method based on physical models uses mathematical formulas and physical models to study the physical behaviors that occur during equipment degradation processes.Typically, nonlinear equations, differential equations, state-space models, and other methods are used to solve them.The physical model-based life prediction method provides a more accurate tool for predicting applications, calculating the remaining service life of equipment through formulas, and predicting performance more accurately.YU et al. [11] proposed a residual service life prediction model based on pressure, assuming that the bearing life can be represented by the bearing geometry and simple Hertz loads.In comparison with the Lundberg and Palmgren (LP) or Loonnides-Harris (IH) models in a large number of practical applications, the accuracy of the pressure-based prediction model is significantly superior to the LP and IH models.Bolander et al. [12] believes that crack detection is a fusion of vibration sensors and online debris sensors, and the crack size can be determined by the number of bearing fragments.Using sub-scale propagation tests to test operating speeds, the particle filtering method is used to track crack propagation rates.Based on future operating conditions and the time when the crack size exceeds the failure threshold, a predicted bearing crack extension model is established, which can accurately predict the crack propagation rate and improve its prediction accuracy and confidence.Tao et al. [13] based on multibody dynamics and linear elastic fracture mechanics theory, obtained data on the armored vehicle body through virtual physical model testing experiments, and predicted the remaining service life of the armored vehicle body by combining crack shape and material fracture shape.Lei et al. [14] proposed a model-based residual service life prediction method, constructing a weighted minimum error health indicator through multiple feature information, reflecting the equipment's degradation process, and using the maximum likelihood estimation algorithm to initialize the model parameters and predict the remaining service life using the particle filtering algorithm.The prediction method based on physical models does not require a large amount of data collection, but it also has shortcomings.Lack of knowledge about the physical system is one of the important reasons that affect the accuracy of model life prediction.The difficulty of equipment analysis is proportional to the complexity of the model.It is usually difficult to establish an accurate physical failure model, and the constructed physical model has a large error compared with the real failure mechanism.Therefore, the prediction method based on physical models is only applicable to certain specific machine equipment and cannot be widely promoted and applied.
A data-driven prediction method based on sensor technology obtains the historical operational data of equipment from sensors, extracts feature indicators that can represent the trend of equipment feature changes from a large amount of data through signal processing, and trains a prediction model for sensor-collected data using artificial intelligence algorithms such as Deep Neural Networks (DNNs), Support Vector Regression (SVR), and other methods.Khelif et al. [15] proposed a rule-based prediction method based on instance learning.The model uses historical data to describe the health status of the equipment and builds a health indicator library.By developing a new similarity measure method to enhance the retrieval step based on sample learning, the accuracy of data prediction is improved.Tian [16] takes the time of checkpoint and monitoring measurement value as input variables, and the percentage of remaining life as output.The failure history of each state monitoring measurement sequence is fitted by the Weibull failure rate function, and the fitted measurement value is used as the training set of the neural network.A validation mechanism is introduced to improve the prediction performance.Loutas et al. [17] proposed a data-driven method for estimating the remaining service life of rolling bearings based on support vector regression.The key faults that occur in each test are located, and critical operation thresholds are established.Multiple statistical features are extracted through wavelet transform, and their diagnostic performance is evaluated.The SVR model is trained and tested to predict invisible data according to the rules.Babu et al. [18] proposed a rule regression estimation method based on deep convolutional neural networks.This method can not only obtain complex relationships between data and rules, but also solve the problem of automatic learning.Lei et al. [19] extracts feature vectors through the spectral principal energy vector, which can characterize the attenuation of bearing vibration signals with usage time.The discontinuity problem found in the prediction results is handled by a smoothing method.The remaining service life of the bearing is predicted using a deep convolutional neural network method.Wang et al. [20] proposed a method for predicting the remaining service life of equipment by combining deep convolutional autoencoder and convolutional neural network.The health indicators of rolling bearings are constructed by combining DCAE and self-organizing mapping network, which can effectively characterize the degradation status of bearings.The method for predicting the remaining service life can accurately predict the degradation trend of bearings.Due to the occurrence of noise in sensors, which leads to data anomaly problems, Gugulothu et al. [21] proposed an embedded remaining service life prediction model, which uses a sequence model based on recursive neural networks to generate embeddings of multivariate time series.The model does not rely on the degradation trend hypothesis and is robust to noise.LEE et al. [22] proposed a data-driven prediction method for liquid filtration systems.Based on bidirectional LSTM, the HI value from the beginning to the end of the service life of mechanical systems is predicted, and the remaining service life of liquid mechanical equipment is obtained.Mohamed SAYAH et al. [23] proposed a remaining service life prediction framework based on the Deep LSTM architecture.Compared with the original LSTM model, this framework can obtain the reliability of remaining service life prediction in the trained LSTM model and ensure better quality.
Compared with physically-based methods for predicting lifespan, data-driven methods do not require comprehensive knowledge of the physical system and related expertise to build models.Data-driven methods are easier to implement for remaining lifespan prediction, but require comprehensive analysis and mining of equipment data to obtain feature information on equipment health status and performance degradation.However, due to the lack of consideration of actual physical characteristics and differences of equipment, there are problems such as insufficient prediction accuracy and poor adaptability.The results show that the proposed model improves the prediction accuracy of the remaining useful life of the digital welding machines.The main contributions of this article are as follows: (1) The IA algorithm was used to optimize the number of hidden units and learning rate in the LSTM model to obtain the optimal hyperparameters.
(2) The LSTM model has good time series fitting regression ability and introduces an attention mechanism to allocate weights to the information output by the LSTM model.By conducting comparative experiments with ARIMA, RNN, and LSTM, it is proven that the model used in this paper has better predictive performance.
(3) Predictive maintenance of digital welding machines is carried out with the lowest cost by combining production scheduling and product quality inspection.

MATERIALS AND METHODS
To evaluate the operating status and performance degradation trend of the shipyard's digital welding machine, the signal of the digital welding machine was extracted and reprocessed to obtain effective candidate feature indicators for performance degradation.In this section, data preprocessing and feature selection were performed on the shipyard's digital welding machine data.

Feature extraction
Different feature indicators in digital welding machines respond differently to performance degradation, and some feature indicators are not sensitive to performance degradation.Choosing insensitive feature parameters may reduce the accuracy of remaining useful life prediction.In order to improve the performance of the prediction model, more sensitive feature indicators in response to the performance degradation process are selected as inputs for the remaining useful life prediction model.
Each digital welding machine collects 28 feature indicators at each time point.Analyzing these 28 feature indicators not only increases the difficulty of data computation, but also excessive data features can lead to overfitting and lack of generalization ability for new data.Principal component analysis is used to reduce the dimensionality of the feature indicators of the digital welding machine, mapping multidimensional data to a lower-dimensional space, projecting the maximum amount of information to the expected dimensionality, and selecting more representative feature indicators.
For the feature indicators with different dimensions, the data of each feature indicator is mapped to [0,1].At the same time, in order to ensure that the output range of the remaining service life prediction method is between 0 and 1, during the training phase of the prediction model, a linear function is used to normalize the output of each stage to [0,1].

Remaining useful Life estimation
The degradation of the performance of a digital welding machine is a continuous and slow process, and cannot be directly used as a health index (HI) based on the feature indicators.The operating limit condition of the shipyard's digital welding machine can be considered as two situations: the equipment is operating normally, and the output value of the remaining service life is 1; the equipment is damaged and stopped, and the output value of the remaining service life is 0. Linear regression can be used to transform the features into health index values, and then use the health index values to predict the remaining service life of the welding machine through the prediction model.
In the experiment, it was found that although all the predicted values of the logistic regression model were between 0 and 1, which met the data distribution of the remaining service life of the ship's digital welder, the logistic regression model also had certain deficiencies.When the value is close to 0 or 1, the curve is flat, resulting in a small impact on the remaining life of the digital welder when the variable changes in the beginning and end intervals.To avoid large prediction errors, a linear regression model was used for performance evaluation.
In this paragraph, (x 1, x 2 x 3 .......... x n ) is an n-dimensional dataset, h(x) represents the remaining service life of the digital welding machine, θ 0 is the regression constant, b is the noise term, and θ 0 = θ 1 , θ 2 , θ 3 ............. θ n ] is the regression term.By using the least squares method, θ 0 and θ can be solved, and a linear regression equation can be established.The data training for linear regression is obtained from the healthy and near-scrap states of the digital welding machine, and 1 and 0 are used as the outputs for the remaining service life of the digital welding machine.

Predictive maintenance method
Building on the remaining useful life prediction discussed earlier, this chapter establishes a new maintenance decision-making model for digital welding machines based on their failure risk and maintenance costs.A maintenance cost objective function is constructed, with the aim of minimizing it.The predictive maintenance method for digital welding machines mainly involves three stages.The first stage is to predict the remaining useful life of the equipment.The second stage is to calculate the failure probability and maintenance cost.The third stage is to execute the optimized maintenance strategy.
There are three methods for predictive maintenance of digital welding machines.The first is minimal maintenance, which aims to restore the machine or its components to their pre-failure working state.The failure rate before and after maintenance remains the same, meaning the post-maintenance instantaneous failure rate is equal to the pre-maintenance rate.The second method is perfect maintenance, which aims to restore the performance-degraded digital welding machine to its original state, such as through major repairs or equipment replacement.The third method is imperfect repair, which aims to reduce the failure rate of the digital welding machine after maintenance to a lower level than before but not to its original state.It falls between minimal maintenance and perfect maintenance.As shown in Figure 1, the remaining useful life does not change after minimal maintenance; perfect maintenance is performed after reaching the usage threshold, and the digital welding machine is restored to its original state.For imperfect repair, maintenance is performed after reaching the maintenance threshold, and the remaining useful life is improved to a certain extent, but not to its initial state.The subsequent maintenance interval is gradually shortened.

AN IA-ATTENTION-LSTM MODEL FOR LIFE PREDICTION
Based on the LSTM network model, this article proposes an IA-Attention-LSTM model for predicting remaining service life.The IA-Attention-LSTM model is constructed from the following aspects, and the overall structure is shown in Figure 2.

LSTM
Due to their excellent function approximation properties, neural networks can represent any nonlinear and linear relationships, thereby expanding the scale and adaptive capabilities of data processing.The LSTM model is a special type of RNN model that optimizes the system structure through forget gates, input gates, and output gates, alleviating the problems of gradient disappearance and explosion during long sequence training.These three gate structures selectively add or remove information and allow information to pass selectively.Here, f t , i t , c ∼ t , and o t are used to represent the three gate structures and the neural cell state corresponding to time, as shown in Figure 3.
The forget gate mainly controls the degree to which the current input x t and the output h t-1 of the previous hidden layer are forgotten, determining the amount of information transmitted.Since non-important information during the training process of the digital welding machine's remaining service life prediction can affect the prediction results, the previous LSTM neuron's hidden layer result h t-1 is integrated with the current x t data, and the forget gate determines whether the data needs to be forgotten.The integrated data is passed through the Sigmoid function, and the Sigmoid output result is 0, indicating that the previous hidden layer and the input layer data at this time have little influence on subsequent data, and the information of the previous data will be forgotten.If the output result is 1, it means the opposite.The specific expression is as follows: In this paragraph, x t represents the input data at time t, h t-1 represents the data from the previous hidden layer, W f is a matrix that adjusts it to the same dimensions as the hidden layer at time t, and b f is the bias term.
The input gate primarily controls the degree to which the current input x t and the current computation update the memory cell.The function of the input gate is to expand the total capacity of the memory, allowing the memory to be continuously updated.
The left pathway of the input gate is the input influence factor, which integrates the previous hidden layer and the current input layer to obtain the value i t through the input influence factor.If i t is 0, it means that the influence of input data c ∼ t on the data c t is relatively low.The right pathway of the input gate is the activation function of the input gate.The function of tanh is to compress the values of the input and distribute them within [-1, 1] to adjust the network, centralize the data, and increase its convergence speed.The specific expression is as follows: The output gate is used to determine the value of the next hidden state, and the network determines the size of the output value through a Sigmoid function.Specifically:

Attention-LSTM
A single LSTM model converts the input sequence into a fixed-length vector and retains all the information, but it cannot detect which parts are important for the current travel time, which reduces the utilization of information.The addition of Attention mechanism can solve this problem by allocating different attention to the model.The feature attention performs pooling operations on the input parameters in the time dimension, ignoring some time sequence information, and mainly focuses on the parameter features of the input parameters.It assigns weights to various parameter features, allowing the model to automatically process the importance of different information.
As shown in Figure 4, the attention model is placed at the output of the LSTM in the attention LSTM framework, and the time series X t-1 , X t-2 , . . . .X t is used as the input of the intermediate states obtained through the forget gate, input gate, and output gate of the LSTM framework.Then, each intermediate state is used as the input of the attention model, and the corresponding weight of each intermediate state is obtained through the corresponding dimension transformation and fully connected layer processing in the attention model.Finally, by multiplying each calculated weight by its corresponding intermediate state, the corresponding feature vector can be obtained, and the predicted result is obtained through the output of the softmax layer.
In the prediction of the remaining service life of digital welding machines, the intermediate states of the LSTM layer determine the impact of the output state on the prediction results, and then provide the corresponding weights.The scoring function e t calculates the importance of the output state.The higher the importance, the higher the value obtained, which is expressed as follows: The feature vector is obtained by weighting, and then the prediction for the next time step is calculated as follows:

IA-Attention-LSTM
The immune algorithm mainly seeks the optimal solution through specific evolutionary processes in the biological immune system.This paper chooses two hyperparameters that have a significant impact on the Attention-LSTM module, namely the number of neurons in the LSTM hidden layer and the learning rate.
(1) Set the parameters of the IA algorithm, including the number of immune individuals, the maximum number of immune generations, and the mutation probability.
(2) Calculate the affinity aff, the calculation formula is as follows: ( ) In the above paragraph, N is the number of samples, while ŷ i and y i are the predicted value and true value of the remaining service life of the welding machine, respectively.
(3) Memory cell differentiation: Antibodies with the highest affinity to antigens are added to the memory cell.
(4) Select two antibodies, mutate them according to a certain mutation probability, and then cross them to obtain new antibodies.
(5) Determine whether the algorithm meets the termination iteration conditions.If the maximum number of iterations is reached, return the optimal hyperparameters of the model; otherwise, repeat step (3) to continue execution until the optimal value is obtained.
This paper is based on the IA-Attention-LSTM model to predict the remaining service life of digital welding machines.The process of optimizing the parameters of the IA-Attention-LSTM model is as follows: Step 1: Preprocess the key features of the digital welding machine, construct the remaining service life dataset of the digital welding machine as the input data for the prediction model, and use 75% of the data set as the training set.
Step 2: Based on the training data output from Step 1, construct the IA-Attention-LSTM model, and use the immune algorithm to optimize the model's hyperparameters.The attention mechanism retains important information in the data, suppresses unnecessary information, and improves the performance of the model.
Step 3: Calculate the deviation between the predicted curve of the remaining service life of the IA-Attention-LSTM model and the actual life curve, and use the evaluation index to compare the model.

CONSTRUCTION OF PREDICTIVE MAINTENANCE MODEL
By conducting proper maintenance, we can greatly improve the reliability of machining equipment, especially for critical components.However, for safety reasons, we usually suspend the operation of the equipment until the maintenance task is completed before resuming normal operation and continuing with production tasks.In many cases, completing maintenance tasks will consume the machine's working time, which will slow down the production process.However, without timely maintenance, machine failure is almost inevitable, which will lead to frequent breakdowns, slow operation, increased costs, and even pose a safety risk.Therefore, it is necessary to optimize the maintenance of equipment or critical components.
Based on the remaining useful life prediction introduced in the previous sections, this chapter establishes a new maintenance decision-making model.By considering the failure risk and maintenance cost of the digital welding machine, a maintenance cost objective function is constructed, which aims to minimize the objective function.The predictive maintenance method for digital welding machines is mainly divided into three stages.The first stage predicts the remaining useful life of the equipment, the second stage evaluates the probability of failure and the corresponding repair costs, and the third stage is to adopt the optimal maintenance plan.

Basic assumptions and symbols
Assumption 1: All historical data from the start of operation to failure is recorded for each digital welding machine in the shipyard.
Assumption 2: The start-up time of the digital welding machine is negligible.
Assumption 3: The historical data for each digital welding machine in the shipyard is representative and not subject to any intentional damage.Assumption 4: When maintenance is performed on a digital welding machine, the machine stops recording data, and the equipment cannot be operated.Assumption 5: Any failure of the digital welding machine or key components can be immediately detected.
Assumption 6: The operating conditions of the digital welding machine are fixed, and the initial reliability of the equipment is 1.
Assumption 7: The degradation process of the digital welding machine is represented by a degradation function, and after maintenance, the component begins a new degradation process, with the maintenance interval being the maintenance cycle.
The symbols used in the formulas in this article are defined in Table 1.

Joint optimization model based on product inspection and production scheduling
As the operating time of the digital welding machine increases, the equipment's operating status declines linearly, and the maintenance cost also increases.Adopting imperfect repair for maintenance of the digital welding machine will not significantly improve the reliability of the equipment's key components.Based on the situation of imperfect repair, a function of cost and number of repairs is constructed to evaluate the maintenance cost of preventive maintenance for the digital welding machine, with the basic formula shown as follows: Among them, CP i is the i-th preventive maintenance cost, CR is the replacement cost, T i is the i-th preventive maintenance period, τ i is the i-th preventive maintenance time, r ct is the maintenance cost per unit time.As shown in the Figure 5, as the number of preventive maintenance increases, r ct first decreases and then increases.The inflection point of the r ct function is the inflection point of the preventive maintenance cost, so this point is the best replacement time for perfect maintenance.At this time, perfect maintenance is a more reasonable and economical choice.
Due to imperfect repairs, the equipment cannot reach a new state after repair.After multiple imperfect repairs, a perfect repair is performed to make the digital welder as good as new.The predicted maintenance of the digital welder is shown in Figure 6, and the change in equipment reliability throughout the predictive maintenance process is shown in Figure 7.   Step 1: Develop a production plan for the digital welder and proceed with normal production.
Step 2: Predict the equipment reliability.
Step 3: Compare the current reliability R i (t) with the reliability threshold R f .If R i (t) is less than the threshold R f , proceed to step 4, otherwise go back to step 1.
Step 4: Calculate the maintenance cost per unit time to determine if it is the minimum value r ct .If it is not the minimum, proceed to step 5, otherwise go to step 6.
Step 5: After performing perfect repair on the digital welder, the reliability is restored to 1, and return to step 1 until all production plans are completed.
Step 6: After performing imperfect repairs on the digital welder, also return to step 1 until all work is completed.
After all welding work is completed, the total cost of predictive maintenance for digital welding machines consists of several components: total production value, total production cost, minimum maintenance cost, imperfect predictive maintenance cost, perfect predictive maintenance cost, product quality inspection and rework cost, and delivery delay penalty cost.

C pv np
pv m represents the hourly production value of product m, pc m represents the hourly production cost of product m, ct represents the completion time of one product m, and np represents the number of products m produced.C tv represents the total production value, and C tc represents the total production cost.
Before the digital welding machine completes the operation m, it is necessary to determine whether maintenance is required for the equipment and which maintenance method to choose.The cost calculation methods for the three maintenance methods are different.The minimum maintenance does not change the service life and failure rate of the equipment, and only solves the problem of the equipment not working properly.The maintenance cost is equal to the number of maintenance times multiplied by the cost of a single maintenance.Perfect replacement involves comprehensive repair of the equipment to restore its service life to the initial state.The maintenance cost is equal to the number of maintenance times multiplied by the cost of a single maintenance.

C cs k p
Where cs represents the cost of minimum maintenance, k is the number of random failures, p is the probability of m product failing before completion, c 1 is the cost of minimum maintenance, cr is the cost of perfect repair, nr is the number of perfect repairs before m product operation, and c 2 is the cost of perfect maintenance.
To calculate the maintenance cost for imperfect maintenance, we first need to calculate the remaining service life and failure rate of the digital welding machine before and after each maintenance, and convert them into reliability.By introducing the age reduction factor and failure rate increase factor, we construct the failure rate function of the digital welding machine.
For the calculation of maintenance cost for imperfect maintenance, it is necessary to first calculate the remaining service life and failure rate of the digital welding machine before and after each maintenance, and convert them into reliability.The age-decreasing factor and failure rate-increasing factor are introduced to construct the failure rate function of the digital welding machine: where a i is the age-decreasing factor of the equipment's remaining service life, 0 < a 1 ≤ a 2 ≤ . . .≤ a i ≤ . . .<1, due to imperfect maintenance, each maintenance state is less than the previous state.0 < b 1 ≤ b 2 ≤ . . .≤ b i , after each imperfect maintenance, the maintenance cycle for the next time is shorter than the previous one.
According to the theoretical relationship between failure function and reliability, the reliability of digital welding machine is as follows:

R t b t a T dt
Where t' is the time variable used in reliability calculations.When the reliability of the digital welding machine reaches the threshold value, maintenance is performed, and the reliability of the component at the end of the current preventive maintenance period can be inferred from this.

R b t aT dt
Take the logarithm of the threshold value R f : Translation: The formula shows the relationship between the failure rate function, reliability threshold, and preventive maintenance cycle of the digital welder.For imperfect maintenance, the total cost is the function of the state before and after each maintenance multiplied by the single maintenance cost.
Considering that the digital welder works for a long time, which leads to a decline in its performance, maintenance is required.However, as the number of preventive maintenance increases, the time and cost of preventive maintenance also increase proportionally.The expression for the time and cost of each preventive maintenance is shown below: The variable c i represents the time factor for the i-th preventive maintenance in the equation.d i is the cost factor for the i-th preventive maintenance.c i and d i are greater than 1, and the functions for preventive maintenance time and cost are increasing functions.The total delay time for delivery is given by: Where t r is the replacement time for perfect maintenance, t s is the replacement time for minimal maintenance, τ i is the time for the i-th imperfect predictive maintenance, t rp is the time for reworking defective products, c p is the penalty cost per unit time for delay, and C 5 is the penalty cost for delivery delay.Product quality is closely related to the production status of digital welding machines, and the reasons for the failure of digital welding machines may include: (1) sudden situations causing the equipment to stop working; (2) gradual faults due to the degradation of the equipment's performance, resulting in lower quality products.Therefore, product quality is also an important indicator for evaluating predictive maintenance of equipment.By detecting product quality, the state of the production equipment can be determined.When the pass rate of the sampled products is high, it indicates that the current working state of the digital welding machine is good; when the pass rate of the sampled products is low, it indicates that the working state of the digital welding machine is unstable, and the equipment needs to be maintained to ensure product quality and normal operation of the digital welding machine.
Product quality problems may be caused by accidental factors, operator errors, external interference, and material defects, all of which can affect product quality.For this type of quality problem, a Bernoulli random variable can be used to represent it.The probability of quality problems before and after are not related, and the probability of the previous and next defective products is the same.However, as the working time changes, the performance of the digital welding machine degrades, and the pass rate of the products will also change accordingly.If the fixed sampling cost of the digital welding machine during the production process of product m is C f , and the unit sampling cost is C v , then the sampling cost of the digital welding machine in completing the operation process of product m is: Where n is the sample size and sn m is the number of sampling times in the predictive maintenance process of product m.Assuming that the quality of the product follows an S-shaped decay model over time.
Based on the analysis above, construct the objective function to maximize the total profit of the digital welder after maintenance: T i > 0 (31)

Case study and data selection
To verify the performance of the proposed IA-Attention-LSTM prediction model, this paper uses the working data of two digital welding machines in Hudong Zhonghua Shipyard from July 2020 to April 2021.The collected data communication of the digital welding machine includes 28 pieces of information such as the ID number of the collection machine, the time of the data, the actual current, the actual voltage, the wire feeding speed, the given voltage, the wire diameter, the protective material and gas, the maximum and minimum current values and voltage values, etc.The original data all come from the real data of the factory, so the data will be affected by external factors and there may be missing data and noise.To ensure the accuracy of the experiment and erroneous data, linear interpolation is used to fill the data.This paper selects a total of 300 hours of data from July 1, 2020 to April 26, 2021, and collects the sensor data of the digital welding machine at 10:00 am every hour.The first 75% of the data are used as the training set, with a total of 225 data points for training, and the remaining 25% are used as the test set.

Data processing
The first step is to perform dimensionality reduction on the 28 data features transmitted by the digital welder.
The PCA method is used to reduce the 28 data features to 5 dimensions of data, which are wire feeding speed, given voltage, given current, actual voltage, and actual current.The given current is subtracted from the actual current, and the given voltage is subtracted from the actual voltage to determine the input end of 4 variables: time, wire feeding speed, voltage difference, and current difference.asTable 2 shows.
To ensure the stability and speed of model training, data normalization is performed, and the specific formula is as follows: In the formula, P represents the sensor data before normalization, P represents the processed data, and P max and p min represent the maximum and minimum values of the sensor data, respectively.
In the immune algorithm optimization, the number of immune individuals is 20, the maximum number of immune generations is 100, and the mutation probability is 0.2.
Assuming that the failure of the digital welding equipment follows the Weibull distribution, the failure function expression in a preventive maintenance cycle is as follows: where the shape parameter P is 1.5, the scale parameter η is 100 hours, the cost of minimum maintenance per occurrence is 500 yuan, the minimum maintenance time is 10 hours, the cost of perfect repair per occurrence is 2000 yuan, the time required for perfect repair is 20 hours, the reliability threshold of the digital welder is 0.4, and maintenance is required when the reliability of the digital welder falls below the threshold.
For the time and cost factors in imperfect maintenance, to facilitate calculation, we set c i to 1.1 and d i to 1.2, which represent that the next imperfect preventive maintenance time is 1.1 times the previous one and the maintenance cost is 1.2 times the previous one.
The factors of decreasing service life and increasing failure rate in imperfect maintenance are not fixed due to the varying degrees of maintenance each time.Therefore, they are linearly related, with k equal to 1 and h equal to 0.1.Since the digital welding equipment often produces defective products after equipment failures during the production process, the probability of minimum maintenance is set to be the same as the probability of producing defective products.For the quality testing of the products in the digital welder, sampling inspection is required, and the fixed cost of sampling inspection is set to be 1000 yuan, with a unit sampling cost of 200 yuan.
Assuming that the digital welder has three types of products that need to be welded, namely A, B, and C. Since the digital welder produces three types of products, there are six production plans, and the predictive maintenance time and total cost of each plan are different.The basic information of products A, B, and C are shown in Table 3.

Evaluation metrics
This paper selects 5 widely used evaluation metrics in reality, including Root Mean Square Error (RMSE), Mean Square Error (MSE), Mean Absolute Error (MAE), Mean Absolute Percentage Error (MAPE), and Coefficient of Determination (R2), to quantitatively evaluate the performance of the model.Among them, RMSE is used to measure the absolute error between predicted values and actual values, MAPE reflects the relative size of the error between predicted values and actual values, MAE reflects the average absolute error between predicted values and actual values, and MSE represents the degree of fit between predicted values and true values.The smaller the values of the four above-mentioned indicators, the higher the prediction accuracy.R2 reflects the degree of model fitting.The closer the value is to 1, the better the predictive fit of the model.The specific formulas are as follows: Where: N is the length of the predicted data; ŷ ={ ŷ 1 , ŷ 2 , . . ., ŷ n } is the predicted value of the remaining life of the digital welding machine at any time n; y = { y 1 , y 2 , . . ., y n } is the true value of the remaining life of the digital welding machine at the corresponding time, and yis the mean value of the true value.

Performance prediction degradation analysis
Based on the working conditions of the two shipyard digital welding machines obtained above as the dataset, the remaining service life of the first 225 hours is predicted for the remaining 75 hours.This paper compares  the time series ARIMA, RNN, LSTM, Attention-LSTM, and IA-Attention-LSTM.Figures 8 and 9 respectively show the predicted curves and actual data comparison of the four methods for the two digital welding machines.Figures 7 and 8 show the absolute error curves of the four methods for the two digital welding machines.The average values of the evaluation metrics of all models are shown in Table 4.
The MAPE of the ARIMA model and the RNN model in this paper's prediction model are greater than 100%, and there are significant problems with the prediction accuracy, especially in the large deviation between the predicted results and the actual values after a long time of data.
After introducing the attention mechanism and immune algorithm, the MSE of the IA-Attention-LSTM is 0.000115, which is 35.8%lowerthan the LSTM model; the MAE is 0.0090, which is 14.2%!lower than the LSTM model; the RMSE is 0.0107, which is 20%lower than the LSTM model.The smaller these three indicators, the higher the model accuracy.The MAPE is 3.73%and a MAPE value close to 0%indicates higher model quality, while a value close to 100%indicates poor quality.The R2 is 0.8925, and the larger the R2, the more suitable the model is for the dataset.
As shown in Figures 10 and 11, the prediction curves of the time series ARIMA, RNN, and LSTM models all exhibit a certain degree of deviation.In particular, the prediction results of the time series ARIMA and  RNN models have larger errors, and it can be clearly seen from the figures that the prediction curves deviate significantly.Although the early prediction results of the LSTM model fit well with the actual curve, the fitting effect is poor in the later stage.In contrast, the IA-Attention-LSTM model has a small overall error throughout the entire prediction phase, and the analysis in Table 4 shows that the proposed IA-Attention-LSTM prediction model performs the best on the test dataset and has good generalization ability.Through experimental comparison and validation, the IA-Attention-LSTM prediction model has better accuracy than other models.
Once the reliability of a critical component reaches a threshold, maintenance is performed on it.In the third preventive maintenance cycle, the cost-time ratio is minimal.The cost-time ratio of the fourth preventive maintenance cycle is greater than that of the third.Therefore, the cost-time ratio of the third preventive maintenance cycle is the turning point of the entire production process.It is economical to perform preventive maintenance on critical components after the third preventive maintenance cycle ends.Therefore, the critical components should be replaced at the end of the third preventive maintenance cycle.
Based on the particle swarm algorithm to solve the minimum objective function, basic parameters are set.This paper sets the population size to 100, and the learning factors C1 and C2 are both 2. The inertia weight is 2. The fitness function is fitness = min TC, and the number of iterations is 200.
As mentioned earlier, once the reliability of the digital welder reaches the threshold, maintenance is performed based on the information shown in Table 5.The cost of imperfect maintenance of the digital welder is high after the third preventive maintenance cycle, so perfect replacement is performed after the third preventive  maintenance cycle.Finally, the optimal production plan is obtained as BAC, with a minimum cost of 37,560 yuan.

CONCLUSIONS
This article is based on the long short-term memory (LSTM) network algorithm, which introduces immune algorithm and attention mechanism to optimize the LSTM network.The immune algorithm optimizes the number of hidden units and learning rate, and assigns the optimal hyperparameters obtained to the LSTM network algorithm.The attention mechanism assigns weights to the output of the LSTM network algorithm to obtain more accurate prediction results.In contrast to traditional predictive maintenance schemes that only consider the remaining service life of the digital welder, this article introduces production scheduling and product quality testing, considering processing costs, delivery delay penalties, and other factors during the operation of the digital welder.An optimization model is established to minimize the total cost and obtain the best maintenance decision.
However, this system still needs further improvement and refinement to improve its efficiency and reliability: (1) This article focuses on the digital welder as the object, and in future research, the research object can be expanded and supplemented, such as the predictive maintenance of equipment such as ship bearings, hydraulic devices, and power systems, to achieve predictive management of various different equipment in a single system.(2) The article's consideration of predictive maintenance decision-making is still not comprehensive enough, as the start-up time of the digital welder equipment is not taken into account.However, in actual production situations, the start-up time of some equipment cannot be ignored.The article establishes a joint optimization of predictive maintenance and production scheduling for single-machine production systems in the predictive maintenance system, without considering the operational impact among multiple devices.
This article takes two digital welding machines in Hudong-Zhonghua Shipbuilding Co., Ltd. as simulation examples, and compares the IA-Attention-LSTM model with ARIMA, RNN, and LSTM.Evaluation indicators including Root Mean Squared Error (RMSE), Mean Squared Error (MSE), Mean Absolute Error (MAE), Mean Absolute Percentage Error (MAPE), and the determination coefficient R2 are used to analyze the models.

Figure 1 :
Figure 1: Remaining service life of different maintenance methods.

Figure 2 :
Figure 2: The overall architecture diagram of the IA-LSTM-Attention model.
describes a formula:Where u and w are weighting factors, and b is the bias factor.The calculation expression for the weight a t of LSTM output value h t is as follows:

Figure 5 :
Figure 5: Relationship between maintenance cost per unit time and maintenance times.

Figure 7 :
Figure 7: Schematic diagram of remaining service life change of equipment during operation.

1 and
p d represents the probability of product quality issues, g and h represents the initial parameters restored by the system after maintenance of the digital welder.The cost of repairing product m is c m , the expression for the cost of rework during final product quality testing is C 4 .

Figure 9 :
Figure 9: Comparison chart of the predicted results and true values of the four models for welding machine 2.

Figure 8 :
Figure 8: Comparison chart of the predicted results and true values of the four models for welding machine 1.

Figure 10 :
Figure 10: Comparison charts of absolute errors for the four models of welding machine 1.

Figure 11 :
Figure 11: Comparison charts of absolute errors for the four models of welding machine 2.

Table 2 :
Key indicators information of digital welding machine.

Table 3 :
Basic product information.

Table 4 :
Evaluation indicators and models of different prediction models.

Table 5 :
Predictive Maintenance Best Practices.