PPL API Reference |
|
---|
Public Member Functions | |
Construction | |
Battery () | |
Battery Interface | |
@TODO Document these functions. | |
void | SetValues (double _max, double _cur) |
void | SetToMax () |
Set current level to max. | |
void | Print () |
Print current and max battery levels. | |
double | GetCurLevel () |
Get current battery level. | |
double | GetMaxLevel () |
Get max charge battery can hold. | |
void | Charge (double _increaseRate) |
void | UpdateValue (double _depletionRateBase, double _depletionRateMoving) |
void | UpdateValue (double _depletionRateBase) |
Protected Attributes | |
Internal State | |
double | m_maxLevel |
Maximum charge the battery can hold. | |
double | m_curLevel |
Current charge in the battery. | |
Models a simulated battery with a finite amount of charge.
@TODO Unify with other hardware code. We want a general 'battery' base class which could represent either a real or simulated battery. This should be derived to describe either option.
void Battery::SetValues | ( | double | _max, |
double | _cur | ||
) |
Set max and current values of the battery
_max | Max charge battery can hold |
_cur | Current charge |
void Battery::Charge | ( | double | _increaseRate | ) |
Increase charge of battery, stop if over max
_increaseRate | Amount to increase the current charge by |
void Battery::UpdateValue | ( | double | _depletionRateBase, |
double | _depletionRateMoving | ||
) |
Reduce value of charge by sum of base and moving rates
_depletionRateBase | Base depletion rate of charge |
_depletionRateMoving | Depletion rate of charge while moving |
void Battery::UpdateValue | ( | double | _depletionRateBase | ) |
Reduce value of charge by base depletion rate
_depletionRateBase | Base depletion rate of charge |