Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ssc/cmod_cashloan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1034,7 +1034,7 @@ class cm_cashloan : public compute_module
cf_lcos.at(8, y) = cf.at(CF_om_capacity1_expense, y); //Capacity OM Battery Cost
}
int grid_charging_cost_version = 0;
lcos_calc(this, cf_lcos, nyears, nom_discount_rate, inflation_rate, lcoe_real, total_cost, real_discount_rate, grid_charging_cost_version, 0);
lcos_calc(this, cf_lcos, nyears, nom_discount_rate, inflation_rate, lcoe_real, total_cost, real_discount_rate, grid_charging_cost_version);
}
/////////////////////////////////////////////////////////////////////////////////////////

Expand Down
2 changes: 1 addition & 1 deletion ssc/cmod_equpartflip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2482,7 +2482,7 @@ class cm_equpartflip : public compute_module
int grid_charging_cost_version = 1; //FOM systems
size_t n_multipliers;
ssc_number_t* ppa_multipliers = as_array("ppa_multipliers", &n_multipliers);
lcos_calc(this, cf_lcos, nyears, nom_discount_rate, inflation_rate, lcoe_real, cost_prefinancing, disc_real, grid_charging_cost_version, ppa_multipliers);
lcos_calc(this, cf_lcos, nyears, nom_discount_rate, inflation_rate, lcoe_real, cost_prefinancing, disc_real, grid_charging_cost_version);
}
/////////////////////////////////////////////////////////////////////////////////////////

