Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
Binary file modified src/geophires_sam_economics/Generic_400_MWe.sam
Binary file not shown.
20 changes: 16 additions & 4 deletions src/geophires_x/Economics.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from geophires_x import EconomicsSam
from geophires_x.EconomicsSam import calculate_sam_economics, SamEconomicsCalculations
from geophires_x.EconomicsUtils import BuildPricingModel, wacc_output_parameter, nominal_discount_rate_parameter, \
real_discount_rate_parameter
real_discount_rate_parameter, after_tax_irr_parameter
from geophires_x.OptionList import Configuration, WellDrillingCostCorrelation, EconomicModel, EndUseOptions, PlantType, \
_WellDrillingCostCorrelationCitation
from geophires_x.Parameter import intParameter, floatParameter, OutputParameter, ReadParameter, boolParameter, \
Expand Down Expand Up @@ -884,7 +884,7 @@ def __init__(self, model: Model):
PreferredUnits=PercentUnit.TENTH,
CurrentUnits=PercentUnit.TENTH,
ErrMessage="assume default fraction of investment in bonds (0.5)",
ToolTipText="Fraction of geothermal project financing through bonds (see docs)"
ToolTipText="Fraction of geothermal project financing through bonds (debt)."
)
self.BIR = self.ParameterDict[self.BIR.Name] = floatParameter(
"Inflated Bond Interest Rate",
Expand Down Expand Up @@ -1581,12 +1581,19 @@ def __init__(self, model: Model):
PreferredUnits=CurrencyUnit.MDOLLARS,
CurrentUnits=CurrencyUnit.MDOLLARS
)

# See TODO re:parameterizing indirect costs at src/geophires_x/Economics.py:652
# (https://github.com/NREL/GEOPHIRES-X/issues/383)
self.Cexpl = self.OutputParameterDict[self.Cexpl.Name] = OutputParameter(
Name="Exploration cost",
display_name='Exploration costs',
UnitType=Units.CURRENCY,
PreferredUnits=CurrencyUnit.MDOLLARS,
CurrentUnits=CurrencyUnit.MDOLLARS
CurrentUnits=CurrencyUnit.MDOLLARS,
ToolTipText=f'Default correlation: 60% of the cost of one production well plus 15% contingency '
f'plus 12% indirect costs. '
f'Provide {self.ccexpladjfactor.Name} to multiply the default correlation. '
f'Provide {self.ccexplfixed.Name} to override the default correlation and set your own cost.'
)

self.Cwell = self.OutputParameterDict[self.Cwell.Name] = OutputParameter(
Expand All @@ -1597,6 +1604,7 @@ def __init__(self, model: Model):
CurrentUnits=CurrencyUnit.MDOLLARS,

# See TODO re:parameterizing indirect costs at src/geophires_x/Economics.py:652
# (https://github.com/NREL/GEOPHIRES-X/issues/383)
ToolTipText="Includes total drilling and completion cost of all injection and production wells and "
"laterals, plus 5% indirect costs."
)
Expand Down Expand Up @@ -1776,6 +1784,8 @@ def __init__(self, model: Model):
CurrentUnits=PercentUnit.PERCENT
)

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] = (
real_discount_rate_parameter())
self.nominal_discount_rate = self.OutputParameterDict[self.nominal_discount_rate.Name] = (
Expand Down Expand Up @@ -2767,7 +2777,9 @@ def Calculate(self, model: Model) -> None:
self.nominal_discount_rate.value = self.sam_economics_calculations.nominal_discount_rate.value
self.ProjectNPV.value = self.sam_economics_calculations.project_npv.quantity().to(
convertible_unit(self.ProjectNPV.CurrentUnits)).magnitude
self.ProjectIRR.value = self.sam_economics_calculations.project_irr.quantity().to(

self.ProjectIRR.value = non_calculated_output_placeholder_val # SAM calculates After-Tax IRR instead
self.after_tax_irr.value = self.sam_economics_calculations.after_tax_irr.quantity().to(
convertible_unit(self.ProjectIRR.CurrentUnits)).magnitude

self.ProjectVIR.value = non_calculated_output_placeholder_val # TODO SAM VIR
Expand Down
19 changes: 11 additions & 8 deletions src/geophires_x/EconomicsSam.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@

from geophires_x import Model as Model
from geophires_x.EconomicsSamCashFlow import _calculate_sam_economics_cash_flow
from geophires_x.EconomicsUtils import BuildPricingModel, wacc_output_parameter, nominal_discount_rate_parameter
from geophires_x.EconomicsUtils import (
BuildPricingModel,
wacc_output_parameter,
nominal_discount_rate_parameter,
after_tax_irr_parameter,
)
from geophires_x.GeoPHIRESUtils import is_float, is_int
from geophires_x.OptionList import EconomicModel, EndUseOptions
from geophires_x.Parameter import Parameter, OutputParameter, floatParameter
Expand All @@ -44,24 +49,22 @@ class SamEconomicsCalculations:
CurrentUnits=EnergyCostUnit.CENTSSPERKWH,
)
)

