aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouis <louis@dnge.de>2026-11-06 16:43:57 +0100
committerLouis <louis@dnge.de>2026-11-06 16:43:57 +0100
commit651afa5e560808f1bb87d292a584d2f097851db3 (patch)
tree92309cf58a16b9ddc3652b75583e89215b737871
downloaddeckungsanteil-651afa5e560808f1bb87d292a584d2f097851db3.tar.gz
Heat pump coverage calculator for all German postcodes
Static web app modelled on BWP WPsim: hourly DWD temperatures per postcode, manual bivalence point, COP estimate from the Remko LWM 110 datasheet, backup fuel types and costs. Weather data is built locally with scripts/prep.py and not part of the repository. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
-rw-r--r--.gitignore7
-rw-r--r--LICENSE21
-rw-r--r--README.md66
-rw-r--r--scripts/prep.py204
-rw-r--r--web/app.js503
-rw-r--r--web/index.html141
-rw-r--r--web/style.css118
7 files changed, 1060 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..81d6109
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,7 @@
+# generated weather data (build with scripts/prep.py)
+web/data/
+.cache/
+.venv/
+.playwright-mcp/
+__pycache__/
+.DS_Store
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..dd3b35c
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2026 Louis
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..c942e7f
--- /dev/null
+++ b/README.md
@@ -0,0 +1,66 @@
+# Deckungsanteil Wärmepumpe
+
+Like BWP WPsim, but for every German postcode. Hourly DWD air temperatures 2007–2025
+(about 470 stations, nearest station per postcode) drive a simple model:
+
+- Heating load linear from Norm-Heizlast at Norm-Außentemperatur to 0 at the heating limit.
+- Heat pump capacity equals the load at the (manual) bivalence point and changes by a
+ fixed %/K with outdoor temperature. Modes: monovalent, bivalent-parallel (optional
+ cut-off temperature), bivalent-alternativ.
+- COP from the Remko LWM 110 datasheet (A−7/A2/A7 at W35), transferred to other flow
+ temperatures via the Carnot efficiency; flow temperature fixed or weather-compensated.
+- Backup fuel: heater rod, natural gas, LPG, oil, pellets or firewood, with amounts in kWh, m³, l, kg or rm.
+- Results: heat demand, coverage shares, JAZ, electricity, costs; charts and CSV export.
+
+The app is static HTML/JS; all calculations run in the browser.
+
+## Quick start
+
+The weather data is not part of this repository. Build it once from the original sources
+(needs Python ≥ 3.10 and numpy; downloads about 700 MB into `.cache/`, writes about
+150 MB to `web/data/`, takes a few minutes):
+
+```sh
+python3 -m venv .venv && .venv/bin/pip install numpy
+.venv/bin/python scripts/prep.py
+```
+
+Then serve the `web/` directory and open http://127.0.0.1:8765:
+
+```sh
+python3 -m http.server 8765 -d web
+```
+
+Re-running `scripts/prep.py` reuses the downloads in `.cache/`; delete that directory to
+fetch fresh data (for example after DWD publishes a new year).
+
+## What `scripts/prep.py` does
+
+1. Downloads the station list and hourly air temperature archives (`historical/`) from the
+ [DWD Climate Data Center](https://opendata.dwd.de/climate_environment/CDC/observations_germany/climate/hourly/air_temperature/historical/).
+2. Keeps years with at most 3 % missing hours and no gap over 72 h (gaps are interpolated)
+ and stations with at least 10 such years.
+3. Estimates the Norm-Außentemperatur per station as the two-day mean undercut on 10 days
+ in 20 years. This is within about 0.5–2.5 K of the DIN/TS 12831-1 values (usually
+ warmer); the user can override it.
+4. Downloads [GeoNames postal codes](https://download.geonames.org/export/zip/) and assigns
+ each postcode to its nearest station.
+
+## Limitations
+
+- No altitude correction between postcode and station.
+- JAZ ignores cycling, circulation pump and hot water, so it is on the optimistic side.
+- LWM 110 datasheet values were taken from retailer listings; check them against the
+ manufacturer's datasheet.
+- Not affiliated with BWP, Remko or DWD.
+
+## License and data sources
+
+Code: [MIT](LICENSE).
+
+The generated data is subject to its sources' terms:
+
+- Weather data: Deutscher Wetterdienst (DWD), Climate Data Center, hourly air temperature,
+ see the [DWD terms of use](https://opendata.dwd.de/climate_environment/CDC/Terms_of_use.pdf).
+ Attribution: "Datenbasis: Deutscher Wetterdienst".
+- Postcodes: [GeoNames](https://www.geonames.org/), CC BY 4.0.
diff --git a/scripts/prep.py b/scripts/prep.py
new file mode 100644
index 0000000..a55918d
--- /dev/null
+++ b/scripts/prep.py
@@ -0,0 +1,204 @@
+"""Build the weather data for the web app from DWD open data and GeoNames.
+
+Output (web/data/):
+ stations.json station metadata, valid years, estimated Norm-Außentemperatur
+ plz.json postcode -> [place, lat, lon, station id, distance km]
+ t/<id>.bin int16 hourly temperatures in 0.1 °C, YEARS x 8760 (Feb 29 dropped),
+ MISSING for invalid years
+"""
+
+import io
+import json
+import math
+import re
+import sys
+import urllib.request
+import zipfile
+from concurrent.futures import ThreadPoolExecutor
+from pathlib import Path
+
+import numpy as np
+
+DWD = "https://opendata.dwd.de/climate_environment/CDC/observations_germany/climate/hourly/air_temperature/historical/"
+GEONAMES = "https://download.geonames.org/export/zip/DE.zip"
+YEARS = list(range(2007, 2026))
+HOURS = 8760
+MISSING = -32768
+MAX_MISSING_SHARE = 0.03 # a year with more gaps is dropped
+MAX_GAP_HOURS = 72 # a longer single gap also drops the year
+MIN_YEARS = 10 # a station needs this many valid years to be used
+
+ROOT = Path(__file__).resolve().parent.parent
+OUT = ROOT / "web" / "data"
+CACHE = ROOT / ".cache"
+
+
+def fetch(url: str) -> bytes:
+ path = CACHE / (url.rsplit("/", 1)[1] or "index.html")
+ if not path.exists():
+ with urllib.request.urlopen(url, timeout=120) as r:
+ path.write_bytes(r.read())
+ return path.read_bytes()
+
+
+def read_station_list() -> dict:
+ text = fetch(DWD + "TU_Stundenwerte_Beschreibung_Stationen.txt").decode("latin1")
+ stations = {}
+ for line in text.splitlines()[2:]:
+ parts = line.split()
+ if len(parts) < 8:
+ continue
+ sid, von, bis, elev, lat, lon = parts[:6]
+ # name may contain spaces; Bundesland and Abgabe are the last two fields
+ name = " ".join(parts[6:-2])
+ stations[sid] = dict(id=sid, von=int(von), bis=int(bis), elev=int(elev),
+ lat=float(lat), lon=float(lon), name=name, land=parts[-2])
+ return stations
+
+
+def zip_names() -> dict:
+ html = fetch(DWD).decode()
+ names = {}
+ for m in re.finditer(r'href="(stundenwerte_TU_(\d{5})_\d{8}_\d{8}_hist\.zip)"', html):
+ names[m.group(2)] = m.group(1)
+ return names
+
+
+def hour_index(year: int) -> dict:
+ """Map (month, day, hour) of a non-leap year to the hour index 0..8759."""
+ idx, i = {}, 0
+ for month, days in enumerate([31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], 1):
+ for day in range(1, days + 1):
+ for hour in range(24):
+ idx[(month, day, hour)] = i
+ i += 1
+ return idx
+
+
+HOUR_INDEX = hour_index(2001)
+
+
+def fill_year(values: np.ndarray) -> np.ndarray | None:
+ """Interpolate gaps linearly, or return None if the year is too incomplete."""
+ missing = np.isnan(values)
+ if missing.mean() > MAX_MISSING_SHARE:
+ return None
+ if missing.any():
+ # longest run of missing values
+ edges = np.diff(np.concatenate([[0], missing.astype(int), [0]]))
+ runs = np.flatnonzero(edges == -1) - np.flatnonzero(edges == 1)
+ if runs.max() > MAX_GAP_HOURS:
+ return None
+ x = np.arange(HOURS)
+ values = values.copy()
+ values[missing] = np.interp(x[missing], x[~missing], values[~missing])
+ return values
+
+
+def load_station(sid: str, zip_name: str) -> np.ndarray:
+ data = np.full((len(YEARS), HOURS), np.nan)
+ with zipfile.ZipFile(io.BytesIO(fetch(DWD + zip_name))) as z:
+ product = next(n for n in z.namelist() if n.startswith("produkt_tu_stunde"))
+ lines = z.read(product).decode("latin1").splitlines()[1:]
+ for line in lines:
+ f = line.split(";")
+ stamp = f[1].strip()
+ year = int(stamp[:4])
+ if year < YEARS[0] or year > YEARS[-1]:
+ continue
+ key = (int(stamp[4:6]), int(stamp[6:8]), int(stamp[8:10]))
+ if key not in HOUR_INDEX: # Feb 29
+ continue
+ t = float(f[3])
+ if t > -999:
+ data[year - YEARS[0], HOUR_INDEX[key]] = t
+ out = np.full((len(YEARS), HOURS), MISSING, dtype=np.int16)
+ for y in range(len(YEARS)):
+ filled = fill_year(data[y])
+ if filled is not None:
+ out[y] = np.round(filled * 10).astype(np.int16)
+ return out
+
+
+def norm_outdoor_temp(series: np.ndarray) -> float | None:
+ """Estimate the Norm-Außentemperatur as in DIN EN 12831: the lowest two-day
+ mean reached or undercut 10 times in 20 years (counted in days)."""
+ valid = [y for y in range(len(YEARS)) if series[y, 0] != MISSING]
+ means = []
+ for a, b in zip(valid, valid[1:]):
+ if b != a + 1:
+ continue
+ # winter from July of year a to June of year b
+ winter = np.concatenate([series[a, 181 * 24:], series[b, :181 * 24]]) / 10
+ daily = winter.reshape(-1, 24).mean(axis=1)
+ means.append((daily[1:] + daily[:-1]) / 2)
+ if len(means) < 5:
+ return None
+ winters = len(means)
+ means = np.sort(np.concatenate(means))
+ return round(float(means[winters * 10 // 20]), 1)
+
+
+def haversine(lat1, lon1, lat2, lon2) -> float:
+ p1, p2 = math.radians(lat1), math.radians(lat2)
+ a = (math.sin((p2 - p1) / 2) ** 2
+ + math.cos(p1) * math.cos(p2) * math.sin(math.radians(lon2 - lon1) / 2) ** 2)
+ return 12742 * math.asin(math.sqrt(a))
+
+
+def read_postcodes() -> dict:
+ with zipfile.ZipFile(io.BytesIO(fetch(GEONAMES))) as z:
+ text = z.read("DE.txt").decode("utf-8")
+ sums = {}
+ for line in text.splitlines():
+ f = line.split("\t")
+ plz, place, lat, lon = f[1], f[2], float(f[9]), float(f[10])
+ s = sums.setdefault(plz, [place, 0.0, 0.0, 0])
+ s[1] += lat
+ s[2] += lon
+ s[3] += 1
+ return {plz: (place, lat / n, lon / n) for plz, (place, lat, lon, n) in sums.items()}
+
+
+def main():
+ CACHE.mkdir(exist_ok=True)
+ (OUT / "t").mkdir(parents=True, exist_ok=True)
+
+ stations = read_station_list()
+ zips = zip_names()
+ candidates = [s for sid, s in stations.items()
+ if sid in zips and s["von"] <= 20120101 and s["bis"] >= 20240101]
+ print(f"{len(candidates)} candidate stations", file=sys.stderr)
+
+ def work(s):
+ series = load_station(s["id"], zips[s["id"]])
+ return s, series
+
+ used = []
+ with ThreadPoolExecutor(8) as pool:
+ for i, (s, series) in enumerate(pool.map(work, candidates), 1):
+ years = [YEARS[y] for y in range(len(YEARS)) if series[y, 0] != MISSING]
+ print(f"\r{i}/{len(candidates)} {s['name'][:30]:30} {len(years)} years",
+ end="", file=sys.stderr)
+ if len(years) < MIN_YEARS:
+ continue
+ series.tofile(OUT / "t" / f"{s['id']}.bin")
+ used.append(dict(id=s["id"], name=s["name"], land=s["land"], lat=s["lat"],
+ lon=s["lon"], elev=s["elev"], years=years,
+ tnorm=norm_outdoor_temp(series)))
+ print(f"\n{len(used)} stations with at least {MIN_YEARS} valid years", file=sys.stderr)
+
+ plz = {}
+ for code, (place, lat, lon) in sorted(read_postcodes().items()):
+ best = min(used, key=lambda s: haversine(lat, lon, s["lat"], s["lon"]))
+ plz[code] = [place, round(lat, 4), round(lon, 4), best["id"],
+ round(haversine(lat, lon, best["lat"], best["lon"]), 1)]
+ print(f"{len(plz)} postcodes", file=sys.stderr)
+
+ meta = dict(years=YEARS, hours=HOURS, missing=MISSING, stations=used)
+ (OUT / "stations.json").write_text(json.dumps(meta, ensure_ascii=False))
+ (OUT / "plz.json").write_text(json.dumps(plz, ensure_ascii=False, separators=(",", ":")))
+
+
+if __name__ == "__main__":
+ main()
diff --git a/web/app.js b/web/app.js
new file mode 100644
index 0000000..a9f7e07
--- /dev/null
+++ b/web/app.js
@@ -0,0 +1,503 @@
+"use strict";
+
+const $ = (id) => document.getElementById(id);
+const MONTH_DAYS = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
+const MONTH_NAMES = ["Jan", "Feb", "Mär", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez"];
+const HOUR_MONTH = new Uint8Array(8760);
+{
+ let h = 0;
+ MONTH_DAYS.forEach((days, m) => { HOUR_MONTH.fill(m, h, h + days * 24); h += days * 24; });
+}
+
+// Remko LWM 110 datasheet, full load at W35: [outdoor °C, COP]
+const LWM110_W35 = [[-7, 3.42], [2, 4.04], [7, 5.02]];
+// constant source temperature of ground and water heat pumps, and their Carnot efficiency
+const SOURCE = { brine: [0, 0.68], water: [10, 0.68], dx: [-2, 0.68] };
+const K = 273.15;
+
+// Carnot COP between condensing (5 K above flow) and evaporating (6 K below source) temperature
+const carnot = (flow, source) => (flow + 5 + K) / (flow + 5 - (source - 6));
+const COP_MAX = 6.5;
+const LWM110_ETA = LWM110_W35.map(([t, cop]) => [t, cop / carnot(35, t)]);
+
+function interp(points, x) {
+ if (x <= points[0][0]) return points[0][1];
+ for (let i = 1; i < points.length; i++) {
+ const [x0, y0] = points[i - 1], [x1, y1] = points[i];
+ if (x <= x1) return y0 + ((y1 - y0) * (x - x0)) / (x1 - x0);
+ }
+ return points[points.length - 1][1];
+}
+
+// Backup heating fuels, energy content as lower heating value. `perPrice` is the energy in
+// kWh bought per price unit and `scale` converts the price to euros.
+const FUELS = {
+ electric: { unit: "kWh", kwh: 1, price: 28, priceUnit: "ct/kWh", perPrice: 1, scale: 0.01, eff: 100 },
+ gas: { unit: "m³", kwh: 10, price: 11, priceUnit: "ct/kWh", perPrice: 1, scale: 0.01, eff: 95 },
+ lpg: { unit: "l", kwh: 6.6, price: 0.7, priceUnit: "€/l", perPrice: 6.6, scale: 1, eff: 95 },
+ oil: { unit: "l", kwh: 9.8, price: 1.0, priceUnit: "€/l", perPrice: 9.8, scale: 1, eff: 95 },
+ pellets: { unit: "kg", kwh: 4.8, price: 350, priceUnit: "€/t", perPrice: 4800, scale: 1, eff: 90 },
+ wood: { unit: "rm", kwh: 1700, price: 110, priceUnit: "€/rm", perPrice: 1700, scale: 1, eff: 80 },
+};
+
+const fmt = (v, digits = 0) => v.toLocaleString("de-DE", { minimumFractionDigits: digits, maximumFractionDigits: digits });
+
+let meta, plzMap, stationById;
+const seriesCache = new Map();
+let station = null;
+let tnEdited = false;
+let lastResult = null;
+let binView = "energy";
+
+// ---------- data ----------
+
+async function loadSeries(id) {
+ if (!seriesCache.has(id)) {
+ const res = await fetch(`data/t/${id}.bin`);
+ const raw = new Int16Array(await res.arrayBuffer());
+ const years = new Map();
+ meta.years.forEach((year, i) => {
+ const slice = raw.subarray(i * meta.hours, (i + 1) * meta.hours);
+ if (slice[0] !== meta.missing) years.set(year, slice);
+ });
+ seriesCache.set(id, years);
+ }
+ return seriesCache.get(id);
+}
+
+/** Heating degree hours below 15 °C, used to find the coldest and warmest year. */
+function degreeHours(slice) {
+ let sum = 0;
+ for (let i = 0; i < slice.length; i++) sum += Math.max(0, 150 - slice[i]);
+ return sum;
+}
+
+function scenarioYears(series, scenario) {
+ const years = [...series.keys()];
+ if (scenario === "all") return years;
+ if (scenario === "cold" || scenario === "warm") {
+ const sorted = years.slice().sort((a, b) => degreeHours(series.get(b)) - degreeHours(series.get(a)));
+ return [scenario === "cold" ? sorted[0] : sorted[sorted.length - 1]];
+ }
+ return series.has(+scenario) ? [+scenario] : years;
+}
+
+/** Temperatures in °C as used by the chosen evaluation type. */
+function temperatures(slice, resolution) {
+ const t = new Float32Array(slice.length);
+ for (let i = 0; i < slice.length; i++) t[i] = slice[i] / 10;
+ if (resolution === "day") {
+ for (let d = 0; d < t.length; d += 24) {
+ let sum = 0;
+ for (let h = 0; h < 24; h++) sum += t[d + h];
+ t.fill(sum / 24, d, d + 24);
+ }
+ } else if (resolution === "bin") {
+ for (let i = 0; i < t.length; i++) t[i] = Math.round(t[i]);
+ }
+ return t;
+}
+
+// ---------- model ----------
+
+/**
+ * Hour-by-hour split of the heating load between heat pump and backup heater.
+ * Load is linear from qn at tn to 0 at the heating limit thg. The heat pump is
+ * sized so that its capacity equals the load at the bivalence point; its capacity
+ * changes by `slope` (fraction per K) with the outdoor temperature.
+ */
+function model(p) {
+ const tb = p.mode === "mono" ? p.tn : p.tbiv;
+ const load = (t) => (t < p.thg ? (p.qn * (p.thg - t)) / (p.thg - p.tn) : 0);
+ const pb = load(tb);
+ const capacity = (t) => Math.max(0, pb * (1 + p.slope * (t - tb)));
+ const heatPump = (t) => {
+ if (p.mode === "alternative" && t < tb) return 0;
+ if (p.mode === "parallel" && Number.isFinite(p.cutoff) && t < p.cutoff) return 0;
+ return Math.min(load(t), capacity(t));
+ };
+ const flow = (t) => {
+ if (!p.flowCurve) return p.flowN;
+ const f = 20 + ((p.flowN - 20) * (20 - t)) / (20 - p.tn);
+ return Math.min(p.flowN, Math.max(25, f));
+ };
+ const cop = (t) => {
+ if (p.type === "air") return Math.min(COP_MAX, interp(LWM110_ETA, t) * carnot(flow(t), t));
+ const [source, eta] = SOURCE[p.type];
+ return Math.min(COP_MAX, eta * carnot(flow(t), source));
+ };
+ return { tb, pb, load, capacity, heatPump, flow, cop };
+}
+
+function simulate(series, years, p) {
+ const m = model(p);
+ const n = years.length;
+ const r = {
+ years, n, tb: m.tb, pb: m.pb, model: m, params: p,
+ q: 0, hp: 0, backup: 0, el: 0, heatingHours: 0, backupHours: 0, belowTn: 0, peak: 0,
+ months: Array.from({ length: 12 }, () => ({ hp: 0, backup: 0 })),
+ els: new Float32Array(n * 8760),
+ bins: new Map(),
+ loads: new Float32Array(n * 8760),
+ hps: new Float32Array(n * 8760),
+ temps: [],
+ };
+ years.forEach((year, y) => {
+ const t = temperatures(series.get(year), p.resolution);
+ r.temps.push(t);
+ for (let i = 0; i < t.length; i++) {
+ const q = m.load(t[i]);
+ const hp = m.heatPump(t[i]);
+ const backup = q - hp;
+ r.loads[y * 8760 + i] = q;
+ r.hps[y * 8760 + i] = hp;
+ if (q <= 0) continue;
+ const el = hp > 0 ? hp / m.cop(t[i]) : 0;
+ r.els[y * 8760 + i] = el;
+ r.q += q; r.hp += hp; r.backup += backup; r.el += el;
+ r.heatingHours++;
+ if (backup > 1e-9) r.backupHours++;
+ if (t[i] < p.tn) r.belowTn++;
+ if (q > r.peak) r.peak = q;
+ r.months[HOUR_MONTH[i]].hp += hp;
+ r.months[HOUR_MONTH[i]].backup += backup;
+ const key = Math.round(t[i]);
+ const bin = r.bins.get(key) || { hours: 0, hp: 0, backup: 0, el: 0 };
+ bin.hours++; bin.hp += hp; bin.backup += backup; bin.el += el;
+ r.bins.set(key, bin);
+ }
+ });
+ // per-year averages
+ for (const k of ["q", "hp", "backup", "el", "heatingHours", "backupHours", "belowTn"]) r[k] /= n;
+ for (const month of r.months) { month.hp /= n; month.backup /= n; }
+ for (const bin of r.bins.values()) { bin.hours /= n; bin.hp /= n; bin.backup /= n; bin.el /= n; }
+ r.jaz = r.el > 0 ? r.hp / r.el : 0;
+ r.costHp = (r.el * p.priceEl) / 100;
+ r.backupFuel = r.backup / p.effBackup;
+ const fuel = FUELS[p.fuel];
+ r.backupAmount = r.backupFuel / fuel.kwh;
+ r.costBackup = (r.backupFuel / fuel.perPrice) * p.priceBackup * fuel.scale;
+ const loadTn = m.load(p.tn);
+ r.powerShareTn = loadTn > 0 ? m.heatPump(p.tn) / loadTn : 0;
+ return r;
+}
+
+// ---------- form ----------
+
+function params() {
+ const cutoff = $("cutoff").value.trim();
+ return {
+ qn: +$("qn").value,
+ tn: +$("tn").value,
+ thg: +$("thg").value,
+ mode: $("mode").value,
+ tbiv: +$("tbiv").value,
+ cutoff: cutoff === "" ? NaN : +cutoff,
+ slope: +$("slope").value / 100,
+ resolution: $("resolution").value,
+ type: $("type").value,
+ flowN: +$("flowN").value,
+ flowCurve: $("flowCurve").checked,
+ priceEl: +$("priceEl").value,
+ fuel: $("fuel").value,
+ priceBackup: +$("priceBackup").value,
+ effBackup: +$("effBackup").value / 100,
+ };
+}
+
+function validate(p) {
+ if (!(p.qn > 0)) return "Norm-Heizlast muss größer als 0 sein.";
+ if (!(p.flowN >= 25 && p.flowN <= 65)) return "Vorlauftemperatur muss zwischen 25 und 65 °C liegen.";
+ if (!(p.effBackup > 0)) return "Wirkungsgrad der Zusatzheizung muss größer als 0 sein.";
+ if (!(p.tn < p.thg)) return "Norm-Außentemperatur muss unter der Heizgrenztemperatur liegen.";
+ if (p.mode !== "mono" && !(p.tbiv < p.thg)) return "Bivalenzpunkt muss unter der Heizgrenztemperatur liegen.";
+ if (p.mode !== "mono" && p.tbiv < p.tn) return "Bivalenzpunkt unter der Norm-Außentemperatur: dann ist die Anlage praktisch monovalent.";
+ return null;
+}
+
+function showLocation() {
+ const code = $("plz").value.trim();
+ const entry = plzMap[code];
+ if (!entry) {
+ station = null;
+ $("location").textContent = code.length === 5 ? "Postleitzahl nicht gefunden." : "";
+ return;
+ }
+ const [place, , , id, dist] = entry;
+ station = stationById[id];
+ $("location").innerHTML =
+ `${place} · Station <b>${station.name}</b> (${station.elev} m ü. NN, ${fmt(dist, 1)} km entfernt, ${station.years.length} Jahre)` +
+ (dist > 25 ? ` <span class="warn">Nächste Station ist weit entfernt.</span>` : "");
+ $("tnHint").textContent = station.tnorm != null ? `(${fmt(station.tnorm, 1)} °C)` : "";
+ if (!tnEdited && station.tnorm != null) $("tn").value = station.tnorm;
+ fillScenarios();
+}
+
+function fillScenarios() {
+ const select = $("scenario");
+ const previous = select.value || "all";
+ const first = station.years[0], last = station.years[station.years.length - 1];
+ select.innerHTML =
+ `<option value="all">Mittel ${first}–${last} (${station.years.length} Jahre)</option>` +
+ `<option value="cold">Kältestes Jahr</option><option value="warm">Wärmstes Jahr</option>` +
+ station.years.slice().reverse().map((y) => `<option>${y}</option>`).join("");
+ select.value = [...select.options].some((o) => o.value === previous) ? previous : "all";
+}
+
+function updateFieldVisibility() {
+ const mode = $("mode").value;
+ $("bivalentFields").hidden = mode === "mono";
+ $("cutoffField").hidden = mode !== "parallel";
+ $("cutoffField").nextElementSibling.hidden = mode !== "parallel";
+}
+
+function onFuelChange(resetValues = true) {
+ const fuel = FUELS[$("fuel").value];
+ if (resetValues) {
+ $("priceBackup").value = fuel.price;
+ $("effBackup").value = fuel.eff;
+ }
+ $("priceBackupUnit").textContent = fuel.priceUnit;
+ $("fuelHint").textContent = fuel.unit === "kWh" ? "" :
+ `Heizwert ${fmt(fuel.kwh, fuel.kwh < 100 ? 1 : 0)} kWh/${fuel.unit}, Wirkungsgrad bezogen auf den Heizwert.`;
+}
+
+function onTypeChange() {
+ $("slope").value = $("type").value === "air" ? 3 : 0;
+}
+
+let runToken = 0;
+async function run() {
+ updateFieldVisibility();
+ if (!station) {
+ $("status").textContent = "Bitte eine gültige Postleitzahl eingeben.";
+ return;
+ }
+ const p = params();
+ const error = validate(p);
+ if (error) { $("status").textContent = error; return; }
+ const token = ++runToken;
+ const series = await loadSeries(station.id);
+ if (token !== runToken) return;
+ const years = scenarioYears(series, $("scenario").value);
+ const r = simulate(series, years, p);
+ lastResult = r;
+ $("status").textContent = years.length > 1
+ ? `Mittelwerte über ${years.length} Jahre (${years[0]}–${years[years.length - 1]}), Station ${station.name}.`
+ : `Wetterjahr ${years[0]}, Station ${station.name}.`;
+ $("tbivHint").textContent = `WP-Heizleistung am Bivalenzpunkt: ${fmt(r.pb, 1)} kW`;
+ renderKpis(r);
+ renderDuration(r);
+ renderBins(r);
+ renderMonths(r);
+}
+
+// ---------- output ----------
+
+function kpi(label, value, sub = "", cls = "") {
+ return `<div class="kpi ${cls}"><div class="label">${label}</div><div class="value">${value}</div><div class="sub">${sub}</div></div>`;
+}
+
+function renderKpis(r) {
+ const share = (x) => (r.q > 0 ? (100 * x) / r.q : 0);
+ const p = r.params;
+ $("kpis").innerHTML = [
+ kpi("Heizwärmebedarf", `${fmt(r.q)} kWh/a`, `${fmt(r.q / p.qn)} Vollbenutzungsstunden`),
+ kpi("Deckungsanteil Wärmepumpe", `${fmt(share(r.hp), 1)} %`, `${fmt(r.hp)} kWh/a`, "hp"),
+ kpi("Deckungsanteil Zusatzheizung", `${fmt(share(r.backup), 1)} %`, `${fmt(r.backup)} kWh/a`, "backup"),
+ kpi("Jahresarbeitszahl WP", fmt(r.jaz, 2), `COP bei Norm-Außentemp. ${fmt(r.model.cop(p.tn), 2)}`, "hp"),
+ kpi("Strombedarf WP", `${fmt(r.el)} kWh/a`, `${fmt(r.costHp)} €/a`, "hp"),
+ kpi(`Endenergie ${$("fuel").selectedOptions[0].text}`,
+ `${fmt(r.backupAmount, FUELS[p.fuel].unit === "rm" ? 1 : 0)} ${FUELS[p.fuel].unit}/a`,
+ `${p.fuel === "electric" ? "" : `${fmt(r.backupFuel)} kWh · `}${fmt(r.costBackup)} €/a`, "backup"),
+ kpi("Heizkosten gesamt", `${fmt(r.costHp + r.costBackup)} €/a`, `${fmt(r.q > 0 ? (100 * (r.costHp + r.costBackup)) / r.q : 0, 1)} ct/kWh Wärme`),
+ kpi("Leistungsanteil bei Norm-Außentemp.", `${fmt(100 * r.powerShareTn, 1)} %`, `WP ${fmt(r.model.heatPump(p.tn), 1)} von ${fmt(p.qn, 1)} kW`),
+ kpi("Bivalenzpunkt", `${fmt(r.tb, 1)} °C`, `WP-Leistung ${fmt(r.pb, 1)} kW`),
+ kpi("Heizstunden", `${fmt(r.heatingHours)} h/a`, `davon ${fmt(r.backupHours)} h mit Zusatzheizung`),
+ kpi("Stunden unter Norm-Außentemp.", `${fmt(r.belowTn)} h/a`, `max. Heizlast ${fmt(r.peak, 1)} kW`),
+ ].join("");
+}
+
+const W = 760, H = 280, PAD = { l: 62, r: 12, t: 10, b: 32 };
+
+function niceMax(v) {
+ if (v <= 0) return 1;
+ const e = Math.pow(10, Math.floor(Math.log10(v)));
+ return [1, 2, 2.5, 5, 10].map((f) => f * e).find((x) => x >= v);
+}
+
+function axes(xTicks, yMax, yLabel, xLabel) {
+ const ih = H - PAD.t - PAD.b;
+ let s = "";
+ for (let i = 0; i <= 4; i++) {
+ const v = (yMax * i) / 4, y = PAD.t + ih - (ih * i) / 4;
+ s += `<line class="grid" x1="${PAD.l}" x2="${W - PAD.r}" y1="${y}" y2="${y}"/>`;
+ s += `<text x="${PAD.l - 6}" y="${y + 4}" text-anchor="end">${fmt(v, v < 10 && v % 1 ? 1 : 0)}</text>`;
+ }
+ for (const [x, label] of xTicks) s += `<text x="${x}" y="${H - PAD.b + 16}" text-anchor="middle">${label}</text>`;
+ s += `<text x="12" y="${PAD.t + ih / 2}" transform="rotate(-90 12 ${PAD.t + ih / 2})" text-anchor="middle">${yLabel}</text>`;
+ s += `<text x="${PAD.l + (W - PAD.l - PAD.r) / 2}" y="${H - 2}" text-anchor="middle">${xLabel}</text>`;
+ return s;
+}
+
+function legend(items) {
+ return `<div class="legend">${items.map(([cls, label]) => `<span><i style="background:var(--${cls})"></i>${label}</span>`).join("")}</div>`;
+}
+
+function renderDuration(r) {
+ // sort all hours by load, descending; x axis is hours per year
+ const total = r.loads.length;
+ const order = Array.from({ length: total }, (_, i) => i).sort((a, b) => r.loads[b] - r.loads[a]);
+ const heating = Math.ceil(order.findIndex((i) => r.loads[i] <= 0) / r.n) || 8760;
+ const xMax = Math.min(8760, Math.ceil(heating / 500) * 500 + 500);
+ const steps = 380;
+ const iw = W - PAD.l - PAD.r, ih = H - PAD.t - PAD.b;
+ const yMax = niceMax(r.peak);
+ const px = (h) => PAD.l + (iw * h) / xMax, py = (v) => PAD.t + ih - (ih * v) / yMax;
+ const loadPts = [], hpPts = [];
+ for (let s = 0; s <= steps; s++) {
+ const idx = Math.min(total - 1, Math.floor(((s / steps) * xMax) * r.n));
+ const i = order[idx];
+ const h = (s / steps) * xMax;
+ loadPts.push(`${px(h)},${py(r.loads[i])}`);
+ hpPts.push(`${px(h)},${py(r.hps[i])}`);
+ }
+ const base = `${px(xMax)},${py(0)} ${px(0)},${py(0)}`;
+ const ticks = [];
+ for (let h = 0; h <= xMax; h += xMax > 4000 ? 1000 : 500) ticks.push([px(h), fmt(h)]);
+ $("duration").innerHTML =
+ `<svg viewBox="0 0 ${W} ${H}" role="img" aria-label="Jahresdauerlinie">` +
+ axes(ticks, yMax, "Heizlast [kW]", "Stunden pro Jahr") +
+ `<polygon class="backup" points="${loadPts.join(" ")} ${base}"/>` +
+ `<polygon class="hp" points="${hpPts.join(" ")} ${base}"/>` +
+ `</svg>` + legend([["hp", "Wärmepumpe"], ["backup", "Zusatzheizung"]]);
+}
+
+function renderBins(r) {
+ const keys = [...r.bins.keys()].sort((a, b) => a - b);
+ if (!keys.length) { $("bins").innerHTML = ""; return; }
+ const lo = keys[0], hi = keys[keys.length - 1];
+ const iw = W - PAD.l - PAD.r, ih = H - PAD.t - PAD.b;
+ const count = hi - lo + 1, bw = iw / count;
+ const energy = binView === "energy";
+ const value = (b) => (energy ? b.hp + b.backup : b.hours);
+ const yMax = niceMax(Math.max(...keys.map((k) => value(r.bins.get(k)))));
+ const py = (v) => PAD.t + ih - (ih * v) / yMax;
+ let bars = "";
+ const ticks = [];
+ for (let k = lo; k <= hi; k++) {
+ const x = PAD.l + (k - lo) * bw;
+ if (k % 5 === 0) ticks.push([x + bw / 2, k]);
+ const b = r.bins.get(k);
+ if (!b) continue;
+ const title = `<title>${k} °C: ${fmt(b.hours)} h, WP ${fmt(b.hp)} kWh, Zusatz ${fmt(b.backup)} kWh</title>`;
+ if (energy) {
+ const yHp = py(b.hp), yTop = py(b.hp + b.backup);
+ bars += `<g>${title}<rect class="hp" x="${x + 0.5}" width="${bw - 1}" y="${yHp}" height="${py(0) - yHp}"/>` +
+ `<rect class="backup" x="${x + 0.5}" width="${bw - 1}" y="${yTop}" height="${yHp - yTop}"/></g>`;
+ } else {
+ const cls = b.backup > 1e-9 ? (b.hp > 1e-9 ? "backup" : "uncovered") : "hp";
+ bars += `<g>${title}<rect class="${cls}" x="${x + 0.5}" width="${bw - 1}" y="${py(b.hours)}" height="${py(0) - py(b.hours)}"/></g>`;
+ }
+ }
+ const toggle = `<div class="actions" style="margin:0 0 6px">` +
+ `<button type="button" data-view="energy"${energy ? ' aria-pressed="true"' : ""}>Wärme</button>` +
+ `<button type="button" data-view="hours"${energy ? "" : ' aria-pressed="true"'}>Stunden</button></div>`;
+ $("bins").innerHTML = toggle +
+ `<svg viewBox="0 0 ${W} ${H}" role="img" aria-label="Bins">` +
+ axes(ticks, yMax, energy ? "Wärme [kWh/a]" : "Stunden [h/a]", "Außentemperatur [°C]") + bars + `</svg>` +
+ legend(energy ? [["hp", "Wärmepumpe"], ["backup", "Zusatzheizung"]]
+ : [["hp", "nur WP"], ["backup", "WP + Zusatzheizung"], ["uncovered", "nur Zusatzheizung"]]);
+ $("bins").querySelectorAll("button").forEach((b) =>
+ b.addEventListener("click", () => { binView = b.dataset.view; renderBins(lastResult); }));
+}
+
+function renderMonths(r) {
+ const iw = W - PAD.l - PAD.r, ih = H - PAD.t - PAD.b, bw = iw / 12;
+ const yMax = niceMax(Math.max(...r.months.map((m) => m.hp + m.backup)));
+ const py = (v) => PAD.t + ih - (ih * v) / yMax;
+ let bars = "";
+ const ticks = [];
+ r.months.forEach((m, i) => {
+ const x = PAD.l + i * bw;
+ ticks.push([x + bw / 2, MONTH_NAMES[i]]);
+ const yHp = py(m.hp), yTop = py(m.hp + m.backup);
+ bars += `<g><title>${MONTH_NAMES[i]}: WP ${fmt(m.hp)} kWh, Zusatz ${fmt(m.backup)} kWh</title>` +
+ `<rect class="hp" x="${x + 4}" width="${bw - 8}" y="${yHp}" height="${py(0) - yHp}"/>` +
+ `<rect class="backup" x="${x + 4}" width="${bw - 8}" y="${yTop}" height="${yHp - yTop}"/></g>`;
+ });
+ $("months").innerHTML =
+ `<svg viewBox="0 0 ${W} ${H}" role="img" aria-label="Monate">` +
+ axes(ticks, yMax, "Wärme [kWh]", "") + bars + `</svg>` +
+ legend([["hp", "Wärmepumpe"], ["backup", "Zusatzheizung"]]);
+}
+
+// ---------- export ----------
+
+function download(name, rows) {
+ const csv = rows.map((r) => r.map((v) => (typeof v === "number" ? String(Math.round(v * 1000) / 1000).replace(".", ",") : v)).join(";")).join("\n");
+ const a = document.createElement("a");
+ a.href = URL.createObjectURL(new Blob(["" + csv], { type: "text/csv;charset=utf-8" }));
+ a.download = name;
+ a.click();
+ URL.revokeObjectURL(a.href);
+}
+
+function exportBins() {
+ const r = lastResult;
+ if (!r) return;
+ const m = r.model;
+ const rows = [["Außentemperatur °C", "Stunden h/a", "Heizlast kW", "WP-Leistung kW", "Vorlauf °C", "COP", "Wärme kWh/a", "WP kWh/a", "Zusatzheizung kWh/a", "Strom WP kWh/a"]];
+ for (const k of [...r.bins.keys()].sort((a, b) => a - b)) {
+ const b = r.bins.get(k);
+ rows.push([k, b.hours, m.load(k), m.heatPump(k), m.flow(k), m.cop(k), b.hp + b.backup, b.hp, b.backup, b.el]);
+ }
+ download(`bins_${$("plz").value}.csv`, rows);
+}
+
+function exportHours() {
+ const r = lastResult;
+ if (!r) return;
+ const rows = [["Jahr", "Monat", "Tag", "Stunde (UTC)", "Außentemperatur °C", "Heizlast kW", "WP kW", "Zusatzheizung kW", "Strom WP kW"]];
+ r.years.forEach((year, y) => {
+ let i = 0;
+ MONTH_DAYS.forEach((days, month) => {
+ for (let d = 1; d <= days; d++) for (let h = 0; h < 24; h++, i++) {
+ const q = r.loads[y * 8760 + i], hp = r.hps[y * 8760 + i];
+ rows.push([year, month + 1, d, h, r.temps[y][i], q, hp, q - hp, r.els[y * 8760 + i]]);
+ }
+ });
+ });
+ download(`stunden_${$("plz").value}.csv`, rows);
+}
+
+// ---------- init ----------
+
+async function init() {
+ [meta, plzMap] = await Promise.all([
+ fetch("data/stations.json").then((r) => r.json()),
+ fetch("data/plz.json").then((r) => r.json()),
+ ]);
+ stationById = Object.fromEntries(meta.stations.map((s) => [s.id, s]));
+
+ $("plz").addEventListener("input", () => { showLocation(); run(); });
+ $("tn").addEventListener("input", () => { tnEdited = true; });
+ $("tnReset").addEventListener("click", () => {
+ tnEdited = false;
+ if (station && station.tnorm != null) $("tn").value = station.tnorm;
+ run();
+ });
+ $("type").addEventListener("change", onTypeChange);
+ $("fuel").addEventListener("change", () => onFuelChange());
+ onFuelChange(false);
+ $("form").addEventListener("input", run);
+ $("form").addEventListener("change", run);
+ $("form").addEventListener("submit", (e) => e.preventDefault());
+ $("exportBins").addEventListener("click", exportBins);
+ $("exportHours").addEventListener("click", exportHours);
+
+ showLocation();
+ run();
+}
+
+init().catch((e) => { $("status").textContent = `Fehler beim Laden: ${e.message}`; });
diff --git a/web/index.html b/web/index.html
new file mode 100644
index 0000000..6747f71
--- /dev/null
+++ b/web/index.html
@@ -0,0 +1,141 @@
+<!doctype html>
+<html lang="de">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>Deckungsanteil Wärmepumpe</title>
+<link rel="stylesheet" href="style.css">
+</head>
+<body>
+<header>
+ <h1>Deckungsanteil Wärmepumpe</h1>
+ <p>Heizwärmebedarf und Aufteilung Wärmepumpe / Zusatzheizung für jede Postleitzahl in Deutschland, auf Basis stündlicher DWD-Messwerte 2007–2025.</p>
+</header>
+
+<main>
+ <form id="form" autocomplete="off">
+ <fieldset>
+ <legend>Standort</legend>
+ <label>Postleitzahl
+ <input id="plz" inputmode="numeric" maxlength="5" pattern="\d{5}" value="10115" required>
+ </label>
+ <div id="location" class="hint"></div>
+ <label>Wetterjahr
+ <select id="scenario"></select>
+ </label>
+ </fieldset>
+
+ <fieldset>
+ <legend>Gebäude</legend>
+ <label>Norm-Heizlast <span class="unit">kW</span>
+ <input id="qn" type="number" step="0.1" min="0.1" value="10">
+ </label>
+ <label>Norm-Außentemperatur <span class="unit">°C</span>
+ <input id="tn" type="number" step="0.1" value="-12">
+ </label>
+ <div class="hint"><button type="button" id="tnReset" class="link">Schätzwert der Station übernehmen</button> <span id="tnHint"></span></div>
+ <label>Heizgrenztemperatur <span class="unit">°C</span>
+ <select id="thg">
+ <option>10</option><option>12</option><option selected>15</option>
+ </select>
+ </label>
+ </fieldset>
+
+ <fieldset>
+ <legend>Wärmepumpe</legend>
+ <label>Typ
+ <select id="type">
+ <option value="air">Luft/Wasser</option>
+ <option value="brine">Sole/Wasser</option>
+ <option value="water">Wasser/Wasser</option>
+ <option value="dx">Direktverdampfung/Wasser</option>
+ </select>
+ </label>
+ <label>Betriebsart
+ <select id="mode">
+ <option value="mono">monovalent</option>
+ <option value="parallel" selected>bivalent-parallel</option>
+ <option value="alternative">bivalent-alternativ</option>
+ </select>
+ </label>
+ <div id="bivalentFields">
+ <label>Bivalenzpunkt <span class="unit">°C</span>
+ <input id="tbiv" type="number" step="0.5" value="-5">
+ </label>
+ <div class="hint" id="tbivHint"></div>
+ <label id="cutoffField">Einsatzgrenze WP <span class="unit">°C, optional</span>
+ <input id="cutoff" type="number" step="0.5" placeholder="keine">
+ </label>
+ <div class="hint">Unterhalb dieser Außentemperatur schaltet die WP ab (bivalent-teilparallel).</div>
+ </div>
+ <label>Vorlauftemperatur bei Norm-Außentemp. <span class="unit">°C</span>
+ <input id="flowN" type="number" step="1" min="25" max="65" value="35">
+ </label>
+ <label class="check"><input id="flowCurve" type="checkbox" checked> witterungsgeführt (Heizkurve)</label>
+ <div class="hint">Vorlauf sinkt linear bis 20 °C bei 20 °C Außentemperatur, mindestens 25 °C. COP nach Datenblatt Remko LWM 110 (A−7/A2/A7 bei W35), auf andere Vorlauftemperaturen über den Carnot-Gütegrad übertragen. Ohne Takten, Umwälzpumpe und Warmwasser, die JAZ ist daher eher optimistisch.</div>
+ <details>
+ <summary>Erweitert</summary>
+ <label>Leistungsänderung der WP <span class="unit">%/K</span>
+ <input id="slope" type="number" step="0.5" value="3">
+ </label>
+ <div class="hint">Relative Änderung der Heizleistung je Kelvin Außentemperatur. Luft/Wasser typisch 2–4 %/K, erdgekoppelte Systeme 0.</div>
+ <label>Auswertungsart
+ <select id="resolution">
+ <option value="bin">Temperatur-Bins (1 K)</option>
+ <option value="day">Tagesmittelwerte</option>
+ <option value="hour">Stundenmittelwerte</option>
+ </select>
+ </label>
+ </details>
+ </fieldset>
+
+ <fieldset>
+ <legend>Kosten</legend>
+ <label>Strompreis Wärmepumpe <span class="unit">ct/kWh</span>
+ <input id="priceEl" type="number" step="0.1" min="0" value="28">
+ </label>
+ <label>Zusatzheizung
+ <select id="fuel">
+ <option value="electric">Heizstab (Strom)</option>
+ <option value="gas">Erdgas</option>
+ <option value="lpg">Flüssiggas</option>
+ <option value="oil">Heizöl</option>
+ <option value="pellets">Holzpellets</option>
+ <option value="wood">Scheitholz</option>
+ </select>
+ </label>
+ <label>Preis Zusatzheizung <span class="unit" id="priceBackupUnit">ct/kWh</span>
+ <input id="priceBackup" type="number" step="0.01" min="0" value="28">
+ </label>
+ <label>Wirkungsgrad Zusatzheizung <span class="unit">%</span>
+ <input id="effBackup" type="number" step="1" min="1" max="110" value="100">
+ </label>
+ <div class="hint" id="fuelHint"></div>
+ </fieldset>
+ </form>
+
+ <section id="results" aria-live="polite">
+ <div id="status" class="hint">Lade Daten …</div>
+ <div id="kpis" class="kpis"></div>
+ <figure>
+ <figcaption>Jahresdauerlinie der Heizlast</figcaption>
+ <div id="duration" class="chart"></div>
+ </figure>
+ <figure>
+ <figcaption>Heizwärme je Außentemperatur (1-K-Bins)</figcaption>
+ <div id="bins" class="chart"></div>
+ </figure>
+ <figure>
+ <figcaption>Heizwärme je Monat</figcaption>
+ <div id="months" class="chart"></div>
+ </figure>
+ <div class="actions">
+ <button type="button" id="exportBins">Bins als CSV</button>
+ <button type="button" id="exportHours">Stundenwerte als CSV</button>
+ </div>
+ <p class="hint">Vereinfachtes Modell: Heizlast linear zwischen Norm-Heizlast bei Norm-Außentemperatur und 0 bei Heizgrenztemperatur, ohne Warmwasser. Wetterdaten: Deutscher Wetterdienst (DWD Climate Data Center, Stundenwerte Lufttemperatur), Postleitzahlen: GeoNames (CC BY 4.0). Die Norm-Außentemperatur der Station ist eine Schätzung aus den Messdaten, nicht der Wert nach DIN/TS 12831-1.</p>
+ </section>
+</main>
+<script src="app.js"></script>
+</body>
+</html>
diff --git a/web/style.css b/web/style.css
new file mode 100644
index 0000000..d407bed
--- /dev/null
+++ b/web/style.css
@@ -0,0 +1,118 @@
+:root {
+ --bg: #f7f7f4;
+ --panel: #ffffff;
+ --text: #1d1f1e;
+ --muted: #646a67;
+ --line: #dcdcd6;
+ --hp: #2f7d6d;
+ --backup: #d9822b;
+ --uncovered: #c0392b;
+ --accent: #2f7d6d;
+}
+@media (prefers-color-scheme: dark) {
+ :root {
+ --bg: #161817;
+ --panel: #1f2221;
+ --text: #e6e7e4;
+ --muted: #9aa19d;
+ --line: #353a38;
+ --hp: #4fb39d;
+ --backup: #e89a4c;
+ --uncovered: #e06456;
+ --accent: #4fb39d;
+ }
+}
+* { box-sizing: border-box; }
+body {
+ margin: 0;
+ background: var(--bg);
+ color: var(--text);
+ font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
+}
+header { padding: 24px 16px 8px; max-width: 1200px; margin: 0 auto; }
+h1 { margin: 0 0 4px; font-size: 1.5rem; }
+header p { margin: 0; color: var(--muted); }
+main {
+ display: grid;
+ grid-template-columns: 320px 1fr;
+ gap: 20px;
+ max-width: 1200px;
+ margin: 0 auto;
+ padding: 16px;
+}
+@media (max-width: 800px) { main { grid-template-columns: 1fr; } }
+form, #results { min-width: 0; }
+fieldset {
+ border: 1px solid var(--line);
+ background: var(--panel);
+ border-radius: 8px;
+ margin: 0 0 14px;
+ padding: 10px 14px 14px;
+}
+legend { font-weight: 600; padding: 0 4px; }
+label { display: block; margin-top: 10px; font-size: 0.9rem; }
+.unit { color: var(--muted); }
+input, select {
+ display: block;
+ width: 100%;
+ margin-top: 3px;
+ padding: 6px 8px;
+ font: inherit;
+ color: var(--text);
+ background: var(--bg);
+ border: 1px solid var(--line);
+ border-radius: 5px;
+}
+label.check { display: flex; align-items: center; gap: 6px; }
+label.check input { width: auto; margin: 0; }
+input:invalid { border-color: var(--uncovered); }
+details { margin-top: 12px; }
+summary { cursor: pointer; font-size: 0.9rem; color: var(--muted); }
+.hint { color: var(--muted); font-size: 0.82rem; margin-top: 4px; }
+.warn { color: var(--backup); }
+button {
+ font: inherit;
+ padding: 6px 12px;
+ border-radius: 5px;
+ border: 1px solid var(--line);
+ background: var(--panel);
+ color: var(--text);
+ cursor: pointer;
+}
+button.link { border: 0; padding: 0; background: none; color: var(--accent); text-decoration: underline; font-size: inherit; }
+.kpis {
+ display: grid;
+ grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
+ gap: 10px;
+ margin: 10px 0 16px;
+}
+.kpi {
+ background: var(--panel);
+ border: 1px solid var(--line);
+ border-radius: 8px;
+ padding: 10px 12px;
+}
+.kpi .label { color: var(--muted); font-size: 0.8rem; }
+.kpi .value { font-size: 1.35rem; font-weight: 600; font-variant-numeric: tabular-nums; }
+.kpi .sub { color: var(--muted); font-size: 0.8rem; font-variant-numeric: tabular-nums; }
+.kpi.hp { border-left: 4px solid var(--hp); }
+.kpi.backup { border-left: 4px solid var(--backup); }
+figure {
+ margin: 0 0 16px;
+ background: var(--panel);
+ border: 1px solid var(--line);
+ border-radius: 8px;
+ padding: 10px 12px;
+}
+figcaption { font-weight: 600; font-size: 0.9rem; margin-bottom: 6px; }
+.chart svg { display: block; width: 100%; height: auto; }
+.chart text { fill: var(--muted); font-size: 11px; }
+.chart .grid { stroke: var(--line); }
+.chart .hp { fill: var(--hp); }
+.chart .backup { fill: var(--backup); }
+.chart .uncovered { fill: var(--uncovered); }
+.chart .capline { stroke: var(--text); fill: none; stroke-dasharray: 4 3; }
+.legend { display: flex; gap: 14px; font-size: 0.8rem; color: var(--muted); margin-top: 4px; flex-wrap: wrap; }
+.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
+.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
+button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--panel); }