Skip to content

Commit

Permalink
Merge pull request #8612 from bigladder/fix-kiva-osky
Browse files Browse the repository at this point in the history
Set default value for OpaqueSkyCover when missing
  • Loading branch information
Myoldmopar authored Mar 19, 2021
2 parents 0c8db47 + 424586b commit 9877239
Show file tree
Hide file tree
Showing 3 changed files with 8,802 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/EnergyPlus/HeatBalanceKivaManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,20 @@ namespace EnergyPlus::HeatBalanceKivaManager {
Albedo,
LiquidPrecip);

// Checks for missing value
if (DryBulb >= 99.9) {
DryBulb = state.dataWeatherManager->Missing.DryBulb;
}
if (DewPoint >= 99.9) {
DewPoint = state.dataWeatherManager->Missing.DewPoint;
}
if (WindSpeed >= 999.0) {
WindSpeed = state.dataWeatherManager->Missing.WindSpd;
}
if (OpaqueSkyCover >= 99.0) {
OpaqueSkyCover = state.dataWeatherManager->Missing.OpaqSkyCvr;
}

kivaWeather.dryBulb.push_back(DryBulb);
kivaWeather.windSpeed.push_back(WindSpeed);

Expand Down
20 changes: 20 additions & 0 deletions tst/EnergyPlus/unit/HeatBalanceKivaManager.unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@

// EnergyPlus Headers
#include "Fixtures/EnergyPlusFixture.hh"
#include <EnergyPlus/ConfiguredFunctions.hh>
#include <EnergyPlus/Data/EnergyPlusData.hh>
#include <EnergyPlus/DataEnvironment.hh>
#include <EnergyPlus/DataGlobals.hh>
Expand All @@ -64,6 +65,7 @@
#include <EnergyPlus/HeatBalanceManager.hh>
#include <EnergyPlus/IOFiles.hh>
#include <EnergyPlus/ScheduleManager.hh>
#include <EnergyPlus/WeatherManager.hh>
#include <EnergyPlus/ZoneTempPredictorCorrector.hh>

namespace EnergyPlus {
Expand Down Expand Up @@ -257,4 +259,22 @@ TEST_F(EnergyPlusFixture, HeatBalanceKiva_SetInitialBCs)
EXPECT_NEAR(expectedResult4, zoneAssumedTemperature4 + DataGlobalConstants::KelvinConv, 0.001);
}

TEST_F(EnergyPlusFixture, OpaqueSkyCover_InterpretWeatherMissingOpaqueSkyCover) {

// DERIVED TYPE DEFINITIONS:
// SUBROUTINE LOCAL VARIABLE DECLARATIONS:

state->files.inputWeatherFileName.fileName = configured_source_directory() + "/tst/EnergyPlus/unit/Resources/HeatBalanceKivaManagerOSkyTest.epw";
state->dataWeatherManager->Missing.OpaqSkyCvr = 5;

HeatBalanceKivaManager::KivaManager km;
km.readWeatherData(*state);

Real64 TDewK = 264.25;
Real64 expected_OSky = 5;
Real64 expected_ESky = (0.787 + 0.764 * std::log(TDewK / DataGlobalConstants::KelvinConv)) * (1.0 + 0.0224 * expected_OSky - 0.0035 * pow_2(expected_OSky) + 0.00028 * pow_3(expected_OSky));;

EXPECT_NEAR(expected_ESky, km.kivaWeather.skyEmissivity[0], 0.01);
}

} // namespace EnergyPlus
Loading

0 comments on commit 9877239

Please sign in to comment.