Skip to content

Commit

Permalink
Merge pull request #8389 from NREL/UnitTestBuildSpeed
Browse files Browse the repository at this point in the history
Unit test build speed improvement
  • Loading branch information
mitchute authored Nov 23, 2020
2 parents 52873dc + 940e6ed commit f586325
Show file tree
Hide file tree
Showing 229 changed files with 15,513 additions and 15,288 deletions.
2 changes: 2 additions & 0 deletions src/EnergyPlus/SingleDuct.hh
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
#ifndef SingleDuct_hh_INCLUDED
#define SingleDuct_hh_INCLUDED

#include <unordered_map>

// ObjexxFCL Headers
#include <ObjexxFCL/Array1D.hh>
#include <ObjexxFCL/Optional.hh>
Expand Down
92 changes: 46 additions & 46 deletions tst/EnergyPlus/unit/AdvancedAFN.unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
#include <EnergyPlus/DataHeatBalFanSys.hh>
#include <EnergyPlus/DataHeatBalance.hh>
#include <EnergyPlus/UtilityRoutines.hh>

#include <EnergyPlus/Data/EnergyPlusData.hh>
#include "Fixtures/EnergyPlusFixture.hh"

using namespace EnergyPlus;
Expand Down Expand Up @@ -85,28 +85,28 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_AdvancedTest_Test1)
int CurveNum;

AirflowNetworkNumOfOccuVentCtrls = 1;
state.dataAirflowNetworkBalanceManager->OccupantVentilationControl.allocate(AirflowNetworkNumOfOccuVentCtrls);
state.dataAirflowNetworkBalanceManager->OccupantVentilationControl(1).MinOpeningTime = 4;
state.dataAirflowNetworkBalanceManager->OccupantVentilationControl(1).MinClosingTime = 4;
state.dataAirflowNetworkBalanceManager->OccupantVentilationControl(1).MinTimeControlOnly = true;
state->dataAirflowNetworkBalanceManager->OccupantVentilationControl.allocate(AirflowNetworkNumOfOccuVentCtrls);
state->dataAirflowNetworkBalanceManager->OccupantVentilationControl(1).MinOpeningTime = 4;
state->dataAirflowNetworkBalanceManager->OccupantVentilationControl(1).MinClosingTime = 4;
state->dataAirflowNetworkBalanceManager->OccupantVentilationControl(1).MinTimeControlOnly = true;

TimeOpenElapsed = 3.0;
TimeCloseElapsed = 0.0;
state.dataAirflowNetworkBalanceManager->OccupantVentilationControl(1).calc(state, 1, TimeOpenElapsed, TimeCloseElapsed, OpenStatus, OpenProbStatus, CloseProbStatus);
state->dataAirflowNetworkBalanceManager->OccupantVentilationControl(1).calc(*state, 1, TimeOpenElapsed, TimeCloseElapsed, OpenStatus, OpenProbStatus, CloseProbStatus);
EXPECT_EQ(1, OpenStatus);

TimeOpenElapsed = 5.0;
state.dataAirflowNetworkBalanceManager->OccupantVentilationControl(1).calc(state, 1, TimeOpenElapsed, TimeCloseElapsed, OpenStatus, OpenProbStatus, CloseProbStatus);
state->dataAirflowNetworkBalanceManager->OccupantVentilationControl(1).calc(*state, 1, TimeOpenElapsed, TimeCloseElapsed, OpenStatus, OpenProbStatus, CloseProbStatus);
EXPECT_EQ(0, OpenStatus);

TimeOpenElapsed = 0.0;
TimeCloseElapsed = 3.0;
state.dataAirflowNetworkBalanceManager->OccupantVentilationControl(1).calc(state, 1, TimeOpenElapsed, TimeCloseElapsed, OpenStatus, OpenProbStatus, CloseProbStatus);
state->dataAirflowNetworkBalanceManager->OccupantVentilationControl(1).calc(*state, 1, TimeOpenElapsed, TimeCloseElapsed, OpenStatus, OpenProbStatus, CloseProbStatus);
EXPECT_EQ(2, OpenStatus);

TimeOpenElapsed = 0.0;
TimeCloseElapsed = 5.0;
state.dataAirflowNetworkBalanceManager->OccupantVentilationControl(1).calc(state, 1, TimeOpenElapsed, TimeCloseElapsed, OpenStatus, OpenProbStatus, CloseProbStatus);
state->dataAirflowNetworkBalanceManager->OccupantVentilationControl(1).calc(*state, 1, TimeOpenElapsed, TimeCloseElapsed, OpenStatus, OpenProbStatus, CloseProbStatus);
EXPECT_EQ(0, OpenStatus);

