Skip to content

Commit cee4edd

Browse files
clean up/document direct-use heat end use option nameplate capacity stub workaround
1 parent 6890082 commit cee4edd

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

src/geophires_x/EconomicsSam.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,20 @@ def _get_royalty_rate_schedule(model: Model) -> list[float]:
854854
def _get_max_total_generation_kW(model: Model) -> float:
855855
max_total_kw = np.max(model.surfaceplant.ElectricityProduced.quantity().to(convertible_unit('kW')).magnitude)
856856

857-
# FIXME TEMP
858-
max_total_kw = max(0.0001, max_total_kw)
857+
if not model.surfaceplant.enduse_option.value.has_electricity_component:
858+
# SAM requires a non-zero nameplate capacity, so we must provide a value even if there is no electricity
859+
# component. The stub value is both accepted/processed by SAM and results in
860+
# zero electricity production/revenue in the cash flow due to rounding.
861+
# This logic should be revisited if SAM adds support for combined energy-heat models per
862+
# https://github.com/softwareengineerprogrammer/GEOPHIRES/pull/142#pullrequestreview-3999949844
863+
non_electricity_end_use_stub_value = 0.0001
864+
865+
max_total_kw = max(non_electricity_end_use_stub_value, max_total_kw)
866+
if max_total_kw != non_electricity_end_use_stub_value:
867+
# Shouldn't happen
868+
model.logger.warning(
869+
f'Unexpected non-zero maximum total electricity generation for heat end-use option: {max_total_kw} kW. '
870+
f'This may be a result of an internal bug in GEOPHIRES or an invalid parameter configuration.'
871+
)
859872

860873
return max_total_kw

0 commit comments

Comments
 (0)