## 3 Energy Management Strategy of FCHEV
### Optimal Covariate Predictor Based on Long Short-Term Memory Neural Network
#### 3.2.1 Optimal Covariate Database Based on PMP  
PMP was used to predict the covariate, and the optimization objective was minimum hydrogen consumption under known operating conditions within the time boundary. The output power of the fuel cell stack \(P_{fc}\) was chosen as the control variable, and the \(SOC\) was chosen as the state variable. The objective function is expressed as:  
\[\min\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\! where \(U_{cov}[SOC(t)]\) is the battery open-circuit voltage corresponding to the \(SOC\) at the current moment \(t\) and \(\dot{SOC}(t)\) is the instantaneous \(SOC\) change rate. The control variable \(P_{fc}(t)\) and the state variable \(SOC(t)\) in the optimization problem are subject to the following constraints:  
\[\left\{ \begin{array}{l}0\leqslant P_{fc}(t)\leqslant P_{fc\_\max}\\ \Delta P_{fc\_\min}\leqslant\Delta P_{fc}(t)\leqslant\Delta P_{fc\_\max}\\ P_{bat\_\min}\leqslant P_{bat}(t)\leqslant P_{bat\_\max}\\ SOC_{\min}\leqslant SOC(t)\leqslant SOC_{\max}\\ \left|SOC\Big{(}t_{f}\Big{)}-SOC\Big{(}t_{ref}\Big{)}\right|\leqslant 0.005 \end{array} \right., \tag{31}\]  
where the fuel cell stack maximum output power \(P_{fc\_\max}\) was set to 82 kW, the lower limit \(\Delta P_{fc\_\min}\) and upper limit \(\Delta P_{fc\_\max}\) of the permissible fuel cell stack power change \(\Delta P_{fc}\) were \(-10.4\) and \(5.4\) kW, respectively, the lower limit \(P_{bat\_\min}\) and upper limit \(P_{bat\_\max}\) of the battery power were \(-80\) and \(80\) kW, respectively, the lower limit \(SOC_{\min}\) and upper limit \(SOC_{\max}\) of the SOC were \(0.2\) and \(0.8\), respectively, \(SOC\Big{(}t_{f}\Big{)}\) is the SOC at the end of the calculation, and \(SOC\Big{(}t_{ref}\Big{)}\) is the reference state variable. The Hamiltonian function is defined as follows:  
\[H\Big{(}SOC(t),P_{fc}(t),\lambda(t),t\Big{)}=\dot{m}_{fc}(t)+\lambda(t)\cdot \dot{SOC}(t), \tag{32}\]  
where \(\lambda(t)\) is the covariate. The optimal control variable \(P_{fc}^{*}(t)\) can be expressed by the following equation:  
\[P_{fc}^{*}(t)=arg\text{min}H(SOC^{*}(t),\lambda^{*}(t),t), \tag{33}\]  
where \(SOC^{*}(t)\) is the optimal state variable, and \(\lambda^{*}(t)\) is the optimal covariate. \(P_{fc}^{*}(t)\) must satisfy the following conditions:  
1. \(P_{fc}^{*}(t)\) must be obtained such that the Hamiltonian function achieves the minimum of all values within the time boundaries, as follows: \[H\Big{(}SOC^{*}(t),P_{fc}^{*}(t),\lambda^{*}(t),t\Big{)}\leq H\Big{(}SOC(t),P_{fc}(t),\lambda(t),t\Big{)};\] (34)
2. The optimal state variable equation is obtained by partial differentiation of the covariate in the Hamiltonian function, as follows: \[\dot{SOC}^{*}(t)=\frac{\partial H\Big{(}SOC^{*}(t),P_{fc}^{*}(t),\lambda^{* }(t),t\Big{)}}{\partial\lambda(t)}=f\Big{(}SOC^{*}(t),P_{fc}^{*}(t)\Big{)};\] (35)  
The optimal covariate trajectory equation is obtained by partial differentiation of the state variable in the Hamiltonian function, as follows:  
\[\dot{\lambda}^{*}(t)=-\frac{\partial H\Big{(}SOC^{*}(t),P_{fc}^{*}(t),\lambda ^{*}(t),t\Big{)}}{\partial SOC(t)}. \tag{36}\]  
When solving the optimization problem using PMP, the initial value of the covariate is usually unknown, and the determination of the initial value of the covariate needs to be carried out by using corresponding search methods. The target method was chosen to solve for the initial covariate, and the reference state variable \(SOC\Big{(}t_{ref}\Big{)}\) was set to \(0.6\). The steps were as follows:  
First, a guess of the initial covariate was provided. Second, the FCHEV power demand was calculated from the known operating conditions. Then, the fuel cell stack output power was discretized within the constraint interval, and the optimal control variable \(P_{fc}^{*}(t)\) was calculated by Equation (34). Finally, the optimal state variable \(SOC^{*}(t)\) and optimal covariate \(\lambda^{*}(t)\) were derived by substituting them into Equations (36) and (37).