Skip to content

Commit

Permalink
Add cash flow net heat output in MMBtu to IPH single owner and cashlo…
Browse files Browse the repository at this point in the history
…an cmods.
  • Loading branch information
taylorbrown75 committed Nov 15, 2024
1 parent dbbb015 commit b58cf62
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
9 changes: 8 additions & 1 deletion ssc/cmod_cashloan_heat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ static var_info vtab_cashloan_heat[] = {


{ SSC_OUTPUT, SSC_ARRAY, "cf_energy_net", "Thermal energy", "kWht", "", "Cash Flow Electricity", "*", "LENGTH_EQUAL=cf_length", "" },
{ SSC_OUTPUT, SSC_ARRAY, "cf_energy_net_heat_btu", "Thermal energy", "MMBtu", "", "Cash Flow Electricity", "*", "LENGTH_EQUAL=cf_length", "" },
{ SSC_OUTPUT, SSC_ARRAY, "cf_energy_sales", "Electricity generation", "kWh", "", "Cash Flow Electricity", "*", "LENGTH_EQUAL=cf_length", "" },
{ SSC_OUTPUT, SSC_ARRAY, "cf_energy_purchases", "Electricity from grid to system", "kWh", "", "Cash Flow Electricity", "*", "LENGTH_EQUAL=cf_length", "" },
{ SSC_OUTPUT, SSC_ARRAY, "cf_energy_without_battery","Electricity generated without the battery or curtailment", "kWh", "", "Cash Flow Electricity", "", "LENGTH_EQUAL=cf_length", "" },
Expand Down Expand Up @@ -1563,7 +1564,13 @@ class cm_cashloan_heat : public compute_module
save_cf(CF_itc_sta, nyears, "cf_itc_sta");
save_cf(CF_itc_total, nyears, "cf_itc_total");


// Save cf_energy_net_heat_btu (converted from cf_energy_net)
const double MMBTU_TO_KWh = 293.07107; // 1 MMBtu = 293.07107 kWh
std::vector<double> cf_energy_net_vec = as_vector_double("cf_energy_net"); //[kWht]
int cf_energy_net_size = cf_energy_net_vec.size();
ssc_number_t* cf_energy_net_heat_btu_arr = allocate("cf_energy_net_heat_btu", cf_energy_net_size);
for (int i = 0; i <= cf_energy_net_size; i++)
cf_energy_net_heat_btu_arr[i] = (ssc_number_t)(cf_energy_net_vec[i] / MMBTU_TO_KWh); //[MMBtu]
}

/* These functions can be placed in common financial library with matrix and constants passed? */
Expand Down
8 changes: 8 additions & 0 deletions ssc/cmod_singleowner_heat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,7 @@ static var_info _cm_vtab_singleowner_heat[] = {

/* Partial Income Statement: Project */
{ SSC_OUTPUT, SSC_ARRAY, "cf_energy_net", "Thermal energy", "kWht", "", "Cash Flow Electricity", "*", "LENGTH_EQUAL=cf_length", "" },
{ SSC_OUTPUT, SSC_ARRAY, "cf_energy_net_heat_btu", "Thermal energy", "MMBtu", "", "Cash Flow Electricity", "*", "LENGTH_EQUAL=cf_length", "" },
{ SSC_OUTPUT, SSC_ARRAY, "cf_energy_sales", "Thermal energy to grid", "kWht", "", "Cash Flow Electricity", "*", "LENGTH_EQUAL=cf_length", "" },
{ SSC_OUTPUT, SSC_ARRAY, "cf_energy_purchases", "Thermal energy from grid", "kWht", "", "Cash Flow Electricity", "*", "LENGTH_EQUAL=cf_length", "" },
{ SSC_OUTPUT, SSC_ARRAY, "cf_energy_without_battery", "Thermal energy generated without storage", "kWht", "", "Cash Flow Electricity", "", "LENGTH_EQUAL=cf_length", "" },
Expand Down Expand Up @@ -3988,6 +3989,13 @@ class cm_singleowner_heat : public compute_module
save_cf(CF_itc_sta, nyears, "cf_itc_sta");
save_cf(CF_itc_total, nyears, "cf_itc_total");


// Save cf_energy_net_heat_btu (converted from cf_energy_net)
std::vector<double> cf_energy_net_vec = as_vector_double("cf_energy_net"); //[kWht]
int cf_energy_net_size = cf_energy_net_vec.size();
ssc_number_t* cf_energy_net_heat_btu_arr = allocate("cf_energy_net_heat_btu", cf_energy_net_size);
for (int i = 0; i <= cf_energy_net_size; i++)
cf_energy_net_heat_btu_arr[i] = (ssc_number_t)(cf_energy_net_vec[i] / MMBTU_TO_KWh); //[MMBtu]
}


Expand Down

0 comments on commit b58cf62

Please sign in to comment.