Skip to content

Commit ee9ca4d

Browse files
Display Real Discount Rate instead of Interest Rate for SAM Economic Models
1 parent 05a768b commit ee9ca4d

File tree

6 files changed

+44
-32
lines changed

6 files changed

+44
-32
lines changed

src/geophires_x/Economics.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
import geophires_x.Model as Model
66
from geophires_x import EconomicsSam
77
from geophires_x.EconomicsSam import calculate_sam_economics, SamEconomicsCalculations
8-
from geophires_x.EconomicsUtils import BuildPricingModel, wacc_output_parameter, nominal_discount_rate_parameter
8+
from geophires_x.EconomicsUtils import BuildPricingModel, wacc_output_parameter, nominal_discount_rate_parameter, \
9+
real_discount_rate_parameter
910
from geophires_x.OptionList import Configuration, WellDrillingCostCorrelation, EconomicModel, EndUseOptions, PlantType, \
1011
_WellDrillingCostCorrelationCitation
1112
from geophires_x.Parameter import intParameter, floatParameter, OutputParameter, ReadParameter, boolParameter, \
@@ -1775,9 +1776,10 @@ def __init__(self, model: Model):
17751776
CurrentUnits=PercentUnit.PERCENT
17761777
)
17771778

1779+
self.real_discount_rate = self.OutputParameterDict[self.real_discount_rate.Name] = (
1780+
real_discount_rate_parameter())
17781781
self.nominal_discount_rate = self.OutputParameterDict[self.nominal_discount_rate.Name] = (
17791782
nominal_discount_rate_parameter())
1780-
17811783
self.wacc = self.OutputParameterDict[self.wacc.Name] = wacc_output_parameter()
17821784

17831785
# TODO this is displayed as "Project Net Revenue" in Revenue & Cashflow Profile which is probably not an
@@ -2907,5 +2909,8 @@ def _calculate_derived_outputs(self, model: Model) -> None:
29072909
/ model.wellbores.numnonverticalsections.value
29082910
)
29092911

2912+
self.real_discount_rate.value = self.discountrate.quantity().to(convertible_unit(
2913+
self.real_discount_rate.CurrentUnits)).magnitude
2914+
29102915
def __str__(self):
29112916
return "Economics"

