Skip to content

Commit

Permalink
Merge pull request #1068 from NREL/sam_1064_correct_monthly_curtailment
Browse files Browse the repository at this point in the history
Sam 1064 correct monthly curtailment
  • Loading branch information
sjanzou authored Oct 31, 2023
2 parents 55ba5ac + 4e47cfd commit 92e232c
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 8 deletions.
File renamed without changes.
1 change: 0 additions & 1 deletion ssc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ include_directories(. ../splinter ../shared ../nlopt ../lpsolve ../solarpilot ..

set(SSC_SRC
cmod_6parsolve.cpp
cmod_annualoutput.cpp
cmod_analysisperiodchange_eqns.cpp
cmod_analysisperiodchange_eqns.h
cmod_battery.cpp
Expand Down
8 changes: 5 additions & 3 deletions ssc/cmod_geothermal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,9 @@ static var_info _cm_vtab_geothermal[] = {

{ SSC_OUTPUT, SSC_ARRAY, "monthly_resource_temperature", "Monthly avg resource temperature", "C", "", "GeoHourly", "ui_calculations_only=0", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "monthly_power", "Monthly power", "kW", "", "GeoHourly", "ui_calculations_only=0", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "monthly_energy", "Monthly energy before performance adjustments", "kWh", "", "GeoHourly", "ui_calculations_only=0", "", "" },

{ SSC_OUTPUT, SSC_ARRAY, "monthly_energy", "AC energy (year 1)", "kWh/mo", "", "GeoHourly", "", "LENGTH=12", "" },
{ SSC_OUTPUT, SSC_ARRAY, "monthly_energy_lifetime", "Monthly energy before performance adjustments", "kWh", "", "GeoHourly", "ui_calculations_only=0", "", "" },

{ SSC_OUTPUT, SSC_ARRAY, "timestep_resource_temperature", "Resource temperature", "C", "", "GeoHourly", "ui_calculations_only=0", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "timestep_test_values", "Test output values in each time step", "", "", "GeoHourly", "ui_calculations_only=0", "", "" },

Expand Down Expand Up @@ -494,7 +495,7 @@ class cm_geothermal : public compute_module
// allocate lifetime monthly arrays (one element per month, over lifetime of project)
geo_outputs.maf_monthly_resource_temp = allocate("monthly_resource_temperature", 12 * geo_inputs.mi_ProjectLifeYears);
geo_outputs.maf_monthly_power = allocate("monthly_power", 12 * geo_inputs.mi_ProjectLifeYears);
geo_outputs.maf_monthly_energy = allocate("monthly_energy", 12 * geo_inputs.mi_ProjectLifeYears);
geo_outputs.maf_monthly_energy = allocate("monthly_energy_lifetime", 12 * geo_inputs.mi_ProjectLifeYears);

// allocate lifetime timestep arrays (one element per timestep, over lifetime of project)
// if this is a monthly analysis, these are redundant with monthly arrays that track same outputs
Expand Down Expand Up @@ -656,6 +657,7 @@ class cm_geothermal : public compute_module
assign("kwh_per_kw", var_data((ssc_number_t)kWhperkW));
// 5/28/15 average provided for FCR market
assign("annual_energy", var_data((ssc_number_t)(annual_energy / geo_inputs.mi_ProjectLifeYears)));
accumulate_monthly_for_year("gen", "monthly_energy", 8760.0 / n_rec, n_rec / 8760);
}

// this assignment happens in UI calculations and model run
Expand Down
3 changes: 3 additions & 0 deletions ssc/cmod_grid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ var_info vtab_grid_input[] = {
{ SSC_INPUT, SSC_ARRAY, "crit_load", "Critical electricity load (year 1)", "kW", "", "Load", "", "", "" },
{ SSC_INOUT, SSC_ARRAY, "grid_outage", "Grid outage in this time step", "0/1", "0=GridAvailable,1=GridUnavailable,Length=load", "Load", "", "", "" },
{ SSC_INPUT, SSC_ARRAY, "load_escalation", "Annual load escalation", "%/year", "", "Load", "?=0", "", "" },
{ SSC_INOUT, SSC_ARRAY, "monthly_energy", "AC energy (year 1)", "kWh/mo", "", "Monthly", "", "LENGTH=12", "" },


var_info_invalid };

Expand Down Expand Up @@ -233,6 +235,7 @@ void cm_grid::exec()
annual_energy_pre_interconnect *= gridVars->dt_hour_gen;
annual_energy *= gridVars->dt_hour_gen;

accumulate_monthly_for_year("gen", "monthly_energy", gridVars->dt_hour_gen, num_steps_per_hour);

// annual_energy_interconnect = std::accumulate(gridVars->systemGenerationLifetime_kW.begin(), gridVars->systemGenerationLifetime_kW.begin() + gridVars->numberOfSingleYearRecords, (double)0.0)*gridVars->dt_hour_gen;
if (gridVars->enable_interconnection_limit)
Expand Down
2 changes: 0 additions & 2 deletions ssc/sscapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ extern module_entry_info
cm_entry_utilityrate4,
cm_entry_utilityrate5,
cm_entry_utilityrateforecast,
cm_entry_annualoutput,
cm_entry_cashloan,
cm_entry_thirdpartyownership,
cm_entry_ippppa,
Expand Down Expand Up @@ -187,7 +186,6 @@ static module_entry_info *module_table[] = {
&cm_entry_utilityrate4,
&cm_entry_utilityrate5,
&cm_entry_utilityrateforecast,
&cm_entry_annualoutput,
&cm_entry_cashloan,
&cm_entry_thirdpartyownership,
&cm_entry_ippppa,
Expand Down
4 changes: 2 additions & 2 deletions test/input_cases/grid_common_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.



#ifndef _FUELCELL_COMMON_DATA_H_
#define _FUELCELL_COMMON_DATA_H_
#ifndef _GRID_COMMON_DATA_H_
#define _GRID_COMMON_DATA_H_

#include <stdio.h>
#include "code_generator_utilities.h"
Expand Down

0 comments on commit 92e232c

Please sign in to comment.