Skip to content

Commit

Permalink
New unit test for zone and space floor areas
Browse files Browse the repository at this point in the history
  • Loading branch information
mjwitte committed Mar 2, 2022
1 parent 5e982ed commit f29f256
Showing 1 changed file with 189 additions and 0 deletions.
189 changes: 189 additions & 0 deletions tst/EnergyPlus/unit/SurfaceGeometry.unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8554,3 +8554,192 @@ TEST_F(EnergyPlusFixture, Use_Gross_Roof_Area_for_Averge_Height_with_Window)
EXPECT_NEAR(state->dataHeatBal->Zone(1).CeilingHeight, ceilingHeight_expected, 1e-6);
EXPECT_NE(state->dataHeatBal->Zone(1).CeilingHeight, ceilingHeight_old);
}
TEST_F(EnergyPlusFixture, SurfaceGeometry_ZoneAndSpaceAreas)
{

// Test for issue #9302 and beyone - User input Zone Floor Area not used for Space Floor Area

std::string const idf_objects = delimited_string({
"Zone,",
"Zone 1, !- Name",
" 90, !- Direction of Relative North {deg}",
" 16.12975, !- X Origin {m}",
" 0, !- Y Origin {m}",
" 0, !- Z Origin {m}",
" , !- Type",
" 1, !- Multiplier",
" , !- Ceiling Height {m}",
" , !- Volume {m3}",
" 30.0; !- Floor Area {m2}",

"Zone,",
"Zone 2, !- Name",
" 90, !- Direction of Relative North {deg}",
" 16.12975, !- X Origin {m}",
" 0, !- Y Origin {m}",
" 0, !- Z Origin {m}",
" , !- Type",
" 1, !- Multiplier",
" , !- Ceiling Height {m}",
" , !- Volume {m3}",
" 20.0; !- Floor Area {m2}",

"Zone,",
"Zone 3; !- Name",

"Space,",
"Space 1a, !- Name",
"Zone 1; !- Zone Name",

"Space,",
"Space 1b, !- Name",
"Zone 1; !- Zone Name",

"Space,",
"Space 3, !- Name",
"Zone 3, !- Zone Name",
"5.0; !- Floor Area {m2}",

"Material,",
" Some Material, !- Name",
" VeryRough, !- Roughness",
" 0.006, !- Thickness {m}",
" 0.815, !- Conductivity {W/m-K}",
" 929, !- Density {kg/m3}",
" 3140, !- Specific Heat {J/kg-K}",
" 0.9, !- Thermal Absorptance",
" 0.7, !- Solar Absorptance",
" 0.7; !- Visible Absorptance",
"Construction,",
" Some Construction, !- Name",
" Some Material; !- Outside Layer",
"Construction:AirBoundary,",
"Grouped Air Boundary, !- Name",
"None; !- Air Exchange Method",

"BuildingSurface:Detailed,",
" Zone1-Floor, !- Name",
" Floor, !- Surface Type",
" Some Construction, !- Construction Name",
" Zone 1, !- Zone Name",
" Space 1a, !- Space Name",
" Outdoors, !- Outside Boundary Condition",
" , !- Outside Boundary Condition Object",
" SunExposed, !- Sun Exposure",
" WindExposed, !- Wind Exposure",
" , !- View Factor to Ground",
" 4, !- Number of Vertices",
" 0,0,0, !- Vertex 1",
" 0,1,0, !- Vertex 2",
" 1,1,0, !- Vertex 3",
" 1,0,0; !- Vertex 4",

"BuildingSurface:Detailed,",
" Zone1-Floor2, !- Name",
" Floor, !- Surface Type",
" Some Construction, !- Construction Name",
" Zone 1, !- Zone Name",
" Space 1b, !- Space Name",
" Outdoors, !- Outside Boundary Condition",
" , !- Outside Boundary Condition Object",
" SunExposed, !- Sun Exposure",
" WindExposed, !- Wind Exposure",
" , !- View Factor to Ground",
" 4, !- Number of Vertices",
" 0,0,0, !- Vertex 1",
" 0,2,0, !- Vertex 2",
" 1,2,0, !- Vertex 3",
" 1,0,0; !- Vertex 4",

"BuildingSurface:Detailed,",
" Zone2-Floor, !- Name",
" Floor, !- Surface Type",
" Some Construction, !- Construction Name",
" Zone 2, !- Zone Name",
" , !- Space Name",
" Ground, !- Outside Boundary Condition",
" , !- Outside Boundary Condition Object",
" NoSun, !- Sun Exposure",
" NoWind, !- Wind Exposure",
" , !- View Factor to Ground",
" 4, !- Number of Vertices",
" 0,0,0, !- Vertex 1",
" 0,1,0, !- Vertex 2",
" 1,1,0, !- Vertex 3",
" 1,0,0; !- Vertex 4",

"BuildingSurface:Detailed,",
" Zone3-Floor, !- Name",
" Floor, !- Surface Type",
" Some Construction, !- Construction Name",
" Zone 3, !- Zone Name",
" Space 3, !- Space Name",
" Ground, !- Outside Boundary Condition",
" , !- Outside Boundary Condition Object",
" NoSun, !- Sun Exposure",
" NoWind, !- Wind Exposure",
" , !- View Factor to Ground",
" 4, !- Number of Vertices",
" 0,0,0, !- Vertex 1",
" 0,1,0, !- Vertex 2",
" 1,1,0, !- Vertex 3",
" 1,0,0; !- Vertex 4",

});
ASSERT_TRUE(process_idf(idf_objects));
bool ErrorsFound = false;

GetMaterialData(*state, ErrorsFound); // read material data
EXPECT_FALSE(ErrorsFound); // expect no errors

GetConstructData(*state, ErrorsFound); // read construction data
EXPECT_FALSE(ErrorsFound); // expect no errors

GetZoneData(*state, ErrorsFound); // read zone data
EXPECT_FALSE(ErrorsFound); // expect no errors

SetupZoneGeometry(*state, ErrorsFound);
EXPECT_FALSE(ErrorsFound); // expect no errors

// Zone 1 with user-entered floor area of 30.0 consists of Space 1 and Space 2
// Space 1 has a floor surface of area 1.0, user-entered floor area is blank
// Space 2 has a floor surface of area 2.0, user-entered floor area is blank
EXPECT_EQ(state->dataHeatBal->space(1).Name, "SPACE 1A");
EXPECT_NEAR(state->dataHeatBal->space(1).userEnteredFloorArea, DataGlobalConstants::AutoCalculate, 0.001);
EXPECT_NEAR(state->dataHeatBal->space(1).calcFloorArea, 1.0, 0.001);
EXPECT_NEAR(state->dataHeatBal->space(1).floorArea, 10.0, 0.001);

EXPECT_EQ(state->dataHeatBal->space(2).Name, "SPACE 1B");
EXPECT_NEAR(state->dataHeatBal->space(2).userEnteredFloorArea, DataGlobalConstants::AutoCalculate, 0.001);
EXPECT_NEAR(state->dataHeatBal->space(2).calcFloorArea, 2.0, 0.001);
EXPECT_NEAR(state->dataHeatBal->space(2).floorArea, 20.0, 0.001);

EXPECT_EQ(state->dataHeatBal->Zone(1).Name, "ZONE 1");
EXPECT_NEAR(state->dataHeatBal->Zone(1).UserEnteredFloorArea, 30.0, 0.001);
EXPECT_NEAR(state->dataHeatBal->Zone(1).CalcFloorArea, 3.0, 0.001);
EXPECT_NEAR(state->dataHeatBal->Zone(1).FloorArea, 30.0, 0.001);
Real64 zone1Area = state->dataHeatBal->space(1).floorArea + state->dataHeatBal->space(2).floorArea;
EXPECT_NEAR(state->dataHeatBal->Zone(1).FloorArea, zone1Area, 0.001);

// Zone 3 consists of Space 3, user-entered floor area is blank
// Space 3 has a floor surface of area 1.0, user-entered floor is 5.0
EXPECT_EQ(state->dataHeatBal->Zone(3).Name, "ZONE 3");
EXPECT_NEAR(state->dataHeatBal->Zone(3).UserEnteredFloorArea, DataGlobalConstants::AutoCalculate, 0.001);
EXPECT_NEAR(state->dataHeatBal->Zone(3).CalcFloorArea, 5.0, 0.001);
EXPECT_NEAR(state->dataHeatBal->Zone(3).FloorArea, 5.0, 0.001);
EXPECT_EQ(state->dataHeatBal->space(3).Name, "SPACE 3");
EXPECT_NEAR(state->dataHeatBal->space(3).userEnteredFloorArea, 5.0, 0.001);
EXPECT_NEAR(state->dataHeatBal->space(3).calcFloorArea, 1.0, 0.001);
EXPECT_NEAR(state->dataHeatBal->space(3).floorArea, 5.0, 0.001);

// Zone 2 consists of auto-generated Space 4, user-entered floor area is 20.0
// Space 4 has a floor surface of area 1.0, user-entered floor is blank
EXPECT_EQ(state->dataHeatBal->Zone(2).Name, "ZONE 2");
EXPECT_NEAR(state->dataHeatBal->Zone(2).UserEnteredFloorArea, 20.0, 0.001);
EXPECT_NEAR(state->dataHeatBal->Zone(2).CalcFloorArea, 1.0, 0.001);
EXPECT_NEAR(state->dataHeatBal->Zone(2).FloorArea, 20.0, 0.001);
EXPECT_EQ(state->dataHeatBal->space(4).Name, "ZONE 2");
EXPECT_NEAR(state->dataHeatBal->space(4).userEnteredFloorArea, DataGlobalConstants::AutoCalculate, 0.001);
EXPECT_NEAR(state->dataHeatBal->space(4).calcFloorArea, 1.0, 0.001);
EXPECT_NEAR(state->dataHeatBal->space(4).floorArea, 20.0, 0.001);
}

