Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
27c16f2
Include first law efficiency (average) in surface equipment simulatio…
softwareengineerprogrammer Jan 17, 2025
4a4b155
Update example outputs to sync with Well depth output name update
softwareengineerprogrammer Jan 20, 2025
2dfb4a9
Bump version: 3.7.0 → 3.7.1
softwareengineerprogrammer Jan 21, 2025
8c1b88d
Revert "Bump version: 3.7.0 → 3.7.1"
softwareengineerprogrammer Jan 21, 2025
f8d6821
Order efficiency after pumping power fields
softwareengineerprogrammer Jan 21, 2025
c136659
Bump version: 3.7.0 → 3.7.1
softwareengineerprogrammer Jan 21, 2025
c9125b5
Fix CSV unit test
softwareengineerprogrammer Jan 21, 2025
6120f89
Regenerate example1_addons.csv when "regenerate-example.result.sh exa…
softwareengineerprogrammer Jan 21, 2025
1701630
Fix python<=3.9-incompatible type annotation
softwareengineerprogrammer Jan 21, 2025
3b07381
Output first law effiency as 'Heat to power conversion efficiency'
softwareengineerprogrammer Jan 21, 2025
7953430
Include description in output parameter docs
softwareengineerprogrammer Jan 22, 2025
1520f0a
Fix floating point errors in default/min/max values in schema generation
softwareengineerprogrammer Jan 22, 2025
de28e0b
Define 'Heat to Power Conversion Efficiency' as a separate output tha…
softwareengineerprogrammer Jan 22, 2025
9463699
Update test cases with 'Heat to Power Conversion Efficiency' output name
softwareengineerprogrammer Jan 22, 2025
70e0f61
Bump version: 3.7.1 → 3.7.2
softwareengineerprogrammer Jan 22, 2025
5aa60a7
Don't output efficiency when not applicable
softwareengineerprogrammer Jan 22, 2025
da5d42d
Convert efficiency into its CurrentUnits instead of hardcoding tenth …
softwareengineerprogrammer Jan 22, 2025
e6a0844
Bump version: 3.7.2 → 3.7.3
softwareengineerprogrammer Jan 22, 2025
528c3f1
3.7.3 changelog entry
softwareengineerprogrammer Jan 22, 2025
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
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 3.7.0
current_version = 3.7.3
commit = True
tag = True

Expand Down
2 changes: 1 addition & 1 deletion .cookiecutterrc
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ default_context:
sphinx_doctest: "no"
sphinx_theme: "sphinx-py3doc-enhanced-theme"
test_matrix_separate_coverage: "no"
version: 3.7.0
version: 3.7.3
version_manager: "bump2version"
website: "https://github.com/NREL"
year_from: "2023"
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ GEOPHIRES-X (2023-2025)

"Well depth (or total length, if not vertical)" output field renamed to "Well depth" per https://github.com/NREL/GEOPHIRES-X/issues/321

3.7.3: Heat to Power Conversion Efficiency output added.


3.6
^^^
Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ Free software: `MIT license <LICENSE>`__
:alt: Supported implementations
:target: https://pypi.org/project/geophires-x

.. |commits-since| image:: https://img.shields.io/github/commits-since/softwareengineerprogrammer/GEOPHIRES-X/v3.7.0.svg
.. |commits-since| image:: https://img.shields.io/github/commits-since/softwareengineerprogrammer/GEOPHIRES-X/v3.7.3.svg
:alt: Commits since latest release
:target: https://github.com/softwareengineerprogrammer/GEOPHIRES-X/compare/v3.7.0...main
:target: https://github.com/softwareengineerprogrammer/GEOPHIRES-X/compare/v3.7.3...main

.. |docs| image:: https://readthedocs.org/projects/GEOPHIRES-X/badge/?style=flat
:target: https://nrel.github.io/GEOPHIRES-X
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
year = '2024'
author = 'NREL'
copyright = f'{year}, {author}'
version = release = '3.7.0'
version = release = '3.7.3'

pygments_style = 'trac'
templates_path = ['./templates']
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def read(*names, **kwargs):

