Soft Sensors for State of Charge, State of Energy, and Power Loss in Formula Student Electric Vehicle

: The proliferation of electric vehicle (EV) technology is an important step towards a more sustainable future. In the current work, two-layer feed-forward artiﬁcial neural-network-based machine learning is applied to design soft sensors to estimate the state of charge (SOC), state of energy (SOE), and power loss (PL) of a formula student electric vehicle (FSEV) battery-pack system. The proposed soft sensors were designed to predict the SOC, SOE, and PL of the EV battery pack on the basis of the input current proﬁle. The input current proﬁle was derived on the basis of the designed vehicle parameters, and formula Bharat track features and guidelines. All developed soft sensors were tested for mean squared error (MSE) and R-squared metrics of the dataset partitions; equations relating the derived and predicted outputs; error histograms of the training, validation, and testing datasets; training state indicators such as gradient, mu, and validation fails; validation performance over successive epochs; and predicted versus derived plots over one lap time. Moreover, the prediction accuracy of the proposed soft sensors was compared against linear or nonlinear regression models and parametric structure models used for system identiﬁcation such as autoregressive with exogenous variables (ARX), autoregressive moving average with exogenous variables (ARMAX), output error (OE) and Box Jenkins (BJ). The testing dataset accuracy of the proposed FSEV SOC, SOE, PL soft sensors was 99.96%, 99.96%, and 99.99%, respectively. The proposed soft sensors attained higher prediction accuracy than that of the modelling structures mentioned above. FSEV results also indicated that the SOC and SOE dropped from 97% to 93.5% and 93.8%, respectively, during the running time of 118 s (one lap time). Thus, two-layer feed-forward neural-network-based soft sensors can be applied for the effective monitoring and prediction of SOC, SOE, and PL during the operation of EVs.


Introduction
Electric vehicles (EV; E-mobility) are gaining wider acceptance in mainstream applications as a greener alternative to the conventional fossil-fuel-based locomotion. E-mobility is a primary focus in the global research efforts to limit and reduce the damage caused to Earth's natural ecosystems due to the effects of the fossil-fuel-based economy. The past decade has witnessed many investigations aimed towards the design, development, and deployment of E-mobility technologies for a more sustainable future. Recent efforts methodology for SOE estimation. Zhang et al. [41] established a multi time scale observer for SOE assessment. Li et al. [42] explored fractional calculus-based SOE modelling for LiFePO 4 battery. Fewer investigations were carried out for power-loss (PL) modelling in EV. In an interesting study, Elpiniki et al. [43] analysed EV PL as a function of charging rate and SOE.
This brief literature review indicates that the past investigations did not include SOC/SOE/PL soft sensor designs for FSEV applications.The exploration of effective PL estimation and modelling strategies is an open research area. Therefore, a novel research scope was identified for the current study to estimate the SOC, SOE, and PL of a formula student electric vehicle (FSEV) battery pack based on neural-network-enabled soft-sensor designs. The following section gives details of the battery-pack modelling and neuralnetwork-based soft-sensor design methodology.

Methodology
This section presents the details of the FSEV battery-pack specifications, BMS design constraints, battery-pack modelling procedure, and the soft-sensor design methodology, including neural-network implementation in MATLAB and the specifics of the ANN training algorithm. Lastly, alternative modelling structures considered in the current study for comparison with the proposed ANN soft sensors are presented.

