Embedded Artificial Neuval Network-Based Real-Time Half-Wave Dynamic Resistance Estimation during the A . C . Resistance Spot Welding Process

Online monitoring of the instantaneous resistance variation during the A.C. resistance spot welding is of paramount importance for the weld quality control. On the basis of the welding transformer circuit model, a new method is proposed to measure the transformer primary-side signal for estimating the secondary-side resistance in each 1/4 cycle. The tailored computing system ensures that the measuring method possesses a real-time computational capacity with satisfying accuracy. Since the dynamic resistance cannot be represented via an explicit functionwith respect tomeasurable parameters from the primary side of thewelding transformer, an offline trained embedded artificial neural network (ANN) successfully realizes the real-time implicit function calculation or estimation. A DSP-based resistance spot welding monitoring system is developed to perform ANN computation. Experimental results indicate that the proposed method is applicable for measuring the dynamic resistance in single-phase, halfwave controlled rectifier circuits.


Introduction
The resistance spot welding (RSW) manufacturing process is one of the most widely used, inexpensive, and efficient material joining processes in the automobile industry.Although MFDC inverter has been proposed for RSW in recent years, Alternating Current (A.C.) spot welding maintains its predominant status in body-in-white (BiW) assembly due to its low-cost installation, sufficient use, and easy integration of the existing infrastructure.However, consistent quality of welds produced by A.C. RSW cannot be guaranteed due to a number of reasons including workpiece thickness and material ingredient variations, surface coatings, assembly structure, workpiece fit-up conditions, and complex electrode abrasion phenomena.Fortunately, the dynamic resistance during the welding process acts as an essential indicator to recognize the working conditions [1], reflect the nugget growth [2][3][4] and its geometry [5], identify welding splash [6], enhance the control performance [7], and represent the weld quality [8].It is, therefore, valuable to have an insight into the dynamics of nugget resistance during welding, and the dynamic resistance measurement is a key factor to success, especially in a real-time fashion [9].
The dynamic resistance can be obtained by measuring the welding current and electrode tip voltage.The measuring setup normally interferes with the movement of electrode and reduces the system reliability, which is not endurable in the automated welding production line.To avoid these constraints, Cho and Rhee [10,11] advocated that the dynamic resistance could be calculated according to a conversion model based on the primary side acquired current and voltage signal.The dynamic resistance is monitored in the primary circuit of the A.C. welding machine in each cycle, thus the required measuring apparatus will not interfere with the operation.However, this measuring method lacks the real-time ability due to the fact that the dynamic resistance is obtained each cycle where the control-oriented dynamic resistance measurement is desired in 1/4 cycle.This paper presents an embedded artificial neural network (ANN)-based approach for measuring the half-wave  dynamic resistance in 1/4 cycle at the primary side of the welding machine, which paves the way for a highperformance real-time control to track a desired resistance variation curve (reference dynamic resistance) during the welding process to assure uniform quality of the weld joint regardless of welding condition variation.
The organization of this paper is as follows.Section 2 develops an electrical model for the subsequent analysis and calculation, in which the dynamic resistance is modeled in the primary circuit.Section 3 presents an embedded ANNbased method to calculate the dynamic resistance parameter.Section 4 introduces a sensing device which is particularly suitable for the application of measurement, describes the experimental setup, and provides the analysis of the experimental results.Section 5 concludes the paper.

Electrical Modeling for the RSW Process
The single-phase A.C. welding machine has an A.C. voltage source, which is connected in series with a pair of antiphase Silicon Controlled Rectifier (SCRs) to the primary circuit of a step-down welding transformer.Each SCR is a diode whose firing angle  (i.e., the phase difference between the line voltage zero-crossing and the SCR turn-on) can be controlled by applying a trigger pulse of a sufficient duration to achieve a suitable welding current.

