## 5 Case Studies and Study Procedure  
This section overviews the case scenarios aside from the test procedure considered for verification purposes. Two case studies of the methodically discussed ECMS and LPF energy management approaches, each combined with the RB strategy (see Figure 9), were investigated for MiL versus HiL examinations. The cases were tested over a complete driving cycle of the New European Driving Cycle (NEDC), plotted in Figure 10, as the input of simulations and real-time implementations.  
Figure 8: Coordination of the optimization algorithm and the model.  
Figure 9: Overview of the considered EMS case studies, ECMS, and low pass filter (LPF) combined with RB.  
The study procedure consisted of different stages. First, the organized model was tested to obtain and store the results of the performed MiL simulations. Afterward, the configured EMS blocks were compiled into C Code using the Simulink(r) code generator tool and were installed into the real-time control unit of the test bench introduced in the next section. Before performing the HiL tests, pre-tests were performed using a standalone dSPACE controller to observe the EMS output signals, ensuring that the generated codes could be smoothly implemented in the main test bench. Eventually, the HiL implementation tests, each spanning 19 min and 76 s of the complete NEDC cycle, were performed and the achieved torque and speeds were stored for a comparison with those of the MiL simulations through statistical indices. In this regard, the most common engineering statistical performance indicators including root mean square error (RMSE), absolute fraction of variance (R\({}^{2}\)), and mean square error (MSE) were applied with the outcomes of MiL simulation timeseries (X\({}_{\text{s}}\)) and the actual experimentally measured HiL timeseries (X\({}_{\text{a}}\)) to analyze and verify the performance of the real-time implementation. RMSE provides error information on short-term performance, as it allows a term-by-term comparison of the actual deviation between the simulated and the measured values [60]. Hence, low RMSE and MSE values are generally favorable. The very commonly used agreement coefficient R\({}^{2}\) is a measure indicating the relationship between values under comparison as a function of RMSE and standard deviation. To compare the two datasets, the standard deviation was constant, so clearly, the R\({}^{2}\) values were expected to increase with degradation of RMSEs. Table 3 provides the utilized statistical indicators accompanied by their mathematical expressions, and Figure 11 depicts a diagram of the study procedure.  
\begin{table}
\begin{tabular}{c c} \hline \hline
**Performance Index** & **Expression** \\ \hline RMSE & \(\sqrt{\frac{1}{n}\sum\limits_{i=1}^{n}\left(X_{i,s}-X_{i,\mu}\right)^{2}}\) \\ \hline R\({}^{2}\) & \(\frac{\sum\limits_{i=1}^{n}\left(X_{i,\mu}-X_{i,\mu_{\text{avg}}}\right)\times \left(X_{i,\mu}-X_{i,\mu_{\text{avg}}}\right)}{\sqrt{\sum\limits_{i=1}^{n}\left( X_{i,\mu}-X_{i,\mu_{\text{avg}}}\right)^{2}}}\) \\ \hline MSE & \(\frac{1}{n}\sum\limits_{i=1}^{n}\left(X_{i,s}-X_{i,\mu}\right)^{2}\) \\ \hline \hline \end{tabular}
\end{table}
Table 3: Statistical performance indices.  
Figure 10: New European Driving Cycle (NEDC).