Skip to content

Commit 1058d7d

Browse files
WIP - PlantType as GeophiresInputEnum - default value discrepancy headache...
1 parent 0ce37df commit 1058d7d

File tree

3 files changed

+67
-35
lines changed

3 files changed

+67
-35
lines changed

src/geophires_x/OptionList.py

Lines changed: 14 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -42,43 +42,28 @@ def get_end_use_option_from_input_string(input_string:str):
4242
raise ValueError(f'Unknown End-Use Option input value: {input_string}')
4343

4444

45-
class PlantType(str, Enum):
46-
SUB_CRITICAL_ORC = "Subcritical ORC" # 1
47-
SUPER_CRITICAL_ORC = "Supercritical ORC" # 2
48-
SINGLE_FLASH = "Single-Flash" # 3
49-
DOUBLE_FLASH = "Double-Flash" # 4
50-
ABSORPTION_CHILLER = "Absorption Chiller" # 5
51-
HEAT_PUMP = "Heat Pump" # 6
52-
DISTRICT_HEATING = "District Heating" # 7
53-
RTES = "Reservoir Thermal Energy Storage" # 8
54-
INDUSTRIAL = "Industrial" # 9
45+
class PlantType(GeophiresInputEnum):
46+
SUB_CRITICAL_ORC = 1, "Subcritical ORC"
47+
SUPER_CRITICAL_ORC = 2, "Supercritical ORC"
48+
SINGLE_FLASH = 3, "Single-Flash"
49+
DOUBLE_FLASH = 4, "Double-Flash"
50+
ABSORPTION_CHILLER = 5, "Absorption Chiller"
51+
HEAT_PUMP = 6, "Heat Pump"
52+
DISTRICT_HEATING = 7, "District Heating"
53+
RTES = 8, "Reservoir Thermal Energy Storage"
54+
INDUSTRIAL = 9, "Industrial"
5555

5656
@staticmethod
5757
def get_plant_type_from_input_string(input_string:str):
5858
"""
5959
:rtype: PlantType
6060
"""
6161

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
62+
for type in PlantType:
63+
if input_string == str(type.int_value):
64+
return type
8065

81-
raise ValueError(f'Unknown End-Use Option input value: {input_string}')
66+
raise ValueError(f'Unknown Power Plant Type input value: {input_string}')
8267

8368

8469
class EconomicModel(str, Enum):

src/geophires_x/SurfacePlant.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,11 +244,11 @@ def __init__(self, model: Model):
244244
"Power Plant Type",
245245
DefaultValue=PlantType.SUB_CRITICAL_ORC,
246246
AllowableRange=[1, 2, 3, 4, 5, 6, 7, 8, 9],
247+
ValuesEnum=PlantType,
247248
UnitType=Units.NONE,
248249
ErrMessage="assume default power plant type (1: subcritical ORC)",
249-
ToolTipText="Specify the type of physical plant. 1: Subcritical ORC," +
250-
" 2: Supercritical ORC, 3: Single-flash, 4: Double-flash, 5: Absorption Chiller, 6: Heat Pump" + # 6
251-
" 7: District Heating, 8: Reservoir Thermal Energy Storage"
250+
ToolTipText="Specify the type of physical plant. " +
251+
'; '.join([f'{it.int_value}: {it.value}' for it in PlantType])
252252
)
253253
self.pump_efficiency = self.ParameterDict[self.pump_efficiency.Name] = floatParameter(
254254
"Circulation Pump Efficiency",

src/geophires_x_schema_generator/geophires-request.json

Lines changed: 50 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -785,13 +785,60 @@
785785
]
786786
},
787787
"Power Plant Type": {
788-
"description": "Specify the type of physical plant. 1: Subcritical ORC, 2: Supercritical ORC, 3: Single-flash, 4: Double-flash, 5: Absorption Chiller, 6: Heat Pump 7: District Heating, 8: Reservoir Thermal Energy Storage",
788+
"description": "Specify the type of physical plant. 1: Subcritical ORC; 2: Supercritical ORC; 3: Single-Flash; 4: Double-Flash; 5: Absorption Chiller; 6: Heat Pump; 7: District Heating; 8: Reservoir Thermal Energy Storage; 9: Industrial",
789789
"type": "integer",
790790
"units": null,
791791
"category": "Surface Plant",
792-
"default": "Subcritical ORC",
792+
"default": "",
793793
"minimum": 1,
794-
"maximum": 9
794+
"maximum": 9,
795+
"enum_values": [
796+
{
797+
"name": "SUB_CRITICAL_ORC",
798+
"value": "Subcritical ORC",
799+
"int_value": 1
800+
},
801+
{
802+
"name": "SUPER_CRITICAL_ORC",
803+
"value": "Supercritical ORC",
804+
"int_value": 2
805+
},
806+
{
807+
"name": "SINGLE_FLASH",
808+
"value": "Single-Flash",
809+
"int_value": 3
810+
},
811+
{
812+
"name": "DOUBLE_FLASH",
813+
"value": "Double-Flash",
814+
"int_value": 4
815+
},
816+
{
817+
"name": "ABSORPTION_CHILLER",
818+
"value": "Absorption Chiller",
819+
"int_value": 5
820+
},
821+
{
822+
"name": "HEAT_PUMP",
823+
"value": "Heat Pump",
824+
"int_value": 6
825+
},
826+
{
827+
"name": "DISTRICT_HEATING",
828+
"value": "District Heating",
829+
"int_value": 7
830+
},
831+
{
832+
"name": "RTES",
833+
"value": "Reservoir Thermal Energy Storage",
834+
"int_value": 8
835+
},
836+
{
837+
"name": "INDUSTRIAL",
838+
"value": "Industrial",
839+
"int_value": 9
840+
}
841+
]
795842
},
796843
"Circulation Pump Efficiency": {
797844
"description": "Specify the overall efficiency of the injection and production well pumps",

0 commit comments

Comments
 (0)