Skip to content

Commit c976107

Browse files
Merge pull request NREL#303 from softwareengineerprogrammer/main
Disable Forex API; Set FIR=DR in relevant examples
2 parents beb8738 + eccce2f commit c976107

17 files changed

+59
-35
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.1
2+
current_version = 3.6.2
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.1
57+
version: 3.6.2
5858
version_manager: "bump2version"
5959
website: "https://github.com/NREL"
6060
year_from: "2023"

README.rst

Lines changed: 10 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.1.svg
54+
.. |commits-since| image:: https://img.shields.io/github/commits-since/softwareengineerprogrammer/GEOPHIRES-X/v3.6.2.svg
5555
:alt: Commits since latest release
56-
:target: https://github.com/softwareengineerprogrammer/GEOPHIRES-X/compare/v3.6.1...main
56+
:target: https://github.com/softwareengineerprogrammer/GEOPHIRES-X/compare/v3.6.2...main
5757

5858
.. |docs| image:: https://readthedocs.org/projects/GEOPHIRES-X/badge/?style=flat
5959
:target: https://nrel.github.io/GEOPHIRES-X
@@ -357,6 +357,14 @@ Example-specific web interface deeplinks are listed in the Link column.
357357
- `Fervo_Project_Cape.txt <tests/examples/Fervo_Project_Cape.txt>`__
358358
- `.out <tests/examples/Fervo_Project_Cape.out>`__
359359
- `link <https://gtp.scientificwebservices.com/geophires?geophires-example-id=Fervo_Project_Cape>`__
360+
* - Fervo Project Cape 2
361+
- `Fervo_Project_Cape-2.txt <tests/examples/Fervo_Project_Cape-2.txt>`__
362+
- `.out <tests/examples/Fervo_Project_Cape-2.out>`__
363+
- `link <https://gtp.scientificwebservices.com/geophires?geophires-example-id=Fervo_Project_Cape-2>`__
364+
* - Fervo Project Cape 3
365+
- `Fervo_Project_Cape-3.txt <tests/examples/Fervo_Project_Cape-3.txt>`__
366+
- `.out <tests/examples/Fervo_Project_Cape-3.out>`__
367+
- `link <https://gtp.scientificwebservices.com/geophires?geophires-example-id=Fervo_Project_Cape-3>`__
360368
* - Superhot Rock (SHR) Example 1
361369
- `example_SHR-1.txt <tests/examples/example_SHR-1.txt>`__
362370
- `.out <tests/examples/example_SHR-1.out>`__

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.1'
21+
version = release = '3.6.2'
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.1',
16+
version='3.6.2',
1717
license='MIT',
1818
description='GEOPHIRES is a free and open-source geothermal techno-economic simulator.',
1919
long_description='{}\n{}'.format(

src/geophires_x/Parameter.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from geophires_x.Units import *
2020

2121
_ureg = get_unit_registry()
22+
_DISABLE_FOREX_API = True # See https://github.com/NREL/GEOPHIRES-X/issues/236#issuecomment-2414681434
2223

2324
class HasQuantity(ABC):
2425

@@ -500,15 +501,19 @@ def ConvertUnits(ParamToModify, strUnit: str, model) -> str:
500501

501502
try:
502503
# if we come here, we have a currency conversion to do (USD->EUR, etc.).
504+
505+
if _DISABLE_FOREX_API:
506+
raise RuntimeError('Forex API disabled')
507+
503508
cr = CurrencyRates()
504509
conv_rate = cr.get_rate(currShort, prefShort)
505510
except BaseException as ex:
506511
print(str(ex))
507512
msg = (
508-
f'Error: GEOPHIRES failed to convert your currency for {ParamToModify.Name} to something it '
509-
f'understands. You gave {strUnit} - Are these currency units defined for forex-python? or perhaps the '
510-
f'currency server is down? Please change your units to {ParamToModify.PreferredUnits.value} to '
511-
f'continue. Cannot continue unless you do. Exiting.'
513+
f'Error: GEOPHIRES failed to convert your currency for {ParamToModify.Name} to something it understands. '
514+
f'You gave {strUnit} - conversion may be affected by https://github.com/NREL/GEOPHIRES-X/issues/236. '
515+
f'Please change your units to {ParamToModify.PreferredUnits.value} '
516+
f'to continue. Cannot continue unless you do. Exiting.'
512517
)
513518
print(msg)
514519
model.logger.critical(str(ex))
@@ -710,6 +715,9 @@ def _parameter_with_currency_units_converted_back_to_preferred_units(param: Para
710715
# start the currency conversion process
711716
cc = CurrencyCodes()
712717
try:
718+
if _DISABLE_FOREX_API:
719+
raise RuntimeError('Forex API disabled')
720+
713721
cr = CurrencyRates()
714722
conv_rate = cr.get_rate(currType, prefType)
715723
except BaseException as ex:
@@ -966,6 +974,9 @@ def ConvertOutputUnits(oparam: OutputParameter, newUnit: Units, model):
966974

967975
raise RuntimeError(msg)
968976
try:
977+
if _DISABLE_FOREX_API:
978+
raise RuntimeError('Forex API disabled')
979+
969980
cr = CurrencyRates()
970981
conv_rate = cr.get_rate(prefShort, currShort)
971982
except BaseException as ex:

src/geophires_x/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '3.6.1'
1+
__version__ = '3.6.2'

tests/examples/example10_HP.out

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
Simulation Metadata
66
----------------------
7-
GEOPHIRES Version: 3.6.0
7+
GEOPHIRES Version: 3.6.2
88
Simulation Date: 2024-10-15
9-
Simulation Time: 13:08
10-
Calculation Time: 0.104 sec
9+
Simulation Time: 15:20
10+
Calculation Time: 0.100 sec
1111

1212
***SUMMARY OF RESULTS***
1313

@@ -29,9 +29,9 @@ Simulation Metadata
2929
Accrued financing during construction: 5.00
3030
Project lifetime: 30 yr
3131
Capacity factor: 90.0 %
32-
Project NPV: 3.32 MUSD
32+
Project NPV: 11.28 MUSD
3333
Project IRR: 8.07 %
34-
Project VIR=PI=PIR: 1.11
34+
Project VIR=PI=PIR: 1.36
3535
Project MOIC: 1.01
3636
Project Payback Period: 11.96 yr
3737

tests/examples/example10_HP.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ Heat Pump COP, 2.8, --- [-]
5151
Plant Lifetime,30, ---[years]
5252
Economic Model,2, ---BICYCLE Levelized Cost Model
5353
Discount Rate, 0.05, --- [-] Required if Standard LCOE/LCOH model is selected. See manual for details.
54+
Fixed Internal Rate, 5, -- matches Discount Rate
5455
Inflation Rate During Construction,0.05, ---[-]
5556

5657
# ***Capital and O&M Cost Parameters***

tests/examples/example11_AC.out

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
Simulation Metadata
66
----------------------
7-
GEOPHIRES Version: 3.6.0
7+
GEOPHIRES Version: 3.6.2
88
Simulation Date: 2024-10-15
9-
Simulation Time: 13:07
10-
Calculation Time: 0.104 sec
9+
Simulation Time: 15:20
10+
Calculation Time: 0.099 sec
1111

1212
***SUMMARY OF RESULTS***
1313

@@ -30,9 +30,9 @@ Simulation Metadata
3030
Accrued financing during construction: 5.00
3131
Project lifetime: 30 yr
3232
Capacity factor: 90.0 %
33-
Project NPV: -0.53 MUSD
33+
Project NPV: 6.22 MUSD
3434
Project IRR: 6.82 %
35-
Project VIR=PI=PIR: 0.98
35+
Project VIR=PI=PIR: 1.21
3636
Project MOIC: 0.83
3737
Project Payback Period: 13.36 yr
3838

0 commit comments

Comments
 (0)