Skip to content

Commit beb8738

Browse files
Merge pull request NREL#302 from softwareengineerprogrammer/main
Set fixed internal rate default value to same as discount rate
2 parents cb3b9f5 + 0338348 commit beb8738

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+310
-297
lines changed

.bumpversion.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 3.6.0
2+
current_version = 3.6.1
33
commit = True
44
tag = True
55

.cookiecutterrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ default_context:
5454
sphinx_doctest: "no"
5555
sphinx_theme: "sphinx-py3doc-enhanced-theme"
5656
test_matrix_separate_coverage: "no"
57-
version: 3.6.0
57+
version: 3.6.1
5858
version_manager: "bump2version"
5959
website: "https://github.com/NREL"
6060
year_from: "2023"

CHANGELOG.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ This affects:
2121
Affected users who do not want the new behavior can specify absolute output paths instead of relative ones e.g. ``python ./geophires-x/GEOPHIRESv3.py my-input.txt /home/user/my-geophires-project/geophires-x/HDR.out``
2222
(Most users are expected to be unaffected.)
2323

24+
3.6.1: Fixed Internal Rate default value changed to 7% from 6.25% per https://github.com/NREL/GEOPHIRES-X/issues/301
25+
2426
3.5
2527
^^^
2628

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ Free software: `MIT license <LICENSE>`__
5151
:alt: Supported implementations
5252
:target: https://pypi.org/project/geophires-x
5353

54-
.. |commits-since| image:: https://img.shields.io/github/commits-since/softwareengineerprogrammer/GEOPHIRES-X/v3.6.0.svg
54+
.. |commits-since| image:: https://img.shields.io/github/commits-since/softwareengineerprogrammer/GEOPHIRES-X/v3.6.1.svg
5555
:alt: Commits since latest release
56-
:target: https://github.com/softwareengineerprogrammer/GEOPHIRES-X/compare/v3.6.0...main
56+
:target: https://github.com/softwareengineerprogrammer/GEOPHIRES-X/compare/v3.6.1...main
5757

5858
.. |docs| image:: https://readthedocs.org/projects/GEOPHIRES-X/badge/?style=flat
5959
:target: https://nrel.github.io/GEOPHIRES-X

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
year = '2024'
1919
author = 'NREL'
2020
copyright = f'{year}, {author}'
21-
version = release = '3.6.0'
21+
version = release = '3.6.1'
2222

2323
pygments_style = 'trac'
2424
templates_path = ['./templates']

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def read(*names, **kwargs):
1313

