Skip to content

Commit

Permalink
Merge pull request #1128 from NREL/snow-slide-coeff
Browse files Browse the repository at this point in the history
Expose snow slide coefficient in ssc
  • Loading branch information
mjprilliman committed Feb 29, 2024
2 parents 5599c03 + 58e2bcc commit 936dd95
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion shared/lib_pv_io_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ Subarray_IO::Subarray_IO(compute_module* cm, const std::string& cmName, size_t s
if (trackMode == irrad::SEASONAL_TILT)
throw exec_error(cmName, "Time-series tilt input may not be used with the snow model at this time: subarray " + util::to_string((int)(subarrayNumber)));
// if tracking mode is 1-axis tracking, don't need to limit tilt angles
if (snowModel.setup(selfShadingInputs.nmody, (float)tiltDegrees, (trackMode != irrad::SINGLE_AXIS))) {
if (snowModel.setup(selfShadingInputs.nmody, (float)tiltDegrees, cm->as_double("snow_slide_coefficient"), (trackMode != irrad::SINGLE_AXIS))) {
if (!snowModel.good) {
cm->log(snowModel.msg, SSC_ERROR);
}
Expand Down
6 changes: 3 additions & 3 deletions shared/lib_snowmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
pvsnowmodel::pvsnowmodel()
{
mSlope = -80;
sSlope = (float)1.97;
//sSlope = (float)1.97;
deltaThreshold = 1.00;
depthThreshold = 1.00;
previousDepth = 0;
Expand All @@ -76,11 +76,11 @@ pvsnowmodel::pvsnowmodel()

}

bool pvsnowmodel::setup(int nmody_in, float baseTilt_in, bool limitTilt){
bool pvsnowmodel::setup(int nmody_in, float baseTilt_in, float snow_slide_coeff, bool limitTilt){

nmody = nmody_in;
baseTilt = baseTilt_in;

sSlope = snow_slide_coeff;
if(limitTilt && (baseTilt>45 || baseTilt < 10)){
good = true;
msg = util::format("The snow model is designed to work for PV arrays with a tilt angle between 10 and 45 degrees, but will generate results for tilt angles outside this range. The system you are modeling includes a subarray tilt angle of %f degrees.", baseTilt);
Expand Down
4 changes: 2 additions & 2 deletions shared/lib_snowmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class pvsnowmodel
pvsnowmodel();

// limitTilt requires tilt to be between 10 and 45 degrees
bool setup(int, float, bool limitTilt = true);
bool setup(int, float, float snow_slide_coeff = 1.97, bool limitTilt = true);

bool getLoss(float poa, float tilt, float wspd, float tdry, float snowDepth, int sunup, float dt, float &returnLoss);

Expand All @@ -63,4 +63,4 @@ class pvsnowmodel
// if an error has occured
};

#endif
#endif
2 changes: 2 additions & 0 deletions ssc/cmod_pvsamv1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ static var_info _cm_vtab_pvsamv1[] = {

// misc inputs
{SSC_INPUT, SSC_NUMBER, "en_snow_model", "Toggle snow loss estimation", "0/1", "", "Losses", "?=0", "BOOLEAN", "" },
{ SSC_INPUT, SSC_NUMBER, "snow_slide_coefficient", "Snow Slide Coefficient", "", "", "Losses", "?=1.97", "", "" },

{SSC_INPUT, SSC_NUMBER, "system_capacity", "DC Nameplate capacity", "kWdc", "", "System Design", "*", "", "" },
{SSC_INPUT, SSC_NUMBER, "use_wf_albedo", "Use albedo in weather file if provided", "0/1", "0=user-specified,1=weatherfile", "Solar Resource", "?=1", "BOOLEAN", "" },
{SSC_INPUT, SSC_NUMBER, "use_spatial_albedos", "Use spatial albedo values", "0/1", "0=no,1=yes", "Solar Resource", "?=0", "BOOLEAN", "" },
Expand Down
2 changes: 1 addition & 1 deletion ssc/cmod_pvwattsv7.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ class cm_pvwattsv7 : public compute_module
// if tracking mode is 1-axis tracking,
// don't need to limit tilt angles
if (snowmodel.setup(pv.nmody,
(float)pv.tilt,
(float)pv.tilt, 1.97,
pv.type == FIXED_RACK || pv.type == FIXED_ROOF)) {

if (!snowmodel.good) {
Expand Down
2 changes: 1 addition & 1 deletion ssc/cmod_pvwattsv8.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ class cm_pvwattsv8 : public compute_module
// if tracking mode is 1-axis tracking,
// don't need to limit tilt angles
if (snowmodel.setup(pv.nmody,
(float)pv.tilt,
(float)pv.tilt, 1.97,
pv.type == FIXED_RACK || pv.type == FIXED_ROOF)) {

if (!snowmodel.good) {
Expand Down
6 changes: 4 additions & 2 deletions ssc/cmod_snowmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ static var_info _cm_vtab_snowmodel[] =
{ SSC_INPUT, SSC_NUMBER, "subarray1_nmody", "Number of Modules in a Row","", "", "PV Snow Model", "*", "", "" },
{ SSC_INPUT, SSC_NUMBER, "subarray1_tilt", "Base tilt", "Degrees", "", "PV Snow Model", "*", "", "" },
{ SSC_INPUT, SSC_NUMBER, "subarray1_track_mode", "Tracking Mode", "", "", "PV Snow Model", "*", "", "" },

{ SSC_INPUT, SSC_NUMBER, "snow_slide_coefficient", "Snow Slide Coefficient", "", "", "PV Snow Model", "?=1.97", "", "" },

{ SSC_OUTPUT, SSC_ARRAY, "hourly_energy_before_snow","Hourly Energy Without Snow Loss","kwh", "", "Time Series", "*", "", "" },
{ SSC_OUTPUT, SSC_ARRAY, "monthly_energy_before_snow","Monthly Energy Without Snow Loss","kwh", "", "Monthly", "*", "", "" },
{ SSC_OUTPUT, SSC_NUMBER, "annual_energy_before_snow","Annual Energy Without Snow Losses","kwh", "", "Annual", "*", "", "" },
Expand Down Expand Up @@ -111,7 +112,8 @@ class cm_snowmodel : public compute_module
int nmody = as_integer("subarray1_nmody"); // The number of modules in a row
int baseTilt = as_integer("subarray1_tilt"); // The tilt for static systems
//int trackMode = as_integer("subarray1_track_mode"); // The systems tracking mode (0 -> static, 1 -> 1 axis tracking)

double snow_slide_coeff = 1.97;
if (is_assigned("snow_slide_coefficient")) snow_slide_coeff = as_double("snow_slide_coefficient");
// Define output arrays and variables
ssc_number_t *hrEn_b4Snow = allocate( "hourly_energy_before_snow", num_steps); // Hourly Energy with Snow Modeld

Expand Down

0 comments on commit 936dd95

Please sign in to comment.