feat(kode): first coding of business economics, ownership, scale, environment and verdicts

Chapters 7 to 11 of the specification, on the made-up set only:

- nivaaisert: the power cost per facility, year and vintage on levelised
  form (S9, S11 with clarifications 2, 11, 13 and 15), S15, S19, S27, S42
- eierskap: the business cash flow with every asset booked, tax, S28, S29
  and S30 for the four ownership forms, the criteria over the draws
- skala: S31 year by year, the first year with stable operation, M6
- miljo: S32 year by year, the rules of M5 (i) and (ii)
- dommer: S37, the verdict per target, the step of the ladder, the overall
  verdicts; tested on invented outcomes
- kontantstrom: each asset is recorded as it is paid, and the price of
  compute exposes the competitor's cost and the markup

This is an intermediate step. The readings are not settled: an independent
reader is coding the same from the specification alone, a first comparison
agrees on the levelised cost, S19, S42, the cash flows, M3 and M4 and
differs on depreciation at the final year, tax, debt and two definitions.
Chapter 16 gets the clarifications before any result is computed.
Nothing is computed for the hypothesis; the parameter file is unchanged.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
Kjell Tore Guttormsen 2026-11-12 12:45:54 +01:00
commit e216702d69
Signed by: ktg
SSH key fingerprint: SHA256:JakMjO6FTBBzN0Bhfj9saOoEjaFxlSdYuZQQpM/lF9Q
15 changed files with 3697 additions and 45 deletions

View file

@ -11,13 +11,23 @@ from typing import TYPE_CHECKING, Protocol
import pytest
from tokenfabrikker.inndata import Inndata, Prislinje
from tokenfabrikker.inndata import Eierform, Inndata, Prislinje
if TYPE_CHECKING:
from collections.abc import Mapping
OMRAADER = ("NO1", "NO2", "NO3", "NO4", "NO5", "Norge")
EIERFORMER: Mapping[str, Eierform] = {
"direkte": Eierform("direkte", 1.0, 0.0, 0.0, 1.0, 0.04, None, 1.0, skatt=False),
"heleid_selskap": Eierform("heleid_selskap", 1.0, 0.0, 0.0, 0.5, 0.05, 0.10, 1.0, skatt=True),
"majoritet_boers": Eierform("majoritet_boers", 0.6, 0.0, 0.0, 0.5, 0.05, 0.12, 1.0, skatt=True),
"petroleumsmodell": Eierform(
"petroleumsmodell", 0.6, 0.25, 0.5, 0.5, 0.05, 0.12, 1.0, skatt=True
),
}
"""Made-up ownership forms with round numbers, in the layout of the parameter file."""
GRUNNVERDIER: Mapping[str, float] = {
# time and size
"T0": 2027,
@ -132,6 +142,19 @@ GRUNNVERDIER: Mapping[str, float] = {
"D_X": 2.0,
"s_brikker": 0.04,
"G_server": 25_000.0,
# business economics and ownership
"t_nett": 0.3e6,
"tau_s": 0.2,
"iota": 0.02,
"r_stat": 0.02,
# scale and environment (emissions in tonnes per MWh and per MW IT)
"SNKS_snitt": 500e9,
"u_kjerne": 0.012,
"u_vind": 0.011,
"u_havvind": 0.012,
"u_vann": 0.004,
"u_H": 1000.0,
"eta_N": 3e-6,
}
"""Round, invented values in the units of the equations (kr, MW, MWh, kr/MWh, years)."""
@ -165,6 +188,9 @@ def lag_inndata(*, u_eksport: tuple[float, ...] | None = None, **endringer: floa
linjer={omraade: Prislinje(alpha=700.0, b=-10e-6) for omraade in OMRAADER},
karbonpris={2026: 1000.0, 2100: 1000.0},
u_eksport=(0.5,) * antall_aar if u_eksport is None else u_eksport,
eierformer=EIERFORMER,
areal={"kjernekraft": 0.1e-6, "vind_direkte": 1.5e-6, "vind_plan": 30e-6, "tomt": 0.001},
petroleum_median=250e9,
)