The number printed on an air conditioner is rarely the number you pay for. A "1.5-ton" split unit doesn't draw 1.5 of anything from the wall, and it doesn't run flat out all day. If you're building an energy dashboard, a smart-plug integration or just want to sanity-check a bill, you need to turn cooling capacity, efficiency and real running time into kilowatt-hours, then into money.
This walkthrough does that in plain Python, with no libraries, so you can drop it into a script, a notebook or a microcontroller backend.
Cooling capacity is not electrical power
AC capacity is usually quoted in tons of refrigeration or BTU per hour. Both describe how much heat the unit removes, not how much electricity it uses.
| Unit | Meaning | Conversion |
|---|---|---|
| 1 ton of refrigeration | Heat removal rate | 12,000 BTU/h ≈ 3.517 kW (thermal) |
| BTU/h | Heat removal rate | 1 BTU/h ≈ 0.293 W (thermal) |
| EER | Efficiency: BTU/h of cooling per watt of electricity | Electrical W = BTU/h ÷ EER |
| COP | Efficiency: cooling kW per electrical kW | Electrical kW = cooling kW ÷ COP |
The efficiency rating is what links the two. A 12,000 BTU/h (1-ton) unit with an EER of 10 draws about 1,200 W of electricity while the compressor runs. The same capacity with an EER of 12 draws about 1,000 W.
TON_BTU_H = 12_000 BTU_H_TO_KW = 0.29307107 / 1000 # 1 BTU/h in kW (thermal) def electrical_kw(tons=None, btu_h=None, eer=None, cop=None): """Electrical input in kW while the compressor runs.""" if btu_h is None: btu_h = tons * TON_BTU_H if eer: return btu_h / eer / 1000 if cop: return btu_h * BTU_H_TO_KW / cop raise ValueError("Need EER or COP") print(round(electrical_kw(tons=1.5, eer=10), 2)) # 1.8 kW print(round(electrical_kw(btu_h=18_000, cop=3.2), 2)) Running hours are not clock hours
A fixed-speed compressor switches on and off as the thermostat is satisfied. An inverter unit slows down instead of stopping. Either way, "on for 10 hours" rarely means "drawing full power for 10 hours". Model this with a duty cycle: the fraction of time the compressor is effectively at full power.
def daily_kwh(kw, hours_on, duty_cycle=1.0): """kWh per day = power x hours x share of time at full power.""" if not 0 < duty_cycle <= 1: raise ValueError("duty_cycle must be between 0 and 1") return kw * hours_on * duty_cycle kw = electrical_kw(tons=1.5, eer=10) # 1.8 kW for duty in (1.0, 0.7, 0.5): print(duty, round(daily_kwh(kw, hours_on=10, duty_cycle=duty), 1), "kWh/day") The duty cycle is the input people guess wrong most often. Don't guess it if you can measure it: a smart plug (for window units) or a clamp-on current sensor on the AC circuit gives you real energy readings. Divide measured kWh by kw * hours_on over a few days and you have your actual duty cycle.
def duty_from_measurement(measured_kwh, kw, hours_on): return min(1.0, measured_kwh / (kw * hours_on)) # 3 days, 10 h/day, unit drawing 1.8 kW, meter shows 37.8 kWh print(round(duty_from_measurement(37.8, 1.8, 30), 2)) # 0.7 Slab (tiered) tariffs: price depends on the bracket
Many utilities don't charge one flat price per kWh. Consumption is split into slabs, and each slab has its own rate. Multiplying the monthly total by a single price gives the wrong answer as soon as you cross a slab boundary.
def slab_cost(kwh, slabs): """slabs: list of (upper_limit_kwh or None for 'and above', price_per_kwh).""" cost, lower = 0.0, 0 for upper, price in slabs: top = kwh if upper is None else min(kwh, upper) if top > lower: cost += (top - lower) * price if upper is None or kwh <= upper: break lower = upper return round(cost, 2) # Example slabs only: replace with the rates published by your utility. EXAMPLE_SLABS = [(2000, 0.23), (4000, 0.28), (6000, 0.32), (None, 0.38)] print(slab_cost(1500, EXAMPLE_SLABS)) # all in the first slab print(slab_cost(4500, EXAMPLE_SLABS)) # crosses three slabs Two practical notes:
- Use your utility's published rates. The numbers above are placeholders to show the method, not anyone's tariff. Utilities also add fixed charges, fuel surcharges or taxes that sit outside the per-kWh slabs.
- The AC is not alone on the meter. Slabs apply to the whole household's consumption. To estimate what the AC adds to a bill, compute the cost with and without the AC's kWh, and take the difference. That marginal cost is often higher than the average price, because the AC pushes you into a more expensive slab.
def ac_marginal_cost(base_kwh, ac_kwh, slabs): return round(slab_cost(base_kwh + ac_kwh, slabs) - slab_cost(base_kwh, slabs), 2) base = 1800 # rest of the home, kWh/month ac = daily_kwh(1.8, 10, 0.7) * 30 # 378 kWh/month print(ac_marginal_cost(base, ac, EXAMPLE_SLABS)) Putting it together
def monthly_ac_estimate(tons, eer, hours_on, duty_cycle, base_kwh, slabs, days=30): kw = electrical_kw(tons=tons, eer=eer) ac_kwh = daily_kwh(kw, hours_on, duty_cycle) * days return { "electrical_kw": round(kw, 2), "ac_kwh_month": round(ac_kwh, 1), "marginal_cost": ac_marginal_cost(base_kwh, ac_kwh, slabs), } print(monthly_ac_estimate(tons=1.5, eer=10, hours_on=10, duty_cycle=0.7, base_kwh=1800, slabs=EXAMPLE_SLABS)) Where estimates go wrong
| Mistake | Effect | Fix |
|---|---|---|
| Using cooling kW (tons × 3.517) as electrical kW | Overstates power roughly 2.5–4x | Convert with EER or COP |
| Assuming 100% duty cycle | Overstates energy | Measure with a smart plug or CT clamp |
| One flat price per kWh | Wrong cost when slabs are crossed | Use slab maths on the whole meter |
| Ignoring the rest of the home | Understates the AC's real cost | Compute the marginal cost |
| Using a nameplate EER for an old, dirty unit | Understates power | Measure, or derate the EER |
The same approach works for any appliance with a rated power and a variable duty cycle: water heaters, pumps or server-room cooling. Keep the inputs explicit, measure what you can, and let the code do the bracket arithmetic.
Cover image: a wall-mounted split AC indoor unit, by Dinkun Chen via Wikimedia Commons, CC BY-SA 4.0.
About the author: we build monitoring and energy-efficiency systems for facilities at SAQRON Technologies.
Sources
- Ton of refrigeration (Wikipedia)
- Seasonal energy efficiency ratio (EER section) (Wikipedia)
- Coefficient of performance (Wikipedia)
Disclosure: this article was prepared with AI assistance and reviewed for accuracy by our team before publication.

