Skip to content

Commit

Permalink
Merge pull request #1114 from NREL/ssc_1110_self_consumption_and_syst…
Browse files Browse the repository at this point in the history
…em_load

Add check for crit load unmet to self consumption metrics
  • Loading branch information
brtietz authored Jan 8, 2024
2 parents 2fe622d + e90d918 commit 13a3fd0
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion ssc/cmod_battery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2105,13 +2105,23 @@ void battstor::calculate_monthly_and_annual_outputs(compute_module& cm)

if (batt_vars->batt_dispatch == dispatch_t::SELF_CONSUMPTION)
{
std::vector<double> crit_load_unmet;
if (cm.is_assigned("crit_load_unmet")) {
crit_load_unmet = cm.as_vector_double("crit_load_unmet");
}

//calculate all outputs for number of timesteps the load is met by the system, using grid_to_load == 0 as a qualification
//better to parse the grid_to_load timeseries once here for all outputs, than to create a new timeseries variable for whether load is met by system
outTimestepsLoadMetBySystemYear1 = 0.0;
outTimestepsLoadMetBySystemLifetime = 0.0;
for (size_t i = 0; i < total_steps; i++)
{
if (outGridToLoad[i] == 0.0)
double crit_load_unmet_i = 0.0;
if (i < crit_load_unmet.size()) {
crit_load_unmet_i = crit_load_unmet[i];
}

if (outGridToLoad[i] == 0.0 && crit_load_unmet_i == 0.0)
{
outTimestepsLoadMetBySystemLifetime++;
if (i < step_per_year) outTimestepsLoadMetBySystemYear1++;
Expand Down

0 comments on commit 13a3fd0

Please sign in to comment.