# Development of a Small CNC Machining Center for Physical Implementation and a Digital Twin
## 4 Materials and Methods
### System Dynamics  
The control strategy used for the motion control systems involved the use of PID controllers. One of the main objectives of the research was to provide users with a practical, cost-effective control solution for an open-architecture CNC equipment. The classical PID controller was found to fulfill these requirements. As experimental research has shown, acceptable results have been obtained using this type of controller. \begin{table}
\begin{tabular}{c c c} \hline \hline
**Parameter** & **Meaning** &
\begin{tabular}{c} **Values** \\ **(for X- and Y-Axes)** \\ \end{tabular} \\ \hline \(\mathrm{M_{mn}}\) & Nominal torque developed by the motor & 0.14 Nm \\ \(\mathrm{K_{t}}\) & Electromagnetic torque constant & 0.06 Nm/A \\ \(\mathrm{K_{v}}\) & Back electromotive voltage constant & 0.06 Vs/rad \\ \(\mathrm{B_{m}}\) & Coefficient of viscous friction of the motor & 0 Nms/rad \\ L & Armature inductance & 0.029 H \\ R & Armature resistance & 1.33 Ohm \\ \(\mathrm{J_{m}}\) & Armature moment of inertia & 0.00004 kgm\({}^{2}\). \\ \(\mathrm{P_{s}}\) & Pitch of the lead screw & 0.006 m \\ d & Ball screw diameter & 0.01 m \\ L & Ball screw length & 0.15 m \\ \(\mathrm{\rho}\) & Screw material density (steel) & 7800 kg/m\({}^{3}\) \\ \(\mathrm{J_{s}}\) & Lead screw moment of inertia & 1.1486\(\cdot 10^{-6}\) kgm\({}^{2}\) \\ \(\mathrm{J_{red}}\) & Reduced moment of inertia at the motor shaft & 4.1149\(\cdot 10^{-5}\) kgm\({}^{2}\) \\ m & Overall mass of the system & m = 20 kg \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Parameters of the motion control system (X- and Y-axes). Figure 3: Simulation diagram for the motion control system made in Simscape. Also, industrial practice indicates that even in commercial industrial CNC industrial equipment, the classical PID control algorithm is the most widely used. Even if in the settings of such equipment there is a possibility to activate more advanced control facilities (e.g., feed-forward algorithms), these are often not activated. The numerical implementation of a more advanced PID algorithm would have required more computational power than what is available on Arduino development boards, which are fitted with only 8-bit microcontrollers. It should be kept in mind here that the Arduino boards need to run both the PID controller algorithm and handle the input quantities generated by the linear or circular interpolation algorithm. Since the actual system is controlled numerically, the numerical form of the transfer function, shown in the equation below, was used for the PID controller:  
\[H_{PID}(z)=K_{P}+K_{I}T_{s}\frac{1}{z-1}+K_{D}\frac{N}{1+NTs_{s}\frac{1}{z-1}}. \tag{7}\]  
where:  
\(\mathrm{K_{P}}\) is the proportional constant;  
\(\mathrm{K_{I}}\) is the integration constant;  
\(\mathrm{K_{D}}\) is the derivative constant;  
\(\mathrm{T_{s}}\) is the sampling time of the system. The interactive \"Tune\" facility, available for the \"PID Controller\" block in Simulink, was used to tune the controller. It is imperative to consider that in the context of automatic position or displacement feedback systems, the overshoot should ideally be zero, or as close to this value as possible. Additionally, the physical limits of variation of the controller parameters for the experimental system must be taken into account. Preliminary experimental tests established that for the proportionality constant \(\mathrm{K_{P}}\), the limit was 200, and for the derivative constant \(\mathrm{K_{D}}\), the limit was 1. No limit was established for the integration constant \(\mathrm{K_{I}}\). For the preliminary tuning of the controller using the specific tuning interface in MATLAB/Simulink, the control objective pursued a balanced approach between reference tracking (which would result in a better contouring accuracy of the CNC equipment) and input disturbance rejection (which would lead to a high robustness of the system to the action of technological resistive forces due to the machining process).