capex: OutputParameter = field(
default_factory=lambda: OutputParameter(
UnitType=Units.CURRENCY,
CurrentUnits=CurrencyUnit.MDOLLARS,
)
)

project_npv: OutputParameter = field(
default_factory=lambda: OutputParameter(
UnitType=Units.CURRENCY,
CurrentUnits=CurrencyUnit.MDOLLARS,
)
)
project_irr: OutputParameter = field(
default_factory=lambda: OutputParameter(
UnitType=Units.PERCENT,
CurrentUnits=PercentUnit.PERCENT,
)
)

after_tax_irr: OutputParameter = field(default_factory=after_tax_irr_parameter)

nominal_discount_rate: OutputParameter = field(default_factory=nominal_discount_rate_parameter)

Expand Down Expand Up @@ -157,7 +160,7 @@ def sf(_v: float) -> float:

sam_economics: SamEconomicsCalculations = SamEconomicsCalculations(sam_cash_flow_profile=cash_flow)
sam_economics.lcoe_nominal.value = sf(single_owner.Outputs.lcoe_nom)
sam_economics.project_irr.value = sf(single_owner.Outputs.project_return_aftertax_irr)
sam_economics.after_tax_irr.value = sf(single_owner.Outputs.project_return_aftertax_irr)
sam_economics.project_npv.value = sf(single_owner.Outputs.project_return_aftertax_npv * 1e-6)
sam_economics.capex.value = single_owner.Outputs.adjusted_installed_cost * 1e-6

Expand Down
42 changes: 27 additions & 15 deletions src/geophires_x/EconomicsUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,27 +37,39 @@ def BuildPricingModel(plantlifetime: int, StartPrice: float, EndPrice: float,
return Price


def after_tax_irr_parameter() -> OutputParameter:
return OutputParameter(
Name='After-Tax IRR',
UnitType=Units.PERCENT,
CurrentUnits=PercentUnit.PERCENT,
PreferredUnits=PercentUnit.PERCENT,
ToolTipText='The After-Tax IRR (internal rate of return) is the nominal discount rate that corresponds to '
'a net present value (NPV) of zero for PPA SAM Economic models. '
'See https://samrepo.nrelcloud.org/help/mtf_irr.html.'
)


def real_discount_rate_parameter() -> OutputParameter:
return OutputParameter(
Name="Real Discount Rate",
UnitType=Units.PERCENT,
CurrentUnits=PercentUnit.PERCENT,
PreferredUnits=PercentUnit.PERCENT,
)
Name="Real Discount Rate",
UnitType=Units.PERCENT,
CurrentUnits=PercentUnit.PERCENT,
PreferredUnits=PercentUnit.PERCENT,
)


