1---
2version: 0.1.0
3precision: 3
4form_title: Car Total Cost of Ownership
5form_description: Calculate the true cost of owning a car. Enter purchase price, consumption, insurance, maintenance and depreciation to see cost per km and per year.
6form_inputs: Purchase price|price{€}, Annual km|km_year{km}, Fuel consumption|consumption{L/100km}, Fuel price|fuel_price{€/L}, Insurance|insurance{€}, Maintenance|maintenance{€}, Depreciation|depreciation{%}
7form_outputs: Fuel cost/year|fuel_year, Total cost/year|cost_year, Cost/km|cost_km, 5-year cost|cost_5yr
8---
9# draftply – Car Total Cost of Ownership
10# What does your car really cost?
11
12# ── Car details ────────────────────────────────────────
13price = 25000 € # purchase price
14km_year = 15000 km # annual kilometers driven
15consumption = 6.5 L/100km # fuel consumption
16fuel_price = 1.80 €/L # fuel price
17insurance = 800 € # annual insurance
18maintenance = 500 € # annual maintenance/repairs
19depreciation = 15 % # annual value loss
20
21# ── Cost calculations ──────────────────────────────────
22# Fuel cost per year
23fuel_year = km_year * consumption * fuel_price
24
25# Depreciation per year
26depreciation_year = price * depreciation
27
28# Total cost per year (excluding depreciation)
29running_cost_year = fuel_year + insurance + maintenance
30
31# Total cost per year (including depreciation)
32cost_year = running_cost_year + depreciation_year
33
34# Cost per kilometer
35cost_km = cost_year / km_year
36
37# 5-year total cost (purchase + 5 years of ownership)
38# After 5 years, car is worth: price * (1 - depreciation)^5
39residual_value_5yr = price * (1 - depreciation)^5
40cost_5yr = price - residual_value_5yr + running_cost_year * 5
41
42# Cost per km over 5 years
43cost_km_5yr = cost_5yr / (km_year * 5)
44
45# ── Results ─────────────────────────────────────────────
46"Purchase price": price
47"Annual km": km_year
48"Fuel consumption": consumption
49"Fuel price": fuel_price
50
51"Annual fuel cost": fuel_year
52"Annual insurance": insurance
53"Annual maintenance": maintenance
54"Annual depreciation": depreciation_year
55
56"Total annual cost": cost_year
57"Cost per km": cost_km
58
59"5-year total cost": cost_5yr
60"5-year cost per km": cost_km_5yr
61"Residual value after 5 years": residual_value_5yr
62