Efficient Simulation and Reformulation of Lithium-Ion Battery Models for Enabling Electric Transportation

Improving the efﬁciency and utilization of battery systems can increase the viability and cost-effectiveness of existing technologies for electric vehicles (EVs). Developing smarter battery management systems and advanced sensing technologies can circumvent problems arising due to capacity fade and safety concerns. This paper describes how efﬁcient simulation techniques and improved algorithms can alleviate some of these problems to help electrify the transportation industry by improving the range of variables that are predictable and controllable in a battery in real-time within an electric vehicle. The use of battery models in a battery management system (BMS) is reviewed. The effect of different simulation techniques on computational cost and accuracy are also compared, and the validity of implementation in a microcontroller environment for model predictive control (MPC) is addressed. Using mathematical techniques to add more physics without losing efﬁciency is also discussed.

Behavioral predictions can be made using mathematical models without the need to directly observe the states using expensive and time consuming physical experiments. Such predictions allow for more intelligent design of new systems, which is generally limited by the mathematical techniques used and the computational resources available. An improved modeling and simulation approach can achieve the following goals when applied to engineering systems: r More accurate predictions by using more meaningful models r Faster simulation with fewer computational resources r Optimization of design parameters r Better control, allowing aggressive performance while maintaining safety Here we focus on the application of such principles to the use of physics-based battery models in battery management systems in electric vehicles.
In recent years, battery electric vehicles (BEV) have increased in popularity to reduce the dependence on fossil fuels. Lithium-ion batteries are a popular choice as an energy storage medium for high demand applications due to their large energy density but are not utilized to their full capacity in BEV applications; operating a Li-ion battery too aggressively can lead to reduced cycle life and unpredictable thermal runaway reactions. These challenges reduce the functional capacity of the battery available for propulsion.
The consumer expects the vehicle's performance and capabilities to remain uniform regardless of the state of charge or age of the battery, as they have become accustomed to internal combustion engines. When the battery is nearly depleted, it is difficult or impossible to satisfy high power demand, which is aggravated as the battery ages. To avoid these difficulties, the BMS shuts off the battery with a large amount of energy unused, so that Li-ion batteries for EVs are greatly overdesigned and carry extra weight and volume, reducing efficiency and increasing cost. 1 Research is underway to better understand the internal limitations of Li-ion batteries including SEI layer growth, side reactions, stress-strain effects, and ohmic and diffusion resistance, [2][3][4] and current efforts exist to optimize battery charging of plug-in hybrid electric vehicles (PHEVs) to minimize cost and maximize life. 5 New materials for batteries and novel architecture designs are currently being pursued to address these issues and reduce the cost while improving safety and life of batteries. [6][7][8][9][10][11][12][13][14][15] Using detailed physics based predictive models can increase the utilization of advanced materials by allowing real-time control.
An important part in overall EV design is the BMS. The BMS controls the flow of current into and out of the battery to maximize performance of the battery while maintaining safety as shown schematically in Figure 1. The BMS uses data on current, voltage, and temperature to estimate the state-of-charge (SOC, the amount of charge that remains during this cycle) and state-of-health (SOH, the present total capacity, which diminishes with age) and maximum available power (for both charge and discharge) of the battery using a built-in battery predictive model allowing for safe operation, improved performance, and effective cell balancing. 16,17 However, the BMS works in tandem with other utilities and control systems in today's automobiles, so computational efficiency is essential. Rahimi-Eichi et al. 18 discussed that BMS is a key element to make the utilization of the battery in the smart grid and  EVs safe, reliable, and efficient. The authors conclude in their review that there is still much research and development needed in finding accurate and practical algorithms to estimate SOC, defining proper application-oriented SOH measures to accurately predict the remaining useful life and end of life of the battery. For any BMS algorithm to be used, a model which can predict battery performance must be chosen. Ideally, this would be a physically meaningful model based on electrochemical engineering principles valid across a wide range of operating conditions, 19 allowing for better predictions of detrimental behavior. [20][21][22][23][24] However, due to computational limitations, simpler reduced order models are often used. 16,[25][26][27][28][29] Once the choice of the model is determined, the BMS must be able to estimate the internal states of the battery. For models based on chemical engineering principles, several states may have to be determined, whereas circuit based models may only estimate a few states, not all of which may have a physical meaning. Accurate estimation of the internal states is essential to predict the SOC, SOH, and available power so that the full range of the capacity of the cell can be utilized. State estimation at a given time step utilizes information from previous states, previous measurements, the current measurement, as well as from any prior event (e.g. estimating the SOC when a vehicle is turned on based on the SOC when it was last turned off, possibly accounting for self-discharge). 16,25,26,28 As state estimation for BEVs and HEVs is considerably more important and more difficult than for consumer electronics, 16 sophisticated methods have been developed, the most popular being a generalized weighted least square approach 27,28 or an extended Kalman filtering approach. 16,25,26 The generalized weighted least squares predicts the internal states of the cell by minimizing the residual between the model prediction of the measured quantities and the observed values. 27,28 This approach puts more weight on the time steps nearest to the present time. Typically, the weight given to a measurement from the N th prior time step is calculated as α N where α < 1 is chosen somewhat arbitrarily to give the best results, and may even vary for different states within a model. Furthermore, weights can be modified in other ways, for example if it is determined that some measured values are unreliable. 27,28 This also provides updates of the parameter values at each time steps. 28 An extended Kalman filter approach can be used to filter out noise in the measurements and states for nonlinear systems (in contrast to the standard Kalman filter for linear systems). However, linearization is still used to simplify the model. 16 The extended Kalman filter approach uses a predictor-corrector approach to state estimation; the state value is predicted using previous data and refined when the next measurement is made. 16,25,26 The extended Kalman filter also directly provides an estimate of error of the state, 16 though inaccuracy in the cell model used can lead to overconfidence in the state estimates. 26 Chiasserini and Rao 30 presented a stochastic battery model that closely matched results obtained through an electrochemical model and used the stochastic model to explore battery management techniques that improve the battery capacity. Their simulation shows that a battery is able to deliver the maximum available capacity at the cost of a fairly small additional delay and complexity.
Optimal simulation techniques 31-34 with model predictive control for optimization 35 can improve performance of batteries in high de-mand applications. Using reformulated models and improved simulation techniques, [31][32][33][34] advanced control schemes can be developed leading to better utilization of any battery chemistry. In this paper, we examine the effect that the model and simulation techniques have on the observed error and computation time to consider the feasibility of implementation of advanced models into MPC schemes. The physics of the system dictate what is predictable and controllable; however, it is the choice of modeling and simulation techniques used which enables real-time prediction and control.
How a battery is used can have a significant impact on its overall performance. Thus, a top-down approach of optimally charging and discharging a battery will lead to increased energy storage and safety. However, the SOC and SOH of a lithium ion battery affect its performance and response to changing conditions. Also, the demand placed upon the battery, or the charging facilities available may not be constant or even known in advance. This ambiguity makes it difficult to develop a priori an optimal control scheme valid for a wide range of operating scenarios and necessitates an online system which can determine the optimal performance for a given set of operating conditions.