def nominal_discount_rate_parameter() -> OutputParameter:
return OutputParameter(
Name="Nominal Discount Rate",
ToolTipText="Nominal Discount Rate is displayed for SAM Economic Models. "
"It is calculated "
"per https://samrepo.nrelcloud.org/help/fin_single_owner.html?q=nominal+discount+rate: "
"Nominal Discount Rate = [ ( 1 + Real Discount Rate ÷ 100 ) "
"× ( 1 + Inflation Rate ÷ 100 ) - 1 ] × 100.",
UnitType=Units.PERCENT,
CurrentUnits=PercentUnit.PERCENT,
PreferredUnits=PercentUnit.PERCENT,
)
Name="Nominal Discount Rate",
ToolTipText="Nominal Discount Rate is displayed for SAM Economic Models. "
"It is calculated "
"per https://samrepo.nrelcloud.org/help/fin_single_owner.html?q=nominal+discount+rate: "
"Nominal Discount Rate = [ ( 1 + Real Discount Rate ÷ 100 ) "
"× ( 1 + Inflation Rate ÷ 100 ) - 1 ] × 100.",
UnitType=Units.PERCENT,
CurrentUnits=PercentUnit.PERCENT,
PreferredUnits=PercentUnit.PERCENT,
)


def wacc_output_parameter() -> OutputParameter:
Expand Down
8 changes: 7 additions & 1 deletion src/geophires_x/Outputs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import datetime
import math
import time
import sys
from pathlib import Path
Expand Down Expand Up @@ -274,7 +275,12 @@ def PrintOutputs(self, model: Model):
# TODO should use CurrentUnits instead of PreferredUnits
f.write(f' {npv_field_label}{e_npv.value:10.2f} {e_npv.PreferredUnits.value}\n')

f.write(f' {econ.ProjectIRR.display_name}: {econ.ProjectIRR.value:10.2f} {econ.ProjectIRR.PreferredUnits.value}\n')
irr_output_param: OutputParameter = econ.ProjectIRR \
if econ.econmodel.value != EconomicModel.SAM_SINGLE_OWNER_PPA else econ.after_tax_irr
irr_field_label = Outputs._field_label(irr_output_param.display_name, 49)
irr_display_value = f'{irr_output_param.value:10.2f}' \
if not math.isnan(irr_output_param.value) else 'NaN'
f.write(f' {irr_field_label}{irr_display_value} {irr_output_param.CurrentUnits.value}\n')

if econ.econmodel.value != EconomicModel.SAM_SINGLE_OWNER_PPA:
# VIR, MOIC, and Payback period not currently supported by SAM economic model(s)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@
"pbi_oth_escal" : 0,
"pbi_oth_tax_fed" : 1,
"pbi_oth_tax_sta" : 1,
"term_tenor" : 30,
"term_tenor" : 20,
"term_int_rate" : 5,
"dscr" : 1.05,
"dscr_limit_debt_fraction" : 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@
"pbi_oth_escal" : 0,
"pbi_oth_tax_fed" : 1,
"pbi_oth_tax_sta" : 1,
"term_tenor" : 30,
"term_tenor" : 20,
"term_int_rate" : 5,
"dscr" : 1.05,
"dscr_limit_debt_fraction" : 0,
Expand Down
4 changes: 2 additions & 2 deletions src/geophires_x_client/geophires_x_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -862,8 +862,8 @@ def _parse_number(self, number_str, field='string') -> int | float:
return None

try:
number_str = number_str.replace(',', '')
if '.' in number_str:
number_str = number_str.replace(',', '').lower()
if '.' in number_str or number_str == 'nan':
# TODO should probably ideally use decimal.Decimal to preserve precision,
# i.e. 1.00 for USD instead of 1.0
return float(number_str)
Expand Down
2 changes: 1 addition & 1 deletion src/geophires_x_schema_generator/geophires-request.json
Original file line number Diff line number Diff line change
Expand Up @@ -1595,7 +1595,7 @@
"maximum": null
},
"Fraction of Investment in Bonds": {
"description": "Fraction of geothermal project financing through bonds (see docs)",
"description": "Fraction of geothermal project financing through bonds (debt).",
"type": "number",
"units": "",
"category": "Economics",
Expand Down
2 changes: 1 addition & 1 deletion src/geophires_x_schema_generator/geophires-result.json
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@
"Total surface equipment costs": {},
"Exploration costs": {
"type": "number",
"description": "Exploration cost",
"description": "Exploration cost. Default correlation: 60% of the cost of one production well plus 15% contingency plus 12% indirect costs. Provide Exploration Capital Cost Adjustment Factor to multiply the default correlation. Provide Exploration Capital Cost to override the default correlation and set your own cost.",
"units": "MUSD"
},
"Investment Tax Credit": {
Expand Down
Loading