Skip to content

Commit

Permalink
Updated incidence calls throughout code, debugged custom rotation angles
Browse files Browse the repository at this point in the history
running through sdk
  • Loading branch information
mjprilliman committed Oct 19, 2023
1 parent 8953a57 commit 8ff0b98
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion shared/lib_irradproc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1771,7 +1771,7 @@ irrad::irrad(weather_record wf, weather_header hdr,
double groundCoverageRatioIn, double slopeTiltIn, double slopeAzmIn, std::vector<double> monthlyTiltDegrees,
std::vector<double> userSpecifiedAlbedo,
poaDecompReq *poaAllIn,
bool useSpatialAlbedos, const util::matrix_t<double>* userSpecifiedSpatialAlbedos, bool enableSubhourlyClipping, bool useCustomTiltAngles, double customTiltAngles) :
bool useSpatialAlbedos, const util::matrix_t<double>* userSpecifiedSpatialAlbedos, bool enableSubhourlyClipping, bool useCustomTiltAngles, double customTiltAngle) :
skyModel(skyModelIn), radiationMode(radiationModeIn), trackingMode(trackModeIn),
enableBacktrack(backtrackingEnabled), forceToStow(forceToStowIn),
delt(dtHour), tiltDegrees(tiltDegreesIn), surfaceAzimuthDegrees(azimuthDegreesIn),
Expand Down
2 changes: 2 additions & 0 deletions shared/lib_irradproc.h
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,8 @@ void solarpos_spa(int year, int month, int day, int hour, double minute, double
* \param[in] slope_azm azimuth angle of slopted terrain relative to tracker azimuth in radians
* \param[in] force_to_stow: force the single-axis tracking array to the stow angle specified in the next input
* \param[in] stow_angle_deg: the angle to force the single-axis tracking array to stow to, in degrees
* \param[in] useCustomAngle: use custom rotation angles for single axis tracking 0/1
* \param[in] customAngle: custom rotation angle to use, in degrees
* \param[out] angle array of elements to return angles to calling function
* \param[out] angle[0] incident angle in radians
* \param[out] angle[1] tilt angle of surface from horizontal in radians
Expand Down
4 changes: 2 additions & 2 deletions shared/lib_pv_io_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ Subarray_IO::Subarray_IO(compute_module* cm, const std::string& cmName, size_t s

/* Insert checks for custom tilt angles here*/
if (cm->is_assigned("custom_tilt_angles_array") && useCustomTiltAngles == 1) {
customTiltAngles = cm->as_vector_double("custom_tilt_angle_array");
customTiltAngles = cm->as_vector_double("custom_tilt_angles_array");
for (int i = 0; i < customTiltAngles.size(); i++) {
if (customTiltAngles[i] < 0.0) throw exec_error(cmName, "Subarray " + util::to_string((int)subarrayNumber) + "custom tilt angles cannot be negative.");
}
Expand Down Expand Up @@ -651,7 +651,7 @@ void PVSystem_IO::SetupPOAInput()


if (tms[2] > 0) {
incidence(Subarrays[nn]->trackMode, Subarrays[nn]->tiltDegrees, Subarrays[nn]->azimuthDegrees, Subarrays[nn]->trackerRotationLimitDegrees, sun[1], sun[0], Subarrays[nn]->backtrackingEnabled, Subarrays[nn]->groundCoverageRatio, Subarrays[nn]->slopeTilt, Subarrays[nn]->slopeAzm, false, 0.0, angle);
incidence(Subarrays[nn]->trackMode, Subarrays[nn]->tiltDegrees, Subarrays[nn]->azimuthDegrees, Subarrays[nn]->trackerRotationLimitDegrees, sun[1], sun[0], Subarrays[nn]->backtrackingEnabled, Subarrays[nn]->groundCoverageRatio, Subarrays[nn]->slopeTilt, Subarrays[nn]->slopeAzm, false, 0.0, false, 0.0, angle);
}
else {
angle[0] = -999;
Expand Down
2 changes: 2 additions & 0 deletions ssc/cmod_pvsamv1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ static var_info _cm_vtab_pvsamv1[] = {

{SSC_INPUT, SSC_NUMBER, "use_measured_temp", "Use measured temperatures", "0/1", "", "System Design", "?=0", "INTEGER,MIN=0,MAX=1", "" },
{SSC_INPUT, SSC_ARRAY, "measured_temp_array", "Measured module temperature", "C", "", "System Design", "use_measured_temp=1", "", "" },
{SSC_INPUT, SSC_NUMBER, "use_custom_tilt_angles", "Use custom rotation angles", "0/1", "", "System Design", "?=0", "INTEGER,MIN=0,MAX=1", "" },
{SSC_INPUT, SSC_ARRAY, "custom_tilt_angles_array", "Custom tracker rotation angles", "deg", "", "System Design", "use_custom_tilt_angles=1", "", "" },

// subarray 1
{SSC_INPUT, SSC_NUMBER, "subarray1_nstrings", "Sub-array 1 Number of parallel strings", "", "", "System Design", "", "INTEGER", "" },
Expand Down
2 changes: 1 addition & 1 deletion tcs/csp_solver_weatherreader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ void C_csp_weatherreader::timestep_call(const C_csp_solver_sim_info& p_sim_info)
if (sunn[2] > 0.0087)
{
/* sun elevation > 0.5 degrees */
incidence(m_trackmode, m_tilt, m_azimuth, 45.0, sunn[1], sunn[0], 0, 0, 0, 0, false, 0.0, angle);
incidence(m_trackmode, m_tilt, m_azimuth, 45.0, sunn[1], sunn[0], 0, 0, 0, 0, false, 0.0, 0.0, 0.0, angle);
perez(sunn[8], m_rec.dn, m_rec.df, 0.2, angle[0], angle[1], sunn[1], poa, diffc); // diffuse shading factor not enabled (set to 1.0 by default)
}

Expand Down
8 changes: 4 additions & 4 deletions test/shared_test/lib_irradproc_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ TEST_F(NightCaseIrradProc, incidenceTest_lib_irradproc) {
/* Just before sunrise test case */
sun_azm = 0.95662;
sun_zen = 1.79457;
incidence(mode, tilt, azim, rotlim, sun_zen, sun_azm, backtrack_on, gcr, 0, 0, false, 0.0, angle);
incidence(mode, tilt, azim, rotlim, sun_zen, sun_azm, backtrack_on, gcr, 0, 0, false, 0.0, 0.0, 0.0, angle);
solutions = { 1.89243, 0.174533, 3.14159, 0, 0 };
for (int i = 0; i < 5; i++) {
EXPECT_NEAR(angle[i], solutions[i], e) << "before-sunrise case";
Expand All @@ -381,7 +381,7 @@ TEST_F(SunriseCaseIrradProc, incidenceTest_lib_irradproc) {

sun_azm = 1.11047;
sun_zen = 1.6031;
incidence(mode, tilt, azim, rotlim, sun_zen, sun_azm, backtrack_on, gcr, 0, 0, false, 0.0, angle);
incidence(mode, tilt, azim, rotlim, sun_zen, sun_azm, backtrack_on, gcr, 0, 0, false, 0.0, 0.0, 0.0, angle);
solution = 1.67992;
EXPECT_NEAR(angle[0], solution, e) << "sunrise case";
}
Expand All @@ -395,7 +395,7 @@ TEST_F(DayCaseIrradProc, incidenceTest_lib_irradproc) {

sun_azm = 0;
sun_zen = 0;
incidence(mode, tilt, azim, rotlim, sun_zen, sun_azm, backtrack_on, gcr, 0, 0, false, 0.0, angle);
incidence(mode, tilt, azim, rotlim, sun_zen, sun_azm, backtrack_on, gcr, 0, 0, false, 0.0, 0.0, 0.0, angle);
solution = 0.174533;
EXPECT_NEAR(angle[0], solution, e) << "noon case";
}
Expand All @@ -409,7 +409,7 @@ TEST_F(SunsetCaseIrradProc, incidenceTest_lib_irradproc) {

sun_azm = 5.13947;
sun_zen = 1.55886;
incidence(mode, tilt, azim, rotlim, sun_zen, sun_azm, backtrack_on, gcr, 0, 0, false, 0.0, angle);
incidence(mode, tilt, azim, rotlim, sun_zen, sun_azm, backtrack_on, gcr, 0, 0, false, 0.0, 0.0, 0.0, angle);
solution = 1.631;
EXPECT_NEAR(angle[0], solution, e) << "sunset case";
}
Expand Down

0 comments on commit 8ff0b98

Please sign in to comment.