src/geophires_x/EconomicsUtils.py

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,28 @@ def BuildPricingModel(plantlifetime: int, StartPrice: float, EndPrice: float,
3737
return Price
3838

3939

40+
def real_discount_rate_parameter() -> OutputParameter:
41+
return OutputParameter(
42+
Name="Real Discount Rate",
43+
UnitType=Units.PERCENT,
44+
CurrentUnits=PercentUnit.PERCENT,
45+
PreferredUnits=PercentUnit.PERCENT,
46+
)
47+
48+
49+
def nominal_discount_rate_parameter() -> OutputParameter:
50+
return OutputParameter(
51+
Name="Nominal Discount Rate",
52+
ToolTipText="Nominal Discount Rate is displayed for SAM Economic Models. "
53+
"It is calculated according to the following formula, defined in SAM Help documentation: "
54+
"Nominal Discount Rate = [ ( 1 + Real Discount Rate ÷ 100 ) "
55+
"× ( 1 + Inflation Rate ÷ 100 ) - 1 ] × 100.",
56+
UnitType=Units.PERCENT,
57+
CurrentUnits=PercentUnit.PERCENT,
58+
PreferredUnits=PercentUnit.PERCENT,
59+
)
60+
61+
4062
def wacc_output_parameter() -> OutputParameter:
4163
return OutputParameter(
4264
Name='WACC',
@@ -52,16 +74,3 @@ def wacc_output_parameter() -> OutputParameter:
5274
CurrentUnits=PercentUnit.PERCENT,
5375
PreferredUnits=PercentUnit.PERCENT,
5476
)
55-
56-
57-
def nominal_discount_rate_parameter() -> OutputParameter:
58-
return OutputParameter(
59-
Name="Nominal Discount Rate",
60-
ToolTipText="Nominal Discount Rate is displayed for SAM Economic Models. "
61-
"It is calculated according to the following formula, defined in SAM Help documentation: "
62-
"Nominal Discount Rate = [ ( 1 + Real Discount Rate ÷ 100 ) "
63-
"× ( 1 + Inflation Rate ÷ 100 ) - 1 ] × 100.",
64-
UnitType=Units.PERCENT,
65-
CurrentUnits=PercentUnit.PERCENT,
66-
PreferredUnits=PercentUnit.PERCENT,
67-
)

src/geophires_x/Outputs.py

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -246,32 +246,24 @@ def PrintOutputs(self, model: Model):
246246
f.write(f' Fixed Charge Rate (FCR): {model.economics.FCR.value*100.0:10.2f} {model.economics.FCR.CurrentUnits.value}\n')
247247
elif model.economics.econmodel.value == EconomicModel.STANDARDIZED_LEVELIZED_COST:
248248
f.write(f' Economic Model = {model.economics.econmodel.value.value}\n')
249+
# TODO disambiguate interest rate for all economic models - see
250+
# https://github.com/softwareengineerprogrammer/GEOPHIRES/commit/535c02d4adbeeeca553b61e9b996fccf00016529
249251
f.write(f' {model.economics.interest_rate.Name}: {model.economics.interest_rate.value:10.2f} {model.economics.interest_rate.CurrentUnits.value}\n')
250252

251253
elif model.economics.econmodel.value in (EconomicModel.BICYCLE, EconomicModel.SAM_SINGLE_OWNER_PPA):
252254
f.write(f' Economic Model = {model.economics.econmodel.value.value}\n')
253255

254256
if model.economics.econmodel.value == EconomicModel.SAM_SINGLE_OWNER_PPA:
255-
fields : list[OutputParameter] = [
256-
# TODO disambiguate interest rate for all economic models - see
257-
# https://github.com/softwareengineerprogrammer/GEOPHIRES/commit/535c02d4adbeeeca553b61e9b996fccf00016529
258-
econ.interest_rate,
259-
257+
sam_econ_fields: list[OutputParameter] = [
258+
econ.real_discount_rate,
260259
econ.nominal_discount_rate,
261260
econ.wacc,
262261
]
263262

264-
for field in fields:
263+
for field in sam_econ_fields:
265264
label = Outputs._field_label(field.Name, 49)
266265
f.write(f' {label}{field.value:10.2f} {field.CurrentUnits.value}\n')
267266

268-
# ir_fl = Outputs._field_label(econ.interest_rate.Name, 49)
269-
# f.write(f' {ir_fl}{econ.interest_rate.value:10.2f} {econ.interest_rate.CurrentUnits.value}\n')
270-
#
271-
# wacc = econ.sam_economics_calculations.wacc
272-
# wacc_fl = Outputs._field_label(wacc.Name, 49)
273-
# f.write(f' {wacc_fl}{wacc.value:10.2f} {wacc.CurrentUnits.value}\n')
274-
275267
# FIXME TODO unit is missing https://github.com/NREL/GEOPHIRES-X/issues/382
276268
f.write(f' Accrued financing during construction: {model.economics.inflrateconstruction.value*100:10.2f} {model.economics.inflrateconstruction.CurrentUnits.value}\n')
277269

src/geophires_x_client/geophires_x_result.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ class GeophiresXResult:
6868
_EqualSignDelimitedField('Economic Model'),
6969
'Interest Rate', # %
7070
'WACC',
71+
'Real Discount Rate',
7172
'Nominal Discount Rate',
7273
'Accrued financing during construction',
7374
'Project lifetime',

src/geophires_x_schema_generator/geophires-result.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@
7979
"description": "Weighted Average Cost of Capital displayed for SAM Economic Models. It is calculated according to the following formula, defined in SAM Help documentation: WACC = [ Nominal Discount Rate \u00f7 100 \u00d7 (1 - Debt Percent \u00f7 100) + Debt Percent \u00f7 100 \u00d7 Loan Rate \u00f7 100 \u00d7 (1 - Effective Tax Rate \u00f7 100 ) ] \u00d7 100; Effective Tax Rate = [ Federal Tax Rate \u00f7 100 \u00d7 ( 1 - State Tax Rate \u00f7 100 ) + State Tax Rate \u00f7 100 ] \u00d7 100; Nominal Discount Rate = [ ( 1 + Real Discount Rate \u00f7 100 ) \u00d7 ( 1 + Inflation Rate \u00f7 100 ) - 1 ] \u00d7 100. ",
8080
"units": "%"
8181
},
82+
"Real Discount Rate": {
83+
"type": "number",
84+
"description": "",
85+
"units": "%"
86+
},
8287
"Nominal Discount Rate": {
8388
"type": "number",
8489
"description": "Nominal Discount Rate is displayed for SAM Economic Models. It is calculated according to the following formula, defined in SAM Help documentation: Nominal Discount Rate = [ ( 1 + Real Discount Rate \u00f7 100 ) \u00d7 ( 1 + Inflation Rate \u00f7 100 ) - 1 ] \u00d7 100.",

tests/examples/example_SAM-single-owner-PPA.out

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ Simulation Metadata
66
----------------------
77
GEOPHIRES Version: 3.9.6
88
Simulation Date: 2025-05-14
9-
Simulation Time: 11:19
10-
Calculation Time: 0.880 sec
9+
Simulation Time: 11:36
10+
Calculation Time: 0.888 sec
1111

1212
***SUMMARY OF RESULTS***
1313

@@ -24,9 +24,9 @@ Simulation Metadata
2424
***ECONOMIC PARAMETERS***
2525

2626
Economic Model = SAM Single Owner PPA
27-
Interest Rate: 7.00 %
28-
WACC: 6.41 %
27+
Real Discount Rate: 7.00 %
2928
Nominal Discount Rate: 9.14 %
29+
WACC: 6.41 %
3030
Accrued financing during construction: 5.00
3131
Project lifetime: 20 yr
3232
Capacity factor: 90.0 %

0 commit comments

Comments
 (0)