Module: simpleBattery
Executive Summary
The SimpleBattery class is a minimal model of battery functionality that considers:
Integrated net input power of the attached modules
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:
battery.addPowerNodeToModel(powerMsg)
For more information on how to set up and use this module, see the simple power system example scenarioPowerDemo.
Users may configure the fault message to simulate a battery capacity fault that reduces the actual storage capacity while the storageCapacity
value remains unchanged. The faulted battery capacity is determined using the faultCapacityRatio
, calculated as (actual capacity) / (set capacity).
faultMsg = messaging.PowerStorageFaultMsgPayload()
faultMsg.faultCapacityRatio = 0.3 # Actual capacity is 30% of the nominal capacity
faultStatusMsg = messaging.PowerStorageFaultMsg().write(faultMsg)
battery.batteryFaultInMsg.subscribeTo(faultStatusMsg)
-
class SimpleBattery : public PowerStorageBase
- #include <simpleBattery.h>
simple battery class
Public Functions
-
SimpleBattery()
The constructor creates a SimpleBattery instance with zero stored charge
-
~SimpleBattery()
-
void readInputMessage()
This method allows the user to set the fault status of the battery capacity
Public Members
-
ReadFunctor<PowerStorageFaultMsgPayload> batteryFaultInMsg
input message to record battery status
-
double storageCapacity
[W-s] Battery capacity in Watt-seconds (Joules).
-
BSKLogger bskLogger
— 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.
- Parameters:
*msg – pointer to a PowerStorageStatusMsgPayload instance
Private Members
-
double faultCapacityRatio
Fault capacity ratio (faulted capacity / nominal capacity)
-
SimpleBattery()