# Development of Path Planning Tool for Unmanned System Considering Energy Consumption
## 4 Mathematical Modeling of the UAV and Battery Pack
### Battery Pack
#### 4.2.3 SOC and Sop State Estimation  
The SOC estimation is performed using the EKF for each cell. For the EKF algorithm application, Equation (21) and SOC calculation based on current integration method are fused and converted into the discrete-time state space model as  
\[ \begin{array}{l}\left[\begin{array}{c}v_{c1}\\ v_{c2}\\ z\end{array}\right]_{\!\!k}=\left[\begin{array}{ccc}e^{-\Delta t/\tau_{1}}&0 &0\\ 0&e^{-\Delta t/\tau_{2}}&0\\ 0&0&1\end{array}\right]\left[\begin{array}{c}v_{c1}\\ v_{c2}\\ z\end{array}\right]_{\!\!k}+\left[\begin{array}{c}R_{1}\Big{(}1-e^{-\Delta t/ \tau_{1}}\Big{)}\\ R_{2}\Big{(}1-e^{-\Delta t/\tau_{2}}\Big{)}\\ \eta\Delta t/\left(3600Q_{norm}\right)\end{array}\right]_{\!\!k}i_{0,\!k}+ \left[\begin{array}{c}n_{w1}\\ n_{w2}\\ n_{w3}\end{array}\right]_{\!\!k},\end{array}  \tag{22}\]  
where \(z\) is the SOC (\(\%/100\)), \(\Delta t\) is 0.1 s, and \(n_{wi}\) and \(n_{vi}\) are system and measurement noises (V), respectively. Here, the term \(z\) can be calculated as \(z(t)=Q_{\text{init}}+\eta i_{0}(t)/Q_{\text{norm}}(t)\) where \(Q_{\text{init}}\) is the initial battery capacity (Ah), \(\eta\) is the battery efficiency (assumed as 1), and \(Q_{\text{norm}}\) is the current battery capacity (Ah). Figure 8: Battery modeling; (**a**) two-ladder battery equivalent circuit model (ECM); (**b**) impedance voltage response. With an initial estimation vector, \(\hat{x}_{0}\), and covariance vector, \(P_{0}\), the estimation vector and covariance vector can be propagated using  
\[\hat{x}_{k+1}^{-}=f(\hat{x}_{k}), \tag{23}\] \[P_{k+1}^{-}=A_{k+1}P_{k}A_{k+1}^{T}+Q_{k}.\]  
The Kalman gain, \(K_{k}\), can be calculated as  
\[K_{k+1}=P_{k+1}^{-}H_{k+1}^{T}\big{(}H_{k+1}P_{k+1}^{-}H_{k+1}^{T}+R_{k+1} \big{)}^{-1}. \tag{24}\]  
With the updated Kalman gain, \(K_{k+1}\), and updated measurement, \(z_{k+1}\), the updated estimation vector, \(\hat{x}_{k+1}\), can be calculated as  
\[\hat{x}_{k+1}=\hat{x}_{k+1}^{-}+K_{k+1}\big{(}z_{k+1}-h_{k+1}\big{(}\hat{x}_{k +1}^{-}\big{)}\big{)}, \tag{25}\]  
and the updated covariance vector, \(P_{k+1}\), can be calculated as  
\[P_{k+1}=P_{k+1}^{-}-K_{k+1}H_{k+1}P_{k+1}^{-}. \tag{26}\]  
The final SOC value of the battery pack is conservatively chosen as the minimum value of each cell as  
\[SOC_{pack,k}=\min\big{(}z_{k}^{1},\ldots,z_{k}^{n}\big{)}\times 100, \tag{27}\]  
where \(SOC_{pack,k}\) is the SOC (%) of a battery pack at the \(k\)-th time step. Regarding the state of power (SOP) estimation, the maximum discharging current, \(i_{max}^{dis}\), can be calculated as  
\[i_{\max}^{dis}=C_{rate}Q_{norm} \tag{28}\]  
where \(C_{rate}\) is the C-rate of the cell (no unit). The maximum discharging current considering the SOC, \(i_{max,k}^{dis,SOC(i)}\), can be calculated as  
\[i_{\max,k}^{dis,SOC(i)}=\left\{\left(z_{k}^{(i)}-3\sigma_{z,k}^{(i)}\right)-z _{\min}\right\}C_{rate}Q_{norm} \tag{29}\]  
where \(\sigma\) is the standard deviation of the cell SOCs (%/100), \(z_{min}\) is the minimum SOC (%/100), \(\eta\) is the battery efficiency (assumed as one), and \(T_{k}-T_{o}\) is the time flown from the beginning (s). Here, 3\(\sigma\) was used for the 99.7% confidence interval of the cell SOC estimation values. The maximum discharging current considering the cell voltage, \(i_{max,k}^{dis,volt(i)}\), can be calculated as  
\[i_{\max,k}^{dis,volt(i)}=\big{|}i_{0,k}\big{|}\{v_{ocr}\Big{(}z_{k}^{(i)}\Big{)} -v_{\min}^{(i)}\}\left\{\frac{1}{\bigg{|}v_{ocr}\Big{(}z_{k}^{(i)}-v_{\min}^{ (i)}\Big{)}\bigg{|}}+\frac{1}{v_{\max}^{(i)}-\bigg{\{}v_{ocr}\Big{(}z_{k}^{(i) }\Big{)}-v_{\min}^{(i)}\bigg{\}}}\right\}, \tag{30}\]  
where \(v_{ocr}\) is the open-circuit voltage (OCV) (V), and \(v_{min}\) is the minimum cell voltage (V). Here, \(v_{min}^{(1)}=3.679\) V, \(v_{min}^{(2)}=3.660\) V, \(v_{min}^{(3)}=3.663\) V, \(v_{min}^{(4)}=3.626\) V, \(v_{max}^{(1)}=4.171\) V, \(v_{max}^{(2)}=4.176\) V, \(v_{max}^{(3)}=4.174\) V, \(v_{max}^{(4)}=4.174\) V, \(z_{min}=0\), \(C_{rate}=18\) C, \(N_{p}=1\), \(N_{s}=4\), and \(Q_{norm}=3.3\) Ah.