1---
2app_version: 0.1.0
3precision: 2
4form_title: Solar payback
5form_description: Enter your system, then read off the yearly return, the payback time and the savings curve — live.
6form_inputs: System size (kWp)|size, Yield per kWp and year|yield_kwh{kWh}, Self-consumption|self_use[35 %:0.35,50 %:0.5,70 %:0.7], Price you avoid|price_buy{€/kWh}, Feed-in tariff|price_feed{€/kWh}, Upfront cost|invest{€}
7form_outputs: Return per year|return_yr, Payback (years)|payback
8form_plots: 1
9---
10# Solar payback
11// "When has my PV system paid for itself?"
12// This notebook also has a FORM (Pro): Form → Form view for an input mask
13// with the savings chart built in. Change any input — everything re-solves.
14
15# Your system
16// The units do the bookkeeping: kWh × €/kWh cancels to €, so the yearly
17// return comes out in euros without a single manual conversion.
18size = 8 // kWp installed (a plain count — kWp is not a unit here)
19yield_kwh = 950 kWh // per kWp and year
20self_use = 0.35 // share you consume yourself
21price_buy = 0.34 €/kWh // what you no longer pay the utility
22price_feed = 0.082 €/kWh // feed-in tariff
23invest = 12000 € // upfront cost
24
25# Yearly result
26prod = size * yield_kwh
27saved = prod * self_use * price_buy
28earned = prod * (1 - self_use) * price_feed
29return_yr = saved + earned
30"Production per year": prod
31"Return per year": return_yr
32
33# Payback
34// € / € — the units cancel, and what is left is the number of years.
35payback = invest / return_yr
36
37// Exact break-even, solved from return_yr * t = invest
38solve(return_yr * t - invest, t)
39
40// Net cumulative savings after N years (investment paid back)
41net(year) = return_yr * year - invest
42After {10} years: {net(10)}
43After {20} years: {net(20)}
44
45# The picture
46// This is the chart the form embeds (form_plots: 1).
47plot(return_yr * x - invest, 0..20, "Solar payback", "year", "€")
48