Skip to content

Commit a8940cb

Browse files
Merge pull request #87 from softwareengineerprogrammer/redrilling-costs-fixup
Redrilling costs fixup; Don't display incorrect SAM-EM ITC [v3.9.40]
2 parents 710cdd7 + 78711a3 commit a8940cb

17 files changed

+132
-43
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.9.36
2+
current_version = 3.9.40
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.9.36
57+
version: 3.9.40
5858
version_manager: "bump2version"
5959
website: "https://github.com/NREL"
6060
year_from: "2023"

README.rst

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

61-
.. |commits-since| image:: https://img.shields.io/github/commits-since/softwareengineerprogrammer/GEOPHIRES-X/v3.9.36.svg
61+
.. |commits-since| image:: https://img.shields.io/github/commits-since/softwareengineerprogrammer/GEOPHIRES-X/v3.9.40.svg
6262
:alt: Commits since latest release
63-
:target: https://github.com/softwareengineerprogrammer/GEOPHIRES-X/compare/v3.9.36...main
63+
:target: https://github.com/softwareengineerprogrammer/GEOPHIRES-X/compare/v3.9.40...main
6464

6565
.. |docs| image:: https://readthedocs.org/projects/GEOPHIRES-X/badge/?style=flat
6666
: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 = '2025'
1919
author = 'NREL'
2020
copyright = f'{year}, {author}'
21-
version = release = '3.9.36'
21+
version = release = '3.9.40'
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.9.36',
16+
version='3.9.40',
1717
license='MIT',
1818
description='GEOPHIRES is a free and open-source geothermal techno-economic simulator.',
1919
long_description='{}\n{}'.format(

src/geophires_x/Economics.py

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -868,7 +868,8 @@ def __init__(self, model: Model):
868868
"Total Capital Cost",
869869
DefaultValue=-1.0,
870870
Min=0,
871-
Max=1000,
871+
# pint treats GUSD as billions of dollars (G for giga)
872+
Max=quantity(100, 'GUSD').to('MUSD').magnitude,
872873
UnitType=Units.CURRENCY,
873874
PreferredUnits=CurrencyUnit.MDOLLARS,
874875
CurrentUnits=CurrencyUnit.MDOLLARS,
@@ -1775,6 +1776,18 @@ def __init__(self, model: Model):
17751776
UnitType=Units.CURRENCYFREQUENCY,
17761777
PreferredUnits=CurrencyFrequencyUnit.MDOLLARSPERYEAR,
17771778
CurrentUnits=CurrencyFrequencyUnit.MDOLLARSPERYEAR
1779+
# TODO TooltipText to document how this is calculated
1780+
)
1781+
self.redrilling_annual_cost = self.OutputParameterDict[self.redrilling_annual_cost.Name] = OutputParameter(
1782+
Name="Redrilling costs",
1783+
UnitType=Units.CURRENCYFREQUENCY,
1784+
PreferredUnits=CurrencyFrequencyUnit.MDOLLARSPERYEAR,
1785+
CurrentUnits=CurrencyFrequencyUnit.MDOLLARSPERYEAR,
1786+
ToolTipText=f'Total redrilling costs over the {model.surfaceplant.plant_lifetime.Name} are calculated as '
1787+
f'({self.Cwell.display_name} + {self.Cstim.display_name}) '
1788+
f'× {model.wellbores.redrill.display_name}. '
1789+
f'The total is then divided over {model.surfaceplant.plant_lifetime.Name} years to calculate '
1790+
f'Redrilling costs per year.'
17781791
)
17791792
self.Cplant = self.OutputParameterDict[self.Cplant.Name] = OutputParameter(
17801793
Name="Surface Plant cost",
@@ -1809,7 +1822,7 @@ def __init__(self, model: Model):
18091822
UnitType=Units.CURRENCYFREQUENCY,
18101823
PreferredUnits=CurrencyFrequencyUnit.MDOLLARSPERYEAR,
18111824
CurrentUnits=CurrencyFrequencyUnit.MDOLLARSPERYEAR,
1812-
ToolTipText='Assumes $3.5/1,000 gallons of water'
1825+
ToolTipText='Assumes $3.5/1,000 gallons of water' # TODO parameterize
18131826
)
18141827
self.CCap = self.OutputParameterDict[self.CCap.Name] = OutputParameter(
18151828
Name="Total Capital Cost",
@@ -2521,8 +2534,10 @@ def Calculate(self, model: Model) -> None:
25212534

25222535
if model.wellbores.redrill.value > 0:
25232536
# account for well redrilling
2524-
self.Coam.value = self.Coam.value + \
2525-
(self.Cwell.value + self.Cstim.value) * model.wellbores.redrill.value / model.surfaceplant.plant_lifetime.value
2537+
redrilling_costs: PlainQuantity = self.calculate_redrilling_costs(model)
2538+
self.redrilling_annual_cost.value = redrilling_costs.to(self.redrilling_annual_cost.CurrentUnits).magnitude
2539+
self.Coam.value += redrilling_costs.to(self.Coam.CurrentUnits).magnitude
2540+
25262541

25272542
# Add in the AnnualLicenseEtc and TaxRelief
25282543
self.Coam.value = self.Coam.value + self.AnnualLicenseEtc.value - self.TaxRelief.value
@@ -2751,6 +2766,11 @@ def calculate_stimulation_costs(self, model: Model) -> PlainQuantity:
27512766

27522767
return quantity(stimulation_costs, self.Cstim.CurrentUnits)
27532768

2769+
def calculate_redrilling_costs(self, model) -> PlainQuantity:
2770+
return ((self.Cwell.quantity() + self.Cstim.quantity())
2771+
* model.wellbores.redrill.quantity()
2772+
/ model.surfaceplant.plant_lifetime.quantity())
2773+
27542774
def calculate_field_gathering_costs(self, model: Model) -> None:
27552775
if self.ccgathfixed.Valid:
27562776
self.Cgath.value = self.ccgathfixed.value
@@ -3164,5 +3184,7 @@ def _calculate_derived_outputs(self, model: Model) -> None:
31643184
(model.wellbores.nprod.value + model.wellbores.ninj.value)
31653185
)
31663186