OutDryBulbTemp = 15.0;
Expand All @@ -118,51 +118,51 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_AdvancedTest_Test1)

TimeOpenElapsed = 5.0;
TimeCloseElapsed = 0.0;
state.dataAirflowNetworkBalanceManager->OccupantVentilationControl(1).MinTimeControlOnly = false;
state.dataAirflowNetworkBalanceManager->OccupantVentilationControl(1).ComfortBouPoint = 10.0;
state.dataAirflowNetworkBalanceManager->OccupantVentilationControl(1).ComfortLowTempCurveNum = 1;
state.dataAirflowNetworkBalanceManager->OccupantVentilationControl(1).ComfortHighTempCurveNum = 2;
state->dataAirflowNetworkBalanceManager->OccupantVentilationControl(1).MinTimeControlOnly = false;
state->dataAirflowNetworkBalanceManager->OccupantVentilationControl(1).ComfortBouPoint = 10.0;
state->dataAirflowNetworkBalanceManager->OccupantVentilationControl(1).ComfortLowTempCurveNum = 1;
state->dataAirflowNetworkBalanceManager->OccupantVentilationControl(1).ComfortHighTempCurveNum = 2;

state.dataCurveManager->NumCurves = 2;
state.dataCurveManager->PerfCurve.allocate(state.dataCurveManager->NumCurves);
state->dataCurveManager->NumCurves = 2;
state->dataCurveManager->PerfCurve.allocate(state->dataCurveManager->NumCurves);

CurveNum = 1;
state.dataCurveManager->PerfCurve(CurveNum).CurveType = CurveTypeEnum::Quadratic;
state.dataCurveManager->PerfCurve(CurveNum).ObjectType = "Curve:Quadratic";
state.dataCurveManager->PerfCurve(CurveNum).InterpolationType = InterpTypeEnum::EvaluateCurveToLimits;
state.dataCurveManager->PerfCurve(CurveNum).Coeff1 = 21.2;
state.dataCurveManager->PerfCurve(CurveNum).Coeff2 = 0.09;
state.dataCurveManager->PerfCurve(CurveNum).Coeff3 = 0.0;
state.dataCurveManager->PerfCurve(CurveNum).Coeff4 = 0.0;
state.dataCurveManager->PerfCurve(CurveNum).Coeff5 = 0.0;
state.dataCurveManager->PerfCurve(CurveNum).Coeff6 = 0.0;
state.dataCurveManager->PerfCurve(CurveNum).Var1Min = -50.0;
state.dataCurveManager->PerfCurve(CurveNum).Var1Max = 10.0;
state.dataCurveManager->PerfCurve(CurveNum).Var2Min = 0.0;
state.dataCurveManager->PerfCurve(CurveNum).Var2Max = 2.0;
state->dataCurveManager->PerfCurve(CurveNum).CurveType = CurveTypeEnum::Quadratic;
state->dataCurveManager->PerfCurve(CurveNum).ObjectType = "Curve:Quadratic";
state->dataCurveManager->PerfCurve(CurveNum).InterpolationType = InterpTypeEnum::EvaluateCurveToLimits;
state->dataCurveManager->PerfCurve(CurveNum).Coeff1 = 21.2;
state->dataCurveManager->PerfCurve(CurveNum).Coeff2 = 0.09;
state->dataCurveManager->PerfCurve(CurveNum).Coeff3 = 0.0;
state->dataCurveManager->PerfCurve(CurveNum).Coeff4 = 0.0;
state->dataCurveManager->PerfCurve(CurveNum).Coeff5 = 0.0;
state->dataCurveManager->PerfCurve(CurveNum).Coeff6 = 0.0;
state->dataCurveManager->PerfCurve(CurveNum).Var1Min = -50.0;
state->dataCurveManager->PerfCurve(CurveNum).Var1Max = 10.0;
state->dataCurveManager->PerfCurve(CurveNum).Var2Min = 0.0;
state->dataCurveManager->PerfCurve(CurveNum).Var2Max = 2.0;

