Battery Management Service¶
- group Battery Management Service
Monitors and controls the CubeSat battery pack.
The BMS is responsible for:
pack voltage/current monitoring
temperature and health estimation
charge state determination
enabling/disabling charging/balancing circuits
protection and failsafe behavior
telemetry collection for upstream consumption
error state management by notifying redundancy manager
- group Structures
Structures used by the Battery Management Service.
-
struct battery_status_t¶
- #include <battery_management.h>
Snapshot of system battery state.
This structure is returned by battery_get_status and is used internally by the BMS to make decisions.
Public Members
-
float voltage¶
Current pack voltage in volts
-
float current¶
Pack current in amps (+ = charging, - = discharging)
-
float temperature¶
Average pack temperature in C
-
float soc¶
State of charge (0-100%)
-
float soh¶
State of health estimate (0-100%)
-
bool charging¶
True if charging is currently active
-
bool balancing¶
True if balancing circuits are enabled
-
float voltage¶
-
struct battery_management_t¶
- #include <battery_management.h>
The battery management service.
Public Members
-
battery_status_t battery_status¶
The battery status
-
bool intiialized¶
True if the BMS is initialized
-
battery_status_t battery_status¶
-
struct battery_status_t¶
- group Public API
External interface for interacting with the Battery Management Service.
Functions
-
void battery_init(battery_management_t *manager)¶
Initialize the Battery Management Service.
This must be called once at startup before any other BMS functions. Initializes internal state, and performs a startup self-check.
Note
This function is idempotent.
- Parameters:
manager – [out] The battery manager
-
void battery_update(battery_management_t *manager)¶
Perform a periodic update of battery status.
This should be called once each main loop tick. Reads sensors, updates SoC/SoH estimates, and runs charge/protection algorithms.
- Parameters:
manager – [in] The battery manager
-
bool battery_self_check_ok(battery_management_t *manager)¶
Returns whether the battery system passed its self-check.
- Parameters:
manager – [out] The battery manager
- Return values:
true – Battery is healthy and operational.
false – Battery failed diagnostics; EPS may require safe mode.
-
bool battery_needs_charge(void)¶
Determine if the battery requires charging.
Uses SoC, voltage thresholds, and EPS policy rules.
- Return values:
true – Battery is below charging threshold.
false – Sufficient charge level or charging not allowed.
-
bool battery_full(void)¶
Determine whether the battery is considered full.
Typically derived from voltage or SoC limit.
- Return values:
true – Battery is full or very near full.
false – Battery still has capacity to charge.
-
void battery_charge_control(void)¶
Apply charge-control policy.
Enables or disables charging circuits based on SoC, temperature, EPS power budget, and safety limits.
-
void battery_protect_mode(void)¶
Enter battery protection mode.
Used during overvoltage, deep discharge, or other critical conditions. May disable EPS rails or charging.
-
battery_status_t battery_get_status(void)¶
Get the full status snapshot of the battery system.
- Returns:
battery_status_t struct with all telemetry fields populated.
-
float battery_get_voltage(void)¶
Get battery pack voltage.
- Returns:
Measured voltage in volts.
-
float battery_get_current(void)¶
Get battery pack current.
Positive = charging, negative = discharging.
- Returns:
Current in amps.
-
void battery_init(battery_management_t *manager)¶