Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
126 commits
Select commit Hold shift + click to select a range
955a7c5
gitignore working files
softwareengineerprogrammer Nov 7, 2025
29b2f17
fix parameter positional list parameter check
softwareengineerprogrammer Nov 7, 2025
4604d75
example_SAM-single-owner-PPA-5.txt
softwareengineerprogrammer Nov 7, 2025
36da399
Additional integrity check for example files in test_geophires_examples
softwareengineerprogrammer Nov 7, 2025
66472bd
support construction years > 1 by offsetting SAM cash flow vectors - …
softwareengineerprogrammer Nov 7, 2025
f95e1d9
incremental adjustments. all examples tests pass
softwareengineerprogrammer Nov 7, 2025
4ff54e7
update construction year test (WIP)
softwareengineerprogrammer Nov 7, 2025
73c1dd9
let construction inflation cost be calculated from inflation + constr…
softwareengineerprogrammer Nov 7, 2025
fd6dc58
initial impl of phased construction capex
softwareengineerprogrammer Nov 7, 2025
fe01752
example_SAM-single-owner-PPA-5 sculpting
softwareengineerprogrammer Nov 7, 2025
2e2b8fa
naming aligned with eventual support for separate exploration costs f…
softwareengineerprogrammer Nov 9, 2025
369bf89
more naming to align with pre-revenue convention and existing 'bond' …
softwareengineerprogrammer Nov 9, 2025
518015e
more bond terminology and default value alignment
softwareengineerprogrammer Nov 9, 2025
4c625e3
consolidate logic for default phased capex schedule + more naming/ter…
softwareengineerprogrammer Nov 9, 2025
8f78111
align inflation costs during construction with pre-existing conventio…
softwareengineerprogrammer Nov 9, 2025
cf7bc1b
WIP - accrued financing during construction more-ish-ly aligned with …
softwareengineerprogrammer Nov 9, 2025
4d9c8d8
Revert "WIP - accrued financing during construction more-ish-ly align…
softwareengineerprogrammer Nov 9, 2025
bfff80f
align SAM economics test with corrected accrued financing during cons…
softwareengineerprogrammer Nov 9, 2025
632b8bf
Bump version: 3.9.65 → 3.10.0
softwareengineerprogrammer Nov 9, 2025
87af498
regenerate examples affected by change to accrued financing during co…
softwareengineerprogrammer Nov 9, 2025
84a28f7
fix unit test, update schema
softwareengineerprogrammer Nov 9, 2025
3be2926
use custom depreciation schedule
softwareengineerprogrammer Nov 10, 2025
478e5b2
regenerate example_SAM-single-owner-PPA-5 with custom depreciation
softwareengineerprogrammer Nov 10, 2025
c1cbbec
make 'construction years' terminology synonymous with pre-revenue years
softwareengineerprogrammer Nov 10, 2025
f299be2
Fix test_multiple_construction_years_supported
softwareengineerprogrammer Nov 10, 2025
704758c
align terminology around bond/debt/loans in applicable tooltip texts
softwareengineerprogrammer Nov 10, 2025
0313a81
add Bond Financing Start Year
softwareengineerprogrammer Nov 10, 2025
2657cc3
validation cleanup, FIXME WIP for WACC. also WIP: Construction Bond I…
softwareengineerprogrammer Nov 10, 2025
216b5ab
remove construction bond interest rate since it's redundant with Infl…
softwareengineerprogrammer Nov 10, 2025
11eab77
Bump version: 3.10.0 → 3.10.1
softwareengineerprogrammer Nov 10, 2025
9e294de
update test_royalty_rate_not_supported_for_non_sam_economic_models
softwareengineerprogrammer Nov 10, 2025
52ad631
Disable bond financing start year for now since we can't disable debt…
softwareengineerprogrammer Nov 11, 2025
9dbf2f9
don't include interest in phased capex schedule calculation since SAM…
softwareengineerprogrammer Nov 11, 2025
19ee1ab
only run core test matrix items on non-main branch in GHA
softwareengineerprogrammer Nov 11, 2025
18da2f6
use cancel-action instead of invalid conditional
softwareengineerprogrammer Nov 11, 2025
2f18744
andymckay/[email protected] (0.5 doesn't seem to be available)
softwareengineerprogrammer Nov 11, 2025
16007c8
andymckay/[email protected] (0.4 doesn't seem to be available)
softwareengineerprogrammer Nov 11, 2025
f2083de
try dropping 'v' prefix (and trying 0.5 again)
softwareengineerprogrammer Nov 11, 2025
941eade
make all test steps conditional instead of using cancel action
softwareengineerprogrammer Nov 11, 2025
56383cf
add no-op '[skip check]' step to help make it apparent why subsequent…
softwareengineerprogrammer Nov 11, 2025
a424f3d
skip step wording
softwareengineerprogrammer Nov 11, 2025
716b42b
remove unused utility function
softwareengineerprogrammer Nov 11, 2025
64c0dfd
move phased capex function to utilities
softwareengineerprogrammer Nov 11, 2025
749219b
WIP - aligning post-processing cash flows (to achieve parity for Ferv…
softwareengineerprogrammer Nov 11, 2025
943747c
WIP - Fervo_Project_Cape-4 IRR parity achieved - TODO/WIP to achieve …
softwareengineerprogrammer Nov 11, 2025
421319e
Fervo_Project_Cape-4 NPV parity achieved
softwareengineerprogrammer Nov 11, 2025
e585ab2
base test case handle zero when calculating percent difference
softwareengineerprogrammer Nov 11, 2025
b390de5
regenerate example_SAM-single-owner-PPA-5
softwareengineerprogrammer Nov 11, 2025
ac7c6df
Bump version: 3.10.1 → 3.10.2
softwareengineerprogrammer Nov 11, 2025
393636d
adjust_phased_schedule_to_new_length utility - WIP, not yet integrated
softwareengineerprogrammer Nov 12, 2025
8746790
Update assertHasLogRecordWithMessage to allow substring matching
softwareengineerprogrammer Nov 12, 2025
bca12aa
automatically adjust capex schedule length for construction years in …
softwareengineerprogrammer Nov 12, 2025
faa20d2
Bump version: 3.10.2 → 3.10.3
softwareengineerprogrammer Nov 12, 2025
00818d6
WIP - structure PreRevenueCostsAndCashflow profile to mirror SAM rows
softwareengineerprogrammer Nov 13, 2025
db94a8b
insert columns with negative year indexes for construction years befo…
softwareengineerprogrammer Nov 13, 2025
01a1077
WIP - insert pre-revenue values from SAM Economics Calculations - TOD…
softwareengineerprogrammer Nov 13, 2025
a6b59fa
WIP - add separate CONSTRUCTION cash flow profile category instead of…
softwareengineerprogrammer Nov 13, 2025
4615b82
use construction-specific row names for now to reduce potential confu…
softwareengineerprogrammer Nov 13, 2025
51945d5
re-enable behavior to backfill native SAM rows
softwareengineerprogrammer Nov 13, 2025
f04a30f
include debt balance line item
softwareengineerprogrammer Nov 13, 2025
03506d2
initial impl of NPV backfill (WIP - needs cleanup)
softwareengineerprogrammer Nov 13, 2025
717307c
backfill IRR
softwareengineerprogrammer Nov 13, 2025
f997c48
update example_SAM-single-owner-PPA-5
softwareengineerprogrammer Nov 13, 2025
6fe5ca7
Bump version: 3.10.3 → 3.10.4
softwareengineerprogrammer Nov 13, 2025
e4c3faf
temporarily only run check/docs/py312 in GHA (previous approach wasn'…
softwareengineerprogrammer Nov 14, 2025
0d9a962
disable backfilling except for NPV & IRR, for now
softwareengineerprogrammer Nov 14, 2025
cd78710
don't erroneously double-count IDC as debt closing cost
softwareengineerprogrammer Nov 14, 2025
40daa7e
enable pre-commit formatting of EconomicsUtils.py
softwareengineerprogrammer Nov 14, 2025
dd1e9cf
EconomicsUtils documentation copy edit, formatting
softwareengineerprogrammer Nov 14, 2025
338c3ca
regenerate SAM examples - adds construction cash flow line items only…
softwareengineerprogrammer Nov 14, 2025
3e28dc6
backfill NPV/IRR all years (including final year), skip test_nan_afte…
softwareengineerprogrammer Nov 14, 2025
2b638cb
WIP - fix issue with too many year columns being generated (construct…
softwareengineerprogrammer Nov 14, 2025
2f1005f
fix IRR & NPV backfill per previous commit WIP explanation
softwareengineerprogrammer Nov 14, 2025
9d22f32
Merge pull request #3 from scientific-web-services/adjust-cash-flow-t…
softwareengineerprogrammer Nov 14, 2025
724a2c3
Bump version: 3.10.4 → 3.10.5
softwareengineerprogrammer Nov 14, 2025
8207457
re-enable bond financing start year now that it's compatible with the…
softwareengineerprogrammer Nov 14, 2025
f85acd3
Bump version: 3.10.5 → 3.10.6
softwareengineerprogrammer Nov 14, 2025
d1e3583
Add Inflated Bond Interest Rate During Construction param
softwareengineerprogrammer Nov 16, 2025
01eaadb
Bump version: 3.10.6 → 3.10.7
softwareengineerprogrammer Nov 16, 2025
124bff4
fix Inflated Bond Interest Rate During Construction impl (inclues cor…
softwareengineerprogrammer Nov 16, 2025
e4cbce4
Bump version: 3.10.7 → 3.10.8
softwareengineerprogrammer Nov 16, 2025
865b7ab
add debt interest payment (IDC) line item
softwareengineerprogrammer Nov 18, 2025
504e794
construct construction cash flow profile rows in pre-revenue calculat…
softwareengineerprogrammer Nov 18, 2025
79dabc1
insert separator rows in construction cash flow profile category
softwareengineerprogrammer Nov 18, 2025
be40857
extend pre-revenue/construction row length to match rest of profile (…
softwareengineerprogrammer Nov 18, 2025
d2f0a19
regenerate examples
softwareengineerprogrammer Nov 18, 2025
bfd6cd6
Bump version: 3.10.8 → 3.10.9
softwareengineerprogrammer Nov 18, 2025
2b89e1d
define capex schedule min max values (fixed invalid JSON in generated…
softwareengineerprogrammer Nov 19, 2025
ef9d20c
pivot Bond Financing Start Year to be index-based for consistency/cla…
softwareengineerprogrammer Nov 19, 2025
a6206ae
Bump version: 3.10.9 → 3.10.10
softwareengineerprogrammer Nov 19, 2025
1a5af3b
update construction capex schedule tooltip text to reflect implementa…
softwareengineerprogrammer Nov 19, 2025
3b36dac
test that construction debt balance equals SAM debt balance at Year 0
softwareengineerprogrammer Nov 24, 2025
bc746b4
add issuance of equity [construction] cash flow row. test that sums f…
softwareengineerprogrammer Nov 24, 2025
12b172d
add interest during construction (IDC) output parameter
softwareengineerprogrammer Nov 24, 2025
00e1b5e
Add Interest During Construction (IDC) capital cost output
softwareengineerprogrammer Nov 24, 2025
66f82ea
break out EconomicsSamPreRevenue.py from EconomicsUtils.py
softwareengineerprogrammer Nov 24, 2025
b292910
Revert "temporarily only run check/docs/py312 in GHA (previous approa…
softwareengineerprogrammer Nov 24, 2025
2877e3b
Revert temporary changes to GitHub Actions config in commits a424f3d1…
softwareengineerprogrammer Nov 24, 2025
24136cb
test_economics_sam_pre_revenue.py py38 compat
softwareengineerprogrammer Nov 24, 2025
1095839
Remove some now-obsolete/irrelevant commented code in EconomicsSam.py
softwareengineerprogrammer Nov 24, 2025
c6cbe4b
test_base_test_case.py py38 compat
softwareengineerprogrammer Nov 24, 2025
f07672a
fix apparent py38-specific log assertion issue - https://github.com/s…
softwareengineerprogrammer Nov 24, 2025
c204d3e
skip py38-problematic assertion entirely for now https://github.com/s…
softwareengineerprogrammer Nov 24, 2025
c42030f
try another approach to skip assertion in GHA py38...
softwareengineerprogrammer Nov 24, 2025
b4154ae
mark FIXME for previous commit
softwareengineerprogrammer Nov 25, 2025
9fde332
add EconomicsSamPreRevenue to pre-commit config
softwareengineerprogrammer Nov 25, 2025
5bbd23b
Normalize CAPEX schedule sum to 1.0.
softwareengineerprogrammer Nov 25, 2025
422178e
regenerate schema
softwareengineerprogrammer Nov 25, 2025
c4c27d5
attempt to fix asserLogs py38 incompatibility
softwareengineerprogrammer Nov 25, 2025
448463c
try scoping skip to py38 (again)
softwareengineerprogrammer Nov 25, 2025
fab5a17
drop '(IDC)' from Interest during construction param name
softwareengineerprogrammer Nov 25, 2025
12e22db
Add Overnight Capital Cost (OCC) output parameter. Only display OCC/I…
softwareengineerprogrammer Nov 25, 2025
8ccba78
update/enable multi-construction year logic in test_inflation_rate_du…
softwareengineerprogrammer Nov 25, 2025
dba6334
minor code readability cleanup
softwareengineerprogrammer Nov 25, 2025
2616613
designate royalties sub tests
softwareengineerprogrammer Nov 25, 2025
af61f34
Adjust royalty holder NPV for multiple construction years
softwareengineerprogrammer Nov 25, 2025
000e1cb
unit test add-ons with multiple construction years
softwareengineerprogrammer Nov 25, 2025
b43a201
Bump version: 3.10.10 → 3.10.11
softwareengineerprogrammer Nov 25, 2025
91c8340
log value in warning instead of full param object
softwareengineerprogrammer Nov 26, 2025
b4b77b8
OCC test assertions
softwareengineerprogrammer Nov 26, 2025
4e489f2
Fix Bond Financing Start Year off-by-one index implementation error. …
softwareengineerprogrammer Nov 27, 2025
7d2309e
enhance tooltip text and increase test coverage
softwareengineerprogrammer Nov 27, 2025
4d4cbb2
revert accidentally-included test stub
softwareengineerprogrammer Nov 27, 2025
b8eea24
Always display OCC for SAM-EM since inflation cost is included in Tot…
softwareengineerprogrammer Nov 27, 2025
ca2b936
fix unit test calculation to exclude OCC from expected total
softwareengineerprogrammer Nov 27, 2025
a9e6ee5
Bump version: 3.10.11 → 3.10.12
softwareengineerprogrammer Nov 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 3.9.65
current_version = 3.10.12
commit = True
tag = True

Expand Down
2 changes: 1 addition & 1 deletion .cookiecutterrc
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ default_context:
sphinx_doctest: "no"
sphinx_theme: "sphinx-py3doc-enhanced-theme"
test_matrix_separate_coverage: "no"
version: 3.9.65
version: 3.10.12
version_manager: "bump2version"
website: "https://github.com/NREL"
year_from: "2023"
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# pre-commit install --install-hooks
# To update the versions:
# pre-commit autoupdate
exclude: '^(\.tox|ci/templates|\.bumpversion\.cfg|src/geophires_x(?!/(GEOPHIRESv3|EconomicsSam|EconomicsSamCashFlow)\.py))(/|$)'
exclude: '^(\.tox|ci/templates|\.bumpversion\.cfg|src/geophires_x(?!/(GEOPHIRESv3|EconomicsSam|EconomicsSamCashFlow|EconomicsUtils|EconomicsSamPreRevenue)\.py))(/|$)'
# Note the order is intentional to avoid multiple passes of the hooks
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ Free software: `MIT license <LICENSE>`__
:alt: Supported implementations
:target: https://pypi.org/project/geophires-x

.. |commits-since| image:: https://img.shields.io/github/commits-since/softwareengineerprogrammer/GEOPHIRES-X/v3.9.65.svg
.. |commits-since| image:: https://img.shields.io/github/commits-since/softwareengineerprogrammer/GEOPHIRES-X/v3.10.12.svg
:alt: Commits since latest release
:target: https://github.com/softwareengineerprogrammer/GEOPHIRES-X/compare/v3.9.65...main
:target: https://github.com/softwareengineerprogrammer/GEOPHIRES-X/compare/v3.10.12...main

.. |docs| image:: https://readthedocs.org/projects/GEOPHIRES-X/badge/?style=flat
:target: https://nrel.github.io/GEOPHIRES-X
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
year = '2025'
author = 'NREL'
copyright = f'{year}, {author}'
version = release = '3.9.65'
version = release = '3.10.12'

pygments_style = 'trac'
templates_path = ['./templates']
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def read(*names, **kwargs):

setup(
name='geophires-x',
version='3.9.65',
version='3.10.12',
license='MIT',
description='GEOPHIRES is a free and open-source geothermal techno-economic simulator.',
long_description='{}\n{}'.format(
Expand Down
113 changes: 97 additions & 16 deletions src/geophires_x/Economics.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@
from geophires_x.EconomicsUtils import BuildPricingModel, wacc_output_parameter, nominal_discount_rate_parameter, \
real_discount_rate_parameter, after_tax_irr_parameter, moic_parameter, project_vir_parameter, \
project_payback_period_parameter, inflation_cost_during_construction_output_parameter, \
total_capex_parameter_output_parameter
interest_during_construction_output_parameter, total_capex_parameter_output_parameter, \
overnight_capital_cost_output_parameter
from geophires_x.GeoPHIRESUtils import quantity
from geophires_x.OptionList import Configuration, WellDrillingCostCorrelation, EconomicModel, EndUseOptions, PlantType, \
_WellDrillingCostCorrelationCitation
from geophires_x.Parameter import intParameter, floatParameter, OutputParameter, ReadParameter, boolParameter, \
coerce_int_params_to_enum_values
coerce_int_params_to_enum_values, listParameter, Parameter
from geophires_x.SurfacePlantUtils import MAX_CONSTRUCTION_YEARS
from geophires_x.Units import *
from geophires_x.WellBores import calculate_total_drilling_lengths_m

Expand Down Expand Up @@ -1050,28 +1052,43 @@ def __init__(self, model: Model):
'See https://github.com/NREL/GEOPHIRES-X/discussions/344 for further details.'
)

default_fraction_in_bonds = 0.5
self.FIB = self.ParameterDict[self.FIB.Name] = floatParameter(
"Fraction of Investment in Bonds",
DefaultValue=0.5,
DefaultValue=default_fraction_in_bonds,
Min=0.0,
Max=1.0,
UnitType=Units.PERCENT,
PreferredUnits=PercentUnit.TENTH,
CurrentUnits=PercentUnit.TENTH,
ErrMessage="assume default fraction of investment in bonds (0.5)",
ToolTipText="Fraction of geothermal project financing through bonds (debt)."
ErrMessage=f"assume default fraction of investment in bonds ({default_fraction_in_bonds})",
ToolTipText="Fraction of geothermal project financing through bonds (debt/loans)."
)

default_bond_interest_rate = 0.05
self.BIR = self.ParameterDict[self.BIR.Name] = floatParameter(
"Inflated Bond Interest Rate",
DefaultValue=0.05,
DefaultValue=default_bond_interest_rate,
Min=0.0,
Max=1.0,
UnitType=Units.PERCENT,
PreferredUnits=PercentUnit.TENTH,
CurrentUnits=PercentUnit.TENTH,
ErrMessage="assume default inflated bond interest rate (0.05)",
ToolTipText="Inflated bond interest rate (see docs)"
ErrMessage=f"assume default inflated bond interest rate ({default_bond_interest_rate})",
ToolTipText="Inflated bond interest rate (for debt/loans)"
)

self.bond_interest_rate_during_construction = self.ParameterDict[self.bond_interest_rate_during_construction.Name] = floatParameter(
'Inflated Bond Interest Rate During Construction',
DefaultValue=self.BIR.DefaultValue,
Min=0.0,
Max=1.0,
UnitType=Units.PERCENT,
PreferredUnits=PercentUnit.TENTH,
CurrentUnits=PercentUnit.TENTH,
ToolTipText='Inflated bond interest rate during construction (for debt/loans)'
)

self.EIR = self.ParameterDict[self.EIR.Name] = floatParameter(
"Inflated Equity Interest Rate",
DefaultValue=0.1,
Expand Down Expand Up @@ -1155,6 +1172,52 @@ def __init__(self, model: Model):
'calculated automatically by compounding Inflation Rate over Construction Years.'
)

construction_capex_schedule_name = 'Construction CAPEX Schedule'
self.construction_capex_schedule = self.ParameterDict[self.construction_capex_schedule.Name] = listParameter(
construction_capex_schedule_name,
DefaultValue=[1.],
Min=0.0,
Max=1.0,
ToolTipText=f'A list of fractions of the total overnight CAPEX spent in each construction year. '
f'For example, for 3 construction years with 10% in the first year, 40% in the second, '
f'and 50% in the third, provide {construction_capex_schedule_name} = 0.1,0.4,0.5. '
f'The schedule will be automatically interpolated to match the number of construction years '
f'and normalized to sum to 1.0.'
)

bond_financing_start_year_name = 'Bond Financing Start Year'
min_bond_financing_start_year = -1*(MAX_CONSTRUCTION_YEARS - 1)
default_bond_financing_start_year = min_bond_financing_start_year
latest_allowed_bond_financing_start_year_index = 0
self.bond_financing_start_year = self.ParameterDict[self.bond_financing_start_year.Name] = intParameter(
bond_financing_start_year_name,
DefaultValue=default_bond_financing_start_year,
AllowableRange=list(range(
min_bond_financing_start_year,
latest_allowed_bond_financing_start_year_index + 1,
1)),
UnitType=Units.TIME,
PreferredUnits=TimeUnit.YEAR,
CurrentUnits=TimeUnit.YEAR,
ToolTipText=f'By default, bond financing (debt/loans) starts during the first construction year '
f'(if {self.FIB.Name} is >0). '
f'Provide {bond_financing_start_year_name} to delay the '
f'start of bond financing during construction; years prior to {bond_financing_start_year_name} '
f'will be financed with equity only. '
f'The value is specified as a project year index corresponding to the Year row in the cash '
f'flow profile; the first construction year has the year index '
f'{{({model.surfaceplant.construction_years.Name} - 1) * -1}})'
f' and the final construction year index is 0. '
f'For example, a project with 4 construction years '
f'where bond financing starts on the third '
f'{model.surfaceplant.construction_years.Name[:-1].lower()} '
f'would have a {bond_financing_start_year_name} value of -1; construction starts in Year -3, '
f'the second year is Year -2, and the final 2 bond-financed construction years are Year -1 '
f'and Year 0. '
f'Bond financing will start on the first construction year if the specified year index is '
f'prior to the first construction year.'
)

self.contingency_percentage = self.ParameterDict[self.contingency_percentage.Name] = floatParameter(
'Contingency Percentage',
DefaultValue=15.,
Expand Down Expand Up @@ -2160,22 +2223,26 @@ def __init__(self, model: Model):
PreferredUnits=PercentUnit.PERCENT,
CurrentUnits=PercentUnit.PERCENT
)

self.overnight_capital_cost = self.OutputParameterDict[
self.overnight_capital_cost.Name] = overnight_capital_cost_output_parameter()

self.accrued_financing_during_construction_percentage = self.OutputParameterDict[
self.accrued_financing_during_construction_percentage.Name] = OutputParameter(
Name='Accrued financing during construction',
UnitType=Units.PERCENT,
PreferredUnits=PercentUnit.PERCENT,
CurrentUnits=PercentUnit.PERCENT,
ToolTipText='The accrued inflation on total capital costs over the construction period, '
f'as defined by {self.inflrateconstruction.Name}. '
'For SAM Economic Models, this is calculated automatically by compounding '
f'{self.RINFL.Name} over Construction Years '
f'if {self.inflrateconstruction.Name} is not provided.'
f'as defined by {self.inflrateconstruction.Name}.'
)

self.inflation_cost_during_construction = self.OutputParameterDict[
self.inflation_cost_during_construction.Name] = inflation_cost_during_construction_output_parameter()

self.interest_during_construction = self.OutputParameterDict[
self.interest_during_construction.Name] = interest_during_construction_output_parameter()

self.after_tax_irr = self.OutputParameterDict[self.after_tax_irr.Name] = (
after_tax_irr_parameter())
self.real_discount_rate = self.OutputParameterDict[self.real_discount_rate.Name] = (
Expand Down Expand Up @@ -2551,10 +2618,16 @@ def _warn(_msg: str) -> None:
if self.econmodel.value == EconomicModel.SAM_SINGLE_OWNER_PPA:
EconomicsSam.validate_read_parameters(model)
else:
if self.royalty_rate.Provided:
raise NotImplementedError('Royalties are only supported for SAM Economic Models')
sam_em_only_params: list[Parameter] = [
self.royalty_rate,
# TODO other royalty params
self.construction_capex_schedule,
self.bond_financing_start_year
]
for sam_em_only_param in sam_em_only_params:
if sam_em_only_param.Provided:
raise NotImplementedError(f'{sam_em_only_param.Name} is only supported for SAM Economic Models')

# TODO validate that other SAM-EM-only parameters have not been provided
else:
model.logger.info("No parameters read because no content provided")

Expand Down Expand Up @@ -3436,7 +3509,7 @@ def calculate_cashflow(self, model: Model) -> None:

def _calculate_sam_economics(self, model: Model) -> None:
non_calculated_output_placeholder_val = -1
self.sam_economics_calculations = calculate_sam_economics(model)
self.sam_economics_calculations: SamEconomicsCalculations = calculate_sam_economics(model)

# Setting capex_total distinguishes capex from CCap's display name of 'Total capital costs',
# since SAM Economic Model doesn't subtract ITC from this value.
Expand All @@ -3445,6 +3518,14 @@ def _calculate_sam_economics(self, model: Model) -> None:
self.CCap.value = (self.sam_economics_calculations.capex.quantity()
.to(self.CCap.CurrentUnits.value).magnitude)

self.overnight_capital_cost.value = (self.sam_economics_calculations.overnight_capital_cost.quantity()
.to(self.overnight_capital_cost.CurrentUnits.value).magnitude)

self.interest_during_construction.value = quantity(
self.sam_economics_calculations.pre_revenue_costs_and_cash_flow.interest_during_construction_usd,
'USD'
).to(self.interest_during_construction.CurrentUnits.value).magnitude


if self.royalty_rate.Provided:
# ignore pre-revenue year(s) (e.g. Year 0)
Expand Down
Loading