Did you know that MacBook batteries have a dedicated chip that keeps track of how much energy goes in and out of the battery during all times? For example, the 13″ MacBook Pro from 2015 uses a BQ20Z451 “battery fuel gauge chip” from Texas Instruments:
Predicting Energy Usage
These chips are extremely smart — their whole purpose is to keep track of the state of the battery:
The bq20z655-R1 measures and maintains an accurate record of available charge in Li-ion or Li-polymer batteries using its integrated high-performance analog peripherals. The bq20z655-R1 monitors capacity change, battery impedance, open-circuit voltage, and other critical parameters of the battery pack which reports the information to the system host controller over a serial-communication bus.
However, they can’t predict when and how long you’re going to play Rocket League, watch streaming videos or listen to music. All these activities require different amounts of energy by various components of the computer. That is why calculating and predicting the state of charge (SOC) is extremely hard. Even Tesla doesn’t know how long you’ll be driving in the “Ludicrous Mode”.
The best it can do is to assume that whatever happens now will continue until the battery runs out. This is also why Apple lists the battery life in terms of one continuous activity:
- Up to 10 hours wireless web
- Up to 10 hours iTunes movie playback
- Up to 30 days of standby time
It is almost impossible to provide a reliable estimate when you mix and match various activities.
Assuming that macOS is pulling the battery estimates from the TI chip (see pages 16 and 17 of the datasheet for all the available data fields) it is possible that the algorithms used by the chip don’t account for certain power usage behaviours of various components (for example, power saving modes) which produced wildly inaccurate estimates.
Here is a great paper on the internals of the MacBook battery by Charlie Miller and a video of his talk at DEFCON 2013 on the same subject: