Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add check for crit load unmet to self consumption metrics #1114

Merged
merged 1 commit into from
Jan 8, 2024
Merged
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
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
Loading