FSEV Battery Pack Modelling
The FSEV was designed as per the vehicle characteristics specified in the Formula Bharat rule book [44]. The features of the designed vehicle (Table 1) and the Formula Bharat track parameters at the Kari Motor Speedway, Coimbatore, India were fed into OptimumLap software to obtain the required drive cycle. Drive cycle characteristics and FSEV features were put into the vehicle powertrain model created in Simulink, MAT-LAB. The powertrain model resulted in the input current profile ( Figure 1) for further computations. The charging current was limited to 20 A as an additional safety margin considering the 40 A limit specified by the cell manufacturer design guide ( Table 2). The FSEV battery pack was designed as per the constraints and specifications provided by the competition rulebook and the A123 cell manufacturer (based on real experimentation datasets) (Tables 2 and 3).   The FSEV battery pack was designed to have 90 cells connected in series, all drawing the same amount of current. In the current study, SOC was estimated for one cell assuming ideal operating conditions over one lap of the Formula Bharat track. For cell parameter estimation, the series internal resistance (R 0 ) was first approximated as per the direct current resistance (DCR) −% SOC characteristics prescribed in the A123 manufacturer design guide (based on actual experiments) [46]. The remaining cell parameters, namely, parallel internal resistance (R 1 ) and capacitance (C 1 ), were determined by mutual substitution in the following equations (also derived from actual experiments) [47,48] These R 0 , R 1 , C 1 values along with the input current profile were utilised to compute voltage drops across R 0 , R 1 and C 1 . Subsequently, these voltage drops and the input current profile were employed to obtain the total PL due to the cell components R 0 , R 1 and C 1 . Thereafter, battery pack temperature was estimated using total PL (P loss ) as per the following relation where C T is specific heat capacity (J m −3 K −1 ), and R T is convection resistance (W m −2 K −1 ) of the cell. Next, the charge capacity of the battery was estimated at all operating temperatures derived in Equation (4) as per the following relation.
On the basis of the derived temperature-capacity profile, the SOC was estimated as follows.
SOC (at time t) = initial SOC − I Capacity * 3600 dt (6) where I is the battery current, and the initial SOC was assumed to be 0.97. Next, open circuit voltage (OCV) was estimated from the experimental OCV, SOC, and temperature data sheet provided by the cell manufacturer [46] OCV = 3.149 * SOC − 7.551 × 10 −5 * T + 0.523 Terminal voltage (V t ) was obtained as follows.
where V d1 and V d2 are the potential differences across R 0 and R 1 , respectively. These voltages were determined using the following relations.
where I 0 is the current through R 0 , and I 1 is the current flowing through R 1 in the equivalent cell model. Subsequently, SOE was calculated as follows.
where P is power of the FSEV battery in watts. Nominal energy of the cell was obtained from the design data sheet [46], and the initial SOE was assumed to be 0.97. Figure 2 shows a schematic representation of the SOC, SOE, and PL estimation procedure followed in the current study. The following section gives details of the proposed soft-sensor designs for these FSEV battery parameters.

Soft-Sensor Design
Data-based modelling generally begins with preprocessing that includes data cleaning and normalization, followed by partitioning data into training, validation, and testing sets [49]. Figure 3 exhibits the two-layer feed-forward artificial neural-network architecture for the soft sensor application proposed in the current work. The two layer feedforward neural network in association with the Levenberg-Marquardt algorithm for data fitting exhibited high fitting accuracy at the cost of lesser training iterations and data points [50]. The vehicle drive cycle characteristics were applied to the input nodes I 1 (time) and I 2 (current). Weights W 1,1 , W 1,2 , · · · , W 1,10 were assigned to the connections from input node I 1 to the ten nodes in the hidden layer. Similarly, weights W 2,1 , W 2,2 , · · · , W 2,10 were applied to the connections from input node I 2 to the hidden layer nodes. The output of each hidden layer comprised the sum of the products of all input nodes to their respective assigned connection weights. All hidden layer outputs were treated with sigmoid activation function f 1 (Figure 4), defined as follows.
where x is the input to the activation function, and S(x) is the sigmoid activation function.
The connections of all activation function outputs to the output layer nodes were also assigned weights (W o,1 , W o,2 , · · · , W o,10 ). For the final predicted output, a linear activation function f 2 ( Figure 5) was applied to the summation of the products of all f 1 function outputs and their respective weights. This linear activation function is defined as follows.
where x is the input to the activation function, A is the slope of the activation function and L(x) is the linear activation function. The above modelling procedure was individually carried out for the estimations of SOC, SOE, and PL for a single cell of the FSEV battery pack considered in the current study.    Next was the stepwise implementation of the neural-network-based soft sensors in MATLAB.

1.
Load the input current profile and SOC/SOE/PL dataset for the FSEV battery pack considered in the current study.

2.
Partition the dataset into training, validation, and testing sets. The total dataset available for the current study was partitioned 70% for training, and 15% each for validation and testing (Table 4).

3.
Select the neural-network architecture for predictive modelling (two-layer feedforward network with sigmoid transfer function in the hidden layer and a linear transfer function in the output layer).

4.
Select the number of hidden neurons (selected as 10 in the present work).

