## A battery isn’t just a voltage source

A leading motorcycle manufacturer has been using MapleSim to model their powertrain, and now they want to include a realistic battery model. This would let them choose batteries and accessories (like starters and alternators) that they can simulate under a variety of operating conditions, along with their powertrain model. The company turned to Maplesoft to help with this modeling exercise and I was put on the task. My background is in circuits so I thought this would be a straightforward project. In my mind batteries were just constant voltage sources that eventually ran out of charge. I was able to find several recent research papers on battery models, and I realized their behavior was much more complicated than a simple voltage source.

It turns out that the voltage measured at the terminals of a battery is extremely nonlinear and depends on the temperature, rate of charge or discharge, and the state of charge. And that doesn’t even include aging effects: If you put a battery on the shelf for a few months its performance will degrade depending on the storage temperature. On top of that, there’s the concept of equivalent series resistance, or ESR. If you measure the open-circuit battery voltage, then attach a load and re-measure the voltage, you can figure out what the internal resistance of the battery is based on the voltage difference. However, it too is a function of the temperature, rate of charge or discharge, and the state of charge. And finally, the battery doesn’t react instantaneously to changing conditions. For example, if the load changes from 1 A to 2 A, the voltage will jump then take some time on the order of minutes to stabilize. So this means that the battery has some time-dependant characteristics as well. After reading all these papers, it was clear that batteries are bad at being constant voltage sources.

The same research papers provided an encouragingly simple equivalent circuit model that was supposed to behave like a realistic lead-acid battery, which was the kind we were interested in. The model was a voltage source, a low-pass RC filter, a few resistors and a current source. The downside is that every component’s value is a complicated time-domain function of the state of charge, temperature, and current. This is not including the heat generated and resulting temperature increases due to losses in the circuit. My simple voltage source had turned into a complicated dynamic, nonlinear system.

As an electrical engineer, I have only used circuit simulators that let you specify numerical values for component parameters. MapleSim, however, lets you put equations right into the components. It goes even further, letting you create custom components where you can specify a set of governing equations, define parameters, add ports for connection to the outside world, and create a block component right in MapleSim. The ports can be any mix of MapleSim’s multiphysics domains, like electrical and thermal in the case of the battery model. I simply took the complicated governing equations right from the research paper, copied over the parameters and their values, and wired up the components in a straightforward manner. As requested, I had now a realistic battery model.

Figure 1 shows an example of the battery model’s behavior. The current, shown in the top left, first discharges then charges the battery. The terminal voltage is shown in the top right and matches quite well with some experimental results available in the literature. The temperature and state of charge are also available from the model and are shown on the bottom left and bottom right, respectively.

 Figure 1 – The MapleSim output of the dynamic response of the battery model matches the realistic behavior of a lead-acid battery. The battery current is shown in the top left plot. First, 65 A is drawn from the battery, the battery rests, then is recharged with 10 A. The dynamic response of the voltage (top right), temperature (bottom left) and state of charge (bottom right) are shown above.

This model was presented to the battery department of the motorcycle manufacturer. For the presentation, we connected the battery model to the existing powertrain model that included a starter motor, alternator, and engine. In the simulation you can actually watch the battery discharge and heat up as the starter motor spins the engine, then charge up as the alternator kicks in. They were impressed at how well the models connected together, and how such a complex battery model could be represented so easily in MapleSim. Thanks to MapleSim we now have a very realistic battery model that can be used on a variety of platforms.

﻿