## 3 NLP-Based ECMS Algorithm
### Adaptive Equivalent Consumption Minimization Strategy  
The NLP-based ECMS algorithm was controlled by an A-ECMS based on the reference SOC trajectory, which is the result of NLP. An A-ECMS computes the cost function for input grids and obtains the optimal power distribution ratio, which minimize the cost function. A schematic diagram of A-ECMS consisting of five steps is shown in Figure 7.  
Figure 6: Surface fitting results for a fuel-consumption rate map. (**a**) surface fitting result with various degree. (**b**) Fitting error according to the degree of polynomial. Figure 7: Conceptual diagram of A-ECMS in NLP-ECMS. The first step determined the number of grids for the control input candidates (\(u_{grid}\)) for the power distribution ratio, as described by Equation (18). The A-ECMS in this paper used 201 grids (\(N=201\)). We have  
\[u_{grid}=u_{N\times 1}=[-1,\ 1]. \tag{18}\]  
The second step calculated the torque candidate of the ICE and EM. The required torque (\(T_{req}\)), calculated by a preprocessing algorithm, was distributed to the EM torque candidates (\(T_{mot,\ grid}\)) by the input grid. The engine torque candidates (\(T_{eng,\ grid}\)) were based on the difference between the required torque and EM torque candidates. The formulas are found in Equations (19) and (20). In this process, the maximum/minimum torque of the EM and the ICE was considered as shown in Equation (21):  
\[T_{mot,\ grid}=T_{req}.u_{grid} \tag{19}\]  
\[T_{eng,\ grid}=T_{req}-T_{mot,grid} \tag{20}\]  
\[\text{{subj. }}\ \text{{to. }}\ \left\{ \begin{aligned} & T_{mot,min}\leq T_{mot,grid}\leq T_{mot,max} \\ & T_{eng,min}\leq T_{eng,grid}\leq T_{eng,max}\end{aligned} .\right. \tag{21}\]  
The third step calculated the power candidate of the ICE and EM. The ICE power candidates (\(P_{eng,\ grid}\)) were obtained from the BSFC (\(\dot{m}_{bsfc}\)) and lower heating value (\(Q_{LHV}\)). The EM power candidates (\(P_{mot,\ grid}\)) were obtained from the internal resistance (\(R_{int}\)), open-circuit voltage (\(V_{oc}\)), and EM current (\(I_{mot}\)). Internal resistance and open-circuit voltage are functions of the battery's SOC, and the EM current can be calculated by using Equation (22). SOC candidates were calculated from the EM power candidates because the EM power candidates affected the SOC. The formulas are as follows Equations (23)-(25):  
\[I_{mot,grid}=\left(V_{oc}-\sqrt{{V_{oc}}^{2}-4{\cdot}R_{int}{\cdot}T_{mot,grid }{\cdot}w_{mot}}\right)\bigg{/}2{\cdot}R_{int} \tag{22}\]  
\[P_{mot,\ grid}=V_{oc}{\cdot}I_{mot,grid}-R_{int}{\cdot}I_{mot,grid}^{2} \tag{23}\]  
\[P_{eng\ grid}=Q_{LHV}{\cdot}\dot{m}_{bsfc}\Big{(}T_{eng,grid},\ w_{eng}\Big{)} \tag{24}\]  
\[SOC_{grid}=(-1/Q_{bal}){\cdot}I_{mot,grid}. \tag{25}\]  
The fourth step calculates the equivalent factor (\(S_{eq}\)), which was used to equalize the power candidates of the ICE and EM. This process determines whether to use power from the EM or the ICE. An A-ECMS regulates the equivalent factor, so that the battery's SOC follows the reference SOC trajectory, which can be calculated by NLP. If the battery's SOC exceeded the reference trajectory, the equivalent factor was decreased. If the battery's SOC was less than reference trajectory, the equivalent factor was increased. This is a form of a proportional-integral-derivative controller (\(S_{pid}\)), as shown in Equations (26) and (27). Equation (28) was used to prevent the equivalent factor from changing rapidly [33; 38]. We have  
\[SOC_{err}=SOC_{ref}-SOC_{grid} \tag{26}\]  
\[S_{pid}=S_{0}+K_{p}{\cdot}SOC_{err}+K_{i}{\cdot}\int SOC_{err}+K_{d}{\cdot} \frac{dSOC_{err}}{dt} \tag{27}\]  
\[S_{eq}=S_{pid}-I_{1}{\cdot}tan\bigg{(}-\frac{\pi}{2}\frac{l_{s}{\cdot}SOC_{ err}}{\Delta SOC}\bigg{)}. \tag{28}\]  
The final step calculates the cost function and derives the optimal input, which is the power-split ratio between the ICE and EM that minimizes the cost function from the candidates. The cost function (\(J_{ecms}\)) of an A-ECMS reflecting the equivalent factor is described by Equation (29).