Modeling and simulating dynamics of lithium-ion batteries using block-oriented models with piecewise linear static nonlinearity

. The article deals with the research of the efficiency of modelling the dynamics of voltage change in lithium-ion rechargeable batteries in charging/discharging modes using nonlinear block-oriented systems. Drawing on experimental data, a structural and parametric identification of the Hammerstein, Wiener and Hammerstein-Wiener models with a polynomial structure of the linear dynamic block and piecewise linear static nonlinearities was performed. It has been established that the best modelling accuracy was ensured by using the Hammerstein-Wiener system with a linear model having the 6 th order of the numerator and denominator polynomials and an input delay of 3 samples. It showed 15.67% and 6.2% higher accuracy compared to the Wiener and Hammerstein systems, respectively. The application of those models in battery management systems will make it possible to improve the control quality for battery assemblies of solar and wind power plants in the context of the variable nature of the charging/discharging processes due to the variability of weather conditions and fluctuations in power consumption during a 24-hour period. This will ensure a wider introduction of renewable power generation into existing power systems, which is currently the leading way to ensure sustainable development of the energy sector.


Introduction
The need to increase generating capacities due to the constant increase in demand for electricity makes the use of traditional energy resources inefficient. This is primarily explained by the rapid depletion of reserves of extractable fuel and energy resources, as well as by high emissions level of harmful substances that is characteristic of processing those resources, and by low enough efficiency of energy conversion.
As a result, designing electricity generation systems that use renewable energy sources and their further integration into existing electric power networks has now become the leading area of the power industry's sustainable development.
Solar and wind energy are by far the main renewable energy sources. One of the features of power plants that use such energy resources is the mismatch (imbalance) between the levels of electric power generation and consumption. This is due to the uneven nature of electric power consumption during the 24-hour period and the variability of weather conditions. In the first case, the efficiency of a power plant is reduced due to the fact that not all electricity produced is fully consumed. In the second case, the power plant does not provide the consumer with electricity, power outages occur, which leads to financial losses of the respective energy company due to non-compliance with contractual terms and conditions. Thus, for example, at solar power plants, the maximum amount of power is produced during daylight [1] provided that the day is cloudless and the maximum insolation of the working surface of the solar panel is ensured, while the peak of power consumption occurs in the evening and at night. At wind farms, under unfavourable wind conditions, when the wind speed is within the range of the limit value necessary to start the wind turbine, electricity may not be generated at all [2]. Such periods can last for long timespans, sometimes even several days.
In order to reduce fluctuations in output power supply, solar and wind power plants are provided with energy storage facilities. As such facilities, secondary electrochemical sources of electric current that are characterized by the property of multiple recharging are used. In the alternative power engineering, lead-acid rechargeable batteries are the most common, but since some time ago, they have been in the process of being replaced by lithium batteries, in particular, lithium-ion (Li-ion) and lithium-metal-phosphate (LiFePO4) ones. This is due to the fact that lithium batteries have a higher power density, smaller dimensions and a low cost.
The special features of lithium batteries are the operating voltage that ranges from 3.7 to 4.2 V (lithiumion) or from 3.2 to 3.5 V (LiFePO4), the inadmissibility of overheating, the non-renewable loss of capacity when discharged to a voltage value below 2.7… 3 V, the accelerated degradation when recharged above 4.2 V (lithium-ion) or 3.5 V (LiFePO4), as well as the limited capacity of an individual battery. In order to create large storage capacities at grid-connected power plants integrated into central power systems, as well as at standalone power plants, lithium batteries must therefore be combined into series-parallel assemblies (battery packs).
The main condition for creating significant storage capacities on the basis of battery packs is the use in those packs of the batteries of the same type and with the same or slightly different parameters. That is, it would be highly ill-advised to incorporate lead-acid and lithium-ion batteries in one energy storage system.
For reliable operation of a battery pack, all connected elements must have the same level of voltage and capacity. The presence of at least one constituent element with different parameters leads either to the premature full discharge of the differing battery below the allowable discharge voltage value during discharging, which causes a non-renewable loss of capacity, or to exceeding the maximum voltage level during charging, which causes overheating of the battery in question and its thermal destruction. As a result, the load on other batteries in the pack increases, which leads to an acceleration of discharging and a decrease in the output voltage of the entire energy storage system of the power plant. This significantly reduces the efficiency of the power plant, because the charging rate of the batteries by the generating equipment may be lower than the intensity of their discharging. The resulting decrease in the output voltage of the energy storage system reduces the energy conversion efficiency by the inverter, through which the consumer receives power. There may also occur a situation where the voltage in the DC link drops below the permissible level, and the energy conversion with the subsequent transfer of the electric power into the network can stop altogether.
In order to eliminate the above situations, the processes of charging/discharging batteries are controlled using protection functions. Battery management systems (BMS) are used for that purpose. The operation efficiency of such a system depends primarily on the accuracy of measuring electrical parameters and predicting on their basis, depending on the mode of operation, the state of an individual battery and the pack as a whole. For predicting purposes, it is necessary to have a model that describes the battery charging/discharging processes with sufficient accuracy. In addition to direct simulation of the operation of a rechargeable battery-based energy storage system for the application as part of the BMS, such a model is also used in the control of generating and converting equipment of power plants that use renewable energy sources [3,4], and electrical loads connected to battery packs, in particular, electric motors [5]. That makes it possible to improve the quality and reliability of operation.