1414
setup(
1515
name='geophires-x',
16-
version='3.6.0',
16+
version='3.6.1',
1717
license='MIT',
1818
description='GEOPHIRES is a free and open-source geothermal techno-economic simulator.',
1919
long_description='{}\n{}'.format(

src/geophires_x/AGSEconomics.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ def read_parameters(self, model: Model) -> None:
110110
# including the ones that are specific to this class
111111

112112
# inputs we already have - needs to be set at ReadParameter time so values set at the latest possible time
113-
self.Discount_rate = model.economics.discountrate.value # same units are GEOPHIRES
114-
self.Electricity_rate = model.surfaceplant.electricity_cost_to_buy.value # same units are GEOPHIRES
113+
self.Discount_rate = model.economics.discountrate.value # same units as GEOPHIRES
114+
self.Electricity_rate = model.surfaceplant.electricity_cost_to_buy.value # same units as GEOPHIRES
115115

116116
model.logger.info(f'complete {__class__!s}: {sys._getframe().f_code.co_name}')
117117

src/geophires_x/AGSOutputs.py

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@
55

66
import geophires_x
77

8-
from .Parameter import ConvertUnitsBack, ConvertOutputUnits
9-
from .OptionList import EndUseOptions, EconomicModel
10-
from .Units import *
8+
from geophires_x.OptionList import EndUseOptions, EconomicModel
9+
1110
import geophires_x.Model as Model
1211
import geophires_x.Outputs as Outputs
1312
import numpy as np
1413

14+
from geophires_x.Units import TemperatureUnit
15+
1516
NL = "\n"
1617

1718

@@ -28,27 +29,8 @@ def PrintOutputs(self, model: Model):
2829
:return: None
2930
"""
3031
model.logger.info(f'Init {str(__class__)}: {sys._getframe().f_code.co_name}')
31-
# Deal with converting Units back to PreferredUnits, if required.
32-
# before we write the outputs, we go thru all the parameters for all of the objects and set the values
33-
# back to the units that the user entered the data in
34-
# We do this because the value may be displayed in the output, and we want the user to recognize their value,
35-
# not some converted value
36-
for obj in [model.reserv, model.wellbores, model.surfaceplant, model.economics]:
37-
for key in obj.ParameterDict:
38-
param = obj.ParameterDict[key]
39-
if not param.UnitsMatch:
40-
ConvertUnitsBack(param, model)
41-
42-
# now we need to loop thru all the output parameters to update their units to whatever units the user has specified.
43-
# i.e., they may have specified that all LENGTH results must be in feet, so we need to convert
44-
# those from whatever LENGTH unit they are to feet.
45-
# same for all the other classes of units (TEMPERATURE, DENSITY, etc).
46-
47-
for obj in [model.reserv, model.wellbores, model.surfaceplant, model.economics]:
48-
for key in obj.OutputParameterDict:
49-
if key in self.ParameterDict:
50-
if self.ParameterDict[key] != obj.OutputParameterDict[key].CurrentUnits:
51-
ConvertOutputUnits(obj.OutputParameterDict[key], self.ParameterDict[key], model)
32+
33+
self._convert_units(model)
5234

5335
# ---------------------------------------
5436
# write results to output file and screen

src/geophires_x/Economics.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -837,15 +837,17 @@ def __init__(self, model: Model):
837837
ErrMessage="assume default fixed charge rate (0.1)",
838838
ToolTipText="Fixed charge rate (FCR) used in the Fixed Charge Rate Model"
839839
)
840+
841+
discount_rate_default_val = 0.07
840842
self.discountrate = self.ParameterDict[self.discountrate.Name] = floatParameter(
841843
"Discount Rate",
842-
DefaultValue=0.07,
844+
DefaultValue=discount_rate_default_val,
843845
Min=0.0,
844846
Max=1.0,
845847
UnitType=Units.PERCENT,
846-
PreferredUnits=PercentUnit.TENTH,
848+
PreferredUnits=PercentUnit.PERCENT,
847849
CurrentUnits=PercentUnit.TENTH,
848-
ErrMessage="assume default discount rate (0.07)",
850+
ErrMessage=f'assume default discount rate ({discount_rate_default_val})',
849851
ToolTipText="Discount rate used in the Standard Levelized Cost Model"
850852
)
851853
self.FIB = self.ParameterDict[self.FIB.Name] = floatParameter(
@@ -1379,15 +1381,18 @@ def __init__(self, model: Model):
13791381
PreferredUnits=CurrencyUnit.MDOLLARS,
13801382
CurrentUnits=CurrencyUnit.MDOLLARS
13811383
)
1384+
1385+
fir_default_unit = PercentUnit.PERCENT
1386+
fir_default_val = self.discountrate.quantity().to(convertible_unit(fir_default_unit)).magnitude
13821387
self.FixedInternalRate = self.ParameterDict[self.FixedInternalRate.Name] = floatParameter(
13831388
"Fixed Internal Rate",
1384-
DefaultValue=6.25,
1389+
DefaultValue=fir_default_val,
13851390
Min=0.0,
13861391
Max=100.0,
13871392
UnitType=Units.PERCENT,
13881393
PreferredUnits=PercentUnit.PERCENT,
1389-
CurrentUnits=PercentUnit.PERCENT,
1390-
ErrMessage="assume default for fixed internal rate (6.25%)",
1394+
CurrentUnits=fir_default_unit,
1395+
ErrMessage=f'assume default for fixed internal rate ({fir_default_val}%)',
13911396
ToolTipText="Fixed Internal Rate (used in NPV calculation)"
13921397
)
13931398
self.CAPEX_heat_electricity_plant_ratio = self.ParameterDict[self.CAPEX_heat_electricity_plant_ratio.Name] = floatParameter(
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
USD = [currency]
22
cents = USD / 100
3+
KUSD = USD * 1000
4+
MMBTU = BTU * 1_000_000

0 commit comments

Comments
 (0)