CurveNum = 2;
state.dataCurveManager->PerfCurve(CurveNum).CurveType = CurveTypeEnum::Quadratic;
state.dataCurveManager->PerfCurve(CurveNum).ObjectType = "Curve:Quadratic";
state.dataCurveManager->PerfCurve(CurveNum).InterpolationType = InterpTypeEnum::EvaluateCurveToLimits;
state.dataCurveManager->PerfCurve(CurveNum).Coeff1 = 18.8;
state.dataCurveManager->PerfCurve(CurveNum).Coeff2 = 0.33;
state.dataCurveManager->PerfCurve(CurveNum).Coeff3 = 0.0;
state.dataCurveManager->PerfCurve(CurveNum).Coeff4 = 0.0;
state.dataCurveManager->PerfCurve(CurveNum).Coeff5 = 0.0;
state.dataCurveManager->PerfCurve(CurveNum).Coeff6 = 0.0;
state.dataCurveManager->PerfCurve(CurveNum).Var1Min = 10.0;
state.dataCurveManager->PerfCurve(CurveNum).Var1Max = 50.0;
state.dataCurveManager->PerfCurve(CurveNum).Var2Min = 0.0;
state.dataCurveManager->PerfCurve(CurveNum).Var2Max = 2.0;

state.dataAirflowNetworkBalanceManager->OccupantVentilationControl(1).calc(state, 1, TimeOpenElapsed, TimeCloseElapsed, OpenStatus, OpenProbStatus, CloseProbStatus);
state->dataCurveManager->PerfCurve(CurveNum).CurveType = CurveTypeEnum::Quadratic;
state->dataCurveManager->PerfCurve(CurveNum).ObjectType = "Curve:Quadratic";
state->dataCurveManager->PerfCurve(CurveNum).InterpolationType = InterpTypeEnum::EvaluateCurveToLimits;
state->dataCurveManager->PerfCurve(CurveNum).Coeff1 = 18.8;
state->dataCurveManager->PerfCurve(CurveNum).Coeff2 = 0.33;
state->dataCurveManager->PerfCurve(CurveNum).Coeff3 = 0.0;
state->dataCurveManager->PerfCurve(CurveNum).Coeff4 = 0.0;
state->dataCurveManager->PerfCurve(CurveNum).Coeff5 = 0.0;
state->dataCurveManager->PerfCurve(CurveNum).Coeff6 = 0.0;
state->dataCurveManager->PerfCurve(CurveNum).Var1Min = 10.0;
state->dataCurveManager->PerfCurve(CurveNum).Var1Max = 50.0;
state->dataCurveManager->PerfCurve(CurveNum).Var2Min = 0.0;
state->dataCurveManager->PerfCurve(CurveNum).Var2Max = 2.0;

state->dataAirflowNetworkBalanceManager->OccupantVentilationControl(1).calc(*state, 1, TimeOpenElapsed, TimeCloseElapsed, OpenStatus, OpenProbStatus, CloseProbStatus);
EXPECT_EQ(0, OpenProbStatus);
EXPECT_EQ(1, CloseProbStatus);

MAT(1) = 26.0;
MRT(1) = 26.0;
state.dataAirflowNetworkBalanceManager->OccupantVentilationControl(1).calc(state, 1, TimeOpenElapsed, TimeCloseElapsed, OpenStatus, OpenProbStatus, CloseProbStatus);
state->dataAirflowNetworkBalanceManager->OccupantVentilationControl(1).calc(*state, 1, TimeOpenElapsed, TimeCloseElapsed, OpenStatus, OpenProbStatus, CloseProbStatus);
EXPECT_EQ(2, OpenProbStatus);
EXPECT_EQ(0, CloseProbStatus);

Expand All @@ -175,14 +175,14 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_AdvancedTest_Test1)
ZoneThermostatSetPointLo.allocate(1);
ZoneThermostatSetPointHi.allocate(1);

state.dataAirflowNetworkBalanceManager->OccupantVentilationControl(1).calc(state, 1, TimeOpenElapsed, TimeCloseElapsed, OpenStatus, OpenProbStatus, CloseProbStatus);
state->dataAirflowNetworkBalanceManager->OccupantVentilationControl(1).calc(*state, 1, TimeOpenElapsed, TimeCloseElapsed, OpenStatus, OpenProbStatus, CloseProbStatus);
EXPECT_EQ(1, OpenProbStatus);
EXPECT_EQ(0, CloseProbStatus);

