From 87270549d74f61dee36ece383ce8e3b2d75cd8fd Mon Sep 17 00:00:00 2001 From: Taylor Brown <60201147+taylorbrown75@users.noreply.github.com> Date: Mon, 11 Nov 2024 18:38:17 -0700 Subject: [PATCH] Add construction financing equations to trough and fresnel cmods. --- ssc/cmod_fresnel_physical.cpp | 205 +++++++++++++++++----------------- ssc/cmod_trough_physical.cpp | 108 ++++++++++++++++++ 2 files changed, 211 insertions(+), 102 deletions(-) diff --git a/ssc/cmod_fresnel_physical.cpp b/ssc/cmod_fresnel_physical.cpp index 703b2ffa1..68be3707c 100644 --- a/ssc/cmod_fresnel_physical.cpp +++ b/ssc/cmod_fresnel_physical.cpp @@ -289,26 +289,26 @@ static var_info _cm_vtab_fresnel_physical[] = { // Construction financing inputs/outputs (SSC variable table from cmod_cb_construction_financing) - { SSC_INPUT, SSC_NUMBER, "const_per_interest_rate1", "Interest rate, loan 1", "%", "", "Financial Parameters", "*", "", "" }, - { SSC_INPUT, SSC_NUMBER, "const_per_interest_rate2", "Interest rate, loan 2", "%", "", "Financial Parameters", "*", "", "" }, - { SSC_INPUT, SSC_NUMBER, "const_per_interest_rate3", "Interest rate, loan 3", "%", "", "Financial Parameters", "*", "", "" }, - { SSC_INPUT, SSC_NUMBER, "const_per_interest_rate4", "Interest rate, loan 4", "%", "", "Financial Parameters", "*", "", "" }, - { SSC_INPUT, SSC_NUMBER, "const_per_interest_rate5", "Interest rate, loan 5", "%", "", "Financial Parameters", "*", "", "" }, - { SSC_INPUT, SSC_NUMBER, "const_per_months1", "Months prior to operation, loan 1", "", "", "Financial Parameters", "*", "", "" }, - { SSC_INPUT, SSC_NUMBER, "const_per_months2", "Months prior to operation, loan 2", "", "", "Financial Parameters", "*", "", "" }, - { SSC_INPUT, SSC_NUMBER, "const_per_months3", "Months prior to operation, loan 3", "", "", "Financial Parameters", "*", "", "" }, - { SSC_INPUT, SSC_NUMBER, "const_per_months4", "Months prior to operation, loan 4", "", "", "Financial Parameters", "*", "", "" }, - { SSC_INPUT, SSC_NUMBER, "const_per_months5", "Months prior to operation, loan 5", "", "", "Financial Parameters", "*", "", "" }, - { SSC_INPUT, SSC_NUMBER, "const_per_percent1", "Percent of total installed cost, loan 1", "%", "", "Financial Parameters", "*", "", "" }, - { SSC_INPUT, SSC_NUMBER, "const_per_percent2", "Percent of total installed cost, loan 2", "%", "", "Financial Parameters", "*", "", "" }, - { SSC_INPUT, SSC_NUMBER, "const_per_percent3", "Percent of total installed cost, loan 3", "%", "", "Financial Parameters", "*", "", "" }, - { SSC_INPUT, SSC_NUMBER, "const_per_percent4", "Percent of total installed cost, loan 4", "%", "", "Financial Parameters", "*", "", "" }, - { SSC_INPUT, SSC_NUMBER, "const_per_percent5", "Percent of total installed cost, loan 5", "%", "", "Financial Parameters", "*", "", "" }, - { SSC_INPUT, SSC_NUMBER, "const_per_upfront_rate1", "Upfront fee on principal, loan 1", "%", "", "Financial Parameters", "*", "", "" }, - { SSC_INPUT, SSC_NUMBER, "const_per_upfront_rate2", "Upfront fee on principal, loan 2", "%", "", "Financial Parameters", "*", "", "" }, - { SSC_INPUT, SSC_NUMBER, "const_per_upfront_rate3", "Upfront fee on principal, loan 3", "%", "", "Financial Parameters", "*", "", "" }, - { SSC_INPUT, SSC_NUMBER, "const_per_upfront_rate4", "Upfront fee on principal, loan 4", "%", "", "Financial Parameters", "*", "", "" }, - { SSC_INPUT, SSC_NUMBER, "const_per_upfront_rate5", "Upfront fee on principal, loan 5", "%", "", "Financial Parameters", "*", "", "" }, + { SSC_INPUT, SSC_NUMBER, "const_per_interest_rate1", "Interest rate, loan 1", "%", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_INPUT, SSC_NUMBER, "const_per_interest_rate2", "Interest rate, loan 2", "%", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_INPUT, SSC_NUMBER, "const_per_interest_rate3", "Interest rate, loan 3", "%", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_INPUT, SSC_NUMBER, "const_per_interest_rate4", "Interest rate, loan 4", "%", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_INPUT, SSC_NUMBER, "const_per_interest_rate5", "Interest rate, loan 5", "%", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_INPUT, SSC_NUMBER, "const_per_months1", "Months prior to operation, loan 1", "", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_INPUT, SSC_NUMBER, "const_per_months2", "Months prior to operation, loan 2", "", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_INPUT, SSC_NUMBER, "const_per_months3", "Months prior to operation, loan 3", "", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_INPUT, SSC_NUMBER, "const_per_months4", "Months prior to operation, loan 4", "", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_INPUT, SSC_NUMBER, "const_per_months5", "Months prior to operation, loan 5", "", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_INPUT, SSC_NUMBER, "const_per_percent1", "Percent of total installed cost, loan 1", "%", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_INPUT, SSC_NUMBER, "const_per_percent2", "Percent of total installed cost, loan 2", "%", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_INPUT, SSC_NUMBER, "const_per_percent3", "Percent of total installed cost, loan 3", "%", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_INPUT, SSC_NUMBER, "const_per_percent4", "Percent of total installed cost, loan 4", "%", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_INPUT, SSC_NUMBER, "const_per_percent5", "Percent of total installed cost, loan 5", "%", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_INPUT, SSC_NUMBER, "const_per_upfront_rate1", "Upfront fee on principal, loan 1", "%", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_INPUT, SSC_NUMBER, "const_per_upfront_rate2", "Upfront fee on principal, loan 2", "%", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_INPUT, SSC_NUMBER, "const_per_upfront_rate3", "Upfront fee on principal, loan 3", "%", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_INPUT, SSC_NUMBER, "const_per_upfront_rate4", "Upfront fee on principal, loan 4", "%", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_INPUT, SSC_NUMBER, "const_per_upfront_rate5", "Upfront fee on principal, loan 5", "%", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, @@ -427,25 +427,25 @@ static var_info _cm_vtab_fresnel_physical[] = { { SSC_OUTPUT, SSC_NUMBER, "installed_per_capacity", "Estimated total installed cost per net capacity ($/kW)", "$/kW", "", "Capital Costs", "", "", "" }, // Financing - { SSC_OUTPUT, SSC_NUMBER, "const_per_principal1", "Principal, loan 1", "$", "", "Financial Parameters", "*", "", "" }, - { SSC_OUTPUT, SSC_NUMBER, "const_per_principal2", "Principal, loan 2", "$", "", "Financial Parameters", "*", "", "" }, - { SSC_OUTPUT, SSC_NUMBER, "const_per_principal3", "Principal, loan 3", "$", "", "Financial Parameters", "*", "", "" }, - { SSC_OUTPUT, SSC_NUMBER, "const_per_principal4", "Principal, loan 4", "$", "", "Financial Parameters", "*", "", "" }, - { SSC_OUTPUT, SSC_NUMBER, "const_per_principal5", "Principal, loan 5", "$", "", "Financial Parameters", "*", "", "" }, - { SSC_OUTPUT, SSC_NUMBER, "const_per_interest1", "Interest cost, loan 1", "$", "", "Financial Parameters", "*", "", "" }, - { SSC_OUTPUT, SSC_NUMBER, "const_per_interest2", "Interest cost, loan 2", "$", "", "Financial Parameters", "*", "", "" }, - { SSC_OUTPUT, SSC_NUMBER, "const_per_interest3", "Interest cost, loan 3", "$", "", "Financial Parameters", "*", "", "" }, - { SSC_OUTPUT, SSC_NUMBER, "const_per_interest4", "Interest cost, loan 4", "$", "", "Financial Parameters", "*", "", "" }, - { SSC_OUTPUT, SSC_NUMBER, "const_per_interest5", "Interest cost, loan 5", "$", "", "Financial Parameters", "*", "", "" }, - { SSC_OUTPUT, SSC_NUMBER, "const_per_total1", "Total financing cost, loan 1", "$", "", "Financial Parameters", "*", "", "" }, - { SSC_OUTPUT, SSC_NUMBER, "const_per_total2", "Total financing cost, loan 2", "$", "", "Financial Parameters", "*", "", "" }, - { SSC_OUTPUT, SSC_NUMBER, "const_per_total3", "Total financing cost, loan 3", "$", "", "Financial Parameters", "*", "", "" }, - { SSC_OUTPUT, SSC_NUMBER, "const_per_total4", "Total financing cost, loan 4", "$", "", "Financial Parameters", "*", "", "" }, - { SSC_OUTPUT, SSC_NUMBER, "const_per_total5", "Total financing cost, loan 5", "$", "", "Financial Parameters", "*", "", "" }, - { SSC_OUTPUT, SSC_NUMBER, "const_per_percent_total", "Total percent of installed costs, all loans", "%", "", "Financial Parameters", "*", "", "" }, - { SSC_OUTPUT, SSC_NUMBER, "const_per_principal_total", "Total principal, all loans", "$", "", "Financial Parameters", "*", "", "" }, - { SSC_OUTPUT, SSC_NUMBER, "const_per_interest_total", "Total interest costs, all loans", "$", "", "Financial Parameters", "*", "", "" }, - { SSC_OUTPUT, SSC_NUMBER, "construction_financing_cost", "Total construction financing cost", "$", "", "Financial Parameters", "*", "", "" }, + { SSC_OUTPUT, SSC_NUMBER, "const_per_principal1", "Principal, loan 1", "$", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_OUTPUT, SSC_NUMBER, "const_per_principal2", "Principal, loan 2", "$", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_OUTPUT, SSC_NUMBER, "const_per_principal3", "Principal, loan 3", "$", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_OUTPUT, SSC_NUMBER, "const_per_principal4", "Principal, loan 4", "$", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_OUTPUT, SSC_NUMBER, "const_per_principal5", "Principal, loan 5", "$", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_OUTPUT, SSC_NUMBER, "const_per_interest1", "Interest cost, loan 1", "$", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_OUTPUT, SSC_NUMBER, "const_per_interest2", "Interest cost, loan 2", "$", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_OUTPUT, SSC_NUMBER, "const_per_interest3", "Interest cost, loan 3", "$", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_OUTPUT, SSC_NUMBER, "const_per_interest4", "Interest cost, loan 4", "$", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_OUTPUT, SSC_NUMBER, "const_per_interest5", "Interest cost, loan 5", "$", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_OUTPUT, SSC_NUMBER, "const_per_total1", "Total financing cost, loan 1", "$", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_OUTPUT, SSC_NUMBER, "const_per_total2", "Total financing cost, loan 2", "$", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_OUTPUT, SSC_NUMBER, "const_per_total3", "Total financing cost, loan 3", "$", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_OUTPUT, SSC_NUMBER, "const_per_total4", "Total financing cost, loan 4", "$", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_OUTPUT, SSC_NUMBER, "const_per_total5", "Total financing cost, loan 5", "$", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_OUTPUT, SSC_NUMBER, "const_per_percent_total", "Total percent of installed costs, all loans", "%", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_OUTPUT, SSC_NUMBER, "const_per_principal_total", "Total principal, all loans", "$", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_OUTPUT, SSC_NUMBER, "const_per_interest_total", "Total interest costs, all loans", "$", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_OUTPUT, SSC_NUMBER, "construction_financing_cost", "Total construction financing cost", "$", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, // **************************************************************************************************************************************** // Timeseries Simulation Outputs here (sim_type = 1): @@ -1628,69 +1628,70 @@ class cm_fresnel_physical : public compute_module } // Update construction financing costs, specifically, update: "construction_financing_cost" - double const_per_interest_rate1 = as_double("const_per_interest_rate1"); - double const_per_interest_rate2 = as_double("const_per_interest_rate2"); - double const_per_interest_rate3 = as_double("const_per_interest_rate3"); - double const_per_interest_rate4 = as_double("const_per_interest_rate4"); - double const_per_interest_rate5 = as_double("const_per_interest_rate5"); - double const_per_months1 = as_double("const_per_months1"); - double const_per_months2 = as_double("const_per_months2"); - double const_per_months3 = as_double("const_per_months3"); - double const_per_months4 = as_double("const_per_months4"); - double const_per_months5 = as_double("const_per_months5"); - double const_per_percent1 = as_double("const_per_percent1"); - double const_per_percent2 = as_double("const_per_percent2"); - double const_per_percent3 = as_double("const_per_percent3"); - double const_per_percent4 = as_double("const_per_percent4"); - double const_per_percent5 = as_double("const_per_percent5"); - double const_per_upfront_rate1 = as_double("const_per_upfront_rate1"); - double const_per_upfront_rate2 = as_double("const_per_upfront_rate2"); - double const_per_upfront_rate3 = as_double("const_per_upfront_rate3"); - double const_per_upfront_rate4 = as_double("const_per_upfront_rate4"); - double const_per_upfront_rate5 = as_double("const_per_upfront_rate5"); - - double const_per_principal1, const_per_principal2, const_per_principal3, const_per_principal4, const_per_principal5; - double const_per_interest1, const_per_interest2, const_per_interest3, const_per_interest4, const_per_interest5; - double const_per_total1, const_per_total2, const_per_total3, const_per_total4, const_per_total5; - double const_per_percent_total, const_per_principal_total, const_per_interest_total, construction_financing_cost; - - const_per_principal1 = const_per_principal2 = const_per_principal3 = const_per_principal4 = const_per_principal5 = - const_per_interest1 = const_per_interest2 = const_per_interest3 = const_per_interest4 = const_per_interest5 = - const_per_total1 = const_per_total2 = const_per_total3 = const_per_total4 = const_per_total5 = - const_per_percent_total = const_per_principal_total = const_per_interest_total = construction_financing_cost = - std::numeric_limits::quiet_NaN(); - - N_financial_parameters::construction_financing_total_cost(total_installed_cost_out, - const_per_interest_rate1, const_per_interest_rate2, const_per_interest_rate3, const_per_interest_rate4, const_per_interest_rate5, - const_per_months1, const_per_months2, const_per_months3, const_per_months4, const_per_months5, - const_per_percent1, const_per_percent2, const_per_percent3, const_per_percent4, const_per_percent5, - const_per_upfront_rate1, const_per_upfront_rate2, const_per_upfront_rate3, const_per_upfront_rate4, const_per_upfront_rate5, - const_per_principal1, const_per_principal2, const_per_principal3, const_per_principal4, const_per_principal5, - const_per_interest1, const_per_interest2, const_per_interest3, const_per_interest4, const_per_interest5, - const_per_total1, const_per_total2, const_per_total3, const_per_total4, const_per_total5, - const_per_percent_total, const_per_principal_total, const_per_interest_total, construction_financing_cost); - - assign("const_per_principal1", (ssc_number_t)const_per_principal1); - assign("const_per_principal2", (ssc_number_t)const_per_principal2); - assign("const_per_principal3", (ssc_number_t)const_per_principal3); - assign("const_per_principal4", (ssc_number_t)const_per_principal4); - assign("const_per_principal5", (ssc_number_t)const_per_principal5); - assign("const_per_interest1", (ssc_number_t)const_per_interest1); - assign("const_per_interest2", (ssc_number_t)const_per_interest2); - assign("const_per_interest3", (ssc_number_t)const_per_interest3); - assign("const_per_interest4", (ssc_number_t)const_per_interest4); - assign("const_per_interest5", (ssc_number_t)const_per_interest5); - assign("const_per_total1", (ssc_number_t)const_per_total1); - assign("const_per_total2", (ssc_number_t)const_per_total2); - assign("const_per_total3", (ssc_number_t)const_per_total3); - assign("const_per_total4", (ssc_number_t)const_per_total4); - assign("const_per_total5", (ssc_number_t)const_per_total5); - assign("const_per_percent_total", (ssc_number_t)const_per_percent_total); - assign("const_per_principal_total", (ssc_number_t)const_per_principal_total); - assign("const_per_interest_total", (ssc_number_t)const_per_interest_total); - assign("construction_financing_cost", (ssc_number_t)construction_financing_cost); - - + if (csp_financial_model < 5 || csp_financial_model == 6) + { + double const_per_interest_rate1 = as_double("const_per_interest_rate1"); + double const_per_interest_rate2 = as_double("const_per_interest_rate2"); + double const_per_interest_rate3 = as_double("const_per_interest_rate3"); + double const_per_interest_rate4 = as_double("const_per_interest_rate4"); + double const_per_interest_rate5 = as_double("const_per_interest_rate5"); + double const_per_months1 = as_double("const_per_months1"); + double const_per_months2 = as_double("const_per_months2"); + double const_per_months3 = as_double("const_per_months3"); + double const_per_months4 = as_double("const_per_months4"); + double const_per_months5 = as_double("const_per_months5"); + double const_per_percent1 = as_double("const_per_percent1"); + double const_per_percent2 = as_double("const_per_percent2"); + double const_per_percent3 = as_double("const_per_percent3"); + double const_per_percent4 = as_double("const_per_percent4"); + double const_per_percent5 = as_double("const_per_percent5"); + double const_per_upfront_rate1 = as_double("const_per_upfront_rate1"); + double const_per_upfront_rate2 = as_double("const_per_upfront_rate2"); + double const_per_upfront_rate3 = as_double("const_per_upfront_rate3"); + double const_per_upfront_rate4 = as_double("const_per_upfront_rate4"); + double const_per_upfront_rate5 = as_double("const_per_upfront_rate5"); + + double const_per_principal1, const_per_principal2, const_per_principal3, const_per_principal4, const_per_principal5; + double const_per_interest1, const_per_interest2, const_per_interest3, const_per_interest4, const_per_interest5; + double const_per_total1, const_per_total2, const_per_total3, const_per_total4, const_per_total5; + double const_per_percent_total, const_per_principal_total, const_per_interest_total, construction_financing_cost; + + const_per_principal1 = const_per_principal2 = const_per_principal3 = const_per_principal4 = const_per_principal5 = + const_per_interest1 = const_per_interest2 = const_per_interest3 = const_per_interest4 = const_per_interest5 = + const_per_total1 = const_per_total2 = const_per_total3 = const_per_total4 = const_per_total5 = + const_per_percent_total = const_per_principal_total = const_per_interest_total = construction_financing_cost = + std::numeric_limits::quiet_NaN(); + + N_financial_parameters::construction_financing_total_cost(total_installed_cost_out, + const_per_interest_rate1, const_per_interest_rate2, const_per_interest_rate3, const_per_interest_rate4, const_per_interest_rate5, + const_per_months1, const_per_months2, const_per_months3, const_per_months4, const_per_months5, + const_per_percent1, const_per_percent2, const_per_percent3, const_per_percent4, const_per_percent5, + const_per_upfront_rate1, const_per_upfront_rate2, const_per_upfront_rate3, const_per_upfront_rate4, const_per_upfront_rate5, + const_per_principal1, const_per_principal2, const_per_principal3, const_per_principal4, const_per_principal5, + const_per_interest1, const_per_interest2, const_per_interest3, const_per_interest4, const_per_interest5, + const_per_total1, const_per_total2, const_per_total3, const_per_total4, const_per_total5, + const_per_percent_total, const_per_principal_total, const_per_interest_total, construction_financing_cost); + + assign("const_per_principal1", (ssc_number_t)const_per_principal1); + assign("const_per_principal2", (ssc_number_t)const_per_principal2); + assign("const_per_principal3", (ssc_number_t)const_per_principal3); + assign("const_per_principal4", (ssc_number_t)const_per_principal4); + assign("const_per_principal5", (ssc_number_t)const_per_principal5); + assign("const_per_interest1", (ssc_number_t)const_per_interest1); + assign("const_per_interest2", (ssc_number_t)const_per_interest2); + assign("const_per_interest3", (ssc_number_t)const_per_interest3); + assign("const_per_interest4", (ssc_number_t)const_per_interest4); + assign("const_per_interest5", (ssc_number_t)const_per_interest5); + assign("const_per_total1", (ssc_number_t)const_per_total1); + assign("const_per_total2", (ssc_number_t)const_per_total2); + assign("const_per_total3", (ssc_number_t)const_per_total3); + assign("const_per_total4", (ssc_number_t)const_per_total4); + assign("const_per_total5", (ssc_number_t)const_per_total5); + assign("const_per_percent_total", (ssc_number_t)const_per_percent_total); + assign("const_per_principal_total", (ssc_number_t)const_per_principal_total); + assign("const_per_interest_total", (ssc_number_t)const_per_interest_total); + assign("construction_financing_cost", (ssc_number_t)construction_financing_cost); + } } diff --git a/ssc/cmod_trough_physical.cpp b/ssc/cmod_trough_physical.cpp index 611e555e5..84a77430b 100644 --- a/ssc/cmod_trough_physical.cpp +++ b/ssc/cmod_trough_physical.cpp @@ -398,6 +398,28 @@ static var_info _cm_vtab_trough_physical[] = { { SSC_INPUT, SSC_NUMBER, "csp.dtr.cost.sales_tax.percent", "Sales Tax Percentage of Direct Cost", "%", "", "Capital_Costs", "?=0", "", "" }, { SSC_INPUT, SSC_NUMBER, "sales_tax_rate", "Sales Tax Rate", "%", "", "Capital_Costs", "?=0", "", "" }, + // Construction financing inputs/outputs (SSC variable table from cmod_cb_construction_financing) + { SSC_INPUT, SSC_NUMBER, "const_per_interest_rate1", "Interest rate, loan 1", "%", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_INPUT, SSC_NUMBER, "const_per_interest_rate2", "Interest rate, loan 2", "%", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_INPUT, SSC_NUMBER, "const_per_interest_rate3", "Interest rate, loan 3", "%", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_INPUT, SSC_NUMBER, "const_per_interest_rate4", "Interest rate, loan 4", "%", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_INPUT, SSC_NUMBER, "const_per_interest_rate5", "Interest rate, loan 5", "%", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_INPUT, SSC_NUMBER, "const_per_months1", "Months prior to operation, loan 1", "", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_INPUT, SSC_NUMBER, "const_per_months2", "Months prior to operation, loan 2", "", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_INPUT, SSC_NUMBER, "const_per_months3", "Months prior to operation, loan 3", "", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_INPUT, SSC_NUMBER, "const_per_months4", "Months prior to operation, loan 4", "", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_INPUT, SSC_NUMBER, "const_per_months5", "Months prior to operation, loan 5", "", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_INPUT, SSC_NUMBER, "const_per_percent1", "Percent of total installed cost, loan 1", "%", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_INPUT, SSC_NUMBER, "const_per_percent2", "Percent of total installed cost, loan 2", "%", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_INPUT, SSC_NUMBER, "const_per_percent3", "Percent of total installed cost, loan 3", "%", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_INPUT, SSC_NUMBER, "const_per_percent4", "Percent of total installed cost, loan 4", "%", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_INPUT, SSC_NUMBER, "const_per_percent5", "Percent of total installed cost, loan 5", "%", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_INPUT, SSC_NUMBER, "const_per_upfront_rate1", "Upfront fee on principal, loan 1", "%", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_INPUT, SSC_NUMBER, "const_per_upfront_rate2", "Upfront fee on principal, loan 2", "%", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_INPUT, SSC_NUMBER, "const_per_upfront_rate3", "Upfront fee on principal, loan 3", "%", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_INPUT, SSC_NUMBER, "const_per_upfront_rate4", "Upfront fee on principal, loan 4", "%", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_INPUT, SSC_NUMBER, "const_per_upfront_rate5", "Upfront fee on principal, loan 5", "%", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + // ************************************************************************************************* // OUTPUTS @@ -523,6 +545,26 @@ static var_info _cm_vtab_trough_physical[] = { { SSC_OUTPUT, SSC_NUMBER, "total_installed_cost", "Total installed cost", "$", "", "Capital Costs", "", "", "" }, { SSC_OUTPUT, SSC_NUMBER, "csp.dtr.cost.installed_per_capacity", "Estimated total installed cost per net capacity ($/kW)", "$/kW", "", "Capital Costs", "", "", "" }, + // Financing + { SSC_OUTPUT, SSC_NUMBER, "const_per_principal1", "Principal, loan 1", "$", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_OUTPUT, SSC_NUMBER, "const_per_principal2", "Principal, loan 2", "$", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_OUTPUT, SSC_NUMBER, "const_per_principal3", "Principal, loan 3", "$", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_OUTPUT, SSC_NUMBER, "const_per_principal4", "Principal, loan 4", "$", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_OUTPUT, SSC_NUMBER, "const_per_principal5", "Principal, loan 5", "$", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_OUTPUT, SSC_NUMBER, "const_per_interest1", "Interest cost, loan 1", "$", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_OUTPUT, SSC_NUMBER, "const_per_interest2", "Interest cost, loan 2", "$", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_OUTPUT, SSC_NUMBER, "const_per_interest3", "Interest cost, loan 3", "$", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_OUTPUT, SSC_NUMBER, "const_per_interest4", "Interest cost, loan 4", "$", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_OUTPUT, SSC_NUMBER, "const_per_interest5", "Interest cost, loan 5", "$", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_OUTPUT, SSC_NUMBER, "const_per_total1", "Total financing cost, loan 1", "$", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_OUTPUT, SSC_NUMBER, "const_per_total2", "Total financing cost, loan 2", "$", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_OUTPUT, SSC_NUMBER, "const_per_total3", "Total financing cost, loan 3", "$", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_OUTPUT, SSC_NUMBER, "const_per_total4", "Total financing cost, loan 4", "$", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_OUTPUT, SSC_NUMBER, "const_per_total5", "Total financing cost, loan 5", "$", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_OUTPUT, SSC_NUMBER, "const_per_percent_total", "Total percent of installed costs, all loans", "%", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_OUTPUT, SSC_NUMBER, "const_per_principal_total", "Total principal, all loans", "$", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_OUTPUT, SSC_NUMBER, "const_per_interest_total", "Total interest costs, all loans", "$", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, + { SSC_OUTPUT, SSC_NUMBER, "construction_financing_cost", "Total construction financing cost", "$", "", "Financial Parameters", "csp_financial_model<5|csp_financial_model=6", "", "" }, // Simulation Kernel { SSC_OUTPUT, SSC_ARRAY, "time_hr", "Time at end of timestep", "hr", "", "solver", "sim_type=1", "", "" }, @@ -2335,6 +2377,72 @@ class cm_trough_physical : public compute_module assign("total_installed_cost", total_installed_cost_out); assign("csp.dtr.cost.installed_per_capacity", installed_per_capacity_out); } + + // Update construction financing costs, specifically, update: "construction_financing_cost" + if (csp_financial_model < 5 || csp_financial_model == 6) + { + double const_per_interest_rate1 = as_double("const_per_interest_rate1"); + double const_per_interest_rate2 = as_double("const_per_interest_rate2"); + double const_per_interest_rate3 = as_double("const_per_interest_rate3"); + double const_per_interest_rate4 = as_double("const_per_interest_rate4"); + double const_per_interest_rate5 = as_double("const_per_interest_rate5"); + double const_per_months1 = as_double("const_per_months1"); + double const_per_months2 = as_double("const_per_months2"); + double const_per_months3 = as_double("const_per_months3"); + double const_per_months4 = as_double("const_per_months4"); + double const_per_months5 = as_double("const_per_months5"); + double const_per_percent1 = as_double("const_per_percent1"); + double const_per_percent2 = as_double("const_per_percent2"); + double const_per_percent3 = as_double("const_per_percent3"); + double const_per_percent4 = as_double("const_per_percent4"); + double const_per_percent5 = as_double("const_per_percent5"); + double const_per_upfront_rate1 = as_double("const_per_upfront_rate1"); + double const_per_upfront_rate2 = as_double("const_per_upfront_rate2"); + double const_per_upfront_rate3 = as_double("const_per_upfront_rate3"); + double const_per_upfront_rate4 = as_double("const_per_upfront_rate4"); + double const_per_upfront_rate5 = as_double("const_per_upfront_rate5"); + + double const_per_principal1, const_per_principal2, const_per_principal3, const_per_principal4, const_per_principal5; + double const_per_interest1, const_per_interest2, const_per_interest3, const_per_interest4, const_per_interest5; + double const_per_total1, const_per_total2, const_per_total3, const_per_total4, const_per_total5; + double const_per_percent_total, const_per_principal_total, const_per_interest_total, construction_financing_cost; + + const_per_principal1 = const_per_principal2 = const_per_principal3 = const_per_principal4 = const_per_principal5 = + const_per_interest1 = const_per_interest2 = const_per_interest3 = const_per_interest4 = const_per_interest5 = + const_per_total1 = const_per_total2 = const_per_total3 = const_per_total4 = const_per_total5 = + const_per_percent_total = const_per_principal_total = const_per_interest_total = construction_financing_cost = + std::numeric_limits::quiet_NaN(); + + N_financial_parameters::construction_financing_total_cost(total_installed_cost_out, + const_per_interest_rate1, const_per_interest_rate2, const_per_interest_rate3, const_per_interest_rate4, const_per_interest_rate5, + const_per_months1, const_per_months2, const_per_months3, const_per_months4, const_per_months5, + const_per_percent1, const_per_percent2, const_per_percent3, const_per_percent4, const_per_percent5, + const_per_upfront_rate1, const_per_upfront_rate2, const_per_upfront_rate3, const_per_upfront_rate4, const_per_upfront_rate5, + const_per_principal1, const_per_principal2, const_per_principal3, const_per_principal4, const_per_principal5, + const_per_interest1, const_per_interest2, const_per_interest3, const_per_interest4, const_per_interest5, + const_per_total1, const_per_total2, const_per_total3, const_per_total4, const_per_total5, + const_per_percent_total, const_per_principal_total, const_per_interest_total, construction_financing_cost); + + assign("const_per_principal1", (ssc_number_t)const_per_principal1); + assign("const_per_principal2", (ssc_number_t)const_per_principal2); + assign("const_per_principal3", (ssc_number_t)const_per_principal3); + assign("const_per_principal4", (ssc_number_t)const_per_principal4); + assign("const_per_principal5", (ssc_number_t)const_per_principal5); + assign("const_per_interest1", (ssc_number_t)const_per_interest1); + assign("const_per_interest2", (ssc_number_t)const_per_interest2); + assign("const_per_interest3", (ssc_number_t)const_per_interest3); + assign("const_per_interest4", (ssc_number_t)const_per_interest4); + assign("const_per_interest5", (ssc_number_t)const_per_interest5); + assign("const_per_total1", (ssc_number_t)const_per_total1); + assign("const_per_total2", (ssc_number_t)const_per_total2); + assign("const_per_total3", (ssc_number_t)const_per_total3); + assign("const_per_total4", (ssc_number_t)const_per_total4); + assign("const_per_total5", (ssc_number_t)const_per_total5); + assign("const_per_percent_total", (ssc_number_t)const_per_percent_total); + assign("const_per_principal_total", (ssc_number_t)const_per_principal_total); + assign("const_per_interest_total", (ssc_number_t)const_per_interest_total); + assign("construction_financing_cost", (ssc_number_t)construction_financing_cost); + } } // Return if only called for design point