Skip to content

Commit

Permalink
Setting up framework for custom rotation angles
Browse files Browse the repository at this point in the history
  • Loading branch information
mjprilliman committed Oct 12, 2023
1 parent 2eb2959 commit f6ec275
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
4 changes: 3 additions & 1 deletion shared/lib_irradproc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -1766,7 +1768,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 useSpatialAlbedos, const util::matrix_t<double>* userSpecifiedSpatialAlbedos, bool enableSubhourlyClipping, bool useCustomTiltAngles) :
skyModel(skyModelIn), radiationMode(radiationModeIn), trackingMode(trackModeIn),
enableBacktrack(backtrackingEnabled), forceToStow(forceToStowIn),
delt(dtHour), tiltDegrees(tiltDegreesIn), surfaceAzimuthDegrees(azimuthDegreesIn),
Expand Down
2 changes: 1 addition & 1 deletion shared/lib_irradproc.h
Original file line number Diff line number Diff line change
Expand Up @@ -1055,7 +1055,7 @@ class irrad
double dtHour, double tiltDegrees, double azimuthDegrees, double trackerRotationLimitDegrees, double stowAngleDegreesIn,
double groundCoverageRatio, double slopeTilt, double slopeAzm, std::vector<double> monthlyTiltDegrees, std::vector<double> userSpecifiedAlbedo,
poaDecompReq* poaAllIn,
bool useSpatialAlbedos = false, const util::matrix_t<double>* userSpecifiedSpatialAlbedos = nullptr, bool enableSubhourlyClipping = false);
bool useSpatialAlbedos = false, const util::matrix_t<double>* userSpecifiedSpatialAlbedos = nullptr, bool enableSubhourlyClipping = false, bool useCustomTiltAngles = false);

/// Construct the irrad class with an Irradiance_IO() object and Subarray_IO() object
irrad();
Expand Down
2 changes: 2 additions & 0 deletions shared/lib_pv_io_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<double>::quiet_NaN();
if (trackMode == irrad::FIXED_TILT || trackMode == irrad::SINGLE_AXIS || trackMode == irrad::SEASONAL_TILT)
Expand Down
2 changes: 2 additions & 0 deletions shared/lib_pv_io_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<double> 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]
Expand Down
7 changes: 4 additions & 3 deletions ssc/cmod_pvsamv1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit f6ec275

Please sign in to comment.