Note
AI-generated code. The source code, tests and documentation in this repository — including the German user manual — were written by an AI coding agent (Claude Code, Anthropic), working under human direction: a person specified the requirements, reviewed the results and verified the editor live. Treat it accordingly — read before you trust.
An interactive editor for low- and medium-voltage distribution grids on
OpenStreetMap: the manual counterpart to the synthetic
gridgen generator. It produces the same gridformat JSON that
EchtzeitNetzSimulator (netzsim) consumes — so a
hand-drawn grid can be simulated, equipped (batteries, meters, PV, EV) and saved
as a teaching scenario immediately.
gridedit edits both voltage levels, switchable in the editor:
Low voltage (NS) — a street-routed 0.4 kV grid:
- Choose an area on the map (a village-sized bbox); streets and building footprints come from the Overpass API and are disk-cached. A place search (Nominatim) and an optional OSM power-infrastructure overlay (⚡ toggle: real substations, lines, transformers for the area) help you orient.
- Place the substation transformer (rating from the standard ladder, 20/0.4 or 10/0.4 kV).
- Draw cables that snap onto the streets — the shortest path along the street graph between clicks — then assign each a cable from gridgen's standard NAYY main/service catalogs. Tap into an existing cable to branch, rubber-band-select and bulk-delete, split components into islands.
- Place cable cabinets and nodes, then connect each house to its cabinet with a service drop.
Medium voltage (MS) — a free-flowing 20 kV / 10 kV network: a 110-kV Umspannwerk, MV lines (own parameters + geometry), large consumers (shopping centre, HPC charging park) and generation (PV, wind, biogas), plus MV/LV stations that feed the drawn LV grids below.
- E-Check (
Netz → Plausibilität prüfen) reuses gridformat's structural rules and runs a one-shot pandapower peak solve as an electrical sanity check (in German). Verdicts are stamped into the exported files. - Export (
Netz → exportieren) writes, per substation, a gridformat LV file, and per Umspannwerk agridedit-mvfile — straight into netzsim's user-grid catalog (NETZSIM_USER_GRIDS_DIR), where they appear under the Eigene tab without a restart. Exports reopen in the editor for further editing.
When a drawn MV/LV station has its own drawn LV grid, the MV export references it
automatically via lv_ref. netzsim then splices the real street-routed LV
grid onto that station (its own transformer, buildings as households, the
station becomes a real Ortsnetz-Zelle) instead of a lumped load — a complete
self-drawn vertical grid from 110 kV down to the house connection.
start_gridedit.bat starts the backend (:8010) and the Vite UI (:5180) in their
own windows, runs npm install if needed, and opens the browser.
python -m venv .venv && .venv\Scripts\activate
pip install -e . -e ../gridgen # gridformat + cable catalogs come from gridgen
gridedit # backend on http://127.0.0.1:8010
cd ui && npm install && npm run dev # UI on http://localhost:5180 (dev proxy to :8010)gridedit/
├── src/gridedit/ # FastAPI backend: OSM fetch (Overpass), E-Check, export
│ ├── api.py # /osm · /check · /check-mv · /export · /export-mv · /exports
│ ├── osm.py # Overpass streets+buildings, disk cache, power overlay
│ └── gridcheck.py # gridformat E-Check + MV structural check + file writing
└── ui/src/ # React + Leaflet editor
├── components/ # EditorMap · SidePanel · MenuTab · Load/Check/ExportPanel · SearchBox
├── model.ts · graph.ts · export.ts # grid model, street routing, gridformat/MV serialisation
Grid file format and cable catalogs are the gridgen contract;
the tool it feeds is EchtzeitNetzSimulator.
AGPL-3.0-or-later — inherited by dependency, not by choice: the
backend imports the gridformat contract, the E-Check and the cable
catalogs from the AGPL-licensed gridgen (which in turn
depends on ding0/eDisGo), so the combined work is AGPL-bound; the license
was already declared in pyproject.toml. The UI stack itself is
permissive (React/i18next: MIT; Leaflet: BSD) — if gridformat is ever
split into a permissive package, gridedit can be relicensed more freely.
Drawn grids are program output and not covered by the copyleft, but they are derived from OpenStreetMap geometry (© OpenStreetMap contributors, ODbL) — keep that attribution when redistributing them.