Documentation
¶
Overview ¶
Package powerbanksizing turns a real usage pattern into a power bank capacity recommendation, and checks the result against airline watt-hour limits.
Picking capacity by "bigger is better" produces packs people stop carrying. The useful question is how many devices, for how many days, away from an outlet — then whether the answer is still allowed in a cabin bag.
Reference capacity and weight data used to validate this package is published at https://cairovolt.com/en/power-banks
Index ¶
Constants ¶
const ConversionLoss = 0.35
ConversionLoss is the share of rated capacity lost to boost conversion and control circuitry. Real usable output is typically 60-75% of the rating.
const IATACabinLimitWh = 100.0
IATACabinLimitWh is the watt-hour ceiling most airlines allow without approval.
const NominalCellVolts = 3.7
NominalCellVolts is the typical lithium-ion cell voltage used for Wh maths.
Variables ¶
var ( Phone = Device{Name: "phone", BatteryMAh: 4500, ChargesPerDay: 1.0} Earbuds = Device{Name: "earbuds", BatteryMAh: 500, ChargesPerDay: 0.5} Tablet = Device{Name: "tablet", BatteryMAh: 8000, ChargesPerDay: 0.5} )
Common device profiles, useful as defaults.
Functions ¶
func CabinLegal ¶
CabinLegal reports whether a rated capacity stays under the usual 100Wh limit.
func DailyDemandMAh ¶
DailyDemandMAh is the charge a device set consumes per day.
func RequiredRatedMAh ¶
RequiredRatedMAh converts a multi-day demand into the rated capacity to buy, grossing up for conversion loss.
Types ¶
type Device ¶
type Device struct {
Name string
// BatteryMAh is the device's own battery capacity.
BatteryMAh float64
// ChargesPerDay is how many full refills it needs daily.
ChargesPerDay float64
}
Device is something that needs charging during a trip.
type Recommendation ¶
type Recommendation struct {
RatedMAh float64
WattHours float64
CabinLegal bool
// Note explains the binding constraint in one line.
Note string
}
Recommendation is a sizing answer with the reasoning attached.
func Recommend ¶
func Recommend(devices []Device, days float64) Recommendation
Recommend sizes a pack for a device set over a number of days, and flags when the airline limit — not the usage pattern — is what caps the choice.