Documentation
¶
Overview ¶
Package twsbattery models the battery behaviour of true wireless earbuds, where the charging case — not the earpieces — is usually what fails first.
A case battery accumulates many shallow cycles per day topping the buds off, while a phone battery sees roughly one deep cycle. Cycle count, not calendar age, drives lithium-ion fade, so the case ages faster despite similar total energy throughput.
Reference model data used to validate this package is published at https://cairovolt.com/en/earbuds
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CapacityAfterCycles ¶
CapacityAfterCycles applies per-cycle fade to a starting capacity percentage.
func WeakestLink ¶
WeakestLink names the component that limits the set's useful life: "case" or "buds".
Types ¶
type Set ¶
type Set struct {
// BudMAh is the capacity of a single earpiece.
BudMAh float64
// CaseMAh is the capacity of the charging case.
CaseMAh float64
// BudHours is rated playback time per earbud charge.
BudHours float64
// TransferEfficiency is the case-to-bud charging efficiency, typically 0.8-0.9.
TransferEfficiency float64
}
Set describes a true wireless earbud set and its charging case.
func (Set) BudRecharges ¶
BudRecharges returns how many times a full case can refill both earpieces.
func (Set) CaseCyclesPerDay ¶
CaseCyclesPerDay estimates full case cycles consumed per day of listening.
func (Set) CaseLifetimeMonths ¶
CaseLifetimeMonths estimates months until the case falls below a usable capacity threshold at a given daily listening load.
The case is modelled as ageing faster than the buds because heat inside a small sealed enclosure accelerates fade — which is why replacement cases are increasingly sold separately.
func (Set) TotalListeningHours ¶
TotalListeningHours is playback from a full set plus everything the case holds.