# STEP-NC Compliant Intelligent CNC Milling Machine with an Open Architecture Controller
## 3 Software Development
Coordinates of the new point \(\mathrm{P_{n+1}}\) with respective to the point \(\mathrm{P_{n}}\) are calculated as follows:  
\[ \begin{array}{c}\delta x\ =\delta t\ \cos(\theta)\\ X_{n+1}\ =X_{n}\ +\delta x\\ Y_{n+1}=Y_{n}+\frac{(X_{n}-X_{s})}{(X_{e}-X_{s})}\ (Y_{e}-Y_{s})\\ \end{array}  \tag{1}\]  
Similarly, Equation (2) is applied when a circular path to be followed by the machine table from point \(\mathrm{P_{s}(X_{s},Y_{s})}\) to \(\mathrm{P_{e}(X_{e},Y_{e})}\) as shown in Figure 9. Consider two points on the arc \(\mathrm{P_{n}(X_{n},Y_{n})}\) and \(\mathrm{P_{n+1}(X_{n+1},Y_{n+1})}\) placed \(\delta\theta\) angle away from each other. The next point on the arc can be calculated by Equation (2) as follows:  
\[ \begin{array}{c}X_{n}\ =\ R\cos(\theta_{n});\ Y_{n}\ =\ R\ \sin(\theta_{n})\\ X_{n+1}\ =\ R\cos(\theta_{n}+\delta\theta);\ Y_{n+1}\ =\ R\sin(\theta_{n}+\delta\theta)\\ X_{n+1}\ =X_{n}\ \cos(\delta\theta)-Y_{n}\ \sin(\delta\theta);\ Y_{n+1}\ =Y_{n}\ \cos(\delta\theta)+X_{n}\ \sin(\delta\theta)\\ \end{array}  \tag{2}\]  
Figure 8: Linear interpolation. Figure 9: Circular interpolation. Ball screws of 5 mm lead are used in this development. The rotary motion of the ball screw is measured by a two-channel incremental encoder with a separate index channel. Two encoder signals, Channel A and Channel B, are separated by 90\({}^{\circ}\). Because of the quadrature decoding, there are four counts generated for each revolution [39]. The encoder DIP switches are set to 1000 PPR since the expected resolution can be achieved without any rounding off errors. Therefore, 4000 numbers of quadrature pulses are required to move a distance of 5 mm. The resolution expected on the new machine is 0.01 mm. The number of pulses, \(N\), required to move distance, \(d\) (mm) is given by Equation (3). \[N=4000\times d/5 \tag{3}\]  
A pulse train is sent to the axis drive to rotate the respective servo motor of the machine to drive the axis. The frequency of the pulse train is decided by the required feed rate of the axis. In manual and MDI modes, the feed rate is obtained by the setting of the rotary switch on the operator's panel, and the frequency is calculated accordingly. A continuous pulse train is sent to the axis drive with the activation of the manual toggle switch of the respective axis in manual mode. In MDI and run modes, a pre-calculated number of pulses are sent to the axis drive, according to the target distance. In the run mode, the feed rate is extracted from the CMC file. In CNC machines, HMI serves as the interface between the NCK and operator. A high level of user friendliness, fast and smooth input options and the real-time display facility are some of important aspects of a good HMI. To cover all the above aspects, the controller HMI is programmed on Qt platform. Figure 10 shows the general appearance of the HMI developed. The developed machine controller is capable of reading and interpreting the STEP-NC part 21 file format product description. The file describes the workpiece material and size, process plan, working steps, manufacturing data and many more details. Therefore, the controller itself can generate toolpaths and execute them on the CNC machine to get the product machined. If it is necessary to change any parameter of the process at the last moment, it can be done by using the editor on the controller. One of system's advantages is that, without going back to the CAD/CAM stage, the toolpath can be regenerated at the machine controller itself.