From 2cdad1bf4428dfc2eafa2166b60fb104e182ccbf Mon Sep 17 00:00:00 2001 From: Darice Date: Thu, 2 Jan 2025 17:35:08 -0700 Subject: [PATCH 1/2] add getem eqn to SAM_eqns --- api/include/SAM_GeothermalCosts.h | 78 +++++++++++++++ api/modules/SAM_GeothermalCosts.cpp | 141 ++++++++++++++++++++++++++++ api/src/SAM_eqns.cpp | 7 ++ api/src/SAM_eqns.h | 2 + 4 files changed, 228 insertions(+) diff --git a/api/include/SAM_GeothermalCosts.h b/api/include/SAM_GeothermalCosts.h index 259c9ba6b1..87f38481be 100644 --- a/api/include/SAM_GeothermalCosts.h +++ b/api/include/SAM_GeothermalCosts.h @@ -119,6 +119,54 @@ extern "C" */ SAM_EXPORT void SAM_GeothermalCosts_GeoHourly_flash_count_nset(SAM_table ptr, double number, SAM_error *err); + /** + * Set geotherm.cost.conf_multiplier: Confirmation cost multiplier + * options: ?=1.2 + * constraints: None + * required if: calc_drill_costs=1 + */ + SAM_EXPORT void SAM_GeothermalCosts_GeoHourly_geotherm_cost_conf_multiplier_nset(SAM_table ptr, double number, SAM_error *err); + + /** + * Set geotherm.cost.conf_non_drill: Confirmation non drilling costs [$] + * options: ?=250000 + * constraints: None + * required if: calc_drill_costs=1 + */ + SAM_EXPORT void SAM_GeothermalCosts_GeoHourly_geotherm_cost_conf_non_drill_nset(SAM_table ptr, double number, SAM_error *err); + + /** + * Set geotherm.cost.conf_num_wells: Number of confirmation wells + * options: ?=2 + * constraints: None + * required if: calc_drill_costs=1 + */ + SAM_EXPORT void SAM_GeothermalCosts_GeoHourly_geotherm_cost_conf_num_wells_nset(SAM_table ptr, double number, SAM_error *err); + + /** + * Set geotherm.cost.expl_multiplier: Exploration cost multiplier + * options: ?=0.5 + * constraints: None + * required if: calc_drill_costs=1 + */ + SAM_EXPORT void SAM_GeothermalCosts_GeoHourly_geotherm_cost_expl_multiplier_nset(SAM_table ptr, double number, SAM_error *err); + + /** + * Set geotherm.cost.expl_non_drill: Exploration non drilling costs [$] + * options: ?=750000 + * constraints: None + * required if: calc_drill_costs=1 + */ + SAM_EXPORT void SAM_GeothermalCosts_GeoHourly_geotherm_cost_expl_non_drill_nset(SAM_table ptr, double number, SAM_error *err); + + /** + * Set geotherm.cost.expl_num_wells: Number of exploration wells + * options: ?=2 + * constraints: None + * required if: calc_drill_costs=1 + */ + SAM_EXPORT void SAM_GeothermalCosts_GeoHourly_geotherm_cost_expl_num_wells_nset(SAM_table ptr, double number, SAM_error *err); + /** * Set geotherm.cost.inj_cost_curve: Injection well diameter type [0/1] * options: 0=LargerDiameter,1=SmallerDiameter @@ -183,6 +231,14 @@ extern "C" */ SAM_EXPORT void SAM_GeothermalCosts_GeoHourly_geotherm_cost_prod_wells_drilled_nset(SAM_table ptr, double number, SAM_error *err); + /** + * Set geotherm.cost.stim_non_drill: Stimulation non drilling costs [$] + * options: ?=0 + * constraints: None + * required if: calc_drill_costs=1 + */ + SAM_EXPORT void SAM_GeothermalCosts_GeoHourly_geotherm_cost_stim_non_drill_nset(SAM_table ptr, double number, SAM_error *err); + /** * Set gross_cost_output: Gross output from GETEM for cost calculations [MW] * options: None @@ -386,6 +442,18 @@ extern "C" SAM_EXPORT double SAM_GeothermalCosts_GeoHourly_flash_count_nget(SAM_table ptr, SAM_error *err); + SAM_EXPORT double SAM_GeothermalCosts_GeoHourly_geotherm_cost_conf_multiplier_nget(SAM_table ptr, SAM_error *err); + + SAM_EXPORT double SAM_GeothermalCosts_GeoHourly_geotherm_cost_conf_non_drill_nget(SAM_table ptr, SAM_error *err); + + SAM_EXPORT double SAM_GeothermalCosts_GeoHourly_geotherm_cost_conf_num_wells_nget(SAM_table ptr, SAM_error *err); + + SAM_EXPORT double SAM_GeothermalCosts_GeoHourly_geotherm_cost_expl_multiplier_nget(SAM_table ptr, SAM_error *err); + + SAM_EXPORT double SAM_GeothermalCosts_GeoHourly_geotherm_cost_expl_non_drill_nget(SAM_table ptr, SAM_error *err); + + SAM_EXPORT double SAM_GeothermalCosts_GeoHourly_geotherm_cost_expl_num_wells_nget(SAM_table ptr, SAM_error *err); + SAM_EXPORT double SAM_GeothermalCosts_GeoHourly_geotherm_cost_inj_cost_curve_nget(SAM_table ptr, SAM_error *err); SAM_EXPORT double SAM_GeothermalCosts_GeoHourly_geotherm_cost_inj_cost_curve_welldiam_nget(SAM_table ptr, SAM_error *err); @@ -402,6 +470,8 @@ extern "C" SAM_EXPORT double SAM_GeothermalCosts_GeoHourly_geotherm_cost_prod_wells_drilled_nget(SAM_table ptr, SAM_error *err); + SAM_EXPORT double SAM_GeothermalCosts_GeoHourly_geotherm_cost_stim_non_drill_nget(SAM_table ptr, SAM_error *err); + SAM_EXPORT double SAM_GeothermalCosts_GeoHourly_gross_cost_output_nget(SAM_table ptr, SAM_error *err); SAM_EXPORT double SAM_GeothermalCosts_GeoHourly_gross_output_nget(SAM_table ptr, SAM_error *err); @@ -453,10 +523,18 @@ extern "C" SAM_EXPORT double SAM_GeothermalCosts_Outputs_baseline_cost_nget(SAM_table ptr, SAM_error *err); + SAM_EXPORT double SAM_GeothermalCosts_Outputs_conf_total_cost_nget(SAM_table ptr, SAM_error *err); + + SAM_EXPORT double SAM_GeothermalCosts_Outputs_drilling_total_cost_nget(SAM_table ptr, SAM_error *err); + + SAM_EXPORT double SAM_GeothermalCosts_Outputs_expl_total_cost_nget(SAM_table ptr, SAM_error *err); + SAM_EXPORT double SAM_GeothermalCosts_Outputs_inj_total_cost_nget(SAM_table ptr, SAM_error *err); SAM_EXPORT double SAM_GeothermalCosts_Outputs_prod_total_cost_nget(SAM_table ptr, SAM_error *err); + SAM_EXPORT double SAM_GeothermalCosts_Outputs_stim_total_cost_nget(SAM_table ptr, SAM_error *err); + #ifdef __cplusplus } /* end of extern "C" { */ #endif diff --git a/api/modules/SAM_GeothermalCosts.cpp b/api/modules/SAM_GeothermalCosts.cpp index cd37f06af2..a57a36cd4c 100644 --- a/api/modules/SAM_GeothermalCosts.cpp +++ b/api/modules/SAM_GeothermalCosts.cpp @@ -80,6 +80,42 @@ SAM_EXPORT void SAM_GeothermalCosts_GeoHourly_flash_count_nset(SAM_table ptr, do }); } +SAM_EXPORT void SAM_GeothermalCosts_GeoHourly_geotherm_cost_conf_multiplier_nset(SAM_table ptr, double number, SAM_error *err){ + translateExceptions(err, [&]{ + ssc_data_set_number(ptr, "geotherm.cost.conf_multiplier", number); + }); +} + +SAM_EXPORT void SAM_GeothermalCosts_GeoHourly_geotherm_cost_conf_non_drill_nset(SAM_table ptr, double number, SAM_error *err){ + translateExceptions(err, [&]{ + ssc_data_set_number(ptr, "geotherm.cost.conf_non_drill", number); + }); +} + +SAM_EXPORT void SAM_GeothermalCosts_GeoHourly_geotherm_cost_conf_num_wells_nset(SAM_table ptr, double number, SAM_error *err){ + translateExceptions(err, [&]{ + ssc_data_set_number(ptr, "geotherm.cost.conf_num_wells", number); + }); +} + +SAM_EXPORT void SAM_GeothermalCosts_GeoHourly_geotherm_cost_expl_multiplier_nset(SAM_table ptr, double number, SAM_error *err){ + translateExceptions(err, [&]{ + ssc_data_set_number(ptr, "geotherm.cost.expl_multiplier", number); + }); +} + +SAM_EXPORT void SAM_GeothermalCosts_GeoHourly_geotherm_cost_expl_non_drill_nset(SAM_table ptr, double number, SAM_error *err){ + translateExceptions(err, [&]{ + ssc_data_set_number(ptr, "geotherm.cost.expl_non_drill", number); + }); +} + +SAM_EXPORT void SAM_GeothermalCosts_GeoHourly_geotherm_cost_expl_num_wells_nset(SAM_table ptr, double number, SAM_error *err){ + translateExceptions(err, [&]{ + ssc_data_set_number(ptr, "geotherm.cost.expl_num_wells", number); + }); +} + SAM_EXPORT void SAM_GeothermalCosts_GeoHourly_geotherm_cost_inj_cost_curve_nset(SAM_table ptr, double number, SAM_error *err){ translateExceptions(err, [&]{ ssc_data_set_number(ptr, "geotherm.cost.inj_cost_curve", number); @@ -128,6 +164,12 @@ SAM_EXPORT void SAM_GeothermalCosts_GeoHourly_geotherm_cost_prod_wells_drilled_n }); } +SAM_EXPORT void SAM_GeothermalCosts_GeoHourly_geotherm_cost_stim_non_drill_nset(SAM_table ptr, double number, SAM_error *err){ + translateExceptions(err, [&]{ + ssc_data_set_number(ptr, "geotherm.cost.stim_non_drill", number); + }); +} + SAM_EXPORT void SAM_GeothermalCosts_GeoHourly_gross_cost_output_nset(SAM_table ptr, double number, SAM_error *err){ translateExceptions(err, [&]{ ssc_data_set_number(ptr, "gross_cost_output", number); @@ -359,6 +401,60 @@ SAM_EXPORT double SAM_GeothermalCosts_GeoHourly_flash_count_nget(SAM_table ptr, return result; } +SAM_EXPORT double SAM_GeothermalCosts_GeoHourly_geotherm_cost_conf_multiplier_nget(SAM_table ptr, SAM_error *err){ + double result; + translateExceptions(err, [&]{ + if (!ssc_data_get_number(ptr, "geotherm.cost.conf_multiplier", &result)) + make_access_error("SAM_GeothermalCosts", "geotherm.cost.conf_multiplier"); + }); + return result; +} + +SAM_EXPORT double SAM_GeothermalCosts_GeoHourly_geotherm_cost_conf_non_drill_nget(SAM_table ptr, SAM_error *err){ + double result; + translateExceptions(err, [&]{ + if (!ssc_data_get_number(ptr, "geotherm.cost.conf_non_drill", &result)) + make_access_error("SAM_GeothermalCosts", "geotherm.cost.conf_non_drill"); + }); + return result; +} + +SAM_EXPORT double SAM_GeothermalCosts_GeoHourly_geotherm_cost_conf_num_wells_nget(SAM_table ptr, SAM_error *err){ + double result; + translateExceptions(err, [&]{ + if (!ssc_data_get_number(ptr, "geotherm.cost.conf_num_wells", &result)) + make_access_error("SAM_GeothermalCosts", "geotherm.cost.conf_num_wells"); + }); + return result; +} + +SAM_EXPORT double SAM_GeothermalCosts_GeoHourly_geotherm_cost_expl_multiplier_nget(SAM_table ptr, SAM_error *err){ + double result; + translateExceptions(err, [&]{ + if (!ssc_data_get_number(ptr, "geotherm.cost.expl_multiplier", &result)) + make_access_error("SAM_GeothermalCosts", "geotherm.cost.expl_multiplier"); + }); + return result; +} + +SAM_EXPORT double SAM_GeothermalCosts_GeoHourly_geotherm_cost_expl_non_drill_nget(SAM_table ptr, SAM_error *err){ + double result; + translateExceptions(err, [&]{ + if (!ssc_data_get_number(ptr, "geotherm.cost.expl_non_drill", &result)) + make_access_error("SAM_GeothermalCosts", "geotherm.cost.expl_non_drill"); + }); + return result; +} + +SAM_EXPORT double SAM_GeothermalCosts_GeoHourly_geotherm_cost_expl_num_wells_nget(SAM_table ptr, SAM_error *err){ + double result; + translateExceptions(err, [&]{ + if (!ssc_data_get_number(ptr, "geotherm.cost.expl_num_wells", &result)) + make_access_error("SAM_GeothermalCosts", "geotherm.cost.expl_num_wells"); + }); + return result; +} + SAM_EXPORT double SAM_GeothermalCosts_GeoHourly_geotherm_cost_inj_cost_curve_nget(SAM_table ptr, SAM_error *err){ double result; translateExceptions(err, [&]{ @@ -431,6 +527,15 @@ SAM_EXPORT double SAM_GeothermalCosts_GeoHourly_geotherm_cost_prod_wells_drilled return result; } +SAM_EXPORT double SAM_GeothermalCosts_GeoHourly_geotherm_cost_stim_non_drill_nget(SAM_table ptr, SAM_error *err){ + double result; + translateExceptions(err, [&]{ + if (!ssc_data_get_number(ptr, "geotherm.cost.stim_non_drill", &result)) + make_access_error("SAM_GeothermalCosts", "geotherm.cost.stim_non_drill"); + }); + return result; +} + SAM_EXPORT double SAM_GeothermalCosts_GeoHourly_gross_cost_output_nget(SAM_table ptr, SAM_error *err){ double result; translateExceptions(err, [&]{ @@ -638,6 +743,33 @@ SAM_EXPORT double SAM_GeothermalCosts_Outputs_baseline_cost_nget(SAM_table ptr, return result; } +SAM_EXPORT double SAM_GeothermalCosts_Outputs_conf_total_cost_nget(SAM_table ptr, SAM_error *err){ + double result; + translateExceptions(err, [&]{ + if (!ssc_data_get_number(ptr, "conf_total_cost", &result)) + make_access_error("SAM_GeothermalCosts", "conf_total_cost"); + }); + return result; +} + +SAM_EXPORT double SAM_GeothermalCosts_Outputs_drilling_total_cost_nget(SAM_table ptr, SAM_error *err){ + double result; + translateExceptions(err, [&]{ + if (!ssc_data_get_number(ptr, "drilling_total_cost", &result)) + make_access_error("SAM_GeothermalCosts", "drilling_total_cost"); + }); + return result; +} + +SAM_EXPORT double SAM_GeothermalCosts_Outputs_expl_total_cost_nget(SAM_table ptr, SAM_error *err){ + double result; + translateExceptions(err, [&]{ + if (!ssc_data_get_number(ptr, "expl_total_cost", &result)) + make_access_error("SAM_GeothermalCosts", "expl_total_cost"); + }); + return result; +} + SAM_EXPORT double SAM_GeothermalCosts_Outputs_inj_total_cost_nget(SAM_table ptr, SAM_error *err){ double result; translateExceptions(err, [&]{ @@ -656,3 +788,12 @@ SAM_EXPORT double SAM_GeothermalCosts_Outputs_prod_total_cost_nget(SAM_table ptr return result; } +SAM_EXPORT double SAM_GeothermalCosts_Outputs_stim_total_cost_nget(SAM_table ptr, SAM_error *err){ + double result; + translateExceptions(err, [&]{ + if (!ssc_data_get_number(ptr, "stim_total_cost", &result)) + make_access_error("SAM_GeothermalCosts", "stim_total_cost"); + }); + return result; +} + diff --git a/api/src/SAM_eqns.cpp b/api/src/SAM_eqns.cpp index 7bf1c32863..46b767463f 100644 --- a/api/src/SAM_eqns.cpp +++ b/api/src/SAM_eqns.cpp @@ -43,6 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include +#include #include "SAM_api.h" #include "SAM_eqns.h" @@ -78,3 +79,9 @@ SAM_EXPORT void SAM_Reopt_size_standalone_battery_post_eqn(ssc_data_t data, SAM_ Reopt_size_standalone_battery_params(data); }); } + +SAM_EXPORT void SAM_getem_om_cost_calc_eqn(SAM_table data, SAM_error* err) { + translateExceptions(err, [&] { + getem_om_cost_calc(data); + }); +} diff --git a/api/src/SAM_eqns.h b/api/src/SAM_eqns.h index a8f1c34fb2..2009ba563b 100644 --- a/api/src/SAM_eqns.h +++ b/api/src/SAM_eqns.h @@ -51,6 +51,8 @@ SAM_EXPORT void SAM_mp_ancillary_services_eqn(SAM_table data, SAM_error* err); SAM_EXPORT void SAM_Reopt_size_standalone_battery_post_eqn(SAM_table data, SAM_error* err); +SAM_EXPORT void SAM_getem_om_cost_calc_eqn(SAM_table data, SAM_error* err); + #ifdef __cplusplus } // extern "C" #endif From 89c8667580a87d606de148399cb3602374e4bfc5 Mon Sep 17 00:00:00 2001 From: Steven Janzou Date: Fri, 3 Jan 2025 02:59:39 -0700 Subject: [PATCH 2/2] Fix build errors with cmod_geothermal_eqns.h - replace with cmod_geothermal_costs_eqns.h --- api/src/SAM_eqns.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/src/SAM_eqns.cpp b/api/src/SAM_eqns.cpp index 46b767463f..dd714f4020 100644 --- a/api/src/SAM_eqns.cpp +++ b/api/src/SAM_eqns.cpp @@ -43,7 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include -#include +#include #include "SAM_api.h" #include "SAM_eqns.h"