feat(modell): count chips from the first possible operating year
The project owner answered the three questions from part 5b on 2026-11-12
("Ja til dine anbefalinger"), before any result is computed:
- chips are a stock from the solution's first possible operating year, not
from the decision year (clarification 25 rewritten; the old reading stays
as a switch that is not part of the verdicts)
- renewable power in C enters operation the same year as the facility
(clarification 24 stands)
- the other choices in clarifications 21-40 are approved
The default in the code is flipped, seven tests that assumed a stock from
2027 are redone, and the comparison with the independent reader's code is
rerun with its switch set the same way: same numbers in all 9 471 paths
that can be built. The parameter file is unchanged.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
parent
326b80d8d1
commit
fb13b8fd75
6 changed files with 120 additions and 55 deletions
|
|
@ -274,13 +274,13 @@ def test_bane_som_ikke_lar_seg_bygge_har_ingen_naaverdi(oppdiktet: LagInndata) -
|
|||
|
||||
|
||||
def test_anlegg_uten_brikker_har_verken_inntekt_eller_kraftbruk(oppdiktet: LagInndata) -> None:
|
||||
"""Chips for one vintage every five years, but a three-year export stop from 2035.
|
||||
"""Chips for one facility a year from 2030, but a three-year export stop from 2035.
|
||||
|
||||
The vintage from 2030 has expired in 2035 and is replaced in 2038. In between the
|
||||
facility earns nothing and uses no power, but its fixed operation is still paid.
|
||||
"""
|
||||
u = tuple(0.0 if aar == 2035 else 0.5 for aar in range(2028, 2061))
|
||||
inn = oppdiktet(u_eksport=u, phi_X=0.1, D_X=3.0, s_brikker=0.02)
|
||||
inn = oppdiktet(u_eksport=u, phi_X=0.1, D_X=3.0)
|
||||
res = _regn(inn, Losning.R)
|
||||
aar = dict(zip(res.aar, range(len(res.aar)), strict=True))
|
||||
assert res.plan.stopp[2035 - 2028 : 2039 - 2028] == (True, True, True, False)
|
||||
|
|
@ -326,17 +326,17 @@ def test_kraftverk_paa_nettet_selger_ogsaa_naar_anlegget_staar(oppdiktet: LagInn
|
|||
assert res.kraftaar[aar[2041]].Delta_Q == pytest.approx(-2 * 8760.0 * 0.8 * 1000.0)
|
||||
|
||||
|
||||
def test_brikker_kan_telles_fra_forste_mulige_aar(oppdiktet: LagInndata) -> None:
|
||||
"""1 000 MW of chips a year. Counted from 2027, three facilities start in 2030.
|
||||
def test_brikker_telles_fra_forste_mulige_aar(oppdiktet: LagInndata) -> None:
|
||||
"""1 000 MW of chips a year, counted from the first possible year (2030): one facility a year.
|
||||
|
||||
Counted from the first possible year (2030), they start in 2030, 2031 and 2032.
|
||||
Saved up from the decision year instead (the switch), three facilities start in 2030.
|
||||
"""
|
||||
inn = oppdiktet(L_H=7)
|
||||
dim = ks.dimensjoner(inn, Losning.R)
|
||||
fra_beslutning = ks.lag_plan(inn, Losning.R, dim, N_anlegg=3)
|
||||
assert [a.start for a in fra_beslutning.anlegg] == [2030, 2030, 2030]
|
||||
fra_start = ks.lag_plan(inn, Losning.R, dim, N_anlegg=3, brikker_fra_T0=False)
|
||||
fra_start = ks.lag_plan(inn, Losning.R, dim, N_anlegg=3)
|
||||
assert [a.start for a in fra_start.anlegg] == [2030, 2031, 2032]
|
||||
fra_beslutning = ks.lag_plan(inn, Losning.R, dim, N_anlegg=3, brikker_fra_T0=True)
|
||||
assert [a.start for a in fra_beslutning.anlegg] == [2030, 2030, 2030]
|
||||
|
||||
|
||||
def test_uten_eksportregel_brukes_ikke_strommen(oppdiktet: LagInndata) -> None:
|
||||
|
|
@ -458,7 +458,7 @@ def _enheter(inn: Inndata, N_anlegg: int) -> tuple[ks.Enhetsgruppe, ...]:
|
|||
|
||||
def test_B_enhetene_hoerer_til_programmet(oppdiktet: LagInndata) -> None:
|
||||
"""Three facilities that start together and need 1.125 unit each: four units of 1 000 MW."""
|
||||
inn = oppdiktet()
|
||||
inn = oppdiktet(s_brikker=0.12)
|
||||
dim = ks.dimensjoner(inn, Losning.B)
|
||||
assert dim.P_G_N == pytest.approx(0.75 * 1.2 * 1000.0 / 0.8)
|
||||
assert all(ks.kraftverk_for_anlegg(inn, Losning.B, dim, k) == () for k in (1, 2, 3))
|
||||
|
|
@ -633,8 +633,12 @@ def test_s45_binder_ikke_for_et_kraftverk_som_taper(oppdiktet: LagInndata) -> No
|
|||
|
||||
|
||||
def test_s45_gir_naaverdi_null_naar_den_binder(oppdiktet: LagInndata) -> None:
|
||||
"""A cheap reactor that earns money on the grid is credited nothing."""
|
||||
inn = oppdiktet(c_N_ref=10e6, f_N=0.3e6)
|
||||
"""A cheap reactor that earns money on the grid is credited nothing.
|
||||
|
||||
Chips for three facilities a year, so the two start together and every unit goes out
|
||||
before the final year; the helper below has no residual value.
|
||||
"""
|
||||
inn = oppdiktet(c_N_ref=10e6, f_N=0.3e6, s_brikker=0.12)
|
||||
for losning in (Losning.B, Losning.B_MERKET):
|
||||
res = _regn(inn, losning, N_anlegg=2)
|
||||
assert 0.0 < res.varsigma[ks.KJERNEKRAFT] < 1.0
|
||||
|
|
@ -785,7 +789,7 @@ def test_anlegg_som_taper_faar_bare_avviklingen_i_restverdien(oppdiktet: LagInnd
|
|||
|
||||
def test_effektkostnaden_deles_paa_anleggene_i_drift(oppdiktet: LagInndata) -> None:
|
||||
"""Three facilities in R that start the same year carry a third each of F_a."""
|
||||
inn = oppdiktet(T_slutt=2040)
|
||||
inn = oppdiktet(T_slutt=2040, s_brikker=0.12)
|
||||
en = _regn(inn, Losning.R, N_anlegg=1)
|
||||
tre = _regn(inn, Losning.R, N_anlegg=3)
|
||||
assert [a.start for a in tre.plan.anlegg] == [2030, 2030, 2030]
|
||||
|
|
|
|||
|
|
@ -153,32 +153,48 @@ def _plan(**endringer: object) -> ub.Plan:
|
|||
return ub.utbyggingsplan(**argumenter) # type: ignore[arg-type]
|
||||
|
||||
|
||||
def test_brikker_samles_opp_fra_beslutningsaaret_og_utskifting_gaar_foran() -> None:
|
||||
def test_brikker_telles_fra_forste_mulige_aar_og_utskifting_gaar_foran() -> None:
|
||||
"""Hand-computed: 500 MW of chips a year, facilities of 1 000 MW, vintages of three years.
|
||||
|
||||
Deliveries count from the first possible operating year, 2030 (clarification 25). Stock
|
||||
after deliveries: 2030 500, 2031 1 000 (facility 1 starts, 0 left), 2032 500, 2033 1 000
|
||||
(facility 2 starts), 2034 500 (facility 1's vintage has expired and waits), 2035 1 000
|
||||
(facility 1's vintage is replaced before facility 3 can start), 2036 500 (facility 2
|
||||
waits), 2037 1 000 (facility 2 replaced), 2038 500 (facility 1 waits), 2039 1 000
|
||||
(facility 1 replaced), 2040 500 (facility 2 waits). Facility 3 never gets chips.
|
||||
"""
|
||||
plan = _plan()
|
||||
assert [a.start for a in plan.anlegg] == [2031, 2033]
|
||||
assert plan.anlegg[0].aarganger == (2031, 2035, 2039)
|
||||
assert plan.anlegg[1].aarganger == (2033, 2037)
|
||||
assert not plan.gjennomforbar
|
||||
assert plan.t_1 == 2031
|
||||
|
||||
|
||||
def test_brikker_spart_opp_fra_beslutningsaaret_er_en_bryter() -> None:
|
||||
"""The reading the text had before clarification 25 was decided: a stock from 2028.
|
||||
|
||||
Stock after deliveries: 2028 500, 2029 1 000, 2030 1 500 (facility 1 starts, 500 left),
|
||||
2031 1 000 (facility 2 starts, 0 left), 2032 500, 2033 1 000 (facility 1's vintage is
|
||||
replaced before facility 3 can start), 2034 500 (facility 2's vintage has expired and
|
||||
waits), 2035 1 000 (facility 2 replaced), 2036 500 (facility 1 waits), 2037 1 000
|
||||
(facility 1 replaced), 2038 500 (facility 2 waits), 2039 1 000 (facility 2 replaced),
|
||||
2040 500 (facility 1 waits). Facility 3 never gets chips.
|
||||
replaced before facility 3 can start), 2034 500 (facility 2 waits), 2035 1 000 (facility
|
||||
2 replaced), 2036 500, 2037 1 000 (facility 1 replaced), 2038 500, 2039 1 000 (facility
|
||||
2 replaced), 2040 500. Facility 3 never gets chips.
|
||||
"""
|
||||
plan = _plan()
|
||||
plan = _plan(forste_brikkeaar=2028)
|
||||
assert [a.start for a in plan.anlegg] == [2030, 2031]
|
||||
assert plan.anlegg[0].aarganger == (2030, 2033, 2037)
|
||||
assert plan.anlegg[1].aarganger == (2031, 2035, 2039)
|
||||
assert not plan.gjennomforbar
|
||||
assert plan.t_1 == 2030
|
||||
|
||||
|
||||
def test_utlevd_aargang_staar_uten_inntekt_til_den_byttes() -> None:
|
||||
plan = _plan()
|
||||
assert plan.aargang(1, 2033) == 2031
|
||||
assert plan.aargang(1, 2034) is None # expired, no chips in stock
|
||||
assert plan.aargang(1, 2035) == 2035
|
||||
assert plan.aargang(0, 2036) is None
|
||||
assert plan.aargang(0, 2029) is None # not in operation yet
|
||||
assert plan.i_drift(1, 2034) # the facility is still operated
|
||||
assert plan.aargang(0, 2033) == 2031
|
||||
assert plan.aargang(0, 2034) is None # expired, no chips in stock
|
||||
assert plan.aargang(0, 2035) == 2035
|
||||
assert plan.aargang(1, 2036) is None
|
||||
assert plan.aargang(0, 2030) is None # not in operation yet
|
||||
assert plan.i_drift(0, 2034) # the facility is still operated
|
||||
|
||||
|
||||
def test_den_som_har_ventet_lengst_faar_brikker_forst() -> None:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue