Estimating Air Conditioner Energy Use and Cost in Python
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…
An air conditioner's energy consumption and cost cannot be accurately determined by simply looking at the tonnage or cooling capacity printed on the unit. This is because the wattage drawn by the AC depends on its efficiency rating (EER or COP) and the duty cycle of the compressor, which varies based on whether it is a fixed-speed or inverter unit.
In Python, you can calculate the electrical power consumption in kilowatts using a function that takes in the cooling capacity (in tons or BTU/h), efficiency rating (EER or COP), and returns the electrical power in kW. The function also allows for the specification of the duty cycle, which represents the fraction of time the compressor is running at full power. This is crucial as a fixed-speed compressor turns on and off, while an inverter compressor varies its speed.
To find the daily energy consumption, the function `daily_kwh` is used. It multiplies the electrical power by the number of hours the unit runs per day and the duty cycle. This gives the total kWh consumed per day.
When dealing with tiered or slab tariffs, where the price per kWh varies based on consumption brackets, a separate function `slab_cost` is provided. This function accepts a list of tuples, each containing the upper limit of the consumption bracket (or None for the 'and above' bracket) and the corresponding price per kWh. The function then calculates the total cost based on the amount of energy consumed in each bracket.
In practice, to get accurate measurements of real-world energy usage, it is recommended to use a smart plug or a clamp-on current sensor to monitor the actual consumption. By dividing the measured kWh by the calculated kW and hours on, you can determine the actual duty cycle of the air conditioner. This information is vital for understanding the true energy costs and for optimizing the usage of the device.
Rewritten by urgent.news; may contain errors — check the original.
Source: dev.to