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
46 changes: 30 additions & 16 deletions ssc/cmod_cashloan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -490,25 +490,34 @@ class cm_cashloan : public compute_module
escal_or_annual( CF_om_capacity_expense, nyears, "om_capacity", inflation_rate, 1.0, false, as_double("om_capacity_escal")*0.01 );
escal_or_annual( CF_om_fuel_expense, nyears, "om_fuel_cost", inflation_rate, as_double("system_heat_rate")*0.001, false, as_double("om_fuel_cost_escal")*0.01 );

// 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;
ssc_number_t nameplate2 = 0;

if (add_om_num_types > 0)
{
// 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;
ssc_number_t nameplate2 = 0;
std::vector<double> battery_discharged;
std::vector<double> fuelcell_discharged;
for (int i = 0; i <= nyears; i++) {
battery_discharged.push_back(0);
fuelcell_discharged.push_back(0);
}
//throw exec_error("singleowner", "Checkpoint 1");
if (add_om_num_types > 0) //PV Battery
{
escal_or_annual(CF_om_fixed1_expense, nyears, "om_batt_fixed_cost", inflation_rate, 1.0, false, as_double("om_fixed_escal") * 0.01);
escal_or_annual(CF_om_production1_expense, nyears, "om_batt_variable_cost", inflation_rate, 0.001, false, as_double("om_production_escal") * 0.01);
escal_or_annual(CF_om_production1_expense, nyears, "om_batt_variable_cost", inflation_rate, 0.001, false, as_double("om_production_escal") * 0.01); //$/MWh
escal_or_annual(CF_om_capacity1_expense, nyears, "om_batt_capacity_cost", inflation_rate, 1.0, false, as_double("om_capacity_escal") * 0.01);
nameplate1 = as_number("ui_batt_capacity");
}
if (add_om_num_types > 1)
{
escal_or_annual(CF_om_fixed2_expense, nyears, "om_fuelcell_fixed_cost", inflation_rate, 1.0, false, as_double("om_fixed_escal")*0.01);
escal_or_annual(CF_om_production2_expense, nyears, "om_fuelcell_variable_cost", inflation_rate, 0.001, false, as_double("om_production_escal")*0.01);
escal_or_annual(CF_om_capacity2_expense, nyears, "om_fuelcell_capacity_cost", inflation_rate, 1.0, false, as_double("om_capacity_escal")*0.01);
nameplate2 = as_number("ui_fuelcell_capacity");
}
if (as_integer("en_batt") == 1)
battery_discharged = as_vector_double("batt_annual_discharge_energy");
}
if (add_om_num_types > 1) // PV Battery Fuel Cell
{
escal_or_annual(CF_om_fixed2_expense, nyears, "om_fuelcell_fixed_cost", inflation_rate, 1.0, false, as_double("om_fixed_escal") * 0.01);
escal_or_annual(CF_om_production2_expense, nyears, "om_fuelcell_variable_cost", inflation_rate, 0.001, false, as_double("om_production_escal") * 0.01);
escal_or_annual(CF_om_capacity2_expense, nyears, "om_fuelcell_capacity_cost", inflation_rate, 1.0, false, as_double("om_capacity_escal") * 0.01);
nameplate2 = as_number("ui_fuelcell_capacity");
fuelcell_discharged = as_vector_double("fuelcell_annual_energy_discharged");
}

// battery cost - replacement from lifetime analysis
if ((as_integer("en_batt") == 1) && (as_integer("batt_replacement_option") > 0))
Expand Down Expand Up @@ -742,6 +751,11 @@ class cm_cashloan : public compute_module


cf.at(CF_om_fuel_expense,i) *= fuel_use[i];

//Battery Production OM Costs
cf.at(CF_om_production1_expense, i) *= battery_discharged[i]; //$/MWh * 0.001 MWh/kWh * kWh = $
cf.at(CF_om_production2_expense, i) *= fuelcell_discharged[i];