3187+
3188+
31673189
def __str__(self):
31683190
return "Economics"

src/geophires_x/Outputs.py

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ def PrintOutputs(self, model: Model):
325325
f.write(f' Flowrate per production well: {model.wellbores.prodwellflowrate.value:10.1f} ' + model.wellbores.prodwellflowrate.CurrentUnits.value + NL)
326326
f.write(f' Injection well casing ID: {model.wellbores.injwelldiam.value:10.3f} ' + model.wellbores.injwelldiam.CurrentUnits.value + NL)
327327
f.write(f' Production well casing ID: {model.wellbores.prodwelldiam.value:10.3f} ' + model.wellbores.prodwelldiam.CurrentUnits.value + NL)
328-
f.write(f' Number of times redrilling: {model.wellbores.redrill.value:10.0f}'+NL)
328+
f.write(f' {model.wellbores.redrill.display_name}: {model.wellbores.redrill.value:10.0f}\n')
329329
if model.surfaceplant.enduse_option.value in [EndUseOptions.ELECTRICITY, EndUseOptions.COGENERATION_TOPPING_EXTRA_HEAT, EndUseOptions.COGENERATION_TOPPING_EXTRA_ELECTRICITY, EndUseOptions.COGENERATION_BOTTOMING_EXTRA_ELECTRICITY, EndUseOptions.COGENERATION_BOTTOMING_EXTRA_HEAT, EndUseOptions.COGENERATION_PARALLEL_EXTRA_HEAT, EndUseOptions.COGENERATION_PARALLEL_EXTRA_ELECTRICITY]:
330330
f.write(' Power plant type: ' + str(model.surfaceplant.plant_type.value.value) + NL)
331331
f.write(NL)
@@ -475,12 +475,23 @@ def PrintOutputs(self, model: Model):
475475
f.write(f' District Heating System Cost: {model.economics.dhdistrictcost.value:10.2f} {model.economics.dhdistrictcost.CurrentUnits.value}\n')
476476
f.write(f' Total surface equipment costs: {(model.economics.Cplant.value+model.economics.Cgath.value):10.2f} ' + model.economics.Cplant.CurrentUnits.value + NL)
477477
f.write(f' {model.economics.Cexpl.display_name}: {model.economics.Cexpl.value:10.2f} {model.economics.Cexpl.CurrentUnits.value}\n')
478+
478479
if model.economics.totalcapcost.Valid and model.wellbores.redrill.value > 0:
479-
f.write(f' Drilling and completion costs (for redrilling):{model.economics.Cwell.value:10.2f} ' + model.economics.Cwell.CurrentUnits.value + NL)
480-
f.write(f' Drilling and completion costs per redrilled well: {(model.economics.Cwell.value/(model.wellbores.nprod.value+model.wellbores.ninj.value)):10.2f} ' + model.economics.Cwell.CurrentUnits.value + NL)
480+
f.write(f' Drilling and completion costs (for redrilling):{econ.Cwell.value:10.2f} {econ.Cwell.CurrentUnits.value}\n')
481+
f.write(f' Drilling and completion costs per redrilled well: {(econ.Cwell.value/(model.wellbores.nprod.value+model.wellbores.ninj.value)):10.2f} {econ.Cwell.CurrentUnits.value}\n')
481482
f.write(f' Stimulation costs (for redrilling): {econ.Cstim.value:10.2f} {econ.Cstim.CurrentUnits.value}\n')
483+
482484
if model.economics.RITCValue.value:
483-
f.write(f' {model.economics.RITCValue.display_name}: {-1*model.economics.RITCValue.value:10.2f} {model.economics.RITCValue.CurrentUnits.value}\n')
485+
if model.economics.econmodel.value != EconomicModel.SAM_SINGLE_OWNER_PPA:
486+
f.write(f' {model.economics.RITCValue.display_name}: {-1*model.economics.RITCValue.value:10.2f} {model.economics.RITCValue.CurrentUnits.value}\n')
487+
else:
488+
# TODO Extract value from SAM Cash Flow Profile per
489+
# https://github.com/NREL/GEOPHIRES-X/issues/404.
490+
# For now we skip displaying the value because it can be/probably is usually mathematically
491+
# inaccurate, and even if it's not, it's redundant with the cash flow profile and also
492+
# misleading/confusing/wrong to display it as a capital cost since it is not a capital
493+
# expenditure.
494+
pass
484495

