diff --git a/.gitignore b/.gitignore index 71db5ce..b582d59 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,7 @@ files/defaults/ .mypy_cache *.zip + +*.dll + +*.lib diff --git a/docs/lists/models.rst b/docs/lists/models.rst index 8a9bd64..7763327 100644 --- a/docs/lists/models.rst +++ b/docs/lists/models.rst @@ -62,7 +62,7 @@ Geothermal monthly and hourly models using general power block code from TRNSYS Type 224 code by M.Wagner, and some GETEM model code. :doc:`../modules/GeothermalCosts` (HD) - Geothermal monthly and hourly models using general power block code from TRNSYS Type 224 code by M.Wagner, and some GETEM model code. + Geothermal cost equations. :doc:`../modules/Grid` (HD) Grid model diff --git a/files/SAM_api.dll b/files/SAM_api.dll deleted file mode 100644 index 59dbb3e..0000000 Binary files a/files/SAM_api.dll and /dev/null differ diff --git a/files/SAM_api.lib b/files/SAM_api.lib deleted file mode 100644 index c4d7c2e..0000000 Binary files a/files/SAM_api.lib and /dev/null differ diff --git a/files/ssc.dll b/files/ssc.dll deleted file mode 100644 index 40b0702..0000000 Binary files a/files/ssc.dll and /dev/null differ diff --git a/files/ssc.lib b/files/ssc.lib deleted file mode 100644 index b1878de..0000000 Binary files a/files/ssc.lib and /dev/null differ diff --git a/files/sscd.dll b/files/sscd.dll deleted file mode 100644 index 09e1121..0000000 Binary files a/files/sscd.dll and /dev/null differ diff --git a/files/sscd.lib b/files/sscd.lib deleted file mode 100644 index 41d3a41..0000000 Binary files a/files/sscd.lib and /dev/null differ diff --git a/modules/Geothermal.c b/modules/Geothermal.c index b6fcebc..54339e7 100644 --- a/modules/Geothermal.c +++ b/modules/Geothermal.c @@ -1013,6 +1013,18 @@ GeoHourly_set_stim_success_rate(VarGroupObject *self, PyObject *value, void *clo return PySAM_double_setter(value, SAM_Geothermal_GeoHourly_stim_success_rate_nset, self->data_ptr); } +static PyObject * +GeoHourly_get_stimulation_type(VarGroupObject *self, void *closure) +{ + return PySAM_double_getter(SAM_Geothermal_GeoHourly_stimulation_type_nget, self->data_ptr); +} + +static int +GeoHourly_set_stimulation_type(VarGroupObject *self, PyObject *value, void *closure) +{ + return PySAM_double_setter(value, SAM_Geothermal_GeoHourly_stimulation_type_nset, self->data_ptr); +} + static PyObject * GeoHourly_get_subsurface_water_loss(VarGroupObject *self, void *closure) { @@ -1344,6 +1356,9 @@ static PyGetSetDef GeoHourly_getset[] = { {"stim_success_rate", (getter)GeoHourly_get_stim_success_rate,(setter)GeoHourly_set_stim_success_rate, PyDoc_STR("*float*: Stimulation success rate [%]\n\nThe value of the following variables depends on ``stim_success_rate``:\n\n\t - num_wells_getem\n"), NULL}, +{"stimulation_type", (getter)GeoHourly_get_stimulation_type,(setter)GeoHourly_set_stimulation_type, + PyDoc_STR("*float*: Which wells are stimulated [0/1/2/3]\n\n**Options:**\n0=Injection,1=Production,2=Both,3=Neither\n\n**Required:**\nFalse. Automatically set to 3 if not assigned explicitly or loaded from defaults."), + NULL}, {"subsurface_water_loss", (getter)GeoHourly_get_subsurface_water_loss,(setter)GeoHourly_set_subsurface_water_loss, PyDoc_STR("*float*: Subsurface water loss [%]\n\n**Required:**\nTrue\n\nThe value of the following variables depends on ``subsurface_water_loss``:\n\n\t - num_wells_getem\n"), NULL}, diff --git a/modules/GeothermalCosts.c b/modules/GeothermalCosts.c index 9101d0c..def4bd6 100644 --- a/modules/GeothermalCosts.c +++ b/modules/GeothermalCosts.c @@ -5,6 +5,8 @@ #include "PySAM_utils.h" +#include "GeothermalCosts_eqns.c" + /* * GeoHourly Group @@ -209,6 +211,78 @@ GeoHourly_set_flash_count(VarGroupObject *self, PyObject *value, void *closure) return PySAM_double_setter(value, SAM_GeothermalCosts_GeoHourly_flash_count_nset, self->data_ptr); } +static PyObject * +GeoHourly_get_geotherm_cost_conf_multiplier(VarGroupObject *self, void *closure) +{ + return PySAM_double_getter(SAM_GeothermalCosts_GeoHourly_geotherm_cost_conf_multiplier_nget, self->data_ptr); +} + +static int +GeoHourly_set_geotherm_cost_conf_multiplier(VarGroupObject *self, PyObject *value, void *closure) +{ + return PySAM_double_setter(value, SAM_GeothermalCosts_GeoHourly_geotherm_cost_conf_multiplier_nset, self->data_ptr); +} + +static PyObject * +GeoHourly_get_geotherm_cost_conf_non_drill(VarGroupObject *self, void *closure) +{ + return PySAM_double_getter(SAM_GeothermalCosts_GeoHourly_geotherm_cost_conf_non_drill_nget, self->data_ptr); +} + +static int +GeoHourly_set_geotherm_cost_conf_non_drill(VarGroupObject *self, PyObject *value, void *closure) +{ + return PySAM_double_setter(value, SAM_GeothermalCosts_GeoHourly_geotherm_cost_conf_non_drill_nset, self->data_ptr); +} + +static PyObject * +GeoHourly_get_geotherm_cost_conf_num_wells(VarGroupObject *self, void *closure) +{ + return PySAM_double_getter(SAM_GeothermalCosts_GeoHourly_geotherm_cost_conf_num_wells_nget, self->data_ptr); +} + +static int +GeoHourly_set_geotherm_cost_conf_num_wells(VarGroupObject *self, PyObject *value, void *closure) +{ + return PySAM_double_setter(value, SAM_GeothermalCosts_GeoHourly_geotherm_cost_conf_num_wells_nset, self->data_ptr); +} + +static PyObject * +GeoHourly_get_geotherm_cost_expl_multiplier(VarGroupObject *self, void *closure) +{ + return PySAM_double_getter(SAM_GeothermalCosts_GeoHourly_geotherm_cost_expl_multiplier_nget, self->data_ptr); +} + +static int +GeoHourly_set_geotherm_cost_expl_multiplier(VarGroupObject *self, PyObject *value, void *closure) +{ + return PySAM_double_setter(value, SAM_GeothermalCosts_GeoHourly_geotherm_cost_expl_multiplier_nset, self->data_ptr); +} + +static PyObject * +GeoHourly_get_geotherm_cost_expl_non_drill(VarGroupObject *self, void *closure) +{ + return PySAM_double_getter(SAM_GeothermalCosts_GeoHourly_geotherm_cost_expl_non_drill_nget, self->data_ptr); +} + +static int +GeoHourly_set_geotherm_cost_expl_non_drill(VarGroupObject *self, PyObject *value, void *closure) +{ + return PySAM_double_setter(value, SAM_GeothermalCosts_GeoHourly_geotherm_cost_expl_non_drill_nset, self->data_ptr); +} + +static PyObject * +GeoHourly_get_geotherm_cost_expl_num_wells(VarGroupObject *self, void *closure) +{ + return PySAM_double_getter(SAM_GeothermalCosts_GeoHourly_geotherm_cost_expl_num_wells_nget, self->data_ptr); +} + +static int +GeoHourly_set_geotherm_cost_expl_num_wells(VarGroupObject *self, PyObject *value, void *closure) +{ + return PySAM_double_setter(value, SAM_GeothermalCosts_GeoHourly_geotherm_cost_expl_num_wells_nset, self->data_ptr); +} + static PyObject * GeoHourly_get_geotherm_cost_inj_cost_curve(VarGroupObject *self, void *closure) { @@ -293,6 +367,18 @@ GeoHourly_set_geotherm_cost_prod_cost_curve_welltype(VarGroupObject *self, PyObj return PySAM_double_setter(value, SAM_GeothermalCosts_GeoHourly_geotherm_cost_prod_cost_curve_welltype_nset, self->data_ptr); } +static PyObject * +GeoHourly_get_geotherm_cost_prod_req(VarGroupObject *self, void *closure) +{ + return PySAM_double_getter(SAM_GeothermalCosts_GeoHourly_geotherm_cost_prod_req_nget, self->data_ptr); +} + +static int +GeoHourly_set_geotherm_cost_prod_req(VarGroupObject *self, PyObject *value, void *closure) +{ + return PySAM_double_setter(value, SAM_GeothermalCosts_GeoHourly_geotherm_cost_prod_req_nset, self->data_ptr); +} + static PyObject * GeoHourly_get_geotherm_cost_prod_wells_drilled(VarGroupObject *self, void *closure) { @@ -305,6 +391,54 @@ GeoHourly_set_geotherm_cost_prod_wells_drilled(VarGroupObject *self, PyObject *v return PySAM_double_setter(value, SAM_GeothermalCosts_GeoHourly_geotherm_cost_prod_wells_drilled_nset, self->data_ptr); } +static PyObject * +GeoHourly_get_geotherm_cost_pump_depth(VarGroupObject *self, void *closure) +{ + return PySAM_double_getter(SAM_GeothermalCosts_GeoHourly_geotherm_cost_pump_depth_nget, self->data_ptr); +} + +static int +GeoHourly_set_geotherm_cost_pump_depth(VarGroupObject *self, PyObject *value, void *closure) +{ + return PySAM_double_setter(value, SAM_GeothermalCosts_GeoHourly_geotherm_cost_pump_depth_nset, self->data_ptr); +} + +static PyObject * +GeoHourly_get_geotherm_cost_pump_fixed(VarGroupObject *self, void *closure) +{ + return PySAM_double_getter(SAM_GeothermalCosts_GeoHourly_geotherm_cost_pump_fixed_nget, self->data_ptr); +} + +static int +GeoHourly_set_geotherm_cost_pump_fixed(VarGroupObject *self, PyObject *value, void *closure) +{ + return PySAM_double_setter(value, SAM_GeothermalCosts_GeoHourly_geotherm_cost_pump_fixed_nset, self->data_ptr); +} + +static PyObject * +GeoHourly_get_geotherm_cost_pump_per_foot(VarGroupObject *self, void *closure) +{ + return PySAM_double_getter(SAM_GeothermalCosts_GeoHourly_geotherm_cost_pump_per_foot_nget, self->data_ptr); +} + +static int +GeoHourly_set_geotherm_cost_pump_per_foot(VarGroupObject *self, PyObject *value, void *closure) +{ + return PySAM_double_setter(value, SAM_GeothermalCosts_GeoHourly_geotherm_cost_pump_per_foot_nset, self->data_ptr); +} + +static PyObject * +GeoHourly_get_geotherm_cost_stim_non_drill(VarGroupObject *self, void *closure) +{ + return PySAM_double_getter(SAM_GeothermalCosts_GeoHourly_geotherm_cost_stim_non_drill_nget, self->data_ptr); +} + +static int +GeoHourly_set_geotherm_cost_stim_non_drill(VarGroupObject *self, PyObject *value, void *closure) +{ + return PySAM_double_setter(value, SAM_GeothermalCosts_GeoHourly_geotherm_cost_stim_non_drill_nset, self->data_ptr); +} + static PyObject * GeoHourly_get_gross_cost_output(VarGroupObject *self, void *closure) { @@ -341,6 +475,30 @@ GeoHourly_set_hp_flash_pressure(VarGroupObject *self, PyObject *value, void *clo return PySAM_double_setter(value, SAM_GeothermalCosts_GeoHourly_hp_flash_pressure_nset, self->data_ptr); } +static PyObject * +GeoHourly_get_inj_num_pumps(VarGroupObject *self, void *closure) +{ + return PySAM_double_getter(SAM_GeothermalCosts_GeoHourly_inj_num_pumps_nget, self->data_ptr); +} + +static int +GeoHourly_set_inj_num_pumps(VarGroupObject *self, PyObject *value, void *closure) +{ + return PySAM_double_setter(value, SAM_GeothermalCosts_GeoHourly_inj_num_pumps_nset, self->data_ptr); +} + +static PyObject * +GeoHourly_get_inj_pump_hp(VarGroupObject *self, void *closure) +{ + return PySAM_double_getter(SAM_GeothermalCosts_GeoHourly_inj_pump_hp_nget, self->data_ptr); +} + +static int +GeoHourly_set_inj_pump_hp(VarGroupObject *self, PyObject *value, void *closure) +{ + return PySAM_double_setter(value, SAM_GeothermalCosts_GeoHourly_inj_pump_hp_nset, self->data_ptr); +} + static PyObject * GeoHourly_get_lp_flash_pressure(VarGroupObject *self, void *closure) { @@ -413,6 +571,18 @@ GeoHourly_set_pressure_ratio_3(VarGroupObject *self, PyObject *value, void *clos return PySAM_double_setter(value, SAM_GeothermalCosts_GeoHourly_pressure_ratio_3_nset, self->data_ptr); } +static PyObject * +GeoHourly_get_pump_size_hp(VarGroupObject *self, void *closure) +{ + return PySAM_double_getter(SAM_GeothermalCosts_GeoHourly_pump_size_hp_nget, self->data_ptr); +} + +static int +GeoHourly_set_pump_size_hp(VarGroupObject *self, PyObject *value, void *closure) +{ + return PySAM_double_setter(value, SAM_GeothermalCosts_GeoHourly_pump_size_hp_nset, self->data_ptr); +} + static PyObject * GeoHourly_get_qCondenser(VarGroupObject *self, void *closure) { @@ -603,6 +773,24 @@ static PyGetSetDef GeoHourly_getset[] = { {"flash_count", (getter)GeoHourly_get_flash_count,(setter)GeoHourly_set_flash_count, PyDoc_STR("*float*: Flash Count [(1 -2)]\n\n**Required:**\nRequired if conversion_type=1"), NULL}, +{"geotherm_cost_conf_multiplier", (getter)GeoHourly_get_geotherm_cost_conf_multiplier,(setter)GeoHourly_set_geotherm_cost_conf_multiplier, + PyDoc_STR("*float*: Confirmation cost multiplier\n\n**Required:**\nRequired if calc_drill_costs=1"), + NULL}, +{"geotherm_cost_conf_non_drill", (getter)GeoHourly_get_geotherm_cost_conf_non_drill,(setter)GeoHourly_set_geotherm_cost_conf_non_drill, + PyDoc_STR("*float*: Confirmation non drilling costs [$]\n\n**Required:**\nRequired if calc_drill_costs=1"), + NULL}, +{"geotherm_cost_conf_num_wells", (getter)GeoHourly_get_geotherm_cost_conf_num_wells,(setter)GeoHourly_set_geotherm_cost_conf_num_wells, + PyDoc_STR("*float*: Number of confirmation wells\n\n**Required:**\nRequired if calc_drill_costs=1"), + NULL}, +{"geotherm_cost_expl_multiplier", (getter)GeoHourly_get_geotherm_cost_expl_multiplier,(setter)GeoHourly_set_geotherm_cost_expl_multiplier, + PyDoc_STR("*float*: Exploration cost multiplier\n\n**Required:**\nRequired if calc_drill_costs=1"), + NULL}, +{"geotherm_cost_expl_non_drill", (getter)GeoHourly_get_geotherm_cost_expl_non_drill,(setter)GeoHourly_set_geotherm_cost_expl_non_drill, + PyDoc_STR("*float*: Exploration non drilling costs [$]\n\n**Required:**\nRequired if calc_drill_costs=1"), + NULL}, +{"geotherm_cost_expl_num_wells", (getter)GeoHourly_get_geotherm_cost_expl_num_wells,(setter)GeoHourly_set_geotherm_cost_expl_num_wells, + PyDoc_STR("*float*: Number of exploration wells\n\n**Required:**\nRequired if calc_drill_costs=1"), + NULL}, {"geotherm_cost_inj_cost_curve", (getter)GeoHourly_get_geotherm_cost_inj_cost_curve,(setter)GeoHourly_set_geotherm_cost_inj_cost_curve, PyDoc_STR("*float*: Injection well diameter type [0/1]\n\n**Options:**\n0=LargerDiameter,1=SmallerDiameter\n\n**Required:**\nRequired if calc_drill_costs=1"), NULL}, @@ -624,9 +812,24 @@ static PyGetSetDef GeoHourly_getset[] = { {"geotherm_cost_prod_cost_curve_welltype", (getter)GeoHourly_get_geotherm_cost_prod_cost_curve_welltype,(setter)GeoHourly_set_geotherm_cost_prod_cost_curve_welltype, PyDoc_STR("*float*: Production well type [0/1]\n\n**Required:**\nRequired if calc_drill_costs=1"), NULL}, +{"geotherm_cost_prod_req", (getter)GeoHourly_get_geotherm_cost_prod_req,(setter)GeoHourly_set_geotherm_cost_prod_req, + PyDoc_STR("*float*: Number of production wells required"), + NULL}, {"geotherm_cost_prod_wells_drilled", (getter)GeoHourly_get_geotherm_cost_prod_wells_drilled,(setter)GeoHourly_set_geotherm_cost_prod_wells_drilled, PyDoc_STR("*float*: Number of drilled production wells [0/1]\n\n**Options:**\n0=LargerDiameter,1=SmallerDiameter\n\n**Required:**\nRequired if calc_drill_costs=1"), NULL}, +{"geotherm_cost_pump_depth", (getter)GeoHourly_get_geotherm_cost_pump_depth,(setter)GeoHourly_set_geotherm_cost_pump_depth, + PyDoc_STR("*float*: Pump depth [ft]"), + NULL}, +{"geotherm_cost_pump_fixed", (getter)GeoHourly_get_geotherm_cost_pump_fixed,(setter)GeoHourly_set_geotherm_cost_pump_fixed, + PyDoc_STR("*float*: Fixed pump workover and casing cost [$]"), + NULL}, +{"geotherm_cost_pump_per_foot", (getter)GeoHourly_get_geotherm_cost_pump_per_foot,(setter)GeoHourly_set_geotherm_cost_pump_per_foot, + PyDoc_STR("*float*: Pump cost per foot [$/ft]"), + NULL}, +{"geotherm_cost_stim_non_drill", (getter)GeoHourly_get_geotherm_cost_stim_non_drill,(setter)GeoHourly_set_geotherm_cost_stim_non_drill, + PyDoc_STR("*float*: Stimulation non drilling costs [$]\n\n**Required:**\nRequired if calc_drill_costs=1"), + NULL}, {"gross_cost_output", (getter)GeoHourly_get_gross_cost_output,(setter)GeoHourly_set_gross_cost_output, PyDoc_STR("*float*: Gross output from GETEM for cost calculations [MW]\n\n**Required:**\nTrue"), NULL}, @@ -636,6 +839,12 @@ static PyGetSetDef GeoHourly_getset[] = { {"hp_flash_pressure", (getter)GeoHourly_get_hp_flash_pressure,(setter)GeoHourly_set_hp_flash_pressure, PyDoc_STR("*float*: HP Flash Pressure [psia]\n\n**Required:**\nRequired if conversion_type=1"), NULL}, +{"inj_num_pumps", (getter)GeoHourly_get_inj_num_pumps,(setter)GeoHourly_set_inj_num_pumps, + PyDoc_STR("*float*: Number of injection pumps [p]"), + NULL}, +{"inj_pump_hp", (getter)GeoHourly_get_inj_pump_hp,(setter)GeoHourly_set_inj_pump_hp, + PyDoc_STR("*float*: Injection pump power [hp]"), + NULL}, {"lp_flash_pressure", (getter)GeoHourly_get_lp_flash_pressure,(setter)GeoHourly_set_lp_flash_pressure, PyDoc_STR("*float*: LP Flash Pressure [psia]\n\n**Required:**\nRequired if conversion_type=1"), NULL}, @@ -654,6 +863,9 @@ static PyGetSetDef GeoHourly_getset[] = { {"pressure_ratio_3", (getter)GeoHourly_get_pressure_ratio_3,(setter)GeoHourly_set_pressure_ratio_3, PyDoc_STR("*float*: Suction Steam Ratio 3\n\n**Required:**\nRequired if conversion_type=1"), NULL}, +{"pump_size_hp", (getter)GeoHourly_get_pump_size_hp,(setter)GeoHourly_set_pump_size_hp, + PyDoc_STR("*float*: Production pump power [hp]"), + NULL}, {"qCondenser", (getter)GeoHourly_get_qCondenser,(setter)GeoHourly_set_qCondenser, PyDoc_STR("*float*: Condenser Heat Rejected [btu/h]\n\n**Required:**\nRequired if conversion_type=1"), NULL}, @@ -820,6 +1032,24 @@ Outputs_get_baseline_cost(VarGroupObject *self, void *closure) return PySAM_double_getter(SAM_GeothermalCosts_Outputs_baseline_cost_nget, self->data_ptr); } +static PyObject * +Outputs_get_conf_total_cost(VarGroupObject *self, void *closure) +{ + return PySAM_double_getter(SAM_GeothermalCosts_Outputs_conf_total_cost_nget, self->data_ptr); +} + +static PyObject * +Outputs_get_drilling_total_cost(VarGroupObject *self, void *closure) +{ + return PySAM_double_getter(SAM_GeothermalCosts_Outputs_drilling_total_cost_nget, self->data_ptr); +} + +static PyObject * +Outputs_get_expl_total_cost(VarGroupObject *self, void *closure) +{ + return PySAM_double_getter(SAM_GeothermalCosts_Outputs_expl_total_cost_nget, self->data_ptr); +} + static PyObject * Outputs_get_inj_total_cost(VarGroupObject *self, void *closure) { @@ -832,15 +1062,51 @@ Outputs_get_prod_total_cost(VarGroupObject *self, void *closure) return PySAM_double_getter(SAM_GeothermalCosts_Outputs_prod_total_cost_nget, self->data_ptr); } +static PyObject * +Outputs_get_stim_total_cost(VarGroupObject *self, void *closure) +{ + return PySAM_double_getter(SAM_GeothermalCosts_Outputs_stim_total_cost_nget, self->data_ptr); +} + +static PyObject * +Outputs_get_total_gathering_cost(VarGroupObject *self, void *closure) +{ + return PySAM_double_getter(SAM_GeothermalCosts_Outputs_total_gathering_cost_nget, self->data_ptr); +} + +static PyObject * +Outputs_get_total_pump_cost(VarGroupObject *self, void *closure) +{ + return PySAM_double_getter(SAM_GeothermalCosts_Outputs_total_pump_cost_nget, self->data_ptr); +} + static PyGetSetDef Outputs_getset[] = { {"baseline_cost", (getter)Outputs_get_baseline_cost,(setter)0, - PyDoc_STR("*float*: Baseline Cost [$/kW]"), + PyDoc_STR("*float*: Baseline cost [$/kW]"), + NULL}, +{"conf_total_cost", (getter)Outputs_get_conf_total_cost,(setter)0, + PyDoc_STR("*float*: Total confirmation well cost [$]"), + NULL}, +{"drilling_total_cost", (getter)Outputs_get_drilling_total_cost,(setter)0, + PyDoc_STR("*float*: Total drilling cost [$]"), + NULL}, +{"expl_total_cost", (getter)Outputs_get_expl_total_cost,(setter)0, + PyDoc_STR("*float*: Total exploration well cost [$]"), NULL}, {"inj_total_cost", (getter)Outputs_get_inj_total_cost,(setter)0, - PyDoc_STR("*float*: Total Injection well cost [$/kW]"), + PyDoc_STR("*float*: Total injection well cost [$]"), NULL}, {"prod_total_cost", (getter)Outputs_get_prod_total_cost,(setter)0, - PyDoc_STR("*float*: Total Production well cost [$/kW]"), + PyDoc_STR("*float*: Total production well cost [$]"), + NULL}, +{"stim_total_cost", (getter)Outputs_get_stim_total_cost,(setter)0, + PyDoc_STR("*float*: Total stimulation well cost [$]"), + NULL}, +{"total_gathering_cost", (getter)Outputs_get_total_gathering_cost,(setter)0, + PyDoc_STR("*float*: Total gathering well cost [$/kW]"), + NULL}, +{"total_pump_cost", (getter)Outputs_get_total_pump_cost,(setter)0, + PyDoc_STR("*float*: Total pumping cost [$/kW]"), NULL}, {NULL} /* Sentinel */ }; @@ -1019,6 +1285,8 @@ static PyMethodDef GeothermalCosts_methods[] = { PyDoc_STR("unassign(name) -> None\n Unassign a value in any of the variable groups.")}, {"get_data_ptr", (PyCFunction)GeothermalCosts_get_data_ptr, METH_VARARGS, PyDoc_STR("get_data_ptr() -> Pointer\n Get ssc_data_t pointer")}, + {"getem_om_cost_calc", (PyCFunction)getem_om_cost_calc, METH_VARARGS | METH_KEYWORDS, + getem_om_cost_calc_doc}, {NULL, NULL} /* sentinel */ }; diff --git a/src/GeothermalCosts_eqns.c b/src/GeothermalCosts_eqns.c new file mode 100644 index 0000000..b34af56 --- /dev/null +++ b/src/GeothermalCosts_eqns.c @@ -0,0 +1,111 @@ +#include "SAM_eqns.h" + +char getem_om_cost_calc_doc[] = + "Add documentation here \\n\\n" + "Input: var_table with key-value pairs\\n" + " 'baseline_cost': double [$] \\n" + " 'drilling_cost': double [$] \\n" + " 'field_gathering_system_cost': double [units] \\n" + " 'num_wells': double [units] \\n" + " 'water_loss': double [units] \\n" + " 'total_installed_cost': double [$] \\n" + " 'pump_cost_install': double [units] \\n" + " 'pump_only_cost': double [units] \\n" + " 'pump_type': double [units] \\n" + " 'pump_depth': double \\n" + "Output: key-value pairs added to var_table\\n" + " 'total_getem_om_cost': double [$]"; + +static PyObject* getem_om_cost_calc(PyObject *self, PyObject *args, PyObject *keywds) +{ + double baseline_cost; + double drilling_cost; + double field_gathering_system_cost; + double num_wells; + double water_loss; + double total_installed_cost; + double pump_cost_install; + double pump_only_cost; + double pump_type; + double pump_depth; + + static char *kwlist[] = {"baseline_cost", "drilling_cost", + "field_gathering_system_cost", "num_wells", "water_loss", "total_installed_cost", + "pump_cost_install", "pump_only_cost", "pump_type", "pump_depth", NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, keywds, "dddddddddd", kwlist, + &baseline_cost, &drilling_cost, + &field_gathering_system_cost, &num_wells, &water_loss, &total_installed_cost, + &pump_cost_install, &pump_only_cost, &pump_type, &pump_depth)) + return NULL; + + // these variables are ones available as inputs to Geothermal_costs. So use those values directly + // instead of expecting user to provide them + double gross_output; + double conversion_type; + double ppi_base_year; + double cwflow; + double GF_flowrate; + + VarGroupObject* self_obj = (VarGroupObject*)self; + SAM_error error = new_error(); + gross_output = (int)SAM_GeothermalCosts_GeoHourly_gross_output_nget(self_obj->data_ptr, &error); + if (PySAM_has_error(error)){ + return NULL; + } + error = new_error(); + conversion_type = (int)SAM_GeothermalCosts_GeoHourly_conversion_type_nget(self_obj->data_ptr, &error); + if (PySAM_has_error(error)){ + return NULL; + } + error = new_error(); + ppi_base_year = (int)SAM_GeothermalCosts_GeoHourly_ppi_base_year_nget(self_obj->data_ptr, &error); + if (PySAM_has_error(error)){ + return NULL; + } + error = new_error(); + cwflow = (int)SAM_GeothermalCosts_GeoHourly_cwflow_nget(self_obj->data_ptr, &error); + if (PySAM_has_error(error)){ + return NULL; + } + error = new_error(); + GF_flowrate = (int)SAM_GeothermalCosts_GeoHourly_GF_flowrate_nget(self_obj->data_ptr, &error); + if (PySAM_has_error(error)){ + return NULL; + } + + SAM_table data = SAM_table_construct(NULL); + SAM_table_set_num(data, "gross_output", gross_output, NULL); + SAM_table_set_num(data, "conversion_type", conversion_type, NULL); + SAM_table_set_num(data, "baseline_cost", baseline_cost, NULL); + SAM_table_set_num(data, "ppi_base_year", ppi_base_year, NULL); + SAM_table_set_num(data, "cwflow", cwflow, NULL); + SAM_table_set_num(data, "drilling_cost", drilling_cost, NULL); + SAM_table_set_num(data, "GF_flowrate", GF_flowrate, NULL); + SAM_table_set_num(data, "field_gathering_system_cost", field_gathering_system_cost, NULL); + SAM_table_set_num(data, "num_wells", num_wells, NULL); + SAM_table_set_num(data, "water_loss", water_loss, NULL); + SAM_table_set_num(data, "total_installed_cost", total_installed_cost, NULL); + SAM_table_set_num(data, "pump_cost_install", pump_cost_install, NULL); + SAM_table_set_num(data, "pump_only_cost", pump_only_cost, NULL); + SAM_table_set_num(data, "pump_type", pump_type, NULL); + SAM_table_set_num(data, "pump_depth", pump_depth, NULL); + + error = new_error(); + SAM_getem_om_cost_calc_eqn(data, &error); + + if (PySAM_has_error(error)){ + return NULL; + } + + error = new_error(); + double total_getem_om_cost = SAM_table_get_num(data, "total_getem_om_cost", &error); + + if (PySAM_has_error(error)){ + return NULL; + } + + SAM_table_destruct(data, NULL); + + return PyFloat_FromDouble(total_getem_om_cost); +} diff --git a/stubs/stubs/Geothermal.pyi b/stubs/stubs/Geothermal.pyi index 3c5652a..801fab4 100644 --- a/stubs/stubs/Geothermal.pyi +++ b/stubs/stubs/Geothermal.pyi @@ -112,6 +112,7 @@ class Geothermal(object): startup_frac = float startup_time = float stim_success_rate = float + stimulation_type = float subsurface_water_loss = float system_use_lifetime_output = float temp_decline_max = float diff --git a/stubs/stubs/GeothermalCosts.pyi b/stubs/stubs/GeothermalCosts.pyi index 43591ee..31db8e9 100644 --- a/stubs/stubs/GeothermalCosts.pyi +++ b/stubs/stubs/GeothermalCosts.pyi @@ -23,6 +23,8 @@ class GeothermalCosts(object): def __init__(self, *args, **kwargs): pass + def getem_om_cost_calc(self, args): + pass class GeoHourly(object): def assign(self): pass @@ -45,6 +47,12 @@ class GeothermalCosts(object): dt_prod_well = float eff_secondlaw = float flash_count = float + geotherm_cost_conf_multiplier = float + geotherm_cost_conf_non_drill = float + geotherm_cost_conf_num_wells = float + geotherm_cost_expl_multiplier = float + geotherm_cost_expl_non_drill = float + geotherm_cost_expl_num_wells = float geotherm_cost_inj_cost_curve = float geotherm_cost_inj_cost_curve_welldiam = float geotherm_cost_inj_cost_curve_welltype = float @@ -52,16 +60,24 @@ class GeothermalCosts(object): geotherm_cost_prod_cost_curve = float geotherm_cost_prod_cost_curve_welldiam = float geotherm_cost_prod_cost_curve_welltype = float + geotherm_cost_prod_req = float geotherm_cost_prod_wells_drilled = float + geotherm_cost_pump_depth = float + geotherm_cost_pump_fixed = float + geotherm_cost_pump_per_foot = float + geotherm_cost_stim_non_drill = float gross_cost_output = float gross_output = float hp_flash_pressure = float + inj_num_pumps = float + inj_pump_hp = float lp_flash_pressure = float ncg_condensate_pump = float ppi_base_year = float pressure_ratio_1 = float pressure_ratio_2 = float pressure_ratio_3 = float + pump_size_hp = float qCondenser = float qRejectByStage_1 = float qRejectByStage_2 = float @@ -89,8 +105,14 @@ class GeothermalCosts(object): baseline_cost = float + conf_total_cost = float + drilling_total_cost = float + expl_total_cost = float inj_total_cost = float prod_total_cost = float + stim_total_cost = float + total_gathering_cost = float + total_pump_cost = float diff --git a/tests/test_GeothermalCosts.py b/tests/test_GeothermalCosts.py new file mode 100644 index 0000000..ee06461 --- /dev/null +++ b/tests/test_GeothermalCosts.py @@ -0,0 +1,36 @@ +import pytest +from pathlib import Path +import PySAM.GeothermalCosts as getem + + +def test_geothermal_costs(): + baseline_cost = 1 + drilling_cost = 1 + field_gathering_system_cost = 1 + num_wells = 1 + water_loss = 1 + total_installed_cost = 1 + pump_cost_install = 1 + pump_only_cost = 1 + pump_type = 1 + pump_depth = 1 + + sys = getem.new() + sys.GeoHourly.gross_output = 1 + sys.GeoHourly.conversion_type = 1 + sys.GeoHourly.ppi_base_year = 1 + sys.GeoHourly.cwflow = 1 + sys.GeoHourly.GF_flowrate = 1 + + total_getem_om_cost = sys.getem_om_cost_calc(baseline_cost=baseline_cost, + drilling_cost=drilling_cost, + field_gathering_system_cost=field_gathering_system_cost, + num_wells=num_wells, + water_loss=water_loss, + total_installed_cost=total_installed_cost, + pump_cost_install=pump_cost_install, + pump_only_cost=pump_only_cost, + pump_type=pump_type, + pump_depth=pump_depth) + + assert(int(total_getem_om_cost) == 110050)