Building a custom rechargeable battery model

You can download the final simulation file here

Without circuit and battery models in hand, circuit designers can neither predict nor optimize either battery runtime or circuit performance. Although accurate and efficient electrical models of circuits and systems at different levels of abstraction have been developed and also have been implemented in Caspoc, there is always the need to create custom battery model.

In this tutorial we will show how to set up a custom battery model and how to make use of electric circuits, the block diagram and how to make custom library blocks for the developed battery model.

A battery model capable of predicting both runtime and I-V performance can be used to design energy-aware circuits and systems, optimize circuit and system performance, predict battery runtime for different load profiles, emulate batteries with electronic circuits, and improve battery energy efficiency.

The model that we develop in this tutorial predicts all the important properties and is compatible with lead-acid, NiCd, NiMH, Li-Ion, polymer Li-Ion, and other electrochemical batteries. More importantly, its ability to be conveniently simulated with other circuits and systems in Caspoc allows for optimum system designs and simulations. With minor modifications, this model can be extended to fuel cells and other power sources.

In its most basic form, a Thevenin-based model uses a series resistor \(R_{Series}\) and an RC parallel network \(R_{Transient}\) and \(C_{Transient}\) to predict battery response to transient load events at a particular state of charge [SoC], assuming \(V_{oc}\) is controlled as function of \(SoC\) and temperature. <br>Click to close the image

An accurate, intuitive and comprehensive electrical battery model is shown below. On the left, the open circuit voltage \(V_{oc}\), is a function of the State of Charge of the battery. The two RC networks, similar to that in the Thevenin-based model, simulates the transient response. To bridge SOC to open-circuit voltage, a voltage-controlled voltage source B is used. <br>Click to close the image

The variation of \(V_{oc}\), comes from different SoC values at the end of discharge for different currents owing to different voltage drops across internal resistor (the sum of \(R_{Series}\), \(R_S\), and \(R_L\) and the same end-of-discharge voltage.

When the battery is being charged or discharged, the current \(I_{battery}\) is integrated using the block INTLIMIT which defines the charge inside the battery. The integrator is limited between zero and the maximum charge in [Coulomb], as defined by \[A_{seconds} = 3600 \cdot Ah\]
From the stored charge in the integrator block INTLIMIT, the SoC can be calculated by scaling the charge with \(A_{seconds}\) <br>Click to close the image

The open-circuit voltage \(V_{oc}\) is dependent on the charge inside the battery. The nonlinear relation between the open-circuit voltage \(V_{oc}\) and \(SoC\) is important to include in the model. Thus, a controlled voltage source \(V_{oc}(SoC)\) is used to represent this relation. The open circuit voltage is normally measured as the steady-state open circuit terminal voltage at various \(SoC\) points.

There are two ways to model the relation between the open-circuit voltage \(V_{oc}\) and \(SoC\)

In this model we are going to use a functional description for the relation between the open-circuit voltage \(V_{oc}\) and \(SoC\).

For a typical measurement, the open-circuit voltage \(V_{oc}\) as function of \(SoC\) is described by the following relation \[ V_{oc} = -1.031e^{-35 SoC} + 3.685 + 0.2156 SoC - 0.1178 SoC^2 + 0.3201 SoC^3 \] Using the blocks from the Components\Blocks\Math section, the relation is modeled. The input is the calculated \(SoC\) which is derived from integrating the battery current. The calculated open-circuit voltage \(V_{oc}\) is controlling the voltage source in the battery model. <br>Click to close the image

From the mathematical relations we are going to make a single library model. Copy or build the model in a empty workscreen. Using the right mouse button, select that the node [Voc] is to be exported to the right <br>Click to close the image

Select witht he right mouse button the input node [SoC] and specify that it should be exported to the left. <br>Click to close the image

Export the model. <br>Click to close the image

Click [Export] <br>Click to close the image

Save the model under a new name, in this case voc.lib <br>Click to close the image

In the original schematic, import the new library block <br>Click to close the image

Select the library block and click [Open] <br>Click to close the image

By default the name of the imported block will be the filename with an extension number, but you can choose any name that you like. Just click [OK] <br>Click to close the image

Drag the new block in the schematic and place it by clicking the left mosue button <br>Click to close the image

The {ugly} block is now placed onto the schematic and can be connected. <br>Click to close the image

Add labels using the right mouse button <br>Click to close the image

To have a nice icon on top of the newly created library block, we are going to draw some vector graphics. Open the library block using the right mouse button and click on [Edit Vec] <br>Click to close the image

Since the accompanying Voc.vec file does not exist yet, you first have to create it by clicking [Yes] <br>Click to close the image

Enter the commands to draw a rectangle with a centered label. More commands can be found here: Customized library drawings <br>Click to close the image

Save the file, or simply click [Ctrl]-[S] to save the voc.vec file <br>Click to close the image

After creating the voc.vec file, deselect all image items except the vec item. <br>Click to close the image

The rectangle and label are now visible on top of the \(Voc(SoC)\) library block. <br>Click to close the image

To test the model, we are going to discharge the battery over the load resistance of \(3 \Omega\). The battery gets an initial charge of \(1 Ah = 3600 Coulomb\). We enter a slightly smaller value (\(3500 Coulomb\)) to have \(SoC <1\) <br>Click to close the image

The full Capacity of the battery is set to \(1 Ah\) using the block constant from the section Components\Blocks\Source and a scope is added to display \(V_{oc}\) as function of \(SoC\). The total simulation time is set to \(T_{screen} = 3600 \) seconds with a integration step size \(dt = 1 s\) <br>Click to close the image

To measure the current flowing into the battery, the current measurement is mirrored. Parameters for the series resistance and time constant are set by specifying the parameters for the R's and C's in the model. After running the simulation, the scope shows \(V_{oc}\) and \(SoC\) as function of time. <br>Click to close the image

Open scope with the right mousse button and change the view to xy by selecting View/XY-writer in the scope menu. <br>Click to close the image

The simulation shows the decrease of \(V_{oc}\) as function of \(SoC\) for a nearly complete discharge. <br>Click to close the image

And of course you can create your own models! Also you can make the values of the R's and C's depending on the SoC and temperature, just about the same way we made the \(V_{oc}\) a function of \(SoC\). The simulation shows the charging of a custom battery model using a DCDC converter that has a controlled output voltage and a maximum charge current. When the battery is fully charged, the series resistance \(R_1\) rises sharply and thereby limiting any further charging of hte battery. The value of the resistance for \(R_1\) is defined by the custom function made up from a summation of a constant value with two exponentional blocks. In this way a nearly flat region where \(R_1\) is constant is modelled and only when the \(SoC\) gets close to \(1\) or \(0\), the resistance rises. <br>Click to close the image

The block ChangeE from the section Components\Blocks\Miscellaneous can change the value of any R or C during the simulation. In this way you can make non-linear parameters. The block expression from the section Components\Blocks\Scripts%Expression models the equation for the \(V_{oc}\) \[ 3.685+0.2156*a-0.1178*a*a+0.3201*a*a*a \] where the variable a is the input \((a=SoC)\) and the output is the value at the node \(Voc1\)

You can download the charging simulation file here

© 2024 CASPOC, All rights reserved. Home   |   Terms and Conditions   |   Legal   |   Export Compliance   |   Privacy Policy   |   Site Map