Skip to content

Commit

Permalink
Doh, forgot to update some unit test files
Browse files Browse the repository at this point in the history
  • Loading branch information
amirroth committed Dec 9, 2024
1 parent 0a5be5d commit ed1b393
Show file tree
Hide file tree
Showing 11 changed files with 75 additions and 88 deletions.
4 changes: 2 additions & 2 deletions src/EnergyPlus/ScheduleManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1390,11 +1390,11 @@ namespace Sched {
}

For_exit:;
if (std::find(allDays.begin(), allDays.end(), false) != allDays.end()) {
if (std::find(&allDays[iDayType_Sun], &allDays[(int)DayType::Num], false) != &allDays[(int)DayType::Num]) {
ShowWarningCustom(state, eoh, format("has missing day types in Through={}", CurrentThrough));
ShowContinueError(state, format("Last \"For\" field={}", LastFor));
std::string errmsg = "Missing day types=,";
for (int kDayType = 0; kDayType < (int)DayType::Num; ++kDayType) {
for (int kDayType = 1; kDayType < (int)DayType::Num; ++kDayType) {
if (allDays[kDayType]) continue;
errmsg.erase(errmsg.length() - 1);
errmsg = format("{} \"{}\",-", errmsg, dayTypeNames[kDayType]);
Expand Down
4 changes: 2 additions & 2 deletions tst/EnergyPlus/unit/AirflowNetworkConditions.unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ TEST_F(EnergyPlusFixture, AirflowNetworkSimulationControl_DefaultSolver)
state->dataHeatBal->People.allocate(state->dataHeatBal->TotPeople);
state->dataHeatBal->People(1).ZonePtr = 1;
state->dataHeatBal->People(1).NumberOfPeople = 100.0;
state->dataHeatBal->People(1).numberOfPeopleSched = Sched::GetScheduleAlwaysOn(*state); // From dataglobals, always returns a 1 for schedule value
state->dataHeatBal->People(1).sched = Sched::GetScheduleAlwaysOn(*state); // From dataglobals, always returns a 1 for schedule value
state->dataHeatBal->People(1).AdaptiveCEN15251 = true;

std::string const idf_objects = delimited_string({
Expand Down Expand Up @@ -312,7 +312,7 @@ TEST_F(EnergyPlusFixture, AirflowNetworkSimulationControl_SetSolver)
state->dataHeatBal->People.allocate(state->dataHeatBal->TotPeople);
state->dataHeatBal->People(1).ZonePtr = 1;
state->dataHeatBal->People(1).NumberOfPeople = 100.0;
state->dataHeatBal->People(1).numberOfPeopleSched = Sched::GetScheduleAlwaysOn(*state); // From dataglobals, always returns a 1 for schedule value
state->dataHeatBal->People(1).sched = Sched::GetScheduleAlwaysOn(*state); // From dataglobals, always returns a 1 for schedule value
state->dataHeatBal->People(1).AdaptiveCEN15251 = true;

std::string const idf_objects = delimited_string({
Expand Down
2 changes: 1 addition & 1 deletion tst/EnergyPlus/unit/AirflowNetworkHVAC.unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2366,7 +2366,7 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestZoneVentingSchWithAdaptiveCtrl)
state->dataHeatBal->People.allocate(state->dataHeatBal->TotPeople);
state->dataHeatBal->People(1).ZonePtr = 1;
state->dataHeatBal->People(1).NumberOfPeople = 100.0;
state->dataHeatBal->People(1).numberOfPeopleSched = Sched::GetScheduleAlwaysOn(*state); // From dataglobals, always returns a 1 for schedule value
state->dataHeatBal->People(1).sched = Sched::GetScheduleAlwaysOn(*state); // From dataglobals, always returns a 1 for schedule value
state->dataHeatBal->People(1).AdaptiveCEN15251 = true;

state->afn->get_input();
Expand Down
6 changes: 2 additions & 4 deletions tst/EnergyPlus/unit/DataSurfaces.unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -510,10 +510,8 @@ TEST_F(EnergyPlusFixture, SurfaceTest_HashMap)
state->dataSurface->surfExtConv.allocate(numSurfs);
std::fill(state->dataSurface->surfExtConv.begin(), state->dataSurface->surfExtConv.end(), SurfExtConv());
state->dataSurface->SurfWinStormWinConstr.dimension(numSurfs, 0);
state->dataSurface->SurfMaterialMovInsulExt.dimension(numSurfs, 0);
state->dataSurface->SurfMaterialMovInsulInt.dimension(numSurfs, 0);
state->dataSurface->SurfMovInsulExtScheds.dimension(numSurfs, nullptr);
state->dataSurface->SurfMovInsulIntScheds.dimension(numSurfs, nullptr);
state->dataSurface->intMovInsuls.allocate(numSurfs);
state->dataSurface->extMovInsuls.allocate(numSurfs);

for (int SurfNum = 1; SurfNum <= numSurfs; SurfNum++) {
state->dataSurface->Surface(SurfNum).set_representative_surface(*state, SurfNum);
Expand Down
8 changes: 4 additions & 4 deletions tst/EnergyPlus/unit/HVACStandaloneERV.unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,10 @@ TEST_F(EnergyPlusFixture, HVACStandAloneERV_Test1)
state->dataHeatBal->People.allocate(state->dataHeatBal->TotPeople);
state->dataHeatBal->People(1).ZonePtr = 1;
state->dataHeatBal->People(1).NumberOfPeople = 100.0;
state->dataHeatBal->People(1).numberOfPeopleSched = Sched::GetScheduleAlwaysOn(*state);
state->dataHeatBal->People(1).sched = Sched::GetScheduleAlwaysOn(*state);
state->dataHeatBal->People(2).ZonePtr = 1;
state->dataHeatBal->People(2).NumberOfPeople = 200.0;
state->dataHeatBal->People(2).numberOfPeopleSched = Sched::GetScheduleAlwaysOn(*state);
state->dataHeatBal->People(2).sched = Sched::GetScheduleAlwaysOn(*state);

state->dataHVACStandAloneERV->StandAloneERV.allocate(1);

Expand Down Expand Up @@ -238,10 +238,10 @@ TEST_F(EnergyPlusFixture, HVACStandAloneERV_Test2)
state->dataHeatBal->People.allocate(state->dataHeatBal->TotPeople);
state->dataHeatBal->People(1).ZonePtr = 1;
state->dataHeatBal->People(1).NumberOfPeople = 10.0;
state->dataHeatBal->People(1).numberOfPeopleSched = Sched::GetScheduleAlwaysOn(*state);
state->dataHeatBal->People(1).sched = Sched::GetScheduleAlwaysOn(*state);
state->dataHeatBal->People(2).ZonePtr = 1;
state->dataHeatBal->People(2).NumberOfPeople = 20.0;
state->dataHeatBal->People(2).numberOfPeopleSched = Sched::GetScheduleAlwaysOn(*state);
state->dataHeatBal->People(2).sched = Sched::GetScheduleAlwaysOn(*state);

state->dataHVACStandAloneERV->StandAloneERV.allocate(1);
auto &erv = state->dataHVACStandAloneERV->StandAloneERV(1);
Expand Down
15 changes: 6 additions & 9 deletions tst/EnergyPlus/unit/HeatBalanceIntRadExchange.unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -396,16 +396,13 @@ TEST_F(EnergyPlusFixture, HeatBalanceIntRadExchange_UpdateMovableInsulationFlagT
auto *mat = new Material::MaterialBase;
state->dataMaterial->materials.push_back(mat);
state->dataSurface->Surface.allocate(1);
state->dataSurface->SurfMaterialMovInsulInt.allocate(1);
state->dataHeatBalSurf->SurfMovInsulIntPresent.allocate(1);
state->dataHeatBalSurf->SurfMovInsulIntPresentPrevTS.allocate(1);
state->dataHeatBalSurf->SurfMovInsulIndexList.push_back(1);
state->dataSurface->intMovInsuls.allocate(1);

SurfNum = 1;
state->dataHeatBalSurf->SurfMovInsulIntPresent(1) = false;
state->dataHeatBalSurf->SurfMovInsulIntPresentPrevTS(1) = false;
state->dataSurface->intMovInsuls(1).present = false;
state->dataSurface->intMovInsuls(1).presentPrevTS = false;
state->dataSurface->Surface(1).Construction = 1;
state->dataSurface->SurfMaterialMovInsulInt(1) = 1;
state->dataSurface->intMovInsuls(1).matNum = 1;

state->dataConstruction->Construct(1).InsideAbsorpThermal = 0.9;
mat->AbsorpThermal = 0.5;
Expand All @@ -418,13 +415,13 @@ TEST_F(EnergyPlusFixture, HeatBalanceIntRadExchange_UpdateMovableInsulationFlagT
EXPECT_TRUE(!DidMIChange);

// Test 2: Movable insulation present and was also present in previous time step. This should result in a false value since nothing has changed.
state->dataHeatBalSurf->SurfMovInsulIntPresentPrevTS(1) = true;
state->dataSurface->intMovInsuls(1).presentPrevTS = true;
HeatBalanceIntRadExchange::UpdateMovableInsulationFlag(*state, DidMIChange, SurfNum);
EXPECT_TRUE(DidMIChange);

// Test 2: Movable insulation present but wasn't in previous time step. However, the emissivity of the movable insulation and that of the
// construction are the same so nothing has actually changed. This should result in a false value.
state->dataHeatBalSurf->SurfMovInsulIntPresentPrevTS(1) = true;
state->dataSurface->intMovInsuls(1).presentPrevTS = true;
mat->AbsorpThermal = state->dataConstruction->Construct(1).InsideAbsorpThermal;
HeatBalanceIntRadExchange::UpdateMovableInsulationFlag(*state, DidMIChange, SurfNum);
EXPECT_TRUE(!DidMIChange);
Expand Down
46 changes: 19 additions & 27 deletions tst/EnergyPlus/unit/HeatBalanceMovableInsulation.unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,14 @@ TEST_F(EnergyPlusFixture, HeatBalanceMovableInsulation_EvalOutsideMovableInsulat

int SurfNum = 1;
state->dataSurface->Surface.allocate(SurfNum);
state->dataSurface->SurfMovInsulExtScheds.allocate(SurfNum);
state->dataSurface->SurfMaterialMovInsulExt.allocate(SurfNum);
state->dataSurface->SurfMovInsulExtScheds(SurfNum) = Sched::GetScheduleAlwaysOn(*state);
state->dataSurface->SurfMaterialMovInsulExt(SurfNum) = 1;
state->dataHeatBalSurf->SurfMovInsulExtPresent.allocate(SurfNum);
state->dataHeatBalSurf->SurfMovInsulHExt.allocate(SurfNum);
state->dataSurface->extMovInsuls.allocate(SurfNum);
state->dataSurface->extMovInsuls(SurfNum).sched = Sched::GetScheduleAlwaysOn(*state);
state->dataSurface->extMovInsuls(SurfNum).matNum = 1;
state->dataHeatBalSurf->SurfAbsSolarExt.allocate(SurfNum);
state->dataHeatBalSurf->SurfAbsThermalExt.allocate(SurfNum);
state->dataHeatBalSurf->SurfRoughnessExt.allocate(SurfNum);
state->dataHeatBalSurf->SurfMovInsulExtPresent(1) = true;
state->dataHeatBalSurf->SurfMovInsulIndexList.push_back(1);
state->dataSurface->extMovInsuls(SurfNum).present = true;
state->dataSurface->extMovInsulSurfNums.push_back(SurfNum);

auto *mat1 = new Material::MaterialShade;
s_mat->materials.push_back(mat1);
Expand All @@ -105,7 +102,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceMovableInsulation_EvalOutsideMovableInsulat
state->dataHeatBalSurf->SurfAbsSolarExt(1) = 0.0;
HeatBalanceSurfaceManager::EvalOutsideMovableInsulation(*state);
EXPECT_EQ(0.75, state->dataHeatBalSurf->SurfAbsSolarExt(1));
EXPECT_EQ(0.8, state->dataHeatBalSurf->SurfMovInsulHExt(1));
EXPECT_EQ(0.8, state->dataSurface->extMovInsuls(1).H);
EXPECT_ENUM_EQ(Material::SurfaceRoughness::VeryRough, state->dataHeatBalSurf->SurfRoughnessExt(1));
EXPECT_EQ(0.75, state->dataHeatBalSurf->SurfAbsThermalExt(1));

Expand Down Expand Up @@ -154,15 +151,12 @@ TEST_F(EnergyPlusFixture, HeatBalanceMovableInsulation_EvalInsideMovableInsulati
int SurfNum = 1;
state->dataSurface->Surface.allocate(SurfNum);

state->dataSurface->SurfMovInsulIntScheds.allocate(SurfNum);
state->dataSurface->SurfMaterialMovInsulInt.allocate(SurfNum);
state->dataSurface->SurfMovInsulIntScheds(SurfNum) = Sched::GetScheduleAlwaysOn(*state);
state->dataSurface->SurfMaterialMovInsulInt(SurfNum) = 1;
state->dataHeatBalSurf->SurfMovInsulIntPresent.allocate(SurfNum);
state->dataHeatBalSurf->SurfMovInsulHInt.allocate(SurfNum);
state->dataSurface->intMovInsuls.allocate(SurfNum);
state->dataSurface->intMovInsuls(SurfNum).sched = Sched::GetScheduleAlwaysOn(*state);
state->dataSurface->intMovInsuls(SurfNum).matNum = 1;
state->dataHeatBalSurf->SurfAbsSolarInt.allocate(SurfNum);
state->dataHeatBalSurf->SurfAbsThermalInt.allocate(SurfNum);
state->dataHeatBalSurf->SurfMovInsulIndexList.push_back(1);
state->dataSurface->intMovInsulSurfNums.push_back(SurfNum);

auto *mat = new Material::MaterialShade;
state->dataMaterial->materials.push_back(mat);
Expand All @@ -183,8 +177,8 @@ TEST_F(EnergyPlusFixture, HeatBalanceMovableInsulation_EvalInsideMovableInsulati
state->dataHeatBalSurf->SurfAbsSolarInt(1) = 0.0;
HeatBalanceSurfaceManager::EvalInsideMovableInsulation(*state);
EXPECT_EQ(0.75, state->dataHeatBalSurf->SurfAbsSolarInt(1));
EXPECT_EQ(0.8, state->dataHeatBalSurf->SurfMovInsulHInt(1));
EXPECT_EQ(true, state->dataHeatBalSurf->SurfMovInsulIntPresent(1));
EXPECT_EQ(0.8, state->dataSurface->intMovInsuls(1).H);
EXPECT_EQ(true, state->dataSurface->intMovInsuls(1).present);
EXPECT_EQ(0.75, state->dataHeatBalSurf->SurfAbsThermalInt(1));

state->dataHeatBalSurf->SurfAbsSolarInt(1) = 0.0;
Expand Down Expand Up @@ -313,14 +307,12 @@ TEST_F(EnergyPlusFixture, SurfaceControlMovableInsulation_InvalidWindowSimpleGla
// set surface data
state->dataSurface->TotSurfaces = 1;
state->dataSurface->Surface.allocate(1);
state->dataSurface->SurfMaterialMovInsulExt.allocate(1);
state->dataSurface->SurfMovInsulExtScheds.allocate(1);
state->dataSurface->SurfMaterialMovInsulInt.allocate(1);
state->dataSurface->SurfMovInsulIntScheds.allocate(1);
state->dataSurface->SurfMaterialMovInsulExt = 0;
state->dataSurface->SurfMovInsulExtScheds(1) = nullptr;
state->dataSurface->SurfMaterialMovInsulInt = 0;
state->dataSurface->SurfMovInsulIntScheds(1) = nullptr;
state->dataSurface->extMovInsuls.allocate(1);
state->dataSurface->intMovInsuls.allocate(1);
state->dataSurface->extMovInsuls(1).matNum = 0;
state->dataSurface->extMovInsuls(1).sched = nullptr;
state->dataSurface->intMovInsuls(1).matNum = 0;
state->dataSurface->intMovInsuls(1).sched = nullptr;
state->dataSurfaceGeometry->SurfaceTmp.allocate(1);
int SurfNum = 0;
int TotHTSurfs = state->dataSurface->TotSurfaces = 1;
Expand All @@ -334,7 +326,7 @@ TEST_F(EnergyPlusFixture, SurfaceControlMovableInsulation_InvalidWindowSimpleGla
SurfaceGeometry::GetMovableInsulationData(*state, ErrorsFound);
// check movable insulation material
EXPECT_EQ(state->dataSurfaceGeometry->SurfaceTmp(1).BaseSurfName, "ZN001:WALL001"); // base surface name
EXPECT_EQ(state->dataSurface->SurfMaterialMovInsulExt(1), 4); // index to movable insulation material
EXPECT_EQ(state->dataSurface->extMovInsuls(1).matNum, 4); // index to movable insulation material
EXPECT_EQ(state->dataMaterial->materials(4)->Name, "SIMPLEGLAZINGSYSTEM"); // name of movable insulation material
EXPECT_ENUM_EQ(state->dataMaterial->materials(4)->group, Material::Group::GlassSimple); // invalid material group type
EXPECT_TRUE(ErrorsFound); // error found due to invalid material
Expand Down
Loading

0 comments on commit ed1b393

Please sign in to comment.