File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -854,7 +854,20 @@ def _get_royalty_rate_schedule(model: Model) -> list[float]:
854854def _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
You can’t perform that action at this time.
0 commit comments