cf.at(CF_om_opt_fuel_1_expense,i) *= om_opt_fuel_1_usage;
cf.at(CF_om_opt_fuel_2_expense,i) *= om_opt_fuel_2_usage;
double decline_percent = 100 - (i-1)*property_tax_decline_percentage;
Expand Down
16 changes: 15 additions & 1 deletion ssc/cmod_equpartflip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1000,23 +1000,33 @@ class cm_equpartflip : 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;
ssc_number_t nameplate2 = 0;
std::vector<double> battery_discharged;
std::vector<double> fuelcell_discharged;
for (int i = 0; i <= nyears; i++) {
battery_discharged.push_back(0);
fuelcell_discharged.push_back(0);
}
//throw exec_error("singleowner", "Checkpoint 1");
if (add_om_num_types > 0) //PV Battery
{
escal_or_annual(CF_om_fixed1_expense, nyears, "om_batt_fixed_cost", inflation_rate, 1.0, false, as_double("om_fixed_escal") * 0.01);
escal_or_annual(CF_om_production1_expense, nyears, "om_batt_variable_cost", inflation_rate, 0.001, false, as_double("om_production_escal") * 0.01);
escal_or_annual(CF_om_production1_expense, nyears, "om_batt_variable_cost", inflation_rate, 0.001, false, as_double("om_production_escal") * 0.01); //$/MWh
escal_or_annual(CF_om_capacity1_expense, nyears, "om_batt_capacity_cost", inflation_rate, 1.0, false, as_double("om_capacity_escal") * 0.01);
nameplate1 = as_number("ui_batt_capacity");
if (as_integer("en_batt") == 1)
battery_discharged = as_vector_double("batt_annual_discharge_energy");
}
if (add_om_num_types > 1) // PV Battery Fuel Cell
{
escal_or_annual(CF_om_fixed2_expense, nyears, "om_fuelcell_fixed_cost", inflation_rate, 1.0, false, as_double("om_fixed_escal") * 0.01);
escal_or_annual(CF_om_production2_expense, nyears, "om_fuelcell_variable_cost", inflation_rate, 0.001, false, as_double("om_production_escal") * 0.01);
escal_or_annual(CF_om_capacity2_expense, nyears, "om_fuelcell_capacity_cost", inflation_rate, 1.0, false, as_double("om_capacity_escal") * 0.01);
nameplate2 = as_number("ui_fuelcell_capacity");
fuelcell_discharged = as_vector_double("fuelcell_annual_energy_discharged");
}

// battery cost - replacement from lifetime analysis
Expand Down Expand Up @@ -1122,6 +1132,10 @@ class cm_equpartflip : public compute_module
cf.at(CF_om_capacity_expense,i) *= nameplate;
cf.at(CF_om_fuel_expense,i) *= year1_fuel_use;

//Battery Production OM Costs
cf.at(CF_om_production1_expense, i) *= battery_discharged[i]; //$/MWh * 0.001 MWh/kWh * kWh = $
cf.at(CF_om_production2_expense, i) *= fuelcell_discharged[i];

