feat(kode): bring business economics, ownership, scale and verdicts in line with clarifications 41-61
The accident cost stays in S11 and S31 when the additionality rule binds; the peak year of M6 is taken among operating years; tax depreciation and carried losses lose real value with price growth; the special tax deducts the corporate tax, has a return allowance and carries a negative basis with interest, so it only meets return above r_e; ownership forms are compared only with forms that pass the EEA assessment; the overall verdict needs a negative median to fell a solution and takes whether conditions can be named; M5 does not hold when both (i) and (ii) are broken; a non-positive price without the programme is an error in M3. Made-up numbers only. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
parent
57a8256306
commit
d4aebad0f9
14 changed files with 335 additions and 95 deletions
|
|
@ -10,9 +10,9 @@ None. It counts in the denominator and never meets the condition for «holder».
|
|||
In M1, M2, M6 and M7, where «holder ikke» is that too few draws reach the
|
||||
target, it counts as a draw that does not reach it. In M3 and M4, where
|
||||
«holder ikke» is a harm that occurs, it meets neither condition. That reading,
|
||||
and which step counts as one that can be built, are NOT settled yet: they go
|
||||
to chapter 16 of the specification and to the project owner before any result
|
||||
is computed.
|
||||
and which step counts as one that can be built, stand in chapter 16 of the
|
||||
specification (clarifications 56 and 57); they touch clarification 1 of the
|
||||
pre-registration and are the project owner's to approve.
|
||||
|
||||
The thresholds are those of the pre-registration. Nothing here is computed
|
||||
from the parameter file: the functions take outcomes per draw.
|
||||
|
|
@ -267,7 +267,7 @@ def trinn_for_dommene(m6: Mapping[int, Mapping[Losning, Utfall]]) -> Trinnvalg:
|
|||
the lowest step where at least 80 % of the draws reach 25 % for one of A, B
|
||||
and C; the 5 % step likewise. Without either, the verdicts are read on the
|
||||
highest step that can be built: the highest where one of A, B and C has a
|
||||
value in at least 80 % of the draws (a reading that is not settled yet).
|
||||
value in at least 80 % of the draws (chapter 16, clarification 57).
|
||||
"""
|
||||
for minst, grunnlag in ((M6_MINST, Grunnlag.TRINN_25), (M6_UNDER, Grunnlag.TRINN_5)):
|
||||
trinn = _laveste_trinn(m6, minst)
|
||||
|
|
@ -291,6 +291,8 @@ def del_I(
|
|||
dommer: Mapping[Losning, Mapping[str, Dom]],
|
||||
median_m1: Mapping[Losning, float],
|
||||
valg: Trinnvalg,
|
||||
*,
|
||||
betingelser_kan_navngis: bool = True,
|
||||
) -> Dom:
|
||||
"""The verdict for part I (the programme), as far as it follows from the targets.
|
||||
|
||||
|
|
@ -298,15 +300,17 @@ def del_I(
|
|||
``median_m1`` the median net present value. «Holder»: one of A, B and C has
|
||||
M1 to M6 all holding, on the 25 % step, with more than one facility.
|
||||
«Holder ikke»: each of them has at least one of M1 to M5 not holding, or a
|
||||
median in M1 that is not positive. Otherwise it holds under conditions;
|
||||
whether the conditions can be named within the range of the sources
|
||||
(clarification 5) is decided where the thresholds are computed.
|
||||
negative median in M1. Otherwise it holds under conditions, and only when
|
||||
the conditions can be named within the range of the sources
|
||||
(pre-registration, clarification 5); ``betingelser_kan_navngis=False``
|
||||
says they cannot, and the verdict is then «holder ikke» (chapter 16,
|
||||
clarification 59).
|
||||
"""
|
||||
if valg.trinn is None:
|
||||
return Dom.HOLDER_IKKE
|
||||
losninger = [a for a in DOMSLOSNINGER if a in dommer]
|
||||
felt = [
|
||||
any(dommer[a][m] is Dom.HOLDER_IKKE for m in MAAL_SOM_FELLER) or not median_m1[a] > 0
|
||||
any(dommer[a][m] is Dom.HOLDER_IKKE for m in MAAL_SOM_FELLER) or median_m1[a] < 0
|
||||
for a in losninger
|
||||
]
|
||||
if all(felt):
|
||||
|
|
@ -314,7 +318,7 @@ def del_I(
|
|||
alle_holder = any(all(dommer[a][m] is Dom.HOLDER for m in MAAL_DEL_I) for a in losninger)
|
||||
if alle_holder and valg.grunnlag is Grunnlag.TRINN_25 and valg.trinn > 1:
|
||||
return Dom.HOLDER
|
||||
return Dom.BETINGELSER
|
||||
return Dom.BETINGELSER if betingelser_kan_navngis else Dom.HOLDER_IKKE
|
||||
|
||||
|
||||
def del_II(m7: Dom) -> Dom:
|
||||
|
|
|
|||
|
|
@ -11,13 +11,16 @@ the company's free cash flow to its owners and the state's net cash flow. The
|
|||
functions at the end turn the outcomes of many draws into the criteria of the
|
||||
pre-registration.
|
||||
|
||||
How the text is read here: the project is one taxpayer; the booked capital is
|
||||
what is paid minus straight-line depreciation; the debt is the share h_e of the
|
||||
How the text is read (chapter 16 of the specification, clarifications 45 to
|
||||
49): the project is one taxpayer; the booked capital is what is paid minus
|
||||
straight-line depreciation in constant kroner; the depreciation the tax is
|
||||
computed on, and losses carried forward, are nominal and lose real value with
|
||||
the price growth; the special tax is computed in constant kroner with a return
|
||||
allowance, so it only meets the return above r_e; an asset still in operation
|
||||
at the final year is not written off there; the debt is the share h_e of the
|
||||
booked capital, with the real borrowing rate, and is repaid at the final year;
|
||||
tax is computed as if the project had no debt. These readings are NOT settled
|
||||
yet: they are being held against an independent reader's coding, and what is
|
||||
chosen will stand in chapter 16 of the specification before any result is
|
||||
computed.
|
||||
tax is computed as if the project had no debt, on the company's part of the
|
||||
project.
|
||||
|
||||
Nothing here reads the parameter file or draws random numbers.
|
||||
"""
|
||||
|
|
@ -68,8 +71,13 @@ class Bedriftsstrom:
|
|||
income in S30.
|
||||
investering: I, every investment but the grid connection (the tariff covers it).
|
||||
budsjett: I^bud, the same with the overrun factor xi_N = 1.
|
||||
avskrivning: straight-line depreciation over each asset's lifetime.
|
||||
kapital: the booked capital at the end of each year.
|
||||
avskrivning: the depreciation the tax is computed on: straight-line over each
|
||||
asset's lifetime in the kroner of the year each payment was made, in constant
|
||||
kroner of the year it is deducted.
|
||||
avskrivning_fast: straight-line depreciation in constant kroner; the special tax
|
||||
and the booked capital use it.
|
||||
kapital: the booked capital at the end of each year: what is paid minus
|
||||
straight-line depreciation in constant kroner.
|
||||
"""
|
||||
|
||||
inntekt: Tabell
|
||||
|
|
@ -78,6 +86,7 @@ class Bedriftsstrom:
|
|||
investering: Tabell
|
||||
budsjett: Tabell
|
||||
avskrivning: Tabell
|
||||
avskrivning_fast: Tabell
|
||||
kapital: Tabell
|
||||
|
||||
@property
|
||||
|
|
@ -132,22 +141,36 @@ def _eiendeler(res: Programresultat) -> list[Eiendel]:
|
|||
|
||||
|
||||
def _investering_og_avskrivning(
|
||||
res: Programresultat,
|
||||
) -> tuple[Tabell, Tabell, Tabell]:
|
||||
"""Payments as made, the same at budget, and depreciation, per year."""
|
||||
res: Programresultat, iota: float
|
||||
) -> tuple[Tabell, Tabell, Tabell, Tabell]:
|
||||
"""Payments as made, the same at budget, tax depreciation and booked depreciation, per year.
|
||||
|
||||
The tax depreciation of a payment is fixed in the kroner of the year it was
|
||||
paid, so in constant kroner it shrinks with the price growth ``iota``. The
|
||||
booked depreciation is the same straight line in constant kroner.
|
||||
"""
|
||||
T_0, T_s = res.plan.T_0, res.plan.T_s
|
||||
investering, budsjett, avskrivning = (
|
||||
np.zeros(len(res.aar), dtype=np.float64) for _ in range(3)
|
||||
investering, budsjett, skattemessig, bokfort = (
|
||||
np.zeros(len(res.aar), dtype=np.float64) for _ in range(4)
|
||||
)
|
||||
for e in _eiendeler(res):
|
||||
for j, andel in enumerate(lg.byggeaar_andeler(tau=e.byggetid)):
|
||||
investering[e.start - 1 - j - T_0] += e.kostnad * andel
|
||||
budsjett[e.start - 1 - j - T_0] += e.budsjett * andel
|
||||
for t in range(e.start, min(e.slutt, T_s) + 1):
|
||||
avskrivning[t - T_0] += lg.s28_avskrivning(
|
||||
kostnad=e.kostnad, levetid=e.levetid, start=e.start, slutt=e.slutt, t=t
|
||||
)
|
||||
return investering, budsjett, avskrivning
|
||||
betalt = e.start - 1 - j
|
||||
investering[betalt - T_0] += e.kostnad * andel
|
||||
budsjett[betalt - T_0] += e.budsjett * andel
|
||||
for t in range(e.start, min(e.slutt, T_s) + 1):
|
||||
rett_linje = lg.s28_avskrivning(
|
||||
kostnad=e.kostnad * andel,
|
||||
levetid=e.levetid,
|
||||
start=e.start,
|
||||
slutt=e.slutt,
|
||||
t=t,
|
||||
)
|
||||
bokfort[t - T_0] += rett_linje
|
||||
skattemessig[t - T_0] += lg.s28_realverdi(
|
||||
belop=rett_linje, iota=iota, aar=t - betalt
|
||||
)
|
||||
return investering, budsjett, skattemessig, bokfort
|
||||
|
||||
|
||||
def bedriftsstrom(
|
||||
|
|
@ -184,7 +207,7 @@ def bedriftsstrom(
|
|||
else:
|
||||
P_buf = lg.s36_buffer(delta_L=inn["delta_L"], PUE=inn["PUE"], P_IT=inn["P_IT"])
|
||||
drift += i_drift * inn["f_buf"] * P_buf
|
||||
investering, budsjett, avskrivning = _investering_og_avskrivning(res)
|
||||
investering, budsjett, avskrivning, bokfort = _investering_og_avskrivning(res, inn["iota"])
|
||||
return Bedriftsstrom(
|
||||
inntekt=sum((a.inntekt for a in res.anlegg), null.copy()),
|
||||
drift=drift,
|
||||
|
|
@ -192,7 +215,8 @@ def bedriftsstrom(
|
|||
investering=investering,
|
||||
budsjett=budsjett,
|
||||
avskrivning=avskrivning,
|
||||
kapital=np.cumsum(investering - avskrivning),
|
||||
avskrivning_fast=bokfort,
|
||||
kapital=np.cumsum(investering - bokfort),
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -232,10 +256,12 @@ def _skatt(
|
|||
kapital_inn = np.concatenate(([0.0], strom.kapital[:-1]))
|
||||
selskap, saer = lg.s30_skatt(
|
||||
overskudd=[float(x) for x in strom.inntekt - strom.drift - strom.avskrivning],
|
||||
overskudd_fast=[float(x) for x in strom.inntekt - strom.drift - strom.avskrivning_fast],
|
||||
kapital_inn=[float(x) for x in kapital_inn],
|
||||
tau_s=inn["tau_s"] if eierform.skatt else 0.0,
|
||||
tau_g=eierform.tau_g,
|
||||
r_e=r_e,
|
||||
iota=inn["iota"],
|
||||
)
|
||||
return np.array(selskap, dtype=np.float64), np.array(saer, dtype=np.float64)
|
||||
|
||||
|
|
@ -406,8 +432,8 @@ def ranger_eierformer(
|
|||
|
||||
A form goes out when it does not pass the EEA assessment (``eos`` holds
|
||||
«består», «usikker» or «består ikke» per form, decided outside the model),
|
||||
or when another form is better on every measure of all the first three
|
||||
criteria. The rest are ranked by value for the public, given the limit for
|
||||
or when another form that passes it is better on every measure of all the
|
||||
first three criteria. The rest are ranked by value for the public, given the limit for
|
||||
the state's risk.
|
||||
"""
|
||||
ute: dict[str, str] = {}
|
||||
|
|
@ -415,7 +441,11 @@ def ranger_eierformer(
|
|||
if eos[a.navn] == EOS_BESTAAR_IKKE:
|
||||
ute[a.navn] = "består ikke EØS-vurderingen"
|
||||
continue
|
||||
bedre = [b.navn for b in kriterier if b is not a and _daarligere_paa_alt(a, b)]
|
||||
bedre = [
|
||||
b.navn
|
||||
for b in kriterier
|
||||
if b is not a and eos[b.navn] != EOS_BESTAAR_IKKE and _daarligere_paa_alt(a, b)
|
||||
]
|
||||
if bedre:
|
||||
ute[a.navn] = f"dårligere enn {bedre[0]} på alle de tre første kriteriene"
|
||||
igjen = sorted((a for a in kriterier if a.navn not in ute), key=lambda a: -a.verdi)
|
||||
|
|
|
|||
|
|
@ -94,7 +94,9 @@ def relativ_prisvirkning(inn: Inndata, *, Delta_Q: float, tort: bool) -> dict[st
|
|||
"""S23: Delta p_z / p_z^0 per price area, in a normal year or in the dry year.
|
||||
|
||||
p_z^0 = m_v P_z(S_0). In the dry year the effect is multiplied by s_tort;
|
||||
the price level m_tort is in both numerator and denominator.
|
||||
the price level m_tort is in both numerator and denominator. A price without
|
||||
the programme that is not positive is an error: the ratio would change sign
|
||||
(specification, chapter 16, clarification 58).
|
||||
"""
|
||||
m_v = inn["m_tort"] if tort else 1.0
|
||||
s_v = inn["s_tort"] if tort else 1.0
|
||||
|
|
@ -112,5 +114,8 @@ def relativ_prisvirkning(inn: Inndata, *, Delta_Q: float, tort: bool) -> dict[st
|
|||
s_v=s_v,
|
||||
)
|
||||
uten = m_v * lg.s38_pris(alpha=linje.alpha, b=linje.b, b_ut=inn["b_ut"], S=inn["S0"])
|
||||
if not uten > 0:
|
||||
msg = f"the price without the programme is not positive in {omraade}: {uten}"
|
||||
raise ValueError(msg)
|
||||
andel[omraade] = endring / uten
|
||||
return andel
|
||||
|
|
|
|||
|
|
@ -433,21 +433,26 @@ class Portefoljeledd:
|
|||
LCOE: levelised cost of the technology, kr/MWh.
|
||||
psi: value factor, achieved price over average price.
|
||||
regelen_binder: True when the additionality rule S45 binds (varsigma below 1).
|
||||
q_N: the part of ``LCOE`` that is the expected accident cost (S6), kr/MWh; zero for
|
||||
renewable power.
|
||||
"""
|
||||
|
||||
x: float
|
||||
LCOE: float
|
||||
psi: float
|
||||
regelen_binder: bool
|
||||
q_N: float = 0.0
|
||||
|
||||
def nettoledd(self, p_z: float) -> float:
|
||||
"""The technology's net cost per MWh produced, kr/MWh.
|
||||
|
||||
Zero when S45 binds: a plant that pays its way without the data centre
|
||||
neither adds nor takes (specification, chapter 16, clarification 11).
|
||||
When S45 binds, only the accident cost is left: a plant that pays its
|
||||
way without the data centre neither adds nor takes, but the accident
|
||||
cost is outside NV_i of S45 and runs in the cash flow whatever the
|
||||
factor is (specification, chapter 16, clarifications 11 and 41).
|
||||
Otherwise LCOE - psi * p_z.
|
||||
"""
|
||||
return 0.0 if self.regelen_binder else self.LCOE - self.psi * p_z
|
||||
return self.q_N if self.regelen_binder else self.LCOE - self.psi * p_z
|
||||
|
||||
|
||||
def s11_nettkostnad(
|
||||
|
|
@ -1123,15 +1128,29 @@ def s28_avskrivning(*, kostnad: float, levetid: int, start: int, slutt: int, t:
|
|||
return kostnad - aarlig * (slutt - start)
|
||||
|
||||
|
||||
def s28_etter_framforing(overskudd: Sequence[float]) -> tuple[float, ...]:
|
||||
"""Chapter 7: the taxable profit per year when losses are carried forward without interest.
|
||||
def s28_realverdi(*, belop: float, iota: float, aar: int) -> float:
|
||||
"""Chapter 7: what a nominal amount fixed ``aar`` years ago is worth in constant kroner.
|
||||
|
||||
A loss gives no tax that year and is deducted from later profits, oldest
|
||||
year first, until it is used up.
|
||||
Tax depreciation and losses carried forward are fixed in the kroner of the
|
||||
year they arose. With the price growth ``iota`` they lose real value each
|
||||
year (specification, chapter 16, clarification 47).
|
||||
"""
|
||||
return belop * (1.0 + iota) ** -aar
|
||||
|
||||
|
||||
def s28_etter_framforing(overskudd: Sequence[float], *, faktor: float = 1.0) -> tuple[float, ...]:
|
||||
"""Chapter 7: the taxable amount per year when negative amounts are carried forward.
|
||||
|
||||
A loss gives no tax that year and is deducted from later profits until it
|
||||
is used up. What is carried is multiplied by ``faktor`` for each year it
|
||||
waits: 1 / (1 + iota) for a loss carried without interest, which loses
|
||||
real value with the price growth, and 1 + r_e for the negative basis of
|
||||
the special tax, which is carried with interest (clarifications 47 and 48).
|
||||
"""
|
||||
underskudd = 0.0
|
||||
grunnlag = []
|
||||
for x in overskudd:
|
||||
underskudd *= faktor
|
||||
if x < 0:
|
||||
underskudd -= x
|
||||
grunnlag.append(0.0)
|
||||
|
|
@ -1174,23 +1193,37 @@ def s29_kapitalkostnad(*, h: float, r_d: float, r_q: float, tau_s: float, iota:
|
|||
def s30_skatt(
|
||||
*,
|
||||
overskudd: Sequence[float],
|
||||
overskudd_fast: Sequence[float] | None = None,
|
||||
kapital_inn: Sequence[float],
|
||||
tau_s: float,
|
||||
tau_g: float,
|
||||
r_e: float,
|
||||
iota: float = 0.0,
|
||||
) -> tuple[tuple[float, ...], tuple[float, ...]]:
|
||||
"""S30: corporate tax and special tax per year, kr, for the project as one taxpayer.
|
||||
|
||||
``overskudd`` is revenue minus operating costs and depreciation,
|
||||
``kapital_inn`` the booked capital at the start of each year. Corporate tax
|
||||
is tau_s on the profit after losses carried forward. The special tax is
|
||||
tau_g on the profit above the return ``r_e`` on booked capital, with its
|
||||
own carry-forward of what is not used. Electricity tax and grid tariff are
|
||||
not part of this; they are added where the state's revenue is summed.
|
||||
``overskudd`` is revenue minus operating costs and the depreciation the tax
|
||||
rules give (nominal, in constant kroner). Corporate tax is tau_s on it
|
||||
after losses carried forward without interest, which lose real value with
|
||||
``iota``.
|
||||
|
||||
The special tax is computed in constant kroner so that it only meets the
|
||||
return above ``r_e``. Its basis is ``overskudd_fast`` (the same profit with
|
||||
straight-line depreciation in constant kroner; ``overskudd`` when not
|
||||
given) minus the year's corporate tax and minus r_e times ``kapital_inn``,
|
||||
the booked capital at the start of the year. A negative basis is carried
|
||||
forward with the interest r_e. The rate on that basis is
|
||||
tau_g / (1 - tau_s): ``tau_g`` is the effective rate of the sources, on
|
||||
profit before corporate tax, so one more krone of profit pays
|
||||
tau_s + tau_g. A project that earns exactly r_e after corporate tax then
|
||||
pays no special tax (clarification 48). Electricity tax and grid tariff
|
||||
are not part of this; they are added where the state's revenue is summed.
|
||||
"""
|
||||
selskap = tuple(tau_s * x for x in s28_etter_framforing(overskudd))
|
||||
utover = [x - r_e * k for x, k in zip(overskudd, kapital_inn, strict=True)]
|
||||
saer = tuple(tau_g * x for x in s28_etter_framforing(utover))
|
||||
selskap = tuple(tau_s * x for x in s28_etter_framforing(overskudd, faktor=1.0 / (1.0 + iota)))
|
||||
fast = overskudd if overskudd_fast is None else overskudd_fast
|
||||
utover = [x - skatt - r_e * k for x, skatt, k in zip(fast, selskap, kapital_inn, strict=True)]
|
||||
sats = tau_g / (1.0 - tau_s)
|
||||
saer = tuple(sats * x for x in s28_etter_framforing(utover, faktor=1.0 + r_e))
|
||||
return selskap, saer
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -160,10 +160,15 @@ def m5(utslipp: Dom, areal_dom: Dom, *, kostnadsfort: bool = True) -> Dom:
|
|||
``kostnadsfort`` says that waste, decommissioning and accident risk are in
|
||||
S26 and the emissions from chips and buildings in S32, which they are by
|
||||
construction. «Holder ikke» when (i) or (ii) is clearly broken or that
|
||||
fails; «holder» when both hold; otherwise it holds under conditions.
|
||||
fails; «holder» when both hold. The pre-registration lets it hold under
|
||||
conditions when one of (i) and (ii) is broken within the range of the
|
||||
sources; with both broken it does not hold (specification, chapter 16,
|
||||
clarification 55).
|
||||
"""
|
||||
if not kostnadsfort or Dom.HOLDER_IKKE in {utslipp, areal_dom}:
|
||||
return Dom.HOLDER_IKKE
|
||||
if utslipp is Dom.HOLDER and areal_dom is Dom.HOLDER:
|
||||
return Dom.HOLDER
|
||||
if utslipp is Dom.BETINGELSER and areal_dom is Dom.BETINGELSER:
|
||||
return Dom.HOLDER_IKKE
|
||||
return Dom.BETINGELSER
|
||||
|
|
|
|||
|
|
@ -127,6 +127,19 @@ def effektkostnad_bedrift(inn: Inndata, res: Programresultat) -> Tabell:
|
|||
return F
|
||||
|
||||
|
||||
def ulykkeskostnad_per_mwh(inn: Inndata, res: Programresultat, *, N_u: int, E_N: float) -> float:
|
||||
"""S6: the expected accident cost of ``N_u`` units producing ``E_N`` MWh a year, kr/MWh."""
|
||||
return lg.s6_ulykkeskostnad(
|
||||
N_u=N_u,
|
||||
phi_U=inn["phi_U"],
|
||||
K_U=inn["K_U"],
|
||||
D_fors=inn["D_fors"],
|
||||
P_u=res.dim.P_u,
|
||||
P_ref=inn["P_ref"],
|
||||
E=E_N,
|
||||
)
|
||||
|
||||
|
||||
def lcoe_kjernekraft(
|
||||
inn: Inndata, res: Programresultat, *, numre: range | tuple[int, ...], E_N: float, rho: float
|
||||
) -> float:
|
||||
|
|
@ -143,15 +156,7 @@ def lcoe_kjernekraft(
|
|||
v_N=inn["v_N"],
|
||||
u_N=ks.brenselkostnad(inn, P_u),
|
||||
d_N=inn["d_N"],
|
||||
q_N=lg.s6_ulykkeskostnad(
|
||||
N_u=len(numre),
|
||||
phi_U=inn["phi_U"],
|
||||
K_U=inn["K_U"],
|
||||
D_fors=inn["D_fors"],
|
||||
P_u=P_u,
|
||||
P_ref=inn["P_ref"],
|
||||
E=E_N,
|
||||
),
|
||||
q_N=ulykkeskostnad_per_mwh(inn, res, N_u=len(numre), E_N=E_N),
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -231,10 +236,11 @@ def _egen_portefolje(
|
|||
E_G = math.fsum(v.energi for v in verk)
|
||||
ledd = []
|
||||
for v in verk:
|
||||
q_N = 0.0
|
||||
if v.teknologi == ks.KJERNEKRAFT:
|
||||
lcoe = lcoe_kjernekraft(
|
||||
inn, res, numre=ks.enhetsnumre(res.dim, k + 1), E_N=v.energi, rho=r.rho_N
|
||||
)
|
||||
numre = ks.enhetsnumre(res.dim, k + 1)
|
||||
lcoe = lcoe_kjernekraft(inn, res, numre=numre, E_N=v.energi, rho=r.rho_N)
|
||||
q_N = ulykkeskostnad_per_mwh(inn, res, N_u=len(numre), E_N=v.energi)
|
||||
else:
|
||||
lcoe = lcoe_fornybar(inn, v.teknologi, r.rho_N)
|
||||
ledd.append(
|
||||
|
|
@ -243,6 +249,7 @@ def _egen_portefolje(
|
|||
LCOE=lcoe,
|
||||
psi=v.psi,
|
||||
regelen_binder=not bedrift and res.varsigma[v.teknologi] < 1.0,
|
||||
q_N=q_N,
|
||||
)
|
||||
)
|
||||
return _Portefolje(ledd=tuple(ledd), E_G=E_G)
|
||||
|
|
@ -262,6 +269,7 @@ def _felles_portefolje(
|
|||
LCOE=lcoe_kjernekraft(inn, res, numre=numre, E_N=E_N, rho=r.rho_N),
|
||||
psi=inn["psi_N"],
|
||||
regelen_binder=not bedrift and res.varsigma[ks.KJERNEKRAFT] < 1.0,
|
||||
q_N=ulykkeskostnad_per_mwh(inn, res, N_u=len(numre), E_N=E_N),
|
||||
)
|
||||
return _Portefolje(ledd=(ledd,), E_G=E_N)
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,8 @@ the yearly cost of all capital at the required returns, so a programme cannot
|
|||
reach M6 by being large alone. Capital is on levelised form here, as in S15,
|
||||
S5, S9 and S11: an asset costs its annuity in each year it is in operation.
|
||||
A power plant on the grid enters after the additionality rule: when S45 binds
|
||||
for a technology, its plants neither add nor take (clarification 11).
|
||||
for a technology, its plants neither add nor take, and only the accident cost
|
||||
is left (clarifications 11 and 41).
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
|
@ -49,7 +50,8 @@ class Skala:
|
|||
at most).
|
||||
M6_median: M6 against the median of the ten years instead of the average.
|
||||
M6_2050: the share in 2050; None when the analysis ends before that.
|
||||
M6_topp: the share in the year the contribution is highest.
|
||||
M6_topp: the share in the year the contribution is highest, among the years in
|
||||
which at least one facility is operated.
|
||||
toppaar: that year.
|
||||
"""
|
||||
|
||||
|
|
@ -77,8 +79,9 @@ def _kraftverk_netto(
|
|||
The annuity of the investment (with interest during construction), fixed and
|
||||
variable operation, the yearly provision for decommissioning and the accident
|
||||
cost, minus the sales. In A nothing is sold, and the variable costs run only
|
||||
when the data centre uses power. On the grid the whole term is zero when the
|
||||
additionality rule binds for the technology.
|
||||
when the data centre uses power. On the grid only the accident cost is left
|
||||
when the additionality rule binds for the technology: it is outside NV_i of
|
||||
S45 and runs in the cash flow whatever the factor is.
|
||||
"""
|
||||
kjernekraft = verk.teknologi == ks.KJERNEKRAFT
|
||||
levetid = inn["L_N"] if kjernekraft else inn[f"{verk.teknologi}.levetid"]
|
||||
|
|
@ -94,7 +97,7 @@ def _kraftverk_netto(
|
|||
if not verk.selges:
|
||||
return kostnad + (verk.variabel_drift if har_last else 0.0)
|
||||
if regelen_binder:
|
||||
return 0.0
|
||||
return verk.ulykke
|
||||
return kostnad + verk.variabel_drift - verk.psi * pris * verk.energi
|
||||
|
||||
|
||||
|
|
@ -214,7 +217,8 @@ def skala(inn: Inndata, res: Programresultat, *, u_e: float = 0.0) -> Skala:
|
|||
M6 = float(B_6[j]) / nevner
|
||||
M6_snitt = float(np.mean(B_6[j : j + res.plan.L_H])) / nevner
|
||||
M6_median = float(B_6[j]) / inn.petroleum_median
|
||||
topp = int(np.argmax(B_6))
|
||||
driftsaar = [t - T_0 for t in res.aar if res.plan.antall_i_drift(t) > 0]
|
||||
topp = max(driftsaar, key=lambda j: float(B_6[j]))
|
||||
return Skala(
|
||||
B_6=B_6,
|
||||
stabilt_aar=stabilt,
|
||||
|
|
|
|||
|
|
@ -258,6 +258,12 @@ def test_del_I_holder_ikke_naar_hver_losning_er_felt() -> None:
|
|||
assert dommer.del_I(per_losning, median, valg) is Dom.HOLDER_IKKE
|
||||
per_losning[Losning.C] = _dommer(M6=Dom.HOLDER_IKKE)
|
||||
assert dommer.del_I(per_losning, median, valg) is Dom.BETINGELSER
|
||||
# without conditions that can be named within the range of the sources it does not hold
|
||||
assert dommer.del_I(per_losning, median, valg, betingelser_kan_navngis=False) is Dom.HOLDER_IKKE
|
||||
# the pre-registration says a negative median; a median of exactly zero does not fell
|
||||
median[Losning.B] = 0.0
|
||||
per_losning[Losning.C] = _dommer(M4=Dom.HOLDER_IKKE)
|
||||
assert dommer.del_I(per_losning, median, valg) is Dom.BETINGELSER
|
||||
assert dommer.del_I(per_losning, median, Trinnvalg(None, Grunnlag.INGEN)) is Dom.HOLDER_IKKE
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ parameter file's. Nothing here says anything about the hypothesis.
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
import dataclasses
|
||||
import math
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
|
|
@ -79,6 +80,19 @@ def test_underskudd_fores_fram_uten_rente() -> None:
|
|||
assert lg.s28_etter_framforing([10.0, -5.0, -5.0, 30.0]) == (10.0, 0.0, 0.0, 20.0)
|
||||
|
||||
|
||||
def test_s28_framfort_underskudd_taper_realverdi() -> None:
|
||||
"""Without interest means nominal: a loss of 100 is worth 100 / 1.1 the year after.
|
||||
|
||||
With 10 % price growth: the loss of 100 is 90.91 in year 2, where 60 is used (30.91 left);
|
||||
28.10 in year 3, where it is used up and 80 - 28.10 is taxed.
|
||||
"""
|
||||
grunnlag = lg.s28_etter_framforing([-100.0, 60.0, 80.0], faktor=1.0 / 1.1)
|
||||
assert grunnlag[:2] == (0.0, 0.0)
|
||||
assert grunnlag[2] == pytest.approx(80.0 - (100.0 / 1.1 - 60.0) / 1.1)
|
||||
assert lg.s28_realverdi(belop=121.0, iota=0.1, aar=2) == pytest.approx(100.0)
|
||||
assert lg.s28_realverdi(belop=121.0, iota=0.0, aar=7) == 121.0
|
||||
|
||||
|
||||
def test_s28_naaverdi() -> None:
|
||||
assert lg.s28_naaverdi(netto=[-100.0, 0.0, 121.0], rente=0.1) == pytest.approx(0.0)
|
||||
|
||||
|
|
@ -93,8 +107,10 @@ def test_s29_kapitalkostnad() -> None:
|
|||
def test_s30_skatt_med_egen_framforing_for_saerskatten() -> None:
|
||||
"""Corporate tax 20 % on profit after the loss; special tax 50 % above 5 % of capital 200.
|
||||
|
||||
Profit above the return: -100, 50, 70, 40. The loss of 100 takes the 50 and half of the
|
||||
70, so the special tax base is 0, 0, 20, 40.
|
||||
Corporate tax: 0, 0, 8, 10. The basis of the special tax is the profit minus the corporate
|
||||
tax and minus 5 % of 200: -100, 50, 62, 30. The negative basis is carried with 5 %
|
||||
interest: 105 meets the 50 (55 left), 57.75 meets the 62 (4.25 taxed), then 30. The rate
|
||||
on that basis is 0.5 / 0.8, so one more krone of profit pays 20 % + 50 %.
|
||||
"""
|
||||
selskap, saer = lg.s30_skatt(
|
||||
overskudd=[-100.0, 60.0, 80.0, 50.0],
|
||||
|
|
@ -104,7 +120,7 @@ def test_s30_skatt_med_egen_framforing_for_saerskatten() -> None:
|
|||
r_e=0.05,
|
||||
)
|
||||
assert selskap == pytest.approx((0.0, 0.0, 8.0, 10.0))
|
||||
assert saer == pytest.approx((0.0, 0.0, 10.0, 20.0))
|
||||
assert saer == pytest.approx((0.0, 0.0, 0.625 * 4.25, 0.625 * 30.0))
|
||||
|
||||
|
||||
def test_s30_statens_kontantstrom() -> None:
|
||||
|
|
@ -146,8 +162,23 @@ def test_R_bedriftsstrom_haandregnet(oppdiktet: LagInndata) -> None:
|
|||
for t in res.aar:
|
||||
assert strom.investering[aar[t]] == pytest.approx(investert.get(t, 0.0))
|
||||
assert (strom.budsjett == strom.investering).all()
|
||||
# the building over 15 years and one vintage at a time over 5
|
||||
assert strom.avskrivning[aar[2030] :] == pytest.approx(110e9 / 15.0 + 40e9)
|
||||
|
||||
# The building over 15 years and one vintage at a time over 5. The deduction is fixed in
|
||||
# the kroner of the year each half was paid (2028 and 2029; later vintages the year before
|
||||
# they start) and loses 2 % a year in constant kroner (clarification 47). Nothing is
|
||||
# written off at the final year: the building and the last vintage are still in operation.
|
||||
def realt(aar_siden: int) -> float:
|
||||
return 1.02**-aar_siden
|
||||
|
||||
assert strom.avskrivning[aar[2030]] == pytest.approx(
|
||||
(55e9 / 15.0 + 20e9) * (realt(2) + realt(1))
|
||||
)
|
||||
assert strom.avskrivning[aar[2036]] == pytest.approx(
|
||||
55e9 / 15.0 * (realt(8) + realt(7)) + 40e9 * realt(2)
|
||||
)
|
||||
assert strom.avskrivning[aar[2040]] == pytest.approx(
|
||||
55e9 / 15.0 * (realt(12) + realt(11)) + 40e9 * realt(1)
|
||||
)
|
||||
assert not strom.avskrivning[: aar[2030]].any()
|
||||
assert strom.kapital[aar[2029]] == pytest.approx(310e9)
|
||||
assert strom.kapital[aar[2030]] == pytest.approx(310e9 - 110e9 / 15.0 - 40e9)
|
||||
|
|
@ -194,13 +225,21 @@ def test_eiendelene_gir_de_samme_investeringene_som_kontantstrommen(
|
|||
|
||||
|
||||
def test_avskrivningene_summerer_seg_til_det_som_er_betalt(oppdiktet: LagInndata) -> None:
|
||||
"""Every asset is out of operation by 2060, so the booked capital ends at zero."""
|
||||
inn = oppdiktet()
|
||||
res = _regn(inn, Losning.A)
|
||||
strom = ei.bedriftsstrom(inn, res)
|
||||
assert float(strom.avskrivning.sum()) == pytest.approx(float(strom.investering.sum()))
|
||||
assert strom.kapital[-1] == pytest.approx(0.0, abs=1.0)
|
||||
assert (strom.kapital > -1.0).all()
|
||||
"""Every asset is out of operation by 2060, so the booked capital ends at zero.
|
||||
|
||||
Without price growth the tax depreciation sums to what is paid; with it, to less.
|
||||
"""
|
||||
for iota in (0.0, 0.02):
|
||||
inn = oppdiktet(iota=iota)
|
||||
res = _regn(inn, Losning.A)
|
||||
strom = ei.bedriftsstrom(inn, res)
|
||||
assert strom.kapital[-1] == pytest.approx(0.0, abs=1.0)
|
||||
assert (strom.kapital > -1.0).all()
|
||||
betalt = float(strom.investering.sum())
|
||||
if iota == 0.0:
|
||||
assert float(strom.avskrivning.sum()) == pytest.approx(betalt)
|
||||
else:
|
||||
assert 0.5 * betalt < float(strom.avskrivning.sum()) < 0.99 * betalt
|
||||
|
||||
|
||||
def test_A_betaler_elavgift_men_ikke_nettariff(oppdiktet: LagInndata) -> None:
|
||||
|
|
@ -326,12 +365,15 @@ def test_privat_minoritet_og_direkte_andel(oppdiktet: LagInndata) -> None:
|
|||
skatt = ut.selskapsskatt + ut.saerskatt
|
||||
ventet = 0.75 * skatt + strom.avgifter + 0.6 * 0.75 * ut.FKE + 0.25 * strom.NK
|
||||
assert ut.KS_stat == pytest.approx(ventet)
|
||||
# the special tax is 50 % of the profit above r_e on the capital booked at the start of the
|
||||
# year; the return on what was booked during construction is carried forward and used in 2030
|
||||
# the basis of the special tax is the profit with straight-line depreciation in constant
|
||||
# kroner, minus the corporate tax and minus r_e on the capital booked at the start of the
|
||||
# year; the rate on it is 0.5 / 0.8. The return on what was booked during construction is
|
||||
# carried forward with interest and used in 2030
|
||||
r_e = 1.08 / 1.02 - 1.0
|
||||
overskudd = strom.inntekt - strom.drift - strom.avskrivning
|
||||
overskudd = strom.inntekt - strom.drift - strom.avskrivning_fast
|
||||
j = 2031 - 2027
|
||||
assert ut.saerskatt[j] == pytest.approx(0.5 * (overskudd[j] - r_e * strom.kapital[j - 1]))
|
||||
grunnlag = overskudd[j] - ut.selskapsskatt[j] - r_e * strom.kapital[j - 1]
|
||||
assert ut.saerskatt[j] == pytest.approx(0.5 / 0.8 * grunnlag)
|
||||
boers = ei.eierresultat(inn, strom, inn.eierformer["majoritet_boers"])
|
||||
assert boers.NV_stat < ut.NV_stat
|
||||
# the special tax lowers the project's value after tax (S28)
|
||||
|
|
@ -340,6 +382,64 @@ def test_privat_minoritet_og_direkte_andel(oppdiktet: LagInndata) -> None:
|
|||
) > ei.naaverdi_etter_skatt(inn, strom, inn.eierformer["petroleumsmodell"])
|
||||
|
||||
|
||||
@pytest.mark.parametrize("navn", ["heleid_selskap", "majoritet_boers", "petroleumsmodell"])
|
||||
def test_statens_eiernes_og_laangivernes_strommer_summerer_seg(
|
||||
oppdiktet: LagInndata, navn: str
|
||||
) -> None:
|
||||
"""Clarification 48: nothing is counted twice and nothing is lost between the parties.
|
||||
|
||||
When the state covers overruns by its share only (zeta = s), what the state, the private
|
||||
owners and the lenders receive adds up to the project's net cash flow plus the
|
||||
electricity tax and grid tariff, every year.
|
||||
"""
|
||||
inn = oppdiktet(T_slutt=2040)
|
||||
strom = _lonnsom(inn)
|
||||
e = dataclasses.replace(inn.eierformer[navn], zeta=inn.eierformer[navn].s)
|
||||
ut = ei.eierresultat(inn, strom, e)
|
||||
gjeld_inn = np.concatenate(([0.0], ut.gjeld[:-1]))
|
||||
rente = (1.0 + e.r_d) / 1.02 - 1.0
|
||||
laangivere = (1.0 - e.theta) * (rente * gjeld_inn - (ut.gjeld - gjeld_inn))
|
||||
private = (1.0 - e.s) * (1.0 - e.theta) * ut.FKE
|
||||
assert ut.KS_stat + private + laangivere == pytest.approx(strom.NK + strom.avgifter)
|
||||
|
||||
|
||||
def test_saerskatten_treffer_bare_avkastning_utover_r_e() -> None:
|
||||
"""Clarification 48: the special tax is neutral.
|
||||
|
||||
100 paid in year 0 for an asset written off over 4 years, r_e 6 % after a corporate tax
|
||||
of 20 %. The corporate tax has its own basis (20, 30, 10, 40: nominal deductions), so the
|
||||
tax is 4, 6, 2, 8. A project whose profit after that tax is exactly 6 % of the booked
|
||||
capital at the start of each year has no special tax, however the corporate tax is
|
||||
computed. With 10 more in profit a year, corporate tax takes 2 and the special tax 5:
|
||||
50 % of the 10. Negative bases are carried with interest.
|
||||
"""
|
||||
kapital_inn = [0.0, 100.0, 75.0, 50.0, 25.0]
|
||||
selskapsgrunnlag = [0.0, 20.0, 30.0, 10.0, 40.0]
|
||||
normal = [0.2 * g + 0.06 * k for g, k in zip(selskapsgrunnlag, kapital_inn, strict=True)]
|
||||
for ekstra in (0.0, 10.0):
|
||||
selskap, saer = lg.s30_skatt(
|
||||
overskudd=[0.0] + [g + ekstra for g in selskapsgrunnlag[1:]],
|
||||
overskudd_fast=[0.0] + [x + ekstra for x in normal[1:]],
|
||||
kapital_inn=kapital_inn,
|
||||
tau_s=0.2,
|
||||
tau_g=0.5,
|
||||
r_e=0.06,
|
||||
iota=0.02,
|
||||
)
|
||||
assert saer == pytest.approx((0.0, *([0.5 * ekstra] * 4)))
|
||||
assert selskap[1] == pytest.approx(0.2 * (20.0 + ekstra))
|
||||
# a negative basis of 50 in year 1 is worth 53 in year 2
|
||||
_, saer = lg.s30_skatt(
|
||||
overskudd=[0.0] * 3,
|
||||
overskudd_fast=[0.0, -50.0, 60.0],
|
||||
kapital_inn=[0.0] * 3,
|
||||
tau_s=0.0,
|
||||
tau_g=0.5,
|
||||
r_e=0.06,
|
||||
)
|
||||
assert saer == pytest.approx((0.0, 0.0, 0.5 * (60.0 - 53.0))) # tau_s = 0: the rate is tau_g
|
||||
|
||||
|
||||
def test_staten_dekker_overskridelser_ut_over_eierandelen(oppdiktet: LagInndata) -> None:
|
||||
"""Overrun 50 % on nuclear power; the state owns 60 % but carries all of it (zeta = 1)."""
|
||||
inn = oppdiktet(u_xi=0.1)
|
||||
|
|
@ -453,3 +553,7 @@ def test_regelen_for_eierformer() -> None:
|
|||
strengere = ei.ranger_eierformer(kriterier, eos, risikogrense=0.05)
|
||||
assert strengere.rangert == ()
|
||||
assert strengere.over_risikogrensen == ("b", "a", "e")
|
||||
# a form that fails the EEA assessment cannot take another form out: without a, only d is
|
||||
# better than c on everything, and d is out itself
|
||||
uten_a = ei.ranger_eierformer(kriterier[1:], eos)
|
||||
assert set(uten_a.ute) == {"d"}
|
||||
|
|
|
|||
|
|
@ -148,3 +148,10 @@ def test_relativ_prisvirkning_per_omraade(oppdiktet: LagInndata) -> None:
|
|||
# the price level of the dry year cancels; the factor on the effect does not
|
||||
tort = kraftsystem.relativ_prisvirkning(inn, Delta_Q=3e6, tort=True)
|
||||
assert tort["NO1"] == pytest.approx(1.2 * 30.0 / 600.0)
|
||||
|
||||
|
||||
def test_relativ_prisvirkning_krever_positiv_pris_uten_satsingen(oppdiktet: LagInndata) -> None:
|
||||
"""A price of zero or less without the programme would turn the sign of the ratio."""
|
||||
inn = oppdiktet(S0=80e6)
|
||||
with pytest.raises(ValueError, match="not positive"):
|
||||
kraftsystem.relativ_prisvirkning(inn, Delta_Q=3e6, tort=False)
|
||||
|
|
|
|||
|
|
@ -376,6 +376,16 @@ def test_s11_kraftverk_som_akkurat_dekker_kostnaden_endrer_ingenting() -> None:
|
|||
assert med == pytest.approx(600)
|
||||
|
||||
|
||||
def test_s11_bindende_regel_lar_ulykkeskostnaden_staa() -> None:
|
||||
"""Nuclear power with S45 binding: only the accident cost of 4 kr/MWh is left."""
|
||||
kjerne = lg.Portefoljeledd(x=1.0, LCOE=500.0, psi=1.0, regelen_binder=True, q_N=4.0)
|
||||
assert kjerne.nettoledd(600) == 4.0
|
||||
verdi = lg.s11_kraftkostnad_nett(
|
||||
p_z=600, n_tap=0.1, portefolje=[kjerne], E_G=8e6, E_D=4e6, H_a=0.0, F_a=0.0
|
||||
)
|
||||
assert verdi == pytest.approx(660 + 4.0 * 2)
|
||||
|
||||
|
||||
def test_s11_portefolje_med_to_teknologier() -> None:
|
||||
"""Hydro earns more than it costs, so S45 binds and its term is zero; wind stands as it is."""
|
||||
vann = lg.Portefoljeledd(x=0.25, LCOE=500.0, psi=1.26, regelen_binder=True)
|
||||
|
|
|
|||
|
|
@ -145,6 +145,8 @@ def test_m5_areal_mot_vind_paa_land() -> None:
|
|||
def test_m5_samlet() -> None:
|
||||
assert miljo.m5(Dom.HOLDER, Dom.HOLDER) is Dom.HOLDER
|
||||
assert miljo.m5(Dom.BETINGELSER, Dom.HOLDER) is Dom.BETINGELSER
|
||||
assert miljo.m5(Dom.BETINGELSER, Dom.BETINGELSER) is Dom.BETINGELSER
|
||||
assert miljo.m5(Dom.HOLDER, Dom.BETINGELSER) is Dom.BETINGELSER
|
||||
# "one of (i) and (ii) broken": with both broken it does not hold
|
||||
assert miljo.m5(Dom.BETINGELSER, Dom.BETINGELSER) is Dom.HOLDER_IKKE
|
||||
assert miljo.m5(Dom.HOLDER, Dom.HOLDER_IKKE) is Dom.HOLDER_IKKE
|
||||
assert miljo.m5(Dom.HOLDER, Dom.HOLDER, kostnadsfort=False) is Dom.HOLDER_IKKE
|
||||
|
|
|
|||
|
|
@ -256,15 +256,26 @@ def test_B_kraftkostnaden_bruker_programmets_enheter(oppdiktet: LagInndata) -> N
|
|||
assert kost.c_a[:, j] == pytest.approx(c_a)
|
||||
|
||||
|
||||
def test_bindende_tilleggsregel_gir_nettoledd_null(oppdiktet: LagInndata) -> None:
|
||||
"""A cheap reactor that pays its way on the grid neither adds nor takes (clarification 11)."""
|
||||
def test_bindende_tilleggsregel_lar_bare_ulykkeskostnaden_staa(oppdiktet: LagInndata) -> None:
|
||||
"""A cheap reactor that pays its way on the grid neither adds nor takes (clarification 11).
|
||||
|
||||
The accident cost is outside NV_i of S45 and stays (clarification 41): 1e-5 a year per
|
||||
unit times the cost of an accident beyond the 8 mrd. kr insured. In B three units of
|
||||
1 000 MW (1 000 mrd. kr) shared by two facilities; in B' each facility's own units of
|
||||
50 MW (50 mrd. kr).
|
||||
"""
|
||||
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 res.varsigma[ks.KJERNEKRAFT] < 1.0
|
||||
j = 2040 - 2027
|
||||
H_a = 5e6 * (600.0 + res.dim.P_G_N) * _crf(0.06, 40)
|
||||
c_a = 1.05 * res.kraftaar[j].pris + (H_a + float(res.F_a[j]) / 2.0) / E_D
|
||||
if losning is Losning.B:
|
||||
assert sum(len(f.gruppe.numre) for f in res.felles) == 3
|
||||
ulykke = 3 * 1e-5 * (1e12 - 8e9) / 2.0
|
||||
else:
|
||||
ulykke = res.dim.N_u * 1e-5 * (50e9 - 8e9)
|
||||
c_a = 1.05 * res.kraftaar[j].pris + (H_a + float(res.F_a[j]) / 2.0 + ulykke) / E_D
|
||||
assert nv.kraftkostnad(inn, res).c_a[:, j] == pytest.approx(c_a)
|
||||
# a business is credited the plant's surplus: S45 does not apply in M2
|
||||
bedrift = nv.kraftkostnad(inn, res, bedrift=True)
|
||||
|
|
|
|||
|
|
@ -92,9 +92,11 @@ def test_R_bidraget_aar_for_aar_og_M6(oppdiktet: LagInndata) -> None:
|
|||
assert ut.M6_snitt == pytest.approx((i_drift - 1e9 / 5.0) / 500e9)
|
||||
assert ut.M6_median == pytest.approx((i_drift - 1e9) / 250e9)
|
||||
assert ut.M6_2050 is None
|
||||
# at the made-up cost-based price the contribution is negative, so no year beats 2027
|
||||
# at the made-up cost-based price the contribution is negative in every year; the peak
|
||||
# is taken among the operating years, so the years before start-up (zero) do not count
|
||||
assert i_drift < 0
|
||||
assert (ut.M6_topp, ut.toppaar) == (0.0, 2027)
|
||||
assert ut.M6_topp == pytest.approx(i_drift / 500e9)
|
||||
assert ut.toppaar >= 2031
|
||||
# with 40 % owned outside Norway only 60 % of the surplus above normal return counts
|
||||
utenlandsk = skala.skala(inn, res, u_e=0.4)
|
||||
assert utenlandsk.B_6[4] == pytest.approx(
|
||||
|
|
@ -175,8 +177,14 @@ def test_A_uten_brikker_betaler_ikke_variable_kostnader(oppdiktet: LagInndata) -
|
|||
assert ut[2039 - 2027] == pytest.approx(med_last)
|
||||
|
||||
|
||||
def test_kraftverk_som_tilleggsregelen_binder_for_teller_null(oppdiktet: LagInndata) -> None:
|
||||
"""Two facilities in B with a cheap reactor: the units neither add nor take in S31."""
|
||||
def test_kraftverk_som_tilleggsregelen_binder_for_teller_bare_ulykkeskostnaden(
|
||||
oppdiktet: LagInndata,
|
||||
) -> None:
|
||||
"""Two facilities in B with a cheap reactor: the units neither add nor take in S31.
|
||||
|
||||
Only the accident cost is left (clarification 41): three units of 1 000 MW, each
|
||||
1e-5 a year times the 1 000 mrd. kr of an accident beyond the 8 mrd. kr insured.
|
||||
"""
|
||||
inn = oppdiktet(c_N_ref=10e6, f_N=0.3e6, s_brikker=0.12)
|
||||
res = _regn(inn, Losning.B, N_anlegg=2)
|
||||
assert res.varsigma[ks.KJERNEKRAFT] < 1.0
|
||||
|
|
@ -186,7 +194,10 @@ def test_kraftverk_som_tilleggsregelen_binder_for_teller_null(oppdiktet: LagInnd
|
|||
1000.0 * _lcoc_v() - 2.5e9 - 1.05 * res.kraftaar[j].pris * E_D - BYGG - MASKINVARE - nett
|
||||
)
|
||||
ut = skala.overskudd_utover_avkastning(inn, res)
|
||||
assert ut[j] == pytest.approx(2.0 * per_anlegg - float(res.F_a[j]))
|
||||
enheter = sum(len(f.gruppe.numre) for f in res.felles if f.gruppe.start <= 2040)
|
||||
assert enheter == 3
|
||||
ulykke = 3 * 1e-5 * (1e12 - 8e9)
|
||||
assert ut[j] == pytest.approx(2.0 * per_anlegg - float(res.F_a[j]) - ulykke)
|
||||
# without the rule the surplus of the units is credited
|
||||
dim = ks.dimensjoner(inn, Losning.B)
|
||||
uten = ks.regn_program(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue