battery life
battery_lifeCalculates battery runtime and energy capacity given cell capacity in mAh, nominal voltage, and average current draw. Accounts for real-world discharge efficiency (Peukert-adjacent derating) to produce effective capacity, total energy in Wh, and runtime in hours and days. Useful for IoT sensor node planning, portable device design, UPS hold-up estimation, and solar battery bank cycling analysis. Outputs feed into solar_sizing (battery_kwh) and ups_runtime (battery_wh) for system-level calculations.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| voltage | No | Nominal battery voltage (V), default 3.7 for Li-ion | |
| efficiency | No | Discharge efficiency factor (0-1), accounts for conversion losses and derating, default 0.85 | |
| capacity_mah | Yes | Battery capacity in milliamp-hours (mAh) | |
| current_draw_ma | Yes | Average current draw in milliamps (mA) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| energy_wh | Yes | Total battery energy in watt-hours (capacity_mah * voltage / 1000) | |
| runtime_days | Yes | Estimated runtime in days | |
| runtime_hours | Yes | Estimated runtime in hours | |
| effective_capacity_mah | Yes | Effective usable capacity after efficiency derating (mAh) |