# Generic Battery

Simple battery model

Sources

## Description

The Generic Battery block represents a simple battery model. The block has four modeling variants, accessible by right-clicking the block in your block diagram and then selecting the appropriate option from the context menu, under Simscape > Block choices:

• Uninstrumented | No thermal port — Basic model that does not output battery charge level or simulate thermal effects. This is the default.

• Uninstrumented | Show thermal port — Model with exposed thermal port. This model does not measure internal charge level of the battery.

• Instrumented | No thermal port — Model with exposed charge output port. This model does not simulate thermal effects.

• Instrumented | Show thermal port — Model that lets you measure internal charge level of the battery and simulate thermal effects. Both the thermal port and the charge output port are exposed.

The instrumented variants have an extra physical signal port that outputs the internal state of charge. Use this functionality to change load behavior as a function of state of charge, without the complexity of building a charge state estimator.

The thermal port variants expose a thermal port, which represents the battery thermal mass. When you select this option, provide additional parameters to define battery behavior at a second temperature. For more information, see Modeling Thermal Effects.

### Battery Model

If you select `Infinite` for the Battery charge capacity parameter, the block models the battery as a series resistor and a constant voltage source. If you select `Finite` for the Battery charge capacity parameter, the block models the battery as a series resistor and a charge-dependent voltage source whose voltage as a function of charge has the following reciprocal relationship:

`$V={V}_{0}\left[1-\left(\frac{\alpha \left(1-x\right)}{1-\beta \left(1-x\right)}\right)\right]$`

where:

• x is the ratio of current charge to rated battery capacity in ampere-hours, AH.

• V0 is the voltage when the battery is fully charged, as defined by the Nominal voltage parameter.

• The block calculates the constants α and β to satisfy the following battery conditions:

• The battery voltage is zero when the charge is zero, that is, when x = 0.

• The battery voltage is V1 (the Voltage V1 < Vnom when charge is AH1 parameter value) when the charge is the Charge AH1 when no-load volts are V1 parameter value, that is, when x = AH1/AH.

The equation defines a reciprocal relationship between voltage and remaining charge. It is an approximation to what happens in a real battery, but it does replicate the increasing rate of voltage drop at low charge values. It also ensures that the battery voltage becomes zero when the charge level is zero. This simple model has the advantage of requiring very few parameters, and these are parameters that are readily available on most datasheets.

### Modeling Thermal Effects

For thermal block variants of the block, you need to provide additional parameters to define battery behavior at a second temperature. The extended equations for the voltage when the thermal port is exposed are:

`$V={V}_{0T}\left[1-\left(\frac{{\alpha }_{T}\left(1-x\right)}{1-{\beta }_{T}\left(1-x\right)}\right)\right]$`
`${\alpha }_{T}=\alpha \left(1+{\lambda }_{\alpha }\left(T-{T}_{1}\right)\right)$`
`${\beta }_{T}=\beta \left(1+{\lambda }_{\beta }\left(T-{T}_{1}\right)\right)$`
`${V}_{0T}={V}_{0}\left(1+{\lambda }_{V}\left(T-{T}_{1}\right)\right)$`

where:

• T is the is the battery temperature.

• T1 is the temperature at which nominal values for α and β are provided.

• λα, λβ, and λV are the parameter temperature dependence coefficients for α, β, and V0, respectively.

The internal series resistance (R1) and self-discharge resistance (R2) also become functions of temperature:

`$\begin{array}{l}{R}_{1T}={R}_{1}\left(1+{\lambda }_{R1}\left(T-{T}_{1}\right)\right)\\ {R}_{2T}={R}_{2}\left(1+{\lambda }_{R2}\left(T-{T}_{1}\right)\right)\end{array}$`

where λR1 and λR2 are the parameter temperature dependence coefficients. All of the temperature dependence coefficients are determined from the corresponding values you provide at the nominal and second measurement temperatures.

The battery temperature is determined from:

`${M}_{th}\stackrel{˙}{T}={i}^{2}{R}_{1T}+{V}^{2}/{R}_{2T}$`

where:

• Mth is the battery thermal mass.

• i is the is the battery output current.

## Basic Assumptions and Limitations

When using the thermal block variants, use caution when operating at temperatures outside of the temperature range bounded by the Measurement temperature and Second temperature measurement values. The block uses linear interpolation for the derived equation coefficients, and simulation results might become nonphysical outside of the specified range. The block checks that the internal series resistance, self-discharge resistance, and nominal voltage always remain positive, and issues error messages in case of violation.

## Dialog Box and Parameters

### Main Tab

Nominal voltage

The voltage at the output port when the battery is fully charged. The default value is `12` V.

Internal resistance

Internal connection resistance. The default value is `2` Ω.

Battery charge capacity

Select one of the following options for modeling the charge capacity of the battery:

• `Infinite` — The battery voltage is independent of charge drawn from the battery. This is the default option.

• `Finite` — The battery voltage decreases as charge decreases.

Ampere-hour rating

The maximum battery charge in ampere-hours. This parameter is visible only when you select `Finite` for the Battery charge capacity parameter. The default value is `50` hr*A.

Initial charge

The battery charge at the start of the simulation. This parameter is visible only when you select `Finite` for the Battery charge capacity parameter. The default value is `50` hr*A.

Voltage V1 < Vnom when charge is AH1

The battery output voltage when the charge level is AH1 hr*A. This parameter is visible only when you select `Finite` for the Battery charge capacity parameter. The default value is `11.5` V.

Charge AH1 when no-load volts are V1

The battery charge level in hr*A when the no-load output voltage is V1. This parameter is visible only when you select `Finite` for the Battery charge capacity parameter. The default value is `25` hr*A.

Model self-discharge resistance?

Select one of the following options for modeling the self-discharge resistance of the battery:

• `Omit` — Do not include resistance across the battery output terminals in the model.

• `Include` — Include resistance R2 across the battery output terminals in the model.

Self-discharge resistance

The resistance across the battery output terminals that represents battery self-discharge. This parameter is visible only when you select `Include` for the Model self-discharge resistance? parameter. The default value is `2e+03` Ω.

Measurement temperature

Temperature T1, at which the block parameters on the Main tab are measured. This parameter is visible only for blocks with exposed thermal port. For more information, see Modeling Thermal Effects. The default value is `298.15` K.

### Temperature Dependence Tab

This tab appears only for blocks with exposed thermal port. For more information, see Modeling Thermal Effects.

Nominal voltage at second measurement temperature

Battery voltage at temperature T2. The default value is `12` V.

Internal resistance at second measurement temperature

Battery internal resistance at temperature T2. The default value is `2.2` Ω.

Voltage V1 at second measurement temperature

The battery output voltage corresponding to the charge level AH1 at temperature T2. This parameter is visible only when you select `Finite` for the Battery charge capacity parameter. The default value is `11.4` V.

Second measurement temperature

The temperature T2, at which the block parameters on the Temperature Dependence tab are measured. The default value is `273.15` K.

### Thermal Port Tab

This tab appears only for blocks with exposed thermal port. For more information, see Modeling Thermal Effects.

Thermal mass

Thermal mass associated with the thermal port H. It represents the energy required to raise the temperature of the thermal port by one degree. The default value is `30000` J/K.

Initial temperature

The temperature of the thermal port at the start of simulation. The default value is `298.15` K.

## Ports

The block has the following ports:

`+`

Positive electrical voltage

`-`

Negative electrical voltage

## Examples

For an example of how you can create a detailed battery model, see the Simscape™ Lead-Acid Battery example.