Skip to content

Commit e2935d6

Browse files
EconomicModel values enum
1 parent cfa9279 commit e2935d6

File tree

3 files changed

+50
-20
lines changed

3 files changed

+50
-20
lines changed

src/geophires_x/Economics.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -609,12 +609,13 @@ def __init__(self, model: Model):
609609
# This is the default.
610610
self.econmodel = self.ParameterDict[self.econmodel.Name] = intParameter(
611611
"Economic Model",
612-
DefaultValue=EconomicModel.STANDARDIZED_LEVELIZED_COST,
612+
DefaultValue=EconomicModel.STANDARDIZED_LEVELIZED_COST.int_value,
613613
AllowableRange=[1, 2, 3, 4],
614+
ValuesEnum=EconomicModel,
614615
Required=True,
615616
ErrMessage="assume default economic model (2)",
616617
ToolTipText="Specify the economic model to calculate the levelized cost of energy." +
617-
" 1: Fixed Charge Rate Model, 2: Standard Levelized Cost Model, 3: BICYCLE Levelized Cost Model, 4: CLGS"
618+
'; '.join([f'{it.int_value}: {it.value}' for it in EconomicModel])
618619
)
619620
self.ccstimfixed = self.ParameterDict[self.ccstimfixed.Name] = floatParameter(
620621
"Reservoir Stimulation Capital Cost",
@@ -1853,17 +1854,10 @@ def read_parameters(self, model: Model) -> None:
18531854

18541855
# handle special cases
18551856
if ParameterToModify.Name == "Economic Model":
1856-
if ParameterReadIn.sValue == '1':
1857-
self.econmodel.value = EconomicModel.FCR
1858-
elif ParameterReadIn.sValue == '2':
1859-
# use standard LCOE/LCOH calculation as found on wikipedia (requires an interest rate).
1860-
self.econmodel.value = EconomicModel.STANDARDIZED_LEVELIZED_COST
1861-
elif ParameterReadIn.sValue == '3':
1862-
# use Bicycle LCOE/LCOH model (requires several financial input parameters)
1863-
self.econmodel.value = EconomicModel.BICYCLE
1864-
else:
1865-
self.econmodel.value = EconomicModel.CLGS # CLGS
1857+
self.econmodel.value = EconomicModel.from_input_string(ParameterReadIn.sValue)
1858+
18661859
elif ParameterToModify.Name == "Well Drilling Cost Correlation":
1860+
# TODO WellDrillingCostCorrelation.from_input_string
18671861
if ParameterReadIn.sValue == '1':
18681862
ParameterToModify.value = WellDrillingCostCorrelation.VERTICAL_SMALL
18691863
elif ParameterReadIn.sValue == '2':

src/geophires_x/OptionList.py

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,25 @@ def from_int(int_val):
7979
return member
8080

8181

82-
class EconomicModel(str, Enum):
83-
CLGS = "Simple (CLGS)"
84-
FCR = "Fixed Charge Rate (FCR)"
85-
STANDARDIZED_LEVELIZED_COST = "Standard Levelized Cost"
86-
BICYCLE = "BICYCLE"
82+
class EconomicModel(GeophiresInputEnum):
83+
FCR = 1, "Fixed Charge Rate (FCR)"
84+
STANDARDIZED_LEVELIZED_COST = 2, "Standard Levelized Cost"
85+
BICYCLE = 3, "BICYCLE"
86+
CLGS = 4, "Simple (CLGS)"
87+
88+
@staticmethod
89+
def from_int(int_val):
90+
for member in __class__:
91+
if member.int_value == int_val:
92+
return member
93+
94+
@staticmethod
95+
def from_input_string(input_string:str):
96+
for member in __class__:
97+
if input_string == str(member.int_value):
98+
return member
99+
100+
raise ValueError(f'Unknown Economic Model input value: {input_string}')
87101

88102

89103
class ReservoirModel(GeophiresInputEnum):

src/geophires_x_schema_generator/geophires-request.json

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,13 +1047,35 @@
10471047
"maximum": 200.0
10481048
},
10491049
"Economic Model": {
1050-
"description": "Specify the economic model to calculate the levelized cost of energy. 1: Fixed Charge Rate Model, 2: Standard Levelized Cost Model, 3: BICYCLE Levelized Cost Model, 4: CLGS",
1050+
"description": "Specify the economic model to calculate the levelized cost of energy.1: Fixed Charge Rate (FCR); 2: Standard Levelized Cost; 3: BICYCLE; 4: Simple (CLGS)",
10511051
"type": "integer",
10521052
"units": null,
10531053
"category": "Economics",
1054-
"default": "Standard Levelized Cost",
1054+
"default": 2,
10551055
"minimum": 1,
1056-
"maximum": 4
1056+
"maximum": 4,
1057+
"enum_values": [
1058+
{
1059+
"name": "FCR",
1060+
"value": "Fixed Charge Rate (FCR)",
1061+
"int_value": 1
1062+
},
1063+
{
1064+
"name": "STANDARDIZED_LEVELIZED_COST",
1065+
"value": "Standard Levelized Cost",
1066+
"int_value": 2
1067+
},
1068+
{
1069+
"name": "BICYCLE",
1070+
"value": "BICYCLE",
1071+
"int_value": 3
1072+
},
1073+
{
1074+
"name": "CLGS",
1075+
"value": "Simple (CLGS)",
1076+
"int_value": 4
1077+
}
1078+
]
10571079
},
10581080
"Reservoir Stimulation Capital Cost": {
10591081
"description": "Total reservoir stimulation capital cost",

0 commit comments

Comments
 (0)