@@ -81,6 +81,14 @@ RC TOPRAT::tp_WthrInit() // Initialize weather data/ display any error message
8181 return rc;
8282} // TOPRAT::tp_WthrInit
8383// ---------------------------------------------------------------------------
84+ RC TOPRAT::tp_WthrBegDay ()
85+ {
86+ RC rc = RCOK;
87+ rc = Wfile.wf_UpSampleDay (jDay);
88+
89+ return rc;
90+ } // TOPRAT::tp_WthrBegDay
91+ // ---------------------------------------------------------------------------
8492RC TOPRAT::tp_WthrBegHour () // start-hour weather stuff: read file, set up public Wthr and Top members.
8593// tp_WthrBegSubhr must also be called, after this function.
8694
@@ -259,6 +267,16 @@ o else { aes = 0.f; bes = 1.5f - g; ces = g - .5f; }
259267 radBeamShAv = (a * radBeamPvHrAv + b * radBeamHrAv + c * radBeamNxHrAv) * beamAdj;
260268 radDiffShAv = (a * radDiffPvHrAv + b * radDiffHrAv + c * radDiffNxHrAv) * diffAdj;
261269
270+ #if 0
271+ float radBeamX, radDiffX;
272+ Wfile.wf_GetSubhrSolar(iHr, iSubhr, radBeamX, radDiffX);
273+ if (frDiff(radBeamShAv, radBeamX) > .001f || frDiff(radDiffShAv, radDiffX) > .001f)
274+ {
275+ printf("\nSolar mismatch");
276+ Wfile.wf_UpSampleDay(jDay);
277+ }
278+ #endif
279+
262280// Interpolate end-subhour instantaneous values for same data
263281
264282#ifdef SOLAVNEND // undef in cndefns.h
@@ -396,31 +414,46 @@ RC WDHR::wd_WfReader( // read an hour's weather data and make adjustments
396414 rc = pWF->wf_Read ( this , jDayST, iHrST, WRN|wfOp); // Read hour's data from weather file
397415 break ;
398416 }
399- if (rc) // if wfRead failed, eg date not in file or type without design days
400- return rc;
401-
402- // Optional anisotropic sky adjustment
403- // Do NOT adjust wd_DNI, wd_DHI
404- if (Top.skyModel ==C_SKYMODCH_ANISO)
405- slaniso ( &wd_bmrad, &wd_dfrad, iHrST); // adjust data in place to approx model sky brighter
406- // near sun, etc, while still computing with sun's
407- // beam and isotropic diffuse radiation. slpak.cpp. */
417+ #if defined( SOLARFIX)
418+ #if defined( _DEBUG)
419+ float bmrad = wd_DNI;
420+ float dfrad = wd_DHI;
421+ if (Top.skyModel == C_SKYMODCH_ANISO)
422+ slaniso (&bmrad, &dfrad,iHrST);
423+ if (frDiff (bmrad, wd_bmrad) > .0001f
424+ || frDiff (dfrad, wd_dfrad) > 0 .0001f )
425+ printf (" \n Diff" );
426+ #endif
427+ #else
428+ if (!rc) // if wfRead failed, eg date not in file or type without design days
429+ wd_Adjust (iHrST);
430+ #endif
431+
432+ return rc;
433+ } // WDHR::wd_WfReader
434+ // -----------------------------------------------------------------------------
435+ void WDHR::wd_Adjust ( // apply adjustments to weather data
436+ int iHrST) // standard time hour of day (0-23)
437+ {
408438
409- // other adjustments
410- wd_bmrad *= Top. radBeamF ; // Adjust radiation values for possible user input factors, defaults 1.0.
411- wd_dfrad *= Top.radDiffF ; // ..
412- wd_wndSpd = Top. windF * max ( wd_wndSpd, Top. windSpeedMin );
413- // apply wind speed min (user input, default = .5)
414- // and adjust by factor (per user input, default .25)
439+ // Optional anisotropic sky adjustment
440+ // Do NOT adjust wd_DNI, wd_DHI
441+ if ( Top.skyModel == C_SKYMODCH_ANISO)
442+ slaniso (&wd_bmrad, &wd_dfrad, iHrST); // adjust data in place to approx model sky brighter
443+ // near sun, etc, while still computing with sun's
444+ // beam and isotropic diffuse radiation. slpak.cpp. */
415445
416- // Ensure solar data values are not negative (as found in some CSW files)
417- wd_bmrad = max (wd_bmrad, 0 .f );
418- wd_dfrad = max (wd_dfrad, 0 .f );
419- wd_glrad = max (wd_glrad, 0 .f );
446+ // other solar adjustments
447+ // ensure solar data values are not negative (as found in some CSW files)
448+ wd_bmrad = max ( Top.radBeamF *wd_bmrad, 0 .f ); // Adjust radiation values by possible user input factors, defaults 1.0.
449+ wd_dfrad = max ( Top.radDiffF *wd_dfrad, 0 .f ); // ..
450+ wd_glrad = max (wd_glrad, 0 .f ); // TODO: re-derive from adjusted wd_bmrad and wd_dfrad?
420451
452+ wd_wndSpd = Top.windF * max (wd_wndSpd, Top.windSpeedMin );
453+ // apply wind speed min (user input, default = .5)
454+ // and adjust by factor (per user input, default .25)
421455
422- return rc;
423- } // WDHR::wd_WfReader
456+ } // WDHR::wd_Adjust
424457// ---------------------------------------------------------------------------
425458void FC cgWfDone () // Close, clean up hourly simulator weather file
426459{
0 commit comments