5.
Train the neural network using a supervised learning algorithm (Levenberg-Marquardt).

6.
Validate and test the trained neural network. 7.
Retrain the network if performance is poor in terms of the R-squared value of the testing dataset.  Table 5 shows salient features of the feed-forward neural network architecture implemented for soft-sensor design. The following subsection provides details of the training algorithm employed in this neural network. Table 5. Two-layer feedf-orward neural-network features.

Training Method Levenberg-Marquardt
Sample division as shown in Table 4 Activation function ( f 1 ) Sigmoid function Activation function ( f 2 ) Linear function Initial weights and bias zero Input layer nodes 2 Output layer nodes 1 Hidden layer nodes 10 Performance index Mean squared error (MSE)

Levenberg-Marquardt Training Algorithm
The artificial neural network (ANN) training algorithm formulates estimation error as an objective function to be minimised through every training iteration ( Figure 6). It distributes the total estimation error among the nodal connection weights. Learning and decay rates are defined to control the upper and lower limits, respectively, of these weights. The optimization algorithm minimises the estimation error over successive training epochs. The transformation function sums up the products of input nodes and respective weights, and yields the output value in conjunction with a bias factor and an activation function. The weighted sums are scaled up to the values of the input nodes by the bias factor to guarantee that the input node values are preserved for further calculations. The activation function ensures that at least the minimal threshold of the calculated nodal outputs is contributed to the next layer [51]. The Levenber-Marquardt algorithm employs a Jacobian matrix in conjunction with the gradient vector and expresses the loss function as the sum of squared errors ( f ). 12) where N is the number of data set instances, and e is the difference between derived and predicted SOC values [52,53]. The Jacobian matrix of this loss function is composed of the error derivatives having N by P dimensions.
where i = 1, 2, · · · , N is the number of data set instances, J = 1, 2, · · · , P is the number of neural network parameters and W j is the weight vector corresponding to a particular input. The gradient vector is determined for this loss function as follows.
The Hessian matrix is approximated as follows.
where I is the identity matrix, and µ is the Hessian damping factor. Lastly, loss function parameters are improved by the algorithm as per the following expression [54].
The network training process is terminated on the basis of the algorithm meeting any one of the stopping criteria depicted in Table 6. Performance goal 0 4.
Maximal validation fails 6 For comparative analysis, the SOC, SOE, and PL of the FSEV considered in the current study were also modelled using linear regression, nonlinear regression, and parametric structures such as ARX, ARMAX, OE, and BJ models. Table 7 depicts the generalized forms of these parametric model structures widely used in the system identification of various systems. The prediction accuracy of all developed models was compared on the basis of R-squared/FIT% and mean squared errors (MSE).
Autoregressive moving average with exogenous input (ARMAX)

Results and Discussion
This section presents the various performance metrics of the proposed FSEV SOC/SOE/PL soft sensors designed on the basis of two-layer feed-forward neural networks. The comparative performance of these soft sensors with regard to the regression and parametric models is also discussed.  Figure 7 shows the regression plot of the FSEV SOC sensor performance relative to various dataset partitions. Figure 8 shows a graphical presentation of the derived versus soft-sensor-predicted SOC values over one lap time of 118 s. The graph shows that the SOC decreased from 97% at the beginning of the lap to 93.5% at the end of the lap. The soft-sensor model output closely matched that of the derived SOC. Figure 9 shows the error histogram for the FSEV SOC soft-sensor predictions. It depicts a maximal number of testing instances (around 4000) at an error bin of 1.99 × 10  (Table 6) had been attained. A low mu indicated that the Levenberg-Marqaurdt algorithm moved towards Newton's method and away from the gradient descent methodology for faster and more accurate convergence [55]. The Figure 10 validation check depicts that there was no validation fail till epoch 25. Figure 11 shows that the best validation performance of the proposed soft sensor was recorded to be a very low MSE value of 8.30 × 10 −8 attained at epoch 25. The y label of the test regression plot exhibits the following relation between derived and soft-sensor-predicted SOC.