Electrical Model for the Welding Circuit.
Ignoring the SCR forward resistance and variations of transformer permeability, Figures 1 and 2 present a simplified circuit schematic diagram of the welding machine and its equivalent circuit via an impedance conversion from the secondary side of the transformer to the primary side [10,12].
Assume that the SCR is to be on at the time  = 0 and the corresponding firing angle is to be .Thus, the loop equation can be written as where  denotes the instantaneous voltage applied on the load,  denotes the instantaneous current, and  is effective value of the main voltage;   is the equivalent inductive reactance;   is the equivalent resistance.
A general solution to (1) is obtained as where 2) illustrates that the current going through the SCR consists of the forced component  1 and the free component  2 as following: where  1 is the steady-state term per sinusoidal waveform, and  2 is a transient term per exponential form with the decay time constant  =   /  = tan /. 1 and  2 constitute the actual current passing through the SCR.
According to (2), we can obtain (4) given below for  =  when the welding current reaches its maximum value and its derivative is equal to zero.

Dynamic Resistance Measuring Model from the Primary
Circuit.According to (2), the equivalent resistance in both primary and secondary circuits can be obtained as For real application, short circuit test (welding operation without workpiece) can be performed with the firing angle preset as zero, in this case the measured firing angle is equal to the power factor angle.Hereby, the power factor angle is recognized as  0 , and the visual equivalent resistance is denoted as  0 .
When the  0 under the short circuit condition is directly measured from the secondary side by the acquired tip voltage and secondary welding current, the dynamic resistance for the subsequent welding operation is calibrated.And the relationship between the short circuit resistance and the arbitrary welding resistance is given by where  0 =  0 tan  0 is a premeasured and calculated constant before online computing   .
According to (7), the dynamic resistance measuvement is converted into that of the power factor angle.From (4), we can also obtain the relationship between , , and  which may be denoted in the form of (8), even though  cannot be expressed analytically in terms of  and .
In this work, it is valid to construct an ANN mapping from ,  onto ctan  since it can approximate the implicit surfaces.In fact, we may assign incremental values for  ranging from 25 ∘ to 85 ∘ with 5 ∘ interval and  ranging from 10 ∘ to 89.5 ∘ with 0.5 ∘ interval in (4) and get the corresponding  array, which can be presented in Figure 3.
Furthmover, we have all the parameters , , and ctan  to form a tuplet.As such, we finally obtain , , and ctan  arrays with 13 × 160 elements, respectively, as shown in Figure 4.

ctan 𝜑 Calculation with an Embedded ANN
An ANN is a collection of simple processing units, mutually interconnected with weights assigned to the connections.By modifying the connecting weights according to certain learning rules, the ANN can be trained to recognize any  A three-layer BP network could be trained to approximate any continuous nonlinear functions with arbitrary precision.Hence, a BP NN is constructed to effectively fit the function represented by (8).Parameters  and  are selected as the network inputs and ctan  as the network output and two hidden layers containing 20 and 30 neural nodes, respectively, are employed to form a 2 × 20 × 30 × 1 network topology, as shown in Figure 5.This structure ensures a trade-off between the ANN model precision and computational complexity.Subsequently, a high-performance Error Back Propagation (EBP) training algorithm [13] is employed for fitting the function (8).
The simulation data generated in part B, Section 2 are used to train and validate the ANN.The data set consists of 2080 (13 × 160) network input-output pairs and can be divided into two parts.Part one includes 1500 randomly selected pairs used to train the neural network.Part two includes the remaining 580 pairs which are employed to validate the generalization of the network.The network converges when trained by the proposed training algorithm.The generalization test results indicate that the mean square error of ctan  is less than 0.001 and the maximum error of ctan  is about 0.004.These two indexes guarantee that the network can satisfy the application requirement perfectly.Also, it is worth mentioning that the ANN need not be re-trained for different types of welding machines and different welding materials.These differences just lead to various impedances in the electrical circuit; for example, the  welding machine with larger arm length has a relatively larger inductive reactance and the aluminum weldment has a lower resistance than the low-carbon steel.However, there exists a fixed relationship between , , and ctan .Therefore, it is reasonable to bring up that the network can succeed with all scenarios.

