diff --git a/src/EnergyPlus/WeatherManager.cc b/src/EnergyPlus/WeatherManager.cc index 41e123a0b7b..bbb19bae37a 100644 --- a/src/EnergyPlus/WeatherManager.cc +++ b/src/EnergyPlus/WeatherManager.cc @@ -2035,7 +2035,7 @@ namespace WeatherManager { state.dataWeatherManager->TodayDifSolarRad = state.dataWeatherManager->TomorrowDifSolarRad; state.dataWeatherManager->TodayLiquidPrecip = state.dataWeatherManager->TomorrowLiquidPrecip; state.dataWeatherManager->TodayTotalSkyCover = state.dataWeatherManager->TomorrowTotalSkyCover; - state.dataWeatherManager->TodayOpaqueSkyCover = state.dataWeatherManager->TomorrowTotalSkyCover; + state.dataWeatherManager->TodayOpaqueSkyCover = state.dataWeatherManager->TomorrowOpaqueSkyCover; // Update Global Data diff --git a/testfiles/1ZoneUncontrolled.idf b/testfiles/1ZoneUncontrolled.idf index ae66687678c..707dea4a226 100644 --- a/testfiles/1ZoneUncontrolled.idf +++ b/testfiles/1ZoneUncontrolled.idf @@ -364,6 +364,10 @@ Output:Variable,*,Site Outdoor Air Drybulb Temperature,hourly; + Output:Variable,*,Site Total Sky Cover,hourly; + + Output:Variable,*,Site Opaque Sky Cover,hourly; + Output:Variable,*,Site Daylight Saving Time Status,daily; Output:Variable,*,Site Day Type Index,daily; diff --git a/testfiles/1ZoneUncontrolled.rvi b/testfiles/1ZoneUncontrolled.rvi index 8436ad5d9da..6b5c9c63914 100644 --- a/testfiles/1ZoneUncontrolled.rvi +++ b/testfiles/1ZoneUncontrolled.rvi @@ -1,6 +1,8 @@ eplusout.eso eplusout.csv Site Outdoor Air Drybulb Temperature +Site Total Sky Cover +Site Opaque Sky Cover ZONE ONE,Zone Mean Air Temperature ZONE ONE,Electricity:Building Other Equipment Total Heating Energy diff --git a/testfiles/1ZoneUncontrolled_DD2009.idf b/testfiles/1ZoneUncontrolled_DD2009.idf index 0dd6f8ff708..1b0ea5d7734 100644 --- a/testfiles/1ZoneUncontrolled_DD2009.idf +++ b/testfiles/1ZoneUncontrolled_DD2009.idf @@ -799,6 +799,10 @@ Output:Variable,*,Site Outdoor Air Barometric Pressure,Timestep; + Output:Variable,*,Site Total Sky Cover,Timestep; + + Output:Variable,*,Site Opaque Sky Cover,Timestep; + Output:Variable,*,Site Sky Temperature,Timestep; Output:Variable,*,Site Diffuse Solar Radiation Rate per Area,Timestep; diff --git a/tst/EnergyPlus/unit/WeatherManager.unit.cc b/tst/EnergyPlus/unit/WeatherManager.unit.cc index 1fb36131b6e..b9e85658e02 100644 --- a/tst/EnergyPlus/unit/WeatherManager.unit.cc +++ b/tst/EnergyPlus/unit/WeatherManager.unit.cc @@ -1148,3 +1148,113 @@ TEST_F(EnergyPlusFixture, Add_and_InterpolateWeatherInputOutputTest) Real64 expected_SkyTemp = -20.8188538296; EXPECT_NEAR(state->dataWeatherManager->TomorrowSkyTemp(2, 1), expected_SkyTemp, 1e-6); } + +// Test for Issue 8760: fix opaque sky cover weather values; +TEST_F(EnergyPlusFixture, Fix_OpaqueSkyCover_Test) +{ + std::string const idf_objects = delimited_string({ + "Timestep,4;" + + "SimulationControl,", + " Yes, !- Do Zone Sizing Calculation", + " Yes, !- Do System Sizing Calculation", + " No, !- Do Plant Sizing Calculation", + " Yes, !- Run Simulation for Sizing Periods", + " No; !- Run Simulation for Weather File Run Periods", + + "RunPeriod,", + " January, !- Name", + " 1, !- Begin Month", + " 1, !- Begin Day of Month", + " , !- Begin Year", + " 1, !- End Month", + " 31, !- End Day of Month", + " , !- End Year", + " Tuesday, !- Day of Week for Start Day", + " Yes, !- Use Weather File Holidays and Special Days", + " Yes, !- Use Weather File Daylight Saving Period", + " No, !- Apply Weekend Holiday Rule", + " Yes, !- Use Weather File Rain Indicators", + " Yes; !- Use Weather File Snow Indicators", + + "Site:Location,", + " Univ_Of_Illinois_725315, !- Name", + " 40.06, !- Latitude {deg}", + " -88.37, !- Longitude {deg}", + " -6.0, !- Time Zone {hr}", + " 213.0; !- Elevation {m}", + + "Output:Variable,*,Site Total Sky Cover,Timestep;", + "Output:Variable,*,Site Opaque Sky Cover,Timestep;", + }); + + ASSERT_TRUE(process_idf(idf_objects)); + + SimulationManager::PostIPProcessing(*state); + bool ErrorsFound(false); + ErrorsFound = false; + + state->dataWeatherManager->WeatherFileExists = true; + state->files.inputWeatherFileName.fileName = configured_source_directory() + "/weather/USA_IL_University.of.Illinois-Willard.AP.725315_TMY3.epw"; + + state->dataGlobal->BeginSimFlag = true; + SimulationManager::GetProjectData(*state); + + bool Available(true); + Available = true; + + state->dataGlobal->BeginSimFlag = true; + WeatherManager::GetNextEnvironment(*state, Available, ErrorsFound); + + // Test get output variables for Total Sky Cover and Opaque Sky Cover + EXPECT_EQ("Site Total Sky Cover", state->dataOutputProcessor->RVariableTypes(1).VarNameOnly); + EXPECT_EQ("Environment:Site Total Sky Cover", state->dataOutputProcessor->RVariableTypes(1).VarName); + EXPECT_EQ("Site Opaque Sky Cover", state->dataOutputProcessor->RVariableTypes(2).VarNameOnly); + EXPECT_EQ("Environment:Site Opaque Sky Cover", state->dataOutputProcessor->RVariableTypes(2).VarName); + + EXPECT_EQ(7, state->dataOutputProcessor->RVariableTypes(1).ReportID); + EXPECT_EQ(8, state->dataOutputProcessor->RVariableTypes(2).ReportID); + + state->dataWeatherManager->Envrn = 1; + + state->dataGlobal->NumOfTimeStepInHour = 4; + state->dataWeatherManager->Environment.allocate(1); + state->dataWeatherManager->Environment(1).SkyTempModel = EmissivityCalcType::ClarkAllenModel; + state->dataWeatherManager->Environment(1).StartMonth = 1; + state->dataWeatherManager->Environment(1).StartDay = 1; + + state->dataWeatherManager->Environment(1).UseWeatherFileHorizontalIR = false; + + AllocateWeatherData(*state); + OpenWeatherFile(*state, ErrorsFound); + ReadWeatherForDay(*state, 1, 1, true); + + // Test additional set of weather data on sky temp calc + Real64 expected_SkyTemp = -1.7901122977770569; + EXPECT_NEAR(state->dataWeatherManager->TomorrowSkyTemp(2, 1), expected_SkyTemp, 1e-6); + + // Test Total Sky Cover and Opaque Sky Cover + Real64 expected_TSC = 9; + Real64 expected_OSC = 8; + + EXPECT_NEAR(state->dataWeatherManager->TomorrowTotalSkyCover(4, 3), expected_TSC, 1e-6); + EXPECT_NEAR(state->dataWeatherManager->TomorrowOpaqueSkyCover(4, 3), expected_OSC, 1e-6); + EXPECT_NEAR(state->dataWeatherManager->TomorrowTotalSkyCover(3, 3), 9.25, 1e-6); + EXPECT_NEAR(state->dataWeatherManager->TomorrowOpaqueSkyCover(3, 3), 8.25, 1e-6); + EXPECT_NEAR(state->dataWeatherManager->TomorrowTotalSkyCover(2, 3), 9.5, 1e-6); + EXPECT_NEAR(state->dataWeatherManager->TomorrowOpaqueSkyCover(2, 3), 8.5, 1e-6); + EXPECT_NEAR(state->dataWeatherManager->TomorrowTotalSkyCover(1, 3), 9.75, 1e-6); + EXPECT_NEAR(state->dataWeatherManager->TomorrowOpaqueSkyCover(1, 3), 8.75, 1e-6); + + expected_TSC = 8; + expected_OSC = 8; + + EXPECT_NEAR(state->dataWeatherManager->TomorrowTotalSkyCover(4, 4), expected_TSC, 1e-6); + EXPECT_NEAR(state->dataWeatherManager->TomorrowOpaqueSkyCover(4, 4), expected_OSC, 1e-6); + EXPECT_NEAR(state->dataWeatherManager->TomorrowTotalSkyCover(3, 4), 8.25, 1e-6); + EXPECT_NEAR(state->dataWeatherManager->TomorrowOpaqueSkyCover(3, 4), 8.00, 1e-6); + EXPECT_NEAR(state->dataWeatherManager->TomorrowTotalSkyCover(2, 4), 8.50, 1e-6); + EXPECT_NEAR(state->dataWeatherManager->TomorrowOpaqueSkyCover(2, 4), 8.00, 1e-6); + EXPECT_NEAR(state->dataWeatherManager->TomorrowTotalSkyCover(1, 4), 8.75, 1e-6); + EXPECT_NEAR(state->dataWeatherManager->TomorrowOpaqueSkyCover(1, 4), 8.00, 1e-6); +}