5 comments on commit f29f256

@nrel-bot
Copy link

Choose a reason for hiding this comment

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

fix9302ZoneFloorArea (mjwitte) - Win64-Windows-10-VisualStudio-16: OK (2469 of 2470 tests passed, 0 test warnings)

Failures:\n

EnergyPlusFixture Test Summary

  • Passed: 1241
  • Failed: 1

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.

fix9302ZoneFloorArea (mjwitte) - x86_64-MacOS-10.15-clang-11.0.0: OK (3233 of 3234 tests passed, 0 test warnings)

Failures:\n

EnergyPlusFixture Test Summary

  • Passed: 1243
  • Failed: 1

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.

fix9302ZoneFloorArea (mjwitte) - x86_64-Linux-Ubuntu-18.04-gcc-7.5: OK (3274 of 3275 tests passed, 0 test warnings)

Failures:\n

EnergyPlusFixture Test Summary

  • Passed: 1243
  • Failed: 1

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.

fix9302ZoneFloorArea (mjwitte) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-UnitTestsCoverage-Debug: OK (1748 of 1749 tests passed, 0 test warnings)

Failures:\n

EnergyPlusFixture Test Summary

  • Passed: 1243
  • Failed: 1

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

fix9302ZoneFloorArea (mjwitte) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-IntegrationCoverage-Debug: OK (746 of 746 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

Please sign in to comment.