Skip to content

Commit daee411

Browse files
define separate end-use option output parameter in preparation to add theoretical basis tooltip text (WIP)
1 parent 2d22b4b commit daee411

File tree

4 files changed

+33
-12
lines changed

4 files changed

+33
-12
lines changed

src/geophires_x/OptionList.py

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,22 @@ def __ne__(self, other):
2525
return str(self) != str(other)
2626

2727

28+
_EXTRA_HEAT_SNIPPET = 'Heat sales considered as extra income'
29+
_EXTRA_ELECTRICITY_SNIPPET = 'Electricity sales considered as extra income'
30+
31+
2832
class EndUseOptions(GeophiresInputEnum):
29-
ELECTRICITY = 1, "Electricity"
30-
HEAT = 2, "Direct-Use Heat"
31-
COGENERATION_TOPPING_EXTRA_HEAT = 31, "Cogeneration Topping Cycle, Heat sales considered as extra income"
32-
COGENERATION_TOPPING_EXTRA_ELECTRICITY = 32, "Cogeneration Topping Cycle, Electricity sales considered as extra income"
33-
COGENERATION_BOTTOMING_EXTRA_HEAT = 41, "Cogeneration Bottoming Cycle, Heat sales considered as extra income"
34-
COGENERATION_BOTTOMING_EXTRA_ELECTRICITY = 42, "Cogeneration Bottoming Cycle, Electricity sales considered as extra income"
35-
COGENERATION_PARALLEL_EXTRA_HEAT = 51, "Cogeneration Parallel Cycle, Heat sales considered as extra income"
36-
COGENERATION_PARALLEL_EXTRA_ELECTRICITY = 52, "Cogeneration Parallel Cycle, Electricity sales considered as extra income"
33+
ELECTRICITY = 1, 'Electricity'
34+
HEAT = 2, 'Direct-Use Heat'
35+
COGENERATION_TOPPING_EXTRA_HEAT = 31, f'Cogeneration Topping Cycle, {_EXTRA_HEAT_SNIPPET}'
36+
COGENERATION_TOPPING_EXTRA_ELECTRICITY = 32, f'Cogeneration Topping Cycle, {_EXTRA_ELECTRICITY_SNIPPET}'
37+
COGENERATION_BOTTOMING_EXTRA_HEAT = 41, f'Cogeneration Bottoming Cycle, {_EXTRA_HEAT_SNIPPET}'
38+
COGENERATION_BOTTOMING_EXTRA_ELECTRICITY = 42, f'Cogeneration Bottoming Cycle, {_EXTRA_ELECTRICITY_SNIPPET}'
39+
COGENERATION_PARALLEL_EXTRA_HEAT = 51, f'Cogeneration Parallel Cycle, {_EXTRA_HEAT_SNIPPET}'
40+
COGENERATION_PARALLEL_EXTRA_ELECTRICITY = 52, f'Cogeneration Parallel Cycle, {_EXTRA_ELECTRICITY_SNIPPET}'
3741

3842
@staticmethod
39-
def from_input_string(input_string: str):
43+
def from_input_string(input_string: str) -> 'EndUseOptions':
4044
"""
4145
:rtype: EndUseOptions
4246
"""
@@ -48,11 +52,17 @@ def from_input_string(input_string: str):
4852
raise ValueError(f'Unknown End-Use Option input value: {input_string}')
4953

5054
@staticmethod
51-
def from_int(int_val):
55+
def from_int(int_val: int) -> 'EndUseOptions':
56+
"""
57+
:rtype: EndUseOptions
58+
"""
59+
5260
for member in __class__:
5361
if member.int_value == int_val:
5462
return member
5563

64+
raise ValueError(f'Unknown End-Use Option integer input value: {int_val}')
65+
5666

5767
class PlantType(GeophiresInputEnum):
5868
SUB_CRITICAL_ORC = 1, "Subcritical ORC"

src/geophires_x/Outputs.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,8 @@ def PrintOutputs(self, model: Model):
195195
f.write(NL)
196196
f.write(' ***SUMMARY OF RESULTS***\n')
197197
f.write(NL)
198-
f.write(f' End-Use Option: {str(model.surfaceplant.enduse_option.value.value)}\n')
198+
f.write(f' {model.surfaceplant.enduse_option_output.display_name}: '
199+
f'{model.surfaceplant.enduse_option_output.value}\n')
199200
if model.surfaceplant.plant_type.value in [PlantType.ABSORPTION_CHILLER, PlantType.HEAT_PUMP, PlantType.DISTRICT_HEATING]:
200201
f.write(' Surface Application: ' + str(model.surfaceplant.plant_type.value.value) + NL)
201202
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]: # there is an electricity component

src/geophires_x/SUTRAOutputs.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ def PrintOutputs(self, model: Model):
6767
f.write(NL)
6868
f.write(' ***SUMMARY OF RESULTS***\n')
6969
f.write(NL)
70-
f.write(" End-Use Option: " + str(model.surfaceplant.enduse_option.value.value) + NL)
70+
f.write(f' {model.surfaceplant.enduse_option_output.display_name}: '
71+
f'{model.surfaceplant.enduse_option_output.value}\n')
7172
f.write(" Reservoir Model = " + str(model.reserv.resoption.value.value) + " Model\n")
7273
f.write(f" Direct-Use heat breakeven price: {model.economics.LCOH.value:10.2f} " + model.economics.LCOH.CurrentUnits.value + NL)
7374

src/geophires_x/SurfacePlant.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,13 @@ def __init__(self, model: Model):
471471
self.MyPath = os.path.abspath(__file__)
472472

473473
# Results - used by other objects or printed in output downstream
474+
self.enduse_option_output = self.OutputParameterDict[self.enduse_option_output.Name] = OutputParameter(
475+
Name=self.enduse_option.Name,
476+
UnitType=Units.NONE,
477+
# FIXME WIP
478+
# ToolTipText="Select the end-use application of the geofluid heat: " +
479+
# '; '.join([f'{it.int_value}: {it.value}' for it in EndUseOptions])
480+
)
474481
self.usebuiltinoutletplantcorrelation = self.OutputParameterDict[self.usebuiltinoutletplantcorrelation.Name] = OutputParameter(
475482
Name="usebuiltinoutletplantcorrelation",
476483
UnitType=Units.NONE
@@ -697,3 +704,5 @@ def _calculate_derived_outputs(self, model: Model) -> None:
697704
convertible_unit(self.heat_to_power_conversion_efficiency.CurrentUnits)).magnitude
698705
if avg_efficiency > 0: # 0 is presumed to mean N/A
699706
self.heat_to_power_conversion_efficiency.value = avg_efficiency
707+
708+
self.enduse_option_output.value = self.enduse_option.value.value

0 commit comments

Comments
 (0)