State of Charge Soft Sensor
Output (predicted SOC) = Target (derived SOC) + 6.8 × 10 −8 (17)   The SOC of the FSEV considered in the current study was also modelled using linear and nonlinear regression as follows: Regression-Linear SOC = 0.9724 − 0.0003157 * t + 1.911 × 10 −6 * I Regression-Nonlinear The FSEV SOC was also modelled using parametric structures generally considered for the system identification of control systems.
ARX 441 A(z)y(t) = B(z)u(t) + e(t) Figure 12 shows the composite plot of R-squared (regression) and FIT% (system identification) models explored in the current study. The ANN-based soft sensor attained the highest accuracy among all models. However, the parametric models scored lower mean squared errors as compared to ANN and regression models ( Figure 13). All models attained comparable performance with regard to SOC estimation. However, ANN is capable of handling unseen data better than other structures are [56]. Therefore, the ANN-based soft sensor is expected to exhibit higher robustness in real-time applications involving system variations and dynamic operating conditions. The ANN modelling procedure incorporates the partitioning of data into training, validation, and testing sets, ensuring the reliable predictability of the final model. Other modelling techniques such as regression and system identification do not provide this advantage, making them inferior to ANN with regard to soft-sensor applications.   Table 10 shows the input weights, output weights, and biases optimised for the twolayer feed-forward FSEV SOE soft sensor.  (Table 9). Nevertheless, the SOE soft sensor attained perfect R squared values of 0.9996 for all datasets. Figure 14 shows the regression plots for the SOE testing, training, and validation datasets. SOE soft-sensor prediction was determined to be correlated with the derived SOE values as follows.

State of Energy Soft Sensor
Output (predicted SOE) = Target (derived SOE) + 4 × 10 −4 (20)   Figure 15 shows the plots of derived and predicted SOE outputs for one lap time (118 s) as per the FSEV drive cycle. It is evident that the predicted SOE plot closely matches the derived SOE curve. The figure shows that the SOE dropped from 97% to approximately 93.8% during one lap time period. The final SOE was slightly better than the SOC (93.5%) at 118 s. Figure 16 shows the error histogram for the SOE soft sensor. The maximal number of testing error instances (around 2500) were generated at the error value of 3.88 × 10 −5 . More than 2000 testing error instances were detected at the −6.5 × 10 −6 error bin. Other major instances numbered approximately 2000, 1900, 1800, and 1700 corresponding to error values of 1.43 × 10 −4 , 2.47 × 10 −4 , 1.7 × 10 −4 and 2.7 × 10 −4 , respectively. The remaining testing error instances measured approximately 1500 or lesser for bins corresponding to 3.51 × 10 −4 , 4.55 × 10 −4 , 3.8 × 10 −4 , and 4.8 × 10 −4 . Thus, the majority of testing error instances were found at very low values of deviations, confirming the high prediction accuracy of the developed SOE soft sensor. Figure 17 shows the training state indicators for the SOE datasets. The gradient settled at a value of 9.574 × 10 −8 at epoch 32, triggering the stopping criterion of the training algorithm. The mu finished at 1 × 10 −10 , whereas there were zero validation fails till the epoch 32. Figure 18 indicates that the best validation performance for the FSEV SOE soft sensor was achieved at 7.4901 × 10 −8 corresponding to epoch 32. The validation performance of the SOC soft sensor (8.30 × 10 −8 ) was superior than that of its SOE counterpart. As discussed in the case of SOC modelling, the FSEV SOE was also modelled using regression and system identification methods for performance comparisons with the proposed ANN-based soft sensor: Regression-Linear Regression-Nonlinear ARX 441 A(z)y(t) = B(z)u(t) + e(t) ARMAX 2221 A(z)y(t) = B(z)u(t) + C(z)e(t)  Figures 19 and 20 depict the composite plots of R-squared/FIT% and mean squared errors of the explored models respectively. The R-squared metric of ANN was once again superior to that of all other model structures. However, its mean squared error is significantly higher at 7.4276 and was not included in Figure 20 to allow for the better visual comparison of the MSE of the remaining models. Figure 20 shows that system identification-based parametric models achieve lower mean squared errors than that of their regression counterparts.   Table 12 shows the final input weights, output weights, and biases obtained for the two-layer feed-forward FSEV PL soft sensor design. Table 13 shows the details of the R-squared (0.9999) and MSE values for the training (MSE 5.74 × 10 −3 ), validation (MSE 5.76 × 10 −3 ), and testing (5.55 × 10 −3 ) sets of the FSEV PL data. The FSEV PL soft sensor attained higher R-squared metrics over the SOC as well as the SOE soft sensors. Its MSE values fared better than those of the SOE neural network but poorer in comparison to the SOC soft sensor. Figure 21 shows the PL soft-sensor regression plots under the various dataset partitions. The y label of the test regression plot indicates the following relation between output (predicted) and target (derived) PL values.