Implementation and Experimental Results
Since ctan  is time-variant during the whole RSW process, we calculate it in each half-wave so as to reveal its dynamic feature.The real-time calculation of ctan  requires the following information: the preset firing angle  of each halfwave and the current peak angle .Viewed from each halfwave, the firing angle may be regarded as a controllable parameter.Hence, we can focus on the measurement of the peak angle .

Experimental Setup.
A resistance spot welding monitoring and control system has been developed to conduct experiments on the welding machine platform of OBARA (ST21).Figures 6 and 7 show the primary and secondary measuring apparatus, respectively.Note that the secondary side dynamic resistance measuring apparatus is just for the verification purpose and will be removed before putting it into real application.
The training results of the network mentioned in Section 3, matrices of the neuron connection weights, and biases can be programmatically embedded into the digital signal processor (DSP) to perform online calculation of the ctan .The TMS320LF2407 DSP is selected to execute the ANN computation because of its low cost and unique structure.The DSP controller has separate buses for instructions and data which allow simultaneous access of the program and data, and overlapping of some operations for an increased process performance.The DSP pipeline's operation can accelerate its instruction executions, and thus it caters for rapidly multiplying/accumulating operations of the neural network computation.Therefore, when implemented in hardware, the ANN runs orders of magnitude faster than software simulations.The processor adaptive calculation has a superior behavior.

Measurement of the Current Peak Angle 𝛾.
The Rogowski loop has a much lower cost and better performance compared to the traditional sensing system like Hall-effect current sensor and current transformer.It can generate and output the current derivative signal whose zero-crossing points correspond to the current peak points [14].A Rogowski loop sensor is adopted in our experimental setup to acquire the current peak angle.The schematic view of the resistance spot welding monitoring and control system is shown in Figure 8.And Figure 9 shows the phase relation of the acquired signals, where channel 1 is the original welding current waveform and channel 2 is the current derivative signal from the Rogowski loop.Actually, the phase difference between the two signals is nothing more than the current peak angle.Hence, we can obtain the current peak angle easily if the current zerocrossing point and the current derivative point in each halfwave are recorded.

Experimental Results
. The experiment has two steps.The first step is to measure and calibrate the measuring system with a short circuit welding experiment.The second step is to validate the proposed algorithm via comparing the actual measured secondary dynamic resistance and that calculated from the primary side.Preset a constant firing angle  = 90 ∘ for 16 cycles, and then measure the values of  (and ctan ) and dynamic resistance, respectively, denoted as  0 and  0 for future use.
The single-overlap shear samples, 1 mm + 1 mm lowcarbon steel plates, are prepared for 16-cycle (32 half-cycles) welding with a constant 7500 A effective welding current.Figure 10 shows that when the correlation effect is taken into consideration, the dynamic resistance  1 estimated by the proposed algorithm is almost identical to the measurement  2 from the secondary side, which indicates that the proposed ANN-based method is feasible.The comparison shows that the average deviation between  1 and  2 is 9.5% and the difference could be minimized via a filtering technique to achieve a satisfactory accuracy requirement.

Conclusion
Conventional measuring technique fails to detect the dynamic resistance at the primary side with a high realtime performance.In this paper, the ANN-based dynamic resistance measuring method was proposed to achieve better real-time performance during the resistance spot welding process.In conclusion, we have the following.
(1) The proposed method has a high real-time performance because it can calculate the dynamic resistance within each 1/4 cycle (5 ms) via a processor adaptive computational method.
(2) The proposed method is easy to use because its physical parameters are easy to acquire and sensitive to measure and the offline trained ANN can be embedded into the program as a matrix constant.The memory space for the proposed algorithm is less than 800 Bytes.
(3) Experimental results show that the general measurement error, including the modeling, computation, and parameter-measuring errors, is endurable.And it could be further reduced by using some filtering techniques, which implies that the method can be applied in resistance spot welding process for realtime fine control.

Figure 1 :
Figure 1: Equivalent welding circuit including a practical transformer.

Figure 2 :
Figure 2: Equivalent welding machine circuit via impedance conversion.

Figure 8 :
Figure 8: Schematic diagram of the experimental system for the RSW.

Figure 9 :Figure 10 :
Figure 9: Phase relation between the welding current and its derivative.