485496
capex_label = Outputs._field_label(econ.CCap.display_name, 50)
486497
f.write(f' {capex_label}{econ.CCap.value:10.2f} {econ.CCap.CurrentUnits.value}\n')
@@ -506,6 +517,10 @@ def PrintOutputs(self, model: Model):
506517
f.write(f' Annual District Heating O&M Cost: {model.economics.dhdistrictoandmcost.value:10.2f} {model.economics.dhdistrictoandmcost.CurrentUnits.value}\n')
507518
f.write(f' Average Annual Peaking Fuel Cost: {model.economics.averageannualngcost.value:10.2f} {model.economics.averageannualngcost.CurrentUnits.value}\n')
508519

520+
if model.wellbores.redrill.value > 0:
521+
redrill_label = Outputs._field_label(econ.redrilling_annual_cost.display_name, 47)
522+
f.write(f' {redrill_label}{econ.redrilling_annual_cost.value:10.2f} {econ.redrilling_annual_cost.CurrentUnits.value}\n')
523+
509524
f.write(f' {econ.Coam.display_name}: {(econ.Coam.value + econ.averageannualpumpingcosts.value + econ.averageannualheatpumpelectricitycost.value):10.2f} {econ.Coam.CurrentUnits.value}\n')
510525
else:
511526
f.write(f' {econ.Coam.display_name}: {econ.Coam.value:10.2f} {econ.Coam.CurrentUnits.value}\n')

src/geophires_x/WellBores.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,6 +1120,7 @@ def __init__(self, model: Model):
11201120
)
11211121
self.redrill = self.OutputParameterDict[self.redrill.Name] = OutputParameter(
11221122
Name="redrill",
1123+
display_name='Number of times redrilling',
11231124
UnitType=Units.NONE
11241125
)
11251126
self.PumpingPowerProd = self.OutputParameterDict[self.PumpingPowerProd.Name] = OutputParameter(

src/geophires_x/__init__.py

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

src/geophires_x_client/geophires_x_result.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -284,13 +284,14 @@ class GeophiresXResult:
284284
'Annual District Heating O&M Cost',
285285
'Average Annual Peaking Fuel Cost',
286286
'Average annual pumping costs',
287-
'Total operating and maintenance costs',
288-
# AGS/CLGS
289-
'OPEX',
290287
# SUTRA
291288
'Average annual auxiliary fuel cost',
292289
'Average annual pumping cost',
290+
'Redrilling costs',
293291
'Total average annual O&M costs',
292+
'Total operating and maintenance costs',
293+
# AGS/CLGS
294+
'OPEX',
294295
],
295296
'SURFACE EQUIPMENT SIMULATION RESULTS': [
296297
'Initial geofluid availability',

0 commit comments

Comments
 (0)