Documentation
¶
Overview ¶
Package batterycapacity converts between the capacity units printed on battery packs and the figures that actually matter: real delivered energy, and the watt-hour rating airlines regulate by.
The number on a power bank's shell (mAh) measures raw cell charge, not the energy that reaches a device. Conversion losses, the pack's own control circuitry, and cell voltage all sit between the two.
Index ¶
- Constants
- func CyclesToPercent(cycles int, fadePerCycle float64) float64
- func FlightStatus(wh float64) string
- func PhoneCharges(ratedMAh, cellVolts, efficiency, phoneMAh float64) float64
- func UsableMAh(ratedMAh, cellVolts, efficiency float64) float64
- func WattHours(ratedMAh, cellVolts float64) float64
Constants ¶
const ( // NominalCellVolts is the typical nominal voltage of a single lithium-ion cell. NominalCellVolts = 3.7 // USBOutputVolts is the baseline USB output voltage packs convert up to. USBOutputVolts = 5.0 // TypicalEfficiency is a conservative real-world conversion efficiency for a // well-built pack (boost conversion plus control-circuit overhead). TypicalEfficiency = 0.85 // IATALimitWh is the watt-hour ceiling most airlines allow in cabin baggage // without prior approval. IATALimitWh = 100.0 // IATAApprovalLimitWh is the ceiling above which carriage is refused outright. IATAApprovalLimitWh = 160.0 )
Variables ¶
This section is empty.
Functions ¶
func CyclesToPercent ¶
CyclesToPercent estimates remaining capacity after a number of full charge cycles, using a per-cycle fade rate. Lithium-ion cells commonly retain about 80% after 300-500 cycles.
func FlightStatus ¶
FlightStatus reports how a pack of the given watt-hour rating is treated in cabin baggage: "allowed", "airline approval required", or "prohibited".
func PhoneCharges ¶
PhoneCharges estimates how many full charges a pack delivers to a device of the given battery size, using real usable capacity rather than the rating.
Types ¶
This section is empty.