Skip to content

Commit

Permalink
Merge branch 'develop' into getem-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mjprilliman committed Oct 29, 2023
2 parents 34e0158 + f9f3857 commit a179c4f
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions ssc/cmod_hybrid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ class cm_hybrid : public compute_module

var_table& input = compute_module_inputs->table;
ssc_data_set_array(static_cast<ssc_data_t>(&input), "gen", pGen, (int)genLength);
ssc_data_set_number(static_cast<ssc_data_t>(&input), "system_use_lifetime_output", 1); // for fuelcell_annual_energy_discharged

if (!ssc_module_exec(module, static_cast<ssc_data_t>(&input))) {
// merge in hybrid vartable for configurations where battery and fuel cell dispatch are combined and not in the technology bin
Expand Down Expand Up @@ -362,15 +363,21 @@ class cm_hybrid : public compute_module
for (size_t i = 0; i <= (size_t)analysisPeriod; i++)
pOMProduction[i] *= fuelcell_discharged[i];


// add calculations to compute module outputs - done above for regular ompute module outputs

// add to gen "fuelcell_power" * timestep (set for pGen above)
// cash flow line item is fuelcell_annual_energy_discharged from cmod_fuelcell
std::vector<double> gen(genLength, 0);
gen = ((var_table*)compute_module_outputs)->as_vector_double("fuelcell_power");
if (gen.size() != genLength)
throw exec_error("hybrid", util::format("fuelcell_power size (%d) incorrect", (int)gen.size()));
for (size_t g = 0; g < genLength; g++) {
pGen[g] += gen[g] * maximumTimeStepsPerHour;
}

ssc_data_set_table(outputs, compute_module.c_str(), compute_module_outputs);
ssc_module_free(module);
ssc_data_free(compute_module_outputs);

}

if (batteries.size() > 0) { // run single battery (refator running code below)

percent = 100.0f * ((float)(generators.size() + fuelcells.size() + batteries.size()) / (float)(generators.size() + fuelcells.size() + batteries.size() + financials.size()));
Expand Down Expand Up @@ -572,9 +579,9 @@ class cm_hybrid : public compute_module

var_table& input = compute_module_inputs->table;

if (use_batt_output)
ssc_data_set_array(static_cast<ssc_data_t>(&input), "gen", pBattGen, (int)battGenLen);
else
// if (use_batt_output)
// ssc_data_set_array(static_cast<ssc_data_t>(&input), "gen", pBattGen, (int)battGenLen);
// else
ssc_data_set_array(static_cast<ssc_data_t>(&input), "gen", pGen, (int)genLength);

if (batteries.size() > 0)
Expand Down

0 comments on commit a179c4f

Please sign in to comment.