## 3 Controller Design
### Smith Predictor  
To optimize the response speed of the control system, the Smith predictor is added for predictive compensation. Its structure is shown in Figure 6, and the transfer function \(\mathrm{G}_{m}(s)\) of the Smith predictor compensator is expressed as  
\[\mathrm{G}_{m}(s)=\mathrm{G}_{o}(s)\big{(}1-e^{-\mathrm{TS}}\big{)} \tag{19}\]  
where \(\mathrm{G}_{o}(s)\cdot e^{-\mathrm{TS}}\) is the open-loop transfer function of the controlled object considering the time delay.  
When the Smith predictor is not added, the closed-loop transfer function of the system is  
\[\mathrm{G}(s)=\frac{\mathrm{G}_{c}(s)\mathrm{G}_{o}(s)e^{-\mathrm{TS}}}{1+ \mathrm{G}_{c}(s)\mathrm{G}_{o}(s)e^{-\mathrm{TS}}} \tag{20}\]  
where \(\mathrm{G}_{c}(s)\) is the transfer function of the controller.  
After adding the Smith predictor, the closed-loop transfer function of the system changes:  
\[\mathrm{G}(s)=\frac{\mathrm{G}_{c}(s)\mathrm{G}_{o}(s)}{1+\mathrm{G}_{c}(s) \mathrm{G}_{o}(s)}e^{-\mathrm{TS}} \tag{21}\]  
By comparison of Equations (20) and (21), it can be found that the Smith predictor uses compensation to separate the pure time delay \(e^{-\mathrm{TS}}\) and \(\mathrm{G}_{o}(s)\), which is equivalent to putting the pure time delay of the controlled object outside the control closed loop.  
As the Smith predictor depends on the prior system model, a BP neural network shown in Figure 9 was used for identifying the system to improve modeling accuracy.  
The controlled object was a single-input single-output (SISO) nonlinear system, which can be described as follows:  
\[F(t+1)=f[F(t),\dots,F(t-n),U_{c}(t),\dots,U_{c}(t-m)] \tag{22}\]  
where \(F(t)\) and _Uc(t)_ are the input and output of the object at time \(t\), respectively; \(m\) and \(n\) mark the orders of \(F(t)\) and _Uc (t)_, respectively; and \(f[\bullet]\) represents a nonlinear function.  
The input \(O_{i}^{\mathrm{I}}(t)\) of the network is  
\[O_{i}^{\mathrm{I}}(t)=\left\{\begin{array}{c}U_{c}(t-i+1),0\leq i\leq m+1\\ F(t-i+m-2),m+2\leq i\leq m+n+2\end{array}\right. \tag{23}\]  
Figure 9: Schematic diagram of the neural network ANN2 structure, part of the BPNN-PID controller depicted in Figure 6.  
The output \(net_{k}(t)\) is  
\[net_{k}(t)=F(t+1) \tag{24}\]  
The neural network ANN2 also used the BP algorithm, and its structural parameters were determined as shown in Table 2.  
The neural network ANN2 was trained offline. As Figure 10 shows, the main training steps of the neural network ANN2 are listed as follows:  
1. Determine the structure of the neural network, including the number of hidden layers, neuron activation functions and training samples;
2. Take a small initial value for the weight;
3. Import samples for training;
4. Calculate the input and output of each layer of neurons;
5. For each iteration, calculate the weight adjustment of the hidden layer and the output layer;
6. Check whether the network training error is less than the error tolerance. If it meets the requirements, go to Step 7, and if not, go to Step 8;
7. Solidify and save each weight. The training is successful, and you can call it through Labview or MATLAB Simulink;
8. Check whether the current iteration number exceeds the upper limit. If not, return to Step 3 for further training; otherwise, the training failed. Return to Step 1 to restart training.  
Figure 10: ANN2 training flowchart.  
\begin{table}
\begin{tabular}{c c} \hline \hline
**Type** & **Value** \\ \hline learning type & Offline \\ Learning rate (\(\eta\)) & 0.3 \\ Inertia index (\(\alpha\)) & 0.15 \\ Number of hidden layer neurons & 15 \\ Hidden layer activation function & tanh \\ Output layer activation function & tanh \\ Initialization weight method & 0.03 rands (n, 1) \\ Time orders m,n & 4 \\ \hline \hline \end{tabular}
\end{table}
Table 2: Parameters of neural network ANN2.