Power-Loss Soft Sensor
Output (predicted PL) = Target (derived PL) + 4 × 10 −4 (23)   Figure 22 shows the extremely nonlinear behaviour of the PL (watts) spikes experienced by the FSEV during one lap of the designated track. This figure depicts the dynamic effects of charging and discharging cycles of the FSEV battery on PL characteristics. In spite of the depicted power fluctuations, the proposed neural-network-based PL soft sensor can accurately follow the actual output throughout the lap. Figure 23 shows the error histogram of the data predicted by the PL soft sensor. It depicts the maximal number of testing data instances (around 10,000) at the error bin of −0.01007 followed by comparatively lower instances at 0.03951 (around 4000) and −0.05965 (approximately 2500) bins. The remaining error bins (0.08909, 0.1387, −0.1092 and others) contained lesser instances. The error histogram shows the concentration of a majority of testing error instances at low magnitudes contributing towards the almost perfect predictability of the proposed FSEV PL soft-sensor design. Figure 24 presents the training state indicators for the PL soft-sensor generation. In this case, the training algorithm is terminated at epoch 211 because of reaching the maximal number (6) of validation fails permissible ( Table 6). The gradient and mu at epoch 211 were 0.0034063 and 0.0001, respectively. Figure 25 shows that the best validation performance of the proposed PL soft sensor was recorded at 0.00057628, attained at epoch 205. This value was comparatively higher than the best validation performance metrics of the SOC and SOE soft sensors.  Below are the regression and parametric model structures explored for the FSEV PL considered in the current work: Regression-Linear Regression-Nonlinear ARX 441 A(z)y(t) = B(z)u(t) + e(t) ARMAX 2221 A(z)y(t) = B(z)u(t) + C(z)e(t) Figures 26 and 27 show the R-squared/FIT% and mean squared errors of the FSEV PL models. The ANN and nonlinear regression PL models attained near perfect prediction accuracy. Linear regression and OE models achieved comparatively worse estimation performance. The mean squared error of the linear regression model was 47.7908 and is excluded from Figure 27 to allow for visual comparisons among the MSEs of the remaining models.

Conclusions
In the current work, two-layer feed-forward neural networks were employed to develop soft sensors for estimations of SOC, SOE, and PL in an FSEV. The FSEV batterypack system was first designed on the basis of the formula student competition guidelines. It included the construction of an FSEV powertrain model in MATLAB Simulink based on the designed vehicle and track parameters. The required input current profile for a single cell was obtained from the powertrain model and was utilised in conjunction with the cell parameters to derive the total PL over the circuit components. The total PL was used to yield the operating temperature and capacity; capacity was utilised to derive the SOC as per the current profile required by the powertrain model. Similarly, the SOE was determined using the input current profile and the terminal voltage (computed on the basis of the OCV). Lastly, the input current profile and derived SOC/SOE/PL datasets were loaded into separate two-layer feed-forward artificial neural-network-based soft-sensor designs. All developed soft sensors were tested for MSE and R-squared metrics of the dataset partitions; equations relating the derived and predicted outputs; error histograms of the training, validation and testing datasets; training state indicators such as gradient, mu and validation fails; validation performance curves over successive epochs and predicted versus derived plots over one lap time. Moreover, the performance of the proposed soft sensors was compared to predictions obtained by linear or nonlinear regression and the parametric models used in the system identification of complex systems. Below are the performance highlights of the proposed soft sensors.
The R-squared prediction metrics of the proposed ANN-based soft sensors were superior to the R-squared values of the linear or nonlinear regression models and FIT% of the system identification-based parametric models. 4.
The mean squared errors of the parametric model structures were lower than those of the ANN and linear or nonlinear regression models (except for the OE 221 PL parametric model).

5.
The Thus, two-layer feed-forward neural-network-based soft sensors can be effectively utilised to monitor and predict the SOC, SOE, and PL profile of an FSEV. The future scope of this work includes the modelling and estimation of other EV parameters such as regenerative power.