Skip to content

Commit

Permalink
Merge branch 'develop' into enumsDataPlant
Browse files Browse the repository at this point in the history
  • Loading branch information
jmythms committed Sep 1, 2021
2 parents aee8afd + 69875d8 commit 7985c0f
Show file tree
Hide file tree
Showing 9 changed files with 638 additions and 38 deletions.
17 changes: 9 additions & 8 deletions src/EnergyPlus/ConvectionCoefficients.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3365,16 +3365,11 @@ void CalcCeilingDiffuserIntConvCoeff(EnergyPlusData &state,

for (auto SurfNum = Zone(ZoneNum).HTSurfaceFirst; SurfNum <= Zone(ZoneNum).HTSurfaceLast; ++SurfNum) {
if (Surface(SurfNum).ExtBoundCond == DataSurfaces::KivaFoundation) {
Real64 height = state.dataSurface->Surface(SurfNum).Height;
bool isWindow = state.dataConstruction->Construct(state.dataSurface->Surface(SurfNum).Construction).TypeIsWindow;
state.dataSurfaceGeometry->kivaManager.surfaceConvMap[SurfNum].in =
[=, &state](double Tsurf, double Tamb, double, double, double cosTilt) -> double {
return CalcCeilingDiffuserIntConvCoeff(state,
ACH,
Tsurf,
Tamb,
cosTilt,
AirHumRat,
Surface(SurfNum).Height,
state.dataConstruction->Construct(Surface(SurfNum).Construction).TypeIsWindow);
return CalcCeilingDiffuserIntConvCoeff(state, ACH, Tsurf, Tamb, cosTilt, AirHumRat, height, isWindow);
};
} else {
state.dataHeatBalSurf->SurfHConvInt(SurfNum) =
Expand Down Expand Up @@ -4858,6 +4853,9 @@ void ManageInsideAdaptiveConvectionAlgo(EnergyPlusData &state, int const SurfNum
// TODO: candidate for rework to do zone level calcs once rather than for each surface
DynamicIntConvSurfaceClassification(state, SurfNum);

// Set report var after surface has been classified successfully
state.dataSurface->SurfIntConvClassificationRpt(SurfNum) = static_cast<int>(state.dataSurface->SurfIntConvClassification(SurfNum));

// simple worker routine takes surface classification and fills in model to use (IntConvHcModelEq) for that surface
MapIntConvClassificationToHcModels(state, SurfNum);

Expand Down Expand Up @@ -4885,6 +4883,9 @@ void ManageOutsideAdaptiveConvectionAlgo(EnergyPlusData &state,

DynamicExtConvSurfaceClassification(state, SurfNum);

// Set report var after surface has been classified successfully
state.dataSurface->SurfOutConvClassificationRpt(SurfNum) = static_cast<int>(state.dataSurface->SurfOutConvClassification(SurfNum));

MapExtConvClassificationToHcModels(state, SurfNum);

EvaluateExtHcModels(state, SurfNum, state.dataSurface->SurfOutConvHnModelEq(SurfNum), state.dataSurface->SurfOutConvHfModelEq(SurfNum), Hc);
Expand Down
34 changes: 22 additions & 12 deletions src/EnergyPlus/HeatBalanceKivaManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -981,18 +981,7 @@ bool KivaManager::setupKivaInstances(EnergyPlusData &state)
}

Real64 initDeepGroundDepth = fnd.deepGroundDepth;
for (auto &block : fnd.inputBlocks) {
// Change temporary zero depth indicators to default foundation depth
if (block.depth == 0.0) {
block.depth = fnd.foundationDepth;
}
if (settings.deepGroundBoundary == Settings::AUTO) {
// Ensure automatically set deep ground depth is at least 1 meater below lowest block
if (block.z + block.depth + 1.0 > fnd.deepGroundDepth) {
fnd.deepGroundDepth = block.z + block.depth + 1.0;
}
}
}
fnd.deepGroundDepth = getDeepGroundDepth(fnd);

if (fnd.deepGroundDepth > initDeepGroundDepth) {
ShowWarningError(state,
Expand Down Expand Up @@ -1119,6 +1108,27 @@ bool KivaManager::setupKivaInstances(EnergyPlusData &state)
return ErrorsFound;
}

Real64 KivaManager::getDeepGroundDepth(Kiva::Foundation fnd)
{
Real64 totalDepthOfWallBelowGrade = fnd.wall.depthBelowSlab + (fnd.foundationDepth - fnd.wall.heightAboveGrade) + fnd.slab.totalWidth();
if (fnd.deepGroundDepth < totalDepthOfWallBelowGrade + 1.0) {
fnd.deepGroundDepth = totalDepthOfWallBelowGrade + 1.0;
}
for (auto &block : fnd.inputBlocks) {
// Change temporary zero depth indicators to default foundation depth
if (block.depth == 0.0) {
block.depth = fnd.foundationDepth;
}
if (settings.deepGroundBoundary == Settings::AUTO) {
// Ensure automatically set deep ground depth is at least 1 meter below lowest block
if (block.z + block.depth + 1.0 > fnd.deepGroundDepth) {
fnd.deepGroundDepth = block.z + block.depth + 1.0;
}
}
}
return fnd.deepGroundDepth;
}

void KivaManager::initKivaInstances(EnergyPlusData &state)
{
// initialize temperatures at the beginning of run environment
Expand Down
1 change: 1 addition & 0 deletions src/EnergyPlus/HeatBalanceKivaManager.hh
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ namespace HeatBalanceKivaManager {
virtual ~KivaManager();
void readWeatherData(EnergyPlusData &state);
bool setupKivaInstances(EnergyPlusData &state);
Real64 getDeepGroundDepth(Kiva::Foundation fnd);
void initKivaInstances(EnergyPlusData &state);
void calcKivaInstances(EnergyPlusData &state);
void defineDefaultFoundation(EnergyPlusData &state);
Expand Down
68 changes: 64 additions & 4 deletions src/EnergyPlus/WaterUse.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1057,6 +1057,8 @@ namespace WaterUse {
// PURPOSE OF THIS SUBROUTINE:
// Calculate desired hot and cold water flow rates

Real64 const EPSILON(1.e-3);

if (this->setupMyOutputVars) {
this->setupOutputVars(state);
this->setupMyOutputVars = false;
Expand Down Expand Up @@ -1114,18 +1116,76 @@ namespace WaterUse {
// There is no hot water
this->HotMassFlowRate = 0.0;

// Need a special case for HotTemp < ColdTemp, due to bad user input (but could happen in a plant loop accidentally)

} else if (this->TargetTemp > this->HotTemp) {
} else if ((this->ColdTemp - this->HotTemp) > EPSILON) {
// Special case for HotTemp < ColdTemp, due to bad user input (could happen in a plant loop accidentally)
this->HotMassFlowRate = 0;
// print error for variables of hot water temperature
++this->HWTempErrorCount;
if (this->HWTempErrorCount < 2) {
ShowWarningError(state, "CalcEquipmentFlowRates: Hot water temperature is less than the cold water temperature");
ShowContinueErrorTimeStamp(state, "");
ShowContinueError(state, format("...hot water temperature = {:.3R} C", this->HotTemp));
ShowContinueError(state, format("...cold water temperature = {:.3R} C", this->ColdTemp));
ShowContinueError(state, "...Note: hot water temperature should be greater than or equal to the cold water temperature");
ShowContinueError(state,
"...Hot water temperature should be greater than or equal to the cold water temperature. "
"Verify temperature setpoints and schedules.");
} else {
ShowRecurringWarningErrorAtEnd(
state,
this->Name + "\" - Hot water temperature should be greater than or equal to the cold water temperature error continues...",
this->HWTempErrIndex,
this->HotTemp,
this->HotTemp);
}
} else if ((this->TargetTemp - this->HotTemp) > EPSILON) {
// Target temp is hotter than the hot water temp; can't meet target temperature
this->HotMassFlowRate = this->TotalMassFlowRate;

// print error for variables of target water temperature
++this->TargetTempErrorCount;
if (this->TargetTempErrorCount < 2) {
ShowWarningError(state, "CalcEquipmentFlowRates: Target water temperature is greater than the hot water temperature");
ShowContinueErrorTimeStamp(state, "");
ShowContinueError(state, format("...target water temperature = {:.3R} C", this->TargetTemp));
ShowContinueError(state, format("...hot water temperature = {:.3R} C", this->HotTemp));
ShowContinueError(state, "...Note: target water temperature should be less than or equal to the hot water temperature");
ShowContinueError(state,
"...Target water temperature should be less than or equal to the hot water temperature. "
"Verify temperature setpoints and schedules.");
} else {
ShowRecurringWarningErrorAtEnd(
state,
this->Name + "\" - Target water temperature should be less than or equal to the hot water temperature error continues...",
this->TargetTempErrIndex,
this->HotTemp,
this->ColdTemp);
}
} else {
this->HotMassFlowRate = this->TotalMassFlowRate * (this->TargetTemp - this->ColdTemp) / (this->HotTemp - this->ColdTemp);
}

if (this->HotMassFlowRate < 0.0) {
// Target temp is colder than the cold water temp; don't allow colder
this->HotMassFlowRate = 0.0;
// print error for variables of target water temperature
++this->TargetTempErrorCount;
if (this->TargetTempErrorCount < 2) {
ShowWarningError(state, "CalcEquipmentFlowRates: Target water temperature is less than the cold water temperature");
ShowContinueErrorTimeStamp(state, "");
ShowContinueError(state, format("...target water temperature = {:.3R} C", this->TargetTemp));
ShowContinueError(state, format("...cold water temperature = {:.3R} C", this->ColdTemp));
ShowContinueError(state, "...Note: target water temperature should be greater than or equal to the cold water temperature");
ShowContinueError(state,
"...Target water temperature should be greater than or equal to the cold water temperature. "
"Verify temperature setpoints and schedules.");
} else {
ShowRecurringWarningErrorAtEnd(
state,
this->Name + "\" - Target water temperature should be greater than or equal to the cold water temperature error continues...",
this->TargetTempErrIndex,
this->HotTemp,
this->ColdTemp);
}
}

this->ColdMassFlowRate = this->TotalMassFlowRate - this->HotMassFlowRate;
Expand Down
9 changes: 7 additions & 2 deletions src/EnergyPlus/WaterUse.hh
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ namespace WaterUse {
Real64 TargetTemp; // Target (mixed) water temperature (C)
Real64 MixedTemp; // Actual outlet (mixed) water temperature (C)
Real64 DrainTemp;
int HWTempErrorCount; // - counter if hot water temp is less than cold water temp
int HWTempErrIndex; // - index to recurring error structure for hot water temp
int TargetTempErrorCount; // - counter for target water temp error
int TargetTempErrIndex; // - index to recurring error structure for target water temp
int Zone; // Index for zone object
int SensibleFracSchedule; // Pointer to schedule object
Real64 SensibleRate;
Expand All @@ -121,8 +125,9 @@ namespace WaterUse {
WaterEquipmentType()
: Connections(0), PeakVolFlowRate(0.0), FlowRateFracSchedule(0), ColdVolFlowRate(0.0), HotVolFlowRate(0.0), TotalVolFlowRate(0.0),
ColdMassFlowRate(0.0), HotMassFlowRate(0.0), TotalMassFlowRate(0.0), DrainMassFlowRate(0.0), ColdTempSchedule(0), HotTempSchedule(0),
TargetTempSchedule(0), ColdTemp(0.0), HotTemp(0.0), TargetTemp(0.0), MixedTemp(0.0), DrainTemp(0.0), Zone(0), SensibleFracSchedule(0),
SensibleRate(0.0), SensibleEnergy(0.0), SensibleRateNoMultiplier(0.0), LatentFracSchedule(0), LatentRate(0.0), LatentEnergy(0.0),
TargetTempSchedule(0), ColdTemp(0.0), HotTemp(0.0), TargetTemp(0.0), MixedTemp(0.0), DrainTemp(0.0), HWTempErrorCount(0.0),
HWTempErrIndex(0.0), TargetTempErrorCount(0.0), TargetTempErrIndex(0.0), Zone(0), SensibleFracSchedule(0), SensibleRate(0.0),
SensibleEnergy(0.0), SensibleRateNoMultiplier(0.0), LatentFracSchedule(0), LatentRate(0.0), LatentEnergy(0.0),
LatentRateNoMultiplier(0.0), MoistureRate(0.0), MoistureMass(0.0), ColdVolume(0.0), HotVolume(0.0), TotalVolume(0.0), Power(0.0),
Energy(0.0), setupMyOutputVars(true)
{
Expand Down
Loading

5 comments on commit 7985c0f

@nrel-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

enumsDataPlant (jmythms) - Win64-Windows-10-VisualStudio-16: OK (2398 of 2398 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot-3
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

enumsDataPlant (jmythms) - x86_64-MacOS-10.15-clang-11.0.0: OK (3147 of 3150 tests passed, 0 test warnings)

Messages:\n

  • 2 tests had: ESO big diffs.

Failures:\n

EnergyPlusFixture Test Summary

  • Passed: 1191
  • Failed: 1

regression Test Summary

  • Passed: 729
  • Failed: 2

Build Badge Test Badge

@nrel-bot-2c
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

enumsDataPlant (jmythms) - x86_64-Linux-Ubuntu-18.04-gcc-7.5: OK (3188 of 3191 tests passed, 0 test warnings)

Messages:\n

  • 2 tests had: ESO big diffs.
  • 1 test had: EIO diffs.
  • 1 test had: ESO small diffs.
  • 1 test had: MTR small diffs.
  • 1 test had: Table big diffs.

Failures:\n

regression Test Summary

  • Passed: 748
  • Failed: 3

Build Badge Test Badge

@nrel-bot-2c
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

enumsDataPlant (jmythms) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-UnitTestsCoverage-Debug: OK (1687 of 1687 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

@nrel-bot-2b
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

enumsDataPlant (jmythms) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-IntegrationCoverage-Debug: OK (735 of 735 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

Please sign in to comment.