Skip to content

Commit f28965d

Browse files
authored
Merge pull request #996 from NREL/SAM_1232
Address SAM issue 1232 for Detailed PV and PVWattsv8
2 parents d618752 + 83987b9 commit f28965d

2 files changed

Lines changed: 9 additions & 11 deletions

File tree

shared/lib_pv_io_manager.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ Irradiance_IO::Irradiance_IO(compute_module* cm, std::string cmName)
211211

212212
void Irradiance_IO::checkWeatherFile(compute_module* cm, std::string cmName)
213213
{
214+
size_t num_alb_errors = 0;
214215
for (size_t idx = 0; idx < numberOfWeatherFileRecords; idx++)
215216
{
216217
if (!weatherDataProvider->read(&weatherRecord))
@@ -275,11 +276,13 @@ void Irradiance_IO::checkWeatherFile(compute_module* cm, std::string cmName)
275276
}
276277
if (useWeatherFileAlbedo && (weatherRecord.alb <= 0 || weatherRecord.alb >= 1))
277278
{
278-
cm->log(util::format("Out of range albedo %lg at time [y:%d m:%d d:%d h:%d minute:%lg], using monthly value",
279-
weatherRecord.alb, weatherRecord.year, weatherRecord.month, weatherRecord.day, weatherRecord.hour, weatherRecord.minute), SSC_WARNING, (float)idx);
279+
num_alb_errors++;
280280
weatherRecord.alb = 0;
281281
}
282282
}
283+
if (num_alb_errors > 0)
284+
cm->log(util::format("Weather file albedo has %d invalid values, using monthly value", (int)num_alb_errors), SSC_WARNING);
285+
283286
weatherDataProvider->rewind();
284287
}
285288

ssc/cmod_pvwattsv8.cpp

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -842,16 +842,8 @@ class cm_pvwattsv8 : public compute_module
842842
{
843843
if ((std::isfinite(wf.alb) && (wf.alb > 0 && wf.alb < 1)))
844844
alb = wf.alb;
845-
else if (n_alb_errs < 5) // display warning up to 5 times
846-
{
847-
log(util::format("Weather file albedo is not valid. "
848-
"Using default albedo value of %f (snow) or %f (no snow). "
849-
"This warning only appears for the first five instances of this error. "
850-
"[year:%d month:%d day:%d hour:%d minute:%lg]. ",
851-
as_double("albedo_default_snow"), as_double("albedo_default"),
852-
wf.year, wf.month, wf.day, wf.hour, wf.minute), SSC_NOTICE);
845+
else
853846
n_alb_errs++;
854-
}
855847
}
856848
else
857849
{
@@ -1373,6 +1365,9 @@ class cm_pvwattsv8 : public compute_module
13731365
idx_life++;
13741366
}
13751367

1368+
if (n_alb_errs > 0)
1369+
log(util::format("Weather file albedo has %d invalid values, using monthly value", (int)n_alb_errs), SSC_WARNING);
1370+
13761371
wdprov->rewind();
13771372
}
13781373

0 commit comments

Comments
 (0)