|
5 | 5 | import numpy_financial as npf
|
6 | 6 | import geophires_x.Model as Model
|
7 | 7 | from geophires_x.OptionList import Configuration, WellDrillingCostCorrelation, EconomicModel, EndUseOptions, PlantType
|
8 |
| -from geophires_x.Parameter import intParameter, floatParameter, OutputParameter, ReadParameter, boolParameter |
| 8 | +from geophires_x.Parameter import intParameter, floatParameter, OutputParameter, ReadParameter, boolParameter, \ |
| 9 | + coerce_int_params_to_enum_values |
9 | 10 | from geophires_x.Units import *
|
10 | 11 |
|
11 | 12 |
|
@@ -608,12 +609,13 @@ def __init__(self, model: Model):
|
608 | 609 | # This is the default.
|
609 | 610 | self.econmodel = self.ParameterDict[self.econmodel.Name] = intParameter(
|
610 | 611 | "Economic Model",
|
611 |
| - DefaultValue=EconomicModel.STANDARDIZED_LEVELIZED_COST, |
| 612 | + DefaultValue=EconomicModel.STANDARDIZED_LEVELIZED_COST.int_value, |
612 | 613 | AllowableRange=[1, 2, 3, 4],
|
| 614 | + ValuesEnum=EconomicModel, |
613 | 615 | Required=True,
|
614 | 616 | ErrMessage="assume default economic model (2)",
|
615 | 617 | ToolTipText="Specify the economic model to calculate the levelized cost of energy." +
|
616 |
| - " 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]) |
617 | 619 | )
|
618 | 620 | self.ccstimfixed = self.ParameterDict[self.ccstimfixed.Name] = floatParameter(
|
619 | 621 | "Reservoir Stimulation Capital Cost",
|
@@ -989,12 +991,13 @@ def __init__(self, model: Model):
|
989 | 991 | )
|
990 | 992 | self.wellcorrelation = self.ParameterDict[self.wellcorrelation.Name] = intParameter(
|
991 | 993 | "Well Drilling Cost Correlation",
|
992 |
| - DefaultValue=WellDrillingCostCorrelation.VERTICAL_LARGE_INT1, |
| 994 | + DefaultValue=WellDrillingCostCorrelation.VERTICAL_LARGE_INT1.int_value, |
993 | 995 | AllowableRange=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17],
|
| 996 | + ValuesEnum=WellDrillingCostCorrelation, |
994 | 997 | UnitType=Units.NONE,
|
995 | 998 | ErrMessage="assume default well drilling cost correlation (10)",
|
996 | 999 | ToolTipText="Select the built-in well drilling and completion cost correlation: " +
|
997 |
| - '; '.join([f'{it.numerical_input_value}: {it.value}' for it in WellDrillingCostCorrelation]) |
| 1000 | + '; '.join([f'{it.int_value}: {it.value}' for it in WellDrillingCostCorrelation]) |
998 | 1001 | )
|
999 | 1002 |
|
1000 | 1003 | self.DoAddOnCalculations = self.ParameterDict[self.DoAddOnCalculations.Name] = boolParameter(
|
@@ -1851,53 +1854,11 @@ def read_parameters(self, model: Model) -> None:
|
1851 | 1854 |
|
1852 | 1855 | # handle special cases
|
1853 | 1856 | if ParameterToModify.Name == "Economic Model":
|
1854 |
| - if ParameterReadIn.sValue == '1': |
1855 |
| - self.econmodel.value = EconomicModel.FCR |
1856 |
| - elif ParameterReadIn.sValue == '2': |
1857 |
| - # use standard LCOE/LCOH calculation as found on wikipedia (requires an interest rate). |
1858 |
| - self.econmodel.value = EconomicModel.STANDARDIZED_LEVELIZED_COST |
1859 |
| - elif ParameterReadIn.sValue == '3': |
1860 |
| - # use Bicycle LCOE/LCOH model (requires several financial input parameters) |
1861 |
| - self.econmodel.value = EconomicModel.BICYCLE |
1862 |
| - else: |
1863 |
| - self.econmodel.value = EconomicModel.CLGS # CLGS |
| 1857 | + self.econmodel.value = EconomicModel.from_input_string(ParameterReadIn.sValue) |
| 1858 | + |
1864 | 1859 | elif ParameterToModify.Name == "Well Drilling Cost Correlation":
|
1865 |
| - if ParameterReadIn.sValue == '1': |
1866 |
| - ParameterToModify.value = WellDrillingCostCorrelation.VERTICAL_SMALL |
1867 |
| - elif ParameterReadIn.sValue == '2': |
1868 |
| - ParameterToModify.value = WellDrillingCostCorrelation.DEVIATED_SMALL |
1869 |
| - elif ParameterReadIn.sValue == '3': |
1870 |
| - ParameterToModify.value = WellDrillingCostCorrelation.VERTICAL_LARGE |
1871 |
| - elif ParameterReadIn.sValue == '4': |
1872 |
| - ParameterToModify.value = WellDrillingCostCorrelation.DEVIATED_LARGE |
1873 |
| - elif ParameterReadIn.sValue == '5': |
1874 |
| - ParameterToModify.value = WellDrillingCostCorrelation.SIMPLE |
1875 |
| - elif ParameterReadIn.sValue == '6': |
1876 |
| - ParameterToModify.value = WellDrillingCostCorrelation.VERTICAL_SMALL_INT1 |
1877 |
| - elif ParameterReadIn.sValue == '7': |
1878 |
| - ParameterToModify.value = WellDrillingCostCorrelation.VERTICAL_SMALL_INT2 |
1879 |
| - elif ParameterReadIn.sValue == '8': |
1880 |
| - ParameterToModify.value = WellDrillingCostCorrelation.DEVIATED_SMALL_INT1 |
1881 |
| - elif ParameterReadIn.sValue == '9': |
1882 |
| - ParameterToModify.value = WellDrillingCostCorrelation.DEVIATED_SMALL_INT2 |
1883 |
| - elif ParameterReadIn.sValue == '10': |
1884 |
| - ParameterToModify.value = WellDrillingCostCorrelation.VERTICAL_LARGE_INT1 |
1885 |
| - elif ParameterReadIn.sValue == '11': |
1886 |
| - ParameterToModify.value = WellDrillingCostCorrelation.VERTICAL_LARGE_INT2 |
1887 |
| - elif ParameterReadIn.sValue == '12': |
1888 |
| - ParameterToModify.value = WellDrillingCostCorrelation.DEVIATED_LARGE_INT1 |
1889 |
| - elif ParameterReadIn.sValue == '13': |
1890 |
| - ParameterToModify.value = WellDrillingCostCorrelation.DEVIATED_LARGE_INT2 |
1891 |
| - elif ParameterReadIn.sValue == '14': |
1892 |
| - ParameterToModify.value = WellDrillingCostCorrelation.VERTICAL_SMALL_IDEAL |
1893 |
| - elif ParameterReadIn.sValue == '15': |
1894 |
| - ParameterToModify.value = WellDrillingCostCorrelation.DEVIATED_SMALL_IDEAL |
1895 |
| - elif ParameterReadIn.sValue == '16': |
1896 |
| - ParameterToModify.value = WellDrillingCostCorrelation.VERTICAL_LARGE_IDEAL |
1897 |
| - elif ParameterReadIn.sValue == '17': |
1898 |
| - ParameterToModify.value = WellDrillingCostCorrelation.DEVIATED_LARGE_IDEAL |
1899 |
| - else: |
1900 |
| - ParameterToModify.value = WellDrillingCostCorrelation.SIMPLE # Assuming 'SIMPLE' is still a valid option |
| 1860 | + ParameterToModify.value = WellDrillingCostCorrelation.from_input_string(ParameterReadIn.sValue) |
| 1861 | + |
1901 | 1862 | elif ParameterToModify.Name == "Reservoir Stimulation Capital Cost Adjustment Factor":
|
1902 | 1863 | if self.ccstimfixed.Valid and ParameterToModify.Valid:
|
1903 | 1864 | print("Warning: Provided reservoir stimulation cost adjustment factor not considered" +
|
@@ -2222,6 +2183,8 @@ def read_parameters(self, model: Model) -> None:
|
2222 | 2183 | self.DoSDACGTCalculations.value = True
|
2223 | 2184 | break
|
2224 | 2185 |
|
| 2186 | + coerce_int_params_to_enum_values(self.ParameterDict) |
| 2187 | + |
2225 | 2188 | model.logger.info(f'complete {__class__!s}: {sys._getframe().f_code.co_name}')
|
2226 | 2189 |
|
2227 | 2190 | def Calculate(self, model: Model) -> None:
|
|
0 commit comments