Lamp-Da 0.1
A compact lantern project
Loading...
Searching...
No Matches
Classes | Namespaces | Functions | Variables
charge_policy.h File Reference

Rules deciding when the battery charge must stop. More...

Go to the source code of this file.

Classes

struct  lampda::component::charger::policy::Inputs
 Snapshot of the measurements used by the charge stop rules. More...
 
class  lampda::component::charger::policy::ChargeLimiter
 Track the charge stop state (battery full, over voltage) More...
 

Namespaces

namespace  lampda
 Program scope.
 
namespace  lampda::component
 Medium level logic, above BSP.
 
namespace  lampda::component::charger
 Handles the battery charging processes, and power output control.
 
namespace  lampda::component::charger::policy
 Charge stop rules, from a snapshot of the battery measurements.
 

Functions

bool lampda::component::charger::policy::is_over_voltage (const Inputs &in)
 True if a cell or the pack is over the charge voltage limit.
 
bool lampda::component::charger::policy::is_end_of_charge (const Inputs &in)
 True if the battery reached the end of charge: pack at the target voltage, or charge current tapered off near full.
 

Variables

static constexpr uint16_t lampda::component::charger::policy::fullLevel = 9900
 Battery level (percent * 100) from which the battery is considered full.
 
static constexpr uint16_t lampda::component::charger::policy::rechargeLevel = 9500
 Once full, the charge restarts below this battery level (percent * 100)
 
static constexpr uint32_t lampda::component::charger::policy::endOfChargeDeglitch_ms = 5000
 The end of charge condition must stay true for this time before the charge is considered done.
 
static constexpr uint16_t lampda::component::charger::policy::cellOverVoltageMargin_mV = 10
 Accepted cell voltage above the safe maximum (cell imbalance, measure noise)
 
static constexpr uint16_t lampda::component::charger::policy::cellOverVoltage_mV = physical_constants::maxSafeLiionVoltage_mV + cellOverVoltageMargin_mV
 A cell over this voltage stops the charge immediately.
 
static constexpr uint16_t lampda::component::charger::policy::packOverVoltage_mV
 A pack over this voltage stops the charge immediately.
 
static constexpr uint16_t lampda::component::charger::policy::cellResumeVoltage_mV = physical_constants::maxSafeLiionVoltage_mV - 20
 After an over voltage, the charge can restart when all cells are below this voltage.
 
static constexpr uint32_t lampda::component::charger::policy::overVoltagePause_ms = 20000
 After an over voltage, the charge stays stopped at least this long (lets the balancer work)
 

Detailed Description

Rules deciding when the battery charge must stop.

Pure logic on a measurement snapshot, so that the rules can be unit tested without the charger hardware.