Current Approach and the Role of Efficient Battery Simulation
An overview of the considerations involved in the development of a suitable BMS is given elsewhere 19,36 and shown schematically in Figure 2. Here we discuss the options related to the choice of battery model and simulation techniques, and implementation into a microcontroller environment and present how identifying and implementing the best possible mathematical techniques provide alternative ways to make these steps more efficient, cost effective, and robust.
Mathematical modeling of Li-ion batteries.-In order to predict, design, and control lithium-ion batteries, the proper model must be chosen based on operational requirements which vary widely in terms of complexity, computational requirements, and reliability of their predictions. 3 As shown graphically in Figure 3, several modeling approaches for Li-ion batteries exist, but there is a tradeoff between accuracy and computational cost. An ideal model would be perfectly predictive under all operating conditions and for the entire life of the battery with minimal computational requirements. Such a model does not exist for any system, but is especially problematic for battery models due to the many coupled and nonlinear physical phenomena which exist in the battery system. Standard Approach.-Equivalent circuit models try to describe the underlying system using a representation that usually employs a combination of capacitors, resistors, voltage sources, and lookup tables. 37 Capacity fade is often represented by a capacitor with a decreasing capacity, while temperature dependence is modeled by a resistorcapacitor combination. Current research in this area includes adopting the circuit based models by continuously updating the parameters using the current and voltage data. 38 Such models occupy the lower left corner of Figure 3; they can be simulated very quickly but are not accurate outside of the operating conditions for which they were developed or as the battery grows older. The parameters also lack any physical meaning, limiting the insight that can be gained from such models.
Despite these limitations, circuit based models are incredibly popular in the BMS literature because of the very small computational requirements of simulation. In fact, it is considered among many that the use of full order models in a BMS is not feasible. 17,39,40 In order to improve the validity of circuit based models, additional components can be included to account for additional phenomena, such as diffusion resistance, 17 hysteresis, 25 temperature effects, 26,29 and selfdischarge and current inefficiencies. 29 This can be achieved by adding linear or nonlinear terms, 17 or using empirical look up tables which are functions of state of charge. 25 Plett 26 found that calculating the circuit based parameters at discrete temperatures using experimental data did not extend well to temperatures that were not used to determine the parameters. In other words, the parameters did not correlate well with temperature so that linear interpolation did not provide accurate results. This was partially rectified by assuming the parameters were a fourth-order function of temperature. 26 Other approaches have used reduced order models based on physical models to incorporate capacity fade effects, such as lithium plating 39 and solid electrolyte interface growth. 40 These are computationally cheap, but ignore the variation of the concentration and pore wall flux across the electrode. 39,40 However, such approximations likely reduce the validity of such models at high rates of charge/discharge. Advanced Alternatives.-Moving up the diagonal of Figure 3, the electrochemical engineering community has long employed continuum models that incorporate chemical/electrochemical kinetics and transport phenomena to generate predictions that are more accurate and meaningful than empirical models, 3,23 which can be used for parameter estimation, 41,42 optimization, 12,43 state estimation, and control 36 with more confidence than circuit based models. Including additional physical phenomena in a model increases the computational cost in terms of both solution time and memory. Numerical methods often are required as most battery models cannot be solved analytically. The mathematical method used to solve the system of equations can also have a significant impact on the computational cost of simulation. Single Particle Model.-The single-particle model (SPM) is a simple model that represents each electrode as a single particle 20 and considers diffusion in the solid phase, but neglects solution phase effects. [44][45][46] The governing equations for the SPM are given by describing the diffusion of lithium in an active particle: with boundary conditions where the pore wall flux is given using Butler-Volmer kinetics Battery models are typically solved efficiently using the method of lines in which discretization of the spatial derivatives results in a system of first-order differential algebraic equations (DAEs) 33,34 that can be solved using optimized solvers for initial value problems. DAEs can be difficult to solve because the initial conditions must be consistent with the algebraic equations, which causes many solvers to fail if inconsistent conditions are provided, especially when nonlinear algebraic equations are considered. Techniques for initialization have been presented elsewhere and will not be discussed here. 47,48 Using the SPM with N = 15 node points in each electrode results in a total of 34 DAEs. This model can be quickly simulated, and has been used to predict capacity fade due to the growth of the SEI layer, 20 which makes the SPM a good choice as an initial attempt for implementation in a microcontroller environment. The single particle model has been validated for rates up to a 1C rate of discharge, but the assumptions are not valid at higher rates or thick electrodes where variations in the electrolyte phase are important. 44,45 The SPM can be further reduced if a parabolic profile approximation in the solid phase. 49 This only tracks the average and surface lithium concentration in the solid phase, reducing the system to only 4 DAEs that must be solved. This makes the SPM very efficient for use in a BMS for low power applications. However, for applications in which higher rates are experienced, a more comprehensive model is needed to accurately estimate the internal states to develop aggressive control strategies. Electrochemical engineering models.-The pseudo-two-dimensional (P2D) model is a more detailed physics-based model that considers the electrochemical potentials within the solid phase and electrolyte along with lithium concentration in both the solid-and liquid-phases, 23 and is flexible enough to include additional physical phenomena as understanding improves. 21,45,[50][51][52][53][54][55][56][57][58][59] The improved predictive capability of the P2D model has contributed to its popularity among battery researchers but it has two independent spatial variables: x to track the variables across the thickness of the cell sandwich, and r to track the lithium concentration radially in the solid electrode particles. 23 Having multiple spatial variables increases the dimensionality of the problem, which greatly increases the number of equations to be solved (and computational requirements) if a finite difference approach is used to discretize both the x and r directions. If 15 node points are used in the radial direction, 50 node points across each electrode, and 25 node points for the separator, nearly 2000 DAEs must be solved. Therefore, appropriate mathematical techniques are required to reduce computational time and memory requirements in order to allow the model to be implemented in a microcontroller environment. 31,42 This high computational cost of simulation has motivated researchers to develop techniques to simplify the battery models and enable faster simulation. For example, proper orthogonal decomposition has been used to reduce the total number of states simulated. 60 Quasi-linearization combined with a Padé approximation has also been used to simplify the model and improve simulation. 61 Conversely, many commercial software packages, such as COMSOL, 62 Fluent, 63 etc. use well understood numerical methods to solve ordinary differential equations (ODEs) or partial differential equations (PDEs). However, many node points, control volumes, or elements are required for convergence. These methods are robust approaches for solving the problem, but the resulting set of algebraic or differential-algebraic equations can number into the thousands and is computationally expensive, even for linear problems, and is difficult to implement into a microcontroller or other resourcelimited environment. Furthermore, many commercial solvers are overdesigned in order to handle a wide variety of problems with minimal input from the user. They do not exploit the structure and unique characteristics of the underlying models, which can be used to improve the computational performance without compromising on the robustness.
In order to reduce the number of DAEs that must be solved for the P2D model, the reformulation methods described previously for the SPM can be implemented for the solid phase diffusion in the P2D model. Using the parabolic profile approximation for the concentration profile in the radial direction, the number of DAEs can be significantly reduced, thereby improving computational efficiency. 34 For the case with 50 node points across each electrode and 25 node points for the separator, roughly 500 DAEs must be solved, much less than the 2000 for a full finite difference approach. The parabolic profile approximation is valid for long times and low rates, but has inaccuracies when there is a large gradient in the solid phase particles, which become significant for rates greater than about 4C. 34 Ramadesigan et al. 32 developed a mixed finite difference (MFD) approach for the solid phase using unequal node spacing across the radius of the particle so that fewer node points are required to achieve convergence at high rates. 32 The equivalent MFD solution results in approximately 1000 DAEs. Using higher order approximations for the concentration profiles in the radial direction can also be used for greater accuracy at high rates while minimizing the computational requirements.
Reformulation in the x-direction can also be applied to further reduce the computational demands of simulation. Spectral methods have faster convergence than finite differences so that fewer equations are required, but require more up-front work for implementation and the resulting system of equations is not sparse, unlike for the finite difference method. In spectral methods, the unknowns are approximated as a series solution of trial functions, such as cosines, with time-dependent coefficients. The coefficients are determined by minimizing the residual of the governing equations across the domain typically by using the Galerkin or orthogonal collocation (OC) methods, 31,64 though OC can better handle non-linear parameters as the integrations required for the Galerkin approach are computationally prohibitive.
Since each dependent variable is approximated as a series solution, it may be possible to solve some equations analytically a priori. Symbolic math tools such as Maple 65 or Mathematica 66 can play an important role in solving for unknown variable to reduce the number of equations that the solver must compute. However, this can increase the complexity of the remaining equations, so testing is often required to determine if this approach is indeed advantageous. Using a single non-constant term in the series approximation coupled with the parabolic profile approximation in the solid phase can provide reasonable results (see Figure 4 and Table II) with only 21 DAEs.  Table II shows the simulation time and numerical error for several simulation schemes using the FORTRAN solver DASKR 67 run on a 3.33 GHz, 24 GB RAM machine for a 1C discharge. The use of the SPM provides faster simulation, but the average error is large compared to any of the P2D simulations due to the limitations of the model itself. Note that the same physical parameters and values used in the P2D model were used in the SPM. It is possible that including a correction factor to account for the electrolyte resistance would provide a better accurate fit. Graphically, Figure 4 shows the voltagetime curve as predicted using the lowest order models considered for implementation in a microcontroller. It is readily apparent that the reformulation approach provides the most accurate results. Conversely, the low order finite difference solutions deviate significantly from the full order solution. The SPM solution predicts a significantly higher voltage for the entire discharge due to its neglect of electrolyte phase resistance, but all the models considered do predict the total capacity reasonably accurately. Importantly, model reformulation reduces the computational time of the P2D model to be comparable to SPM and circuit-based models which makes the implantation of such models into a BMS practical. Furthermore, using reformation allows for the possibility of using more detailed models (moving further up the diagonal in Figure 3) in a BMS. For example, thermal effects can be included, and/or a P3D model could be used to account for the spatial variation parallel to the electrodes. Additionally, for state of health estimates and life modeling, capacity fade mechanisms must be included in the model at increased computational cost, making reformulation even more useful. Table I shows the relationship between the choice of models and possible functionalities of the BMS to provide more clarity about the advantages of using a detailed physics based models in BMS. Empirical and circuit based models can optimize conditions which describe the cell as a whole, for example, the cell voltage, or total SOC. Using the single particle model allows for constraints to be applied to electrode averaged variables, such as anode or cathode SOC. The porous electrode model allows for objectives to be set on local values of SOC or potential, as well as other variables. Applying constraints to local variables can be very important, especially at high rates which can cause significant variations across the electrode. Under such conditions, the average values may suggest that there is nothing to be concerned about, but there may be areas within the electrode that experience conditions which are detrimental to performance and/or life. Inclusion of the stress and other effects into the single particle framework allows for constraints to be implemented to reduce capacity fade in the cell, 68 while inclusion of the same phenomena into the P2D framework allows from local variation to be accounted for, so that the maximum stress development can be minimized. Under conditions with high spatial variation, the maximum stress (as predicted by the P2D model) may be much larger than the average stress (as predicted by the single particle model). As fracture and capacity fade occur at any point which exceeds the yield stress, the maximal stress is a more important metric to predict internal damage than average stress. In general, more detailed models allow for aggressive, safe operation of batteries by utilizing physics based local constraints. However, this comes at a computational cost and efficient simulation helps bring more physics models to real-time simulation and control for the BMS.
The use of detailed physics based models in a BMS enables the ability to provide additional charge and discharge constraints on the system to maximize performance. For example, circuit based models can enforce a terminal voltage conditions on the battery on charge and discharge. The specific cycling window varies with the specific chemistry used, but is typically constrained to 3 < V < 4. Using the single particle model, however, allows for voltage constraints to be set for each individual electrode. This can be critical at the anode as lithium plating occurs when the overpotential at the anode when η anode < 0 V vs. Li/Li + which can result in severe capacity fade and possible dendrite formation. Conservative charging protocols can alleviate this problem if using circuit based models, but using a model which can directly estimate the overpotentials can provide the confidence needed to be more aggressive. The importance of considering lithium plating has led to the development of reduced order models which account for lithium plating from a control perspective. 39 Although this can be seen as improvement over circuit based models, such a reduced order approach makes several assumptions, such as neglecting variation across the electrode, 39 which makes it invalid at higher rates of charge.
As an example, the reformulated P2D model was used to develop an optimal charging profile to maximize the total amount of charge stored subject to a maximum charging rate and a limited charging time. To ensure that lithium plating does not occur, the additional constraint of η anode > 0 V vs. Li/Li + at all points in the electrode throughout the charging time is enforced. Furthermore, constraints are applied on the solid phase concentration in the anode and cathode to maintain reasonable limits. By applying constraints directly to the overpotential, it is not necessary to apply a constraint on the overall cell voltage,  allowing for higher voltages to be used. The optimal charging profiles are given in Figure 5 with maximum charging rates of 2C, 2.5C, and 3C and compared to traditional constant-current constant-voltage charging (CC-CV). Clearly the optimal charging profile allows for greater charge storage by allowing for the maximum current to be applied for a longer time. Although the optimal charge curves are qualitatively similar to the constant-current constant-voltage charge curves, the voltage-time curves given in Figure 6 show that a constant potential condition is never applied, but are allowed to continually increase. Rather, a constant overpotential is applied, as shown in Figure 7, and the anodic overpotential is never < 0 V, thus safe operation is maintained. The overall cutoff voltage of 4.2 V is overly conservative. Furthermore, overpotential increases during the constant voltage portion of the CC-CV charge, suggesting that more aggressive charging could be applied. This allows for a higher charging voltage to be used. Importantly, such an aggressive charging profile begins to deplete the lithium available in the cathode. Thus, the inflection point in the current at the end of discharge is due to the bounds enforced on the solid-phase concentration in the cathode. This results in a sharp drop in applied current to ensure that the cathode is not overcharged (i.e. by removing too much lithium from the metal oxide lattice, such that the process is not reversible). This allows the cell to relax to an extent, as shown by the increasing overpotential and decreasing cell voltage, while still applying some small amount of charge. Being able to accurately estimate the overpotential in a lithium-ion cell is critical for estimating the amount of power that can be delivered or received by the cell. We showed that applying a cutoff to the cell voltage limits the amount of charge stored. Thus, during a regenerative breaking event, for example, constraining the overpotential rather than cell voltage can allow more energy to be supplied to the battery, especially in conditions in which the cell is nearly fully charged already. Allowing more power to be sent to the battery directly increases the overall efficiency and utilization and reduces the braking energy which must be dissipated as heat. Importantly, the overpotential cannot be directly measured, so an accurate model with effective state-estimation techniques is required if a BMS is to perform such aggressive charging.
Furthermore, Figures 8, 9, and 10 show the current-time, voltagetime, and overpotential curves for a 3.5C rate of charge for optimal charging and for CC-CV charging. In this case, the CC-CV charge results in a negative overpotential at the anode. This can result in lithium-plating as an undesirable side reaction, and ultimately reduce the lithium available for cycling. By using a model which can account for the overpotential, the occurrences of such events can be minimized. Although the optimal charging profile does not apply the maximum charge for as long as the CC-CV approach, the rate of decrease is less, so that more charge is being supplied by the end of charge in the optimized case.
It is possible that such a constant-current constant-overpotential charge may cause increased capacity fade, and thus may not be ideal for all conditions, but can improve the amount of charge that can be stored in a short time.
The reformulated P2D model allows for variation to be considered across the electrode in real-time, without the need to make assumptions reducing the physics significantly. This model can be further extended to include additional physical phenomena, including SEI layer growth. For example, the electrolyte concentration difference across the battery can be constrained to be less than a specified value. This can improve energy efficiency by reducing the diffusive resistance that must be overcome on during charging and discharging. Of  course, maintaining the concentration gradient to be within a certain amount can reduce the total amount of power supplied to the battery, which highlights the tradeoff between total power and efficiency and safety. The energy efficiency of battery systems can be much lower at high rates due to the large internal resistances which cause a large amount of heat to be generated in the system. Thus, it may be advantageous to charge a cell at a lower rate, if the downsides of high-rate charging outweigh the benefits. A BMS which accounts for all these phenomena can be used to improve efficiency and performance, and ensure safety and longevity.
Implementation into a microcontroller.-In order to use any battery model in a BMS, the model must be able to be simulated in a microcontroller in real-time. Because of the limited resources available, the smallest forms of discretization are considered for the finite  difference and orthogonal collocation approaches, although Table II shows that these low-order models are not particularly accurate. When using finite difference solutions, this involves using only a single point within the interior of each region (i.e. the cathode, anode, and separator), as well as at each boundary for a total of 7 node points considered. When collocation is used, the lowest order form uses only a single cosine term for each unknown in each region and requires 2 collocation points in each region for a total of 6 collocation points. Three computational platforms are chosen to compare the runtime of battery models with varying levels of computational resources: Platform 1 is a PC and Platforms 2 and 3 are microcontrollers. Table III summarizes the performance of simulating a complete discharge in the microcontroller environments. Using a numerical Jacobian instead of an analytical Jacobian reduces the RAM requirements but slows the code by a factor of 3 to 5. While the analysis in this paper shows that reformulated model allows for more accurate and faster simulation of the P2D battery models, a similar gain in CPU time and memory are expected for real-time model-base optimization schemes for state estimation and optimal control of batteries, which will be considered as future work. Though a BMS cannot alter the internal resistances directly, the optimal profile calculated using detailed physics-based models will consider the effects of electrolyte concentration variation across the electrode thickness and provide for the ideal solution as demonstrated elsewhere. 3 This is not captured in the SPM, further reducing the validity of the model for use in a BMS.

