CcBatteryPack

Package: inet.power.storage

CcBatteryPack

simple module

C++ definition

Models a battery pack consisting of multiple identical cells arranged in series or parallel. Calculates the overall capacity, voltage, and internal resistance based on the cell properties and their arrangement. In a serial arrangement, voltages and internal resistances add up. In a parallel arrangement, capacities add up and internal resistance decreases.

Inheritance diagram

The following diagram shows inheritance relationships for this type. Unresolved types are missing from the diagram.

Extends

Name Type Description
SimpleCcBattery simple module

This battery model maintains a residual charge capacity by integrating the difference between the total consumed current and the total generated current over time. This model uses a charge-independent ideal voltage source and a charge-independent internal resistance. It initiates node crash when the residual charge capacity reaches zero. See the base module for signals and statistics.

Parameters

Name Type Default value Description
displayStringTextFormat string "%c (%p)"

Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information

nominalCapacity double numberOfCells * cellNominalCapacity

Maximum amount of charge stored

initialCapacity double nominalCapacity

The initially stored amount of charge

nominalVoltage double arrangement == "serial" ? numberOfCells * cellNominalVoltage : cellNominalVoltage

Open circuit voltage at maximum charge

internalResistance double arrangement == "serial" ? numberOfCells * cellInternalResistance : cellInternalResistance / numberOfCells

Internal resistance

numberOfCells int 1

Number of cells in the battery pack

arrangement string "serial"
cellNominalCapacity double 7200 C

Typical capacity of an AA battery is 2 Ah = 7200 C

cellNominalVoltage double 1.5 V
cellInternalResistance double 0.1 Ohm

Properties

Name Value Description
class SimpleCcBattery
display i=block/plug

Signals

Name Type Unit Description
currentConsumptionChanged
residualChargeCapacityChanged
currentGenerationChanged

Statistics

Name Title Source Record Unit Interpolation Mode Description
currentGeneration Current generation currentGenerationChanged vector A sample-hold
residualChargeCapacity Residual charge capacity residualChargeCapacityChanged vector C linear
currentConsumption Current consumption currentConsumptionChanged vector A sample-hold

Source code

//
// Models a battery pack consisting of multiple identical cells arranged in
// series or parallel. Calculates the overall capacity, voltage, and internal
// resistance based on the cell properties and their arrangement. In a serial
// arrangement, voltages and internal resistances add up. In a parallel
// arrangement, capacities add up and internal resistance decreases.
//
simple CcBatteryPack extends SimpleCcBattery
{
    parameters:
        int numberOfCells = default(1); // Number of cells in the battery pack
        string arrangement @enum("serial","parallel") = default("serial");
        double cellNominalCapacity @unit(C) = default(7200 C); // Typical capacity of an AA battery is 2 Ah = 7200 C
        double cellNominalVoltage @unit(V) = default(1.5 V);
        double cellInternalResistance @unit(Ohm) = default(0.1 Ohm);
        nominalCapacity = default(numberOfCells * cellNominalCapacity); // Cell capacities are added when arranged in parallel
        nominalVoltage = default(arrangement == "serial" ? numberOfCells * cellNominalVoltage : cellNominalVoltage); // Voltage is added when cells are arranged in series
        internalResistance = default(arrangement == "serial" ? numberOfCells * cellInternalResistance : cellInternalResistance / numberOfCells); // Internal resistance is added when cells are arranged in series
}
File: src/inet/power/storage/CcBatteryPack.ned