Electricity Costs

← All samples

electricity-costs.dply
1---
2version: 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 (W)|power_w, Daily usage (h)|hours, Electricity price (€/kWh)|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# draftply – Electricity Cost Calculator
10# How much do your devices really cost to run?
11
12# ── Device specifications ───────────────────────────────
13# Plain numbers here, units in the names and comments: draftply treats
14# W·h and kWh as different units, so the kWh price would not cancel out.
15power_w = 1500 # device power in watts
16hours = 4 # hours used per day
17price_kwh = 0.30 # € per kilowatt-hour
18count = 1 # number of such devices
19
20# ── Calculations ──────────────────────────────────────
21# Energy consumption per day, in kWh
22kwh_per_day = power_w / 1000 * hours
23
24# Cost calculations (all in €)
25daily_cost = kwh_per_day * price_kwh * 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
35weekend_daily_cost = power_w / 1000 * weekend_hours * price_kwh * count
36weekly_cost = daily_cost * 5 + weekend_daily_cost * 2
37
38# What if price changes?
39price_high = 0.40
40price_low = 0.25
41daily_cost_high = kwh_per_day * price_high * count
42daily_cost_low = kwh_per_day * price_low * count
43
44# ── Results ─────────────────────────────────────────────
45"Power per device (W)": power_w
46"Energy per day (kWh)": kwh_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_w / 1000 * 1 * price_kwh * count * 365
59reduction_2h = power_w / 1000 * 2 * price_kwh * count * 365
60
61"Yearly savings by reducing 1h/day (€)": reduction_1h
62"Yearly savings by reducing 2h/day (€)": reduction_2h
63