EV Charging Cost

← All samples

ev-charging-cost.dply
1---
2version: 0.1.0
3precision: 3
4form_title: EV Charging Cost
5form_description: Calculate the true cost of charging an electric vehicle. Compare home charging vs public charging and vs gasoline.
6form_inputs: Battery capacity|capacity{kWh}, Home price|home_price{€/kWh}, Public price|public_price{€/kWh}, Annual km|km_year{km}, Consumption|consumption{kWh/100km}, Gasoline price|gas_price{€/L}, Gas consumption|gas_consumption{L/100km}
7form_outputs: Home charge cost|home_cost, Public charge cost|public_cost, Gasoline cost|gas_cost, Annual savings vs gas|savings, Cost per km home|cost_km_home
8---
9# draftply – EV Charging Cost Calculator
10# How much does it really cost to charge an EV?
11
12# ── Vehicle parameters ──────────────────────────────────
13capacity = 60 kWh # battery capacity
14km_year = 15000 km # annual distance
15consumption = 16 kWh/100km # EV consumption
16
17# ── Electricity prices ────────────────────────────────
18home_price = 0.30/kWh # home charging price
19public_price = 0.50/kWh # public charging price
20
21# ── Gasoline comparison ────────────────────────────────
22gas_price = 1.80/L
23gas_consumption = 6.5 L/100km # gasoline car consumption
24
25# ── Calculations ──────────────────────────────────────
26# Annual electricity needed for EV
27annual_kwh = km_year * consumption
28
29# Annual charging cost at home
30home_cost = annual_kwh * home_price
31
32# Annual charging cost at public stations
33public_cost = annual_kwh * public_price
34
35# Cost per km for EV
36cost_km_home = home_price * consumption
37cost_km_public = public_price * consumption
38
39# Gasoline car annual fuel cost
40gas_annual_liters = km_year * gas_consumption
41gas_cost = gas_annual_liters * gas_price
42
43# Savings vs gasoline
44savings_home = gas_cost - home_cost
45savings_public = gas_cost - public_cost
46
47# CO2 comparison (EV: 50g/km with German mix, Gas: 231g/L * consumption)
48co2_ev = km_year * 0.05 kg/km # CO2 per year for EV
49co2_gas = gas_annual_liters * 2.31 kg/L # CO2 per year for gas car
50co2_savings = co2_gas - co2_ev
51
52# ── Results ─────────────────────────────────────────────
53"Battery capacity": capacity
54"Annual km": km_year
55"EV consumption": consumption
56
57"Annual electricity needed": annual_kwh
58
59"Charging at home per year": home_cost
60"Charging publicly per year": public_cost
61"Cost per km (home)": cost_km_home
62"Cost per km (public)": cost_km_public
63
64"Gasoline cost per year": gas_cost
65"Savings vs gas (home charging)": savings_home
66"Savings vs gas (public charging)": savings_public
67
68"Annual CO2 (EV)": co2_ev
69"Annual CO2 (gas car)": co2_gas
70"CO2 saved per year": co2_savings
71
72# Break-even: at what electricity price is EV same cost as gas?
73break_even_price = (gas_price * gas_consumption) / consumption
74"Break-even electricity price": break_even_price
75