Future Directions
This paper focused primarily on the advantages of reformulating the battery model to reduce the memory requirements while maintaining (or improving) accuracy in order to drive electric vehicle design and development. However, that is only part of the full package that must be in installed in a BMS based on highly detailed models. The ODE/DAE solver is also critical for the successful development of a BMS, as it directly affects the speed, robustness, and memory requirements. Additionally, the optimizer used in real-time estimation and control algorithms can be similarly refined to satisfy the requirements for use in the microcontroller. 35 Future work will be to design new solvers or parse down existing solvers to further reduce the overhead required to perform simulations in a microcontroller environment. For comparing solvers in a desktop computer environment, DASKR 67 /IDA 69 can be used in full form, but they are not optimized for implementation in a microcontroller. A general-purpose code can be trimmed by removing parts of the code never used when solving battery models for use in a microcontroller. Such an approach requires careful testing in the computer to maintain robustness, but can reduce the RAM and/or flash memory requirements by 50% or more. Similar or better gains are expected by trimming optimizers such as IPOPT. 70,71 In our opinion, future research in mathematics that can contribute to more detailed physics-based models in BMS include: (1) Adaptive solvers in time that can handle index-2 and index-3 DAEs with parallel sparse solvers with possible options to solve nonlinear equations based on Jacobian-free methods (e.g. Newton-Krylov) for ill-conditioned systems with low precision. (2) Compilers that convert and optimize a given procedure for a specific microcontroller environment. Today any given procedure can be converted in a computer algebra system like Maple 65 to C. However, the conversion is done without any input on the platform to be used. (3) As of today, most control vector parameterization (CVP) approaches for optimization rely on black box solvers and use robust optimizers that apply to many classes of problems. Future research would choose a particular set algorithms for the battery model both for numerical solution (as shown in this paper) and optimization based on the structure of Hessian and constraints imposed by the model and the objective function. 72 (4) Adaptive solvers that can directly take and handle hierarchical models. For example, solvers that would simulate the P2D model in an inner loop and, if that solver fails, simulate the SPM in an outer loop to provide results. As of today, it is trivial to do this for constant step size solvers but the simulations need to be performed with adaptive time steps and varying order for accuracy.

Conclusions
In 1985, H. Lomax quoted that "there are at least two ways to combat stiffness. One is to design a better computer, the other to design a better algorithm." 73 Models for batteries result in ill-conditioned stiff nonlinear differential algebraic equations. Algorithms have matured for integrating in time and computing power has increased. The limited resources available in a microcontroller require modeling and simulations to be performed as efficiently as possible to take advantage of the predictive power of first-principles based models. With this paper, we would like to summarize that improved simulations can enable "including more physics in the microcontroller by identifying, applying and reformulating (reducing) the model equations to its best possible discretized form" and thereby making batteries in EV a reality.
Mathematical techniques applied and tailored for a specific battery model can be used to drive the development and application of lithium-ion batteries in EVs. Furthermore, model-based control requires a physics-based model valid across a wide range of operating conditions. In order to simplify physics-based models, mathematical techniques can be used to reduce the computational demands. These reduced computational demands lead to more accurate but robust models that can be implemented into a BMS without using expensive hardware, allowing for better control and more confident prediction of internal states and future behavior. With such a control scheme in place, the battery of an EV can be fully utilized, reducing weight and improving performance.