Skip to content

Commit

Permalink
Merge branch 'develop' into ortools
Browse files Browse the repository at this point in the history
  • Loading branch information
dguittet authored Oct 10, 2023
2 parents 3ab34a2 + 798f4b3 commit 3be8f42
Show file tree
Hide file tree
Showing 42 changed files with 581 additions and 578 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 0 additions & 5 deletions ssc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ set(SSC_SRC
cmod_mhk_wave.cpp
cmod_mspt_sf_and_rec_isolated.cpp
cmod_mspt_iph.cpp
cmod_poacalib.cpp
cmod_ptes_design_point.cpp
cmod_pv6parmod.cpp
cmod_pv_get_shade_loss_mpp.cpp
Expand All @@ -82,10 +81,6 @@ set(SSC_SRC
cmod_pvsamv1_eqns.cpp
cmod_pvsamv1_eqns.h
cmod_pvsandiainv.cpp
cmod_pvwattsv0.cpp
cmod_pvwattsv1.cpp
cmod_pvwattsv1_1ts.cpp
cmod_pvwattsv1_poa.cpp
cmod_pvwattsv5.cpp
cmod_pvwattsv7.cpp
cmod_pvwattsv8.cpp
Expand Down
12 changes: 4 additions & 8 deletions ssc/cmod_annualoutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,13 @@ static var_info _cm_vtab_annualoutput[] = {
{ SSC_INPUT, SSC_ARRAY, "energy_degradation", "Annual energy degradation", "%", "", "AnnualOutput", "*", "", "" },
{ SSC_INPUT, SSC_MATRIX, "energy_curtailment", "First year energy curtailment", "", "(0..1)", "AnnualOutput", "*", "", "" },
{ SSC_INPUT, SSC_NUMBER, "system_use_lifetime_output", "Lifetime hourly system outputs", "0/1", "0=hourly first year,1=hourly lifetime", "AnnualOutput", "*", "INTEGER,MIN=0", "" },
// { SSC_INPUT, SSC_ARRAY, "energy_net", "Hourly energy produced by the system", "kW", "", "AnnualOutput", "*", "", "" },
{ SSC_INPUT, SSC_ARRAY, "system_hourly_energy", "Hourly energy produced by the system", "kW", "", "AnnualOutput", "*", "", "" },
{ SSC_INPUT, SSC_ARRAY, "system_hourly_energy", "Hourly energy produced by the system", "kW", "", "AnnualOutput", "*", "", "" },


/* output */
// { SSC_OUTPUT, SSC_ARRAY, "annual_e_net_delivered", "Annual energy", "kWh", "", "AnnualOutput", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "annual_energy", "Annual energy", "kWh", "", "AnnualOutput", "*", "", "" },
// { SSC_OUTPUT, SSC_ARRAY, "monthly_e_net_delivered", "Monthly energy", "kWh", "", "AnnualOutput", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "monthly_energy", "Monthly energy gross", "kWh", "", "AnnualOutput", "*", "", "" },
// { SSC_OUTPUT, SSC_ARRAY, "hourly_e_net_delivered", "Hourly energy", "kWh", "", "AnnualOutput", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "hourly_energy", "Hourly energy", "kWh", "", "AnnualOutput", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "annual_energy", "Annual energy", "kWh", "", "AnnualOutput", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "monthly_energy", "Monthly energy gross", "kWh", "", "AnnualOutput", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "hourly_energy", "Hourly energy", "kWh", "", "AnnualOutput", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "annual_availability", "Annual availability", "", "", "AnnualOutput", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "annual_degradation", "Annual degradation", "", "", "AnnualOutput", "*", "", "" },

Expand Down
28 changes: 28 additions & 0 deletions ssc/cmod_battery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,12 @@ var_info vtab_battery_outputs[] = {
{ SSC_OUTPUT, SSC_NUMBER, "batt_pvs_energy_to_grid_percent", "PV smoothing energy to grid percent (loss due to curtail and battery loss)", "%", "", "Battery", "", "", "" },
{ SSC_OUTPUT, SSC_NUMBER, "batt_pvs_energy_to_grid_percent_sam", "PV smoothing energy to grid percent actual (loss due to curtail and battery loss)", "%", "", "Battery", "", "", "" },

// Self-consumption outputs
{ SSC_OUTPUT, SSC_NUMBER, "num_ts_load_met_by_system_yr1", "Number of timesteps electric load met by system (year 1)", "", "", "Battery", "", "", "" },
{ SSC_OUTPUT, SSC_NUMBER, "percent_ts_load_met_by_system_yr1", "Percent of timesteps electric load met by system (year 1)", "", "", "Battery", "", "", "" },
{ SSC_OUTPUT, SSC_NUMBER, "num_ts_load_met_by_system_lifetime", "Number of timesteps electric load met by system (lifetime)", "", "", "Battery", "", "", "" },
{ SSC_OUTPUT, SSC_NUMBER, "percent_ts_load_met_by_system_lifetime", "Percent of timesteps electric load met by system (lifetime)", "", "", "Battery", "", "", "" },

// validation outputs at ramp interval - use for debugging and remove for release
/*
{ SSC_OUTPUT, SSC_ARRAY, "batt_pvs_outpower_vec", "PV smoothing outpower at ramp interval", "kW", "", "Battery", "", "", "" },
Expand Down Expand Up @@ -2093,6 +2099,28 @@ void battstor::calculate_monthly_and_annual_outputs(compute_module& cm)
cm.accumulate_monthly_for_year("system_to_load", "monthly_system_to_load", _dt_hour, step_per_hour);
cm.accumulate_monthly_for_year("batt_to_load", "monthly_batt_to_load", _dt_hour, step_per_hour);
cm.accumulate_monthly_for_year("grid_to_load", "monthly_grid_to_load", _dt_hour, step_per_hour);

if (batt_vars->batt_dispatch == dispatch_t::SELF_CONSUMPTION)
{
//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)
{
outTimestepsLoadMetBySystemLifetime++;
if (i < step_per_year) outTimestepsLoadMetBySystemYear1++;
}
}
cm.assign("num_ts_load_met_by_system_yr1", outTimestepsLoadMetBySystemYear1);
cm.assign("num_ts_load_met_by_system_lifetime", outTimestepsLoadMetBySystemLifetime);
outPercentTimestepsLoadMetBySystemYear1 = (outTimestepsLoadMetBySystemYear1 / step_per_year) * 100.0;
cm.assign("percent_ts_load_met_by_system_yr1", (ssc_number_t)outPercentTimestepsLoadMetBySystemYear1);
outPercentTimestepsLoadMetBySystemLifetime = (outTimestepsLoadMetBySystemLifetime / total_steps) * 100.0;
cm.assign("percent_ts_load_met_by_system_lifetime", (ssc_number_t)outPercentTimestepsLoadMetBySystemLifetime);
}
}
else if (batt_vars->batt_meter_position == dispatch_t::FRONT)
{
Expand Down
6 changes: 6 additions & 0 deletions ssc/cmod_battery.h
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,12 @@ struct battstor
double outAverageCycleEfficiency;
double outAverageRoundtripEfficiency;
double outSystemChargePercent;

//output variables for self-consumption dispatch
double outTimestepsLoadMetBySystemYear1;
double outPercentTimestepsLoadMetBySystemYear1;
double outTimestepsLoadMetBySystemLifetime;
double outPercentTimestepsLoadMetBySystemLifetime;
};

#endif
Loading

0 comments on commit 3be8f42

Please sign in to comment.