# Electric Drive with an Adaptive Controller and Wireless Communication System
## 2 Mathematical Model of the Control Structure and the Controller  
The discussed control structure consists of two neural networks that are applied to a mechanical system with elastic joints. Such a construction is often referred to as a two-mass system. Expressions describing the dynamic properties of the drive can be formulated using a set of the following equations [4; 54; 55]:  
\[T_{1}s\omega_{1}=T_{e}-T_{s}-T_{f1} \tag{1}\]  
\[T_{2}s\omega_{2}=T_{s}-T_{L}-T_{f2} \tag{2}\]  
\[T_{c}s_{s}=\omega_{1}-\omega_{2} \tag{3}\]  
where \(T_{1}\), \(T_{2}\), and \(T_{c}\) are the mechanical time constants of the motor, load and shaft, respectively, \(T_{e}\), \(T_{s}\) are the electromagnetic torque and shaft torque, \(\omega_{1}\) and \(\omega_{2}\) are the rotor speeds of the motor and load, respectively, \(T_{L}\) is the load torque, and \(T_{f1}\) and \(T_{f2}\) are non-linear functions that describe the friction present in a real drive [30]:  
\[T_{fi}=(c|\omega_{i}|+d)\text{sgn}(\omega_{i}) \tag{4}\]  
where \(c\) and \(d\) represent the viscous and Coulomb friction coefficients, respectively. It was assumed during the design process of the control structure that the current control loop (inner loop) is simplified to a first-order element and can be represented as a simple transfer function:  
\[G_{i}(s)=\frac{1}{T_{p}s+1}. \tag{5}\]  
A simplified schematic of the control structure is presented in Figure 1. The first neural network presented (in blue in Figure 1) is a network composed of an input layer, a hidden layer, and an output layer. In addition, a hidden layer has a recurrent connection, which is called a context layer. The second one (represented in orange in Figure 1) represents the neural predictor of the feedback signal. Both networks work to achieve a reliable performance by the plant according to a reference value. The Elman network is described below, as the neural predictor is in Section 3. The Elman neural network consists of \(I\) inputs, \(N\) hidden neurons, and an output neuron that generates the reference value of the electromagnetic torque--\(T_{\textit{ref}}\). The input layer is a linear layer with \(i\) neurons. Equations for the input can be written as:  
\[h_{i}^{1}(k)=x_{i}(k) \tag{6}\]  
\[z_{i}^{1}(k)=f\Big{(}h_{i}^{1}(k)\Big{)}=h_{i}^{1}(k) \tag{7}\]  
where \(h\), \(z\) are the input and output node, respectively, \(i\) is the number of the input, \(x\) is the input signal, and \(k\) represents samples. The hidden layer, with a hyperbolic activation function, processes signals from the previous layer. In addition, in the Elman network, recurrent signals from context layer are introduced, which act as an additional memory that can learn supplementary features of the plant [56]. The equations for the hidden layer input and output signal can be written as follows:  
\[h_{j}^{2}(k)=\sum_{i,j=1}^{N}\Big{(}w_{ij}^{1}(k)z_{i}^{1}(k)+w_{j}^{c}(k)z_{j} ^{c}(k)\Big{)} \tag{8}\]  
\[z_{j}^{2}(k)=f\Big{(}h_{j}^{2}(k)\Big{)}=\tanh\Big{(}h_{j}^{2}(k)\Big{)} \tag{9}\]  
and for the context layer:  
\[T_{2}s\omega_{2}=T_{s}-T_{L}-T_{f2} \tag{2}\]0  
\[T_{2}s\omega_{2}=T_{s}-T_{L}-T_{f2} \tag{2}\]1  
where \(w\) is a weight corresponding to the given layer and neuron and \(c\) stands for the context layer indicator. The output layer is also a linear layer, so its output can be presented similarly to the input layer:  
\[T_{2}s\omega_{2}=T_{s}-T_{L}-T_{f2} \tag{2}\]2  
\[T_{2}s\omega_{2}=T_{s}-T_{L}-T_{f2} \tag{2}\]3  
The [PERSON] neural network, presented in Figure 2 below, operates in on-line mode, which implies that it learns during the operation of the drive. \[T_{2}s\omega_{2}=T_{s}-T_{L}-T_{f2} \tag{2}\]4 Simplified schematic diagram of adaptive control with two neural elements. In this work, the gradient descent technique is used--weights between the first and second layer, second and third, and in the context layer, are subject to update their value during the running process of the drive.