Literature review
A fairly large number of papers deal with the development of rechargeable battery models. That being the case, approaches to simulating the main modes of operation of the principal types of batteries used in energy storage systems of power plants are considered, but special attention is paid to lithium batteries.
Analytical models describe in detail the physical and chemical processes that occur when the battery is charged/discharged. Such models take into account a large number of parameters and use systems of differential equations and partial differential equations. This leads to high accuracy and illustrative nature of such models, but their calculation is accompanied by a high computational load, which reduces their efficiency when used in digital control devices with limited computing resources. Analytical models are convenient to use for studying modes of operation of batteries and establishing new patterns of the ongoing processes.
The research results presented in papers [32][33][34][35] show that the most efficient method for estimating the parameters of analytical models made, in particular, on the basis of equivalent replacement circuits is the use of the extended Kalman filter (EKF). Such an approach makes it possible to conduct even quick identification of the parameters of the battery model under the conditions of constantly changing characteristics during operation. However, the peculiarity of such a method lies in reducing the nonlinear model of the plant to a linearized one in the space of states and, as a result, in modelling the operation of the energy storage system in the operating point area. This significantly reduces the accuracy of the model for an essentially nonlinear plant, such as a rechargeable battery.
Data-driven models make it possible to predict the output values of an energy storage system only according to the law of change of input values without taking into account the internal processes of electrochemical transformation. They are characterized by high accuracy at low computational loads upon structural and parametric identification. An important distinctive feature of such models is the possibility, when using certain algorithms, of adapting to changes in the operating conditions of the object. Given the fact that the parameters of batteries, such as their maximum capacity, change with each charging cycle because of degradation processes, the presence of an adaptation mechanism improves the quality of such a model. Data-driven models can be used both when simulating individual batteries and the entire power storage system as a single object. They are therefore convenient to use when handling operational control tasks.
To date, a number of studies have been conducted dealing with the development and investigation of datadriven models of lithium-ion, lithium-polymer and leadacid batteries used in solar and wind power plants. The main purpose of those studies was to predict such parameters as the battery voltage level during the discharging process, state of charge (SoC) or the depth of discharge (DoD), as well as the remaining useful life (RUL) or the state of health (SoH).
According to the type of response, data-driven models can be divided into linear and nonlinear ones.
Among linear models, polynomial structures are widely used. In papers [20,21], it was proposed to simulate the modes of operation of lithium-ion batteries using autoregressive models with exogenous input (ARX), whose parameters are estimated by the EKF algorithm, the features of which have been described above. In paper [22], the model based on the equivalent replacement circuit is approximated using the ARX system. A parametric identification of the ARX model is performed based on the full set of experimental data using the least squares method, which reduces the adaptability of the model.
Given the nonlinear nature of the electrochemical processes occurring in a rechargeable battery, it can be argued that the scope of application of linear models is quite limited. Therefore, nonlinear models are normally used.
Machine learning methods are widely used to model and predict the state of rechargeable batteries. The models used for that are nonlinear, have pre-known structure defined at the stage of structural optimization [23], and apply experimentally obtained data for parametric identification. That is, they can be classified as datadriven models.
In papers [24,25], studies are presented of a classical artificial neural network, a multilayer perceptron, that is a universal approximator, used to predict the RUL of the battery, but it does not always accurately describe the dynamic characteristics of the nonlinear plant. However, parametric identification algorithms for such a model are characterized by high quickness.
The nature of changes in the electrical parameters of the battery is modelled more precisely by recurrent neural networks. In papers [26] studies are presented of a recurrent neural structure based on a nonlinear autoregressive model with an exogenous input (NARX) used to indirectly estimate the RUL and SoC of a lithiumion rechargeable battery. The studies presented in papers [27,28] deal with predicting the RUL of a battery using an LSTM network having a recurrent architecture. The results obtained by the authors show that the models in question ensure a low error rate in relation to simulation and experimental data, but create a high computational load during the identification.
In order to predict the SoH and RUL of lithium-ion batteries, deep learning by means of neural network models with many hidden layers is also used [29]. As with recurrent neural networks, these networks can ensure high prediction accuracy, but require a significant amount of time for the structural and parametric identification.
In papers [30,31], it was proposed to predict the SoC and SoH using an adaptive neuro-fuzzy inference system (ANFIS).
The analysis of literature data has shown that insufficient attention is paid to block-oriented models when simulating the dynamics of a rechargeable battery. At the same time, those models demonstrate high accuracy of simulating nonlinear dynamical systems, which is natural due to a distinctive feature of the configuration, i.e. the presence of a separate dynamic block in the structure of the model. The identification of parameters of such models is efficiently carried out both in off-line and on-line modes based on the algorithms given in [36,37], which allows those models to be used in digital control systems.

