## 3 The Data-Driven Adaptive Control Strategy  
### Conventional Proportional-Integral-Derivative (PID) Algorithm  
This section introduces the formulation of a conventional PID controller and its parameter optimization problem, which lays the foundation of the proposed data-driven adaptive control strategy. In the DED process, the goal of closed-loop control is to improve the stability of the MPW by adjusting the laser voltage that determines the laser power. The block diagram for the conventional closed-loop control system is shown in Figure 2. The PID control action in the continuous time-domain can be expressed as:  
\[u(t)=K_{p}e(t)+K_{i}\int e(t)dt+K_{d}\frac{d}{dt}e(t) \tag{1}\]  
where \(e(t)\) is the error term that equals to the difference between the reference MPW value (\(r(t)\)) and the measured MPW value (\(y(t)\)); \(K_{p}\), \(K_{i}\), and \(K_{d}\) are the tuneable PID parameters; and \(u(t)\) is the laser voltage signal computed by the PID controller. The laser voltage signal is input into the plant \(G(s)\) that produces the MPW feedback. The PID controller with a first-order low-pass filter in derivate term can be represented as the following s-domain transfer function [18]:  
\[C(s)=\ K_{p}+\ K_{i}\frac{1}{s}+\ K_{d}\frac{s}{1+\tau_{d}\,s} \tag{2}\]  
where \(\tau_{d}\) is the first-order derivative filter time and \(s\) is the complex variable in the frequency domain.  
Figure 1: The setup of the laser-based direct energy deposition (DED) system with closed-loop control.  
To obtain the optimal controller parameters denoted as \(\theta=(K_{p},\,K_{i},\,K_{d})\), the following optimization problem in the model-reference (MR) framework [19] can be established as follows:  
\[\hat{\theta}_{MR}=\underset{\theta}{\arg\min}J_{MR}(\theta) \tag{3}\]  
\[J_{MR}(\theta)\triangleq\left\|\left(\frac{G\!\left(z^{-1}\right)}{1+\,G(z^{-1 })C(z^{-1};\theta)}-\,T_{d}\!\left(z^{-1}\right)\right)\!L_{r}\!\left(z^{-1} \right)\right\|\,\frac{2}{2} \tag{4}\]  
where the cost function \(J_{MR}(\theta)\) penalizes the difference between the desired closed-loop transfer function \(T_{d}\!\left(z^{-1}\right)\) and the actual closed-loop transfer function, \(G\!\left(z^{-1}\right)\) and \(C\!\left(z^{-1};\theta\right)\) are the discrete time-domain counterparts of \(G(s)\) and \(C(s)\), respectively, and \(L_{r}\!\left(z^{-1}\right)\) is a band-pass noise filter. The optimization objective is to minimize the \(J_{MR}(\theta)\) criterion. The controller \(C_{d}\!\left(z^{-1}\right)\) with the optimal parameters \(\hat{\theta}_{MR}\) is the final tuning outcome, and the resultant closed-loop transfer function should be equal to the desired closed-loop reference model \(T_{d}\!\left(z^{-1}\right)\), i.e.,  
\[\frac{G\!\left(z^{-1}\right)}{1+\,G(z^{-1})C_{d}(z^{-1};\theta)}=T_{d}\!\left( z^{-1}\right) \tag{5}\]  
Since the plant model \(G\!\left(z^{-1}\right)\) in the cost function \(J_{MR}(\theta)\) is unknown, system identification is needed in the conventional tuning process to find \(G\!\left(z^{-1}\right)\) before controller parameters can be optimized; otherwise, trial-and-error experiments are conducted to determine the PID gains, which is cumbersome and time-consuming. The inaccuracy in the system identification could also jeopardize the controller tuning result. Moreover, for different part geometries and powder materials, the DED process does not have a single plant model \(G(s)\) that can generalize the melt pool dynamic response to the laser voltage signal. The melt pool response also varies with time when fabricating the same part, and hence a single set of optimal controller parameters \(\theta\) cannot be obtained for the entire time domain. Therefore, an adaptive control method is needed to automatically update the controller parameters without repeated system identification. The proposed data-driven adaptive controller is explained in Section 3.2.