# Adaptive MPC Based Real-Time Energy Management Strategy of the Electric Sanitation Vehicles
## 3 The Real-Time AMPC-Based EMS
### The Prediction Method
Thus, the parameters of the NARNN predictor mentioned in the Equation (11) could be updated with supervised learning. The performance of the trained neural network is shown in Figure 16 and the final precision was appropriate, with a mean square error (MSE) equaling 1.35. Details of training performance of NARNN predic  
Figure 14: The topology of the NARNN predictor. Figure 15: The training process of the NARNN. After the open-loop training was accomplished, as Figure 18 displays, the network was converted to a closed loop for prediction. Supplied with the initial \(p\) values, the future garbage density \(\delta(k+1),\ \delta(k+2),\ldots\delta(k+L)\) series could be iteratively forecasted using the latest past \(p\) values, including the predicted ones [28]. Nevertheless, with the increase of prediction horizon length, the error inevitably accumulates because of the iteration process. To restrain it within an acceptable range, the NARNN predictor updates the past values with the real detected ones as the prediction horizon moves forward, which can be realized with a visual sensor used to estimate the garbage density. The length of the prediction zone was set to be 20 m.  
In addition, two adaptive measures for the NARNN predictor were taken:  
Figure 16: Training verification of the NARNN. Figure 17: Details of training performance of the NARNN. Figure 18: The prediction process of the NARNN. For one thing, aiming at saltation tended to cause inaccurate prediction, especially those between level 4 and the others. One possible solution was to lessen the length of the prediction zone to 10 m when detecting such dramatic changes [29]. The demonstration of real-time feasibility is completed in Section 3.2. For another, nerual networks trained by different training sets can be switched to better adapt to improve the generalization, when a certain pattern of the garbage distribution was recognized [30]. Different types of training sets could be obtained from the garbage model statistically established on the observations from different garbage condition roads. Principal parameters of the NARNN predictor are listed in \[\delta(k)=\alpha_{0}+\sum_{j=1}^{m}\alpha_{j}\phi\left(\sum_{i=1}^{p}\beta_{ij }\delta(k-i)+\beta_{0j}\right)+\varepsilon_{t} \tag{11}\]0  
To avoid the overlap, the NARNN took the remaining 25% of the data in the model as the test set. The prediction result of the NARNN is shown in \[\delta(k)=\alpha_{0}+\sum_{j=1}^{m}\alpha_{j}\phi\left(\sum_{i=1}^{p}\beta_{ij }\delta(k-i)+\beta_{0j}\right)+\varepsilon_{t} \tag{11}\]1 Some magnified details are displayed in Figure 20 to highlight the predictor performance in particular regions. \begin{table}
\begin{tabular}{c c} \hline \hline
**Name** & **Value** \\ \hline Hidden layer & 1 \\ Neurons in the hidden layer & 20 \\ Dependent past value/Time delay & 11 \\ Length of prediction zone & 20 m/10 m (only regional) \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Parameter setting of the NARNN. Figure 19: Prediction of the NARNN. Figure 20: Magnified prediction details. Compared with the ARIMA model, which sometimes either overshot or dropped in advance [11], the NARNN seized the changing tendency of predicted series a little better. As Figure 20 shows, predicted values were a little more responsive and better anticipated the trends in the transitional areas from 400 m to 500 m or from 2400 m to 2600 m, whereas in an area from 1600 m to 2200 m, the range of predicted values better covered the real ones. In other words, the random fluctuations of real values in the flat distribution area were truly reflected. For sanitation vehicles, such improvement might be critical because the constraints on garbage residue are so strict that a few wrong forecasts probably make the vehicle fail to accomplish clean tasks, which are manifested in Section 4.