Structure of nonlinear block-oriented systems
In order to model and predict the modes of operation of a rechargeable battery, this research proposes to use blockoriented systems. This is due to the fact that these models accurately describe the dynamics of essentially nonlinear plants [38]. Block-oriented systems contain two parts in their structure: a linear dynamic block and a nonlinear static one. Depending on the relative position of these parts when converting an input signal into an output one, the Wiener, Hammerstein, and Hammerstein-Wiener models are distinguished. The structures of those models are shown in Fig. 1. In the Hammerstein model ( Fig. 1, a) a dynamic linear block is preceded by a linear static one, while in the Wiener model (Fig. 1, b), the opposite is the case, i.e. a linear block is placed before a nonlinear one. That is, these systems contain one element of each type in their structure. The Hammerstein-Wiener system (Fig. 1, c) consists of two static nonlinear blocks, at the input and output of the model, between which a linear dynamic block is placed.
Mathematically, the above structures are described by the following formulas. The The linear part of a block-oriented system can be represented by a transfer function, a state-space model [38], a system of orthogonal basis functions (Laguerre [39], Kautz, Legendre), etc. However, the most widely used polynomial input-output models (BJ, ARX, ARMAX, OE) [38]. According to [40], when modeling dynamic systems, in contrast to prediction, linear polynomial models of the output error (OE) structure are used as part of nonlinear models. In such models, the output depends only on the past values of the input [40], taking into account the disturbances. Since in this paper the problem of modeling the dynamics of lithium-ion batteries is investigated, the OE model is adopted as the structure of the linear part of block-oriented systems.
Piecewise linear functions are used as static nonlinearities ( ) \ and ( ) [ . Such an approach ensures flexibility during the identification, since linear functions can be used to approximate a function of any kind. That being the case, the accuracy will depend on the number of linear functions. Also, using a linear function, it is possible to determine the inverse function with low computational load, which simplifies the application of the obtained block-oriented model in digital control systems.
When conducting an analysis of the efficiency of using block-oriented structures for modelling the modes of operation of lithium-ion batteries, it is advisable to apply the following accuracy indicator of the model: This indicator is used due to the clarity and simplicity of calculation. When estimating the accuracy of the plant approximation by data-driven model, it is convenient to use the relative dimensionless errors, rather than errors in units of electrical parameters. This greatly simplifies the analysis and interpretation of experimental results.

Simulating dynamics of a lithium-ion rechargeable battery using blockoriented systems
When performing the research, the measurement results for electrical parameters of lithium-ion batteries during charging and discharging conducted and published by NASA were taken as experimental data [41].
The value of the battery voltage during operation, whose dynamic characteristics were approximated by nonlinear models, was assumed as an output variable.
In order to perform a structural and parametric identification of block-oriented systems, Dataset 1 [41] for Battery No. 5 with a nominal capacity of 2000 mAh containing 167 recharging cycles was used. For each recharging cycle, the data was divided into three data frames corresponding to charging, discharging, and impedance measurements. The battery was discharged with a load current of 1C.
Prior to conducting computational experiments, preliminary data preparation for identification was performed as follows. The measured battery voltage in the data frames for charging and discharging during each cycle was combined into one common array. The values of charging and discharging currents were also combined into common arrays, but for the periods that do not correspond to the actual mode of operation some currents were assigned a zero value. That is, the discharging current during charging process and the charging current during discharging have zero value.
At the first stage of the research, a structural and parametric identification of the linear dynamic part of the block-oriented model was carried out (Fig. 2). That being the case, the static nonlinear block had a fixed structure and consisted of 10 linear functions. The parametric identification of the model was carried out using the gradient descent method. For Systems (1) -(3), direct scanning for parameters corresponding to the order of the linear dynamic block's polynomial model's numerator and denominator was performed, as well as that for the value of the input delay in the range from 1 to 6. As a result, 216 structures were obtained for each type of the block-oriented system. The data obtained in the computational experiments for the Wiener, Hammerstein and Hammerstein-Wiener models are shown in Tables 1 to 3. Ten models of the respective type were summarized in each table indicating the parameters of the linear dynamic part that demonstrated the best agreement between the simulation data and the experimental ones.
The analysis of the results for the Wiener system (Table 1) shows that the model, whose polynomial orders for linear blocks ‫)ݖ(ܨ‬ and ‫)ݖ(ܤ‬ are ܰ ி = 6 and ܰ = 4, has the best accuracy, with an input delay standing at ܰ ௭ = 4 samples. The next most accurate model with the ܰ ி = 3, ܰ = 3, ܰ ௭ = 1 structure has 4.35% lower value of the agreement between the simulation and experimental data (4). At the same time, the number of parameters that need to be determined is 2 times lower (7 vs. 14), which leads to a faster parametric identification. Using a personal computer with AMD Athlon II X4 645 3.10 GHz and 8 GB DDR3 RAM configuration, the identification process of Wiener 2 model was performed in 29.56 seconds, while that of Wiener 1 model was done in 33.99 seconds. When using digital control devices with limited computing resources, it is therefore advisable to use Model 2. It should be noted that for structures 2 to 5 and 6 to 10 (cf. Table. 1) the error value differs insignificantly. Thus, the accuracy of Model 5 is only 0.67 % lower than that of Model 2, while the accuracy of Model 10 is 1.89 % lower than that of Model 6.
The structural identification of the linear part of the Hammerstein model was carried out next. The results of that identification are shown in Table 2.
A system with the ܰ ி = 2, ܰ = 3, ܰ ௭ = 5 structure showed the best agreement between the model and the plant. The next most accurate model, the Hammerstein one (2, Table 2), has an agreement indicator that is 1.3% lower (4). Given that the number of parameters of the linear block for Structures 1 and 2 is identical, it is advisable to use Model 1 during practical implementation. The identification time for Hammerstein model 1 was 46.59 seconds, while that for Hammerstein model 2 was 46.78 seconds. The accuracy of Hammerstein model 1 ( Table 2) is 8.92 % higher than that of the Wiener system that has the best quality of simulating the battery dynamics among the models of its type (Table 1). In addition, the number of parameters that need to be estimated is fewer in the Hammerstein system than in the Wiener one, and is 10 versus 14. That is, the computational load of the parametric identification process for such a model is lower.
Let us note that as many as 5 models of the Hammerstein system (1 to 5, Table 2) have a better accuracy than Model 1 of the Wiener structure (Table 1).
A structural identification of the Hammerstein-Wiener model was carried out last at this stage of computational experiments (Table 3). On the whole, this structure demonstrates the best accuracy of modelling the dynamic characteristics of a rechargeable battery. All ten blockoriented systems of this structure have a better agreement with the experimental data compared to the most accurate Wiener and Hammerstein models. Model 1 of the Hammerstein-Wiener system ensures 15.67 % and 6.2 %, while Model 10 does 10.86 % and 1.79 % higher accuracy than Model 1 of the Wiener system (Table 1) and Model 1 of the Hammerstein system (Table 2), respectively. The agreement index (4) for the two most accurate models of the Hammerstein-Wiener system differs insignificantly. In Model 2, it is only 1.4% lower compared to Model 1. However, for the structure of the linear block of Model 2, it is necessary to determine 7 parameters fewer than for Model 1. The time of the parametric identification for Hammerstein-Wiener 1 model was 55.68 seconds, while that for Hammerstein-Wiener model 2 was 51.56 seconds. That is why it is advisable to use the Hammerstein-Wiener system with the ܰ ி = 4, ܰ = 3, ܰ ௭ = 1 structure of the polynomial dynamic model in a digital control device to ensure a low computational load while providing high quality simulation of the battery dynamics.
A graphical interpretation of the results of the computational experiments is shown in Fig. 3 to 6. For better clarity, two block-oriented systems of each type that had demonstrated the best agreement with the experimental data were depicted in the figures. Fig. 3 shows the voltage change in a real rechargeable battery and block-oriented models for the first seven recharge cycles. The graphs demonstrate that during the first three cycles, Hammerstein model 2 and Wiener model 1 have a significant error rate when simulating the charging process. This is corroborated by the detailed graphs shown in Fig. 4 for the first charging cycle. Wiener 1 model poorly describes the initial stage of the charging process, when the charging current is maintained constant (CC mode), while Wiener 2 model, on the contrary, has a high deviation from the experimental data at the stage, when the battery is charged at a constant voltage (CV mode). Hammerstein-Wiener models 1 and 2, as well as Hammerstein model 1, have the best fit.
After the fourth cycle, the accuracy of the models increases. This is evidenced by the graphs shown in Fig. 5.  The discharging process (Fig. 6) is best described by Hammerstein-Wiener 1 and Wiener 1 models, but the latter shows a delay at the beginning of discharging. In Hammerstein-Wiener 2 systems, as well as in Hammerstein 1 and 2 ones, periodic fluctuations occur, which generally reduces their accuracy. All the models considered do not make it possible to simulate a sharp drop in battery voltage during the final stage of the discharging process that begins at sample 4350.  The analysis of the results obtained shows that setting the number of piecewise linear functions to a value other than 10 leads to a decrease in the accuracy of blockoriented systems in all three cases. It is therefore advisable to leave the structure of the nonlinear block unchanged.

Conclusions
In this paper, a research done has been presented of the efficiency of modelling the dynamic characteristics of lithium-ion rechargeable batteries and, in particular, the voltage change at the unit during charging and discharging processes using block-oriented systems with static nonlinearities on the basis of piecewise linear functions.
The Hammerstein-Wiener structures have been found to have the best accuracy. They adequately describe the process of charging the battery in the modes of constant current (CC) and constant voltage (CV), as well as the discharging process. At the same time, only the Hammerstein-Wiener systems with high orders of the linear model's polynomial components generally describe the discharging process in a quality way. Output fluctuations are observed in the low-order systems, which reduces their accuracy. However, such models ensure a low computational load on the digital control device.
The Hammerstein systems with high order polynomials of the linear model have demonstrated a simulation quality comparable to that of the low order Hammerstein-Wiener systems.
The Wiener models provide low agreement with a real nonlinear plant when describing the processes of charging a lithium-ion battery in the CC and CV modes, as well as discharging it at the rated loading current. When using them, an unstable nature of modelling the charging process was observed, viz. the accuracy at different cycles differed significantly. However, the Wiener systems did not have output fluctuations at the discharging stage unlike the Hammerstein systems.
All the block-oriented systems considered do not make it possible to describe a rapid decrease in the rechargeable battery voltage at the final stage of the discharging process.
Consequently, taking into account the high accuracy of individual structures of the block-oriented systems, they can be used in simulating and predicting the state of lithium-ion rechargeable batteries in control systems for both storage devices and generating and converting equipment of power plants that use renewable energy sources. An efficient control of energy storage systems will make it possible to improve the quality and reliability of solar and wind power plants in the context of changing weather conditions and fluctuations in electricity consumption during a 24-hour period. This will contribute to their wider implementation in energy systems of various levels and promote the sustainable development of the energy sector.
Further research will be devoted to the analysis of the efficiency of lithium-ion batteries electrical parameters prediction using block-oriented systems. The application of these models in nonlinear model predictive control systems of energy storage equipment of renewable-energy power plants will also be investigated.