# An Online Simultaneous Measurement of the Dual-Axis Straightness Error for Machine Tools
## 2 Dual-Axis Measurement System
### Measurement Principle  
As shown in Figure 7, the measurement path was inspired by previous study [13]. The straightness variation of the moving working table is detected by PSDs. The laser beam of the 2 nd module is utilized not only as the reference line projected on PSD-2 for measuring the vertical straightness errors of the Y-axis, as shown in Figure 3, but also as the connection for linking the errors measured by the 1 st module. The reference-point of the machine tool is at the left down corner, and the measurement was performed in horizontal motion along the X-Y plane of the machine tool. The moving direction of PSD-1 along the X-axis was from machine position X--100 mm to X--900 mm (measurement distance: 800 mm), and the PSD-1 along Y-axis was from Y--100 mm to Y--500 mm (measurement distance: 400 mm).  
The vertical straightness error \(Z_{\sigma}\) can be expressed as the sum of the measured \(X\)- and \(Y\)-axis vertical straightness \(X_{\sigma_{Z}}\) and \(Y_{\sigma_{Z}}\):  
\[Z_{\sigma}=X_{\sigma_{Z}}+Y_{\sigma_{Z}} \tag{1}\]  
The equation for the least-squared plane can be expressed as follows:  
\[Z-AX-BY-C=0 \tag{2}\]  
where \(A\), \(B\), and \(C\) are constants; \(X\), \(Y\), and \(Z\) are coordinates on the least-squared plane.  
Figure 6: Pitch angle error of the laser source due to the motion of the working table: (**a**) moving away; and (**b**) moving closer to the laser source.  
Figure 7: Schematic diagram of dual-axis measuring mechanism.  
The vertical straightness error of every sampling point \(Ei\) can be expressed as:  
\[E_{i}\ =\ Z_{\sigma_{i}}-AX_{i}\ -\ BY_{i}\ -\ C\ =\ Z_{\sigma_{i}}-(AX_{i}+\ BY_{i}+\ C) =\ Z_{\sigma_{i}}\ -\ Z_{i}\ \ \ \text{for}\ i\ =\ 1\ \sim n \tag{3}\]  
And the squared error \(E\) is given by:  
\[E=\sum_{i=1}^{n}E_{i}^{2}=\sum_{i=1}^{n}[Z_{\sigma_{i}}-(AX_{i}+BY_{i}+C)]^{2} \ \ \ i=1\ \sim n \tag{4}\]  
The minimum value of the squared error can be obtained by taking partial derivatives of \(E\) with respect to \(A\), \(B\) and \(C\), setting these derivatives to zero, and then solving for \(A\), \(B\), and \(C\):  
\[\begin{split}\frac{\partial E}{\partial A}&=\sum_{ i=1}^{n}2(Z_{\sigma_{i}}-AX_{i}-BY_{i}-C)(-X_{i})=0\\ \frac{\partial E}{\partial B}&=\sum_{i=1}^{n}2(Z_{ \sigma_{i}}-AX_{i}-BY_{i}-C)(-Y_{i})=0\\ \frac{\partial E}{\partial C}&=\sum_{i=1}^{n}2(Z_{ \sigma_{i}}-AX_{i}-BY_{i}-C)(-1)=0\end{split} \tag{5}\]  
Equation (5) can be expressed in a matrix form:  
\[\left[\begin{array}{ccc}\sum X_{i}^{2}&\sum X_{i}Y_{i}&\sum X_{i}\\ \sum X_{i}Y_{i}&\sum Y_{i}^{2}&\sum Y_{i}\\ \sum X_{i}&\sum Y_{i}&\sum 1\end{array}\right]\left[\begin{array}{c}A\\ B\\ C\end{array}\right]=\left[\begin{array}{c}\sum X_{i}Z_{\sigma_{i}}\\ \sum Y_{i}Z_{\sigma_{i}}\\ \sum Z_{\sigma_{i}}\end{array}\right] \tag{6}\]  
The constants \(A\), \(B\) and \(C\) are obtained from Equation (6). Thus, the \(Z\)-axis coordinate on the least-squared plane \(Z_{i}\) can be calculated by substituting \(A\), \(B\) and \(C\) back into Equation (2), and then the vertical straightness error of every sampling point \(E_{i}\) can be calculated by subtracting \(Z_{i}\) from \(Z_{\sigma_{i}}\) of Equation (3). Finally, the plane flatness is given by using the extremum of \(E_{i}\):  
\[E=\frac{(E_{i})_{max}-(E_{i})_{min}}{\sqrt{1+A^{2}+B^{2}}} \tag{7}\]  
If the plane of interest is in close proximity to the horizontal plane, i.e., \(\sqrt{1+A^{2}+B^{2}}\approx 1\), Equation (7) can be simplified to:  
\[E=(E_{i})_{max}-(E_{i})_{min} \tag{8}\]