cf.at(CF_om_opt_fuel_1_expense,i) *= om_opt_fuel_1_usage;
cf.at(CF_om_opt_fuel_2_expense,i) *= om_opt_fuel_2_usage;
}
Expand Down
11 changes: 9 additions & 2 deletions ssc/cmod_fuelcell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ var_info vtab_fuelcell_output[] = {
{ SSC_OUTPUT, SSC_ARRAY, "fuelcell_fuel_consumption_mcf", "Fuel consumption of fuel cell", "MCf", "", "Fuel Cell", "", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "fuelcell_to_load", "Electricity to load from fuel cell", "kW", "", "Fuel Cell", "", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "fuelcell_to_grid", "Electricity to grid from fuel cell", "kW", "", "Fuel Cell", "", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "fuelcell_annual_energy_discharged", "Annual energy from fuelcell", "kWh", "", "Fuel Cell", "", "", "" },

{ SSC_OUTPUT, SSC_ARRAY, "fuelcell_replacement", "Fuel cell replacements per year", "number/year", "", "Fuel Cell", "", "", "" },
{ SSC_OUTPUT, SSC_NUMBER, "system_heat_rate", "Heat rate conversion factor (MMBTUs/MWhe)", "MMBTUs/MWhe", "", "Fuel Cell", "*", "", "" },
Expand Down Expand Up @@ -141,7 +142,7 @@ void cm_fuelcell::exec()
// float percent_complete = 0.0;
// float percent = 0.0;
// size_t nStatusUpdates = 50;

double annual_energy_fc = 0.0;
/*
if (is_assigned("percent_complete")) {
percent_complete = as_float("percent_complete");
Expand All @@ -155,6 +156,7 @@ void cm_fuelcell::exec()
size_t idx_year = 0;
size_t annual_index;
fcVars->numberOfYears > 1 ? annual_index = y + 1 : annual_index = 0;
annual_energy_fc = 0;

for (size_t h = 0; h < 8760; h++){
/*
Expand All @@ -173,6 +175,7 @@ void cm_fuelcell::exec()
for (size_t s = 0; s < fcVars->stepsPerHour; s++) {
fuelCellDispatch->runSingleTimeStep(h, idx_year, fcVars->systemGeneration_kW[idx], fcVars->electricLoad_kW[idx]);
p_fuelCellPower_kW[idx] = (ssc_number_t)fuelCellDispatch->getPower();
annual_energy_fc += p_fuelCellPower_kW[idx] * fcVars->dt_hour;
p_fuelCellPowerMaxAvailable_percent[idx] = (ssc_number_t)fuelCellDispatch->getPowerMaxPercent();
p_fuelCellLoad_percent[idx] = (ssc_number_t)fuelCellDispatch->getPercentLoad();
p_fuelCellElectricalEfficiency_percent[idx] = (ssc_number_t)fuelCellDispatch->getElectricalEfficiencyPercent();
Expand All @@ -196,11 +199,13 @@ void cm_fuelcell::exec()
annual_fuel = p_fuelCellConsumption_MCf_annual[annual_index];
}

p_fuelCellAnnualEnergy[annual_index] = annual_energy_fc;

// tabulate replacements
p_fuelCellReplacements[annual_index] = (ssc_number_t)(fuelCell->getTotalReplacements());
fuelCell->resetReplacements();
}

ssc_number_t* p_annual_energy_dist_time_fc = gen_heatmap(this, 1);

// capacity factor update
Expand Down Expand Up @@ -244,6 +249,8 @@ void cm_fuelcell::allocateOutputs()
p_fuelCellConsumption_MCf_annual[0] = 0;

p_gen_kW = allocate("gen", fcVars->numberOfLifetimeRecords);
p_fuelCellAnnualEnergy = allocate("fuelcell_annual_energy_discharged", annual_size);
p_fuelCellAnnualEnergy[0] = 0;

}

Expand Down
1 change: 1 addition & 0 deletions ssc/cmod_fuelcell.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ class cm_fuelcell : public compute_module
ssc_number_t * p_fuelCellToLoad_kW;
ssc_number_t * p_fuelCellReplacements;
ssc_number_t * p_fuelCellConsumption_MCf_annual;
ssc_number_t * p_fuelCellAnnualEnergy;
};

#endif
16 changes: 15 additions & 1 deletion ssc/cmod_host_developer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -983,23 +983,33 @@ 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;
ssc_number_t nameplate2 = 0;
std::vector<double> battery_discharged;
std::vector<double> fuelcell_discharged;
for (int i = 0; i <= nyears; i++) {
battery_discharged.push_back(0);
fuelcell_discharged.push_back(0);
}
//throw exec_error("singleowner", "Checkpoint 1");
if (add_om_num_types > 0) //PV Battery
{
escal_or_annual(CF_om_fixed1_expense, nyears, "om_batt_fixed_cost", inflation_rate, 1.0, false, as_double("om_fixed_escal") * 0.01);
escal_or_annual(CF_om_production1_expense, nyears, "om_batt_variable_cost", inflation_rate, 0.001, false, as_double("om_production_escal") * 0.01);
escal_or_annual(CF_om_production1_expense, nyears, "om_batt_variable_cost", inflation_rate, 0.001, false, as_double("om_production_escal") * 0.01); //$/MWh
escal_or_annual(CF_om_capacity1_expense, nyears, "om_batt_capacity_cost", inflation_rate, 1.0, false, as_double("om_capacity_escal") * 0.01);
nameplate1 = as_number("ui_batt_capacity");
if (as_integer("en_batt") == 1)
battery_discharged = as_vector_double("batt_annual_discharge_energy");
}
if (add_om_num_types > 1) // PV Battery Fuel Cell
{
escal_or_annual(CF_om_fixed2_expense, nyears, "om_fuelcell_fixed_cost", inflation_rate, 1.0, false, as_double("om_fixed_escal") * 0.01);
escal_or_annual(CF_om_production2_expense, nyears, "om_fuelcell_variable_cost", inflation_rate, 0.001, false, as_double("om_production_escal") * 0.01);
escal_or_annual(CF_om_capacity2_expense, nyears, "om_fuelcell_capacity_cost", inflation_rate, 1.0, false, as_double("om_capacity_escal") * 0.01);
nameplate2 = as_number("ui_fuelcell_capacity");
fuelcell_discharged = as_vector_double("fuelcell_annual_energy_discharged");
}

// battery cost - replacement from lifetime analysis
Expand Down Expand Up @@ -1105,6 +1115,10 @@ class cm_host_developer : public compute_module
cf.at(CF_om_capacity_expense,i) *= nameplate;
cf.at(CF_om_fuel_expense,i) *= year1_fuel_use;

//Battery Production OM Costs
cf.at(CF_om_production1_expense, i) *= battery_discharged[i]; //$/MWh * 0.001 MWh/kWh * kWh = $
cf.at(CF_om_production2_expense, i) *= fuelcell_discharged[i];

cf.at(CF_om_opt_fuel_1_expense,i) *= om_opt_fuel_1_usage;
cf.at(CF_om_opt_fuel_2_expense,i) *= om_opt_fuel_2_usage;
}
Expand Down
16 changes: 15 additions & 1 deletion ssc/cmod_levpartflip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1020,23 +1020,33 @@ class cm_levpartflip : 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;
ssc_number_t nameplate2 = 0;
std::vector<double> battery_discharged;
std::vector<double> fuelcell_discharged;
for (int i = 0; i <= nyears; i++) {
battery_discharged.push_back(0);
fuelcell_discharged.push_back(0);
}
//throw exec_error("singleowner", "Checkpoint 1");
if (add_om_num_types > 0) //PV Battery
{
escal_or_annual(CF_om_fixed1_expense, nyears, "om_batt_fixed_cost", inflation_rate, 1.0, false, as_double("om_fixed_escal") * 0.01);
escal_or_annual(CF_om_production1_expense, nyears, "om_batt_variable_cost", inflation_rate, 0.001, false, as_double("om_production_escal") * 0.01);
escal_or_annual(CF_om_production1_expense, nyears, "om_batt_variable_cost", inflation_rate, 0.001, false, as_double("om_production_escal") * 0.01); //$/MWh
escal_or_annual(CF_om_capacity1_expense, nyears, "om_batt_capacity_cost", inflation_rate, 1.0, false, as_double("om_capacity_escal") * 0.01);
nameplate1 = as_number("ui_batt_capacity");
if (as_integer("en_batt") == 1)
battery_discharged = as_vector_double("batt_annual_discharge_energy");
}
if (add_om_num_types > 1) // PV Battery Fuel Cell
{
escal_or_annual(CF_om_fixed2_expense, nyears, "om_fuelcell_fixed_cost", inflation_rate, 1.0, false, as_double("om_fixed_escal") * 0.01);
escal_or_annual(CF_om_production2_expense, nyears, "om_fuelcell_variable_cost", inflation_rate, 0.001, false, as_double("om_production_escal") * 0.01);
escal_or_annual(CF_om_capacity2_expense, nyears, "om_fuelcell_capacity_cost", inflation_rate, 1.0, false, as_double("om_capacity_escal") * 0.01);
nameplate2 = as_number("ui_fuelcell_capacity");
fuelcell_discharged = as_vector_double("fuelcell_annual_energy_discharged");
}

// battery cost - replacement from lifetime analysis
Expand Down Expand Up @@ -1144,6 +1154,10 @@ class cm_levpartflip : public compute_module
cf.at(CF_om_capacity_expense,i) *= nameplate;
cf.at(CF_om_fuel_expense,i) *= year1_fuel_use;

//Battery Production OM Costs
cf.at(CF_om_production1_expense, i) *= battery_discharged[i]; //$/MWh * 0.001 MWh/kWh * kWh = $
cf.at(CF_om_production2_expense, i) *= fuelcell_discharged[i];

cf.at(CF_om_opt_fuel_1_expense,i) *= om_opt_fuel_1_usage;
cf.at(CF_om_opt_fuel_2_expense,i) *= om_opt_fuel_2_usage;
}
Expand Down
25 changes: 19 additions & 6 deletions ssc/cmod_merchantplant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1037,24 +1037,33 @@ class cm_merchantplant : 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;
ssc_number_t nameplate2 = 0;

// 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;
ssc_number_t nameplate2 = 0;
std::vector<double> battery_discharged;
std::vector<double> fuelcell_discharged;
for (int i = 0; i <= nyears; i++) {
battery_discharged.push_back(0);
fuelcell_discharged.push_back(0);
}
//throw exec_error("singleowner", "Checkpoint 1");
if (add_om_num_types > 0) //PV Battery
{
escal_or_annual(CF_om_fixed1_expense, nyears, "om_batt_fixed_cost", inflation_rate, 1.0, false, as_double("om_fixed_escal") * 0.01);
escal_or_annual(CF_om_production1_expense, nyears, "om_batt_variable_cost", inflation_rate, 0.001, false, as_double("om_production_escal") * 0.01);
escal_or_annual(CF_om_production1_expense, nyears, "om_batt_variable_cost", inflation_rate, 0.001, false, as_double("om_production_escal") * 0.01); //$/MWh
escal_or_annual(CF_om_capacity1_expense, nyears, "om_batt_capacity_cost", inflation_rate, 1.0, false, as_double("om_capacity_escal") * 0.01);
nameplate1 = as_number("ui_batt_capacity");
if (as_integer("en_batt") == 1)
battery_discharged = as_vector_double("batt_annual_discharge_energy");
}
if (add_om_num_types > 1) // PV Battery Fuel Cell
{
escal_or_annual(CF_om_fixed2_expense, nyears, "om_fuelcell_fixed_cost", inflation_rate, 1.0, false, as_double("om_fixed_escal") * 0.01);
escal_or_annual(CF_om_production2_expense, nyears, "om_fuelcell_variable_cost", inflation_rate, 0.001, false, as_double("om_production_escal") * 0.01);
escal_or_annual(CF_om_capacity2_expense, nyears, "om_fuelcell_capacity_cost", inflation_rate, 1.0, false, as_double("om_capacity_escal") * 0.01);
nameplate2 = as_number("ui_fuelcell_capacity");
fuelcell_discharged = as_vector_double("fuelcell_annual_energy_discharged");
}


Expand Down Expand Up @@ -1297,6 +1306,10 @@ class cm_merchantplant : public compute_module
cf.at(CF_om_capacity2_expense, i) *= nameplate2;
cf.at(CF_om_fuel_expense,i) *= fuel_use[i];

//Battery Production OM Costs
cf.at(CF_om_production1_expense, i) *= battery_discharged[i]; //$/MWh * 0.001 MWh/kWh * kWh = $
cf.at(CF_om_production2_expense, i) *= fuelcell_discharged[i];

cf.at(CF_om_opt_fuel_1_expense,i) *= om_opt_fuel_1_usage;
cf.at(CF_om_opt_fuel_2_expense,i) *= om_opt_fuel_2_usage;
}
Expand Down
Loading