## 3 CEV Estimation and ILCC Design  
The CEV is the shortest distance vector between the response position (on the response path) and the helical path; thus, the precise calculation of the CEV is generally difficult and time-consuming. Although many CEV estimation methods have been proposed in recent decades, the accuracy, complexity, and calculation time of the estimated CEV must be carefully considered in the PCB-ILCC design. Therefore, this study used the interpolated positions on a helical path to estimate the CEV [27]. As shown in Figure 4, \(R\) denotes the response position on the response path; \(H_{i}\) and \(H_{i-1}\) denote the interpolated positions that are the positions on the helical path and close to the response position \(R\); \(H_{c}\) denotes the position on the \(\overrightarrow{H_{i-1}H_{i}}\) vector, and the \(\overrightarrow{RR_{c}}\) vector is perpendicular to the \(\overrightarrow{H_{i-1}H_{i}}\) vector so that the \(\overrightarrow{RR_{c}}\) vector can be obtained as the estimated CEV \(\varepsilon\) (i.e., \(\varepsilon=\overrightarrow{RR_{c}}\)). Here, \(\varepsilon=\left[\varepsilon_{x}\quad\varepsilon_{y}\quad\varepsilon_{z} \right]^{T}\), where \(\varepsilon_{x}\), \(\varepsilon_{y}\), and \(\varepsilon_{z}\) are the axial components of the estimated CEV \(\varepsilon\) on the \(X\)-axis, \(Y\)-axis, and \(Z\)-axis, respectively. Let \(d_{i-1}\) and \(d_{i}\), respectively, denote the distance from \(R\) to \(H_{i-1}\) and \(H_{i}\), and let \(D_{i-1}\) and \(D_{i}\), respectively, denote the distance from \(H_{c}\) to \(H_{i-1}\) and \(H_{i}\). Referring to the geometric relationship shown in Figure 4, the distance relations can be obtained as Equations (1) and (2):  
\[\left(d_{i-1}\right)^{2}-\left(D_{i-1}\right)^{2}=\left(d_{i}\right)^{2}-\left( D_{i}\right)^{2} \tag{1}\]  
Figure 4: CEV estimation based on the interpolated positions on the helical path. Figure 3: Control structure of the PCB-ILCC method developed in this study. \[D_{i-1}+D_{i}=\left\|H_{i}-H_{i-1}\right\| \tag{2}\]  
Here, \(D_{i-1}\) and \(H_{c}\) can be, respectively, calculated by Equations (3) and (4):  
\[D_{i-1}=\frac{\left((d_{i-1})^{2}-(d_{i})^{2}\right)+\left\|H_{i}-H_{i-1}\right\| ^{2}}{2\left\|H_{i}-H_{i-1}\right\|} \tag{3}\]  
\[H_{c}=H_{i-1}+\frac{\left(H_{i}-H_{i-1}\right)}{\left\|H_{i}-H_{i-1}\right\|}D _{i-1} \tag{4}\]  
Therefore, the estimated CEV \(\varepsilon\) can be obtained as:  
\[\varepsilon=R\overset{\rightarrow}{H_{c}}=H_{c}-R=(H_{i-1}-R)+\frac{\left(H _{i}-H_{i-1}\right)}{\left\|H_{i}-H_{i-1}\right\|}D_{i-1} \tag{5}\]  
Because the helical path is adopted in thread milling operations, the estimated CEV \(\varepsilon\) can provide a good approximation to the actual CEV when the helical path has a large helical radius, and the thread milling tool moves with a low feed rate. While the response position \(R\) moves on the response path R, the contour error \(\varepsilon\) can be obtained by collecting the estimated CEV \(\varepsilon\) with the given helical path H, as shown in Figure 2 for the conventional ILCC methods; therefore, for the simplified expression, Equation (6) is used to represent the calculation of the contour error \(\varepsilon\):  
\[\varepsilon=\mathit{ctrerr}\ (\mathrm{H-R}) \tag{6}\]  
where \(\mathit{ctrerr}\ (\ \cdot\ )\) denotes the function of the contour error calculation. Specifically, as shown in Figure 3 for the PCB-ILCC method, Equation (6) is modified as Equation (7) to represent the calculation of the contour error \(\varepsilon_{j}\):  
\[\varepsilon_{j}=\mathit{ctrerr}\ (\mathrm{H_{j}-R_{j}}) \tag{7}\]  
This study developed the cycle learning method shown in Equation (8) to design the PCB-ILCC shown in Figure 3:  
Figure 4:0  
where \(Z_{L}\) denotes the vector of the pitch increment and \(K(s)\) denotes the transfer function matrix of the iterative learning contour controllers. \(Z_{L}\) is a constant vector.