From 7e52c1baa3f03ae4fd570ad047a07437663b9456 Mon Sep 17 00:00:00 2001 From: Steven Janzou Date: Fri, 15 Nov 2024 03:39:06 -0700 Subject: [PATCH] Update host developer to account for thermal savings for SAM #1903 --- ssc/cmod_host_developer.cpp | 24 ++++++++++++++++++------ ssc/cmod_thermalrate.cpp | 8 +++++--- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/ssc/cmod_host_developer.cpp b/ssc/cmod_host_developer.cpp index 444ff3bed..485a8fa71 100644 --- a/ssc/cmod_host_developer.cpp +++ b/ssc/cmod_host_developer.cpp @@ -51,8 +51,8 @@ static var_info _cm_vtab_host_developer[] = { { SSC_INPUT, SSC_ARRAY, "utility_bill_w_sys", "Electricity bill for system", "$", "", "Charges by Month", "*", "", "" }, { SSC_INPUT, SSC_MATRIX, "charge_w_sys_dc_tou_ym", "Demand charge with system (TOU)", "$", "", "Charges by Month", "*", "", "COL_LABEL=MONTHS,FORMAT_SPEC=CURRENCY,GROUP=UR_AM" }, - { SSC_INPUT, SSC_ARRAY, "annual_energy_value", "Energy value", "$", "", "System Output", "*", "", "" }, - { SSC_INPUT, SSC_ARRAY, "annual_thermal_value", "Energy value", "$", "", "System Output", "", "", "" }, + // { SSC_INPUT, SSC_ARRAY, "annual_energy_value", "Energy value", "$", "", "System Output", "*", "", "" }, + { SSC_INPUT, SSC_ARRAY, "annual_thermal_value", "Host thermal value", "$", "", "System Output", "", "", "" }, { SSC_INPUT, SSC_ARRAY, "gen", "Power generated by renewable resource", "kW", "", "System Output", "*", "", "" }, // { SSC_OUTPUT, SSC_ARRAY, "gen_purchases", "Electricity from grid", "kW", "", "System Output", "", "", "" }, @@ -852,6 +852,7 @@ enum { CF_cumulative_payback_with_expenses, CF_nte, CF_host_energy_value, + CF_host_thermal_value, @@ -1017,6 +1018,8 @@ class cm_host_developer : public compute_module double om_opt_fuel_1_usage = as_double("om_opt_fuel_1_usage"); double om_opt_fuel_2_usage = as_double("om_opt_fuel_2_usage"); + + // additional o and m sub types (e.g. batteries and fuel cells) int add_om_num_types = as_integer("add_om_num_types"); ssc_number_t nameplate1 = 0; @@ -2822,7 +2825,16 @@ class cm_host_developer : public compute_module // ---------------------------------------------------------------------------- // Host calculations based on thirdpartyownership with PPA agreement - + if (is_assigned("annual_thermal_value")) { + arrp = as_array("annual_thermal_value", &count); + if ((int)count != nyears + 1) + throw exec_error("host developer", util::format("thermal value input wrong length (%d) shouCF_host_energy_valueld be (%d)", count, nyears + 1)); + i = 0; + while (i < nyears && i < (int)count) { + cf.at(CF_host_thermal_value, i + 1) = (double)arrp[i + 1]; + i++; + } + } // output from utility rate already nyears+1 - no offset arrp = as_array("annual_energy_value", &count); if ((int)count != nyears + 1) @@ -2840,7 +2852,7 @@ class cm_host_developer : public compute_module cf.at(CF_after_tax_cash_flow, i) = cf.at(CF_after_tax_net_equity_cost_flow, i) - + cf.at(CF_host_energy_value, i); + + cf.at(CF_host_energy_value, i) + cf.at(CF_host_thermal_value, i); cf.at(CF_payback_with_expenses, i) = cf.at(CF_after_tax_cash_flow, i); @@ -3346,8 +3358,8 @@ class cm_host_developer : public compute_module save_cf( CF_debt_payment_principal, nyears, "cf_debt_payment_principal" ); save_cf( CF_debt_balance, nyears, "cf_debt_balance" ); - save_cf( CF_energy_value, nyears, "cf_energy_value" ); - save_cf( CF_ppa_price, nyears, "cf_ppa_price" ); + save_cf(CF_energy_value, nyears, "cf_energy_value"); + save_cf( CF_ppa_price, nyears, "cf_ppa_price" ); save_cf( CF_om_fixed_expense, nyears, "cf_om_fixed_expense" ); save_cf( CF_om_production_expense, nyears, "cf_om_production_expense" ); save_cf( CF_om_capacity_expense, nyears, "cf_om_capacity_expense" ); diff --git a/ssc/cmod_thermalrate.cpp b/ssc/cmod_thermalrate.cpp index c6bcf6030..69363b81b 100644 --- a/ssc/cmod_thermalrate.cpp +++ b/ssc/cmod_thermalrate.cpp @@ -72,9 +72,11 @@ static var_info vtab_thermal_rate[] = { { SSC_OUTPUT, SSC_ARRAY, "annual_thermal_value", "Thermal value", "$", "", "Annual", "*", "", "" }, // { SSC_OUTPUT, SSC_ARRAY, "annual_thermal_revenue_with_system", "Thermal value with system", "$", "", "Annual", "*", "", "" }, // { SSC_OUTPUT, SSC_ARRAY, "annual_thermal_revenue_without_system", "Thermal value without system", "$", "", "Annual", "*", "", "" }, - { SSC_OUTPUT, SSC_ARRAY, "thermal_revenue_with_system", "Thermal revenue with system", "$", "", "Time Series", "*", "", "" }, - { SSC_OUTPUT, SSC_ARRAY, "thermal_revenue_without_system", "Thermal revenue without system", "$", "", "Time Series", "*", "", "" }, - { SSC_OUTPUT, SSC_NUMBER, "thermal_load_year1", "Thermal load (year 1)", "$", "", "", "*", "", "" }, + { SSC_OUTPUT, SSC_ARRAY, "thermal_revenue_with_system", "Thermal revenue with system", "$", "", "Time Series", "*", "", "" }, + { SSC_OUTPUT, SSC_ARRAY, "thermal_revenue_without_system", "Thermal revenue without system", "$", "", "Time Series", "*", "", "" }, + { SSC_OUTPUT, SSC_ARRAY, "thermal_cost_with_system", "Thermal cost with system", "$", "", "Time Series", "*", "", "" }, + { SSC_OUTPUT, SSC_ARRAY, "thermal_cost_without_system", "Thermal cost without system", "$", "", "Time Series", "*", "", "" }, + { SSC_OUTPUT, SSC_NUMBER, "thermal_load_year1", "Thermal load (year 1)", "$", "", "", "*", "", "" }, { SSC_OUTPUT, SSC_NUMBER, "thermal_savings_year1", "Thermal savings (year 1)", "$", "", "", "*", "", "" }, { SSC_OUTPUT, SSC_NUMBER, "thermal_cost_with_system_year1", "Thermal cost with sytem (year 1)", "$", "", "", "*", "", "" }, { SSC_OUTPUT, SSC_NUMBER, "thermal_cost_without_system_year1", "Thermal cost without system (year 1)", "$", "", "", "*", "", "" },