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
|
|
@ -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"}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue