1---
2app_version: 0.1.0
3precision: 2
4form_title: Electricity Cost Calculator
5form_description: Calculate how much your electrical devices really cost. Enter power consumption, daily usage and electricity price to see daily, monthly and yearly costs.
6form_inputs: Power|power{W}, Daily usage|hours{h}, Electricity price|price{€/kWh}, Number of devices|count
7form_outputs: Daily cost|daily_cost, Monthly cost|monthly_cost, Yearly cost|yearly_cost, Cost per device|cost_per_device
8---
9# Electricity Cost Calculator
10// How much do your devices really cost to run?
11
12# Device specifications
13// Real units all the way through: W · h is energy, and it cancels against the
14// kWh in the price. No manual /1000 anywhere.
15power = 1500 W // device power
16hours = 4 h // hours used per day
17price = 0.30 €/kWh // electricity price
18count = 1 // number of such devices
19
20# Calculations
21// Energy consumption per day
22energy_per_day = power * hours
23
24// Cost calculations
25daily_cost = energy_per_day * price * count
26monthly_cost = daily_cost * 30 // average month
27yearly_cost = daily_cost * 365
28
29// Cost per single device
30cost_per_device = daily_cost / count
31
32# Additional useful calculations
33// Cost for different usage patterns
34weekend_hours = 8 h
35weekend_daily_cost = power * weekend_hours * price * count
36weekly_cost = daily_cost * 5 + weekend_daily_cost * 2
37
38// What if price changes?
39price_high = 0.40 €/kWh
40price_low = 0.25 €/kWh
41daily_cost_high = energy_per_day * price_high * count
42daily_cost_low = energy_per_day * price_low * count
43
44# Results
45"Power per device": power
46"Energy per day": energy_per_day * count
47
48"Daily cost": daily_cost
49"Monthly cost, ~30 days": monthly_cost
50"Yearly cost": yearly_cost
51
52"Weekly cost, 5 weekdays + 2 weekend days": weekly_cost
53
54"At high price, 0.40 €/kWh": daily_cost_high
55"At low price, 0.25 €/kWh": daily_cost_low
56
57// How much can you save by using less?
58reduction_1h = power * 1 h * price * count * 365
59reduction_2h = power * 2 h * price * count * 365
60
61"Yearly savings by reducing 1h/day": reduction_1h
62"Yearly savings by reducing 2h/day": reduction_2h
63