## 3 The Data-Driven Adaptive Control Strategy
### Adaptive Controller Design
\Big{]}\ \The above-filtered signals are then used in the formulation of a modified cost function \(J_{VRTT}(\theta)\) as follows:  
\[J_{VRTT}(\theta)=\ \frac{1}{N}\ \sum\limits_{k=1}^{N}\left\{u_{F}(k)-C \left(z^{-1};\theta\right)\overline{e_{F}}(k)\right\}^{2} \tag{17}\] \[=\ \frac{1}{N}\ \sum\limits_{k=1}^{N}\left\{L\left(z^{-1}\right) \left[u(k)-C\left(z^{-1};\theta\right)\overline{e}(k)\right]\right\}^{2}\] \[=\frac{1}{N}\ \sum\limits_{k=1}^{N}\left[L\left(z^{-1}\right) \left[u(k)-C\left(z^{-1};\theta\right)\left(T_{d}{}^{-1}\left(z^{-1}\right)-1 \right)y(k)\right]\right]^{2}\]  
The filter \(L\left(z^{-1}\right)\) is formulated as follows, which makes the resultant PID controller a good approximation of the \"ideal controller\" [16]:  
\[L\left(z^{-1}\right)\ =\ \frac{\left(1-T_{d}\left(z^{-1}\right)\right)T_{d} \left(z^{-1}\right)}{\Phi_{u}\left(z^{-1}\right)^{1/2}} \tag{18}\]  
The \(\Phi_{u}\left(z^{-1}\right)\) term in Equation (18) is the spectral density of the laser voltage signal, which can be calculated based on the I/O dataset \(\left\{u(k)\right\}_{k=1,2...N}\) by periodogram and ARMA modeling methods [24; 25]. The execution of the VRFT-based autotuning unit in the laser-based DED process can be summarized in the following steps:  
* **VRFT presetting**: Before the control process starts, the reference model \(T_{d}\left(z^{-1}\right)\), representing the desired system performance, is specified by Equation (6). * **Data collection and preprocessing**: During the \(M\)th adaptive control cycle, the laser voltage and MPW data \(D_{M}=\left\{\left(u_{k},\ y_{k}\right)\right\}_{M}\) are recorded and stored into the temporary buffer within the interval \(\Delta t=t_{0}\sim t_{N}\). The virtual reference signal \(\widetilde{r}_{M}\left(z^{-1}\right)\) and the virtual error signal \(\overline{e}_{M}\left(z^{-1}\right)\) for this cycle are then calculated using Equations (9) and (10). The filter \(L\left(z^{-1}\right)\) determined by Equation (18) is applied to filter the I/O data and virtual signals. * **VRFT controller tuning**: When the \(M\)th control cycle has completed, and the timeout signal is issued in the autotuning unit, the VRFT function updates the optimal controller parameters \(\hat{\theta}_{M}\) by minimizing the modified cost function \(J_{VRFT}(\theta)\) in Equation (17), using the data \(D_{M}=\left\{\left(u_{k},\ y_{k}\right)\right\}_{M}\) in the buffer. * **PID parameter updating**: The autotuning unit sends the updated controller parameters \(\hat{\theta}_{M}\) to the digital PID controller unit, resets the timer, flushes the buffer, and then returns to Step 1 to start the (\(M\)+\(I\))th control cycle. The main contribution of the proposed DED control strategy is that the autotuning method has eliminated the necessity of prior system identification and its associated cost and manual labor. The same controller can be applied in the DED fabrication with any shape, size, or material without modification. Previous rule-based adaptive DED control methods updated the controller parameters based on the layer number or the part height, while the rules were derived from experiments for a specific combination of material and process parameters [4; 14; 15]. In comparison, the proposed data-driven adaptive controller can update the parameters automatically regardless of the layer number or part height, and no prior experiments are needed to generate the control rules, thus saving time and cost for end-users.