diff --git a/shared/lib_irradproc.cpp b/shared/lib_irradproc.cpp index 35db1295a..353f4945a 100644 --- a/shared/lib_irradproc.cpp +++ b/shared/lib_irradproc.cpp @@ -1224,6 +1224,8 @@ void incidence(int mode, double tilt, double sazm, double rlim, double zen, rot = backtracking_rotation; } + /*Check if custom tilt angles enabled, apply timeseries value*/ + /* Find tilt angle for the tracking surface */ arg = cos(xtilt) * cos(rot); if (arg < -1.0) @@ -1766,7 +1768,7 @@ irrad::irrad(weather_record wf, weather_header hdr, double groundCoverageRatioIn, double slopeTiltIn, double slopeAzmIn, std::vector monthlyTiltDegrees, std::vector userSpecifiedAlbedo, poaDecompReq *poaAllIn, - bool useSpatialAlbedos, const util::matrix_t* userSpecifiedSpatialAlbedos, bool enableSubhourlyClipping) : + bool useSpatialAlbedos, const util::matrix_t* userSpecifiedSpatialAlbedos, bool enableSubhourlyClipping, bool useCustomTiltAngles) : skyModel(skyModelIn), radiationMode(radiationModeIn), trackingMode(trackModeIn), enableBacktrack(backtrackingEnabled), forceToStow(forceToStowIn), delt(dtHour), tiltDegrees(tiltDegreesIn), surfaceAzimuthDegrees(azimuthDegreesIn), diff --git a/shared/lib_irradproc.h b/shared/lib_irradproc.h index 864aff360..61ec9a122 100644 --- a/shared/lib_irradproc.h +++ b/shared/lib_irradproc.h @@ -1055,7 +1055,7 @@ class irrad double dtHour, double tiltDegrees, double azimuthDegrees, double trackerRotationLimitDegrees, double stowAngleDegreesIn, double groundCoverageRatio, double slopeTilt, double slopeAzm, std::vector monthlyTiltDegrees, std::vector userSpecifiedAlbedo, poaDecompReq* poaAllIn, - bool useSpatialAlbedos = false, const util::matrix_t* userSpecifiedSpatialAlbedos = nullptr, bool enableSubhourlyClipping = false); + bool useSpatialAlbedos = false, const util::matrix_t* userSpecifiedSpatialAlbedos = nullptr, bool enableSubhourlyClipping = false, bool useCustomTiltAngles = false); /// Construct the irrad class with an Irradiance_IO() object and Subarray_IO() object irrad(); diff --git a/shared/lib_pv_io_manager.cpp b/shared/lib_pv_io_manager.cpp index dcc4146de..11d7d90b6 100644 --- a/shared/lib_pv_io_manager.cpp +++ b/shared/lib_pv_io_manager.cpp @@ -376,6 +376,8 @@ Subarray_IO::Subarray_IO(compute_module* cm, const std::string& cmName, size_t s if (monthlyTiltDegrees[i] < 0.0) throw exec_error(cmName, "Subarray " + util::to_string((int)subarrayNumber) + " monthly tilt angles cannot be negative."); } } + /* Insert checks for custom tilt angles here*/ + //azimuth required for fixed tilt, single axis, and seasonal tilt- can't check for this in variable table so check here azimuthDegrees = std::numeric_limits::quiet_NaN(); if (trackMode == irrad::FIXED_TILT || trackMode == irrad::SINGLE_AXIS || trackMode == irrad::SEASONAL_TILT) diff --git a/shared/lib_pv_io_manager.h b/shared/lib_pv_io_manager.h index c745f48ad..a1a5347ee 100644 --- a/shared/lib_pv_io_manager.h +++ b/shared/lib_pv_io_manager.h @@ -465,6 +465,8 @@ struct Subarray_IO double slopeTilt; // Angle of sloped terrain [degrees] double slopeAzm; // azimuth of sloped terrain relative to tracker azimuth [degrees] double tiltDegrees; // The surface tilt [degrees] + flag useCustomTiltAngles; // Use custom timeseries rotation angles + std::vector customTiltAngles; //Custom timeseries rotation angles [degrees] double azimuthDegrees; // The surface azimuth [degrees] int trackMode; // The tracking mode [0 = fixed, 1 = single-axis tracking, 2 = two-axis tracking, 3 = azimuth-axis tracking, 4 = seasonal-tilt double trackerRotationLimitDegrees; // The rotational limit of the tracker [degrees] diff --git a/ssc/cmod_pvsamv1.cpp b/ssc/cmod_pvsamv1.cpp index a81825409..a3ad405ef 100644 --- a/ssc/cmod_pvsamv1.cpp +++ b/ssc/cmod_pvsamv1.cpp @@ -1139,8 +1139,8 @@ void cm_pvsamv1::exec() for (size_t nn = 0; nn < num_subarrays; nn++) { if (as_integer("use_user_tilt_angles") == 1 && is_assigned("user_tilt_angles_array")) { - Subarrays[nn]->trackMode = irrad::FIXED_TILT; - Subarrays[nn]->tiltDegrees = 0; //reset to 0 to then be replaced in loop? + Subarrays[nn]->trackMode = irrad::SINGLE_AXIS; + //Subarrays[nn]->tiltDegrees = 0; //reset to 0 to then be replaced in loop? Subarrays[nn]->backtrackingEnabled = false; //account for backtracking in user-specified angles [deg] } if (Subarrays[nn]->tiltEqualLatitude) @@ -1506,10 +1506,11 @@ void cm_pvsamv1::exec() || Subarrays[nn]->nStrings < 1) continue; // skip disabled subarrays + /* if (as_integer("use_user_tilt_angles") == 1 && is_assigned("user_tilt_angles_array")) { Subarrays[nn]->tiltDegrees = user_tilt_angles[inrec]; - } + }*/ irrad irr(Irradiance->weatherRecord, Irradiance->weatherHeader, Irradiance->skyModel, Irradiance->radiationMode, Subarrays[nn]->trackMode,