setup(
name='geophires-x',
version='3.7.0',
version='3.7.3',
license='MIT',
description='GEOPHIRES is a free and open-source geothermal techno-economic simulator.',
long_description='{}\n{}'.format(
Expand Down
6 changes: 5 additions & 1 deletion src/geophires_x/Outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
PlantType
from geophires_x.GeoPHIRESUtils import UpgradeSymbologyOfUnits, render_default, InsertImagesIntoHTML
from geophires_x.Parameter import Parameter
from geophires_x.Units import convertible_unit, Units, PercentUnit

NL = '\n'
validFilenameChars = "-_.() %s%s" % (string.ascii_letters, string.digits)
Expand Down Expand Up @@ -1912,6 +1911,11 @@ def PrintOutputs(self, model: Model):

f.write(f' Average Pumping Power: {np.average(model.wellbores.PumpingPower.value):10.2f} {model.wellbores.PumpingPower.CurrentUnits.value}{NL}')

if model.surfaceplant.heat_to_power_conversion_efficiency.value is not None:
hpce = model.surfaceplant.heat_to_power_conversion_efficiency
f.write(f' {Outputs._field_label(hpce.Name, 50)}'
f'{hpce.value:10.2f} {model.surfaceplant.heat_to_power_conversion_efficiency.CurrentUnits.value}\n')

f.write(NL)
f.write(' ************************************************************\n')
f.write(' * HEATING, COOLING AND/OR ELECTRICITY PRODUCTION PROFILE *\n')
Expand Down
4 changes: 2 additions & 2 deletions src/geophires_x/Parameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ class OutputParameter(HasQuantity):
"""

Name: str = ""
value: int = 0
ToolTipText: str = "This is ToolTip Text"
value: Any = 0
ToolTipText: str = ""
UnitType: IntEnum = Units.NONE
PreferredUnits: Enum = Units.NONE
# set to PreferredUnits by default assuming that the current units are the preferred units -
Expand Down
28 changes: 27 additions & 1 deletion src/geophires_x/SurfacePlant.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import os
import numpy as np

from .GeoPHIRESUtils import quantity
from .OptionList import EndUseOptions, PlantType
from .Parameter import floatParameter, intParameter, strParameter, OutputParameter, ReadParameter, \
coerce_int_params_to_enum_values
Expand Down Expand Up @@ -486,7 +487,16 @@ def __init__(self, model: Model):
Name="First Law Efficiency",
UnitType=Units.PERCENT,
PreferredUnits=PercentUnit.PERCENT,
CurrentUnits=PercentUnit.PERCENT
CurrentUnits=PercentUnit.PERCENT, # FIXME default values are actually in tenths, not percent.
ToolTipText='Net electricity produced divided by heat extracted towards electricity'
)
self.heat_to_power_conversion_efficiency = self.OutputParameterDict[self.heat_to_power_conversion_efficiency.Name] = OutputParameter(
Name='Heat to Power Conversion Efficiency',
value=None,
UnitType=Units.PERCENT,
PreferredUnits=PercentUnit.PERCENT,
CurrentUnits=PercentUnit.PERCENT,
ToolTipText='First law efficiency average over project lifetime'
)
self.HeatExtracted = self.OutputParameterDict[self.HeatExtracted.Name] = OutputParameter(
Name="Heat Extracted",
Expand Down Expand Up @@ -636,4 +646,20 @@ def Calculate(self, model: Model) -> None:

# All calculations are handled in subclasses of this class, so this function is empty.

# Subclasses should call _calculate_derived_outputs at the end of their Calculate methods.
self._calculate_derived_outputs(model)

model.logger.info(f'Complete {self.__class__.__name__}: {__name__}')

def _calculate_derived_outputs(self, model: Model) -> None:
"""
Subclasses should call _calculate_derived_outputs at the end of their Calculate methods to populate output
values that are derived from subclass-calculated outputs.
"""

if self.FirstLawEfficiency is not None:
fle_unit = PercentUnit.TENTH # See FIXME on self.FirstLawEfficiency re: CurrentUnit being incorrect.
avg_efficiency = quantity(np.average(model.surfaceplant.FirstLawEfficiency.value), fle_unit).to(
convertible_unit(self.heat_to_power_conversion_efficiency.CurrentUnits)).magnitude
if avg_efficiency > 0: # 0 is presumed to mean N/A
self.heat_to_power_conversion_efficiency.value = avg_efficiency
1 change: 1 addition & 0 deletions src/geophires_x/SurfacePlantAGS.py
Original file line number Diff line number Diff line change
Expand Up @@ -783,4 +783,5 @@ def Calculate(self, model: Model) -> None:
print(f'Error: {class_file_info_msg}. Exiting....')
raise RuntimeError(base_msg)

self._calculate_derived_outputs(model)
model.logger.info(f"complete {str(__class__)}: {sys._getframe().f_code.co_name}")
2 changes: 2 additions & 0 deletions src/geophires_x/SurfacePlantAbsorptionChiller.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,4 +141,6 @@ def Calculate(self, model: Model) -> None:
# calculate reservoir heat content
self.RemainingReservoirHeatContent.value = SurfacePlant.remaining_reservoir_heat_content(
self, model.reserv.InitialReservoirHeatContent.value, self.HeatkWhExtracted.value)

self._calculate_derived_outputs(model)
model.logger.info(f"complete {self.__class__.__name__}: {__name__}")
1 change: 1 addition & 0 deletions src/geophires_x/SurfacePlantDistrictHeating.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ def Calculate(self, model: Model) -> None:
self.RemainingReservoirHeatContent.value = SurfacePlant.remaining_reservoir_heat_content(
self, model.reserv.InitialReservoirHeatContent.value, self.HeatkWhExtracted.value)

self._calculate_derived_outputs(model)
model.logger.info(f"Complete {self.__class__.__name__}: {__name__}")

# district heating routines below
Expand Down
1 change: 1 addition & 0 deletions src/geophires_x/SurfacePlantDoubleFlash.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,5 @@ def Calculate(self, model: Model) -> None:
self.RemainingReservoirHeatContent.value = SurfacePlant.remaining_reservoir_heat_content(
self, model.reserv.InitialReservoirHeatContent.value, self.HeatkWhExtracted.value)

self._calculate_derived_outputs(model)
model.logger.info(f'complete {self.__class__.__name__}: {__name__}')
3 changes: 2 additions & 1 deletion src/geophires_x/SurfacePlantHeatPump.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,5 @@ def Calculate(self, model: Model) -> None:
self.RemainingReservoirHeatContent.value = SurfacePlant.remaining_reservoir_heat_content(
self, model.reserv.InitialReservoirHeatContent.value, self.HeatkWhExtracted.value)

model.logger.info("complete " + str(__class__) + ": " + inspect.currentframe().f_code.co_name)
self._calculate_derived_outputs(model)
model.logger.info(f"complete {str(__class__)}: {inspect.currentframe().f_code.co_name}")
3 changes: 2 additions & 1 deletion src/geophires_x/SurfacePlantIndustrialHeat.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,5 @@ def Calculate(self, model: Model) -> None:
self.RemainingReservoirHeatContent.value = SurfacePlant.remaining_reservoir_heat_content(
self, model.reserv.InitialReservoirHeatContent.value, self.HeatkWhExtracted.value)

model.logger.info("complete " + self.__class__.__name__ + ": " + __name__)
self._calculate_derived_outputs(model)
model.logger.info(f"complete {self.__class__.__name__}: {__name__}")
1 change: 1 addition & 0 deletions src/geophires_x/SurfacePlantSUTRA.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,5 +204,6 @@ def Calculate(self, model: Model) -> None:
# calculate maximum auxiliary boiler demand
self.max_peaking_boiler_demand.value = max(self.AnnualAuxiliaryHeatProduced.value)

self._calculate_derived_outputs(model)
model.logger.info(f"complete {self.__class__.__name__}: {self.__init__.__name__}")

5 changes: 3 additions & 2 deletions src/geophires_x/SurfacePlantSingleFlash.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def Calculate(self, model: Model) -> None:
self.NetElectricityProduced.value = self.ElectricityProduced.value - model.wellbores.PumpingPower.value
self.FirstLawEfficiency.value = self.NetElectricityProduced.value/HeatExtractedTowardsElectricity

# Calculate annual electricity, pum;ping, and heat production
# Calculate annual electricity, pumping, and heat production
self.HeatkWhExtracted.value, self.PumpingkWh.value, self.TotalkWhProduced.value, self.NetkWhProduced.value, self.HeatkWhProduced.value = \
SurfacePlant.annual_electricity_pumping_power(self, self.plant_lifetime.value, self.enduse_option.value,
self.HeatExtracted.value, model.economics.timestepsperyear.value, self.utilization_factor.value,
Expand All @@ -133,4 +133,5 @@ def Calculate(self, model: Model) -> None:
self.RemainingReservoirHeatContent.value = SurfacePlant.remaining_reservoir_heat_content(
self, model.reserv.InitialReservoirHeatContent.value, self.HeatkWhExtracted.value)

model.logger.info("complete " + str(__class__) + ": " + sys._getframe().f_code.co_name)
self._calculate_derived_outputs(model)
model.logger.info(f"complete {str(__class__)}: {sys._getframe().f_code.co_name}")
3 changes: 2 additions & 1 deletion src/geophires_x/SurfacePlantSubcriticalORC.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,5 @@ def Calculate(self, model: Model) -> None:
self.RemainingReservoirHeatContent.value = SurfacePlant.remaining_reservoir_heat_content(
self, model.reserv.InitialReservoirHeatContent.value, self.HeatkWhExtracted.value)

model.logger.info("complete " + self.__class__.__name__ + ": " + __name__)
self._calculate_derived_outputs(model)
model.logger.info(f"complete {self.__class__.__name__}: {__name__}")
3 changes: 2 additions & 1 deletion src/geophires_x/SurfacePlantSupercriticalORC.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,5 @@ def Calculate(self, model: Model) -> None:
self.RemainingReservoirHeatContent.value = SurfacePlant.remaining_reservoir_heat_content(
self, model.reserv.InitialReservoirHeatContent.value, self.HeatkWhExtracted.value)

model.logger.info("complete " + self.__class__.__name__ + ": " + __name__)
self._calculate_derived_outputs(model)
model.logger.info(f"complete {self.__class__.__name__}: {__name__}")
2 changes: 1 addition & 1 deletion src/geophires_x/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '3.7.0'
__version__ = '3.7.3'
3 changes: 2 additions & 1 deletion src/geophires_x_client/geophires_x_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,10 @@ class GeophiresXResult:
'Maximum Peaking Boiler Heat Production',
'Average Peaking Boiler Heat Production',
'Minimum Peaking Boiler Heat Production',
'Initial pumping power/net installed power',
'Heat to Power Conversion Efficiency',
# AGS/CLGS
'Surface Plant Cost',
'Initial pumping power/net installed power',
# SUTRA
'Average RTES Heating Production',
'Average Auxiliary Heating Production',
Expand Down
17 changes: 14 additions & 3 deletions src/geophires_x_schema_generator/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def generate_json_schema(self) -> dict:
'type': param['json_parameter_type'],
'units': units_val,
'category': param['parameter_category'],
'default': param['DefaultValue'],
'default': _fix_floating_point_error(param['DefaultValue']),
'minimum': min_val,
'maximum': max_val,
}
Expand Down Expand Up @@ -168,13 +168,15 @@ def get_input_params_table(category_params, category_name) -> str:
# if param['Required']:
# TODO designate required params

default_value = _fix_floating_point_error(_get_key(param, 'DefaultValue'))

min_val, max_val = _get_min_and_max(param)

input_rst += f"""\n * - {param['Name']}
- {_get_key(param, 'ToolTipText')}
- {_get_key(param, 'PreferredUnits')}
- {_get_key(param, 'json_parameter_type')}
- {_get_key(param, 'DefaultValue')}
- {default_value}
- {min_val}
- {max_val}"""

Expand Down Expand Up @@ -210,6 +212,7 @@ def get_output_params_table_rst(self, output_params_json) -> str:
:header-rows: 1

* - Name
- Description
- Preferred Units
- Default Value Type"""

Expand All @@ -223,6 +226,7 @@ def get_key(k):
return ''

output_rst += f"""\n * - {param['Name']}
- {get_key('ToolTipText')}
- {get_key('PreferredUnits')}
- {get_key('json_parameter_type')}"""

Expand All @@ -245,7 +249,14 @@ def _get_min_and_max(param: dict, default_val='') -> Tuple:
min_val = min(param['AllowableRange'])
max_val = max(param['AllowableRange'])

return (min_val, max_val)
return _fix_floating_point_error(min_val), _fix_floating_point_error(max_val)


def _fix_floating_point_error(val: Any) -> Any:
if '.0000' in str(val):
return format(float(val), '.1f')

return val


class HipRaXSchemaGenerator(GeophiresXSchemaGenerator):
Expand Down
4 changes: 2 additions & 2 deletions src/geophires_x_schema_generator/geophires-request.json
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@
"category": "Well Bores",
"default": 1.0,
"minimum": 0.0,
"maximum": 1.000001
"maximum": "1.0"
},
"Is AGS": {
"description": "Set to true if the model is for an Advanced Geothermal System (AGS)",
Expand Down Expand Up @@ -2086,7 +2086,7 @@
"type": "number",
"units": "%",
"category": "Economics",
"default": 7.00,
"default": "7.0",
"minimum": 0.0,
"maximum": 100.0
},
Expand Down
3 changes: 2 additions & 1 deletion tests/example1_addons.csv
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ SURFACE EQUIPMENT SIMULATION RESULTS,Average Annual Total Electricity Generation
SURFACE EQUIPMENT SIMULATION RESULTS,Average Annual Net Electricity Generation,,42.3,GWh
SURFACE EQUIPMENT SIMULATION RESULTS,Average Pumping Power,,0.2,MW
SURFACE EQUIPMENT SIMULATION RESULTS,Initial pumping power/net installed power,,3.82,%
Simulation Metadata,GEOPHIRES Version,,3.7.0,
SURFACE EQUIPMENT SIMULATION RESULTS,Heat to Power Conversion Efficiency,,10.07,%
Simulation Metadata,GEOPHIRES Version,,3.7.1,
POWER GENERATION PROFILE,THERMAL DRAWDOWN,1,1.0,
POWER GENERATION PROFILE,THERMAL DRAWDOWN,2,1.0056,
POWER GENERATION PROFILE,THERMAL DRAWDOWN,3,1.0073,
Expand Down
9 changes: 5 additions & 4 deletions tests/examples/Fervo_Norbeck_Latimer_2023.out
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

Simulation Metadata
----------------------
GEOPHIRES Version: 3.7.0
Simulation Date: 2025-01-20
Simulation Time: 10:49
Calculation Time: 0.454 sec
GEOPHIRES Version: 3.7.1
Simulation Date: 2025-01-22
Simulation Time: 10:48
Calculation Time: 0.443 sec

***SUMMARY OF RESULTS***

Expand Down Expand Up @@ -129,6 +129,7 @@ Simulation Metadata
Average Annual Net Electricity Generation: 17.70 GWh
Initial pumping power/net installed power: 28.16 %
Average Pumping Power: 0.63 MW
Heat to Power Conversion Efficiency: 9.95 %

************************************************************
* HEATING, COOLING AND/OR ELECTRICITY PRODUCTION PROFILE *
Expand Down
9 changes: 5 additions & 4 deletions tests/examples/Fervo_Project_Cape-2.out
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

Simulation Metadata
----------------------
GEOPHIRES Version: 3.7.0
Simulation Date: 2025-01-20
Simulation Time: 10:49
Calculation Time: 0.685 sec
GEOPHIRES Version: 3.7.1
Simulation Date: 2025-01-22
Simulation Time: 10:48
Calculation Time: 0.684 sec

***SUMMARY OF RESULTS***

Expand Down Expand Up @@ -127,6 +127,7 @@ Simulation Metadata
Average Annual Net Electricity Generation: 69.67 GWh
Initial pumping power/net installed power: 1.68 %
Average Pumping Power: 0.15 MW
Heat to Power Conversion Efficiency: 16.00 %

************************************************************
* HEATING, COOLING AND/OR ELECTRICITY PRODUCTION PROFILE *
Expand Down
9 changes: 5 additions & 4 deletions tests/examples/Fervo_Project_Cape-3.out
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

Simulation Metadata
----------------------
GEOPHIRES Version: 3.7.0
Simulation Date: 2025-01-20
Simulation Time: 10:49
Calculation Time: 0.915 sec
GEOPHIRES Version: 3.7.1
Simulation Date: 2025-01-22
Simulation Time: 10:48
Calculation Time: 0.889 sec

***SUMMARY OF RESULTS***

Expand Down Expand Up @@ -128,6 +128,7 @@ Simulation Metadata
Average Annual Net Electricity Generation: 3171.75 GWh
Initial pumping power/net installed power: 13.50 %
Average Pumping Power: 53.73 MW
Heat to Power Conversion Efficiency: 14.39 %

************************************************************
* HEATING, COOLING AND/OR ELECTRICITY PRODUCTION PROFILE *
Expand Down
Loading
Loading