-
Notifications
You must be signed in to change notification settings - Fork 392
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4623 from NREL/74715116-CrashIssue4277
Fix ShadowCalculation with TimestepFrequency hourly init in SolarShading
- Loading branch information
Showing
3 changed files
with
98 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
// EnergyPlus::SolarShading Unit Tests | ||
|
||
// Google Test Headers | ||
#include <gtest/gtest.h> | ||
|
||
// EnergyPlus Headers | ||
#include <SolarShading.hh> | ||
#include <DataSurfaces.hh> | ||
#include <DataGlobals.hh> | ||
#include <DataSystemVariables.hh> | ||
#include <DataHeatBalance.hh> | ||
#include <DataBSDFWindow.hh> | ||
|
||
using namespace EnergyPlus; | ||
using namespace EnergyPlus::SolarShading; | ||
using namespace EnergyPlus::DataSurfaces; | ||
using namespace EnergyPlus::DataGlobals; | ||
using namespace EnergyPlus::DataSystemVariables; | ||
using namespace EnergyPlus::DataHeatBalance; | ||
using namespace EnergyPlus::DataBSDFWindow; | ||
using namespace ObjexxFCL; | ||
|
||
TEST( CalcPerSolarBeamTest, Test1 ) | ||
{ | ||
// Test inits for integrated and non-integrated shading calcs | ||
|
||
// static bool ErrorsFound( false ); // If errors detected in input | ||
// static int ZoneNum( 0 ); // Zone number | ||
// int NumAlphas ( 2 ); | ||
// int NumNumbers ( 9 ); | ||
Real64 AvgEqOfTime ( 0.0 ); // Average value of Equation of Time for period | ||
Real64 AvgSinSolarDeclin ( 1.0 ); // Average value of Sine of Solar Declination for period | ||
Real64 AvgCosSolarDeclin ( 0.0 ); // Average value of Cosine of Solar Declination for period | ||
int NumTimeSteps( 6 ); | ||
|
||
TimeStep = 1; | ||
TotSurfaces = 3; | ||
MaxBkSurf = 3; | ||
SurfaceWindow.allocate( TotSurfaces ); | ||
SunlitFracHR.allocate( TotSurfaces, 24 ); | ||
SunlitFrac.allocate( TotSurfaces, 24, NumTimeSteps ); | ||
SunlitFracWithoutReveal.allocate( TotSurfaces, 24, NumTimeSteps ); | ||
CTHETA.allocate( TotSurfaces ); | ||
CosIncAngHR.allocate( TotSurfaces, 24 ); | ||
CosIncAng.allocate( TotSurfaces, 24, NumTimeSteps ); | ||
AOSurf.allocate( TotSurfaces ); | ||
BackSurfaces.allocate( TotSurfaces, MaxBkSurf, 24, NumTimeSteps ); | ||
OverlapAreas.allocate( TotSurfaces, MaxBkSurf, 24, NumTimeSteps ); | ||
|
||
// Test non-integrated option first, CalcPerSolarBeam should set OutProjSLFracMult and InOutProjSLFracMult to 1.0 for all hours | ||
for ( int SurfNum = 1; SurfNum <= TotSurfaces; ++SurfNum ) { | ||
for ( int Hour = 1; Hour <= 24; ++Hour ) { | ||
SurfaceWindow( SurfNum).OutProjSLFracMult( Hour ) = 999.0; | ||
SurfaceWindow( SurfNum ).InOutProjSLFracMult( Hour ) = 888.0; | ||
} | ||
} | ||
|
||
DetailedSolarTimestepIntegration = false; | ||
CalcPerSolarBeam( AvgEqOfTime, AvgSinSolarDeclin, AvgCosSolarDeclin ); | ||
|
||
for ( int SurfNum = 1; SurfNum <= TotSurfaces; ++SurfNum ) { | ||
for ( int Hour = 1; Hour <= 24; ++Hour ) { | ||
EXPECT_EQ( 1.0, SurfaceWindow( SurfNum ).OutProjSLFracMult( Hour ) ); | ||
EXPECT_EQ( 1.0, SurfaceWindow( SurfNum ).InOutProjSLFracMult( Hour ) ); | ||
} | ||
} | ||
|
||
// Test integrated option, CalcPerSolarBeam should set OutProjSLFracMult and InOutProjSLFracMult to 1.0 only for the specified hour | ||
// Re-initialize to new values | ||
for ( int SurfNum = 1; SurfNum <= TotSurfaces; ++SurfNum ) { | ||
for ( int Hour = 1; Hour <= 24; ++Hour ) { | ||
SurfaceWindow( SurfNum ).OutProjSLFracMult( Hour ) = 555.0; | ||
SurfaceWindow( SurfNum ).InOutProjSLFracMult( Hour ) = 444.0; | ||
} | ||
} | ||
|
||
DetailedSolarTimestepIntegration = true; | ||
HourOfDay = 23; | ||
CalcPerSolarBeam( AvgEqOfTime, AvgSinSolarDeclin, AvgCosSolarDeclin ); | ||
|
||
for ( int SurfNum = 1; SurfNum <= TotSurfaces; ++SurfNum ) { | ||
for ( int Hour = 1; Hour <= 24; ++Hour ) { | ||
if ( Hour == HourOfDay ) { | ||
EXPECT_EQ( 1.0, SurfaceWindow( SurfNum ).OutProjSLFracMult( Hour ) ); | ||
EXPECT_EQ( 1.0, SurfaceWindow( SurfNum ).InOutProjSLFracMult( Hour ) ); | ||
} else { | ||
EXPECT_EQ( 555.0, SurfaceWindow( SurfNum ).OutProjSLFracMult( Hour ) ); | ||
EXPECT_EQ( 444.0, SurfaceWindow( SurfNum ).InOutProjSLFracMult( Hour ) ); | ||
} | ||
} | ||
} | ||
|
||
} |
777c1f8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
develop (Myoldmopar) - x86_64-MacOS-10.9-clang: OK (1092 of 1092 tests passed)
777c1f8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
develop (Myoldmopar) - x86_64-Linux-Ubuntu-14.04-gcc-4.8: OK (1095 of 1095 tests passed)
777c1f8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
develop (Myoldmopar) - x86_64-Linux-Ubuntu-14.04-cppcheck-1.61: OK (0 of 0 tests passed)
777c1f8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
develop (Myoldmopar) - i386-Windows-7-VisualStudio-12: OK (1095 of 1095 tests passed)
777c1f8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
develop (Myoldmopar) - x86_64-Linux-Ubuntu-14.04-gcc-4.8-UnitTestsCoverage-Debug: OK (597 of 597 tests passed)
777c1f8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
develop (Myoldmopar) - Win64-Windows-7-VisualStudio-12: OK (1095 of 1095 tests passed)
777c1f8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
develop (Myoldmopar) - x86_64-Linux-Ubuntu-14.04-gcc-4.8-IntegrationCoverage-Debug: OK (1095 of 1095 tests passed)