2
2
from enum import Enum
3
3
4
4
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
+ """
14
9
15
10
def __new__ (cls , * args , ** kwds ):
16
11
obj = str .__new__ (cls )
@@ -23,6 +18,17 @@ def __init__(self, int_value: int, _: str):
23
18
def __eq__ (self , other ):
24
19
return str (self ) == str (other )
25
20
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
+
26
32
@staticmethod
27
33
def get_end_use_option_from_input_string (input_string :str ):
28
34
"""
@@ -106,7 +112,7 @@ class ReservoirVolume(str, Enum):
106
112
RES_VOL_ONLY = "Specify reservoir volume only"
107
113
108
114
109
- class WellDrillingCostCorrelation (str , Enum ):
115
+ class WellDrillingCostCorrelation (GeophiresInputEnum ):
110
116
"""Note: order must be retained since input is read as an int; first int arg is duplicative of order"""
111
117
112
118
VERTICAL_SMALL = 1 , "vertical small diameter, baseline" , 0.30212 , 584.91124 , 751368.47270
@@ -132,19 +138,11 @@ class WellDrillingCostCorrelation(str, Enum):
132
138
def calculate_cost_MUSD (self , meters ) -> float :
133
139
return (self ._c2 * meters ** 2 + self ._c1 * meters + self ._c0 ) * 1E-6
134
140
135
- def __new__ (cls , * args , ** kwds ):
136
- obj = str .__new__ (cls )
137
- obj ._value_ = args [1 ]
138
- return obj
139
-
140
141
def __init__ (self , int_value : int , _ : str , c2 : float , c1 : float , c0 : float ):
141
- self .int_value = int_value
142
142
self ._c2 = c2
143
143
self ._c1 = c1
144
144
self ._c0 = c0
145
-
146
- def __eq__ (self , other ):
147
- return str (self ) == str (other )
145
+ super ().__init__ (int_value , _ )
148
146
149
147
def calculate_cost_MUSD (self , meters ) -> float :
150
148
return (self ._c2 * meters ** 2 + self ._c1 * meters + self ._c0 ) * 1E-6
0 commit comments