In this study,the effects of heat-input(2.16 kJ/mm,2.52 kJ/mm,2.88 kJ/mm)on the defects of welded joints of heat exchanger tube-to-tubesheet were studied by changing the welding current and voltage.Based on the finite element(FE)algorithm,the effect of heat-input on the residual stress at the welded joints of the heat exchanger tube-to-tubesheet was studied,and the welding process was further optimized.The results show that compared with the heat input of 2.16 kJ/mm and 2.88 kJ/mm,when the heat input is 2.52 kJ/mm,the welding quality of the tube-to-tubesheet welded joints is the best,with good weld formation,no cracks,and a small number of acceptable welding defects.Through the calculation of the residual stress of the tube-to-tubesheet welded joints,it is found that the residual stress in the heat-affected-zone(HAZ)at the central tube is larger.And the residual stress does not increase with the increase of the heat-input.Compared with the heat input of 2.16 kJ/mm and 2.88 kJ/mm,when the heat input is 2.52 kJ/mm,the residual stress distribution at the tube-to-tubesheet joints is the most uniform and stable,indicating that the welding quality is the best,which is consistent with the experimental results.Finally,the welding process is optimized by increasing the cooling time between welds and changing the welding sequence,which solves the problem of local residual stress distribution concentration and optimizes the quality of welded joints.