Skip to content

Commit 0ce37df

Browse files
PlantType parsing in enum
1 parent 768044d commit 0ce37df

File tree

2 files changed

+28
-18
lines changed

2 files changed

+28
-18
lines changed

src/geophires_x/OptionList.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,33 @@ class PlantType(str, Enum):
5353
RTES = "Reservoir Thermal Energy Storage" # 8
5454
INDUSTRIAL = "Industrial" # 9
5555

56+
@staticmethod
57+
def get_plant_type_from_input_string(input_string:str):
58+
"""
59+
:rtype: PlantType
60+
"""
61+
62+
if input_string == str(1):
63+
return PlantType.SUB_CRITICAL_ORC
64+
elif input_string == str(2):
65+
return PlantType.SUPER_CRITICAL_ORC
66+
elif input_string == str(3):
67+
return PlantType.SINGLE_FLASH
68+
elif input_string == str(4):
69+
return PlantType.DOUBLE_FLASH
70+
elif input_string == str(5):
71+
return PlantType.ABSORPTION_CHILLER
72+
elif input_string == str(6):
73+
return PlantType.HEAT_PUMP
74+
elif input_string == str(7):
75+
return PlantType.DISTRICT_HEATING
76+
elif input_string == str(8):
77+
return PlantType.RTES
78+
else:
79+
return PlantType.INDUSTRIAL
80+
81+
raise ValueError(f'Unknown End-Use Option input value: {input_string}')
82+
5683

5784
class EconomicModel(str, Enum):
5885
CLGS = "Simple (CLGS)"

src/geophires_x/SurfacePlant.py

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -519,24 +519,7 @@ def read_parameters(self, model:Model) -> None:
519519
self.plant_type.value = PlantType.INDUSTRIAL
520520

521521
elif ParameterToModify.Name == 'Power Plant Type':
522-
if ParameterReadIn.sValue == str(1):
523-
ParameterToModify.value = PlantType.SUB_CRITICAL_ORC
524-
elif ParameterReadIn.sValue == str(2):
525-
ParameterToModify.value = PlantType.SUPER_CRITICAL_ORC
526-
elif ParameterReadIn.sValue == str(3):
527-
ParameterToModify.value = PlantType.SINGLE_FLASH
528-
elif ParameterReadIn.sValue == str(4):
529-
ParameterToModify.value = PlantType.DOUBLE_FLASH
530-
elif ParameterReadIn.sValue == str(5):
531-
ParameterToModify.value = PlantType.ABSORPTION_CHILLER
532-
elif ParameterReadIn.sValue == str(6):
533-
ParameterToModify.value = PlantType.HEAT_PUMP
534-
elif ParameterReadIn.sValue == str(7):
535-
ParameterToModify.value = PlantType.DISTRICT_HEATING
536-
elif ParameterReadIn.sValue == str(8):
537-
ParameterToModify.value = PlantType.RTES
538-
else:
539-
ParameterToModify.value = PlantType.INDUSTRIAL
522+
ParameterToModify.value = PlantType.get_plant_type_from_input_string(ParameterReadIn.sValue)
540523
if self.enduse_option.value == EndUseOptions.ELECTRICITY:
541524
# simple single- or double-flash power plant assumes no production well pumping
542525
if ParameterToModify.value in [PlantType.SINGLE_FLASH, PlantType.DOUBLE_FLASH]:

0 commit comments

Comments
 (0)