Skip to content

Commit 871520b

Browse files
Define GeophiresInputEnum
1 parent a6b2ca2 commit 871520b

File tree

1 file changed

+17
-19
lines changed

1 file changed

+17
-19
lines changed

src/geophires_x/OptionList.py

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,10 @@
22
from enum import Enum
33

44

5-
class EndUseOptions(str, Enum):
6-
ELECTRICITY = 1, "Electricity"
7-
HEAT = 2, "Direct-Use Heat"
8-
COGENERATION_TOPPING_EXTRA_HEAT = 31, "Cogeneration Topping Cycle, Heat sales considered as extra income"
9-
COGENERATION_TOPPING_EXTRA_ELECTRICITY = 32, "Cogeneration Topping Cycle, Electricity sales considered as extra income"
10-
COGENERATION_BOTTOMING_EXTRA_HEAT = 41, "Cogeneration Bottoming Cycle, Heat sales considered as extra income"
11-
COGENERATION_BOTTOMING_EXTRA_ELECTRICITY = 42, "Cogeneration Bottoming Cycle, Electricity sales considered as extra income"
12-
COGENERATION_PARALLEL_EXTRA_HEAT = 51, "Cogeneration Parallel Cycle, Heat sales considered as extra income"
13-
COGENERATION_PARALLEL_EXTRA_ELECTRICITY = 52, "Cogeneration Parallel Cycle, Electricity sales considered as extra income"
5+
class GeophiresInputEnum(str, Enum):
6+
"""
7+
Input enums have a name, integer input value, and string value
8+
"""
149

1510
def __new__(cls, *args, **kwds):
1611
obj = str.__new__(cls)
@@ -23,6 +18,17 @@ def __init__(self, int_value: int, _: str):
2318
def __eq__(self, other):
2419
return str(self) == str(other)
2520

21+
22+
class EndUseOptions(GeophiresInputEnum):
23+
ELECTRICITY = 1, "Electricity"
24+
HEAT = 2, "Direct-Use Heat"
25+
COGENERATION_TOPPING_EXTRA_HEAT = 31, "Cogeneration Topping Cycle, Heat sales considered as extra income"
26+
COGENERATION_TOPPING_EXTRA_ELECTRICITY = 32, "Cogeneration Topping Cycle, Electricity sales considered as extra income"
27+
COGENERATION_BOTTOMING_EXTRA_HEAT = 41, "Cogeneration Bottoming Cycle, Heat sales considered as extra income"
28+
COGENERATION_BOTTOMING_EXTRA_ELECTRICITY = 42, "Cogeneration Bottoming Cycle, Electricity sales considered as extra income"
29+
COGENERATION_PARALLEL_EXTRA_HEAT = 51, "Cogeneration Parallel Cycle, Heat sales considered as extra income"
30+
COGENERATION_PARALLEL_EXTRA_ELECTRICITY = 52, "Cogeneration Parallel Cycle, Electricity sales considered as extra income"
31+
2632
@staticmethod
2733
def get_end_use_option_from_input_string(input_string:str):
2834
"""
@@ -106,7 +112,7 @@ class ReservoirVolume(str, Enum):
106112
RES_VOL_ONLY = "Specify reservoir volume only"
107113

108114

109-
class WellDrillingCostCorrelation(str, Enum):
115+
class WellDrillingCostCorrelation(GeophiresInputEnum):
110116
"""Note: order must be retained since input is read as an int; first int arg is duplicative of order"""
111117

112118
VERTICAL_SMALL = 1, "vertical small diameter, baseline", 0.30212, 584.91124, 751368.47270
@@ -132,19 +138,11 @@ class WellDrillingCostCorrelation(str, Enum):
132138
def calculate_cost_MUSD(self, meters) -> float:
133139
return (self._c2 * meters ** 2 + self._c1 * meters + self._c0) * 1E-6
134140

135-
def __new__(cls, *args, **kwds):
136-
obj = str.__new__(cls)
137-
obj._value_ = args[1]
138-
return obj
139-
140141
def __init__(self, int_value: int, _: str, c2: float, c1: float, c0: float):
141-
self.int_value = int_value
142142
self._c2 = c2
143143
self._c1 = c1
144144
self._c0 = c0
145-
146-
def __eq__(self, other):
147-
return str(self) == str(other)
145+
super().__init__(int_value, _)
148146

149147
def calculate_cost_MUSD(self, meters) -> float:
150148
return (self._c2 * meters ** 2 + self._c1 * meters + self._c0) * 1E-6

0 commit comments

Comments
 (0)