# Electric Drive with an Adaptive Controller and Wireless Communication System
## 3 ADALINE Predictor  
In the previous section, it was mentioned that the cost function requires motor speed in its calculations (14). As all signals are based on the current sample of the reference and motor speeds, if the motor speed is known in advance, the neural controller can take that into account and be more precise and robust in its work (due to faster reaction). To predict the value of a motor speed, a simple ADALINE model is proposed. The ADALINE model consists of simple linear function neurons. Data processing is performed similarly to classic neural networks--input values are multiplied by weights, then the sum of these values is taken. The advantage of this approach is the use of a model that can predict (with the proper connections of the signals) data without an actual plant model. The cost function [59] and output signal for an ADALINE model can be defined similarly to (13), (14):  
\[E_{pred}(k)=\frac{1}{2}\Big{(}y_{pred}(k)-in(k)\Big{)}^{2} \tag{22}\]  
\[y^{pred}(k)=\sum_{\gamma=1}^{N_{a}}x_{\gamma}(k)w^{pred}_{\gamma}(k) \tag{23}\]  
where \(x\) is the processed state variable, \(w^{pred}\) is the weight associated with a given input, \(y^{pred}\) is the output of the predictor, \(in\) is the model input, and \(N_{a}\) is the number of inputs. The update process principle remains the same as in the previous chapter. However, this time, the calculations are performed to optimize \(w^{pred}\) (it should be noted that the value of the learning rate \(\beta\) is a small value):  
\[w^{pred}_{\gamma}(k+1)=w^{pred}_{\gamma}(k)+\beta\Bigg{[}\left(\sum_{\gamma=1 }^{N_{a}}x_{\gamma}(k)w^{pred}_{\gamma}(k)-in(k)\right)x^{pred}_{\gamma}(k) \Bigg{]} \tag{24}\]  
It can also be written as:  
\[w^{pred}_{\gamma}(k+1)=w^{pred}_{\gamma}(k)+\beta\Delta w^{pred}_{\gamma}(k) \tag{25}\]  
The update function is based on a gradient of the defined cost function for a predictor:  
\[\Delta w^{pred}_{\gamma}=\frac{\partial E_{pred}(k)}{\partial w^{pred}_{\gamma }(k)}=\Bigg{[}\left(\sum_{\gamma=1}^{N_{a}}x_{\gamma}(k)w^{pred}_{\gamma}(k)- in(k)\right)x^{pred}_{\gamma}(k)\Bigg{]} \tag{26}\]  
The neural predictor can be organized so that the output of one unit is the input of the second. Such a combination increases the prediction horizon by a number of connected units. If, for example, \(k\) units were connected as presented, the output of the entire predictor system would predict \(k\) future steps, which is presented in detail in [60]. An example system of connected predictor nodes is presented in Figure 3.  
A stable training procedure for a neural network should allow small and smooth gradient changes and minimization of the defined error, \(E_{pred}\). This process can be written as follows:  
\[E_{pred}\Big{(}w^{pred}_{\gamma}(k)\Big{)}<E_{pred}\Big{(}w^{pred}_{\gamma}(k -1)\Big{)} \tag{27}\]  
After modification and using Equation (25), it can be expressed as:  
\[E_{pred}\Big{(}w^{pred}_{\gamma}(k)+\Delta w^{pred}_{\gamma}(k)\Big{)}<E_{pred }\Big{(}w^{pred}_{\gamma}(k-1)\Big{)} \tag{28}\]The gradient value is presented with expression (26). The prediction error can also be defined:  
\[e(k)=y_{ref}^{pred}(k)-y^{pred}(k) \tag{29}\]  
The first part in (27) is a reference prediction value, which is achieved for the optimal weights value:  
\[y_{ref}^{pred}(k)=\sum_{\gamma=1}^{nan}x_{\gamma}(k)w_{\gamma_{opt}}^{pred}(k) \tag{30}\]  
After inserting Equations (30) and (23) into (29), it yields:  
\[y^{pred}(k)=\sum_{\gamma=1}^{N_{a}}x_{\gamma}(k)w^{pred}_{\gamma}(k) \tag{23}\]0  
where \(\Theta\) is a weight adaptation error, and it can be expressed as:  
\[y^{pred}(k)=\sum_{\gamma=1}^{N_{a}}x_{\gamma}(k)w^{pred}_{\gamma}(k) \tag{23}\]1  
It should be noted that \(w_{\gamma opt}^{pred}\) does not depend on time or samples because it is an optimal value. After combining expressions (25) and (32), the weight update error can be written as:  
\[y^{pred}(k)=\sum_{\gamma=1}^{N_{a}}x_{\gamma}(k)w^{pred}_{\gamma}(k) \tag{23}\]2  
A proper analysis of the stability of the neural network should define a Lyapunov function.