TempControlType(1) = 4;
ZoneThermostatSetPointLo(1) = 22.0;
ZoneThermostatSetPointHi(1) = 28.0;
state.dataAirflowNetworkBalanceManager->OccupantVentilationControl(1).calc(state, 1, TimeOpenElapsed, TimeCloseElapsed, OpenStatus, OpenProbStatus, CloseProbStatus);
state->dataAirflowNetworkBalanceManager->OccupantVentilationControl(1).calc(*state, 1, TimeOpenElapsed, TimeCloseElapsed, OpenStatus, OpenProbStatus, CloseProbStatus);
EXPECT_EQ(1, OpenProbStatus);
EXPECT_EQ(0, CloseProbStatus);
}
63 changes: 32 additions & 31 deletions tst/EnergyPlus/unit/AirLoopHVACDOAS.unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
#include <gtest/gtest.h>

// EnergyPlus Headers
#include <EnergyPlus/Data/EnergyPlusData.hh>
#include "Fixtures/EnergyPlusFixture.hh"
#include <EnergyPlus/AirLoopHVACDOAS.hh>
#include <EnergyPlus/CurveManager.hh>
Expand Down Expand Up @@ -3949,32 +3950,32 @@ TEST_F(EnergyPlusFixture, AirLoopHVACDOASTest)

bool ErrorsFound = false;
// Read objects
HeatBalanceManager::GetProjectControlData(state, ErrorsFound);
HeatBalanceManager::GetProjectControlData(*state, ErrorsFound);
EXPECT_FALSE(ErrorsFound);
HeatBalanceManager::GetZoneData(state, ErrorsFound);
HeatBalanceManager::GetZoneData(*state, ErrorsFound);
EXPECT_FALSE(ErrorsFound);
HeatBalanceManager::GetWindowGlassSpectralData(state, ErrorsFound);
HeatBalanceManager::GetWindowGlassSpectralData(*state, ErrorsFound);
EXPECT_FALSE(ErrorsFound);
HeatBalanceManager::GetMaterialData(state, ErrorsFound);
HeatBalanceManager::GetMaterialData(*state, ErrorsFound);
EXPECT_FALSE(ErrorsFound);
HeatBalanceManager::GetConstructData(state, ErrorsFound);
HeatBalanceManager::GetConstructData(*state, ErrorsFound);
EXPECT_FALSE(ErrorsFound);
SurfaceGeometry::GetGeometryParameters(state, ErrorsFound);
SurfaceGeometry::GetGeometryParameters(*state, ErrorsFound);
EXPECT_FALSE(ErrorsFound);

state.dataSurfaceGeometry->CosBldgRotAppGonly = 1.0;
state.dataSurfaceGeometry->SinBldgRotAppGonly = 0.0;
state.dataSurfaceGeometry->CosZoneRelNorth.allocate(6);
state.dataSurfaceGeometry->SinZoneRelNorth.allocate(6);
state.dataSurfaceGeometry->CosZoneRelNorth = 1.0;
state.dataSurfaceGeometry->SinZoneRelNorth = 0.0;
state.dataSurfaceGeometry->CosBldgRelNorth = 1.0;
state.dataSurfaceGeometry->SinBldgRelNorth = 0.0;
SurfaceGeometry::GetSurfaceData(state, ErrorsFound);
state->dataSurfaceGeometry->CosBldgRotAppGonly = 1.0;
state->dataSurfaceGeometry->SinBldgRotAppGonly = 0.0;
state->dataSurfaceGeometry->CosZoneRelNorth.allocate(6);
state->dataSurfaceGeometry->SinZoneRelNorth.allocate(6);
state->dataSurfaceGeometry->CosZoneRelNorth = 1.0;
state->dataSurfaceGeometry->SinZoneRelNorth = 0.0;
state->dataSurfaceGeometry->CosBldgRelNorth = 1.0;
state->dataSurfaceGeometry->SinBldgRelNorth = 0.0;
SurfaceGeometry::GetSurfaceData(*state, ErrorsFound);
EXPECT_FALSE(ErrorsFound);

ZoneEquipmentManager::GetZoneEquipment(state);
SimAirServingZones::GetAirPathData(state);
ZoneEquipmentManager::GetZoneEquipment(*state);
SimAirServingZones::GetAirPathData(*state);
// OA inlet node
DataLoopNode::Node(2).MassFlowRate = 0.1;
DataLoopNode::Node(3).MassFlowRate = 0.1;
Expand All @@ -3998,15 +3999,15 @@ TEST_F(EnergyPlusFixture, AirLoopHVACDOASTest)
DataLoopNode::Node(65).HumRat = 0.001;
DataLoopNode::Node(66).HumRat = 0.001;

