February 17th, 2017 by Mahdieh Mehrabi
Written by: Raees B. K. Parambu – project Engineer
Download a copy of this article as a pdf: Dymola Modelica: Tips & Tricks – Part 1: ‘Li-ion Battery Partial Modelling and Parameterisation’
This article is aimed to present a methodology to develop a partial acasual equivalent-circuit based model (ECM) of Lithium-ion (Li-ion) battery in Dymola, and its component parameterisation method using manufacturer’s datasheet available online.
Owing to high energy densities and terminal voltage up to 4.2V, nowadays Lithium-ion (Li-ion) based batteries are widely used in both Electric vehicles (EVs) and plug-in EVs (PHEVs) . For obtaining a desired voltage or power, their battery packs are made up of hundreds to thousands of individual cells . Battery management system (BMS) is an inevitable part of reliable and efficient operation of these vehicles and their battery packs, under a wide range of operating conditions , but it relies heavily on battery models.
Battery models can be created in relation to their applications. Among others, the two major classifications are electrochemical  and electrical  battery models. An electrochemical  battery model is one based on the first principles-based modelling approach. It uses a set of partial differential equations (PDEs) and an algebraic equation to represent the dynamic behaviour of batteries with high accuracy. On the other hand, electrical or equivalent circuit-based models (ECMs)  are simple in construction, but depends heavily on available test data, thus less accurate and mostly represented using equivalent circuit elements. Both modelling methods have a trade-off between accuracy and performance. Because of its simplicity, this article focusses only on ECM.
In the literature, an efficient acausal ECM is developed using two sets of laboratory test data and implemented on an advanced systems-engineering tool, Dymola . On one hand, the data required for such a modelling approach is from (1) an Open-circuit-voltage (OCV) discharge  and (2) Hybrid Pulse Power Characterisation (HPPC)  tests for representing both static and dynamic parts of battery operation respectively. However, battery manufacturers’ datasheet available online does not provide these details. On the other hand, Dymola (Dynamic Modelling Laboratory) is a systems engineering tool for modelling multi-engineering multi-physical complex systems based on the open Modelica (an equation-based object-oriented) modelling language. In addition to the Modelica function (a specialised Modelica class) available in the Modelica Language specification guide , Dymola also provides several built-in functions (routines) and operators  for improving the modelling capabilities and post-processing of simulation results. This article utilises these facilities for modelling and parametrisation process. The aim of this article is to present a methodology to build a partial acasual ECM of Li-ion battery and parameterisation of its OCV component using manufacturer’s datasheet available online in Dymola.
Li-ion Battery Partial Modelling (OCV Part Only)
As previously mentioned, there are at least two types of battery models available in the literature for predicting the performance of Li-ion batteries. However, a simple ECM of a Li-ion battery can easily be developed by modifying the RC-circuit presented in our previous blog . This simple ECM consists of voltage source (Vocv), series resistor (Ro), and a pair of parallel resistor-capacitor (RC) with a constant current load (Load) as shown in Figure 1. Battery modellers are likely to use parameters of Ro and RC components as a function of temperature (T), current rate (C-rate) and state-of-charge (SOC) or depth-of-discharge (DoD), but, OCV depends only on temperature and SOC.
Figure 1: A simple ECM of Li-ion Battery with a constant current load.
For representing the OCV vs SOC relationship in the battery model, in Figure 1, a variable voltage source is used and its input is kept open for modifying this circuit later. As aforementioned, this article does not cover the entire processes of building a full Li-ion battery model and its parameterisation methodology. Consequently, certain components in the model are greyed out and will not be used in this work.
A more appropriate model in the context of estimating the OCV-SOC relationship for the selected battery type based on manufacturer’s test data is provided in Figure 2.
Figure 2: A modified model of a Li-ion battery for estimating SOC.
Compared to Figure 1, in Figure 2 a couple of components are added and removed. The added components include a SOC estimator, 1D lookup table and additional sensors, and the removed components include RC pair and a sensor. A ‘terminateSimulation’ component is used in the model in order to stop the simulation process when a certain condition is met.
The SOC of the battery is defined as the percentage of obtained capacity to the rated or typical capacity of a cell.
Whereas, I is the discharging current, t0 is the start and tf is the end time of the discharging process.
In equation (1), , is the typical capacity of the cell, defined as the total charge can be obtained from a fully charged battery under a manufacturer’s specified test conditions, normally expressed in (milli) Ampere hour ((m)Ah)).
Both SOC and DOD equations are implemented in sOC_Estimator in Figure 2. The DOD is defined as below,
The voltage of the cell is defined as
where, I is the load current and Ro internal resistance of the cell. In literature, for developing the OCV part of battery model it is not required to have an internal resistance in the model, but because of lack of sufficient OCV test data, we use an internal resistance with very low resistance. Details are provided in the next section.
OCV Discharge Test Data and Extraction Method
OCV Discharge Test Data
The OCV can be defined as the terminal voltage of a battery when there is no external load applied to it. It is a crucial part of the battery model for accurately estimating SOCs of the battery. However, for measuring the OCV there must be a charge depletion/restoration process. This charge depletion process can either be done by applying a very small constant discharge current (normally, C/25), known as pseudo OCV test , or by OCV pulse discharge test . However, datasheet available from almost all battery manufacturers do not provide this information. Rather, they provide constant-current (CC) discharge characteristics of battery at various C-rates and at different temperatures, in addition to charging and cycle-life characteristics. One such CC discharge characteristics data from Panasonic NCR-18650A based cell type  is shown in Figure 3 and chosen for modelling purpose.
Figure 3: Discharge Characteristics of NCR-18650A cell from Panasonic  at different C-rates.
In Figure 3, the minimum C-rate applied for discharging the tested battery is higher than the one required for modelling battery OCV. As mentioned in the last section, because of the lack of suitable OCV test data at very low discharge rates, we choose a R0 resistor with an assumed value of 0.0013 Ω  in the presented model in Figure 2. This helps to estimate the OCV vs SOC characteristics of battery using equation (1) in the model.
OCV-SOC Extraction Method
The entire OCV-SOC extraction method consists of the following 8 steps shown in Figure 4.
Figure 4: Flow chart of OCV-SOC data extraction process.
The flow chart above shows that the OCV-SOC extraction process start with the extraction of number of digitalised points of voltage versus discharge capacity (mAh) at 0.2 C from Figure 3. These discrete points are then saved in .csv file. These steps can be repeated for other C-rates as well (such as at 0.5C, 1C and 2C) for modelling of a full battery model. Such a full order model may only be suitable for steady-state operation. A function called processOCV is created using the Modelica function class. This created function has an ability to accept the saved .csv file(s), convert voltage vs discharge capacity data to OCV vs SOC curve and save into .mat file. This saved .mat file is then used in 1D CombiTable (OCVSOC_table) of the battery model in Figure 2. Finally the model is simulated and the results comparison is provided in the next section.
Result & Discussion:
Figure 5 depicts that both estimated (green line) and test (blue line with dot) OCV curves match well, however, when zooming into Figure 5, Figure 6 shows a slight difference between the cell voltage and estimated OCV due to the addition of a small resistance in the R0 component.
Figure 5: Comparison of estimated and test OCVs with a current rate of 0.2C
Figure 6: Zoomed portion of Figure 5.
One can adapt this model to capture the additional discharge characteristics available in Figure 3. By replacing the constant R0 element in Figure 2 with a variable resistor and 1D CombiTable, one can represent R0 as a function of SOC and C-rates. The same model can also be adapted to include the dynamic effects by incorporating RC pairs as shown in Figure 1, but HPPC test data is required. An alternative interest in battery modelling is incorporating a thermal model to predict the temperature of the battery. All these can be easily included because of the acausal nature of Dymola model.
This short article presented a step-by-step approach to build a partial acausal ECM of Li-ion battery and parameterisation of its OCV component. Both test data and estimated OCVs matched very well and several limitations and caveats of the model were briefly discussed. A potential improvement to the model is also highlighted in the end. For more information about how to use your own data to build an acausal ECM of Li-ion battery, please contact Claytex Services Limited.
Please get in touch if you have any questions or have got a topic in mind that you would like us to write about. You can submit your questions / topics via: Tech Blog Questions / Topic Suggestion