# Practical Control of a Cold Milling Machine using an Adaptive PID Controller
## 3 The Proposed Adaptive PID Controller
The deviation \(e(k)\) approaches to zero in steady state, the value of \(K_{u}\) should be decreases gradually until it reaches the steady value to ensure that the system is stable and small overshoot. Weights \(\omega_{i}(k)\) changes adaptively with the value of deviation \(e(k)\), and ultimately the process value will track the set value. Therefore it is necessary to select the online correction of nonlinear transformation in the Equation (26). From Equation (26), one can see that \(K_{u}\) is changed with the error of the engine speed. If the error is small, \(K_{u}=K_{u0}\). If the error is large, \(K_{u}\) increases to be very large which leads to increasing the convergence speed of the control system. The advantage of this method is that we only need to select a proper \(K_{u0}\), and there is no need to set the learning rate repeatedly. The online correction of \(K_{u}\) is conduced to reduce the influence of the learning rate in this method. In the single neuron PID control [31; 32], the control law can be expressed by  
\[\Delta u(k)=K_{u}\sum\limits_{i=1}^{3}\frac{w_{i}(k)x_{i}(k)}{\sum\limits_{i =1}^{3}\left|w_{i}(k)\right|} \tag{27}\]  
The single neuron adaptive PID controller implements the function of the adaptive- and self-learning by adjusting weight coefficients, which can form different control algorithms using different learning rules. Unsupervised learning functions as self-organized learning, i.e., the network learning is a completely self-learning process. The fundamental principle of Hebb learning is that if two neurons are activated at the same time, then the increase of their connect intensity is directly proportional to the product of their stimulation. Introducing a teacher signal into the Hebb learning algorithm leads to changing the output to the difference between ideal output and actual output. Basically, the supervised Hebb learning algorithm combines the unsupervised Hebb learning algorithm with the supervised Delta learning algorithm in [33]. In this work, the supervised Hebb learning algorithm is used to design the control law. In the supervised Hebb learning algorithm, the weight value adjustment function is expressed as [34; 35]  
\[w_{i}(k+1)=w_{i}(k)+\eta_{i}p_{i}(k) \tag{28}\]  
\[p_{i}(k)=K_{u}(k)z(k)u(k)x_{i}(k) \tag{29}\]where \(p_{i}(k)\) is the recursive signal and hushes gradually during the process, \(\eta_{i}(i=P,I,D)\) is the learning rate, and \(z(k)=e(k)\) is output error. Substituting Equation (29) into Equation (28) one can get the weight increment \(\Delta w_{i}(k)\),  
\[\Delta w_{i}(k)=w_{i}(k+1)-w_{i}(k)=\eta_{i}K_{u}(k)e(k)u(k)x_{i}(k) \tag{30}\]  
To ensure the astringency and robustness of Equation (30) and \(u(k)\) in the learning algorithm of single neuron adaptive PID controller, learning algorithms should be disposed canonically as  
\[ \begin{array}{l}u(k)=u(k-1)+K_{u}\sum\limits_{i=1}^{3}\frac{w_{i}(k)x_{i}(k )}{\sum\limits_{i=1}^{3}\left[w_{i}(k)\right]}\\ w_{1}(k+1)=w_{1}(k)+\eta_{I}K_{u}e(k)u(k)x_{1}(k)\\ w_{2}(k+1)=w_{2}(k)+\eta_{P}K_{u}e(k)u(k)x_{2}(k)\\ w_{3}(k+1)=w_{3}(k)+\eta_{D}K_{u}e(k)u(k)x_{3}(k)\end{array}  \tag{31}\]  
The weights of the neuron are trained using the simulation method until getting satisfied regulating results. Then the neuron adjuster operating mode is set by manual to non-automatic correction weights mode. According to simulation results of the system and practical trials, the system is convergent. For a cold milling machine, which is a very complicated system, the parameters calculated with the training data significantly deviate from the actual condition. The initial parameters in the system are determined through the trial and error method in the field tests.