Expand Down
2 changes: 1 addition & 1 deletion ssc/cmod_host_developer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2767,7 +2767,7 @@ class cm_host_developer : public compute_module
cf_lcos.at(8, y) = cf.at(CF_om_capacity1_expense, y); //Capacity OM Battery Cost
}
int grid_charging_cost_version = 0;
lcos_calc(this, cf_lcos, nyears, nom_discount_rate, inflation_rate, lcoe_real, cost_prefinancing, disc_real, grid_charging_cost_version, 0);
lcos_calc(this, cf_lcos, nyears, nom_discount_rate, inflation_rate, lcoe_real, cost_prefinancing, disc_real, grid_charging_cost_version);
/*
double lcos_investment_cost = as_double("battery_total_cost_lcos"); //does not include replacement costs
double lcos_om_cost = npv(CF_om_capacity1_expense, nyears, nom_discount_rate); //Todo: include variable om due to charging
Expand Down
2 changes: 1 addition & 1 deletion ssc/cmod_levpartflip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2759,7 +2759,7 @@ class cm_levpartflip : public compute_module
int grid_charging_cost_version = 1;
size_t n_multipliers;
ssc_number_t* ppa_multipliers = as_array("ppa_multipliers", &n_multipliers);
lcos_calc(this, cf_lcos, nyears, nom_discount_rate, inflation_rate, lcoe_real, cost_prefinancing, disc_real, grid_charging_cost_version, ppa_multipliers);
lcos_calc(this, cf_lcos, nyears, nom_discount_rate, inflation_rate, lcoe_real, cost_prefinancing, disc_real, grid_charging_cost_version);
}
/////////////////////////////////////////////////////////////////////////////////////////

Expand Down
2 changes: 1 addition & 1 deletion ssc/cmod_merchantplant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2731,7 +2731,7 @@ class cm_merchantplant : public compute_module

}
int grid_charging_cost_version = 2; //Merchant plant
lcos_calc(this, cf_lcos, nyears, nom_discount_rate, inflation_rate, lcoe_real, cost_prefinancing, disc_real, grid_charging_cost_version, 0);
lcos_calc(this, cf_lcos, nyears, nom_discount_rate, inflation_rate, lcoe_real, cost_prefinancing, disc_real, grid_charging_cost_version);
/*
double lcos_investment_cost = as_double("battery_total_cost_lcos"); //does not include replacement costs
double lcos_om_cost = npv(CF_om_capacity1_expense, nyears, nom_discount_rate); //Todo: include variable om due to charging
Expand Down
2 changes: 1 addition & 1 deletion ssc/cmod_saleleaseback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2565,7 +2565,7 @@ class cm_saleleaseback : public compute_module
int grid_charging_cost_version = 1;
size_t n_multipliers;
ssc_number_t* ppa_multipliers = as_array("ppa_multipliers", &n_multipliers);
lcos_calc(this, cf_lcos, nyears, nom_discount_rate, inflation_rate, lcoe_real, cost_prefinancing, disc_real, grid_charging_cost_version, ppa_multipliers);
lcos_calc(this, cf_lcos, nyears, nom_discount_rate, inflation_rate, lcoe_real, cost_prefinancing, disc_real, grid_charging_cost_version);
}
/////////////////////////////////////////////////////////////////////////////////////////

Expand Down
4 changes: 3 additions & 1 deletion ssc/cmod_singleowner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2997,7 +2997,9 @@ class cm_singleowner : public compute_module
cf_lcos.at(8, y) = cf.at(CF_om_capacity1_expense, y); //Capacity OM Battery Cost
}
int grid_charging_cost_version = 1;
lcos_calc(this, cf_lcos, nyears, nom_discount_rate, inflation_rate, lcoe_real, cost_prefinancing, disc_real, grid_charging_cost_version, ppa_multipliers);
ssc_number_t* tod_multipliers;
size_t* n_tod_multipliers = 0;
lcos_calc(this, cf_lcos, nyears, nom_discount_rate, inflation_rate, lcoe_real, cost_prefinancing, disc_real, grid_charging_cost_version);
}
/////////////////////////////////////////////////////////////////////////////////////////

Expand Down
21 changes: 18 additions & 3 deletions ssc/common_financial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3401,7 +3401,7 @@ void save_cf(int cf_line, int nyears, const std::string& name, util::matrix_t<do
arrp[i] = (ssc_number_t)cf.at(cf_line, i);
}

void lcos_calc(compute_module* cm, util::matrix_t<double> cf, int nyears, double nom_discount_rate, double inflation_rate, double lcoe_real, double total_cost, double real_discount_rate, int grid_charging_cost_version, ssc_number_t* ppa_multipliers = { 0 }) {
void lcos_calc(compute_module* cm, util::matrix_t<double> cf, int nyears, double nom_discount_rate, double inflation_rate, double lcoe_real, double total_cost, double real_discount_rate, int grid_charging_cost_version) {
enum {
CF_battery_replacement_cost_lcos,
CF_battery_replacement_cost_schedule_lcos,
Expand Down Expand Up @@ -3495,6 +3495,18 @@ void lcos_calc(compute_module* cm, util::matrix_t<double> cf, int nyears, double
double lcoe_real_lcos = lcoe_real * capex_lcoe_ratio * (total_cost - lcos_investment_cost) / total_cost; //cents/kWh
//Using ration of investment cost to lcoe for system+storage and system only to approximate lcoe for system only; Used in PV charging cost calculations

//Preallocate tod multiplier index
size_t tod_mult_index = 0;
ssc_number_t* tod_multipliers;
size_t* n_tod_multipliers = 0;
if (grid_charging_cost_version == 1) {
if (cm->is_assigned("ppa_multiplier_model") && cm->as_integer("ppa_multiplier_model") == 0) {
tod_multipliers = cm->as_array("ppa_multipliers", n_tod_multipliers);
}
else if (cm->is_assigned("ppa_multiplier_model") && cm->as_integer("ppa_multiplier_model") == 1) {
tod_multipliers = cm->as_array("dispatch_factors_ts", n_tod_multipliers);
}
}

for (int a = 0; a <= nyears; a++) { //Iterate through nyears of the project

Expand All @@ -3516,7 +3528,8 @@ void lcos_calc(compute_module* cm, util::matrix_t<double> cf, int nyears, double
double ppa_value = cf.at(CF_ppa_price_lcos, a); //PPA price at year a
if (ppa_purchases && a != 0) {
for (size_t h = 0; h < n_steps_per_year; h++) {
cf.at(CF_charging_cost_grid_lcos, a) += grid_to_batt[(size_t(a) - 1) * n_steps_per_year + h] * 8760 / n_steps_per_year * ppa_value / 100.0 * ppa_multipliers[h]; //Grid charging cost from PPA price ($)
tod_mult_index = floor(h / (n_steps_per_year/8760));
cf.at(CF_charging_cost_grid_lcos, a) += grid_to_batt[(size_t(a) - 1) * n_steps_per_year + h] * 8760 / n_steps_per_year * ppa_value / 100.0 * tod_multipliers[tod_mult_index]; //Grid charging cost from PPA price ($)
}
}
else if (!ppa_purchases && a != 0) {
Expand All @@ -3537,7 +3550,9 @@ void lcos_calc(compute_module* cm, util::matrix_t<double> cf, int nyears, double

if (ppa_purchases && a != 0) { //PPA purchases enabled and not in investment year
for (size_t h = 0; h < 8760; h++) {
cf.at(CF_charging_cost_grid_lcos, a) += grid_to_batt[h] * cf.at(CF_degradation_lcos, a) * ppa_value / 100.0 * ppa_multipliers[h]; //Grid charging cost calculated from PPA price ($)

tod_mult_index = floor(h / 8760);
cf.at(CF_charging_cost_grid_lcos, a) += grid_to_batt[h] * cf.at(CF_degradation_lcos, a) * ppa_value / 100.0 * tod_multipliers[h]; //Grid charging cost calculated from PPA price ($)
}
}
else if (!ppa_purchases && a != 0) { //No PPA purchases and not in investment year
Expand Down
2 changes: 1 addition & 1 deletion ssc/common_financial.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ void save_cf(int cf_line, int nyears, const std::string& name, util::matrix_t<do

extern var_info vtab_lcos_inputs[]; //LCOS var table

void lcos_calc(compute_module* cm, util::matrix_t<double> cf, int nyears, double nom_discount_rate, double inflation_rate, double lcoe_real, double total_cost, double real_discount_rate, int grid_charging_cost_version, ssc_number_t* ppa_multipliers); //LCOS function
void lcos_calc(compute_module* cm, util::matrix_t<double> cf, int nyears, double nom_discount_rate, double inflation_rate, double lcoe_real, double total_cost, double real_discount_rate, int grid_charging_cost_version); //LCOS function


class dispatch_calculations
Expand Down