auto &thisAirLoopDOASObjec = state.dataAirLoopHVACDOAS->airloopDOAS[0];
auto &thisAirLoopDOASObjec = state->dataAirLoopHVACDOAS->airloopDOAS[0];

int index = 0;
thisAirLoopDOASObjec.SizingOnceFlag = false;
DataLoopNode::Node(11).Temp = -10.0;
DataLoopNode::Node(11).HumRat = 0.0008;
DataLoopNode::Node(70).TempSetPoint = 4.5;
Schedule(1).CurrentValue = 1.0; // set availability and fan schedule to 1
thisAirLoopDOASObjec.SimAirLoopHVACDOAS(state, true, index);
thisAirLoopDOASObjec.SimAirLoopHVACDOAS(*state, true, index);

// Mixer outlet
EXPECT_NEAR(23.0, DataLoopNode::Node(68).Temp, 0.0001);
Expand Down Expand Up @@ -4247,22 +4248,22 @@ TEST_F(EnergyPlusFixture, AirLoopHVACDOAS_TestOACompOutletNodeIndex)

ASSERT_TRUE(process_idf(idf_objects));

MixedAir::GetOutsideAirSysInputs(state);
MixedAir::GetOutsideAirSysInputs(*state);
MixedAir::GetOASysInputFlag = false;
MixedAir::GetOAMixerInputs(state);
MixedAir::GetOAMixerInputs(*state);

state.dataAirSystemsData->PrimaryAirSystems.allocate(5);
state.dataAirSystemsData->PrimaryAirSystems(1).Name = "PSZ-AC:1";
state.dataAirSystemsData->PrimaryAirSystems(2).Name = "PSZ-AC:2";
state.dataAirSystemsData->PrimaryAirSystems(3).Name = "PSZ-AC:3";
state.dataAirSystemsData->PrimaryAirSystems(4).Name = "PSZ-AC:4";
state.dataAirSystemsData->PrimaryAirSystems(5).Name = "PSZ-AC:5";
state->dataAirSystemsData->PrimaryAirSystems.allocate(5);
state->dataAirSystemsData->PrimaryAirSystems(1).Name = "PSZ-AC:1";
state->dataAirSystemsData->PrimaryAirSystems(2).Name = "PSZ-AC:2";
state->dataAirSystemsData->PrimaryAirSystems(3).Name = "PSZ-AC:3";
state->dataAirSystemsData->PrimaryAirSystems(4).Name = "PSZ-AC:4";
state->dataAirSystemsData->PrimaryAirSystems(5).Name = "PSZ-AC:5";

AirLoopHVACDOAS::AirLoopDOAS::getAirLoopDOASInput(state);
AirLoopHVACDOAS::AirLoopDOAS::getAirLoopDOASInput(*state);

EXPECT_EQ(state.dataAirLoop->OutsideAirSys(1).ComponentType(2), "HUMIDIFIER:STEAM:ELECTRIC");
EXPECT_EQ(state.dataAirLoop->OutsideAirSys(1).InletNodeNum(2), 2);
EXPECT_EQ(state.dataAirLoop->OutsideAirSys(1).OutletNodeNum(2), 23);
EXPECT_EQ(state->dataAirLoop->OutsideAirSys(1).ComponentType(2), "HUMIDIFIER:STEAM:ELECTRIC");
EXPECT_EQ(state->dataAirLoop->OutsideAirSys(1).InletNodeNum(2), 2);
EXPECT_EQ(state->dataAirLoop->OutsideAirSys(1).OutletNodeNum(2), 23);
}

} // namespace EnergyPlus
Loading

5 comments on commit f586325

@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.

develop (mitchute) - x86_64-Linux-Ubuntu-18.04-gcc-7.5: OK (2297 of 2297 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.

develop (mitchute) - x86_64-MacOS-10.15-clang-11.0.0: OK (2277 of 2277 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot-2
Copy link

Choose a reason for hiding this comment

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

develop (mitchute) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-UnitTestsCoverage-Debug: OK (1558 of 1558 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

@nrel-bot
Copy link

Choose a reason for hiding this comment

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

develop (mitchute) - Win64-Windows-10-VisualStudio-16: OK (2250 of 2250 tests passed, 0 test warnings)

Build Badge Test 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.

develop (mitchute) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-IntegrationCoverage-Debug: OK (722 of 722 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

Please sign in to comment.