1---
2app_version: 0.1.0
3precision: 2
4form_title: Carpool Savings
5form_description: Calculate how much you save by carpooling. Enter distance, fuel consumption, fuel price and number of passengers to see savings and CO2 reduction.
6form_inputs: One-way distance|distance{km}, Fuel consumption|consumption{L/100km}, Fuel price|fuel_price{€/L}, Days per week|days, Weeks per year|weeks, Passengers|passengers{}
7form_outputs: Weekly fuel cost solo|cost_solo_week, Weekly fuel cost shared (per person)|cost_shared_week, Weekly savings|savings_week, Annual savings|savings_year, CO2 saved|co2_saved
8---
9# Carpool Savings Calculator
10// How much do you save by sharing rides?
11
12# Trip parameters
13distance = 25 km // one-way distance to work
14consumption = 7 L/100km // car fuel consumption
15fuel_price = 1.80 €/L // current fuel price
16days = 5 // work days per week
17weeks = 50 // work weeks per year
18passengers = 3 // total people in carpool (including driver)
19
20# Calculations
21// Round trip distance
22round_trip = distance * 2
23
24// Fuel per trip
25fuel_per_trip = round_trip * consumption
26
27// Cost per trip solo (driver only)
28cost_per_trip_solo = fuel_per_trip * fuel_price
29
30// Cost per trip when shared
31cost_per_trip_shared = cost_per_trip_solo // total cost stays the same
32
33// Cost per person per trip
34cost_per_person = cost_per_trip_shared / passengers
35
36// Weekly costs
37cost_solo_week = cost_per_trip_solo * days
38cost_shared_week = cost_per_person * days
39
40// Weekly savings (what you save by carpooling)
41savings_week = cost_per_trip_solo * days - cost_per_person * days
42
43// Annual savings
44savings_year = savings_week * weeks
45
46// CO2 emissions (approx 2.31 kg CO2 per liter of gasoline)
47co2_per_liter = 2.31 kg/L
48co2_solo_year = fuel_per_trip * days * weeks * co2_per_liter
49co2_shared_year = co2_solo_year / passengers // per person
50co2_saved = co2_solo_year - co2_shared_year // saved per person
51
52// Total fuel saved per year
53fuel_solo_year = fuel_per_trip * days * weeks
54fuel_shared_year = fuel_solo_year // same total, but shared
55
56# Results
57"One-way distance": distance
58"Passengers (total)": passengers
59
60"Fuel per round trip": fuel_per_trip
61"Cost per round trip": cost_per_trip_solo
62
63"Weekly cost solo": cost_solo_week
64"Weekly cost shared per person": cost_shared_week
65"Weekly savings per person": savings_week
66
67"Annual savings per person": savings_year
68
69"Annual CO2 saved": co2_saved
70"Fuel saved per year (if this replaces solo trips)": fuel_solo_year * (1 - 1/passengers)
71