flexpool

Portfolio

The pool as code: owners, pools, reserve groups, technical units and assets in a TOML file and a CSV.

The portfolio is two files in one directory, kept in version control next to the rules: portfolio.toml for the structure and assets.csv for the assets — thousands of rows fit comfortably. The daemon reads them at start; a broken portfolio stops it with every problem listed.

owner ─┐
pool ──┼─ reserve group ─ technical unit ─ asset ─ slice
       └──────────────── technical unit
# portfolio.toml
[[owner]]
id = "stadtwerke-nord"
name = "Stadtwerke Nord"

[[owner]]
id = "haushalte"
name = "Haushaltskunden"
household = true             # optional: a person; their units are personal data

[[pool]]
id = "nord"
name = "Pool Nord"

[pool.fahrplan]               # optional: where the pool's Fahrplan is nominated
balance_group = "11X…"        # the pool's Bilanzkreis: sender, delivers when selling
counterparty = "11X…"         # receives when selling, delivers when buying
control_area = "10Y…"         # the control area
tso = "10X…"                  # the TSO, the schedule's receiver
tso_mp_id = "99…"             # the TSO's market-partner id (AS4)

[[reserve_group]]
id = "nord-rg1"
pool = "nord"
name = "RG Nord 1"

[[technical_unit]]
id = "bess-hamburg"
pool = "nord"
reserve_group = "nord-rg1"   # optional
name = "BESS Hamburg"
tr_id = "D…"                  # optional, check digit verified

[[slice]]                     # optional: split an asset between owners
id = "bess-hamburg-1-trader"
asset = "bess-hamburg-1"
owner = "stadtwerke-nord"
power_share = "0.5"
energy_share = "0.5"
id,kind,technical_unit,owner,rated_kw,energy_kwh,malo,sr_id,tr_id,congestion_point
bess-hamburg-1,battery,bess-hamburg,stadtwerke-nord,20000,40000,50000000013,C0000000011,,
home-nord-00000-bat,battery,homes-nord,haushalte,8,5.8,50000000063,,,ea1.2026-11.netz-nord.example:cp-hh-nord

kind is one of battery, pv, wind, heat-pump, ev-charger, chp, load. Numbers are plain decimals (20000, 0.5): no exponents, no thousands separators. MaLo, SR-ID and TR-ID are checked including their check digits. An asset without slices belongs wholly to its owner. A pool's [pool.fahrplan] is checked as mako checks it: every EIC code by its check character and object type (X for the Bilanzkreise and the TSO, Y for the area), the MP-ID by its check digit, and the two Bilanzkreise must differ. A pool without it cannot be nominated (Book). The congestion_point column is optional: the UFTP entity address an asset sits behind, for the flexibility market. An owner with household = true is a person, and anything about one of their units is personal data (Data protection).

Check, summarise, generate🔗

flexpool portfolio check portfolio/demo      # exit 0, or 2 with file:line:column per problem
flexpool portfolio summary portfolio/demo    # pools, kinds, MW, MWh
flexpool portfolio demo /tmp/pf --assets 5000 --seed 7
Assets: the two pools with their power and energy, and a searchable table of batteries, heat pumps, EV chargers and PV systems with the status of their latest value.

Serve it🔗

Set portfolio.dir (or FLEXPOOL_PORTFOLIO_DIR). The API gains /api/v1/portfolio and /api/v1/assets, and the desk gains the Anlagen view: filter by pool and kind, search by id, MaLo, SR-ID or TR-ID (/), open an asset to see its technical unit, reserve group, owner and slices. Every view is a link.

Who may read it🔗

Asset data is not public. Peers in auth.trusted_networks (default: loopback) are trusted; everyone else needs a bearer token or a trusted proxy's identity header — otherwise 401 unauthorized.

flexpool token new
# token (give to the client, shown once):
#   3f9c…
# configuration (only the hash is stored; separate several with commas):
#   [auth]
#   token_hashes = "a41e…"
curl -H "Authorization: Bearer 3f9c…" https://flexpool.example/api/v1/portfolio

The daemon refuses to listen beyond loopback with no token hashes unless trusted networks are set explicitly. It also answers only to the host names in http.allowed_hosts (default localhost, 127.0.0.1, ::1) and refuses state-changing requests a browser marks as cross-site: a web page cannot re-point its own name to 127.0.0.1 and act as a trusted local client (DNS rebinding). Behind a proxy, add its public name.

Real devices🔗

An optional edge.toml in the same directory declares how assets are reached — SunSpec over Modbus TCP or IEC 60870-5-104, read-only. flexpool portfolio check checks it too. See Telemetry.

Edit this page