Module: simpleBattery

Executive Summary

The SimpleBattery class is a minimal model of battery functionality that considers:

  1. Integrated net input power of the attached modules

  2. The battery’s maximum storage capacity as defined by the storageCapacity attribute. Integration of the net input power is performed with a simple Euler method.

    \(W_{stored} = \dot{W}_{net} (t_{current} - t_{previous})\)

Module Assumptions and Limitations

See Module: powerStorageBase class for inherited assumption and limitations. The SimpleBattery class assumes that the net energy storage amount is a fixed value.

Message Connection Descriptions

This module only uses the input and output messages of the Module: powerStorageBase base class.

User Guide

To set up this module users must create a SimpleBattery instance:

battery = simpleBattery.SimpleBattery()
battery.ModelTag = "batteryModel"

In addition to the variables that must be set for the Module: powerStorageBase base class, this module requires the storageCapacity attribute to be specified. The total power stored in the battery will be limited to not exceed this capacity value:

battery.storageCapacity = 10.0 # Given in Joules or Watt-seconds

The next step is to attach one or more PowerNodeUsageMsgPayload instances to it using the addNodeToStorage() method:


For more information on how to set up and use this module, see the simple power system example scenarioPowerDemo.

class SimpleBattery : public PowerStorageBase
#include <simpleBattery.h>

simple battery class

Public Functions


The constructor creates a SimpleBattery instance with zero stored charge


Public Members

double storageCapacity

[W-s] Battery capacity in Watt-seconds (Joules).

BSKLogger bskLogger

&#8212; BSK Logging

Private Functions

void customReset(uint64_t CurrentClock)

custom reset function.

void evaluateBatteryModel(PowerStorageStatusMsgPayload *msg)

This method integrates the current net power, and checks to see whether the integrated power falls between 0 and the battery’s storageCapacity.


*msg – pointer to a PowerStorageStatusMsgPayload instance