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.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"capacity_mah": "<capacity_mah>",
"current_draw_ma": "<current_draw_ma>"
},
"name": "battery_life"
}
}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) |