From f4facf5e89430deddd7c9df6379354bd4cce4b52 Mon Sep 17 00:00:00 2001 From: "Michael J. Witte" Date: Wed, 29 Nov 2023 13:56:57 -0600 Subject: [PATCH 01/22] Extend unit tests for surface order and first/last surface values --- tst/EnergyPlus/unit/SurfaceGeometry.unit.cc | 2409 ++++++++++++++++++- 1 file changed, 2398 insertions(+), 11 deletions(-) diff --git a/tst/EnergyPlus/unit/SurfaceGeometry.unit.cc b/tst/EnergyPlus/unit/SurfaceGeometry.unit.cc index 4c10d01f90a..5c9e8084f21 100644 --- a/tst/EnergyPlus/unit/SurfaceGeometry.unit.cc +++ b/tst/EnergyPlus/unit/SurfaceGeometry.unit.cc @@ -8661,10 +8661,6 @@ TEST_F(EnergyPlusFixture, GetSurfaceData_SurfaceOrder) SetupZoneGeometry(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); // expect no errors - - GetSurfaceData(*state, ErrorsFound); // setup zone geometry and get zone data - EXPECT_FALSE(ErrorsFound); // expect no errors - // compare_err_stream( "" ); // just for debugging // This tests the sorted order of surfaces in two ways: @@ -8718,11 +8714,11 @@ TEST_F(EnergyPlusFixture, GetSurfaceData_SurfaceOrder) // 12. Living:Ceiling (ceiling) // 13. Living:Floor (floor) // 14. WestDoor (door) - // 15. TubularDaylightingDiffuser1 ("window") - // 16. NorthWindow (window) - // 17. EastWindow (window) - // 18. SouthWindow (window) - // 19. WestWindow (window) + // 15. NorthWindow (window) + // 16. EastWindow (window) + // 17. SouthWindow (window) + // 18. WestWindow (window) + // 19. TubularDaylightingDiffuser1 ("window") // GARAGE ZONE: // 20. Garage:Interior (wall) // 21. Garage:EastWall (wall) @@ -8837,11 +8833,11 @@ TEST_F(EnergyPlusFixture, GetSurfaceData_SurfaceOrder) EXPECT_EQ(floorLivingFloor, 12); EXPECT_EQ(ceilingLivingCeiling, 13); EXPECT_EQ(doorWestDoor, 14); - EXPECT_EQ(windowTubularDaylightingDiffuser1, 19); EXPECT_EQ(windowNorthWindow, 15); EXPECT_EQ(windowEastWindow, 16); EXPECT_EQ(windowSouthWindow, 17); EXPECT_EQ(windowWestWindow, 18); + EXPECT_EQ(windowTubularDaylightingDiffuser1, 19); EXPECT_EQ(state->dataHeatBal->space(1).HTSurfaceFirst, 7); EXPECT_EQ(state->dataHeatBal->space(1).HTSurfaceLast, 19); EXPECT_EQ(state->dataHeatBal->space(1).OpaqOrIntMassSurfaceFirst, 7); @@ -8900,8 +8896,8 @@ TEST_F(EnergyPlusFixture, GetSurfaceData_SurfaceOrder) EXPECT_EQ(roofNorthRoof4, 36); EXPECT_EQ(roofEastRoof, 37); EXPECT_EQ(roofWestRoof, 38); - EXPECT_EQ(nonwindowTubularDaylightingDome1, 40); EXPECT_EQ(windowAtticSkylight, 39); + EXPECT_EQ(nonwindowTubularDaylightingDome1, 40); EXPECT_EQ(state->dataHeatBal->space(3).HTSurfaceFirst, wallEastGable); EXPECT_EQ(state->dataHeatBal->space(3).HTSurfaceLast, nonwindowTubularDaylightingDome1); EXPECT_EQ(state->dataHeatBal->space(3).OpaqOrIntMassSurfaceFirst, wallEastGable); @@ -9058,6 +9054,2397 @@ TEST_F(EnergyPlusFixture, GetSurfaceData_SurfaceOrder) EXPECT_FALSE(std::find(HTKivaSurfaces.begin(), HTKivaSurfaces.end(), thisSurface) != HTKivaSurfaces.end()); } +TEST_F(EnergyPlusFixture, GetSurfaceData_SurfaceOrder2) +{ + // First zone, LIVING ZONE, has no surfaces + + bool ErrorsFound(false); + + std::string const idf_objects = delimited_string({ + " Material,", + " A1 - 1 IN STUCCO, !- Name", + " Smooth, !- Roughness", + " 2.5389841E-02, !- Thickness {m}", + " 0.6918309, !- Conductivity {W/m-K}", + " 1858.142, !- Density {kg/m3}", + " 836.8000, !- Specific Heat {J/kg-K}", + " 0.9000000, !- Thermal Absorptance", + " 0.9200000, !- Solar Absorptance", + " 0.9200000; !- Visible Absorptance", + + " Material,", + " CB11, !- Name", + " MediumRough, !- Roughness", + " 0.2032000, !- Thickness {m}", + " 1.048000, !- Conductivity {W/m-K}", + " 1105.000, !- Density {kg/m3}", + " 837.0000, !- Specific Heat {J/kg-K}", + " 0.9000000, !- Thermal Absorptance", + " 0.2000000, !- Solar Absorptance", + " 0.2000000; !- Visible Absorptance", + + " Material,", + " GP01, !- Name", + " MediumSmooth, !- Roughness", + " 1.2700000E-02, !- Thickness {m}", + " 0.1600000, !- Conductivity {W/m-K}", + " 801.0000, !- Density {kg/m3}", + " 837.0000, !- Specific Heat {J/kg-K}", + " 0.9000000, !- Thermal Absorptance", + " 0.7500000, !- Solar Absorptance", + " 0.7500000; !- Visible Absorptance", + + " Material,", + " IN02, !- Name", + " Rough, !- Roughness", + " 9.0099998E-02, !- Thickness {m}", + " 4.3000001E-02, !- Conductivity {W/m-K}", + " 10.00000, !- Density {kg/m3}", + " 837.0000, !- Specific Heat {J/kg-K}", + " 0.9000000, !- Thermal Absorptance", + " 0.7500000, !- Solar Absorptance", + " 0.7500000; !- Visible Absorptance", + + " Material,", + " IN05, !- Name", + " Rough, !- Roughness", + " 0.2458000, !- Thickness {m}", + " 4.3000001E-02, !- Conductivity {W/m-K}", + " 10.00000, !- Density {kg/m3}", + " 837.0000, !- Specific Heat {J/kg-K}", + " 0.9000000, !- Thermal Absorptance", + " 0.7500000, !- Solar Absorptance", + " 0.7500000; !- Visible Absorptance", + + " Material,", + " PW03, !- Name", + " MediumSmooth, !- Roughness", + " 1.2700000E-02, !- Thickness {m}", + " 0.1150000, !- Conductivity {W/m-K}", + " 545.0000, !- Density {kg/m3}", + " 1213.000, !- Specific Heat {J/kg-K}", + " 0.9000000, !- Thermal Absorptance", + " 0.7800000, !- Solar Absorptance", + " 0.7800000; !- Visible Absorptance", + + " Material,", + " CC03, !- Name", + " MediumRough, !- Roughness", + " 0.1016000, !- Thickness {m}", + " 1.310000, !- Conductivity {W/m-K}", + " 2243.000, !- Density {kg/m3}", + " 837.0000, !- Specific Heat {J/kg-K}", + " 0.9000000, !- Thermal Absorptance", + " 0.6500000, !- Solar Absorptance", + " 0.6500000; !- Visible Absorptance", + + " Material,", + " HF-A3, !- Name", + " Smooth, !- Roughness", + " 1.5000000E-03, !- Thickness {m}", + " 44.96960, !- Conductivity {W/m-K}", + " 7689.000, !- Density {kg/m3}", + " 418.0000, !- Specific Heat {J/kg-K}", + " 0.9000000, !- Thermal Absorptance", + " 0.2000000, !- Solar Absorptance", + " 0.2000000; !- Visible Absorptance", + + " Material:NoMass,", + " AR02, !- Name", + " VeryRough, !- Roughness", + " 7.8000002E-02, !- Thermal Resistance {m2-K/W}", + " 0.9000000, !- Thermal Absorptance", + " 0.7000000, !- Solar Absorptance", + " 0.7000000; !- Visible Absorptance", + + " Material:NoMass,", + " CP02, !- Name", + " Rough, !- Roughness", + " 0.2170000, !- Thermal Resistance {m2-K/W}", + " 0.9000000, !- Thermal Absorptance", + " 0.7500000, !- Solar Absorptance", + " 0.7500000; !- Visible Absorptance", + + " WindowMaterial:Glazing,", + " CLEAR 3MM, !- Name", + " SpectralAverage, !- Optical Data Type", + " , !- Window Glass Spectral Data Set Name", + " 0.003, !- Thickness {m}", + " 0.837, !- Solar Transmittance at Normal Incidence", + " 0.075, !- Front Side Solar Reflectance at Normal Incidence", + " 0.075, !- Back Side Solar Reflectance at Normal Incidence", + " 0.898, !- Visible Transmittance at Normal Incidence", + " 0.081, !- Front Side Visible Reflectance at Normal Incidence", + " 0.081, !- Back Side Visible Reflectance at Normal Incidence", + " 0.0, !- Infrared Transmittance at Normal Incidence", + " 0.84, !- Front Side Infrared Hemispherical Emissivity", + " 0.84, !- Back Side Infrared Hemispherical Emissivity", + " 0.9; !- Conductivity {W/m-K}", + + " WindowMaterial:Gas,", + " AIR 6MM, !- Name", + " AIR, !- Gas Type", + " 0.006; !- Thickness {m}", + + " Construction,", + " EXTWALL:LIVING, !- Name", + " A1 - 1 IN STUCCO, !- Outside Layer", + " CB11, !- Layer 2", + " GP01; !- Layer 3", + + " Construction,", + " INTERIORWall, !- Name", + " GP01, !- Outside Layer", + " IN02, !- Layer 2", + " GP01; !- Layer 3", + + " Construction,", + " FLOOR:GARAGE, !- Name", + " CC03; !- Outside Layer", + + " Construction,", + " FLOOR:LIVING, !- Name", + " CC03, !- Outside Layer", + " CP02; !- Layer 2", + + " Construction,", + " ROOF, !- Name", + " AR02, !- Outside Layer", + " PW03; !- Layer 2", + + " Construction,", + " EXTWALL:GARAGE, !- Name", + " A1 - 1 IN STUCCO, !- Outside Layer", + " CB11; !- Layer 2", + + " Construction,", + " CEILING:LIVING, !- Name", + " IN05, !- Outside Layer", + " GP01; !- Layer 2", + + " Construction,", + " reverseCEILING:LIVING, !- Name", + " GP01, !- Outside Layer", + " IN05; !- Layer 2", + + " Construction,", + " GABLE, !- Name", + " PW03; !- Outside Layer", + + " Construction,", + " Dbl Clr 3mm/6mm Air, !- Name", + " CLEAR 3MM, !- Outside Layer", + " AIR 6MM, !- Layer 2", + " CLEAR 3MM; !- Layer 3", + + " Construction,", + " Garage:SteelDoor, !- Name", + " HF-A3; !- Outside Layer", + + " Construction,", + " CEILING:Garage, !- Name", + " GP01; !- Outside Layer", + + " Zone,", + " LIVING ZONE; !- Name", + + " Zone,", + " GARAGE ZONE; !- Name", + + " Zone,", + " ATTIC ZONE; !- Name", + + " GlobalGeometryRules,", + " UpperLeftCorner, !- Starting Vertex Position", + " CounterClockWise, !- Vertex Entry Direction", + " World; !- Coordinate System", + + " WindowMaterial:Glazing,", + " Clear Acrylic Plastic, !- Name", + " SpectralAverage, !- Optical Data Type", + " , !- Window Glass Spectral Data Set Name", + " 0.003, !- Thickness {m}", + " 0.92, !- Solar Transmittance at Normal Incidence", + " 0.05, !- Front Side Solar Reflectance at Normal Incidence", + " 0.05, !- Back Side Solar Reflectance at Normal Incidence", + " 0.92, !- Visible Transmittance at Normal Incidence", + " 0.05, !- Front Side Visible Reflectance at Normal Incidence", + " 0.05, !- Back Side Visible Reflectance at Normal Incidence", + " 0.00, !- Infrared Transmittance at Normal Incidence", + " 0.90, !- Front Side Infrared Hemispherical Emissivity", + " 0.90, !- Back Side Infrared Hemispherical Emissivity", + " 0.90; !- Conductivity {W/m-K}", + + " WindowMaterial:Glazing,", + " Diffusing Acrylic Plastic, !- Name", + " SpectralAverage, !- Optical Data Type", + " , !- Window Glass Spectral Data Set Name", + " 0.0022, !- Thickness {m}", + " 0.90, !- Solar Transmittance at Normal Incidence", + " 0.08, !- Front Side Solar Reflectance at Normal Incidence", + " 0.08, !- Back Side Solar Reflectance at Normal Incidence", + " 0.90, !- Visible Transmittance at Normal Incidence", + " 0.08, !- Front Side Visible Reflectance at Normal Incidence", + " 0.08, !- Back Side Visible Reflectance at Normal Incidence", + " 0.00, !- Infrared Transmittance at Normal Incidence", + " 0.90, !- Front Side Infrared Hemispherical Emissivity", + " 0.90, !- Back Side Infrared Hemispherical Emissivity", + " 0.90; !- Conductivity {W/m-K}", + "", + " Material,", + " Very High Reflectivity Surface, !- Name", + " Smooth, !- Roughness", + " 0.0005, !- Thickness {m}", + " 237, !- Conductivity {W/m-K}", + " 2702, !- Density {kg/m3}", + " 903, !- Specific Heat {J/kg-K}", + " 0.90, !- Thermal Absorptance", + " 0.05, !- Solar Absorptance", + " 0.05; !- Visible Absorptance", + " Construction,", + " TDD Pipe, !- Name", + " Very High Reflectivity Surface; !- Outside Layer", + "", + " Construction,", + " TDD Dome, !- Name", + " Clear Acrylic Plastic; !- Outside Layer", + "", + " Construction,", + " TDD Diffuser, !- Name", + " Diffusing Acrylic Plastic; !- Outside Layer", + + " DaylightingDevice:Tubular,", + " Pipe1, !- Name", + " TubularDaylightingDome1, !- Dome Name", + " TubularDaylightingDiffuser1, !- Diffuser Name", + " TDD Pipe, !- Construction Name", + " 0.3556, !- Diameter {m}", + " 1.4, !- Total Length {m}", + " 0.28, !- Effective Thermal Resistance {m2-K/W}", + " ATTIC ZONE, !- Transition Zone 1 Name", + " 1.1; !- Transition Zone 1 Length {m}", + + " FenestrationSurface:Detailed,", + " TubularDaylightingDome1, !- Name", + " TubularDaylightDome, !- Surface Type", + " TDD Dome, !- Construction Name", + " NorthRoof1, !- Building Surface Name", + " , !- Outside Boundary Condition Object", + " 0.0, !- View Factor to Ground", + " , !- Frame and Divider Name", + " 1.0, !- Multiplier", + " 4, !- Number of Vertices", + " 13.782,5.389,4.6838, !- X,Y,Z ==> Vertex 1 {m}", + " 13.782,6.3172,3.8804, !- X,Y,Z ==> Vertex 2 {m}", + " 0,6.3172,3.8804, !- X,Y,Z ==> Vertex 3 {m}", + " 0,5.389,4.6838; !- X,Y,Z ==> Vertex 4 {m}", + + " BuildingSurface:Detailed,", + " NorthRoof1, !- Name", + " ROOF, !- Surface Type", + " ROOF, !- Construction Name", + " ATTIC ZONE, !- Zone Name", + " , !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.9, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 13.782,5.389,4.6838, !- X,Y,Z ==> Vertex 1 {m}", + " 13.782,7.3172,3.8804, !- X,Y,Z ==> Vertex 2 {m}", + " 0,7.3172,3.8804, !- X,Y,Z ==> Vertex 3 {m}", + " 0,5.389,4.6838; !- X,Y,Z ==> Vertex 4 {m}", + + " BuildingSurface:Detailed,", + " SouthRoof, !- Name", + " ROOF, !- Surface Type", + " ROOF, !- Construction Name", + " ATTIC ZONE, !- Zone Name", + " , !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.5000000, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 0.000000,5.389000,4.683800, !- X,Y,Z ==> Vertex 1 {m}", + " 0.000000,0.000000,2.438400, !- X,Y,Z ==> Vertex 2 {m}", + " 17.24200,0.000000,2.438400, !- X,Y,Z ==> Vertex 3 {m}", + " 17.24200,5.389000,4.683800; !- X,Y,Z ==> Vertex 4 {m}", + + " BuildingSurface:Detailed,", + " NorthRoof2, !- Name", + " ROOF, !- Surface Type", + " ROOF, !- Construction Name", + " ATTIC ZONE, !- Zone Name", + " , !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.9, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 13.782,7.3172,3.8804, !- X,Y,Z ==> Vertex 1 {m}", + " 10.332,10.778,2.4384, !- X,Y,Z ==> Vertex 2 {m}", + " 0.0,10.778,2.4384, !- X,Y,Z ==> Vertex 3 {m}", + " 0.0,7.3172,3.8804; !- X,Y,Z ==> Vertex 4 {m}", + + " BuildingSurface:Detailed,", + " NorthRoof3, !- Name", + " ROOF, !- Surface Type", + " ROOF, !- Construction Name", + " ATTIC ZONE, !- Zone Name", + " , !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.9, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 17.242,5.389,4.6838, !- X,Y,Z ==> Vertex 1 {m}", + " 17.242,7.3172,3.8804, !- X,Y,Z ==> Vertex 2 {m}", + " 13.782,7.3172,3.8804, !- X,Y,Z ==> Vertex 3 {m}", + " 13.782,5.389,4.6838; !- X,Y,Z ==> Vertex 4 {m}", + + " BuildingSurface:Detailed,", + " NorthRoof4, !- Name", + " ROOF, !- Surface Type", + " ROOF, !- Construction Name", + " ATTIC ZONE, !- Zone Name", + " , !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.9, !- View Factor to Ground", + " 3, !- Number of Vertices", + " 17.242,7.3172,3.8804, !- X,Y,Z ==> Vertex 1 {m}", + " 17.242,10.778,2.4384, !- X,Y,Z ==> Vertex 2 {m}", + " 13.782,7.3172,3.8804; !- X,Y,Z ==> Vertex 3 {m}", + + " BuildingSurface:Detailed,", + " EastGable, !- Name", + " WALL, !- Surface Type", + " GABLE, !- Construction Name", + " ATTIC ZONE, !- Zone Name", + " , !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.5, !- View Factor to Ground", + " 3, !- Number of Vertices", + " 17.242,5.389,4.6838, !- X,Y,Z ==> Vertex 1 {m}", + " 17.242,0.0,2.4384, !- X,Y,Z ==> Vertex 2 {m}", + " 17.242,10.778,2.4384; !- X,Y,Z ==> Vertex 3 {m}", + + " BuildingSurface:Detailed,", + " WestGable, !- Name", + " WALL, !- Surface Type", + " GABLE, !- Construction Name", + " ATTIC ZONE, !- Zone Name", + " , !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.5, !- View Factor to Ground", + " 3, !- Number of Vertices", + " 0.0,5.389,4.6838, !- X,Y,Z ==> Vertex 1 {m}", + " 0.0,10.778,2.4384, !- X,Y,Z ==> Vertex 2 {m}", + " 0.0,0.0,2.4384; !- X,Y,Z ==> Vertex 3 {m}", + + " BuildingSurface:Detailed,", + " EastRoof, !- Name", + " ROOF, !- Surface Type", + " ROOF, !- Construction Name", + " ATTIC ZONE, !- Zone Name", + " , !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.9, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 13.782,16.876,3.8804, !- X,Y,Z ==> Vertex 1 {m}", + " 13.782,7.3172,3.8804, !- X,Y,Z ==> Vertex 2 {m}", + " 17.242,10.778,2.4384, !- X,Y,Z ==> Vertex 3 {m}", + " 17.242,16.876,2.4384; !- X,Y,Z ==> Vertex 4 {m}", + + " BuildingSurface:Detailed,", + " WestRoof, !- Name", + " ROOF, !- Surface Type", + " ROOF, !- Construction Name", + " ATTIC ZONE, !- Zone Name", + " , !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.9, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 10.323,16.876,2.4384, !- X,Y,Z ==> Vertex 1 {m}", + " 10.323,10.778,2.4384, !- X,Y,Z ==> Vertex 2 {m}", + " 13.782,7.3172,3.8804, !- X,Y,Z ==> Vertex 3 {m}", + " 13.782,16.876,3.8804; !- X,Y,Z ==> Vertex 4 {m}", + + " BuildingSurface:Detailed,", + " NorthGable, !- Name", + " WALL, !- Surface Type", + " GABLE, !- Construction Name", + " ATTIC ZONE, !- Zone Name", + " , !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.5, !- View Factor to Ground", + " 3, !- Number of Vertices", + " 13.782,16.876,3.8804, !- X,Y,Z ==> Vertex 1 {m}", + " 17.242,16.876,2.4384, !- X,Y,Z ==> Vertex 2 {m}", + " 10.323,16.876,2.4384; !- X,Y,Z ==> Vertex 3 {m}", + + " BuildingSurface:Detailed,", + " Garage:EastWall, !- Name", + " WALL, !- Surface Type", + " EXTWALL:GARAGE, !- Construction Name", + " GARAGE ZONE, !- Zone Name", + " , !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.5, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 17.242,10.778,2.4384, !- X,Y,Z ==> Vertex 1 {m}", + " 17.242,10.778,0.0, !- X,Y,Z ==> Vertex 2 {m}", + " 17.242,16.876,0.0, !- X,Y,Z ==> Vertex 3 {m}", + " 17.242,16.876,2.4384; !- X,Y,Z ==> Vertex 4 {m}", + + " BuildingSurface:Detailed,", + " Garage:WestWall, !- Name", + " WALL, !- Surface Type", + " EXTWALL:GARAGE, !- Construction Name", + " GARAGE ZONE, !- Zone Name", + " , !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.5, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 10.323,16.876,2.4384, !- X,Y,Z ==> Vertex 1 {m}", + " 10.323,16.876,0.0, !- X,Y,Z ==> Vertex 2 {m}", + " 10.323,10.778,0.0, !- X,Y,Z ==> Vertex 3 {m}", + " 10.323,10.778,2.4384; !- X,Y,Z ==> Vertex 4 {m}", + + " InternalMass,", + " EVChargingStation, !- Name", + " Garage:SteelDoor, !- Construction Name", + " GARAGE ZONE, !- Zone or ZoneList Name", + " , !- Space Name", + " 88.249272671219; !- Surface Area {m2}", + + " BuildingSurface:Detailed,", + " Garage:FrontDoor, !- Name", + " WALL, !- Surface Type", + " Garage:SteelDoor, !- Construction Name", + " GARAGE ZONE, !- Zone Name", + " , !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.5, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 17.242,16.876,2.4384, !- X,Y,Z ==> Vertex 1 {m}", + " 17.242,16.876,0.0, !- X,Y,Z ==> Vertex 2 {m}", + " 10.323,16.876,0.0, !- X,Y,Z ==> Vertex 3 {m}", + " 10.323,16.876,2.4384; !- X,Y,Z ==> Vertex 4 {m}", + + " BuildingSurface:Detailed,", + " Attic:GarageFloor, !- Name", + " FLOOR, !- Surface Type", + " CEILING:Garage, !- Construction Name", + " ATTIC ZONE, !- Zone Name", + " , !- Space Name", + " Surface, !- Outside Boundary Condition", + " Garage:Ceiling, !- Outside Boundary Condition Object", + " NoSun, !- Sun Exposure", + " NoWind, !- Wind Exposure", + " 0.5, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 10.323,10.778,2.4384, !- X,Y,Z ==> Vertex 1 {m}", + " 10.323,16.876,2.4384, !- X,Y,Z ==> Vertex 2 {m}", + " 17.242,16.876,2.4384, !- X,Y,Z ==> Vertex 3 {m}", + " 17.242,10.778,2.4384; !- X,Y,Z ==> Vertex 4 {m}", + + " BuildingSurface:Detailed,", + " Garage:Ceiling, !- Name", + " CEILING, !- Surface Type", + " CEILING:Garage, !- Construction Name", + " GARAGE ZONE, !- Zone Name", + " , !- Space Name", + " Surface, !- Outside Boundary Condition", + " Attic:GarageFloor, !- Outside Boundary Condition Object", + " NoSun, !- Sun Exposure", + " NoWind, !- Wind Exposure", + " 0.5, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 10.323,16.876,2.4384, !- X,Y,Z ==> Vertex 1 {m}", + " 10.323,10.778,2.4384, !- X,Y,Z ==> Vertex 2 {m}", + " 17.242,10.778,2.4384, !- X,Y,Z ==> Vertex 3 {m}", + " 17.242,16.876,2.4384; !- X,Y,Z ==> Vertex 4 {m}", + + " BuildingSurface:Detailed,", + " Garage:Floor, !- Name", + " FLOOR, !- Surface Type", + " FLOOR:GARAGE, !- Construction Name", + " GARAGE ZONE, !- Zone Name", + " , !- Space Name", + " Surface, !- Outside Boundary Condition", + " Garage:Floor, !- Outside Boundary Condition Object", + " NoSun, !- Sun Exposure", + " NoWind, !- Wind Exposure", + " 0, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 10.323,10.778,0, !- X,Y,Z ==> Vertex 1 {m}", + " 10.323,16.876,0, !- X,Y,Z ==> Vertex 2 {m}", + " 17.242,16.876,0, !- X,Y,Z ==> Vertex 3 {m}", + " 17.242,10.778,0; !- X,Y,Z ==> Vertex 4 {m}", + + " FenestrationSurface:Detailed,", + " AtticSkylight, !- Name", + " Window, !- Surface Type", + " Dbl Clr 3mm/6mm Air, !- Construction Name", + " EastRoof, !- Building Surface Name", + " , !- Outside Boundary Condition Object", + " 0.5000000, !- View Factor to Ground", + " , !- Frame and Divider Name", + " 1.0, !- Multiplier", + " 4, !- Number of Vertices", + " 14.782,16.876,3.8804, !- X,Y,Z ==> Vertex 1 {m}", + " 14.782,7.3172,3.8804, !- X,Y,Z ==> Vertex 2 {m}", + " 15.242,10.778,2.4384, !- X,Y,Z ==> Vertex 3 {m}", + " 15.242,16.876,2.4384; !- X,Y,Z ==> Vertex 4 {m}", + }); + + ASSERT_TRUE(process_idf(idf_objects)); + + GetProjectControlData(*state, ErrorsFound); // read project control data + EXPECT_FALSE(ErrorsFound); // expect no errors + + 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_TRUE(ErrorsFound); // expect errors due to zone with no surfaces + // compare_err_stream( "" ); // just for debugging + + // This tests the space surface first/last values after surfaces are sorted: + // + // Simulation Order: + // All shading surfaces (including mirrored surfaces) + // Shading:Site + // Shading:Building + // Shading:Zone (and variants) + // + // By zone (in the order the zones appear in the idf): + // Walls + // Floors + // Roofs + // Internal Mass + // Doors + // Windows + // TDD_Domes + // + // Special cases: + // TubularDaylightDome is treated as a separate surface type + // TubularDaylightDiffuser is treated as a window subsurface + + // For this test, the order should be + // Simulation Order (1-based): + // GARAGE ZONE: + // 1. Garage:EastWall (wall) + // 2. Garage:WestWall (wall) + // 3. Garage:FrontDoor (wall) + // 4. Garage:Floor (floor) + // 5. Garage:Ceiling (ceiling) + // 6. EVChargingStation (internal mass) + // + // ATTIC ZONE: + // 7. EastGable (wall) + // 8. WestGable (wall) + // 9. NorthGable (wall) + // 10. Attic:GarageFloor (floor) + // 11. NorthRoof1 (roof) + // 12. SouthRoof (roof) + // 13. NorthRoof2 (roof) + // 14. NorthRoof3 (roof) + // 15. NorthRoof4 (roof) + // 16. EastRoof (roof) + // 17. WestRoof (roof) + // 18. AtticSkylight (window) + // 19. TubularDaylightingDome1 (not a window) + + // Simulation Order (1-based): + + // LIVING ZONE - no surfaces + EXPECT_EQ(state->dataHeatBal->space(1).HTSurfaceFirst, -0); + EXPECT_EQ(state->dataHeatBal->space(1).HTSurfaceLast, -1); + EXPECT_EQ(state->dataHeatBal->space(1).OpaqOrIntMassSurfaceFirst, 0); + EXPECT_EQ(state->dataHeatBal->space(1).OpaqOrIntMassSurfaceLast, -1); + EXPECT_EQ(state->dataHeatBal->space(1).WindowSurfaceFirst, 0); + EXPECT_EQ(state->dataHeatBal->space(1).WindowSurfaceLast, -1); + EXPECT_EQ(state->dataHeatBal->space(1).OpaqOrWinSurfaceFirst, 0); + EXPECT_EQ(state->dataHeatBal->space(1).OpaqOrWinSurfaceLast, -1); + + // GARAGE ZONE: + int wallGarageEast = Util::FindItemInList(Util::makeUPPER("Garage:EastWall"), state->dataSurface->Surface); + int wallGarageWest = Util::FindItemInList(Util::makeUPPER("Garage:WestWall"), state->dataSurface->Surface); + int wallGarageFrontDoor = Util::FindItemInList(Util::makeUPPER("Garage:FrontDoor"), state->dataSurface->Surface); + int floorGarageFloor = Util::FindItemInList(Util::makeUPPER("Garage:Floor"), state->dataSurface->Surface); + int ceilingGarageInterior = Util::FindItemInList(Util::makeUPPER("Garage:Ceiling"), state->dataSurface->Surface); + int intmassEVChargingStation = Util::FindItemInList(Util::makeUPPER("EVChargingStation"), state->dataSurface->Surface); + + EXPECT_EQ(wallGarageEast, 1); + EXPECT_EQ(wallGarageWest, 2); + EXPECT_EQ(wallGarageFrontDoor, 3); + EXPECT_EQ(floorGarageFloor, 4); + EXPECT_EQ(ceilingGarageInterior, 5); + EXPECT_EQ(intmassEVChargingStation, 6); + EXPECT_EQ(state->dataHeatBal->space(2).HTSurfaceFirst, wallGarageEast); + EXPECT_EQ(state->dataHeatBal->space(2).HTSurfaceLast, intmassEVChargingStation); + EXPECT_EQ(state->dataHeatBal->space(2).OpaqOrIntMassSurfaceFirst, wallGarageEast); + EXPECT_EQ(state->dataHeatBal->space(2).OpaqOrIntMassSurfaceLast, intmassEVChargingStation); + EXPECT_EQ(state->dataHeatBal->space(2).WindowSurfaceFirst, 0); + EXPECT_EQ(state->dataHeatBal->space(2).WindowSurfaceLast, -1); + EXPECT_EQ(state->dataHeatBal->space(2).OpaqOrWinSurfaceFirst, wallGarageEast); + EXPECT_EQ(state->dataHeatBal->space(2).OpaqOrWinSurfaceLast, intmassEVChargingStation); + + // ATTIC ZONE: + int wallEastGable = Util::FindItemInList(Util::makeUPPER("EastGable"), state->dataSurface->Surface); + int wallWestGable = Util::FindItemInList(Util::makeUPPER("WestGable"), state->dataSurface->Surface); + int wallNorthGable = Util::FindItemInList(Util::makeUPPER("NorthGable"), state->dataSurface->Surface); + int floorAtticGarageFloor = Util::FindItemInList(Util::makeUPPER("Attic:GarageFloor"), state->dataSurface->Surface); + int roofNorthRoof1 = Util::FindItemInList(Util::makeUPPER("NorthRoof1"), state->dataSurface->Surface); + int roofSouthRoof = Util::FindItemInList(Util::makeUPPER("SouthRoof"), state->dataSurface->Surface); + int roofNorthRoof2 = Util::FindItemInList(Util::makeUPPER("NorthRoof2"), state->dataSurface->Surface); + int roofNorthRoof3 = Util::FindItemInList(Util::makeUPPER("NorthRoof3"), state->dataSurface->Surface); + int roofNorthRoof4 = Util::FindItemInList(Util::makeUPPER("NorthRoof4"), state->dataSurface->Surface); + int roofEastRoof = Util::FindItemInList(Util::makeUPPER("EastRoof"), state->dataSurface->Surface); + int roofWestRoof = Util::FindItemInList(Util::makeUPPER("WestRoof"), state->dataSurface->Surface); + int nonwindowTubularDaylightingDome1 = Util::FindItemInList(Util::makeUPPER("TubularDaylightingDome1"), state->dataSurface->Surface); + int windowAtticSkylight = Util::FindItemInList(Util::makeUPPER("AtticSkylight"), state->dataSurface->Surface); + + EXPECT_EQ(wallEastGable, 7); + EXPECT_EQ(wallWestGable, 8); + EXPECT_EQ(wallNorthGable, 9); + EXPECT_EQ(floorAtticGarageFloor, 10); + EXPECT_EQ(roofNorthRoof1, 11); + EXPECT_EQ(roofSouthRoof, 12); + EXPECT_EQ(roofNorthRoof2, 13); + EXPECT_EQ(roofNorthRoof3, 14); + EXPECT_EQ(roofNorthRoof4, 15); + EXPECT_EQ(roofEastRoof, 16); + EXPECT_EQ(roofWestRoof, 17); + EXPECT_EQ(windowAtticSkylight, 18); + EXPECT_EQ(nonwindowTubularDaylightingDome1, 19); + EXPECT_EQ(state->dataHeatBal->space(3).HTSurfaceFirst, wallEastGable); + EXPECT_EQ(state->dataHeatBal->space(3).HTSurfaceLast, nonwindowTubularDaylightingDome1); + EXPECT_EQ(state->dataHeatBal->space(3).OpaqOrIntMassSurfaceFirst, wallEastGable); + EXPECT_EQ(state->dataHeatBal->space(3).OpaqOrIntMassSurfaceLast, roofWestRoof); + EXPECT_EQ(state->dataHeatBal->space(3).WindowSurfaceFirst, windowAtticSkylight); + EXPECT_EQ(state->dataHeatBal->space(3).WindowSurfaceLast, windowAtticSkylight); + EXPECT_EQ(state->dataHeatBal->space(3).OpaqOrWinSurfaceFirst, wallEastGable); + EXPECT_EQ(state->dataHeatBal->space(3).OpaqOrWinSurfaceLast, windowAtticSkylight); + EXPECT_EQ(state->dataHeatBal->space(3).TDDDomeFirst, nonwindowTubularDaylightingDome1); + EXPECT_EQ(state->dataHeatBal->space(3).TDDDomeLast, nonwindowTubularDaylightingDome1); + + // Extend test to check other surface lists + auto &HTSurfaces = state->dataSurface->AllHTSurfaceList; + auto &ExtSolarSurfaces = state->dataSurface->AllExtSolarSurfaceList; + auto &ExtSolAndShadingSurfaces = state->dataSurface->AllExtSolAndShadingSurfaceList; + auto &ShadowPossObstrSurfaces = state->dataSurface->AllShadowPossObstrSurfaceList; + auto &IZSurfaces = state->dataSurface->AllIZSurfaceList; + auto &HTNonWindowSurfaces = state->dataSurface->AllHTNonWindowSurfaceList; + auto &HTWindowSurfaces = state->dataSurface->AllHTWindowSurfaceList; + auto &ExtSolWindowSurfaces = state->dataSurface->AllExtSolWindowSurfaceList; + auto &ExtSolWinWithFrameSurfaces = state->dataSurface->AllExtSolWinWithFrameSurfaceList; + auto &HTKivaSurfaces = state->dataSurface->AllHTKivaSurfaceList; + + int thisSurface = wallEastGable; + EXPECT_TRUE(std::find(HTSurfaces.begin(), HTSurfaces.end(), thisSurface) != HTSurfaces.end()); + EXPECT_TRUE(std::find(ExtSolarSurfaces.begin(), ExtSolarSurfaces.end(), thisSurface) != ExtSolarSurfaces.end()); + EXPECT_TRUE(std::find(ExtSolAndShadingSurfaces.begin(), ExtSolAndShadingSurfaces.end(), thisSurface) != ExtSolAndShadingSurfaces.end()); + EXPECT_TRUE(std::find(ShadowPossObstrSurfaces.begin(), ShadowPossObstrSurfaces.end(), thisSurface) != ShadowPossObstrSurfaces.end()); + EXPECT_FALSE(std::find(IZSurfaces.begin(), IZSurfaces.end(), thisSurface) != IZSurfaces.end()); + EXPECT_TRUE(std::find(HTNonWindowSurfaces.begin(), HTNonWindowSurfaces.end(), thisSurface) != HTNonWindowSurfaces.end()); + EXPECT_FALSE(std::find(HTWindowSurfaces.begin(), HTWindowSurfaces.end(), thisSurface) != HTWindowSurfaces.end()); + EXPECT_FALSE(std::find(ExtSolWindowSurfaces.begin(), ExtSolWindowSurfaces.end(), thisSurface) != ExtSolWindowSurfaces.end()); + EXPECT_FALSE(std::find(ExtSolWinWithFrameSurfaces.begin(), ExtSolWinWithFrameSurfaces.end(), thisSurface) != ExtSolWinWithFrameSurfaces.end()); + EXPECT_FALSE(std::find(HTKivaSurfaces.begin(), HTKivaSurfaces.end(), thisSurface) != HTKivaSurfaces.end()); + + thisSurface = nonwindowTubularDaylightingDome1; + EXPECT_TRUE(std::find(HTSurfaces.begin(), HTSurfaces.end(), thisSurface) != HTSurfaces.end()); + EXPECT_TRUE(std::find(ExtSolarSurfaces.begin(), ExtSolarSurfaces.end(), thisSurface) != ExtSolarSurfaces.end()); + EXPECT_TRUE(std::find(ExtSolAndShadingSurfaces.begin(), ExtSolAndShadingSurfaces.end(), thisSurface) != ExtSolAndShadingSurfaces.end()); + EXPECT_TRUE(std::find(ShadowPossObstrSurfaces.begin(), ShadowPossObstrSurfaces.end(), thisSurface) != ShadowPossObstrSurfaces.end()); + EXPECT_FALSE(std::find(IZSurfaces.begin(), IZSurfaces.end(), thisSurface) != IZSurfaces.end()); + EXPECT_TRUE(std::find(HTNonWindowSurfaces.begin(), HTNonWindowSurfaces.end(), thisSurface) != HTNonWindowSurfaces.end()); + EXPECT_FALSE(std::find(HTWindowSurfaces.begin(), HTWindowSurfaces.end(), thisSurface) != HTWindowSurfaces.end()); + EXPECT_FALSE(std::find(ExtSolWindowSurfaces.begin(), ExtSolWindowSurfaces.end(), thisSurface) != ExtSolWindowSurfaces.end()); + EXPECT_FALSE(std::find(ExtSolWinWithFrameSurfaces.begin(), ExtSolWinWithFrameSurfaces.end(), thisSurface) != ExtSolWinWithFrameSurfaces.end()); + EXPECT_FALSE(std::find(HTKivaSurfaces.begin(), HTKivaSurfaces.end(), thisSurface) != HTKivaSurfaces.end()); +} + +TEST_F(EnergyPlusFixture, GetSurfaceData_SurfaceOrder3) +{ + + // Middle zone, GARAGE ZONE, has no surfaces + + bool ErrorsFound(false); + + std::string const idf_objects = delimited_string({ + " Material,", + " A1 - 1 IN STUCCO, !- Name", + " Smooth, !- Roughness", + " 2.5389841E-02, !- Thickness {m}", + " 0.6918309, !- Conductivity {W/m-K}", + " 1858.142, !- Density {kg/m3}", + " 836.8000, !- Specific Heat {J/kg-K}", + " 0.9000000, !- Thermal Absorptance", + " 0.9200000, !- Solar Absorptance", + " 0.9200000; !- Visible Absorptance", + + " Material,", + " CB11, !- Name", + " MediumRough, !- Roughness", + " 0.2032000, !- Thickness {m}", + " 1.048000, !- Conductivity {W/m-K}", + " 1105.000, !- Density {kg/m3}", + " 837.0000, !- Specific Heat {J/kg-K}", + " 0.9000000, !- Thermal Absorptance", + " 0.2000000, !- Solar Absorptance", + " 0.2000000; !- Visible Absorptance", + + " Material,", + " GP01, !- Name", + " MediumSmooth, !- Roughness", + " 1.2700000E-02, !- Thickness {m}", + " 0.1600000, !- Conductivity {W/m-K}", + " 801.0000, !- Density {kg/m3}", + " 837.0000, !- Specific Heat {J/kg-K}", + " 0.9000000, !- Thermal Absorptance", + " 0.7500000, !- Solar Absorptance", + " 0.7500000; !- Visible Absorptance", + + " Material,", + " IN02, !- Name", + " Rough, !- Roughness", + " 9.0099998E-02, !- Thickness {m}", + " 4.3000001E-02, !- Conductivity {W/m-K}", + " 10.00000, !- Density {kg/m3}", + " 837.0000, !- Specific Heat {J/kg-K}", + " 0.9000000, !- Thermal Absorptance", + " 0.7500000, !- Solar Absorptance", + " 0.7500000; !- Visible Absorptance", + + " Material,", + " IN05, !- Name", + " Rough, !- Roughness", + " 0.2458000, !- Thickness {m}", + " 4.3000001E-02, !- Conductivity {W/m-K}", + " 10.00000, !- Density {kg/m3}", + " 837.0000, !- Specific Heat {J/kg-K}", + " 0.9000000, !- Thermal Absorptance", + " 0.7500000, !- Solar Absorptance", + " 0.7500000; !- Visible Absorptance", + + " Material,", + " PW03, !- Name", + " MediumSmooth, !- Roughness", + " 1.2700000E-02, !- Thickness {m}", + " 0.1150000, !- Conductivity {W/m-K}", + " 545.0000, !- Density {kg/m3}", + " 1213.000, !- Specific Heat {J/kg-K}", + " 0.9000000, !- Thermal Absorptance", + " 0.7800000, !- Solar Absorptance", + " 0.7800000; !- Visible Absorptance", + + " Material,", + " CC03, !- Name", + " MediumRough, !- Roughness", + " 0.1016000, !- Thickness {m}", + " 1.310000, !- Conductivity {W/m-K}", + " 2243.000, !- Density {kg/m3}", + " 837.0000, !- Specific Heat {J/kg-K}", + " 0.9000000, !- Thermal Absorptance", + " 0.6500000, !- Solar Absorptance", + " 0.6500000; !- Visible Absorptance", + + " Material,", + " HF-A3, !- Name", + " Smooth, !- Roughness", + " 1.5000000E-03, !- Thickness {m}", + " 44.96960, !- Conductivity {W/m-K}", + " 7689.000, !- Density {kg/m3}", + " 418.0000, !- Specific Heat {J/kg-K}", + " 0.9000000, !- Thermal Absorptance", + " 0.2000000, !- Solar Absorptance", + " 0.2000000; !- Visible Absorptance", + + " Material:NoMass,", + " AR02, !- Name", + " VeryRough, !- Roughness", + " 7.8000002E-02, !- Thermal Resistance {m2-K/W}", + " 0.9000000, !- Thermal Absorptance", + " 0.7000000, !- Solar Absorptance", + " 0.7000000; !- Visible Absorptance", + + " Material:NoMass,", + " CP02, !- Name", + " Rough, !- Roughness", + " 0.2170000, !- Thermal Resistance {m2-K/W}", + " 0.9000000, !- Thermal Absorptance", + " 0.7500000, !- Solar Absorptance", + " 0.7500000; !- Visible Absorptance", + + " WindowMaterial:Glazing,", + " CLEAR 3MM, !- Name", + " SpectralAverage, !- Optical Data Type", + " , !- Window Glass Spectral Data Set Name", + " 0.003, !- Thickness {m}", + " 0.837, !- Solar Transmittance at Normal Incidence", + " 0.075, !- Front Side Solar Reflectance at Normal Incidence", + " 0.075, !- Back Side Solar Reflectance at Normal Incidence", + " 0.898, !- Visible Transmittance at Normal Incidence", + " 0.081, !- Front Side Visible Reflectance at Normal Incidence", + " 0.081, !- Back Side Visible Reflectance at Normal Incidence", + " 0.0, !- Infrared Transmittance at Normal Incidence", + " 0.84, !- Front Side Infrared Hemispherical Emissivity", + " 0.84, !- Back Side Infrared Hemispherical Emissivity", + " 0.9; !- Conductivity {W/m-K}", + + " WindowMaterial:Gas,", + " AIR 6MM, !- Name", + " AIR, !- Gas Type", + " 0.006; !- Thickness {m}", + + " Construction,", + " EXTWALL:LIVING, !- Name", + " A1 - 1 IN STUCCO, !- Outside Layer", + " CB11, !- Layer 2", + " GP01; !- Layer 3", + + " Construction,", + " INTERIORWall, !- Name", + " GP01, !- Outside Layer", + " IN02, !- Layer 2", + " GP01; !- Layer 3", + + " Construction,", + " FLOOR:GARAGE, !- Name", + " CC03; !- Outside Layer", + + " Construction,", + " FLOOR:LIVING, !- Name", + " CC03, !- Outside Layer", + " CP02; !- Layer 2", + + " Construction,", + " ROOF, !- Name", + " AR02, !- Outside Layer", + " PW03; !- Layer 2", + + " Construction,", + " EXTWALL:GARAGE, !- Name", + " A1 - 1 IN STUCCO, !- Outside Layer", + " CB11; !- Layer 2", + + " Construction,", + " CEILING:LIVING, !- Name", + " IN05, !- Outside Layer", + " GP01; !- Layer 2", + + " Construction,", + " reverseCEILING:LIVING, !- Name", + " GP01, !- Outside Layer", + " IN05; !- Layer 2", + + " Construction,", + " GABLE, !- Name", + " PW03; !- Outside Layer", + + " Construction,", + " Dbl Clr 3mm/6mm Air, !- Name", + " CLEAR 3MM, !- Outside Layer", + " AIR 6MM, !- Layer 2", + " CLEAR 3MM; !- Layer 3", + + " Construction,", + " Garage:SteelDoor, !- Name", + " HF-A3; !- Outside Layer", + + " Construction,", + " CEILING:Garage, !- Name", + " GP01; !- Outside Layer", + + " Zone,", + " LIVING ZONE; !- Name", + + " Zone,", + " GARAGE ZONE; !- Name", + + " Zone,", + " ATTIC ZONE; !- Name", + + " GlobalGeometryRules,", + " UpperLeftCorner, !- Starting Vertex Position", + " CounterClockWise, !- Vertex Entry Direction", + " World; !- Coordinate System", + + " WindowMaterial:Glazing,", + " Clear Acrylic Plastic, !- Name", + " SpectralAverage, !- Optical Data Type", + " , !- Window Glass Spectral Data Set Name", + " 0.003, !- Thickness {m}", + " 0.92, !- Solar Transmittance at Normal Incidence", + " 0.05, !- Front Side Solar Reflectance at Normal Incidence", + " 0.05, !- Back Side Solar Reflectance at Normal Incidence", + " 0.92, !- Visible Transmittance at Normal Incidence", + " 0.05, !- Front Side Visible Reflectance at Normal Incidence", + " 0.05, !- Back Side Visible Reflectance at Normal Incidence", + " 0.00, !- Infrared Transmittance at Normal Incidence", + " 0.90, !- Front Side Infrared Hemispherical Emissivity", + " 0.90, !- Back Side Infrared Hemispherical Emissivity", + " 0.90; !- Conductivity {W/m-K}", + + " WindowMaterial:Glazing,", + " Diffusing Acrylic Plastic, !- Name", + " SpectralAverage, !- Optical Data Type", + " , !- Window Glass Spectral Data Set Name", + " 0.0022, !- Thickness {m}", + " 0.90, !- Solar Transmittance at Normal Incidence", + " 0.08, !- Front Side Solar Reflectance at Normal Incidence", + " 0.08, !- Back Side Solar Reflectance at Normal Incidence", + " 0.90, !- Visible Transmittance at Normal Incidence", + " 0.08, !- Front Side Visible Reflectance at Normal Incidence", + " 0.08, !- Back Side Visible Reflectance at Normal Incidence", + " 0.00, !- Infrared Transmittance at Normal Incidence", + " 0.90, !- Front Side Infrared Hemispherical Emissivity", + " 0.90, !- Back Side Infrared Hemispherical Emissivity", + " 0.90; !- Conductivity {W/m-K}", + "", + " Material,", + " Very High Reflectivity Surface, !- Name", + " Smooth, !- Roughness", + " 0.0005, !- Thickness {m}", + " 237, !- Conductivity {W/m-K}", + " 2702, !- Density {kg/m3}", + " 903, !- Specific Heat {J/kg-K}", + " 0.90, !- Thermal Absorptance", + " 0.05, !- Solar Absorptance", + " 0.05; !- Visible Absorptance", + " Construction,", + " TDD Pipe, !- Name", + " Very High Reflectivity Surface; !- Outside Layer", + "", + " Construction,", + " TDD Dome, !- Name", + " Clear Acrylic Plastic; !- Outside Layer", + "", + " Construction,", + " TDD Diffuser, !- Name", + " Diffusing Acrylic Plastic; !- Outside Layer", + + " DaylightingDevice:Tubular,", + " Pipe1, !- Name", + " TubularDaylightingDome1, !- Dome Name", + " TubularDaylightingDiffuser1, !- Diffuser Name", + " TDD Pipe, !- Construction Name", + " 0.3556, !- Diameter {m}", + " 1.4, !- Total Length {m}", + " 0.28, !- Effective Thermal Resistance {m2-K/W}", + " ATTIC ZONE, !- Transition Zone 1 Name", + " 1.1; !- Transition Zone 1 Length {m}", + + " FenestrationSurface:Detailed,", + " TubularDaylightingDome1, !- Name", + " TubularDaylightDome, !- Surface Type", + " TDD Dome, !- Construction Name", + " NorthRoof1, !- Building Surface Name", + " , !- Outside Boundary Condition Object", + " 0.0, !- View Factor to Ground", + " , !- Frame and Divider Name", + " 1.0, !- Multiplier", + " 4, !- Number of Vertices", + " 13.782,5.389,4.6838, !- X,Y,Z ==> Vertex 1 {m}", + " 13.782,6.3172,3.8804, !- X,Y,Z ==> Vertex 2 {m}", + " 0,6.3172,3.8804, !- X,Y,Z ==> Vertex 3 {m}", + " 0,5.389,4.6838; !- X,Y,Z ==> Vertex 4 {m}", + + " FenestrationSurface:Detailed,", + " TubularDaylightingDiffuser1, !- Name", + " TubularDaylightDiffuser, !- Surface Type", + " TDD Diffuser, !- Construction Name", + " Living:Ceiling, !- Building Surface Name", + " , !- Outside Boundary Condition Object", + " 0.0, !- View Factor to Ground", + " , !- Frame and Divider Name", + " 1.0, !- Multiplier", + " 4, !- Number of Vertices", + " 2.3425,3.1575,2.5, !- X,Y,Z ==> Vertex 1 {m}", + " 2.3425,2.8425,2.5, !- X,Y,Z ==> Vertex 2 {m}", + " 2.6575,2.8425,2.5, !- X,Y,Z ==> Vertex 3 {m}", + " 2.6575,3.1575,2.5; !- X,Y,Z ==> Vertex 4 {m}", + + " BuildingSurface:Detailed,", + " Living:North, !- Name", + " Wall, !- Surface Type", + " EXTWALL:LIVING, !- Construction Name", + " LIVING ZONE, !- Zone Name", + " , !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.5000000, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 10.323,10.778,2.4384, !- X,Y,Z ==> Vertex 1 {m}", + " 10.323,10.778,0, !- X,Y,Z ==> Vertex 2 {m}", + " 0,10.778,0, !- X,Y,Z ==> Vertex 3 {m}", + " 0,10.778,2.4384; !- X,Y,Z ==> Vertex 4 {m}", + + " BuildingSurface:Detailed,", + " Living:East, !- Name", + " Wall, !- Surface Type", + " EXTWALL:LIVING, !- Construction Name", + " LIVING ZONE, !- Zone Name", + " , !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.5000000, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 17.242,0,2.4384, !- X,Y,Z ==> Vertex 1 {m}", + " 17.242,0,0, !- X,Y,Z ==> Vertex 2 {m}", + " 17.242,10.778,0, !- X,Y,Z ==> Vertex 3 {m}", + " 17.242,10.778,2.4384; !- X,Y,Z ==> Vertex 4 {m}", + + " BuildingSurface:Detailed,", + " Living:South, !- Name", + " Wall, !- Surface Type", + " EXTWALL:LIVING, !- Construction Name", + " LIVING ZONE, !- Zone Name", + " , !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.5000000, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 0,0,2.4383, !- X,Y,Z ==> Vertex 1 {m}", + " 0,0,0, !- X,Y,Z ==> Vertex 2 {m}", + " 17.242,0,0, !- X,Y,Z ==> Vertex 3 {m}", + " 17.242,0,2.4384; !- X,Y,Z ==> Vertex 4 {m}", + + " BuildingSurface:Detailed,", + " Living:West, !- Name", + " Wall, !- Surface Type", + " EXTWALL:LIVING, !- Construction Name", + " LIVING ZONE, !- Zone Name", + " , !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.5000000, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 0,10.778,2.4384, !- X,Y,Z ==> Vertex 1 {m}", + " 0,10.778,0, !- X,Y,Z ==> Vertex 2 {m}", + " 0,0,0, !- X,Y,Z ==> Vertex 3 {m}", + " 0,0,2.4384; !- X,Y,Z ==> Vertex 4 {m}", + + " BuildingSurface:Detailed,", + " Living:Floor, !- Name", + " FLOOR, !- Surface Type", + " FLOOR:LIVING, !- Construction Name", + " LIVING ZONE, !- Zone Name", + " , !- Space Name", + " Surface, !- Outside Boundary Condition", + " Living:Floor, !- Outside Boundary Condition Object", + " NoSun, !- Sun Exposure", + " NoWind, !- Wind Exposure", + " 0, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 0,0,0, !- X,Y,Z ==> Vertex 1 {m}", + " 0,10.778,0, !- X,Y,Z ==> Vertex 2 {m}", + " 17.242,10.778,0, !- X,Y,Z ==> Vertex 3 {m}", + " 17.242,0,0; !- X,Y,Z ==> Vertex 4 {m}", + + " BuildingSurface:Detailed,", + " Living:Ceiling, !- Name", + " CEILING, !- Surface Type", + " CEILING:LIVING, !- Construction Name", + " LIVING ZONE, !- Zone Name", + " , !- Space Name", + " Surface, !- Outside Boundary Condition", + " Attic:LivingFloor, !- Outside Boundary Condition Object", + " NoSun, !- Sun Exposure", + " NoWind, !- Wind Exposure", + " 0, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 0,10.778,2.4384, !- X,Y,Z ==> Vertex 1 {m}", + " 0,0,2.4384, !- X,Y,Z ==> Vertex 2 {m}", + " 17.242,0,2.4384, !- X,Y,Z ==> Vertex 3 {m}", + " 17.242,10.778,2.4384; !- X,Y,Z ==> Vertex 4 {m}", + + " BuildingSurface:Detailed,", + " Attic:LivingFloor, !- Name", + " FLOOR, !- Surface Type", + " reverseCEILING:LIVING, !- Construction Name", + " ATTIC ZONE, !- Zone Name", + " , !- Space Name", + " Surface, !- Outside Boundary Condition", + " Living:Ceiling, !- Outside Boundary Condition Object", + " NoSun, !- Sun Exposure", + " NoWind, !- Wind Exposure", + " 0.5000000, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 0,0,2.4384, !- X,Y,Z ==> Vertex 1 {m}", + " 0,10.778,2.4384, !- X,Y,Z ==> Vertex 2 {m}", + " 17.242,10.778,2.4384, !- X,Y,Z ==> Vertex 3 {m}", + " 17.242,0,2.4384; !- X,Y,Z ==> Vertex 4 {m}", + + " BuildingSurface:Detailed,", + " NorthRoof1, !- Name", + " ROOF, !- Surface Type", + " ROOF, !- Construction Name", + " ATTIC ZONE, !- Zone Name", + " , !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.9, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 13.782,5.389,4.6838, !- X,Y,Z ==> Vertex 1 {m}", + " 13.782,7.3172,3.8804, !- X,Y,Z ==> Vertex 2 {m}", + " 0,7.3172,3.8804, !- X,Y,Z ==> Vertex 3 {m}", + " 0,5.389,4.6838; !- X,Y,Z ==> Vertex 4 {m}", + + " BuildingSurface:Detailed,", + " SouthRoof, !- Name", + " ROOF, !- Surface Type", + " ROOF, !- Construction Name", + " ATTIC ZONE, !- Zone Name", + " , !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.5000000, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 0.000000,5.389000,4.683800, !- X,Y,Z ==> Vertex 1 {m}", + " 0.000000,0.000000,2.438400, !- X,Y,Z ==> Vertex 2 {m}", + " 17.24200,0.000000,2.438400, !- X,Y,Z ==> Vertex 3 {m}", + " 17.24200,5.389000,4.683800; !- X,Y,Z ==> Vertex 4 {m}", + + " BuildingSurface:Detailed,", + " NorthRoof2, !- Name", + " ROOF, !- Surface Type", + " ROOF, !- Construction Name", + " ATTIC ZONE, !- Zone Name", + " , !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.9, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 13.782,7.3172,3.8804, !- X,Y,Z ==> Vertex 1 {m}", + " 10.332,10.778,2.4384, !- X,Y,Z ==> Vertex 2 {m}", + " 0.0,10.778,2.4384, !- X,Y,Z ==> Vertex 3 {m}", + " 0.0,7.3172,3.8804; !- X,Y,Z ==> Vertex 4 {m}", + + " BuildingSurface:Detailed,", + " NorthRoof3, !- Name", + " ROOF, !- Surface Type", + " ROOF, !- Construction Name", + " ATTIC ZONE, !- Zone Name", + " , !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.9, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 17.242,5.389,4.6838, !- X,Y,Z ==> Vertex 1 {m}", + " 17.242,7.3172,3.8804, !- X,Y,Z ==> Vertex 2 {m}", + " 13.782,7.3172,3.8804, !- X,Y,Z ==> Vertex 3 {m}", + " 13.782,5.389,4.6838; !- X,Y,Z ==> Vertex 4 {m}", + + " BuildingSurface:Detailed,", + " NorthRoof4, !- Name", + " ROOF, !- Surface Type", + " ROOF, !- Construction Name", + " ATTIC ZONE, !- Zone Name", + " , !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.9, !- View Factor to Ground", + " 3, !- Number of Vertices", + " 17.242,7.3172,3.8804, !- X,Y,Z ==> Vertex 1 {m}", + " 17.242,10.778,2.4384, !- X,Y,Z ==> Vertex 2 {m}", + " 13.782,7.3172,3.8804; !- X,Y,Z ==> Vertex 3 {m}", + + " BuildingSurface:Detailed,", + " EastGable, !- Name", + " WALL, !- Surface Type", + " GABLE, !- Construction Name", + " ATTIC ZONE, !- Zone Name", + " , !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.5, !- View Factor to Ground", + " 3, !- Number of Vertices", + " 17.242,5.389,4.6838, !- X,Y,Z ==> Vertex 1 {m}", + " 17.242,0.0,2.4384, !- X,Y,Z ==> Vertex 2 {m}", + " 17.242,10.778,2.4384; !- X,Y,Z ==> Vertex 3 {m}", + + " BuildingSurface:Detailed,", + " WestGable, !- Name", + " WALL, !- Surface Type", + " GABLE, !- Construction Name", + " ATTIC ZONE, !- Zone Name", + " , !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.5, !- View Factor to Ground", + " 3, !- Number of Vertices", + " 0.0,5.389,4.6838, !- X,Y,Z ==> Vertex 1 {m}", + " 0.0,10.778,2.4384, !- X,Y,Z ==> Vertex 2 {m}", + " 0.0,0.0,2.4384; !- X,Y,Z ==> Vertex 3 {m}", + + " BuildingSurface:Detailed,", + " EastRoof, !- Name", + " ROOF, !- Surface Type", + " ROOF, !- Construction Name", + " ATTIC ZONE, !- Zone Name", + " , !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.9, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 13.782,16.876,3.8804, !- X,Y,Z ==> Vertex 1 {m}", + " 13.782,7.3172,3.8804, !- X,Y,Z ==> Vertex 2 {m}", + " 17.242,10.778,2.4384, !- X,Y,Z ==> Vertex 3 {m}", + " 17.242,16.876,2.4384; !- X,Y,Z ==> Vertex 4 {m}", + + " BuildingSurface:Detailed,", + " WestRoof, !- Name", + " ROOF, !- Surface Type", + " ROOF, !- Construction Name", + " ATTIC ZONE, !- Zone Name", + " , !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.9, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 10.323,16.876,2.4384, !- X,Y,Z ==> Vertex 1 {m}", + " 10.323,10.778,2.4384, !- X,Y,Z ==> Vertex 2 {m}", + " 13.782,7.3172,3.8804, !- X,Y,Z ==> Vertex 3 {m}", + " 13.782,16.876,3.8804; !- X,Y,Z ==> Vertex 4 {m}", + + " BuildingSurface:Detailed,", + " NorthGable, !- Name", + " WALL, !- Surface Type", + " GABLE, !- Construction Name", + " ATTIC ZONE, !- Zone Name", + " , !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.5, !- View Factor to Ground", + " 3, !- Number of Vertices", + " 13.782,16.876,3.8804, !- X,Y,Z ==> Vertex 1 {m}", + " 17.242,16.876,2.4384, !- X,Y,Z ==> Vertex 2 {m}", + " 10.323,16.876,2.4384; !- X,Y,Z ==> Vertex 3 {m}", + + " FenestrationSurface:Detailed,", + " NorthWindow, !- Name", + " Window, !- Surface Type", + " Dbl Clr 3mm/6mm Air, !- Construction Name", + " Living:North, !- Building Surface Name", + " , !- Outside Boundary Condition Object", + " 0.5000000, !- View Factor to Ground", + " , !- Frame and Divider Name", + " 1.0, !- Multiplier", + " 4, !- Number of Vertices", + " 6.572,10.778,2.1336, !- X,Y,Z ==> Vertex 1 {m}", + " 6.572,10.778,0.6096, !- X,Y,Z ==> Vertex 2 {m}", + " 2,10.778,0.6096, !- X,Y,Z ==> Vertex 3 {m}", + " 2,10.778,2.1336; !- X,Y,Z ==> Vertex 4 {m}", + + " FenestrationSurface:Detailed,", + " EastWindow, !- Name", + " Window, !- Surface Type", + " Dbl Clr 3mm/6mm Air, !- Construction Name", + " Living:East, !- Building Surface Name", + " , !- Outside Boundary Condition Object", + " 0.5000000, !- View Factor to Ground", + " , !- Frame and Divider Name", + " 1.0, !- Multiplier", + " 4, !- Number of Vertices", + " 17.242,2,2.1336, !- X,Y,Z ==> Vertex 1 {m}", + " 17.242,2,0.6096, !- X,Y,Z ==> Vertex 2 {m}", + " 17.242,6.572,0.6096, !- X,Y,Z ==> Vertex 3 {m}", + " 17.242,6.572,2.1336; !- X,Y,Z ==> Vertex 4 {m}", + + " FenestrationSurface:Detailed,", + " SouthWindow, !- Name", + " Window, !- Surface Type", + " Dbl Clr 3mm/6mm Air, !- Construction Name", + " Living:South, !- Building Surface Name", + " , !- Outside Boundary Condition Object", + " 0.5000000, !- View Factor to Ground", + " , !- Frame and Divider Name", + " 1.0, !- Multiplier", + " 4, !- Number of Vertices", + " 2,0,2.1336, !- X,Y,Z ==> Vertex 1 {m}", + " 2,0,0.6096, !- X,Y,Z ==> Vertex 2 {m}", + " 6.572,0,0.6096, !- X,Y,Z ==> Vertex 3 {m}", + " 6.572,0,2.1336; !- X,Y,Z ==> Vertex 4 {m}", + + " FenestrationSurface:Detailed,", + " WestWindow, !- Name", + " Window, !- Surface Type", + " Dbl Clr 3mm/6mm Air, !- Construction Name", + " Living:West, !- Building Surface Name", + " , !- Outside Boundary Condition Object", + " 0.5000000, !- View Factor to Ground", + " , !- Frame and Divider Name", + " 1.0, !- Multiplier", + " 4, !- Number of Vertices", + " 0,6.572,2.1336, !- X,Y,Z ==> Vertex 1 {m}", + " 0,6.572,0.6096, !- X,Y,Z ==> Vertex 2 {m}", + " 0,2,0.6096, !- X,Y,Z ==> Vertex 3 {m}", + " 0,2,2.1336; !- X,Y,Z ==> Vertex 4 {m}", + + " FenestrationSurface:Detailed,", + " WestDoor, !- Name", + " Door, !- Surface Type", + " Garage:SteelDoor, !- Construction Name", + " Living:West, !- Building Surface Name", + " , !- Outside Boundary Condition Object", + " 0.5000000, !- View Factor to Ground", + " , !- Frame and Divider Name", + " 1.0, !- Multiplier", + " 4, !- Number of Vertices", + " 0,9.0,2.0, !- X,Y,Z ==> Vertex 1 {m}", + " 0,9.0,0.0, !- X,Y,Z ==> Vertex 2 {m}", + " 0,8.0,0.0, !- X,Y,Z ==> Vertex 3 {m}", + " 0,8.0,2.0; !- X,Y,Z ==> Vertex 4 {m}", + + " FenestrationSurface:Detailed,", + " AtticSkylight, !- Name", + " Window, !- Surface Type", + " Dbl Clr 3mm/6mm Air, !- Construction Name", + " EastRoof, !- Building Surface Name", + " , !- Outside Boundary Condition Object", + " 0.5000000, !- View Factor to Ground", + " , !- Frame and Divider Name", + " 1.0, !- Multiplier", + " 4, !- Number of Vertices", + " 14.782,16.876,3.8804, !- X,Y,Z ==> Vertex 1 {m}", + " 14.782,7.3172,3.8804, !- X,Y,Z ==> Vertex 2 {m}", + " 15.242,10.778,2.4384, !- X,Y,Z ==> Vertex 3 {m}", + " 15.242,16.876,2.4384; !- X,Y,Z ==> Vertex 4 {m}", + + }); + + ASSERT_TRUE(process_idf(idf_objects)); + + GetProjectControlData(*state, ErrorsFound); // read project control data + EXPECT_FALSE(ErrorsFound); // expect no errors + + 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_TRUE(ErrorsFound); // expect errors due to zone with no surfaces + // compare_err_stream( "" ); // just for debugging + + // This tests the space surface first/last values after surfaces are sorted: + // + // Simulation Order: + // All shading surfaces (including mirrored surfaces) + // Shading:Site + // Shading:Building + // Shading:Zone (and variants) + // + // By zone (in the order the zones appear in the idf): + // Walls + // Floors + // Roofs + // Internal Mass + // Doors + // Windows + // TDD_Domes + // + // Special cases: + // TubularDaylightDome is treated as a separate surface type + // TubularDaylightDiffuser is treated as a window subsurface + + // For this test, the order should be + // Simulation Order (1-based): + // LIVING ZONE: + // 1. Living:North (wall) + // 2. Living:East (wall) + // 3. Living:South (wall) + // 4. Living:West (wall) + // 5. Living:Ceiling (ceiling) + // 6. Living:Floor (floor) + // 7. WestDoor (door) + // 8. NorthWindow (window) + // 9. EastWindow (window) + // 10. SouthWindow (window) + // 11. WestWindow (window) + // 12. TubularDaylightingDiffuser1 ("window") + // + // ATTIC ZONE: + // 13. EastGable (wall) + // 14. WestGable (wall) + // 15. NorthGable (wall) + // 16. Attic:LivingFloor (floor) + // 17. NorthRoof1 (roof) + // 18. SouthRoof (roof) + // 19. NorthRoof2 (roof) + // 20. NorthRoof3 (roof) + // 21. NorthRoof4 (roof) + // 22. EastRoof (roof) + // 23. WestRoof (roof) + // 24. AtticSkylight (window) + // 25. TubularDaylightingDome1 (not a window) + + // Simulation Order (1-based): + + // LIVING ZONE: + int wallLivingNorth = Util::FindItemInList(Util::makeUPPER("Living:North"), state->dataSurface->Surface); + int wallLivingEast = Util::FindItemInList(Util::makeUPPER("Living:East"), state->dataSurface->Surface); + int wallLivingSouth = Util::FindItemInList(Util::makeUPPER("Living:South"), state->dataSurface->Surface); + int wallLivingWest = Util::FindItemInList(Util::makeUPPER("Living:West"), state->dataSurface->Surface); + int wallLivingInterior = Util::FindItemInList(Util::makeUPPER("Living:Interior"), state->dataSurface->Surface); + int floorLivingFloor = Util::FindItemInList(Util::makeUPPER("Living:Floor"), state->dataSurface->Surface); + int ceilingLivingCeiling = Util::FindItemInList(Util::makeUPPER("Living:Ceiling"), state->dataSurface->Surface); + int doorWestDoor = Util::FindItemInList(Util::makeUPPER("WestDoor"), state->dataSurface->Surface); + int windowTubularDaylightingDiffuser1 = Util::FindItemInList(Util::makeUPPER("TubularDaylightingDiffuser1"), state->dataSurface->Surface); + int windowNorthWindow = Util::FindItemInList(Util::makeUPPER("NorthWindow"), state->dataSurface->Surface); + int windowEastWindow = Util::FindItemInList(Util::makeUPPER("EastWindow"), state->dataSurface->Surface); + int windowSouthWindow = Util::FindItemInList(Util::makeUPPER("SouthWindow"), state->dataSurface->Surface); + int windowWestWindow = Util::FindItemInList(Util::makeUPPER("WestWindow"), state->dataSurface->Surface); + + EXPECT_EQ(wallLivingNorth, 1); + EXPECT_EQ(wallLivingEast, 2); + EXPECT_EQ(wallLivingSouth, 3); + EXPECT_EQ(wallLivingWest, 4); + EXPECT_EQ(floorLivingFloor, 5); + EXPECT_EQ(ceilingLivingCeiling, 6); + EXPECT_EQ(doorWestDoor, 7); + EXPECT_EQ(windowNorthWindow, 8); + EXPECT_EQ(windowEastWindow, 9); + EXPECT_EQ(windowSouthWindow, 10); + EXPECT_EQ(windowWestWindow, 11); + EXPECT_EQ(windowTubularDaylightingDiffuser1, 12); + EXPECT_EQ(state->dataHeatBal->space(1).HTSurfaceFirst, 1); + EXPECT_EQ(state->dataHeatBal->space(1).HTSurfaceLast, 12); + EXPECT_EQ(state->dataHeatBal->space(1).OpaqOrIntMassSurfaceFirst, 1); + EXPECT_EQ(state->dataHeatBal->space(1).OpaqOrIntMassSurfaceLast, 7); + EXPECT_EQ(state->dataHeatBal->space(1).WindowSurfaceFirst, 8); + EXPECT_EQ(state->dataHeatBal->space(1).WindowSurfaceLast, 12); + EXPECT_EQ(state->dataHeatBal->space(1).OpaqOrWinSurfaceFirst, 1); + EXPECT_EQ(state->dataHeatBal->space(1).OpaqOrWinSurfaceLast, 12); + + // ATTIC ZONE: + int wallEastGable = Util::FindItemInList(Util::makeUPPER("EastGable"), state->dataSurface->Surface); + int wallWestGable = Util::FindItemInList(Util::makeUPPER("WestGable"), state->dataSurface->Surface); + int wallNorthGable = Util::FindItemInList(Util::makeUPPER("NorthGable"), state->dataSurface->Surface); + int floorAtticLivingFloor = Util::FindItemInList(Util::makeUPPER("Attic:LivingFloor"), state->dataSurface->Surface); + int floorAtticGarageFloor = Util::FindItemInList(Util::makeUPPER("Attic:GarageFloor"), state->dataSurface->Surface); + int roofNorthRoof1 = Util::FindItemInList(Util::makeUPPER("NorthRoof1"), state->dataSurface->Surface); + int roofSouthRoof = Util::FindItemInList(Util::makeUPPER("SouthRoof"), state->dataSurface->Surface); + int roofNorthRoof2 = Util::FindItemInList(Util::makeUPPER("NorthRoof2"), state->dataSurface->Surface); + int roofNorthRoof3 = Util::FindItemInList(Util::makeUPPER("NorthRoof3"), state->dataSurface->Surface); + int roofNorthRoof4 = Util::FindItemInList(Util::makeUPPER("NorthRoof4"), state->dataSurface->Surface); + int roofEastRoof = Util::FindItemInList(Util::makeUPPER("EastRoof"), state->dataSurface->Surface); + int roofWestRoof = Util::FindItemInList(Util::makeUPPER("WestRoof"), state->dataSurface->Surface); + int nonwindowTubularDaylightingDome1 = Util::FindItemInList(Util::makeUPPER("TubularDaylightingDome1"), state->dataSurface->Surface); + int windowAtticSkylight = Util::FindItemInList(Util::makeUPPER("AtticSkylight"), state->dataSurface->Surface); + + EXPECT_EQ(wallEastGable, 13); + EXPECT_EQ(wallWestGable, 14); + EXPECT_EQ(wallNorthGable, 15); + EXPECT_EQ(floorAtticLivingFloor, 16); + EXPECT_EQ(roofNorthRoof1, 17); + EXPECT_EQ(roofSouthRoof, 18); + EXPECT_EQ(roofNorthRoof2, 19); + EXPECT_EQ(roofNorthRoof3, 20); + EXPECT_EQ(roofNorthRoof4, 21); + EXPECT_EQ(roofEastRoof, 22); + EXPECT_EQ(roofWestRoof, 23); + EXPECT_EQ(windowAtticSkylight, 24); + EXPECT_EQ(nonwindowTubularDaylightingDome1, 25); + EXPECT_EQ(state->dataHeatBal->space(3).HTSurfaceFirst, wallEastGable); + EXPECT_EQ(state->dataHeatBal->space(3).HTSurfaceLast, nonwindowTubularDaylightingDome1); + EXPECT_EQ(state->dataHeatBal->space(3).OpaqOrIntMassSurfaceFirst, wallEastGable); + EXPECT_EQ(state->dataHeatBal->space(3).OpaqOrIntMassSurfaceLast, roofWestRoof); + EXPECT_EQ(state->dataHeatBal->space(3).WindowSurfaceFirst, windowAtticSkylight); + EXPECT_EQ(state->dataHeatBal->space(3).WindowSurfaceLast, windowAtticSkylight); + EXPECT_EQ(state->dataHeatBal->space(3).OpaqOrWinSurfaceFirst, wallEastGable); + EXPECT_EQ(state->dataHeatBal->space(3).OpaqOrWinSurfaceLast, windowAtticSkylight); + EXPECT_EQ(state->dataHeatBal->space(3).TDDDomeFirst, nonwindowTubularDaylightingDome1); + EXPECT_EQ(state->dataHeatBal->space(3).TDDDomeLast, nonwindowTubularDaylightingDome1); + + // Extend test to check other surface lists + auto &HTSurfaces = state->dataSurface->AllHTSurfaceList; + auto &ExtSolarSurfaces = state->dataSurface->AllExtSolarSurfaceList; + auto &ExtSolAndShadingSurfaces = state->dataSurface->AllExtSolAndShadingSurfaceList; + auto &ShadowPossObstrSurfaces = state->dataSurface->AllShadowPossObstrSurfaceList; + auto &IZSurfaces = state->dataSurface->AllIZSurfaceList; + auto &HTNonWindowSurfaces = state->dataSurface->AllHTNonWindowSurfaceList; + auto &HTWindowSurfaces = state->dataSurface->AllHTWindowSurfaceList; + auto &ExtSolWindowSurfaces = state->dataSurface->AllExtSolWindowSurfaceList; + auto &ExtSolWinWithFrameSurfaces = state->dataSurface->AllExtSolWinWithFrameSurfaceList; + auto &HTKivaSurfaces = state->dataSurface->AllHTKivaSurfaceList; + + int thisSurface = wallEastGable; + EXPECT_TRUE(std::find(HTSurfaces.begin(), HTSurfaces.end(), thisSurface) != HTSurfaces.end()); + EXPECT_TRUE(std::find(ExtSolarSurfaces.begin(), ExtSolarSurfaces.end(), thisSurface) != ExtSolarSurfaces.end()); + EXPECT_TRUE(std::find(ExtSolAndShadingSurfaces.begin(), ExtSolAndShadingSurfaces.end(), thisSurface) != ExtSolAndShadingSurfaces.end()); + EXPECT_TRUE(std::find(ShadowPossObstrSurfaces.begin(), ShadowPossObstrSurfaces.end(), thisSurface) != ShadowPossObstrSurfaces.end()); + EXPECT_FALSE(std::find(IZSurfaces.begin(), IZSurfaces.end(), thisSurface) != IZSurfaces.end()); + EXPECT_TRUE(std::find(HTNonWindowSurfaces.begin(), HTNonWindowSurfaces.end(), thisSurface) != HTNonWindowSurfaces.end()); + EXPECT_FALSE(std::find(HTWindowSurfaces.begin(), HTWindowSurfaces.end(), thisSurface) != HTWindowSurfaces.end()); + EXPECT_FALSE(std::find(ExtSolWindowSurfaces.begin(), ExtSolWindowSurfaces.end(), thisSurface) != ExtSolWindowSurfaces.end()); + EXPECT_FALSE(std::find(ExtSolWinWithFrameSurfaces.begin(), ExtSolWinWithFrameSurfaces.end(), thisSurface) != ExtSolWinWithFrameSurfaces.end()); + EXPECT_FALSE(std::find(HTKivaSurfaces.begin(), HTKivaSurfaces.end(), thisSurface) != HTKivaSurfaces.end()); + + thisSurface = doorWestDoor; + EXPECT_TRUE(std::find(HTSurfaces.begin(), HTSurfaces.end(), thisSurface) != HTSurfaces.end()); + EXPECT_TRUE(std::find(ExtSolarSurfaces.begin(), ExtSolarSurfaces.end(), thisSurface) != ExtSolarSurfaces.end()); + EXPECT_TRUE(std::find(ExtSolAndShadingSurfaces.begin(), ExtSolAndShadingSurfaces.end(), thisSurface) != ExtSolAndShadingSurfaces.end()); + EXPECT_FALSE(std::find(ShadowPossObstrSurfaces.begin(), ShadowPossObstrSurfaces.end(), thisSurface) != ShadowPossObstrSurfaces.end()); + EXPECT_FALSE(std::find(IZSurfaces.begin(), IZSurfaces.end(), thisSurface) != IZSurfaces.end()); + EXPECT_TRUE(std::find(HTNonWindowSurfaces.begin(), HTNonWindowSurfaces.end(), thisSurface) != HTNonWindowSurfaces.end()); + EXPECT_FALSE(std::find(HTWindowSurfaces.begin(), HTWindowSurfaces.end(), thisSurface) != HTWindowSurfaces.end()); + EXPECT_FALSE(std::find(ExtSolWindowSurfaces.begin(), ExtSolWindowSurfaces.end(), thisSurface) != ExtSolWindowSurfaces.end()); + EXPECT_FALSE(std::find(ExtSolWinWithFrameSurfaces.begin(), ExtSolWinWithFrameSurfaces.end(), thisSurface) != ExtSolWinWithFrameSurfaces.end()); + EXPECT_FALSE(std::find(HTKivaSurfaces.begin(), HTKivaSurfaces.end(), thisSurface) != HTKivaSurfaces.end()); + + thisSurface = windowSouthWindow; + EXPECT_TRUE(std::find(HTSurfaces.begin(), HTSurfaces.end(), thisSurface) != HTSurfaces.end()); + EXPECT_TRUE(std::find(ExtSolarSurfaces.begin(), ExtSolarSurfaces.end(), thisSurface) != ExtSolarSurfaces.end()); + EXPECT_TRUE(std::find(ExtSolAndShadingSurfaces.begin(), ExtSolAndShadingSurfaces.end(), thisSurface) != ExtSolAndShadingSurfaces.end()); + EXPECT_FALSE(std::find(ShadowPossObstrSurfaces.begin(), ShadowPossObstrSurfaces.end(), thisSurface) != ShadowPossObstrSurfaces.end()); + EXPECT_FALSE(std::find(IZSurfaces.begin(), IZSurfaces.end(), thisSurface) != IZSurfaces.end()); + EXPECT_FALSE(std::find(HTNonWindowSurfaces.begin(), HTNonWindowSurfaces.end(), thisSurface) != HTNonWindowSurfaces.end()); + EXPECT_TRUE(std::find(HTWindowSurfaces.begin(), HTWindowSurfaces.end(), thisSurface) != HTWindowSurfaces.end()); + EXPECT_TRUE(std::find(ExtSolWindowSurfaces.begin(), ExtSolWindowSurfaces.end(), thisSurface) != ExtSolWindowSurfaces.end()); + EXPECT_FALSE(std::find(ExtSolWinWithFrameSurfaces.begin(), ExtSolWinWithFrameSurfaces.end(), thisSurface) != ExtSolWinWithFrameSurfaces.end()); + EXPECT_FALSE(std::find(HTKivaSurfaces.begin(), HTKivaSurfaces.end(), thisSurface) != HTKivaSurfaces.end()); + + thisSurface = windowTubularDaylightingDiffuser1; + EXPECT_TRUE(std::find(HTSurfaces.begin(), HTSurfaces.end(), thisSurface) != HTSurfaces.end()); + EXPECT_FALSE(std::find(ExtSolarSurfaces.begin(), ExtSolarSurfaces.end(), thisSurface) != ExtSolarSurfaces.end()); + EXPECT_FALSE(std::find(ExtSolAndShadingSurfaces.begin(), ExtSolAndShadingSurfaces.end(), thisSurface) != ExtSolAndShadingSurfaces.end()); + EXPECT_FALSE(std::find(ShadowPossObstrSurfaces.begin(), ShadowPossObstrSurfaces.end(), thisSurface) != ShadowPossObstrSurfaces.end()); + EXPECT_FALSE(std::find(IZSurfaces.begin(), IZSurfaces.end(), thisSurface) != IZSurfaces.end()); + EXPECT_FALSE(std::find(HTNonWindowSurfaces.begin(), HTNonWindowSurfaces.end(), thisSurface) != HTNonWindowSurfaces.end()); + EXPECT_TRUE(std::find(HTWindowSurfaces.begin(), HTWindowSurfaces.end(), thisSurface) != HTWindowSurfaces.end()); + EXPECT_FALSE(std::find(ExtSolWindowSurfaces.begin(), ExtSolWindowSurfaces.end(), thisSurface) != ExtSolWindowSurfaces.end()); + EXPECT_FALSE(std::find(ExtSolWinWithFrameSurfaces.begin(), ExtSolWinWithFrameSurfaces.end(), thisSurface) != ExtSolWinWithFrameSurfaces.end()); + EXPECT_FALSE(std::find(HTKivaSurfaces.begin(), HTKivaSurfaces.end(), thisSurface) != HTKivaSurfaces.end()); + + thisSurface = nonwindowTubularDaylightingDome1; + EXPECT_TRUE(std::find(HTSurfaces.begin(), HTSurfaces.end(), thisSurface) != HTSurfaces.end()); + EXPECT_TRUE(std::find(ExtSolarSurfaces.begin(), ExtSolarSurfaces.end(), thisSurface) != ExtSolarSurfaces.end()); + EXPECT_TRUE(std::find(ExtSolAndShadingSurfaces.begin(), ExtSolAndShadingSurfaces.end(), thisSurface) != ExtSolAndShadingSurfaces.end()); + EXPECT_TRUE(std::find(ShadowPossObstrSurfaces.begin(), ShadowPossObstrSurfaces.end(), thisSurface) != ShadowPossObstrSurfaces.end()); + EXPECT_FALSE(std::find(IZSurfaces.begin(), IZSurfaces.end(), thisSurface) != IZSurfaces.end()); + EXPECT_TRUE(std::find(HTNonWindowSurfaces.begin(), HTNonWindowSurfaces.end(), thisSurface) != HTNonWindowSurfaces.end()); + EXPECT_FALSE(std::find(HTWindowSurfaces.begin(), HTWindowSurfaces.end(), thisSurface) != HTWindowSurfaces.end()); + EXPECT_FALSE(std::find(ExtSolWindowSurfaces.begin(), ExtSolWindowSurfaces.end(), thisSurface) != ExtSolWindowSurfaces.end()); + EXPECT_FALSE(std::find(ExtSolWinWithFrameSurfaces.begin(), ExtSolWinWithFrameSurfaces.end(), thisSurface) != ExtSolWinWithFrameSurfaces.end()); + EXPECT_FALSE(std::find(HTKivaSurfaces.begin(), HTKivaSurfaces.end(), thisSurface) != HTKivaSurfaces.end()); +} + +TEST_F(EnergyPlusFixture, GetSurfaceData_SurfaceOrder4) +{ + + // Last zone, ATTIC ZONE, has no surfaces + + bool ErrorsFound(false); + + std::string const idf_objects = delimited_string({ + " Material,", + " A1 - 1 IN STUCCO, !- Name", + " Smooth, !- Roughness", + " 2.5389841E-02, !- Thickness {m}", + " 0.6918309, !- Conductivity {W/m-K}", + " 1858.142, !- Density {kg/m3}", + " 836.8000, !- Specific Heat {J/kg-K}", + " 0.9000000, !- Thermal Absorptance", + " 0.9200000, !- Solar Absorptance", + " 0.9200000; !- Visible Absorptance", + + " Material,", + " CB11, !- Name", + " MediumRough, !- Roughness", + " 0.2032000, !- Thickness {m}", + " 1.048000, !- Conductivity {W/m-K}", + " 1105.000, !- Density {kg/m3}", + " 837.0000, !- Specific Heat {J/kg-K}", + " 0.9000000, !- Thermal Absorptance", + " 0.2000000, !- Solar Absorptance", + " 0.2000000; !- Visible Absorptance", + + " Material,", + " GP01, !- Name", + " MediumSmooth, !- Roughness", + " 1.2700000E-02, !- Thickness {m}", + " 0.1600000, !- Conductivity {W/m-K}", + " 801.0000, !- Density {kg/m3}", + " 837.0000, !- Specific Heat {J/kg-K}", + " 0.9000000, !- Thermal Absorptance", + " 0.7500000, !- Solar Absorptance", + " 0.7500000; !- Visible Absorptance", + + " Material,", + " IN02, !- Name", + " Rough, !- Roughness", + " 9.0099998E-02, !- Thickness {m}", + " 4.3000001E-02, !- Conductivity {W/m-K}", + " 10.00000, !- Density {kg/m3}", + " 837.0000, !- Specific Heat {J/kg-K}", + " 0.9000000, !- Thermal Absorptance", + " 0.7500000, !- Solar Absorptance", + " 0.7500000; !- Visible Absorptance", + + " Material,", + " IN05, !- Name", + " Rough, !- Roughness", + " 0.2458000, !- Thickness {m}", + " 4.3000001E-02, !- Conductivity {W/m-K}", + " 10.00000, !- Density {kg/m3}", + " 837.0000, !- Specific Heat {J/kg-K}", + " 0.9000000, !- Thermal Absorptance", + " 0.7500000, !- Solar Absorptance", + " 0.7500000; !- Visible Absorptance", + + " Material,", + " PW03, !- Name", + " MediumSmooth, !- Roughness", + " 1.2700000E-02, !- Thickness {m}", + " 0.1150000, !- Conductivity {W/m-K}", + " 545.0000, !- Density {kg/m3}", + " 1213.000, !- Specific Heat {J/kg-K}", + " 0.9000000, !- Thermal Absorptance", + " 0.7800000, !- Solar Absorptance", + " 0.7800000; !- Visible Absorptance", + + " Material,", + " CC03, !- Name", + " MediumRough, !- Roughness", + " 0.1016000, !- Thickness {m}", + " 1.310000, !- Conductivity {W/m-K}", + " 2243.000, !- Density {kg/m3}", + " 837.0000, !- Specific Heat {J/kg-K}", + " 0.9000000, !- Thermal Absorptance", + " 0.6500000, !- Solar Absorptance", + " 0.6500000; !- Visible Absorptance", + + " Material,", + " HF-A3, !- Name", + " Smooth, !- Roughness", + " 1.5000000E-03, !- Thickness {m}", + " 44.96960, !- Conductivity {W/m-K}", + " 7689.000, !- Density {kg/m3}", + " 418.0000, !- Specific Heat {J/kg-K}", + " 0.9000000, !- Thermal Absorptance", + " 0.2000000, !- Solar Absorptance", + " 0.2000000; !- Visible Absorptance", + + " Material:NoMass,", + " AR02, !- Name", + " VeryRough, !- Roughness", + " 7.8000002E-02, !- Thermal Resistance {m2-K/W}", + " 0.9000000, !- Thermal Absorptance", + " 0.7000000, !- Solar Absorptance", + " 0.7000000; !- Visible Absorptance", + + " Material:NoMass,", + " CP02, !- Name", + " Rough, !- Roughness", + " 0.2170000, !- Thermal Resistance {m2-K/W}", + " 0.9000000, !- Thermal Absorptance", + " 0.7500000, !- Solar Absorptance", + " 0.7500000; !- Visible Absorptance", + + " WindowMaterial:Glazing,", + " CLEAR 3MM, !- Name", + " SpectralAverage, !- Optical Data Type", + " , !- Window Glass Spectral Data Set Name", + " 0.003, !- Thickness {m}", + " 0.837, !- Solar Transmittance at Normal Incidence", + " 0.075, !- Front Side Solar Reflectance at Normal Incidence", + " 0.075, !- Back Side Solar Reflectance at Normal Incidence", + " 0.898, !- Visible Transmittance at Normal Incidence", + " 0.081, !- Front Side Visible Reflectance at Normal Incidence", + " 0.081, !- Back Side Visible Reflectance at Normal Incidence", + " 0.0, !- Infrared Transmittance at Normal Incidence", + " 0.84, !- Front Side Infrared Hemispherical Emissivity", + " 0.84, !- Back Side Infrared Hemispherical Emissivity", + " 0.9; !- Conductivity {W/m-K}", + + " WindowMaterial:Gas,", + " AIR 6MM, !- Name", + " AIR, !- Gas Type", + " 0.006; !- Thickness {m}", + + " Construction,", + " EXTWALL:LIVING, !- Name", + " A1 - 1 IN STUCCO, !- Outside Layer", + " CB11, !- Layer 2", + " GP01; !- Layer 3", + + " Construction,", + " INTERIORWall, !- Name", + " GP01, !- Outside Layer", + " IN02, !- Layer 2", + " GP01; !- Layer 3", + + " Construction,", + " FLOOR:GARAGE, !- Name", + " CC03; !- Outside Layer", + + " Construction,", + " FLOOR:LIVING, !- Name", + " CC03, !- Outside Layer", + " CP02; !- Layer 2", + + " Construction,", + " ROOF, !- Name", + " AR02, !- Outside Layer", + " PW03; !- Layer 2", + + " Construction,", + " EXTWALL:GARAGE, !- Name", + " A1 - 1 IN STUCCO, !- Outside Layer", + " CB11; !- Layer 2", + + " Construction,", + " CEILING:LIVING, !- Name", + " IN05, !- Outside Layer", + " GP01; !- Layer 2", + + " Construction,", + " reverseCEILING:LIVING, !- Name", + " GP01, !- Outside Layer", + " IN05; !- Layer 2", + + " Construction,", + " GABLE, !- Name", + " PW03; !- Outside Layer", + + " Construction,", + " Dbl Clr 3mm/6mm Air, !- Name", + " CLEAR 3MM, !- Outside Layer", + " AIR 6MM, !- Layer 2", + " CLEAR 3MM; !- Layer 3", + + " Construction,", + " Garage:SteelDoor, !- Name", + " HF-A3; !- Outside Layer", + + " Construction,", + " CEILING:Garage, !- Name", + " GP01; !- Outside Layer", + + " Zone,", + " LIVING ZONE; !- Name", + + " Zone,", + " GARAGE ZONE; !- Name", + + " Zone,", + " ATTIC ZONE; !- Name", + + " GlobalGeometryRules,", + " UpperLeftCorner, !- Starting Vertex Position", + " CounterClockWise, !- Vertex Entry Direction", + " World; !- Coordinate System", + + " WindowMaterial:Glazing,", + " Clear Acrylic Plastic, !- Name", + " SpectralAverage, !- Optical Data Type", + " , !- Window Glass Spectral Data Set Name", + " 0.003, !- Thickness {m}", + " 0.92, !- Solar Transmittance at Normal Incidence", + " 0.05, !- Front Side Solar Reflectance at Normal Incidence", + " 0.05, !- Back Side Solar Reflectance at Normal Incidence", + " 0.92, !- Visible Transmittance at Normal Incidence", + " 0.05, !- Front Side Visible Reflectance at Normal Incidence", + " 0.05, !- Back Side Visible Reflectance at Normal Incidence", + " 0.00, !- Infrared Transmittance at Normal Incidence", + " 0.90, !- Front Side Infrared Hemispherical Emissivity", + " 0.90, !- Back Side Infrared Hemispherical Emissivity", + " 0.90; !- Conductivity {W/m-K}", + + " WindowMaterial:Glazing,", + " Diffusing Acrylic Plastic, !- Name", + " SpectralAverage, !- Optical Data Type", + " , !- Window Glass Spectral Data Set Name", + " 0.0022, !- Thickness {m}", + " 0.90, !- Solar Transmittance at Normal Incidence", + " 0.08, !- Front Side Solar Reflectance at Normal Incidence", + " 0.08, !- Back Side Solar Reflectance at Normal Incidence", + " 0.90, !- Visible Transmittance at Normal Incidence", + " 0.08, !- Front Side Visible Reflectance at Normal Incidence", + " 0.08, !- Back Side Visible Reflectance at Normal Incidence", + " 0.00, !- Infrared Transmittance at Normal Incidence", + " 0.90, !- Front Side Infrared Hemispherical Emissivity", + " 0.90, !- Back Side Infrared Hemispherical Emissivity", + " 0.90; !- Conductivity {W/m-K}", + "", + " Material,", + " Very High Reflectivity Surface, !- Name", + " Smooth, !- Roughness", + " 0.0005, !- Thickness {m}", + " 237, !- Conductivity {W/m-K}", + " 2702, !- Density {kg/m3}", + " 903, !- Specific Heat {J/kg-K}", + " 0.90, !- Thermal Absorptance", + " 0.05, !- Solar Absorptance", + " 0.05; !- Visible Absorptance", + " Construction,", + " TDD Pipe, !- Name", + " Very High Reflectivity Surface; !- Outside Layer", + "", + " Construction,", + " TDD Dome, !- Name", + " Clear Acrylic Plastic; !- Outside Layer", + "", + " Construction,", + " TDD Diffuser, !- Name", + " Diffusing Acrylic Plastic; !- Outside Layer", + + " BuildingSurface:Detailed,", + " Living:North, !- Name", + " Wall, !- Surface Type", + " EXTWALL:LIVING, !- Construction Name", + " LIVING ZONE, !- Zone Name", + " , !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.5000000, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 10.323,10.778,2.4384, !- X,Y,Z ==> Vertex 1 {m}", + " 10.323,10.778,0, !- X,Y,Z ==> Vertex 2 {m}", + " 0,10.778,0, !- X,Y,Z ==> Vertex 3 {m}", + " 0,10.778,2.4384; !- X,Y,Z ==> Vertex 4 {m}", + + " BuildingSurface:Detailed,", + " Living:East, !- Name", + " Wall, !- Surface Type", + " EXTWALL:LIVING, !- Construction Name", + " LIVING ZONE, !- Zone Name", + " , !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.5000000, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 17.242,0,2.4384, !- X,Y,Z ==> Vertex 1 {m}", + " 17.242,0,0, !- X,Y,Z ==> Vertex 2 {m}", + " 17.242,10.778,0, !- X,Y,Z ==> Vertex 3 {m}", + " 17.242,10.778,2.4384; !- X,Y,Z ==> Vertex 4 {m}", + + " BuildingSurface:Detailed,", + " Living:South, !- Name", + " Wall, !- Surface Type", + " EXTWALL:LIVING, !- Construction Name", + " LIVING ZONE, !- Zone Name", + " , !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.5000000, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 0,0,2.4383, !- X,Y,Z ==> Vertex 1 {m}", + " 0,0,0, !- X,Y,Z ==> Vertex 2 {m}", + " 17.242,0,0, !- X,Y,Z ==> Vertex 3 {m}", + " 17.242,0,2.4384; !- X,Y,Z ==> Vertex 4 {m}", + + " BuildingSurface:Detailed,", + " Living:West, !- Name", + " Wall, !- Surface Type", + " EXTWALL:LIVING, !- Construction Name", + " LIVING ZONE, !- Zone Name", + " , !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.5000000, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 0,10.778,2.4384, !- X,Y,Z ==> Vertex 1 {m}", + " 0,10.778,0, !- X,Y,Z ==> Vertex 2 {m}", + " 0,0,0, !- X,Y,Z ==> Vertex 3 {m}", + " 0,0,2.4384; !- X,Y,Z ==> Vertex 4 {m}", + + " BuildingSurface:Detailed,", + " Garage:Interior, !- Name", + " WALL, !- Surface Type", + " INTERIORWall, !- Construction Name", + " GARAGE ZONE, !- Zone Name", + " , !- Space Name", + " Surface, !- Outside Boundary Condition", + " Living:Interior, !- Outside Boundary Condition Object", + " NoSun, !- Sun Exposure", + " NoWind, !- Wind Exposure", + " 0.5, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 10.323,10.778,2.4384, !- X,Y,Z ==> Vertex 1 {m}", + " 10.323,10.778,0, !- X,Y,Z ==> Vertex 2 {m}", + " 17.242,10.778,0, !- X,Y,Z ==> Vertex 3 {m}", + " 17.242,10.778,2.4384; !- X,Y,Z ==> Vertex 4 {m}", + + " BuildingSurface:Detailed,", + " Living:Interior, !- Name", + " WALL, !- Surface Type", + " INTERIORWall, !- Construction Name", + " LIVING ZONE, !- Zone Name", + " , !- Space Name", + " Surface, !- Outside Boundary Condition", + " Garage:Interior, !- Outside Boundary Condition Object", + " NoSun, !- Sun Exposure", + " NoWind, !- Wind Exposure", + " 0.5, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 17.242,10.778,2.4384, !- X,Y,Z ==> Vertex 1 {m}", + " 17.242,10.778,0, !- X,Y,Z ==> Vertex 2 {m}", + " 10.323,10.778,0, !- X,Y,Z ==> Vertex 3 {m}", + " 10.323,10.778,2.4384; !- X,Y,Z ==> Vertex 4 {m}", + + " BuildingSurface:Detailed,", + " Living:Floor, !- Name", + " FLOOR, !- Surface Type", + " FLOOR:LIVING, !- Construction Name", + " LIVING ZONE, !- Zone Name", + " , !- Space Name", + " Surface, !- Outside Boundary Condition", + " Living:Floor, !- Outside Boundary Condition Object", + " NoSun, !- Sun Exposure", + " NoWind, !- Wind Exposure", + " 0, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 0,0,0, !- X,Y,Z ==> Vertex 1 {m}", + " 0,10.778,0, !- X,Y,Z ==> Vertex 2 {m}", + " 17.242,10.778,0, !- X,Y,Z ==> Vertex 3 {m}", + " 17.242,0,0; !- X,Y,Z ==> Vertex 4 {m}", + + " BuildingSurface:Detailed,", + " Living:Ceiling, !- Name", + " CEILING, !- Surface Type", + " CEILING:LIVING, !- Construction Name", + " LIVING ZONE, !- Zone Name", + " , !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " NoSun, !- Sun Exposure", + " NoWind, !- Wind Exposure", + " 0, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 0,10.778,2.4384, !- X,Y,Z ==> Vertex 1 {m}", + " 0,0,2.4384, !- X,Y,Z ==> Vertex 2 {m}", + " 17.242,0,2.4384, !- X,Y,Z ==> Vertex 3 {m}", + " 17.242,10.778,2.4384; !- X,Y,Z ==> Vertex 4 {m}", + + " BuildingSurface:Detailed,", + " Garage:EastWall, !- Name", + " WALL, !- Surface Type", + " EXTWALL:GARAGE, !- Construction Name", + " GARAGE ZONE, !- Zone Name", + " , !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.5, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 17.242,10.778,2.4384, !- X,Y,Z ==> Vertex 1 {m}", + " 17.242,10.778,0.0, !- X,Y,Z ==> Vertex 2 {m}", + " 17.242,16.876,0.0, !- X,Y,Z ==> Vertex 3 {m}", + " 17.242,16.876,2.4384; !- X,Y,Z ==> Vertex 4 {m}", + + " BuildingSurface:Detailed,", + " Garage:WestWall, !- Name", + " WALL, !- Surface Type", + " EXTWALL:GARAGE, !- Construction Name", + " GARAGE ZONE, !- Zone Name", + " , !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.5, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 10.323,16.876,2.4384, !- X,Y,Z ==> Vertex 1 {m}", + " 10.323,16.876,0.0, !- X,Y,Z ==> Vertex 2 {m}", + " 10.323,10.778,0.0, !- X,Y,Z ==> Vertex 3 {m}", + " 10.323,10.778,2.4384; !- X,Y,Z ==> Vertex 4 {m}", + + " InternalMass,", + " EVChargingStation, !- Name", + " Garage:SteelDoor, !- Construction Name", + " GARAGE ZONE, !- Zone or ZoneList Name", + " , !- Space Name", + " 88.249272671219; !- Surface Area {m2}", + + " BuildingSurface:Detailed,", + " Garage:FrontDoor, !- Name", + " WALL, !- Surface Type", + " Garage:SteelDoor, !- Construction Name", + " GARAGE ZONE, !- Zone Name", + " , !- Space Name", + " Outdoors, !- Outside Boundary Condition", + " , !- Outside Boundary Condition Object", + " SunExposed, !- Sun Exposure", + " WindExposed, !- Wind Exposure", + " 0.5, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 17.242,16.876,2.4384, !- X,Y,Z ==> Vertex 1 {m}", + " 17.242,16.876,0.0, !- X,Y,Z ==> Vertex 2 {m}", + " 10.323,16.876,0.0, !- X,Y,Z ==> Vertex 3 {m}", + " 10.323,16.876,2.4384; !- X,Y,Z ==> Vertex 4 {m}", + + " BuildingSurface:Detailed,", + " Garage:Floor, !- Name", + " FLOOR, !- Surface Type", + " FLOOR:GARAGE, !- Construction Name", + " GARAGE ZONE, !- Zone Name", + " , !- Space Name", + " Surface, !- Outside Boundary Condition", + " Garage:Floor, !- Outside Boundary Condition Object", + " NoSun, !- Sun Exposure", + " NoWind, !- Wind Exposure", + " 0, !- View Factor to Ground", + " 4, !- Number of Vertices", + " 10.323,10.778,0, !- X,Y,Z ==> Vertex 1 {m}", + " 10.323,16.876,0, !- X,Y,Z ==> Vertex 2 {m}", + " 17.242,16.876,0, !- X,Y,Z ==> Vertex 3 {m}", + " 17.242,10.778,0; !- X,Y,Z ==> Vertex 4 {m}", + + " FenestrationSurface:Detailed,", + " NorthWindow, !- Name", + " Window, !- Surface Type", + " Dbl Clr 3mm/6mm Air, !- Construction Name", + " Living:North, !- Building Surface Name", + " , !- Outside Boundary Condition Object", + " 0.5000000, !- View Factor to Ground", + " , !- Frame and Divider Name", + " 1.0, !- Multiplier", + " 4, !- Number of Vertices", + " 6.572,10.778,2.1336, !- X,Y,Z ==> Vertex 1 {m}", + " 6.572,10.778,0.6096, !- X,Y,Z ==> Vertex 2 {m}", + " 2,10.778,0.6096, !- X,Y,Z ==> Vertex 3 {m}", + " 2,10.778,2.1336; !- X,Y,Z ==> Vertex 4 {m}", + + " FenestrationSurface:Detailed,", + " EastWindow, !- Name", + " Window, !- Surface Type", + " Dbl Clr 3mm/6mm Air, !- Construction Name", + " Living:East, !- Building Surface Name", + " , !- Outside Boundary Condition Object", + " 0.5000000, !- View Factor to Ground", + " , !- Frame and Divider Name", + " 1.0, !- Multiplier", + " 4, !- Number of Vertices", + " 17.242,2,2.1336, !- X,Y,Z ==> Vertex 1 {m}", + " 17.242,2,0.6096, !- X,Y,Z ==> Vertex 2 {m}", + " 17.242,6.572,0.6096, !- X,Y,Z ==> Vertex 3 {m}", + " 17.242,6.572,2.1336; !- X,Y,Z ==> Vertex 4 {m}", + + " FenestrationSurface:Detailed,", + " SouthWindow, !- Name", + " Window, !- Surface Type", + " Dbl Clr 3mm/6mm Air, !- Construction Name", + " Living:South, !- Building Surface Name", + " , !- Outside Boundary Condition Object", + " 0.5000000, !- View Factor to Ground", + " , !- Frame and Divider Name", + " 1.0, !- Multiplier", + " 4, !- Number of Vertices", + " 2,0,2.1336, !- X,Y,Z ==> Vertex 1 {m}", + " 2,0,0.6096, !- X,Y,Z ==> Vertex 2 {m}", + " 6.572,0,0.6096, !- X,Y,Z ==> Vertex 3 {m}", + " 6.572,0,2.1336; !- X,Y,Z ==> Vertex 4 {m}", + + " FenestrationSurface:Detailed,", + " WestWindow, !- Name", + " Window, !- Surface Type", + " Dbl Clr 3mm/6mm Air, !- Construction Name", + " Living:West, !- Building Surface Name", + " , !- Outside Boundary Condition Object", + " 0.5000000, !- View Factor to Ground", + " , !- Frame and Divider Name", + " 1.0, !- Multiplier", + " 4, !- Number of Vertices", + " 0,6.572,2.1336, !- X,Y,Z ==> Vertex 1 {m}", + " 0,6.572,0.6096, !- X,Y,Z ==> Vertex 2 {m}", + " 0,2,0.6096, !- X,Y,Z ==> Vertex 3 {m}", + " 0,2,2.1336; !- X,Y,Z ==> Vertex 4 {m}", + + " FenestrationSurface:Detailed,", + " WestDoor, !- Name", + " Door, !- Surface Type", + " Garage:SteelDoor, !- Construction Name", + " Living:West, !- Building Surface Name", + " , !- Outside Boundary Condition Object", + " 0.5000000, !- View Factor to Ground", + " , !- Frame and Divider Name", + " 1.0, !- Multiplier", + " 4, !- Number of Vertices", + " 0,9.0,2.0, !- X,Y,Z ==> Vertex 1 {m}", + " 0,9.0,0.0, !- X,Y,Z ==> Vertex 2 {m}", + " 0,8.0,0.0, !- X,Y,Z ==> Vertex 3 {m}", + " 0,8.0,2.0; !- X,Y,Z ==> Vertex 4 {m}", + + }); + + ASSERT_TRUE(process_idf(idf_objects)); + + GetProjectControlData(*state, ErrorsFound); // read project control data + EXPECT_FALSE(ErrorsFound); // expect no errors + + 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_TRUE(ErrorsFound); // expect errors + std::string const error_string = delimited_string( + {" ** Warning ** No floor exists in Zone=\"ATTIC ZONE\", zone floor area is zero. All values for this zone that are entered per floor " + "area will be zero.", + " ** Warning ** Indicated Zone Volume <= 0.0 for Zone=ATTIC ZONE", + " ** ~~~ ** The calculated Zone Volume was=0.00", + " ** ~~~ ** The simulation will continue with the Zone Volume set to 10.0 m3. ", + " ** ~~~ ** ...use Output:Diagnostics,DisplayExtraWarnings; to show more details on individual zones.", + " ** Warning ** CalculateZoneVolume: 1 zone is not fully enclosed. For more details use: Output:Diagnostics,DisplayExtrawarnings; ", + " ** Severe ** SetUpZoneGeometry: Zone=\"ATTIC ZONE\" has only internal mass surfaces. Need at least one other surface."}); + + compare_err_stream(error_string); + + // This tests the space surface first/last values after surfaces are sorted: + // + // Simulation Order: + // All shading surfaces (including mirrored surfaces) + // Shading:Site + // Shading:Building + // Shading:Zone (and variants) + // + // By zone (in the order the zones appear in the idf): + // Walls + // Floors + // Roofs + // Internal Mass + // Doors + // Windows + // TDD_Domes + // + // Special cases: + // TubularDaylightDome is treated as a separate surface type + // TubularDaylightDiffuser is treated as a window subsurface + + // For this test, the order should be + // Simulation Order (1-based): + // LIVING ZONE: + // 1. Living:North (wall) + // 2. Living:East (wall) + // 3. Living:South (wall) + // 4. Living:West (wall) + // 5. Living:Interior (wall) + // 6. Living:Ceiling (ceiling) + // 7. Living:Floor (floor) + // 8. WestDoor (door) + // 9. NorthWindow (window) + // 10. EastWindow (window) + // 11. SouthWindow (window) + // 12. WestWindow (window) + // GARAGE ZONE: + // 13. Garage:Interior (wall) + // 14. Garage:EastWall (wall) + // 15. Garage:WestWall (wall) + // 16. Garage:FrontDoor (wall) + // 17. Garage:Floor (floor) + // 18. EVChargingStation (internal mass) + // + // Simulation Order (1-based): + + // LIVING ZONE: + int wallLivingNorth = Util::FindItemInList(Util::makeUPPER("Living:North"), state->dataSurface->Surface); + int wallLivingEast = Util::FindItemInList(Util::makeUPPER("Living:East"), state->dataSurface->Surface); + int wallLivingSouth = Util::FindItemInList(Util::makeUPPER("Living:South"), state->dataSurface->Surface); + int wallLivingWest = Util::FindItemInList(Util::makeUPPER("Living:West"), state->dataSurface->Surface); + int wallLivingInterior = Util::FindItemInList(Util::makeUPPER("Living:Interior"), state->dataSurface->Surface); + int floorLivingFloor = Util::FindItemInList(Util::makeUPPER("Living:Floor"), state->dataSurface->Surface); + int ceilingLivingCeiling = Util::FindItemInList(Util::makeUPPER("Living:Ceiling"), state->dataSurface->Surface); + int doorWestDoor = Util::FindItemInList(Util::makeUPPER("WestDoor"), state->dataSurface->Surface); + int windowNorthWindow = Util::FindItemInList(Util::makeUPPER("NorthWindow"), state->dataSurface->Surface); + int windowEastWindow = Util::FindItemInList(Util::makeUPPER("EastWindow"), state->dataSurface->Surface); + int windowSouthWindow = Util::FindItemInList(Util::makeUPPER("SouthWindow"), state->dataSurface->Surface); + int windowWestWindow = Util::FindItemInList(Util::makeUPPER("WestWindow"), state->dataSurface->Surface); + + EXPECT_EQ(wallLivingNorth, 1); + EXPECT_EQ(wallLivingEast, 2); + EXPECT_EQ(wallLivingSouth, 3); + EXPECT_EQ(wallLivingWest, 4); + EXPECT_EQ(wallLivingInterior, 5); + EXPECT_EQ(floorLivingFloor, 6); + EXPECT_EQ(ceilingLivingCeiling, 7); + EXPECT_EQ(doorWestDoor, 8); + EXPECT_EQ(windowNorthWindow, 9); + EXPECT_EQ(windowEastWindow, 10); + EXPECT_EQ(windowSouthWindow, 11); + EXPECT_EQ(windowWestWindow, 12); + EXPECT_EQ(state->dataHeatBal->space(1).HTSurfaceFirst, 1); + EXPECT_EQ(state->dataHeatBal->space(1).HTSurfaceLast, 12); + EXPECT_EQ(state->dataHeatBal->space(1).OpaqOrIntMassSurfaceFirst, 1); + EXPECT_EQ(state->dataHeatBal->space(1).OpaqOrIntMassSurfaceLast, 8); + EXPECT_EQ(state->dataHeatBal->space(1).WindowSurfaceFirst, 9); + EXPECT_EQ(state->dataHeatBal->space(1).WindowSurfaceLast, 12); + EXPECT_EQ(state->dataHeatBal->space(1).OpaqOrWinSurfaceFirst, 1); + EXPECT_EQ(state->dataHeatBal->space(1).OpaqOrWinSurfaceLast, 12); + + // GARAGE ZONE: + int wallGarageInterior = Util::FindItemInList(Util::makeUPPER("Garage:Interior"), state->dataSurface->Surface); + int wallGarageEast = Util::FindItemInList(Util::makeUPPER("Garage:EastWall"), state->dataSurface->Surface); + int wallGarageWest = Util::FindItemInList(Util::makeUPPER("Garage:WestWall"), state->dataSurface->Surface); + int wallGarageFrontDoor = Util::FindItemInList(Util::makeUPPER("Garage:FrontDoor"), state->dataSurface->Surface); + int floorGarageFloor = Util::FindItemInList(Util::makeUPPER("Garage:Floor"), state->dataSurface->Surface); + int intmassEVChargingStation = Util::FindItemInList(Util::makeUPPER("EVChargingStation"), state->dataSurface->Surface); + + EXPECT_EQ(wallGarageInterior, 13); + EXPECT_EQ(wallGarageEast, 14); + EXPECT_EQ(wallGarageWest, 15); + EXPECT_EQ(wallGarageFrontDoor, 16); + EXPECT_EQ(floorGarageFloor, 17); + EXPECT_EQ(intmassEVChargingStation, 18); + EXPECT_EQ(state->dataHeatBal->space(2).HTSurfaceFirst, 13); + EXPECT_EQ(state->dataHeatBal->space(2).HTSurfaceLast, 18); + EXPECT_EQ(state->dataHeatBal->space(2).OpaqOrIntMassSurfaceFirst, 13); + EXPECT_EQ(state->dataHeatBal->space(2).OpaqOrIntMassSurfaceLast, 18); + EXPECT_EQ(state->dataHeatBal->space(2).WindowSurfaceFirst, 0); + EXPECT_EQ(state->dataHeatBal->space(2).WindowSurfaceLast, -1); + EXPECT_EQ(state->dataHeatBal->space(2).OpaqOrWinSurfaceFirst, 13); + EXPECT_EQ(state->dataHeatBal->space(2).OpaqOrWinSurfaceLast, 18); + + // ATTIC ZONE: + EXPECT_EQ(state->dataHeatBal->space(3).HTSurfaceFirst, 0); + EXPECT_EQ(state->dataHeatBal->space(3).HTSurfaceLast, -1); + EXPECT_EQ(state->dataHeatBal->space(3).OpaqOrIntMassSurfaceFirst, 0); + EXPECT_EQ(state->dataHeatBal->space(3).OpaqOrIntMassSurfaceLast, -1); + EXPECT_EQ(state->dataHeatBal->space(3).WindowSurfaceFirst, 0); + EXPECT_EQ(state->dataHeatBal->space(3).WindowSurfaceLast, -1); + EXPECT_EQ(state->dataHeatBal->space(3).OpaqOrWinSurfaceFirst, 0); + EXPECT_EQ(state->dataHeatBal->space(3).OpaqOrWinSurfaceLast, -1); + EXPECT_EQ(state->dataHeatBal->space(3).TDDDomeFirst, 0); + EXPECT_EQ(state->dataHeatBal->space(3).TDDDomeLast, -1); + + // Extend test to check other surface lists + auto &HTSurfaces = state->dataSurface->AllHTSurfaceList; + auto &ExtSolarSurfaces = state->dataSurface->AllExtSolarSurfaceList; + auto &ExtSolAndShadingSurfaces = state->dataSurface->AllExtSolAndShadingSurfaceList; + auto &ShadowPossObstrSurfaces = state->dataSurface->AllShadowPossObstrSurfaceList; + auto &IZSurfaces = state->dataSurface->AllIZSurfaceList; + auto &HTNonWindowSurfaces = state->dataSurface->AllHTNonWindowSurfaceList; + auto &HTWindowSurfaces = state->dataSurface->AllHTWindowSurfaceList; + auto &ExtSolWindowSurfaces = state->dataSurface->AllExtSolWindowSurfaceList; + auto &ExtSolWinWithFrameSurfaces = state->dataSurface->AllExtSolWinWithFrameSurfaceList; + auto &HTKivaSurfaces = state->dataSurface->AllHTKivaSurfaceList; + + int thisSurface = doorWestDoor; + EXPECT_TRUE(std::find(HTSurfaces.begin(), HTSurfaces.end(), thisSurface) != HTSurfaces.end()); + EXPECT_TRUE(std::find(ExtSolarSurfaces.begin(), ExtSolarSurfaces.end(), thisSurface) != ExtSolarSurfaces.end()); + EXPECT_TRUE(std::find(ExtSolAndShadingSurfaces.begin(), ExtSolAndShadingSurfaces.end(), thisSurface) != ExtSolAndShadingSurfaces.end()); + EXPECT_FALSE(std::find(ShadowPossObstrSurfaces.begin(), ShadowPossObstrSurfaces.end(), thisSurface) != ShadowPossObstrSurfaces.end()); + EXPECT_FALSE(std::find(IZSurfaces.begin(), IZSurfaces.end(), thisSurface) != IZSurfaces.end()); + EXPECT_TRUE(std::find(HTNonWindowSurfaces.begin(), HTNonWindowSurfaces.end(), thisSurface) != HTNonWindowSurfaces.end()); + EXPECT_FALSE(std::find(HTWindowSurfaces.begin(), HTWindowSurfaces.end(), thisSurface) != HTWindowSurfaces.end()); + EXPECT_FALSE(std::find(ExtSolWindowSurfaces.begin(), ExtSolWindowSurfaces.end(), thisSurface) != ExtSolWindowSurfaces.end()); + EXPECT_FALSE(std::find(ExtSolWinWithFrameSurfaces.begin(), ExtSolWinWithFrameSurfaces.end(), thisSurface) != ExtSolWinWithFrameSurfaces.end()); + EXPECT_FALSE(std::find(HTKivaSurfaces.begin(), HTKivaSurfaces.end(), thisSurface) != HTKivaSurfaces.end()); + + thisSurface = wallGarageInterior; + EXPECT_TRUE(std::find(HTSurfaces.begin(), HTSurfaces.end(), thisSurface) != HTSurfaces.end()); + EXPECT_FALSE(std::find(ExtSolarSurfaces.begin(), ExtSolarSurfaces.end(), thisSurface) != ExtSolarSurfaces.end()); + EXPECT_FALSE(std::find(ExtSolAndShadingSurfaces.begin(), ExtSolAndShadingSurfaces.end(), thisSurface) != ExtSolAndShadingSurfaces.end()); + EXPECT_FALSE(std::find(ShadowPossObstrSurfaces.begin(), ShadowPossObstrSurfaces.end(), thisSurface) != ShadowPossObstrSurfaces.end()); + EXPECT_TRUE(std::find(IZSurfaces.begin(), IZSurfaces.end(), thisSurface) != IZSurfaces.end()); + EXPECT_TRUE(std::find(HTNonWindowSurfaces.begin(), HTNonWindowSurfaces.end(), thisSurface) != HTNonWindowSurfaces.end()); + EXPECT_FALSE(std::find(HTWindowSurfaces.begin(), HTWindowSurfaces.end(), thisSurface) != HTWindowSurfaces.end()); + EXPECT_FALSE(std::find(ExtSolWindowSurfaces.begin(), ExtSolWindowSurfaces.end(), thisSurface) != ExtSolWindowSurfaces.end()); + EXPECT_FALSE(std::find(ExtSolWinWithFrameSurfaces.begin(), ExtSolWinWithFrameSurfaces.end(), thisSurface) != ExtSolWinWithFrameSurfaces.end()); + EXPECT_FALSE(std::find(HTKivaSurfaces.begin(), HTKivaSurfaces.end(), thisSurface) != HTKivaSurfaces.end()); + + thisSurface = windowSouthWindow; + EXPECT_TRUE(std::find(HTSurfaces.begin(), HTSurfaces.end(), thisSurface) != HTSurfaces.end()); + EXPECT_TRUE(std::find(ExtSolarSurfaces.begin(), ExtSolarSurfaces.end(), thisSurface) != ExtSolarSurfaces.end()); + EXPECT_TRUE(std::find(ExtSolAndShadingSurfaces.begin(), ExtSolAndShadingSurfaces.end(), thisSurface) != ExtSolAndShadingSurfaces.end()); + EXPECT_FALSE(std::find(ShadowPossObstrSurfaces.begin(), ShadowPossObstrSurfaces.end(), thisSurface) != ShadowPossObstrSurfaces.end()); + EXPECT_FALSE(std::find(IZSurfaces.begin(), IZSurfaces.end(), thisSurface) != IZSurfaces.end()); + EXPECT_FALSE(std::find(HTNonWindowSurfaces.begin(), HTNonWindowSurfaces.end(), thisSurface) != HTNonWindowSurfaces.end()); + EXPECT_TRUE(std::find(HTWindowSurfaces.begin(), HTWindowSurfaces.end(), thisSurface) != HTWindowSurfaces.end()); + EXPECT_TRUE(std::find(ExtSolWindowSurfaces.begin(), ExtSolWindowSurfaces.end(), thisSurface) != ExtSolWindowSurfaces.end()); + EXPECT_FALSE(std::find(ExtSolWinWithFrameSurfaces.begin(), ExtSolWinWithFrameSurfaces.end(), thisSurface) != ExtSolWinWithFrameSurfaces.end()); + EXPECT_FALSE(std::find(HTKivaSurfaces.begin(), HTKivaSurfaces.end(), thisSurface) != HTKivaSurfaces.end()); +} + TEST_F(EnergyPlusFixture, Use_Gross_Roof_Area_for_Averge_Height) { bool ErrorsFound(false); From 6474cbcf8888b8340e758ee0304fa2ca2f87db02 Mon Sep 17 00:00:00 2001 From: "Michael J. Witte" Date: Wed, 29 Nov 2023 15:50:22 -0600 Subject: [PATCH 02/22] Cleanup --- tst/EnergyPlus/unit/SurfaceGeometry.unit.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/tst/EnergyPlus/unit/SurfaceGeometry.unit.cc b/tst/EnergyPlus/unit/SurfaceGeometry.unit.cc index 5c9e8084f21..a4865c18131 100644 --- a/tst/EnergyPlus/unit/SurfaceGeometry.unit.cc +++ b/tst/EnergyPlus/unit/SurfaceGeometry.unit.cc @@ -10560,7 +10560,6 @@ TEST_F(EnergyPlusFixture, GetSurfaceData_SurfaceOrder3) int wallLivingEast = Util::FindItemInList(Util::makeUPPER("Living:East"), state->dataSurface->Surface); int wallLivingSouth = Util::FindItemInList(Util::makeUPPER("Living:South"), state->dataSurface->Surface); int wallLivingWest = Util::FindItemInList(Util::makeUPPER("Living:West"), state->dataSurface->Surface); - int wallLivingInterior = Util::FindItemInList(Util::makeUPPER("Living:Interior"), state->dataSurface->Surface); int floorLivingFloor = Util::FindItemInList(Util::makeUPPER("Living:Floor"), state->dataSurface->Surface); int ceilingLivingCeiling = Util::FindItemInList(Util::makeUPPER("Living:Ceiling"), state->dataSurface->Surface); int doorWestDoor = Util::FindItemInList(Util::makeUPPER("WestDoor"), state->dataSurface->Surface); @@ -10596,7 +10595,6 @@ TEST_F(EnergyPlusFixture, GetSurfaceData_SurfaceOrder3) int wallWestGable = Util::FindItemInList(Util::makeUPPER("WestGable"), state->dataSurface->Surface); int wallNorthGable = Util::FindItemInList(Util::makeUPPER("NorthGable"), state->dataSurface->Surface); int floorAtticLivingFloor = Util::FindItemInList(Util::makeUPPER("Attic:LivingFloor"), state->dataSurface->Surface); - int floorAtticGarageFloor = Util::FindItemInList(Util::makeUPPER("Attic:GarageFloor"), state->dataSurface->Surface); int roofNorthRoof1 = Util::FindItemInList(Util::makeUPPER("NorthRoof1"), state->dataSurface->Surface); int roofSouthRoof = Util::FindItemInList(Util::makeUPPER("SouthRoof"), state->dataSurface->Surface); int roofNorthRoof2 = Util::FindItemInList(Util::makeUPPER("NorthRoof2"), state->dataSurface->Surface); From 3c76a8b263570929d6c53d59fde4ee2c991247dc Mon Sep 17 00:00:00 2001 From: "Michael J. Witte" Date: Wed, 29 Nov 2023 16:44:29 -0600 Subject: [PATCH 03/22] Redo surface first/last --- src/EnergyPlus/SurfaceGeometry.cc | 171 +++++++------------- src/EnergyPlus/SurfaceGeometry.hh | 4 +- tst/EnergyPlus/unit/SurfaceGeometry.unit.cc | 3 +- 3 files changed, 65 insertions(+), 113 deletions(-) diff --git a/src/EnergyPlus/SurfaceGeometry.cc b/src/EnergyPlus/SurfaceGeometry.cc index 845a6766e4a..6a04ae22626 100644 --- a/src/EnergyPlus/SurfaceGeometry.cc +++ b/src/EnergyPlus/SurfaceGeometry.cc @@ -560,7 +560,7 @@ namespace SurfaceGeometry { bool nonInternalMassSurfacesPresent = false; Real64 TotSurfArea = 0.0; thisZone.Centroid = Vector(0.0, 0.0, 0.0); - if (state.dataSurface->Surface(thisZone.AllSurfaceFirst).Sides > 0) { + if ((thisZone.AllSurfaceFirst > 0) && (state.dataSurface->Surface(thisZone.AllSurfaceFirst).Sides > 0)) { thisZone.MinimumX = state.dataSurface->Surface(thisZone.AllSurfaceFirst).Vertex(1).x; thisZone.MaximumX = state.dataSurface->Surface(thisZone.AllSurfaceFirst).Vertex(1).x; thisZone.MinimumY = state.dataSurface->Surface(thisZone.AllSurfaceFirst).Vertex(1).y; @@ -1739,7 +1739,7 @@ namespace SurfaceGeometry { state.dataSurfaceGeometry->SurfaceTmp.deallocate(); // DeAllocate the Temp Surface derived type - createSpaceSurfaceLists(state, ErrorsFound); + createSpaceSurfaceLists(state); // For each Base Surface Type (Wall, Floor, Roof) @@ -2257,110 +2257,7 @@ namespace SurfaceGeometry { } } - //********************************************************************************** - // Set up Zone Surface Pointers - for (int ZoneNum = 1; ZoneNum <= state.dataGlobal->NumOfZones; ++ZoneNum) { - for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) { - auto &thisSpace = state.dataHeatBal->space(spaceNum); - for (int SurfNum = 1; SurfNum <= MovedSurfs; ++SurfNum) { // TotSurfaces - if (state.dataSurface->Surface(SurfNum).spaceNum == spaceNum) { - if (thisSpace.AllSurfaceFirst == 0) { - thisSpace.AllSurfaceFirst = SurfNum; - } - if (state.dataSurface->Surface(SurfNum).IsAirBoundarySurf) { - state.dataSurface->Surface(SurfNum).HeatTransSurf = false; - continue; - } - if (thisSpace.HTSurfaceFirst == 0) { - thisSpace.HTSurfaceFirst = SurfNum; - // Non window surfaces are grouped next within each zone - thisSpace.OpaqOrIntMassSurfaceFirst = SurfNum; - } - if ((thisSpace.WindowSurfaceFirst == 0) && - ((state.dataSurface->Surface(SurfNum).Class == DataSurfaces::SurfaceClass::Window) || - (state.dataSurface->Surface(SurfNum).Class == DataSurfaces::SurfaceClass::GlassDoor) || - (state.dataSurface->Surface(SurfNum).Class == DataSurfaces::SurfaceClass::TDD_Diffuser))) { - // Window surfaces are grouped last within each zone - thisSpace.WindowSurfaceFirst = SurfNum; - thisSpace.OpaqOrIntMassSurfaceLast = SurfNum - 1; - } - if ((thisSpace.TDDDomeFirst == 0) && (state.dataSurface->Surface(SurfNum).Class == DataSurfaces::SurfaceClass::TDD_Dome)) { - // Window surfaces are grouped last within each zone - thisSpace.TDDDomeFirst = SurfNum; - if (thisSpace.WindowSurfaceFirst != 0) { - thisSpace.WindowSurfaceLast = SurfNum - 1; - } else { - // No window in the zone. - thisSpace.OpaqOrIntMassSurfaceLast = SurfNum - 1; - thisSpace.WindowSurfaceLast = -1; - } - break; - } - } - } - } - int firstSpaceNum = state.dataHeatBal->Zone(ZoneNum).spaceIndexes(1); - state.dataHeatBal->Zone(ZoneNum).AllSurfaceFirst = state.dataHeatBal->space(firstSpaceNum).AllSurfaceFirst; - } - // Surface First pointers are set, set last - if (state.dataGlobal->NumOfZones > 0) { - state.dataHeatBal->Zone(state.dataGlobal->NumOfZones).AllSurfaceLast = state.dataSurface->TotSurfaces; - int lastSpaceNum = state.dataHeatBal->Zone(state.dataGlobal->NumOfZones) - .spaceIndexes(state.dataHeatBal->Zone(state.dataGlobal->NumOfZones).spaceIndexes.size()); - state.dataHeatBal->space(lastSpaceNum).AllSurfaceLast = state.dataSurface->TotSurfaces; - } - for (int ZoneNum = 1; ZoneNum <= state.dataGlobal->NumOfZones; ++ZoneNum) { - if (ZoneNum < state.dataGlobal->NumOfZones) { - state.dataHeatBal->Zone(ZoneNum).AllSurfaceLast = state.dataHeatBal->Zone(ZoneNum + 1).AllSurfaceFirst - 1; - } - auto &thisSpaceList = state.dataHeatBal->Zone(ZoneNum).spaceIndexes; - int numSpacesInZone = thisSpaceList.size(); - if (numSpacesInZone > 1) { - for (int spaceCount = 1; spaceCount <= numSpacesInZone - 1; ++spaceCount) { - auto &thisSpace = state.dataHeatBal->space(thisSpaceList(spaceCount)); - auto &nextSpace = state.dataHeatBal->space(thisSpaceList(spaceCount + 1)); - thisSpace.AllSurfaceLast = nextSpace.AllSurfaceFirst - 1; - } - state.dataHeatBal->space(thisSpaceList(numSpacesInZone)).AllSurfaceLast = state.dataHeatBal->Zone(ZoneNum).AllSurfaceLast; - } else if (numSpacesInZone == 1) { - auto &thisSpace = state.dataHeatBal->space(thisSpaceList(numSpacesInZone)); - thisSpace.AllSurfaceFirst = state.dataHeatBal->Zone(ZoneNum).AllSurfaceFirst; - thisSpace.AllSurfaceLast = state.dataHeatBal->Zone(ZoneNum).AllSurfaceLast; - } - } - for (int ZoneNum = 1; ZoneNum <= state.dataGlobal->NumOfZones; ++ZoneNum) { - for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) { - auto &thisSpace = state.dataHeatBal->space(spaceNum); - if (state.dataSurface->Surface(thisSpace.AllSurfaceLast).Class == DataSurfaces::SurfaceClass::TDD_Dome) { - thisSpace.TDDDomeLast = thisSpace.AllSurfaceLast; - } else if ((state.dataSurface->Surface(thisSpace.AllSurfaceLast).Class == DataSurfaces::SurfaceClass::Window) || - (state.dataSurface->Surface(thisSpace.AllSurfaceLast).Class == DataSurfaces::SurfaceClass::GlassDoor) || - (state.dataSurface->Surface(thisSpace.AllSurfaceLast).Class == DataSurfaces::SurfaceClass::TDD_Diffuser)) { - thisSpace.TDDDomeLast = -1; - thisSpace.WindowSurfaceLast = thisSpace.AllSurfaceLast; - } else { - // If there are no windows in the zone, then set this to -1 so any for loops on WindowSurfaceFirst to WindowSurfaceLast - // will not execute. Same for TDDDome and its indices - thisSpace.TDDDomeLast = -1; - thisSpace.WindowSurfaceLast = -1; - thisSpace.OpaqOrIntMassSurfaceLast = thisSpace.AllSurfaceLast; - } - if (thisSpace.HTSurfaceFirst > 0) { - thisSpace.OpaqOrWinSurfaceFirst = thisSpace.HTSurfaceFirst; - thisSpace.OpaqOrWinSurfaceLast = std::max(thisSpace.OpaqOrIntMassSurfaceLast, thisSpace.WindowSurfaceLast); - thisSpace.HTSurfaceLast = thisSpace.AllSurfaceLast; - } else { - // If no heat transfer surfaces, make sure all others are set correctly - thisSpace.HTSurfaceLast = -1; - thisSpace.WindowSurfaceFirst = 0; - thisSpace.WindowSurfaceLast = -1; - thisSpace.OpaqOrWinSurfaceFirst = 0; - thisSpace.OpaqOrWinSurfaceLast = -1; - thisSpace.OpaqOrIntMassSurfaceFirst = 0; - thisSpace.OpaqOrIntMassSurfaceLast = -1; - } - } - } + setSurfaceFirstLast(state); // Set up Floor Areas for Zones and Spaces Real64 constexpr floorAreaTolerance(0.05); @@ -3001,7 +2898,7 @@ namespace SurfaceGeometry { } } - void createSpaceSurfaceLists(EnergyPlusData &state, bool &ErrorsFound) + void createSpaceSurfaceLists(EnergyPlusData &state) { static constexpr std::string_view RoutineName("createSpaceSurfaceLists: "); // Build Space surface lists now that all of the surface sorting is complete @@ -3011,12 +2908,64 @@ namespace SurfaceGeometry { // Add to Space's list of surfaces state.dataHeatBal->space(thisSurf.spaceNum).surfaces.emplace_back(surfNum); } - // TODO MJW: Is this necessary? Check that all Spaces have at least one Surface - for (int spaceNum = 1; spaceNum < state.dataGlobal->numSpaces; ++spaceNum) { + for (int spaceNum = 1; spaceNum <= state.dataGlobal->numSpaces; ++spaceNum) { if (int(state.dataHeatBal->space(spaceNum).surfaces.size()) == 0) { - ShowSevereError(state, format("{}Space = {} has no surfaces.", RoutineName, state.dataHeatBal->space(spaceNum).Name)); - ErrorsFound = true; + ShowWarningError(state, format("{}Space = {} has no surfaces.", RoutineName, state.dataHeatBal->space(spaceNum).Name)); + } + } + } + + void setSurfaceFirstLast(EnergyPlusData &state) + { + // Set Zone and Space Surface First/Last Pointers + // Space surface lists have been built earlier in createSpaceSurfaceLists + for (int ZoneNum = 1; ZoneNum <= state.dataGlobal->NumOfZones; ++ZoneNum) { + for (int spaceNum : state.dataHeatBal->Zone(ZoneNum).spaceIndexes) { + auto &thisSpace = state.dataHeatBal->space(spaceNum); + for (int SurfNum : thisSpace.surfaces) { + if (thisSpace.AllSurfaceFirst == 0) { + thisSpace.AllSurfaceFirst = SurfNum; + } + thisSpace.AllSurfaceLast = SurfNum; + + if (state.dataSurface->Surface(SurfNum).IsAirBoundarySurf) { + state.dataSurface->Surface(SurfNum).HeatTransSurf = false; + continue; + } + // Non window surfaces are grouped next within each space + if (thisSpace.HTSurfaceFirst == 0) { + thisSpace.HTSurfaceFirst = SurfNum; + thisSpace.OpaqOrIntMassSurfaceFirst = SurfNum; + thisSpace.OpaqOrWinSurfaceFirst = SurfNum; + } + thisSpace.HTSurfaceLast = SurfNum; + + // Window surfaces are grouped next within each space + if ((state.dataSurface->Surface(SurfNum).Class == DataSurfaces::SurfaceClass::Window) || + (state.dataSurface->Surface(SurfNum).Class == DataSurfaces::SurfaceClass::GlassDoor) || + (state.dataSurface->Surface(SurfNum).Class == DataSurfaces::SurfaceClass::TDD_Diffuser)) { + if (thisSpace.WindowSurfaceFirst == 0) { + thisSpace.WindowSurfaceFirst = SurfNum; + } + thisSpace.WindowSurfaceLast = SurfNum; + } else if (state.dataSurface->Surface(SurfNum).Class != DataSurfaces::SurfaceClass::TDD_Dome) { + thisSpace.OpaqOrIntMassSurfaceLast = SurfNum; + } + + // TDDDome surfaces are grouped last within each space + if (state.dataSurface->Surface(SurfNum).Class == DataSurfaces::SurfaceClass::TDD_Dome) { + if (thisSpace.TDDDomeFirst == 0) { + thisSpace.TDDDomeFirst = SurfNum; + } + thisSpace.TDDDomeLast = SurfNum; + } else { + thisSpace.OpaqOrWinSurfaceLast = SurfNum; + } + } + state.dataHeatBal->Zone(ZoneNum).AllSurfaceLast = thisSpace.AllSurfaceLast; } + int firstSpaceNum = state.dataHeatBal->Zone(ZoneNum).spaceIndexes(1); + state.dataHeatBal->Zone(ZoneNum).AllSurfaceFirst = state.dataHeatBal->space(firstSpaceNum).AllSurfaceFirst; } } diff --git a/src/EnergyPlus/SurfaceGeometry.hh b/src/EnergyPlus/SurfaceGeometry.hh index b9d940860bc..4693b69ce5a 100644 --- a/src/EnergyPlus/SurfaceGeometry.hh +++ b/src/EnergyPlus/SurfaceGeometry.hh @@ -90,7 +90,9 @@ namespace SurfaceGeometry { void CreateMissingSpaces(EnergyPlusData &state, Array1D &Surfaces); - void createSpaceSurfaceLists(EnergyPlusData &state, bool &ErrorsFound); + void createSpaceSurfaceLists(EnergyPlusData &state); + + void setSurfaceFirstLast(EnergyPlusData &state); void checkSubSurfAzTiltNorm(EnergyPlusData &state, SurfaceData &baseSurface, // Base surface data (in) diff --git a/tst/EnergyPlus/unit/SurfaceGeometry.unit.cc b/tst/EnergyPlus/unit/SurfaceGeometry.unit.cc index a4865c18131..94db2a88a29 100644 --- a/tst/EnergyPlus/unit/SurfaceGeometry.unit.cc +++ b/tst/EnergyPlus/unit/SurfaceGeometry.unit.cc @@ -11267,7 +11267,8 @@ TEST_F(EnergyPlusFixture, GetSurfaceData_SurfaceOrder4) SetupZoneGeometry(*state, ErrorsFound); EXPECT_TRUE(ErrorsFound); // expect errors std::string const error_string = delimited_string( - {" ** Warning ** No floor exists in Zone=\"ATTIC ZONE\", zone floor area is zero. All values for this zone that are entered per floor " + {" ** Warning ** createSpaceSurfaceLists: Space = ATTIC ZONE has no surfaces.", + " ** Warning ** No floor exists in Zone=\"ATTIC ZONE\", zone floor area is zero. All values for this zone that are entered per floor " "area will be zero.", " ** Warning ** Indicated Zone Volume <= 0.0 for Zone=ATTIC ZONE", " ** ~~~ ** The calculated Zone Volume was=0.00", From d9aa4fe8455e8f179cc2e13cd6afbd7378257dd5 Mon Sep 17 00:00:00 2001 From: "Michael J. Witte" Date: Thu, 30 Nov 2023 13:24:46 -0600 Subject: [PATCH 04/22] Surface error cleanup --- src/EnergyPlus/HeatBalanceIntRadExchange.cc | 3 ++- src/EnergyPlus/SurfaceGeometry.cc | 12 ++++++++---- tst/EnergyPlus/unit/SurfaceGeometry.unit.cc | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/EnergyPlus/HeatBalanceIntRadExchange.cc b/src/EnergyPlus/HeatBalanceIntRadExchange.cc index 7dd75b5388c..40402904f24 100644 --- a/src/EnergyPlus/HeatBalanceIntRadExchange.cc +++ b/src/EnergyPlus/HeatBalanceIntRadExchange.cc @@ -778,6 +778,7 @@ namespace HeatBalanceIntRadExchange { Array2D SaveApproximateViewFactors; // Save for View Factor reporting std::string Option1; // view factor report option + static constexpr std::string_view RoutineName("InitSolarViewFactors: "); bool ErrorsFound = false; bool ViewFactorReport = false; @@ -817,7 +818,7 @@ namespace HeatBalanceIntRadExchange { } } thisEnclosure.NumOfSurfaces = numEnclosureSurfaces; - if (numEnclosureSurfaces < 1) ShowFatalError(state, "No surfaces in an enclosure in InitSolarViewFactors"); + if (numEnclosureSurfaces < 1) ShowFatalError(state, format("{}No surfaces in enclosure={}.", RoutineName, thisEnclosure.Name)); // Allocate the parts of the derived type thisEnclosure.F.dimension(numEnclosureSurfaces, numEnclosureSurfaces, 0.0); diff --git a/src/EnergyPlus/SurfaceGeometry.cc b/src/EnergyPlus/SurfaceGeometry.cc index 6a04ae22626..a44115564f3 100644 --- a/src/EnergyPlus/SurfaceGeometry.cc +++ b/src/EnergyPlus/SurfaceGeometry.cc @@ -558,6 +558,7 @@ namespace SurfaceGeometry { for (int ZoneNum = 1; ZoneNum <= state.dataGlobal->NumOfZones; ++ZoneNum) { auto &thisZone = state.dataHeatBal->Zone(ZoneNum); bool nonInternalMassSurfacesPresent = false; + bool internalMassSurfacesPresent = false; Real64 TotSurfArea = 0.0; thisZone.Centroid = Vector(0.0, 0.0, 0.0); if ((thisZone.AllSurfaceFirst > 0) && (state.dataSurface->Surface(thisZone.AllSurfaceFirst).Sides > 0)) { @@ -573,8 +574,11 @@ namespace SurfaceGeometry { for (int SurfNum = thisSpace.AllSurfaceFirst; SurfNum <= thisSpace.AllSurfaceLast; ++SurfNum) { auto &thisSurface = state.dataSurface->Surface(SurfNum); - if (thisSurface.Class == SurfaceClass::IntMass) continue; - nonInternalMassSurfacesPresent = true; + if (thisSurface.Class == SurfaceClass::IntMass) { + internalMassSurfacesPresent = true; + continue; + } + if (!thisSurface.IsAirBoundarySurf) nonInternalMassSurfacesPresent = true; if (thisSurface.Class == SurfaceClass::Wall || (thisSurface.Class == SurfaceClass::Roof) || (thisSurface.Class == SurfaceClass::Floor)) { @@ -596,7 +600,7 @@ namespace SurfaceGeometry { thisZone.Centroid.y /= TotSurfArea; thisZone.Centroid.z /= TotSurfArea; } - if (!nonInternalMassSurfacesPresent) { + if (internalMassSurfacesPresent && !nonInternalMassSurfacesPresent) { ShowSevereError( state, format("{}Zone=\"{}\" has only internal mass surfaces. Need at least one other surface.", RoutineName, thisZone.Name)); ErrorsFound = true; @@ -2910,7 +2914,7 @@ namespace SurfaceGeometry { } for (int spaceNum = 1; spaceNum <= state.dataGlobal->numSpaces; ++spaceNum) { if (int(state.dataHeatBal->space(spaceNum).surfaces.size()) == 0) { - ShowWarningError(state, format("{}Space = {} has no surfaces.", RoutineName, state.dataHeatBal->space(spaceNum).Name)); + ShowWarningError(state, format("{}Space={} has no surfaces.", RoutineName, state.dataHeatBal->space(spaceNum).Name)); } } } diff --git a/tst/EnergyPlus/unit/SurfaceGeometry.unit.cc b/tst/EnergyPlus/unit/SurfaceGeometry.unit.cc index 94db2a88a29..3fd7b8084a8 100644 --- a/tst/EnergyPlus/unit/SurfaceGeometry.unit.cc +++ b/tst/EnergyPlus/unit/SurfaceGeometry.unit.cc @@ -11267,7 +11267,7 @@ TEST_F(EnergyPlusFixture, GetSurfaceData_SurfaceOrder4) SetupZoneGeometry(*state, ErrorsFound); EXPECT_TRUE(ErrorsFound); // expect errors std::string const error_string = delimited_string( - {" ** Warning ** createSpaceSurfaceLists: Space = ATTIC ZONE has no surfaces.", + {" ** Warning ** createSpaceSurfaceLists: Space=ATTIC ZONE has no surfaces.", " ** Warning ** No floor exists in Zone=\"ATTIC ZONE\", zone floor area is zero. All values for this zone that are entered per floor " "area will be zero.", " ** Warning ** Indicated Zone Volume <= 0.0 for Zone=ATTIC ZONE", From 405d8ea19b8aaa9137e4b0647b3f86032a309da5 Mon Sep 17 00:00:00 2001 From: "Michael J. Witte" Date: Thu, 30 Nov 2023 13:56:06 -0600 Subject: [PATCH 05/22] Surface error cleanup --- src/EnergyPlus/HeatBalanceIntRadExchange.cc | 15 +++++++++++---- tst/EnergyPlus/unit/SurfaceGeometry.unit.cc | 9 ++++----- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/EnergyPlus/HeatBalanceIntRadExchange.cc b/src/EnergyPlus/HeatBalanceIntRadExchange.cc index 40402904f24..80fa4496c43 100644 --- a/src/EnergyPlus/HeatBalanceIntRadExchange.cc +++ b/src/EnergyPlus/HeatBalanceIntRadExchange.cc @@ -448,6 +448,7 @@ namespace HeatBalanceIntRadExchange { // the grey interchange between surfaces in an enclosure. // SUBROUTINE LOCAL VARIABLE DECLARATIONS: + static constexpr std::string_view RoutineName("InitInteriorRadExchange: "); bool NoUserInputF; // Logical flag signifying no input F's for zone bool ErrorsFound(false); Real64 CheckValue1; @@ -499,7 +500,10 @@ namespace HeatBalanceIntRadExchange { thisEnclosure.NumOfSurfaces = numEnclosureSurfaces; state.dataHeatBalIntRadExchg->MaxNumOfRadEnclosureSurfs = max(state.dataHeatBalIntRadExchg->MaxNumOfRadEnclosureSurfs, numEnclosureSurfaces); - if (numEnclosureSurfaces < 1) ShowFatalError(state, "No surfaces in an enclosure in InitInteriorRadExchange"); + if (numEnclosureSurfaces < 1) { + ShowSevereError(state, format("{}No surfaces in enclosure={}.", RoutineName, thisEnclosure.Name)); + ErrorsFound = true; + } // Allocate the parts of the derived type thisEnclosure.F.dimension(numEnclosureSurfaces, numEnclosureSurfaces, 0.0); @@ -767,7 +771,7 @@ namespace HeatBalanceIntRadExchange { } if (ErrorsFound) { - ShowFatalError(state, "InitInteriorRadExchange: Errors found during initialization of radiant exchange. Program terminated."); + ShowFatalError(state, format("{}Errors found during initialization of radiant exchange. Program terminated.", RoutineName)); } } @@ -818,7 +822,10 @@ namespace HeatBalanceIntRadExchange { } } thisEnclosure.NumOfSurfaces = numEnclosureSurfaces; - if (numEnclosureSurfaces < 1) ShowFatalError(state, format("{}No surfaces in enclosure={}.", RoutineName, thisEnclosure.Name)); + if (numEnclosureSurfaces < 1) { + ShowSevereError(state, format("{}No surfaces in enclosure={}.", RoutineName, thisEnclosure.Name)); + ErrorsFound = true; + } // Allocate the parts of the derived type thisEnclosure.F.dimension(numEnclosureSurfaces, numEnclosureSurfaces, 0.0); @@ -1049,7 +1056,7 @@ namespace HeatBalanceIntRadExchange { } if (ErrorsFound) { - ShowFatalError(state, "InitSolarViewFactors: Errors found during initialization of diffuse solar distribution. Program terminated."); + ShowFatalError(state, format("{}Errors found during initialization of diffuse solar distribution. Program terminated.", RoutineName)); } } diff --git a/tst/EnergyPlus/unit/SurfaceGeometry.unit.cc b/tst/EnergyPlus/unit/SurfaceGeometry.unit.cc index 3fd7b8084a8..94969fbec87 100644 --- a/tst/EnergyPlus/unit/SurfaceGeometry.unit.cc +++ b/tst/EnergyPlus/unit/SurfaceGeometry.unit.cc @@ -9645,7 +9645,7 @@ TEST_F(EnergyPlusFixture, GetSurfaceData_SurfaceOrder2) EXPECT_FALSE(ErrorsFound); // expect no errors SetupZoneGeometry(*state, ErrorsFound); - EXPECT_TRUE(ErrorsFound); // expect errors due to zone with no surfaces + EXPECT_FALSE(ErrorsFound); // expect no errors // compare_err_stream( "" ); // just for debugging // This tests the space surface first/last values after surfaces are sorted: @@ -10498,7 +10498,7 @@ TEST_F(EnergyPlusFixture, GetSurfaceData_SurfaceOrder3) EXPECT_FALSE(ErrorsFound); // expect no errors SetupZoneGeometry(*state, ErrorsFound); - EXPECT_TRUE(ErrorsFound); // expect errors due to zone with no surfaces + EXPECT_FALSE(ErrorsFound); // expect no errors // compare_err_stream( "" ); // just for debugging // This tests the space surface first/last values after surfaces are sorted: @@ -11265,7 +11265,7 @@ TEST_F(EnergyPlusFixture, GetSurfaceData_SurfaceOrder4) EXPECT_FALSE(ErrorsFound); // expect no errors SetupZoneGeometry(*state, ErrorsFound); - EXPECT_TRUE(ErrorsFound); // expect errors + EXPECT_FALSE(ErrorsFound); // expect no errors, just warnings std::string const error_string = delimited_string( {" ** Warning ** createSpaceSurfaceLists: Space=ATTIC ZONE has no surfaces.", " ** Warning ** No floor exists in Zone=\"ATTIC ZONE\", zone floor area is zero. All values for this zone that are entered per floor " @@ -11274,8 +11274,7 @@ TEST_F(EnergyPlusFixture, GetSurfaceData_SurfaceOrder4) " ** ~~~ ** The calculated Zone Volume was=0.00", " ** ~~~ ** The simulation will continue with the Zone Volume set to 10.0 m3. ", " ** ~~~ ** ...use Output:Diagnostics,DisplayExtraWarnings; to show more details on individual zones.", - " ** Warning ** CalculateZoneVolume: 1 zone is not fully enclosed. For more details use: Output:Diagnostics,DisplayExtrawarnings; ", - " ** Severe ** SetUpZoneGeometry: Zone=\"ATTIC ZONE\" has only internal mass surfaces. Need at least one other surface."}); + " ** Warning ** CalculateZoneVolume: 1 zone is not fully enclosed. For more details use: Output:Diagnostics,DisplayExtrawarnings; "}); compare_err_stream(error_string); From 69a8c2809bf3f396114b88432b7218dbc08de40d Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Thu, 14 Dec 2023 15:21:08 +0100 Subject: [PATCH 06/22] Quick Fix #10266 --- idd/Energy+.idd.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/idd/Energy+.idd.in b/idd/Energy+.idd.in index 24466299615..efd581da83d 100644 --- a/idd/Energy+.idd.in +++ b/idd/Energy+.idd.in @@ -23357,7 +23357,7 @@ Daylighting:Controls, A12, \field Daylighting Reference Point 6 Name \type object-list \object-list DaylightReferencePointNames - N18, \field Fraction of Zone Controlled by Reference Point 6 + N18, \field Fraction of Lights Controlled by Reference Point 6 \type real \minimum 0.0 \maximum 1.0 @@ -23396,7 +23396,7 @@ Daylighting:Controls, A15, \field Daylighting Reference Point 9 Name \type object-list \object-list DaylightReferencePointNames - N24, \field Fraction of Zone Controlled by Reference Point 9 + N24, \field Fraction of Lights Controlled by Reference Point 9 \type real \minimum 0.0 \maximum 1.0 From e361b479df666b862784ac80155c25696bcc9532 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Fri, 22 Dec 2023 10:35:11 +0100 Subject: [PATCH 07/22] Use PyConfig * Isolate https://github.com/NREL/EnergyPlus/pull/10340 into it's own PR * remove blocks on python version (use PyConfig for 3.8 too), * Put back type_traits * Improve error messages via a fmt formatter for PyStatus * Replace C style casts with static_casts --- src/EnergyPlus/PluginManager.cc | 185 +++++++++++++++++++++++--------- src/EnergyPlus/PluginManager.hh | 2 + 2 files changed, 134 insertions(+), 53 deletions(-) diff --git a/src/EnergyPlus/PluginManager.cc b/src/EnergyPlus/PluginManager.cc index dc55cf482d2..19eed55b70c 100644 --- a/src/EnergyPlus/PluginManager.cc +++ b/src/EnergyPlus/PluginManager.cc @@ -57,17 +57,49 @@ #include #include +#if LINK_WITH_PYTHON +#include +namespace fmt { +template <> struct formatter +{ + // parse is inherited from formatter. + constexpr auto parse(format_parse_context &ctx) -> format_parse_context::iterator + { + return ctx.begin(); + } + + auto format(const PyStatus &status, format_context &ctx) const -> format_context::iterator + { + if (!PyStatus_Exception(status)) { + return ctx.out(); + } + if (PyStatus_IsExit(status)) { + return fmt::format_to(ctx.out(), "Exited with code {}", status.exitcode); + } + if (PyStatus_IsError(status)) { + auto it = ctx.out(); + it = fmt::format_to(it, "Fatal Python error: "); + if (status.func) { + it = fmt::format_to(it, "{}: ", status.func); + } + it = fmt::format_to(it, "{}", status.err_msg); + return it; + } + return ctx.out(); + } +}; +} // namespace fmt +#endif + namespace EnergyPlus::PluginManagement { PluginTrendVariable::PluginTrendVariable(EnergyPlusData &state, std::string _name, int _numValues, int _indexOfPluginVariable) : name(std::move(_name)), numValues(_numValues), indexOfPluginVariable(_indexOfPluginVariable) { - // initialize the deque so it can be queried immediately, even with just zeroes + // initialize the deque, so it can be queried immediately, even with just zeroes for (int i = 1; i <= this->numValues; i++) { this->values.push_back(0); - } - for (int loop = 1; loop <= _numValues; ++loop) { - this->times.push_back(-loop * state.dataGlobal->TimeStepZone); + this->times.push_back(-i * state.dataGlobal->TimeStepZone); } } @@ -379,6 +411,82 @@ void PluginManager::setupOutputVariables([[maybe_unused]] EnergyPlusData &state) #endif } +#if LINK_WITH_PYTHON +void PluginManager::initPython(EnergyPlusData &state, fs::path const &pathToPythonPackages) +{ + PyStatus status; + + // first pre-config Python so that it can speak UTF-8 + PyPreConfig preConfig; + PyPreConfig_InitPythonConfig(&preConfig); + preConfig.utf8_mode = 1; + status = Py_PreInitialize(&preConfig); + if (PyStatus_Exception(status)) { + ShowFatalError(state, fmt::format("Could not pre-initialize Python to speak UTF-8... {}", status)); + } + + PyConfig config; + PyConfig_InitIsolatedConfig(&config); + config.isolated = 1; + + status = PyConfig_SetBytesString(&config, &config.program_name, PluginManagement::programName); + if (PyStatus_Exception(status)) { + ShowFatalError(state, fmt::format("Could not initialize program_name on PyConfig... {}", status)); + } + + status = PyConfig_Read(&config); + if (PyStatus_Exception(status)) { + ShowFatalError(state, fmt::format("Could not read back the PyConfig... {}", status)); + } + + if constexpr (std::is_same_v) { + // PyConfig_SetString copies the wide character string str into *config_str. + std::wstring const ws = pathToPythonPackages.generic_wstring(); + const wchar_t *wcharPath = ws.c_str(); + + status = PyConfig_SetString(&config, &config.home, wcharPath); + if (PyStatus_Exception(status)) { + ShowFatalError(state, fmt::format("Could not set home to {} on PyConfig... {}", pathToPythonPackages.generic_string(), status)); + } + status = PyConfig_SetString(&config, &config.base_prefix, wcharPath); + if (PyStatus_Exception(status)) { + ShowFatalError(state, fmt::format("Could not set base_prefix to {} on PyConfig... {}", pathToPythonPackages.generic_string(), status)); + } + config.module_search_paths_set = 1; + status = PyWideStringList_Append(&config.module_search_paths, wcharPath); + if (PyStatus_Exception(status)) { + ShowFatalError(state, + fmt::format("Could not add {} to module_search_paths on PyConfig... {}", pathToPythonPackages.generic_string(), status)); + } + + } else { + // PyConfig_SetBytesString takes a `const char * str` and decodes str using Py_DecodeLocale() and set the result into *config_str + // But we want to avoid doing it three times, so we PyDecodeLocale manually + // Py_DecodeLocale can be called because Python has been PreInitialized. + wchar_t *wcharPath = Py_DecodeLocale(pathToPythonPackages.generic_string().c_str(), nullptr); // This allocates! + + status = PyConfig_SetString(&config, &config.home, wcharPath); + if (PyStatus_Exception(status)) { + ShowFatalError(state, fmt::format("Could not set home to {} on PyConfig... {}", pathToPythonPackages.generic_string(), status)); + } + status = PyConfig_SetString(&config, &config.base_prefix, wcharPath); + if (PyStatus_Exception(status)) { + ShowFatalError(state, fmt::format("Could not set base_prefix to {} on PyConfig... {}", pathToPythonPackages.generic_string(), status)); + } + config.module_search_paths_set = 1; + status = PyWideStringList_Append(&config.module_search_paths, wcharPath); + if (PyStatus_Exception(status)) { + ShowFatalError(state, + fmt::format("Could not add {} to module_search_paths on PyConfig... {}", pathToPythonPackages.generic_string(), status)); + } + + PyMem_RawFree(wcharPath); + } + + Py_InitializeFromConfig(&config); +} +#endif // LINK_WITH_PYTHON + PluginManager::PluginManager(EnergyPlusData &state) : eplusRunningViaPythonAPI(state.dataPluginManager->eplusRunningViaPythonAPI) { // Now read all the actual plugins and interpret them @@ -390,9 +498,6 @@ PluginManager::PluginManager(EnergyPlusData &state) : eplusRunningViaPythonAPI(s } #if LINK_WITH_PYTHON - // this frozen flag tells Python that the package and library have been frozen for embedding, so it shouldn't warn about missing prefixes - Py_FrozenFlag = 1; - // we'll need the program directory for a few things so get it once here at the top and sanitize it fs::path programDir; if (state.dataGlobal->installRootOverride) { @@ -400,34 +505,9 @@ PluginManager::PluginManager(EnergyPlusData &state) : eplusRunningViaPythonAPI(s } else { programDir = FileSystem::getParentDirectoryPath(FileSystem::getAbsolutePath(FileSystem::getProgramPath())); } - - // I think we need to set the python path before initializing the library - // make this relative to the binary fs::path const pathToPythonPackages = programDir / "python_standard_lib"; - if constexpr (std::is_same_v) { - std::wstring const ws = pathToPythonPackages.generic_wstring(); - Py_SetPath(ws.c_str()); - Py_SetPythonHome(ws.c_str()); - } else { - // TODO: Py_DecodeLocale shouldn't be called before Python is PreInitialized. Also, this should be replaced by PyConfig - wchar_t *a = Py_DecodeLocale(pathToPythonPackages.generic_string().c_str(), nullptr); // This allocates! - Py_SetPath(a); - Py_SetPythonHome(a); - PyMem_RawFree(a); - } - // must be called before Py_Initialize - // tells the interpreter the value of argv[0] to the main() function - // used by some functions to find run-time libraries relative to the interpreter executable - Py_SetProgramName((wchar_t *)programName); - - // now that we have set the path, we can initialize python - // from https://docs.python.org/3/c-api/init.html - // If arg 0, it skips init registration of signal handlers, which might be useful when Python is embedded. - bool alreadyInitialized = (Py_IsInitialized() != 0); - if (!alreadyInitialized) { - Py_InitializeEx(0); - } + PluginManager::initPython(state, pathToPythonPackages); // Take control of the global interpreter lock while we are here, make sure to release it... PyGILState_STATE gil = PyGILState_Ensure(); @@ -690,7 +770,7 @@ void PluginInstance::reportPythonError([[maybe_unused]] EnergyPlusData &state) return; } - unsigned long numVals = PyList_Size(pyth_val); + Py_ssize_t numVals = PyList_Size(pyth_val); if (numVals == 0) { EnergyPlus::ShowContinueError(state, "No traceback available"); return; @@ -700,7 +780,7 @@ void PluginInstance::reportPythonError([[maybe_unused]] EnergyPlusData &state) EnergyPlus::ShowContinueError(state, "```"); - for (unsigned long itemNum = 0; itemNum < numVals; itemNum++) { + for (Py_ssize_t itemNum = 0; itemNum < numVals; itemNum++) { PyObject *item = PyList_GetItem(pyth_val, itemNum); if (PyUnicode_Check(item)) { // NOLINT(hicpp-signed-bitwise) -- something inside Python code causes warning std::string traceback_line = PyUnicode_AsUTF8(item); @@ -769,16 +849,14 @@ void PluginInstance::setup([[maybe_unused]] EnergyPlusData &state) // import from database or something ShowFatalError(state, "Could not get full path"); } else { - PyObject *pStrObj = PyUnicode_AsUTF8String(pFullPath); - char *zStr = PyBytes_AsString(pStrObj); - std::string s(zStr); - Py_DECREF(pStrObj); // PyUnicode_AsUTF8String returns a new reference, decrement it - ShowMessage(state, format("PythonPlugin: Class {} imported from: {}", className, s)); + const char *zStr = PyUnicode_AsUTF8(pFullPath); + std::string sHere(zStr); + ShowMessage(state, format("PythonPlugin: Class {} imported from: {}", className, sHere)); } PyObject *pClass = PyDict_GetItemString(pModuleDict, className.c_str()); // Py_DECREF(pModuleDict); // PyModule_GetDict returns a borrowed reference, DO NOT decrement if (!pClass) { - EnergyPlus::ShowSevereError(state, format("Failed to get class type \"{}\" from module \"{}\"", className, modulePath.generic_string())); + EnergyPlus::ShowSevereError(state, format(R"(Failed to get class type "{}" from module "{}")", className, modulePath.generic_string())); if (PyErr_Occurred()) { PluginInstance::reportPythonError(state); } else { @@ -816,7 +894,7 @@ void PluginInstance::setup([[maybe_unused]] EnergyPlusData &state) PyObject *detectFunction = PyObject_GetAttrString(this->pClassInstance, detectOverriddenFunctionName.c_str()); if (!detectFunction || !PyCallable_Check(detectFunction)) { EnergyPlus::ShowSevereError(state, - format("Could not find or call function \"{}\" on class \"{}.{}\"", + format(R"(Could not find or call function "{}" on class "{}.{}")", detectOverriddenFunctionName, this->modulePath.generic_string(), this->className)); @@ -841,14 +919,14 @@ void PluginInstance::setup([[maybe_unused]] EnergyPlusData &state) if (!PyList_Check(pFunctionResponse)) { // NOLINT(hicpp-signed-bitwise) EnergyPlus::ShowFatalError(state, format("Invalid return from _detect_overridden() on class \"{}\", this is weird", this->stringIdentifier)); } - unsigned long numVals = PyList_Size(pFunctionResponse); + Py_ssize_t numVals = PyList_Size(pFunctionResponse); // at this point we know which base class methods are being overridden by the derived class // we can loop over them and based on the name check the appropriate flag and assign the function pointer if (numVals == 0) { EnergyPlus::ShowFatalError( state, format("Python plugin \"{}\" did not override any base class methods; must override at least one", this->stringIdentifier)); } - for (unsigned long itemNum = 0; itemNum < numVals; itemNum++) { + for (Py_ssize_t itemNum = 0; itemNum < numVals; itemNum++) { PyObject *item = PyList_GetItem(pFunctionResponse, itemNum); if (PyUnicode_Check(item)) { // NOLINT(hicpp-signed-bitwise) -- something inside Python code causes warning std::string functionName = PyUnicode_AsUTF8(item); @@ -1067,7 +1145,7 @@ bool PluginInstance::run(EnergyPlusData &state, EMSManager::EMSCallFrom iCalledF format("Program terminates after call to {}() on {} failed!", functionNameAsString, this->stringIdentifier)); } if (PyLong_Check(pFunctionResponse)) { // NOLINT(hicpp-signed-bitwise) - int exitCode = PyLong_AsLong(pFunctionResponse); + long exitCode = PyLong_AsLong(pFunctionResponse); if (exitCode == 0) { // success } else if (exitCode == 1) { @@ -1102,9 +1180,9 @@ bool PluginInstance::run([[maybe_unused]] EnergyPlusData &state, [[maybe_unused] std::vector PluginManager::currentPythonPath() { PyObject *sysPath = PySys_GetObject("path"); // Borrowed reference - size_t const n = PyList_Size(sysPath); // Py_ssize_t + Py_ssize_t const n = PyList_Size(sysPath); // Py_ssize_t std::vector pathLibs(n); - for (size_t i = 0; i < n; ++i) { + for (Py_ssize_t i = 0; i < n; ++i) { PyObject *element = PyList_GetItem(sysPath, i); // Borrowed reference pathLibs[i] = std::string{PyUnicode_AsUTF8(element)}; } @@ -1180,16 +1258,17 @@ void PluginManager::addGlobalVariable([[maybe_unused]] EnergyPlusData &state, [[ int PluginManager::getGlobalVariableHandle(EnergyPlusData &state, const std::string &name, bool const suppress_warning) { // note zero is a valid handle std::string const varNameUC = EnergyPlus::Util::makeUPPER(name); - auto const it = std::find(state.dataPluginManager->globalVariableNames.begin(), state.dataPluginManager->globalVariableNames.end(), varNameUC); - if (it != state.dataPluginManager->globalVariableNames.end()) { - return std::distance(state.dataPluginManager->globalVariableNames.begin(), it); + auto const &gVarNames = state.dataPluginManager->globalVariableNames; + auto const it = std::find(gVarNames.begin(), gVarNames.end(), varNameUC); + if (it != gVarNames.end()) { + return static_cast(std::distance(gVarNames.begin(), it)); } else { if (suppress_warning) { return -1; } else { EnergyPlus::ShowSevereError(state, "Tried to retrieve handle for a nonexistent plugin global variable"); EnergyPlus::ShowContinueError(state, format("Name looked up: \"{}\", available names: ", varNameUC)); - for (auto const &gvName : state.dataPluginManager->globalVariableNames) { + for (auto const &gvName : gVarNames) { EnergyPlus::ShowContinueError(state, format(" \"{}\"", gvName)); } EnergyPlus::ShowFatalError(state, "Plugin global variable problem causes program termination"); @@ -1213,7 +1292,7 @@ int PluginManager::getTrendVariableHandle(EnergyPlusData &state, const std::stri for (size_t i = 0; i < state.dataPluginManager->trends.size(); i++) { auto &thisTrend = state.dataPluginManager->trends[i]; if (thisTrend.name == varNameUC) { - return i; + return static_cast(i); } } return -1; @@ -1407,7 +1486,7 @@ int PluginManager::getLocationOfUserDefinedPlugin(EnergyPlusData &state, std::st for (size_t handle = 0; handle < state.dataPluginManager->plugins.size(); handle++) { auto const &thisPlugin = state.dataPluginManager->plugins[handle]; if (Util::makeUPPER(thisPlugin.emsAlias) == Util::makeUPPER(_programName)) { - return handle; + return static_cast(handle); } } return -1; diff --git a/src/EnergyPlus/PluginManager.hh b/src/EnergyPlus/PluginManager.hh index 34cf2084174..bafb7550bf5 100644 --- a/src/EnergyPlus/PluginManager.hh +++ b/src/EnergyPlus/PluginManager.hh @@ -183,6 +183,8 @@ namespace PluginManagement { explicit PluginManager(EnergyPlusData &state); ~PluginManager(); + static void initPython(EnergyPlusData &state, fs::path const &pathToPythonPackages); + static int numActiveCallbacks(EnergyPlusData &state); static void addToPythonPath(EnergyPlusData &state, const fs::path &includePath, bool userDefinedPath); static void setupOutputVariables(EnergyPlusData &state); From d2125a3171f5e4c8677052a95b8b0e8aef3ee1f6 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Fri, 22 Dec 2023 10:38:15 +0100 Subject: [PATCH 08/22] Request at least python 3.8 when LINK_WITH_PYTHON is enabled --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ceca25eec6e..4f8672e0ade 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -174,6 +174,7 @@ endif() # we are making *a Python 3.6 Interpreter* a required dependency, so find it here # If LINK_WITH_PYTHON, also request the Development (libs) at the same time, to ensure consistent version between interpreter and Development +# and ask for at least 3.8 (for the PyConfig stuff). if(LINK_WITH_PYTHON) # find_package(Python) has the problem that on github actions in particular it'll pick up the most recent python (eg 3.9) from the tool cache # even if you have used the setup-python action and set it to 3.8, so we make the exact version required @@ -184,7 +185,7 @@ if(LINK_WITH_PYTHON) if(Python_REQUIRED_VERSION) find_package(Python ${Python_REQUIRED_VERSION} EXACT COMPONENTS Interpreter Development REQUIRED) else() - find_package(Python 3.6 COMPONENTS Interpreter Development REQUIRED) + find_package(Python 3.8 COMPONENTS Interpreter Development REQUIRED) endif() else() find_package(Python 3.6 COMPONENTS Interpreter REQUIRED) From a59310a033fa9f7700b5ed75e4dc6ae96c3b17e5 Mon Sep 17 00:00:00 2001 From: Edwin Lee Date: Thu, 21 Dec 2023 14:43:46 -0600 Subject: [PATCH 09/22] Updated code, compiler warnings, format, etc. for Ubuntu 23.10/GCC 13.2/Python 3.11, definitely not ready as-is --- cmake/CompilerFlags.cmake | 12 +- src/ConvertInputFormat/main.cpp | 2 +- src/EnergyPlus/EPVector.hh | 16 +- src/EnergyPlus/FileSystem.hh | 4 +- src/EnergyPlus/HeatBalanceKivaManager.cc | 2 +- src/EnergyPlus/HeatPumpWaterToWaterCOOLING.hh | 9 +- src/EnergyPlus/IOFiles.hh | 21 +- .../PhaseChangeModeling/HysteresisModel.cc | 10 +- src/EnergyPlus/PoweredInductionUnits.hh | 6 +- src/EnergyPlus/StringUtilities.hh | 2 +- third_party/ssc/shared/lib_battery_lifetime.h | 4 +- .../unit/HVACVariableRefrigerantFlow.unit.cc | 468 +++++++++--------- .../unit/OutputReportTabular.unit.cc | 5 +- 13 files changed, 284 insertions(+), 277 deletions(-) diff --git a/cmake/CompilerFlags.cmake b/cmake/CompilerFlags.cmake index c622c9d0b1e..6367627154e 100644 --- a/cmake/CompilerFlags.cmake +++ b/cmake/CompilerFlags.cmake @@ -86,9 +86,10 @@ elseif(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" O # COMPILER FLAGS target_compile_options(project_options INTERFACE -pipe) # Faster compiler processing - target_compile_options(project_warnings INTERFACE -Wpedantic - )# Turn on warnings about constructs/situations that may be non-portable or outside of the standard - target_compile_options(project_warnings INTERFACE -Wall -Wextra) # Turn on warnings + target_compile_options(project_warnings INTERFACE -Wpedantic) + # Turn on warnings about constructs/situations that may be non-portable or outside of the standard + target_compile_options(project_warnings INTERFACE -Wall) # Turn on warnings + target_compile_options(project_warnings INTERFACE -Wextra) # Turn on warnings target_compile_options(project_warnings INTERFACE -Wno-unknown-pragmas) if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 9.0) target_compile_options(project_warnings INTERFACE -Wno-deprecated-copy) @@ -101,6 +102,11 @@ elseif(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" O target_compile_options(project_warnings INTERFACE -Wno-unused-but-set-parameter -Wno-unused-but-set-variable) target_compile_options(project_warnings INTERFACE -Wno-maybe-uninitialized) target_compile_options(project_warnings INTERFACE -Wno-aggressive-loop-optimizations) + # Sadly, GCC 13.2 is throwing many false positives on dangling references and compile time array-bounds + # https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=6b927b1297e66e26e62e722bf15c921dcbbd25b9 + target_compile_options(project_warnings INTERFACE -Wno-dangling-reference) + target_compile_options(project_warnings INTERFACE -Wno-array-bounds) + target_compile_options(project_warnings INTERFACE -Wno-stringop-overflow) elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang") if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.0) # Suppress unused-but-set warnings until more serious ones are addressed diff --git a/src/ConvertInputFormat/main.cpp b/src/ConvertInputFormat/main.cpp index 3efc0f46fa9..c6a8a3677c0 100644 --- a/src/ConvertInputFormat/main.cpp +++ b/src/ConvertInputFormat/main.cpp @@ -88,7 +88,7 @@ static constexpr std::array(OutputTypes::Num) static constexpr auto outputTypeExperimentalStart = OutputTypes::CBOR; -template void displayMessage(std::string_view str_format, Args &&... args) +template void displayMessage(std::string_view str_format, Args &&...args) { fmt::print(std::cout, str_format, args...); std::cout.write("\n", 1); diff --git a/src/EnergyPlus/EPVector.hh b/src/EnergyPlus/EPVector.hh index 9b5c02f294a..1cb6505b668 100644 --- a/src/EnergyPlus/EPVector.hh +++ b/src/EnergyPlus/EPVector.hh @@ -263,12 +263,12 @@ private: bool m_allocated{false}; }; -template [[nodiscard]] bool allocated(EPVector const &v) noexcept +template [[nodiscard]] bool allocated(EPVector const &v) noexcept { return v.allocated(); } -template [[nodiscard]] auto isize(const EPVector &v) noexcept +template [[nodiscard]] auto isize(const EPVector &v) noexcept { return v.isize(); } @@ -294,7 +294,7 @@ template [[nodiscard]] auto isize(const EPVector &v) noexcept return std::count_if(values.cbegin(), values.cend(), [](bool v) { return v; }); } -template [[nodiscard]] EPVector pack(EPVector const &v, EPVector const &mask) +template [[nodiscard]] EPVector pack(EPVector const &v, EPVector const &mask) { EPVector r; r.reserve(mask.size()); @@ -306,7 +306,7 @@ template [[nodiscard]] EPVector pack(EPVector const &v, EPVect return r; } -template [[nodiscard]] Array1D pack(Array1 const &a, EPVector const &mask) +template [[nodiscard]] Array1D pack(Array1 const &a, EPVector const &mask) { Array1D r; r.reserve(mask.size()); @@ -318,17 +318,17 @@ template [[nodiscard]] Array1D pack(Array1 const &a, EPVector< return r; } -template [[nodiscard]] T magnitude_squared(const EPVector &v) +template [[nodiscard]] T magnitude_squared(const EPVector &v) { return std::inner_product(v.begin(), v.end(), v.begin(), T{}); } -template [[nodiscard]] T dot(const EPVector &u, const V &v) +template [[nodiscard]] T dot(const EPVector &u, const V &v) { return std::inner_product(u.begin(), u.end(), v.begin(), T{}); } -template [[nodiscard]] Member maxval(EPVector const &a, Member Element::*pmem) +template [[nodiscard]] Member maxval(EPVector const &a, Member Element::*pmem) { Member v(a.empty() ? std::numeric_limits::lowest() : a(1).*pmem); for (int i = 2, e = a.isize(); i <= e; ++i) { @@ -343,7 +343,7 @@ template inline Member sum(EPVector return std::accumulate(c.cbegin(), c.cend(), 0.0, [&pmem](const Member &sum, const Element &e) { return sum + e.*pmem; }); } -template [[nodiscard]] T maxval(EPVector const &a) +template [[nodiscard]] T maxval(EPVector const &a) { auto max = std::max_element(a.begin(), a.end()); if (max == a.end()) { diff --git a/src/EnergyPlus/FileSystem.hh b/src/EnergyPlus/FileSystem.hh index a8c31c20300..b23b40f8364 100644 --- a/src/EnergyPlus/FileSystem.hh +++ b/src/EnergyPlus/FileSystem.hh @@ -229,8 +229,8 @@ namespace FileSystem { is_any, std::unique_ptr, std::unique_ptr, std::unique_ptr>::value; template - inline constexpr bool enable_json_v = is_all_json_type(fileType) && is_any::value && - !is_any::value; + inline constexpr bool enable_json_v = + is_all_json_type(fileType) && is_any::value && !is_any::value; template void writeFile(fs::path const &filePath, const std::string_view data) { diff --git a/src/EnergyPlus/HeatBalanceKivaManager.cc b/src/EnergyPlus/HeatBalanceKivaManager.cc index 435b29f05c0..ec82cb61fba 100644 --- a/src/EnergyPlus/HeatBalanceKivaManager.cc +++ b/src/EnergyPlus/HeatBalanceKivaManager.cc @@ -839,7 +839,7 @@ bool KivaManager::setupKivaInstances(EnergyPlusData &state) Real64 surfHeight = Surfaces(wl).get_average_height(state); // round to avoid numerical precision differences - surfHeight = std::round((surfHeight)*1000.0) / 1000.0; + surfHeight = std::round((surfHeight) * 1000.0) / 1000.0; if (combinationMap.count({Surfaces(wl).Construction, surfHeight}) == 0) { // create new combination diff --git a/src/EnergyPlus/HeatPumpWaterToWaterCOOLING.hh b/src/EnergyPlus/HeatPumpWaterToWaterCOOLING.hh index d8f995a4f53..589efb9ee43 100644 --- a/src/EnergyPlus/HeatPumpWaterToWaterCOOLING.hh +++ b/src/EnergyPlus/HeatPumpWaterToWaterCOOLING.hh @@ -128,11 +128,10 @@ namespace HeatPumpWaterToWaterCOOLING { MaxPartLoadRat(0.0), OptPartLoadRat(0.0), LoadSideVolFlowRate(0.0), LoadSideDesignMassFlow(0.0), SourceSideVolFlowRate(0.0), SourceSideDesignMassFlow(0.0), SourceSideInletNodeNum(0), SourceSideOutletNodeNum(0), LoadSideInletNodeNum(0), LoadSideOutletNodeNum(0), SourceSideUACoeff(0.0), LoadSideUACoeff(0.0), CompPistonDisp(0.0), CompClearanceFactor(0.0), CompSucPressDrop(0.0), SuperheatTemp(0.0), - PowerLosses(0.0), LossFactor(0.0), HighPressCutoff(0.0), LowPressCutoff(0.0), IsOn(false), - MustRun(false), SourcePlantLoc{}, LoadPlantLoc{}, CondMassFlowIndex(0), Power(0.0), Energy(0.0), QLoad(0.0), QLoadEnergy(0.0), - QSource(0.0), QSourceEnergy(0.0), LoadSideWaterInletTemp(0.0), SourceSideWaterInletTemp(0.0), LoadSideWaterOutletTemp(0.0), - SourceSideWaterOutletTemp(0.0), Running(0), LoadSideWaterMassFlowRate(0.0), SourceSideWaterMassFlowRate(0.0), plantScanFlag(true), - beginEnvironFlag(true) + PowerLosses(0.0), LossFactor(0.0), HighPressCutoff(0.0), LowPressCutoff(0.0), IsOn(false), MustRun(false), SourcePlantLoc{}, + LoadPlantLoc{}, CondMassFlowIndex(0), Power(0.0), Energy(0.0), QLoad(0.0), QLoadEnergy(0.0), QSource(0.0), QSourceEnergy(0.0), + LoadSideWaterInletTemp(0.0), SourceSideWaterInletTemp(0.0), LoadSideWaterOutletTemp(0.0), SourceSideWaterOutletTemp(0.0), Running(0), + LoadSideWaterMassFlowRate(0.0), SourceSideWaterMassFlowRate(0.0), plantScanFlag(true), beginEnvironFlag(true) { } diff --git a/src/EnergyPlus/IOFiles.hh b/src/EnergyPlus/IOFiles.hh index 01da0c23427..5991b069993 100644 --- a/src/EnergyPlus/IOFiles.hh +++ b/src/EnergyPlus/IOFiles.hh @@ -141,6 +141,9 @@ private: std::string_view spec_builder() { buffer.clear(); + // This line seems to be the culprit with some array-bounds warnings + // during compilation on GCC 13.2. I don't see how at the moment. + // I tried pragma-ing it away but it didn't help buffer.push_back('{'); buffer.push_back(':'); // [[fill]align][sign]["#"]["0"][width]["." precision]["L"][type] @@ -492,7 +495,7 @@ inline constexpr bool is_fortran_syntax(const std::string_view format_str) class InputOutputFile; template -void print(InputOutputFile &outputFile, std::string_view format_str, Args &&... args); +void print(InputOutputFile &outputFile, std::string_view format_str, Args &&...args); inline constexpr FormatSyntax check_syntax(const std::string_view format_str) { @@ -610,7 +613,7 @@ public: private: std::unique_ptr os; bool print_to_dev_null = false; - template friend void print(InputOutputFile &outputFile, std::string_view format_str, Args &&... args); + template friend void print(InputOutputFile &outputFile, std::string_view format_str, Args &&...args); friend class IOFiles; }; @@ -802,7 +805,7 @@ public: } }; -template void vprint(std::ostream &os, std::string_view format_str, const Args &... args) +template void vprint(std::ostream &os, std::string_view format_str, const Args &...args) { // assert(os.good()); auto buffer = fmt::memory_buffer(); @@ -814,7 +817,7 @@ template void vprint(std::ostream &os, std::string_view forma os.write(buffer.data(), buffer.size()); } -template std::string vprint(std::string_view format_str, const Args &... args) +template std::string vprint(std::string_view format_str, const Args &...args) { auto buffer = fmt::memory_buffer(); try { @@ -848,19 +851,19 @@ template std::string vprint(std::string_view format_str, cons // namespace { - template void print_fortran_syntax(std::ostream &os, std::string_view format_str, const Args &... args) + template void print_fortran_syntax(std::ostream &os, std::string_view format_str, const Args &...args) { EnergyPlus::vprint, DoubleWrapper, Args>...>(os, format_str, args...); } - template std::string format_fortran_syntax(std::string_view format_str, const Args &... args) + template std::string format_fortran_syntax(std::string_view format_str, const Args &...args) { return EnergyPlus::vprint, DoubleWrapper, Args>...>(format_str, args...); } } // namespace template -void print(std::ostream &os, std::string_view format_str, Args &&... args) +void print(std::ostream &os, std::string_view format_str, Args &&...args) { if constexpr (formatSyntax == FormatSyntax::Fortran) { print_fortran_syntax(os, format_str, args...); @@ -871,7 +874,7 @@ void print(std::ostream &os, std::string_view format_str, Args &&... args) } } -template void print(InputOutputFile &outputFile, std::string_view format_str, Args &&... args) +template void print(InputOutputFile &outputFile, std::string_view format_str, Args &&...args) { auto *outputStream = [&]() -> std::ostream * { if (outputFile.os) { @@ -894,7 +897,7 @@ template void print(InputOutputFil } } -template std::string format(std::string_view format_str, Args &&... args) +template std::string format(std::string_view format_str, Args &&...args) { if constexpr (formatSyntax == FormatSyntax::Fortran) { return format_fortran_syntax(format_str, args...); diff --git a/src/EnergyPlus/PhaseChangeModeling/HysteresisModel.cc b/src/EnergyPlus/PhaseChangeModeling/HysteresisModel.cc index 4094b42a302..8e3af8a8de2 100644 --- a/src/EnergyPlus/PhaseChangeModeling/HysteresisModel.cc +++ b/src/EnergyPlus/PhaseChangeModeling/HysteresisModel.cc @@ -165,7 +165,7 @@ namespace HysteresisPhaseChange { phaseChangeState = PhaseChangeStates::FREEZING; this->enthNew = this->getEnthalpy(updatedTempTDT, this->peakTempFreezing, this->deltaTempFreezingLow, this->deltaTempFreezingHigh); - } else if (this->enthNew < this->enthalpyF && this->enthNew > this->enthalpyM) { + } else if (this->enthNew > this->enthalpyM && this->enthNew < this->enthalpyF) { phaseChangeState = PhaseChangeStates::TRANSITION; this->enthNew = (this->specHeatTransition * updatedTempTDT) + (this->enthOld - (this->specHeatTransition * prevTempTD)); } else if (this->enthNew < this->enthalpyF && updatedTempTDT > phaseChangeTempReverse) { @@ -191,11 +191,11 @@ namespace HysteresisPhaseChange { this->enthNew = (this->specHeatTransition * updatedTempTDT) + (this->enthOld - (this->specHeatTransition * prevTempTD)); this->enthalpyM = this->getEnthalpy(updatedTempTDT, this->peakTempMelting, this->deltaTempMeltingLow, this->deltaTempMeltingHigh); this->enthalpyF = this->getEnthalpy(updatedTempTDT, this->peakTempMelting, this->deltaTempMeltingLow, this->deltaTempMeltingHigh); - if (updatedTempTDT < phaseChangeTempReverse && this->enthNew > this->enthalpyF) { + if (this->enthNew > this->enthalpyF && updatedTempTDT < phaseChangeTempReverse) { phaseChangeState = PhaseChangeStates::FREEZING; this->enthNew = this->getEnthalpy(updatedTempTDT, this->peakTempFreezing, this->deltaTempFreezingLow, this->deltaTempFreezingHigh); - } else if (this->enthNew < this->enthalpyF && this->enthNew > this->enthalpyM && + } else if (this->enthNew > this->enthalpyM && this->enthNew < this->enthalpyF && (updatedTempTDT < prevTempTD || updatedTempTDT > prevTempTD)) { phaseChangeState = PhaseChangeStates::TRANSITION; this->enthNew = @@ -211,7 +211,7 @@ namespace HysteresisPhaseChange { this->enthNew = (this->specHeatTransition * updatedTempTDT) + (this->enthRev - (this->specHeatTransition * phaseChangeTempReverse)); this->enthalpyM = this->getEnthalpy(updatedTempTDT, this->peakTempMelting, this->deltaTempMeltingLow, this->deltaTempMeltingHigh); this->enthalpyF = this->getEnthalpy(updatedTempTDT, this->peakTempFreezing, this->deltaTempFreezingLow, this->deltaTempFreezingHigh); - if (this->enthNew < this->enthalpyF && this->enthNew > this->enthalpyM) { + if (this->enthNew > this->enthalpyM && this->enthNew < this->enthalpyF) { phaseChangeState = PhaseChangeStates::TRANSITION; this->enthNew = (this->specHeatTransition * updatedTempTDT) + (this->enthRev - (this->specHeatTransition * phaseChangeTempReverse)); @@ -226,7 +226,7 @@ namespace HysteresisPhaseChange { if (this->enthNew < this->enthOld && updatedTempTDT < prevTempTD) { phaseChangeState = PhaseChangeStates::TRANSITION; this->enthNew = (this->specHeatTransition * updatedTempTDT) + (this->enthOld - (this->specHeatTransition * prevTempTD)); - } else if (this->enthNew < this->enthalpyF && this->enthNew > this->enthalpyM && updatedTempTDT < prevTempTD) { + } else if (this->enthNew > this->enthalpyM && this->enthNew < this->enthalpyF && updatedTempTDT < prevTempTD) { phaseChangeState = PhaseChangeStates::TRANSITION; this->enthNew = (this->specHeatTransition * updatedTempTDT) + (this->enthRev - (this->specHeatTransition * phaseChangeTempReverse)); diff --git a/src/EnergyPlus/PoweredInductionUnits.hh b/src/EnergyPlus/PoweredInductionUnits.hh index 0e8beca99f2..babe185b7c3 100644 --- a/src/EnergyPlus/PoweredInductionUnits.hh +++ b/src/EnergyPlus/PoweredInductionUnits.hh @@ -156,9 +156,9 @@ namespace PoweredInductionUnits { OutAirNode(0), HCoilInAirNode(0), ControlCompTypeNum(0), CompErrIndex(0), Mixer_Num(0), Fan_Num(0), Fan_Index(0), FanAvailSchedPtr(0), HCoilType(HtgCoilType::Invalid), HCoil_PlantType(DataPlant::PlantEquipmentType::Invalid), HCoil_Index(0), HCoil_FluidIndex(0), MaxVolHotWaterFlow(0.0), MaxVolHotSteamFlow(0.0), MaxHotWaterFlow(0.0), MaxHotSteamFlow(0.0), MinVolHotWaterFlow(0.0), - MinHotSteamFlow(0.0), MinVolHotSteamFlow(0.0), MinHotWaterFlow(0.0), HotControlNode(0), HotCoilOutNodeNum(0), - HotControlOffset(0.0), HWplantLoc{}, ADUNum(0), InducesPlenumAir(false), HeatingRate(0.0), HeatingEnergy(0.0), SensCoolRate(0.0), - SensCoolEnergy(0.0), CtrlZoneNum(0), ctrlZoneInNodeIndex(0), AirLoopNum(0), OutdoorAirFlowRate(0.0) + MinHotSteamFlow(0.0), MinVolHotSteamFlow(0.0), MinHotWaterFlow(0.0), HotControlNode(0), HotCoilOutNodeNum(0), HotControlOffset(0.0), + HWplantLoc{}, ADUNum(0), InducesPlenumAir(false), HeatingRate(0.0), HeatingEnergy(0.0), SensCoolRate(0.0), SensCoolEnergy(0.0), + CtrlZoneNum(0), ctrlZoneInNodeIndex(0), AirLoopNum(0), OutdoorAirFlowRate(0.0) { } diff --git a/src/EnergyPlus/StringUtilities.hh b/src/EnergyPlus/StringUtilities.hh index 2748eb14369..3f12c78a384 100644 --- a/src/EnergyPlus/StringUtilities.hh +++ b/src/EnergyPlus/StringUtilities.hh @@ -157,7 +157,7 @@ inline auto nth_occurrence(std::string_view input_str, char const search_char, s return pos; } -template bool readList(std::string_view input, Param &&... param) +template bool readList(std::string_view input, Param &&...param) { if constexpr (std::conjunction_v...> || std::conjunction_v...>) { size_t index = 0; diff --git a/third_party/ssc/shared/lib_battery_lifetime.h b/third_party/ssc/shared/lib_battery_lifetime.h index 7c0c5cf1799..fc6298a93e0 100644 --- a/third_party/ssc/shared/lib_battery_lifetime.h +++ b/third_party/ssc/shared/lib_battery_lifetime.h @@ -68,7 +68,7 @@ struct lifetime_state { lifetime_state(const std::shared_ptr& cyc, const std::shared_ptr& cal); - lifetime_state(const std::shared_ptr& nmc); + explicit lifetime_state(const std::shared_ptr& nmc); lifetime_state &operator=(const lifetime_state &rhs); @@ -81,7 +81,7 @@ class lifetime_t { lifetime_t(const lifetime_t &rhs); - virtual lifetime_t &operator=(const lifetime_t &rhs); + lifetime_t &operator=(const lifetime_t &rhs); virtual lifetime_t *clone() = 0; diff --git a/tst/EnergyPlus/unit/HVACVariableRefrigerantFlow.unit.cc b/tst/EnergyPlus/unit/HVACVariableRefrigerantFlow.unit.cc index 68f17f37af8..17f2a681acf 100644 --- a/tst/EnergyPlus/unit/HVACVariableRefrigerantFlow.unit.cc +++ b/tst/EnergyPlus/unit/HVACVariableRefrigerantFlow.unit.cc @@ -2487,109 +2487,109 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_VRFOU_Compressor) } // Run and Check: VRFOU_CompSpd - {// Test the method VRFOU_CompSpd, which calculates the compressor speed at given - // operational conditions to meet the evaporator or condenser capacity provided. + { // Test the method VRFOU_CompSpd, which calculates the compressor speed at given + // operational conditions to meet the evaporator or condenser capacity provided. - {// a. Evaporator + { // a. Evaporator - // Inputs_condition - Real64 constexpr Q_req = 6971; // Required capacity [W] - Real64 constexpr T_suction = -13.35; // Compressor suction temperature Te' [C] - Real64 constexpr T_discharge = 36.37; // Compressor discharge temperature Tc' [C] - Real64 constexpr h_IU_evap_in = 225016; // Enthalpy of IU at inlet, for C_cap_operation calculation [kJ/kg] - Real64 constexpr h_comp_in = 429529; // Enthalpy after piping loss (compressor inlet), for C_cap_operation calculation [kJ/kg] - Real64 CompSpdActual; // Actual compressor running speed [rps] + // Inputs_condition + Real64 constexpr Q_req = 6971; // Required capacity [W] + Real64 constexpr T_suction = -13.35; // Compressor suction temperature Te' [C] + Real64 constexpr T_discharge = 36.37; // Compressor discharge temperature Tc' [C] + Real64 constexpr h_IU_evap_in = 225016; // Enthalpy of IU at inlet, for C_cap_operation calculation [kJ/kg] + Real64 constexpr h_comp_in = 429529; // Enthalpy after piping loss (compressor inlet), for C_cap_operation calculation [kJ/kg] + Real64 CompSpdActual; // Actual compressor running speed [rps] - // Run - state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_CompSpd( - *state, Q_req, HXOpMode::EvapMode, T_suction, T_discharge, h_IU_evap_in, h_comp_in, CompSpdActual); + // Run + state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_CompSpd( + *state, Q_req, HXOpMode::EvapMode, T_suction, T_discharge, h_IU_evap_in, h_comp_in, CompSpdActual); - // Test - EXPECT_NEAR(1295, CompSpdActual, 5); -} + // Test + EXPECT_NEAR(1295, CompSpdActual, 5); + } -{ - // b. Condenser - - // Inputs_condition - Real64 constexpr Q_req = 6953; // Required capacity [W] - Real64 constexpr T_suction = -13.35; // Compressor suction temperature Te' [C] - Real64 constexpr T_discharge = 36.37; // Compressor discharge temperature Tc' [C] - Real64 constexpr h_IU_evap_in = 225016; // Enthalpy of IU at inlet, for C_cap_operation calculation [kJ/kg] - Real64 constexpr h_comp_in = 429529; // Enthalpy after piping loss (compressor inlet), for C_cap_operation calculation [kJ/kg] - Real64 CompSpdActual; // Actual compressor running speed [rps] - - // Run - state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_CompSpd( - *state, Q_req, HXOpMode::CondMode, T_suction, T_discharge, h_IU_evap_in, h_comp_in, CompSpdActual); - - // Test - EXPECT_NEAR(950, CompSpdActual, 5); -} -} // namespace EnergyPlus + { + // b. Condenser -// Run and Check: VRFOU_CompCap -{ - // Test the method VRFOU_CompCap, which calculates the compressor performance (power and capacity) - // at given compressor speed and operational conditions. - - // Inputs_condition - Real64 constexpr CompSpdActual = 1298; // Actual compressor running speed [rps] - Real64 constexpr T_suction = -13.35; // Compressor suction temperature Te' [C] - Real64 constexpr T_discharge = 36.37; // Compressor discharge temperature Tc' [C] - Real64 constexpr h_IU_evap_in = 225016; // Enthalpy of IU at inlet, for C_cap_operation calculation [kJ/kg] - Real64 constexpr h_comp_in = 429529; // Enthalpy after piping loss (compressor inlet), for C_cap_operation calculation [kJ/kg] - Real64 Q_c_tot; // Compressor evaporative capacity [W] - Real64 Ncomp; // Compressor power [W] - - // Run - state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_CompCap(*state, CompSpdActual, T_suction, T_discharge, h_IU_evap_in, h_comp_in, Q_c_tot, Ncomp); - - // Test - EXPECT_NEAR(6990, Q_c_tot, 10); - EXPECT_NEAR(1601, Ncomp, 10); -} + // Inputs_condition + Real64 constexpr Q_req = 6953; // Required capacity [W] + Real64 constexpr T_suction = -13.35; // Compressor suction temperature Te' [C] + Real64 constexpr T_discharge = 36.37; // Compressor discharge temperature Tc' [C] + Real64 constexpr h_IU_evap_in = 225016; // Enthalpy of IU at inlet, for C_cap_operation calculation [kJ/kg] + Real64 constexpr h_comp_in = 429529; // Enthalpy after piping loss (compressor inlet), for C_cap_operation calculation [kJ/kg] + Real64 CompSpdActual; // Actual compressor running speed [rps] -// Run and Check: VRFOU_CalcComp -{ - // Test the method VRFOU_CalcCompH, which simulates the compressor performance at given oprtaional conditions. More specifically, it - // sepcifies the compressor speed to provide sufficient evaporative capacity, and calculate the power of the compressor running at the - // specified speed. Note that it may be needed to manipulate the operational conditions to further adjust system capacity at low load - // conditions. The low load modification logics are different for cooling mode and heating mode. - - // Inputs_condition - Real64 TU_load = 6006; // Indoor unit cooling load [W] - Real64 T_suction = 8.86; // Compressor suction temperature Te' [C] - Real64 T_discharge = 40.26; // Compressor discharge temperature Tc' [C] - Real64 Pipe_h_out_ave = 233428; // Average Enthalpy of the refrigerant leaving IUs [kJ/kg] - Real64 IUMaxCondTemp = 36; // VRV IU condensing temperature, max among all indoor units [C] - Real64 MinOutdoorUnitTe = -72; // The minimum temperature that OU Te can be at cooling mode (only used for calculating Min capacity) - Real64 Tfs = 10.90; // Temperature of the air at the OU evaporator coil surface [C]] - Real64 Pipe_Q = 162.67; // Piping Loss Algorithm Parameter: Heat loss [W] - Real64 OUEvapHeatExtract = 5110.40; // Evaporator heat extract [W] - Real64 Ncomp = 1058; // Compressor power [W] - Real64 CompSpdActual; // Actual compressor running speed [rps] - - // Run - state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_CalcCompH(*state, - TU_load, - T_suction, - T_discharge, - Pipe_h_out_ave, - IUMaxCondTemp, - MinOutdoorUnitTe, - Tfs, - Pipe_Q, - OUEvapHeatExtract, - CompSpdActual, - Ncomp); - - // Test - EXPECT_NEAR(5110, OUEvapHeatExtract, 1); - EXPECT_NEAR(1500, CompSpdActual, 1); - EXPECT_NEAR(2080, Ncomp, 1); - EXPECT_EQ(state->dataLoopNodes->Node(state->dataHVACVarRefFlow->VRFTU(1).VRFTUInletNodeNum).MassFlowRate, 0.0); -} + // Run + state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_CompSpd( + *state, Q_req, HXOpMode::CondMode, T_suction, T_discharge, h_IU_evap_in, h_comp_in, CompSpdActual); + + // Test + EXPECT_NEAR(950, CompSpdActual, 5); + } + } // namespace EnergyPlus + + // Run and Check: VRFOU_CompCap + { + // Test the method VRFOU_CompCap, which calculates the compressor performance (power and capacity) + // at given compressor speed and operational conditions. + + // Inputs_condition + Real64 constexpr CompSpdActual = 1298; // Actual compressor running speed [rps] + Real64 constexpr T_suction = -13.35; // Compressor suction temperature Te' [C] + Real64 constexpr T_discharge = 36.37; // Compressor discharge temperature Tc' [C] + Real64 constexpr h_IU_evap_in = 225016; // Enthalpy of IU at inlet, for C_cap_operation calculation [kJ/kg] + Real64 constexpr h_comp_in = 429529; // Enthalpy after piping loss (compressor inlet), for C_cap_operation calculation [kJ/kg] + Real64 Q_c_tot; // Compressor evaporative capacity [W] + Real64 Ncomp; // Compressor power [W] + + // Run + state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_CompCap(*state, CompSpdActual, T_suction, T_discharge, h_IU_evap_in, h_comp_in, Q_c_tot, Ncomp); + + // Test + EXPECT_NEAR(6990, Q_c_tot, 10); + EXPECT_NEAR(1601, Ncomp, 10); + } + + // Run and Check: VRFOU_CalcComp + { + // Test the method VRFOU_CalcCompH, which simulates the compressor performance at given oprtaional conditions. More specifically, it + // sepcifies the compressor speed to provide sufficient evaporative capacity, and calculate the power of the compressor running at the + // specified speed. Note that it may be needed to manipulate the operational conditions to further adjust system capacity at low load + // conditions. The low load modification logics are different for cooling mode and heating mode. + + // Inputs_condition + Real64 TU_load = 6006; // Indoor unit cooling load [W] + Real64 T_suction = 8.86; // Compressor suction temperature Te' [C] + Real64 T_discharge = 40.26; // Compressor discharge temperature Tc' [C] + Real64 Pipe_h_out_ave = 233428; // Average Enthalpy of the refrigerant leaving IUs [kJ/kg] + Real64 IUMaxCondTemp = 36; // VRV IU condensing temperature, max among all indoor units [C] + Real64 MinOutdoorUnitTe = -72; // The minimum temperature that OU Te can be at cooling mode (only used for calculating Min capacity) + Real64 Tfs = 10.90; // Temperature of the air at the OU evaporator coil surface [C]] + Real64 Pipe_Q = 162.67; // Piping Loss Algorithm Parameter: Heat loss [W] + Real64 OUEvapHeatExtract = 5110.40; // Evaporator heat extract [W] + Real64 Ncomp = 1058; // Compressor power [W] + Real64 CompSpdActual; // Actual compressor running speed [rps] + + // Run + state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_CalcCompH(*state, + TU_load, + T_suction, + T_discharge, + Pipe_h_out_ave, + IUMaxCondTemp, + MinOutdoorUnitTe, + Tfs, + Pipe_Q, + OUEvapHeatExtract, + CompSpdActual, + Ncomp); + + // Test + EXPECT_NEAR(5110, OUEvapHeatExtract, 1); + EXPECT_NEAR(1500, CompSpdActual, 1); + EXPECT_NEAR(2080, Ncomp, 1); + EXPECT_EQ(state->dataLoopNodes->Node(state->dataHVACVarRefFlow->VRFTU(1).VRFTUInletNodeNum).MassFlowRate, 0.0); + } } TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_VRFOU_Coil) @@ -2632,163 +2632,165 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_VRFOU_Coil) InitializePsychRoutines(*state); // Run and Check: VRFOU_Cap - { // Test the method VRFOU_Cap, which determines the VRF OU heat transfer rate, given refrigerant side temperature, - // i.e., condensing temperature and SC for condenser, or evaporating temperature and SH for evaporator. - {// a. Condenser - - // Inputs_condition - m_air = 3.6; - OutDryBulbTemp = 28; - OutHumRat = 0.0146; - SC = 1; - Tdischarge = 36; - - // Run - Q_h_OU = state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_Cap(*state, HXOpMode::CondMode, Tdischarge, SC, m_air, OutDryBulbTemp, OutHumRat); - - // Test - EXPECT_NEAR(27551, Q_h_OU, 10); -} - -{ - // b. Evaporator - - // Inputs_condition - m_air = 3.6; - OutDryBulbTemp = 7; - OutHumRat = 0.0019; - SH = 1; - Tsuction = -3; - - // Run - Q_c_OU = state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_Cap(*state, HXOpMode::EvapMode, Tsuction, SH, m_air, OutDryBulbTemp, OutHumRat); - - // Test - EXPECT_NEAR(24456, Q_c_OU, 10); -} -} // namespace EnergyPlus - -// Run and Check: VRFOU_FlowRate -{ // Test the method VRFOU_Cap, which calculates the outdoor unit fan flow rate, given VRF OU load and refrigerant side temperature, i.e., - // condensing temperature and SC for condenser, or evaporating temperature and SH for evaporator. - {// a. Condenser + { // Test the method VRFOU_Cap, which determines the VRF OU heat transfer rate, given refrigerant side temperature, + // i.e., condensing temperature and SC for condenser, or evaporating temperature and SH for evaporator. + { // a. Condenser + + // Inputs_condition + m_air = 3.6; + OutDryBulbTemp = 28; + OutHumRat = 0.0146; + SC = 1; + Tdischarge = 36; + + // Run + Q_h_OU = state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_Cap(*state, HXOpMode::CondMode, Tdischarge, SC, m_air, OutDryBulbTemp, OutHumRat); + + // Test + EXPECT_NEAR(27551, Q_h_OU, 10); + } - // Inputs_condition - Q_h_OU = 27551; -OutDryBulbTemp = 28; -OutHumRat = 0.0146; -SC = 1; -Tdischarge = 36; + { + // b. Evaporator -// Run -m_air = state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_FlowRate(*state, HXOpMode::CondMode, Tdischarge, SC, Q_h_OU, OutDryBulbTemp, OutHumRat); + // Inputs_condition + m_air = 3.6; + OutDryBulbTemp = 7; + OutHumRat = 0.0019; + SH = 1; + Tsuction = -3; -// Test -EXPECT_NEAR(3.6, m_air, 0.01); -} + // Run + Q_c_OU = state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_Cap(*state, HXOpMode::EvapMode, Tsuction, SH, m_air, OutDryBulbTemp, OutHumRat); -{ - // b. Evaporator + // Test + EXPECT_NEAR(24456, Q_c_OU, 10); + } + } // namespace EnergyPlus + + // Run and Check: VRFOU_FlowRate + { // Test the method VRFOU_Cap, which calculates the outdoor unit fan flow rate, given VRF OU load and refrigerant side temperature, i.e., + // condensing temperature and SC for condenser, or evaporating temperature and SH for evaporator. + { // a. Condenser + + // Inputs_condition + Q_h_OU = 27551; + OutDryBulbTemp = 28; + OutHumRat = 0.0146; + SC = 1; + Tdischarge = 36; + + // Run + m_air = + state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_FlowRate(*state, HXOpMode::CondMode, Tdischarge, SC, Q_h_OU, OutDryBulbTemp, OutHumRat); + + // Test + EXPECT_NEAR(3.6, m_air, 0.01); + } - // Inputs_condition - Q_c_OU = 24456; - OutDryBulbTemp = 7; - OutHumRat = 0.0019; - SH = 1; - Tsuction = -3; + { + // b. Evaporator - // Run - m_air = state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_FlowRate(*state, HXOpMode::EvapMode, Tsuction, SH, Q_c_OU, OutDryBulbTemp, OutHumRat); + // Inputs_condition + Q_c_OU = 24456; + OutDryBulbTemp = 7; + OutHumRat = 0.0019; + SH = 1; + Tsuction = -3; - // Test - EXPECT_NEAR(3.6, m_air, 0.01); -} -} + // Run + m_air = + state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_FlowRate(*state, HXOpMode::EvapMode, Tsuction, SH, Q_c_OU, OutDryBulbTemp, OutHumRat); -// Run and Check: VRFOU_TeTc -{ // Test the method VRFOU_Cap, which calculates the VRF OU refrigerant side temperature, i.e., condensing temperature - // at cooling mode, or evaporating temperature at heating mode, given the coil heat - // release/extract amount and air side parameters. - {// a. Condenser - - // Inputs_condition - m_air = 3.6; -Q_h_OU = 27551; -OutDryBulbTemp = 28; -OutHumRat = 0.0146; -SC = 1; - -// Run -state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_TeTc( - *state, HXOpMode::CondMode, Q_h_OU, SC, m_air, OutDryBulbTemp, OutHumRat, OutBaroPress, temp, Tdischarge); - -// Test -EXPECT_NEAR(36, Tdischarge, 0.05); -} + // Test + EXPECT_NEAR(3.6, m_air, 0.01); + } + } -{ - // b. Evaporator - - // Inputs_condition - m_air = 3.6; - Q_c_OU = 24456; - OutDryBulbTemp = 7; - OutHumRat = 0.0019; - SH = 1; - Tsuction = -3; - - // Run - state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_TeTc( - *state, HXOpMode::EvapMode, Q_c_OU, SH, m_air, OutDryBulbTemp, OutHumRat, OutBaroPress, temp, Tsuction); - - // Test - EXPECT_NEAR(-3, Tsuction, 0.05); -} -} + // Run and Check: VRFOU_TeTc + { // Test the method VRFOU_Cap, which calculates the VRF OU refrigerant side temperature, i.e., condensing temperature + // at cooling mode, or evaporating temperature at heating mode, given the coil heat + // release/extract amount and air side parameters. + { // a. Condenser + + // Inputs_condition + m_air = 3.6; + Q_h_OU = 27551; + OutDryBulbTemp = 28; + OutHumRat = 0.0146; + SC = 1; + + // Run + state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_TeTc( + *state, HXOpMode::CondMode, Q_h_OU, SC, m_air, OutDryBulbTemp, OutHumRat, OutBaroPress, temp, Tdischarge); + + // Test + EXPECT_NEAR(36, Tdischarge, 0.05); + } -// Run and Check: VRFOU_SCSH -{ - // Test the method VRFOU_Cap, which calculates the VRF OU refrigerant side temperature, i.e., condensing temperature - // at cooling mode, or evaporating temperature at heating mode, given the coil heat - // release/extract amount and air side parameters. - { - // a. Condenser + { + // b. Evaporator - // Inputs_condition - m_air = 3.6; - Q_h_OU = 27551; - OutDryBulbTemp = 28; - OutHumRat = 0.0146; - Tdischarge = 36; + // Inputs_condition + m_air = 3.6; + Q_c_OU = 24456; + OutDryBulbTemp = 7; + OutHumRat = 0.0019; + SH = 1; + Tsuction = -3; - // Run - SC = state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_SCSH( - *state, HXOpMode::CondMode, Q_h_OU, Tdischarge, m_air, OutDryBulbTemp, OutHumRat, OutBaroPress); + // Run + state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_TeTc( + *state, HXOpMode::EvapMode, Q_c_OU, SH, m_air, OutDryBulbTemp, OutHumRat, OutBaroPress, temp, Tsuction); - // Test - EXPECT_NEAR(1, SC, 0.01); + // Test + EXPECT_NEAR(-3, Tsuction, 0.05); + } } + // Run and Check: VRFOU_SCSH { - // b. Evaporator + // Test the method VRFOU_Cap, which calculates the VRF OU refrigerant side temperature, i.e., condensing temperature + // at cooling mode, or evaporating temperature at heating mode, given the coil heat + // release/extract amount and air side parameters. + { + // a. Condenser + + // Inputs_condition + m_air = 3.6; + Q_h_OU = 27551; + OutDryBulbTemp = 28; + OutHumRat = 0.0146; + Tdischarge = 36; + + // Run + SC = state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_SCSH( + *state, HXOpMode::CondMode, Q_h_OU, Tdischarge, m_air, OutDryBulbTemp, OutHumRat, OutBaroPress); + + // Test + EXPECT_NEAR(1, SC, 0.01); + } - // Inputs_condition - m_air = 3.6; - Q_c_OU = 24456; - OutDryBulbTemp = 7; - OutHumRat = 0.0019; - Tsuction = -3; + { + // b. Evaporator - // Run - SH = state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_SCSH( - *state, HXOpMode::EvapMode, Q_c_OU, Tsuction, m_air, OutDryBulbTemp, OutHumRat, OutBaroPress); + // Inputs_condition + m_air = 3.6; + Q_c_OU = 24456; + OutDryBulbTemp = 7; + OutHumRat = 0.0019; + Tsuction = -3; - // Test - EXPECT_NEAR(1, SH, 0.01); + // Run + SH = state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_SCSH( + *state, HXOpMode::EvapMode, Q_c_OU, Tsuction, m_air, OutDryBulbTemp, OutHumRat, OutBaroPress); + + // Test + EXPECT_NEAR(1, SH, 0.01); + } } -} -// Clean up -state->dataHVACVarRefFlow->VRF.deallocate(); + // Clean up + state->dataHVACVarRefFlow->VRF.deallocate(); } TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_GetCoilInput) diff --git a/tst/EnergyPlus/unit/OutputReportTabular.unit.cc b/tst/EnergyPlus/unit/OutputReportTabular.unit.cc index 02079680f88..02bf71ec73b 100644 --- a/tst/EnergyPlus/unit/OutputReportTabular.unit.cc +++ b/tst/EnergyPlus/unit/OutputReportTabular.unit.cc @@ -7208,10 +7208,7 @@ TEST_F(SQLiteFixture, OutputReportTabular_WriteLoadComponentSummaryTables_AirLoo state->dataSize->SysSizInput.allocate(state->dataSize->NumSysSizInput); state->dataSize->SysSizInput(1).AirLoopNum = 1; state->dataSize->SysSizInput(1).SizingOption = DataSizing::NonCoincident; - auto degC_to_F = [](Real64 celsius) constexpr - { - return celsius * (9.0 / 5.0) + 32.0; - }; + auto degC_to_F = [](Real64 celsius) constexpr { return celsius * (9.0 / 5.0) + 32.0; }; constexpr Real64 coolMixTempSys = 26.2; constexpr Real64 coolMixTempSysIP = degC_to_F(coolMixTempSys); constexpr Real64 heatMixTempSys = -1.7; From ce006a6c451de2141962fe3b2c6debaacb59bc9e Mon Sep 17 00:00:00 2001 From: Edwin Lee Date: Thu, 21 Dec 2023 20:22:00 -0600 Subject: [PATCH 10/22] Go back to using Clang Format 10, should pass happily now --- src/ConvertInputFormat/main.cpp | 2 +- src/EnergyPlus/EPVector.hh | 16 +- src/EnergyPlus/FileSystem.hh | 4 +- src/EnergyPlus/HeatBalanceKivaManager.cc | 2 +- src/EnergyPlus/HeatPumpWaterToWaterCOOLING.hh | 9 +- src/EnergyPlus/IOFiles.hh | 18 +- src/EnergyPlus/PoweredInductionUnits.hh | 6 +- src/EnergyPlus/StringUtilities.hh | 2 +- .../unit/HVACVariableRefrigerantFlow.unit.cc | 468 +++++++++--------- .../unit/OutputReportTabular.unit.cc | 5 +- 10 files changed, 267 insertions(+), 265 deletions(-) diff --git a/src/ConvertInputFormat/main.cpp b/src/ConvertInputFormat/main.cpp index c6a8a3677c0..3efc0f46fa9 100644 --- a/src/ConvertInputFormat/main.cpp +++ b/src/ConvertInputFormat/main.cpp @@ -88,7 +88,7 @@ static constexpr std::array(OutputTypes::Num) static constexpr auto outputTypeExperimentalStart = OutputTypes::CBOR; -template void displayMessage(std::string_view str_format, Args &&...args) +template void displayMessage(std::string_view str_format, Args &&... args) { fmt::print(std::cout, str_format, args...); std::cout.write("\n", 1); diff --git a/src/EnergyPlus/EPVector.hh b/src/EnergyPlus/EPVector.hh index 1cb6505b668..9b5c02f294a 100644 --- a/src/EnergyPlus/EPVector.hh +++ b/src/EnergyPlus/EPVector.hh @@ -263,12 +263,12 @@ private: bool m_allocated{false}; }; -template [[nodiscard]] bool allocated(EPVector const &v) noexcept +template [[nodiscard]] bool allocated(EPVector const &v) noexcept { return v.allocated(); } -template [[nodiscard]] auto isize(const EPVector &v) noexcept +template [[nodiscard]] auto isize(const EPVector &v) noexcept { return v.isize(); } @@ -294,7 +294,7 @@ template [[nodiscard]] auto isize(const EPVector &v) noexcept return std::count_if(values.cbegin(), values.cend(), [](bool v) { return v; }); } -template [[nodiscard]] EPVector pack(EPVector const &v, EPVector const &mask) +template [[nodiscard]] EPVector pack(EPVector const &v, EPVector const &mask) { EPVector r; r.reserve(mask.size()); @@ -306,7 +306,7 @@ template [[nodiscard]] EPVector pack(EPVector const &v, EPVec return r; } -template [[nodiscard]] Array1D pack(Array1 const &a, EPVector const &mask) +template [[nodiscard]] Array1D pack(Array1 const &a, EPVector const &mask) { Array1D r; r.reserve(mask.size()); @@ -318,17 +318,17 @@ template [[nodiscard]] Array1D pack(Array1 const &a, EPVector return r; } -template [[nodiscard]] T magnitude_squared(const EPVector &v) +template [[nodiscard]] T magnitude_squared(const EPVector &v) { return std::inner_product(v.begin(), v.end(), v.begin(), T{}); } -template [[nodiscard]] T dot(const EPVector &u, const V &v) +template [[nodiscard]] T dot(const EPVector &u, const V &v) { return std::inner_product(u.begin(), u.end(), v.begin(), T{}); } -template [[nodiscard]] Member maxval(EPVector const &a, Member Element::*pmem) +template [[nodiscard]] Member maxval(EPVector const &a, Member Element::*pmem) { Member v(a.empty() ? std::numeric_limits::lowest() : a(1).*pmem); for (int i = 2, e = a.isize(); i <= e; ++i) { @@ -343,7 +343,7 @@ template inline Member sum(EPVector return std::accumulate(c.cbegin(), c.cend(), 0.0, [&pmem](const Member &sum, const Element &e) { return sum + e.*pmem; }); } -template [[nodiscard]] T maxval(EPVector const &a) +template [[nodiscard]] T maxval(EPVector const &a) { auto max = std::max_element(a.begin(), a.end()); if (max == a.end()) { diff --git a/src/EnergyPlus/FileSystem.hh b/src/EnergyPlus/FileSystem.hh index b23b40f8364..a8c31c20300 100644 --- a/src/EnergyPlus/FileSystem.hh +++ b/src/EnergyPlus/FileSystem.hh @@ -229,8 +229,8 @@ namespace FileSystem { is_any, std::unique_ptr, std::unique_ptr, std::unique_ptr>::value; template - inline constexpr bool enable_json_v = - is_all_json_type(fileType) && is_any::value && !is_any::value; + inline constexpr bool enable_json_v = is_all_json_type(fileType) && is_any::value && + !is_any::value; template void writeFile(fs::path const &filePath, const std::string_view data) { diff --git a/src/EnergyPlus/HeatBalanceKivaManager.cc b/src/EnergyPlus/HeatBalanceKivaManager.cc index ec82cb61fba..435b29f05c0 100644 --- a/src/EnergyPlus/HeatBalanceKivaManager.cc +++ b/src/EnergyPlus/HeatBalanceKivaManager.cc @@ -839,7 +839,7 @@ bool KivaManager::setupKivaInstances(EnergyPlusData &state) Real64 surfHeight = Surfaces(wl).get_average_height(state); // round to avoid numerical precision differences - surfHeight = std::round((surfHeight) * 1000.0) / 1000.0; + surfHeight = std::round((surfHeight)*1000.0) / 1000.0; if (combinationMap.count({Surfaces(wl).Construction, surfHeight}) == 0) { // create new combination diff --git a/src/EnergyPlus/HeatPumpWaterToWaterCOOLING.hh b/src/EnergyPlus/HeatPumpWaterToWaterCOOLING.hh index 589efb9ee43..d8f995a4f53 100644 --- a/src/EnergyPlus/HeatPumpWaterToWaterCOOLING.hh +++ b/src/EnergyPlus/HeatPumpWaterToWaterCOOLING.hh @@ -128,10 +128,11 @@ namespace HeatPumpWaterToWaterCOOLING { MaxPartLoadRat(0.0), OptPartLoadRat(0.0), LoadSideVolFlowRate(0.0), LoadSideDesignMassFlow(0.0), SourceSideVolFlowRate(0.0), SourceSideDesignMassFlow(0.0), SourceSideInletNodeNum(0), SourceSideOutletNodeNum(0), LoadSideInletNodeNum(0), LoadSideOutletNodeNum(0), SourceSideUACoeff(0.0), LoadSideUACoeff(0.0), CompPistonDisp(0.0), CompClearanceFactor(0.0), CompSucPressDrop(0.0), SuperheatTemp(0.0), - PowerLosses(0.0), LossFactor(0.0), HighPressCutoff(0.0), LowPressCutoff(0.0), IsOn(false), MustRun(false), SourcePlantLoc{}, - LoadPlantLoc{}, CondMassFlowIndex(0), Power(0.0), Energy(0.0), QLoad(0.0), QLoadEnergy(0.0), QSource(0.0), QSourceEnergy(0.0), - LoadSideWaterInletTemp(0.0), SourceSideWaterInletTemp(0.0), LoadSideWaterOutletTemp(0.0), SourceSideWaterOutletTemp(0.0), Running(0), - LoadSideWaterMassFlowRate(0.0), SourceSideWaterMassFlowRate(0.0), plantScanFlag(true), beginEnvironFlag(true) + PowerLosses(0.0), LossFactor(0.0), HighPressCutoff(0.0), LowPressCutoff(0.0), IsOn(false), + MustRun(false), SourcePlantLoc{}, LoadPlantLoc{}, CondMassFlowIndex(0), Power(0.0), Energy(0.0), QLoad(0.0), QLoadEnergy(0.0), + QSource(0.0), QSourceEnergy(0.0), LoadSideWaterInletTemp(0.0), SourceSideWaterInletTemp(0.0), LoadSideWaterOutletTemp(0.0), + SourceSideWaterOutletTemp(0.0), Running(0), LoadSideWaterMassFlowRate(0.0), SourceSideWaterMassFlowRate(0.0), plantScanFlag(true), + beginEnvironFlag(true) { } diff --git a/src/EnergyPlus/IOFiles.hh b/src/EnergyPlus/IOFiles.hh index 5991b069993..b7dcea12eb9 100644 --- a/src/EnergyPlus/IOFiles.hh +++ b/src/EnergyPlus/IOFiles.hh @@ -495,7 +495,7 @@ inline constexpr bool is_fortran_syntax(const std::string_view format_str) class InputOutputFile; template -void print(InputOutputFile &outputFile, std::string_view format_str, Args &&...args); +void print(InputOutputFile &outputFile, std::string_view format_str, Args &&... args); inline constexpr FormatSyntax check_syntax(const std::string_view format_str) { @@ -613,7 +613,7 @@ public: private: std::unique_ptr os; bool print_to_dev_null = false; - template friend void print(InputOutputFile &outputFile, std::string_view format_str, Args &&...args); + template friend void print(InputOutputFile &outputFile, std::string_view format_str, Args &&... args); friend class IOFiles; }; @@ -805,7 +805,7 @@ public: } }; -template void vprint(std::ostream &os, std::string_view format_str, const Args &...args) +template void vprint(std::ostream &os, std::string_view format_str, const Args &... args) { // assert(os.good()); auto buffer = fmt::memory_buffer(); @@ -817,7 +817,7 @@ template void vprint(std::ostream &os, std::string_view forma os.write(buffer.data(), buffer.size()); } -template std::string vprint(std::string_view format_str, const Args &...args) +template std::string vprint(std::string_view format_str, const Args &... args) { auto buffer = fmt::memory_buffer(); try { @@ -851,19 +851,19 @@ template std::string vprint(std::string_view format_str, cons // namespace { - template void print_fortran_syntax(std::ostream &os, std::string_view format_str, const Args &...args) + template void print_fortran_syntax(std::ostream &os, std::string_view format_str, const Args &... args) { EnergyPlus::vprint, DoubleWrapper, Args>...>(os, format_str, args...); } - template std::string format_fortran_syntax(std::string_view format_str, const Args &...args) + template std::string format_fortran_syntax(std::string_view format_str, const Args &... args) { return EnergyPlus::vprint, DoubleWrapper, Args>...>(format_str, args...); } } // namespace template -void print(std::ostream &os, std::string_view format_str, Args &&...args) +void print(std::ostream &os, std::string_view format_str, Args &&... args) { if constexpr (formatSyntax == FormatSyntax::Fortran) { print_fortran_syntax(os, format_str, args...); @@ -874,7 +874,7 @@ void print(std::ostream &os, std::string_view format_str, Args &&...args) } } -template void print(InputOutputFile &outputFile, std::string_view format_str, Args &&...args) +template void print(InputOutputFile &outputFile, std::string_view format_str, Args &&... args) { auto *outputStream = [&]() -> std::ostream * { if (outputFile.os) { @@ -897,7 +897,7 @@ template void print(InputOutputFil } } -template std::string format(std::string_view format_str, Args &&...args) +template std::string format(std::string_view format_str, Args &&... args) { if constexpr (formatSyntax == FormatSyntax::Fortran) { return format_fortran_syntax(format_str, args...); diff --git a/src/EnergyPlus/PoweredInductionUnits.hh b/src/EnergyPlus/PoweredInductionUnits.hh index babe185b7c3..0e8beca99f2 100644 --- a/src/EnergyPlus/PoweredInductionUnits.hh +++ b/src/EnergyPlus/PoweredInductionUnits.hh @@ -156,9 +156,9 @@ namespace PoweredInductionUnits { OutAirNode(0), HCoilInAirNode(0), ControlCompTypeNum(0), CompErrIndex(0), Mixer_Num(0), Fan_Num(0), Fan_Index(0), FanAvailSchedPtr(0), HCoilType(HtgCoilType::Invalid), HCoil_PlantType(DataPlant::PlantEquipmentType::Invalid), HCoil_Index(0), HCoil_FluidIndex(0), MaxVolHotWaterFlow(0.0), MaxVolHotSteamFlow(0.0), MaxHotWaterFlow(0.0), MaxHotSteamFlow(0.0), MinVolHotWaterFlow(0.0), - MinHotSteamFlow(0.0), MinVolHotSteamFlow(0.0), MinHotWaterFlow(0.0), HotControlNode(0), HotCoilOutNodeNum(0), HotControlOffset(0.0), - HWplantLoc{}, ADUNum(0), InducesPlenumAir(false), HeatingRate(0.0), HeatingEnergy(0.0), SensCoolRate(0.0), SensCoolEnergy(0.0), - CtrlZoneNum(0), ctrlZoneInNodeIndex(0), AirLoopNum(0), OutdoorAirFlowRate(0.0) + MinHotSteamFlow(0.0), MinVolHotSteamFlow(0.0), MinHotWaterFlow(0.0), HotControlNode(0), HotCoilOutNodeNum(0), + HotControlOffset(0.0), HWplantLoc{}, ADUNum(0), InducesPlenumAir(false), HeatingRate(0.0), HeatingEnergy(0.0), SensCoolRate(0.0), + SensCoolEnergy(0.0), CtrlZoneNum(0), ctrlZoneInNodeIndex(0), AirLoopNum(0), OutdoorAirFlowRate(0.0) { } diff --git a/src/EnergyPlus/StringUtilities.hh b/src/EnergyPlus/StringUtilities.hh index 3f12c78a384..2748eb14369 100644 --- a/src/EnergyPlus/StringUtilities.hh +++ b/src/EnergyPlus/StringUtilities.hh @@ -157,7 +157,7 @@ inline auto nth_occurrence(std::string_view input_str, char const search_char, s return pos; } -template bool readList(std::string_view input, Param &&...param) +template bool readList(std::string_view input, Param &&... param) { if constexpr (std::conjunction_v...> || std::conjunction_v...>) { size_t index = 0; diff --git a/tst/EnergyPlus/unit/HVACVariableRefrigerantFlow.unit.cc b/tst/EnergyPlus/unit/HVACVariableRefrigerantFlow.unit.cc index 17f2a681acf..68f17f37af8 100644 --- a/tst/EnergyPlus/unit/HVACVariableRefrigerantFlow.unit.cc +++ b/tst/EnergyPlus/unit/HVACVariableRefrigerantFlow.unit.cc @@ -2487,109 +2487,109 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_VRFOU_Compressor) } // Run and Check: VRFOU_CompSpd - { // Test the method VRFOU_CompSpd, which calculates the compressor speed at given - // operational conditions to meet the evaporator or condenser capacity provided. + {// Test the method VRFOU_CompSpd, which calculates the compressor speed at given + // operational conditions to meet the evaporator or condenser capacity provided. - { // a. Evaporator + {// a. Evaporator - // Inputs_condition - Real64 constexpr Q_req = 6971; // Required capacity [W] - Real64 constexpr T_suction = -13.35; // Compressor suction temperature Te' [C] - Real64 constexpr T_discharge = 36.37; // Compressor discharge temperature Tc' [C] - Real64 constexpr h_IU_evap_in = 225016; // Enthalpy of IU at inlet, for C_cap_operation calculation [kJ/kg] - Real64 constexpr h_comp_in = 429529; // Enthalpy after piping loss (compressor inlet), for C_cap_operation calculation [kJ/kg] - Real64 CompSpdActual; // Actual compressor running speed [rps] + // Inputs_condition + Real64 constexpr Q_req = 6971; // Required capacity [W] + Real64 constexpr T_suction = -13.35; // Compressor suction temperature Te' [C] + Real64 constexpr T_discharge = 36.37; // Compressor discharge temperature Tc' [C] + Real64 constexpr h_IU_evap_in = 225016; // Enthalpy of IU at inlet, for C_cap_operation calculation [kJ/kg] + Real64 constexpr h_comp_in = 429529; // Enthalpy after piping loss (compressor inlet), for C_cap_operation calculation [kJ/kg] + Real64 CompSpdActual; // Actual compressor running speed [rps] - // Run - state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_CompSpd( - *state, Q_req, HXOpMode::EvapMode, T_suction, T_discharge, h_IU_evap_in, h_comp_in, CompSpdActual); + // Run + state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_CompSpd( + *state, Q_req, HXOpMode::EvapMode, T_suction, T_discharge, h_IU_evap_in, h_comp_in, CompSpdActual); - // Test - EXPECT_NEAR(1295, CompSpdActual, 5); - } - - { - // b. Condenser - - // Inputs_condition - Real64 constexpr Q_req = 6953; // Required capacity [W] - Real64 constexpr T_suction = -13.35; // Compressor suction temperature Te' [C] - Real64 constexpr T_discharge = 36.37; // Compressor discharge temperature Tc' [C] - Real64 constexpr h_IU_evap_in = 225016; // Enthalpy of IU at inlet, for C_cap_operation calculation [kJ/kg] - Real64 constexpr h_comp_in = 429529; // Enthalpy after piping loss (compressor inlet), for C_cap_operation calculation [kJ/kg] - Real64 CompSpdActual; // Actual compressor running speed [rps] - - // Run - state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_CompSpd( - *state, Q_req, HXOpMode::CondMode, T_suction, T_discharge, h_IU_evap_in, h_comp_in, CompSpdActual); - - // Test - EXPECT_NEAR(950, CompSpdActual, 5); - } - } // namespace EnergyPlus - - // Run and Check: VRFOU_CompCap - { - // Test the method VRFOU_CompCap, which calculates the compressor performance (power and capacity) - // at given compressor speed and operational conditions. - - // Inputs_condition - Real64 constexpr CompSpdActual = 1298; // Actual compressor running speed [rps] - Real64 constexpr T_suction = -13.35; // Compressor suction temperature Te' [C] - Real64 constexpr T_discharge = 36.37; // Compressor discharge temperature Tc' [C] - Real64 constexpr h_IU_evap_in = 225016; // Enthalpy of IU at inlet, for C_cap_operation calculation [kJ/kg] - Real64 constexpr h_comp_in = 429529; // Enthalpy after piping loss (compressor inlet), for C_cap_operation calculation [kJ/kg] - Real64 Q_c_tot; // Compressor evaporative capacity [W] - Real64 Ncomp; // Compressor power [W] - - // Run - state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_CompCap(*state, CompSpdActual, T_suction, T_discharge, h_IU_evap_in, h_comp_in, Q_c_tot, Ncomp); - - // Test - EXPECT_NEAR(6990, Q_c_tot, 10); - EXPECT_NEAR(1601, Ncomp, 10); - } - - // Run and Check: VRFOU_CalcComp - { - // Test the method VRFOU_CalcCompH, which simulates the compressor performance at given oprtaional conditions. More specifically, it - // sepcifies the compressor speed to provide sufficient evaporative capacity, and calculate the power of the compressor running at the - // specified speed. Note that it may be needed to manipulate the operational conditions to further adjust system capacity at low load - // conditions. The low load modification logics are different for cooling mode and heating mode. + // Test + EXPECT_NEAR(1295, CompSpdActual, 5); +} - // Inputs_condition - Real64 TU_load = 6006; // Indoor unit cooling load [W] - Real64 T_suction = 8.86; // Compressor suction temperature Te' [C] - Real64 T_discharge = 40.26; // Compressor discharge temperature Tc' [C] - Real64 Pipe_h_out_ave = 233428; // Average Enthalpy of the refrigerant leaving IUs [kJ/kg] - Real64 IUMaxCondTemp = 36; // VRV IU condensing temperature, max among all indoor units [C] - Real64 MinOutdoorUnitTe = -72; // The minimum temperature that OU Te can be at cooling mode (only used for calculating Min capacity) - Real64 Tfs = 10.90; // Temperature of the air at the OU evaporator coil surface [C]] - Real64 Pipe_Q = 162.67; // Piping Loss Algorithm Parameter: Heat loss [W] - Real64 OUEvapHeatExtract = 5110.40; // Evaporator heat extract [W] - Real64 Ncomp = 1058; // Compressor power [W] - Real64 CompSpdActual; // Actual compressor running speed [rps] +{ + // b. Condenser + + // Inputs_condition + Real64 constexpr Q_req = 6953; // Required capacity [W] + Real64 constexpr T_suction = -13.35; // Compressor suction temperature Te' [C] + Real64 constexpr T_discharge = 36.37; // Compressor discharge temperature Tc' [C] + Real64 constexpr h_IU_evap_in = 225016; // Enthalpy of IU at inlet, for C_cap_operation calculation [kJ/kg] + Real64 constexpr h_comp_in = 429529; // Enthalpy after piping loss (compressor inlet), for C_cap_operation calculation [kJ/kg] + Real64 CompSpdActual; // Actual compressor running speed [rps] + + // Run + state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_CompSpd( + *state, Q_req, HXOpMode::CondMode, T_suction, T_discharge, h_IU_evap_in, h_comp_in, CompSpdActual); + + // Test + EXPECT_NEAR(950, CompSpdActual, 5); +} +} // namespace EnergyPlus - // Run - state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_CalcCompH(*state, - TU_load, - T_suction, - T_discharge, - Pipe_h_out_ave, - IUMaxCondTemp, - MinOutdoorUnitTe, - Tfs, - Pipe_Q, - OUEvapHeatExtract, - CompSpdActual, - Ncomp); +// Run and Check: VRFOU_CompCap +{ + // Test the method VRFOU_CompCap, which calculates the compressor performance (power and capacity) + // at given compressor speed and operational conditions. + + // Inputs_condition + Real64 constexpr CompSpdActual = 1298; // Actual compressor running speed [rps] + Real64 constexpr T_suction = -13.35; // Compressor suction temperature Te' [C] + Real64 constexpr T_discharge = 36.37; // Compressor discharge temperature Tc' [C] + Real64 constexpr h_IU_evap_in = 225016; // Enthalpy of IU at inlet, for C_cap_operation calculation [kJ/kg] + Real64 constexpr h_comp_in = 429529; // Enthalpy after piping loss (compressor inlet), for C_cap_operation calculation [kJ/kg] + Real64 Q_c_tot; // Compressor evaporative capacity [W] + Real64 Ncomp; // Compressor power [W] + + // Run + state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_CompCap(*state, CompSpdActual, T_suction, T_discharge, h_IU_evap_in, h_comp_in, Q_c_tot, Ncomp); + + // Test + EXPECT_NEAR(6990, Q_c_tot, 10); + EXPECT_NEAR(1601, Ncomp, 10); +} - // Test - EXPECT_NEAR(5110, OUEvapHeatExtract, 1); - EXPECT_NEAR(1500, CompSpdActual, 1); - EXPECT_NEAR(2080, Ncomp, 1); - EXPECT_EQ(state->dataLoopNodes->Node(state->dataHVACVarRefFlow->VRFTU(1).VRFTUInletNodeNum).MassFlowRate, 0.0); - } +// Run and Check: VRFOU_CalcComp +{ + // Test the method VRFOU_CalcCompH, which simulates the compressor performance at given oprtaional conditions. More specifically, it + // sepcifies the compressor speed to provide sufficient evaporative capacity, and calculate the power of the compressor running at the + // specified speed. Note that it may be needed to manipulate the operational conditions to further adjust system capacity at low load + // conditions. The low load modification logics are different for cooling mode and heating mode. + + // Inputs_condition + Real64 TU_load = 6006; // Indoor unit cooling load [W] + Real64 T_suction = 8.86; // Compressor suction temperature Te' [C] + Real64 T_discharge = 40.26; // Compressor discharge temperature Tc' [C] + Real64 Pipe_h_out_ave = 233428; // Average Enthalpy of the refrigerant leaving IUs [kJ/kg] + Real64 IUMaxCondTemp = 36; // VRV IU condensing temperature, max among all indoor units [C] + Real64 MinOutdoorUnitTe = -72; // The minimum temperature that OU Te can be at cooling mode (only used for calculating Min capacity) + Real64 Tfs = 10.90; // Temperature of the air at the OU evaporator coil surface [C]] + Real64 Pipe_Q = 162.67; // Piping Loss Algorithm Parameter: Heat loss [W] + Real64 OUEvapHeatExtract = 5110.40; // Evaporator heat extract [W] + Real64 Ncomp = 1058; // Compressor power [W] + Real64 CompSpdActual; // Actual compressor running speed [rps] + + // Run + state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_CalcCompH(*state, + TU_load, + T_suction, + T_discharge, + Pipe_h_out_ave, + IUMaxCondTemp, + MinOutdoorUnitTe, + Tfs, + Pipe_Q, + OUEvapHeatExtract, + CompSpdActual, + Ncomp); + + // Test + EXPECT_NEAR(5110, OUEvapHeatExtract, 1); + EXPECT_NEAR(1500, CompSpdActual, 1); + EXPECT_NEAR(2080, Ncomp, 1); + EXPECT_EQ(state->dataLoopNodes->Node(state->dataHVACVarRefFlow->VRFTU(1).VRFTUInletNodeNum).MassFlowRate, 0.0); +} } TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_VRFOU_Coil) @@ -2632,165 +2632,163 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_VRFOU_Coil) InitializePsychRoutines(*state); // Run and Check: VRFOU_Cap - { // Test the method VRFOU_Cap, which determines the VRF OU heat transfer rate, given refrigerant side temperature, - // i.e., condensing temperature and SC for condenser, or evaporating temperature and SH for evaporator. - { // a. Condenser - - // Inputs_condition - m_air = 3.6; - OutDryBulbTemp = 28; - OutHumRat = 0.0146; - SC = 1; - Tdischarge = 36; - - // Run - Q_h_OU = state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_Cap(*state, HXOpMode::CondMode, Tdischarge, SC, m_air, OutDryBulbTemp, OutHumRat); - - // Test - EXPECT_NEAR(27551, Q_h_OU, 10); - } + { // Test the method VRFOU_Cap, which determines the VRF OU heat transfer rate, given refrigerant side temperature, + // i.e., condensing temperature and SC for condenser, or evaporating temperature and SH for evaporator. + {// a. Condenser + + // Inputs_condition + m_air = 3.6; + OutDryBulbTemp = 28; + OutHumRat = 0.0146; + SC = 1; + Tdischarge = 36; + + // Run + Q_h_OU = state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_Cap(*state, HXOpMode::CondMode, Tdischarge, SC, m_air, OutDryBulbTemp, OutHumRat); + + // Test + EXPECT_NEAR(27551, Q_h_OU, 10); +} - { - // b. Evaporator +{ + // b. Evaporator - // Inputs_condition - m_air = 3.6; - OutDryBulbTemp = 7; - OutHumRat = 0.0019; - SH = 1; - Tsuction = -3; + // Inputs_condition + m_air = 3.6; + OutDryBulbTemp = 7; + OutHumRat = 0.0019; + SH = 1; + Tsuction = -3; - // Run - Q_c_OU = state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_Cap(*state, HXOpMode::EvapMode, Tsuction, SH, m_air, OutDryBulbTemp, OutHumRat); + // Run + Q_c_OU = state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_Cap(*state, HXOpMode::EvapMode, Tsuction, SH, m_air, OutDryBulbTemp, OutHumRat); - // Test - EXPECT_NEAR(24456, Q_c_OU, 10); - } - } // namespace EnergyPlus - - // Run and Check: VRFOU_FlowRate - { // Test the method VRFOU_Cap, which calculates the outdoor unit fan flow rate, given VRF OU load and refrigerant side temperature, i.e., - // condensing temperature and SC for condenser, or evaporating temperature and SH for evaporator. - { // a. Condenser - - // Inputs_condition - Q_h_OU = 27551; - OutDryBulbTemp = 28; - OutHumRat = 0.0146; - SC = 1; - Tdischarge = 36; - - // Run - m_air = - state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_FlowRate(*state, HXOpMode::CondMode, Tdischarge, SC, Q_h_OU, OutDryBulbTemp, OutHumRat); - - // Test - EXPECT_NEAR(3.6, m_air, 0.01); - } + // Test + EXPECT_NEAR(24456, Q_c_OU, 10); +} +} // namespace EnergyPlus - { - // b. Evaporator +// Run and Check: VRFOU_FlowRate +{ // Test the method VRFOU_Cap, which calculates the outdoor unit fan flow rate, given VRF OU load and refrigerant side temperature, i.e., + // condensing temperature and SC for condenser, or evaporating temperature and SH for evaporator. + {// a. Condenser - // Inputs_condition - Q_c_OU = 24456; - OutDryBulbTemp = 7; - OutHumRat = 0.0019; - SH = 1; - Tsuction = -3; + // Inputs_condition + Q_h_OU = 27551; +OutDryBulbTemp = 28; +OutHumRat = 0.0146; +SC = 1; +Tdischarge = 36; - // Run - m_air = - state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_FlowRate(*state, HXOpMode::EvapMode, Tsuction, SH, Q_c_OU, OutDryBulbTemp, OutHumRat); +// Run +m_air = state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_FlowRate(*state, HXOpMode::CondMode, Tdischarge, SC, Q_h_OU, OutDryBulbTemp, OutHumRat); - // Test - EXPECT_NEAR(3.6, m_air, 0.01); - } - } +// Test +EXPECT_NEAR(3.6, m_air, 0.01); +} - // Run and Check: VRFOU_TeTc - { // Test the method VRFOU_Cap, which calculates the VRF OU refrigerant side temperature, i.e., condensing temperature - // at cooling mode, or evaporating temperature at heating mode, given the coil heat - // release/extract amount and air side parameters. - { // a. Condenser - - // Inputs_condition - m_air = 3.6; - Q_h_OU = 27551; - OutDryBulbTemp = 28; - OutHumRat = 0.0146; - SC = 1; - - // Run - state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_TeTc( - *state, HXOpMode::CondMode, Q_h_OU, SC, m_air, OutDryBulbTemp, OutHumRat, OutBaroPress, temp, Tdischarge); - - // Test - EXPECT_NEAR(36, Tdischarge, 0.05); - } +{ + // b. Evaporator - { - // b. Evaporator + // Inputs_condition + Q_c_OU = 24456; + OutDryBulbTemp = 7; + OutHumRat = 0.0019; + SH = 1; + Tsuction = -3; - // Inputs_condition - m_air = 3.6; - Q_c_OU = 24456; - OutDryBulbTemp = 7; - OutHumRat = 0.0019; - SH = 1; - Tsuction = -3; + // Run + m_air = state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_FlowRate(*state, HXOpMode::EvapMode, Tsuction, SH, Q_c_OU, OutDryBulbTemp, OutHumRat); + + // Test + EXPECT_NEAR(3.6, m_air, 0.01); +} +} - // Run - state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_TeTc( - *state, HXOpMode::EvapMode, Q_c_OU, SH, m_air, OutDryBulbTemp, OutHumRat, OutBaroPress, temp, Tsuction); +// Run and Check: VRFOU_TeTc +{ // Test the method VRFOU_Cap, which calculates the VRF OU refrigerant side temperature, i.e., condensing temperature + // at cooling mode, or evaporating temperature at heating mode, given the coil heat + // release/extract amount and air side parameters. + {// a. Condenser + + // Inputs_condition + m_air = 3.6; +Q_h_OU = 27551; +OutDryBulbTemp = 28; +OutHumRat = 0.0146; +SC = 1; + +// Run +state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_TeTc( + *state, HXOpMode::CondMode, Q_h_OU, SC, m_air, OutDryBulbTemp, OutHumRat, OutBaroPress, temp, Tdischarge); + +// Test +EXPECT_NEAR(36, Tdischarge, 0.05); +} - // Test - EXPECT_NEAR(-3, Tsuction, 0.05); - } - } +{ + // b. Evaporator + + // Inputs_condition + m_air = 3.6; + Q_c_OU = 24456; + OutDryBulbTemp = 7; + OutHumRat = 0.0019; + SH = 1; + Tsuction = -3; + + // Run + state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_TeTc( + *state, HXOpMode::EvapMode, Q_c_OU, SH, m_air, OutDryBulbTemp, OutHumRat, OutBaroPress, temp, Tsuction); + + // Test + EXPECT_NEAR(-3, Tsuction, 0.05); +} +} - // Run and Check: VRFOU_SCSH +// Run and Check: VRFOU_SCSH +{ + // Test the method VRFOU_Cap, which calculates the VRF OU refrigerant side temperature, i.e., condensing temperature + // at cooling mode, or evaporating temperature at heating mode, given the coil heat + // release/extract amount and air side parameters. { - // Test the method VRFOU_Cap, which calculates the VRF OU refrigerant side temperature, i.e., condensing temperature - // at cooling mode, or evaporating temperature at heating mode, given the coil heat - // release/extract amount and air side parameters. - { - // a. Condenser - - // Inputs_condition - m_air = 3.6; - Q_h_OU = 27551; - OutDryBulbTemp = 28; - OutHumRat = 0.0146; - Tdischarge = 36; - - // Run - SC = state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_SCSH( - *state, HXOpMode::CondMode, Q_h_OU, Tdischarge, m_air, OutDryBulbTemp, OutHumRat, OutBaroPress); - - // Test - EXPECT_NEAR(1, SC, 0.01); - } + // a. Condenser + + // Inputs_condition + m_air = 3.6; + Q_h_OU = 27551; + OutDryBulbTemp = 28; + OutHumRat = 0.0146; + Tdischarge = 36; - { - // b. Evaporator + // Run + SC = state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_SCSH( + *state, HXOpMode::CondMode, Q_h_OU, Tdischarge, m_air, OutDryBulbTemp, OutHumRat, OutBaroPress); - // Inputs_condition - m_air = 3.6; - Q_c_OU = 24456; - OutDryBulbTemp = 7; - OutHumRat = 0.0019; - Tsuction = -3; + // Test + EXPECT_NEAR(1, SC, 0.01); + } - // Run - SH = state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_SCSH( - *state, HXOpMode::EvapMode, Q_c_OU, Tsuction, m_air, OutDryBulbTemp, OutHumRat, OutBaroPress); + { + // b. Evaporator - // Test - EXPECT_NEAR(1, SH, 0.01); - } + // Inputs_condition + m_air = 3.6; + Q_c_OU = 24456; + OutDryBulbTemp = 7; + OutHumRat = 0.0019; + Tsuction = -3; + + // Run + SH = state->dataHVACVarRefFlow->VRF(VRFCond).VRFOU_SCSH( + *state, HXOpMode::EvapMode, Q_c_OU, Tsuction, m_air, OutDryBulbTemp, OutHumRat, OutBaroPress); + + // Test + EXPECT_NEAR(1, SH, 0.01); } - // Clean up - state->dataHVACVarRefFlow->VRF.deallocate(); +} +// Clean up +state->dataHVACVarRefFlow->VRF.deallocate(); } TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_GetCoilInput) diff --git a/tst/EnergyPlus/unit/OutputReportTabular.unit.cc b/tst/EnergyPlus/unit/OutputReportTabular.unit.cc index 02bf71ec73b..02079680f88 100644 --- a/tst/EnergyPlus/unit/OutputReportTabular.unit.cc +++ b/tst/EnergyPlus/unit/OutputReportTabular.unit.cc @@ -7208,7 +7208,10 @@ TEST_F(SQLiteFixture, OutputReportTabular_WriteLoadComponentSummaryTables_AirLoo state->dataSize->SysSizInput.allocate(state->dataSize->NumSysSizInput); state->dataSize->SysSizInput(1).AirLoopNum = 1; state->dataSize->SysSizInput(1).SizingOption = DataSizing::NonCoincident; - auto degC_to_F = [](Real64 celsius) constexpr { return celsius * (9.0 / 5.0) + 32.0; }; + auto degC_to_F = [](Real64 celsius) constexpr + { + return celsius * (9.0 / 5.0) + 32.0; + }; constexpr Real64 coolMixTempSys = 26.2; constexpr Real64 coolMixTempSysIP = degC_to_F(coolMixTempSys); constexpr Real64 heatMixTempSys = -1.7; From 34493f7bb37ada9d686240676c51f75d6547824a Mon Sep 17 00:00:00 2001 From: Edwin Lee Date: Thu, 21 Dec 2023 20:35:35 -0600 Subject: [PATCH 11/22] Clarify compiler args, eliminate some comments --- cmake/CompilerFlags.cmake | 5 +++++ src/EnergyPlus/IOFiles.hh | 3 --- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cmake/CompilerFlags.cmake b/cmake/CompilerFlags.cmake index 6367627154e..9c49aa82342 100644 --- a/cmake/CompilerFlags.cmake +++ b/cmake/CompilerFlags.cmake @@ -104,8 +104,13 @@ elseif(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" O target_compile_options(project_warnings INTERFACE -Wno-aggressive-loop-optimizations) # Sadly, GCC 13.2 is throwing many false positives on dangling references and compile time array-bounds # https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=6b927b1297e66e26e62e722bf15c921dcbbd25b9 + # https://trofi.github.io/posts/264-gcc-s-new-Wdangling-reference-warning.html target_compile_options(project_warnings INTERFACE -Wno-dangling-reference) + # The array-bounds appears to be problematic as well depending on the optimization level chosen + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100430 target_compile_options(project_warnings INTERFACE -Wno-array-bounds) + # depending on the level of overflow check selected, the stringop-overflow can also emit false positives + # https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wstringop-overflow target_compile_options(project_warnings INTERFACE -Wno-stringop-overflow) elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang") if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.0) diff --git a/src/EnergyPlus/IOFiles.hh b/src/EnergyPlus/IOFiles.hh index b7dcea12eb9..01da0c23427 100644 --- a/src/EnergyPlus/IOFiles.hh +++ b/src/EnergyPlus/IOFiles.hh @@ -141,9 +141,6 @@ private: std::string_view spec_builder() { buffer.clear(); - // This line seems to be the culprit with some array-bounds warnings - // during compilation on GCC 13.2. I don't see how at the moment. - // I tried pragma-ing it away but it didn't help buffer.push_back('{'); buffer.push_back(':'); // [[fill]align][sign]["#"]["0"][width]["." precision]["L"][type] From e233def4d002af4dfd9f7d5648e46ef922d39ccc Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Fri, 22 Dec 2023 11:03:32 +0100 Subject: [PATCH 12/22] Use parenthesis for HysteresisModel conditions that clang-format 17 is treating as a template param --- .../PhaseChangeModeling/HysteresisModel.cc | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/EnergyPlus/PhaseChangeModeling/HysteresisModel.cc b/src/EnergyPlus/PhaseChangeModeling/HysteresisModel.cc index 8e3af8a8de2..095034e5d98 100644 --- a/src/EnergyPlus/PhaseChangeModeling/HysteresisModel.cc +++ b/src/EnergyPlus/PhaseChangeModeling/HysteresisModel.cc @@ -165,14 +165,14 @@ namespace HysteresisPhaseChange { phaseChangeState = PhaseChangeStates::FREEZING; this->enthNew = this->getEnthalpy(updatedTempTDT, this->peakTempFreezing, this->deltaTempFreezingLow, this->deltaTempFreezingHigh); - } else if (this->enthNew > this->enthalpyM && this->enthNew < this->enthalpyF) { + } else if ((this->enthNew < this->enthalpyF) && (this->enthNew > this->enthalpyM)) { phaseChangeState = PhaseChangeStates::TRANSITION; this->enthNew = (this->specHeatTransition * updatedTempTDT) + (this->enthOld - (this->specHeatTransition * prevTempTD)); - } else if (this->enthNew < this->enthalpyF && updatedTempTDT > phaseChangeTempReverse) { + } else if ((this->enthNew < this->enthalpyF) && (updatedTempTDT > phaseChangeTempReverse)) { phaseChangeState = PhaseChangeStates::TRANSITION; this->enthNew = (this->specHeatTransition * updatedTempTDT) + (this->enthRev - (this->specHeatTransition * phaseChangeTempReverse)); - } else if (this->enthNew <= this->enthalpyM && updatedTempTDT <= phaseChangeTempReverse) { + } else if ((this->enthNew <= this->enthalpyM) && (updatedTempTDT <= phaseChangeTempReverse)) { phaseChangeState = PhaseChangeStates::TRANSITION; this->enthNew = (this->specHeatTransition * updatedTempTDT) + (this->enthRev - (this->specHeatTransition * phaseChangeTempReverse)); @@ -191,11 +191,11 @@ namespace HysteresisPhaseChange { this->enthNew = (this->specHeatTransition * updatedTempTDT) + (this->enthOld - (this->specHeatTransition * prevTempTD)); this->enthalpyM = this->getEnthalpy(updatedTempTDT, this->peakTempMelting, this->deltaTempMeltingLow, this->deltaTempMeltingHigh); this->enthalpyF = this->getEnthalpy(updatedTempTDT, this->peakTempMelting, this->deltaTempMeltingLow, this->deltaTempMeltingHigh); - if (this->enthNew > this->enthalpyF && updatedTempTDT < phaseChangeTempReverse) { + if ((updatedTempTDT < phaseChangeTempReverse) && (this->enthNew > this->enthalpyF)) { phaseChangeState = PhaseChangeStates::FREEZING; this->enthNew = this->getEnthalpy(updatedTempTDT, this->peakTempFreezing, this->deltaTempFreezingLow, this->deltaTempFreezingHigh); - } else if (this->enthNew > this->enthalpyM && this->enthNew < this->enthalpyF && + } else if ((this->enthNew < this->enthalpyF) && (this->enthNew > this->enthalpyM) && (updatedTempTDT < prevTempTD || updatedTempTDT > prevTempTD)) { phaseChangeState = PhaseChangeStates::TRANSITION; this->enthNew = @@ -211,7 +211,7 @@ namespace HysteresisPhaseChange { this->enthNew = (this->specHeatTransition * updatedTempTDT) + (this->enthRev - (this->specHeatTransition * phaseChangeTempReverse)); this->enthalpyM = this->getEnthalpy(updatedTempTDT, this->peakTempMelting, this->deltaTempMeltingLow, this->deltaTempMeltingHigh); this->enthalpyF = this->getEnthalpy(updatedTempTDT, this->peakTempFreezing, this->deltaTempFreezingLow, this->deltaTempFreezingHigh); - if (this->enthNew > this->enthalpyM && this->enthNew < this->enthalpyF) { + if ((this->enthNew < this->enthalpyF) && (this->enthNew > this->enthalpyM)) { phaseChangeState = PhaseChangeStates::TRANSITION; this->enthNew = (this->specHeatTransition * updatedTempTDT) + (this->enthRev - (this->specHeatTransition * phaseChangeTempReverse)); @@ -223,14 +223,14 @@ namespace HysteresisPhaseChange { this->enthNew = (this->specHeatTransition * updatedTempTDT) + (this->enthOld - (this->specHeatTransition * prevTempTD)); this->enthalpyM = this->getEnthalpy(updatedTempTDT, this->peakTempMelting, this->deltaTempMeltingLow, this->deltaTempMeltingHigh); this->enthalpyF = this->getEnthalpy(updatedTempTDT, this->peakTempFreezing, this->deltaTempFreezingLow, this->deltaTempFreezingHigh); - if (this->enthNew < this->enthOld && updatedTempTDT < prevTempTD) { + if ((this->enthNew < this->enthOld) && (updatedTempTDT < prevTempTD)) { phaseChangeState = PhaseChangeStates::TRANSITION; this->enthNew = (this->specHeatTransition * updatedTempTDT) + (this->enthOld - (this->specHeatTransition * prevTempTD)); - } else if (this->enthNew > this->enthalpyM && this->enthNew < this->enthalpyF && updatedTempTDT < prevTempTD) { + } else if ((this->enthNew < this->enthalpyF) && (this->enthNew > this->enthalpyM) && (updatedTempTDT < prevTempTD)) { phaseChangeState = PhaseChangeStates::TRANSITION; this->enthNew = (this->specHeatTransition * updatedTempTDT) + (this->enthRev - (this->specHeatTransition * phaseChangeTempReverse)); - } else if (this->enthNew >= this->enthalpyF && updatedTempTDT <= phaseChangeTempReverse) { + } else if ((this->enthNew >= this->enthalpyF) && (updatedTempTDT <= phaseChangeTempReverse)) { phaseChangeState = PhaseChangeStates::TRANSITION; this->enthNew = (this->specHeatTransition * updatedTempTDT) + (this->enthRev - (this->specHeatTransition * phaseChangeTempReverse)); From cf2deda44369391d227d40678bb48b8544b02875 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Fri, 22 Dec 2023 12:56:24 +0100 Subject: [PATCH 13/22] Fix SSC config so we can build on Clang-17 * The arch shouldn't be passed, I'm on M1 not x86_64. This was removed upstream already: https://github.com/NREL/ssc/commit/4e0ab97988ba9e7bb77c7dff847205f94dcb270e * Shouldn't link to stdc++ directly. I'm actively trying to build against's LLVM's libc++ and getting a multiple flag warning (I use `export LDFLAGS="-L/opt/homebrew/opt/llvm/lib/c++ -Wl,-rpath,/opt/homebrew/opt/llvm/lib/c++"`) --- third_party/ssc/CMakeLists.txt | 2 +- third_party/ssc/linux_errors | 11 ----------- third_party/ssc/ssc/CMakeLists.txt | 7 ++++++- 3 files changed, 7 insertions(+), 13 deletions(-) delete mode 100644 third_party/ssc/linux_errors diff --git a/third_party/ssc/CMakeLists.txt b/third_party/ssc/CMakeLists.txt index f0977159eb1..d00eb0dc943 100644 --- a/third_party/ssc/CMakeLists.txt +++ b/third_party/ssc/CMakeLists.txt @@ -91,7 +91,7 @@ function(set_default_compile_options target) else(MSVC) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") if (APPLE) - set(MAIN_CFLAGS "${MAIN_CFLAGS} -arch x86_64 -fno-common -DWX_PRECOMP -D__MACOSX__") + set(MAIN_CFLAGS "${MAIN_CFLAGS} -fno-common -DWX_PRECOMP -D__MACOSX__") else() set(MAIN_CFLAGS "${MAIN_CFLAGS} -D__UNIX__") endif() diff --git a/third_party/ssc/linux_errors b/third_party/ssc/linux_errors deleted file mode 100644 index 0b9fc8b3ec8..00000000000 --- a/third_party/ssc/linux_errors +++ /dev/null @@ -1,11 +0,0 @@ -g++ -g -o Test ../test/input_cases/tcs_trough_physical_input.o ../test/input_cases/weather_inputs.o ../test/shared_test/lib_battery_test.o ../test/shared_test/lib_battery_powerflow_test.o ../test/shared_test/lib_irradproc_test.o ../test/shared_test/lib_util_test.o ../test/shared_test/lib_weatherfile_test.o ../test/shared_test/lib_windfile_test.o ../test/shared_test/lib_windwakemodel_test.o ../test/shared_test/lib_windwatts_test.o ../test/ssc_test/computeModuleTest.o ../test/ssc_test/cmod_windpower_test.o ../test/ssc_test/cmod_pvsamv1_test.o ../test/ssc_test/cmod_pvwattsv5_test.o ../test/ssc_test/cmod_tcstrough_physical_test.o ../test/tcs_test/csp_solver_core_test.o main.o -std=c++0x `wx-config-3 --libs` `wx-config-3 --libs aui` `wx-config-3 --libs stc` `wx-config-3 --libs` -lm ../../googletest/googletest/make/gtest_main.a ./ssc.so -Wl,--no-as-needed -ldl -../test/ssc_test/computeModuleTest.o: In function `testing::internal::MutexBase::Lock()': -/home/sjanzou/Public/Projects/GitHub/NREL/ssc/build_linux/../../googletest/googletest/include/gtest/internal/gtest-port.h:1860: undefined reference to `testing::internal::g_linked_ptr_mutex' -/home/sjanzou/Public/Projects/GitHub/NREL/ssc/build_linux/../../googletest/googletest/include/gtest/internal/gtest-port.h:1861: undefined reference to `testing::internal::g_linked_ptr_mutex' -/home/sjanzou/Public/Projects/GitHub/NREL/ssc/build_linux/../../googletest/googletest/include/gtest/internal/gtest-port.h:1862: undefined reference to `testing::internal::g_linked_ptr_mutex' -../test/ssc_test/computeModuleTest.o: In function `testing::internal::MutexBase::Unlock()': -/home/sjanzou/Public/Projects/GitHub/NREL/ssc/build_linux/../../googletest/googletest/include/gtest/internal/gtest-port.h:1872: undefined reference to `testing::internal::g_linked_ptr_mutex' -/home/sjanzou/Public/Projects/GitHub/NREL/ssc/build_linux/../../googletest/googletest/include/gtest/internal/gtest-port.h:1871: undefined reference to `testing::internal::g_linked_ptr_mutex' -../test/ssc_test/computeModuleTest.o:/home/sjanzou/Public/Projects/GitHub/NREL/ssc/build_linux/../../googletest/googletest/include/gtest/internal/gtest-port.h:1860: more undefined references to `testing::internal::g_linked_ptr_mutex' follow -collect2: error: ld returned 1 exit status -make: *** [Test] Error 1 diff --git a/third_party/ssc/ssc/CMakeLists.txt b/third_party/ssc/ssc/CMakeLists.txt index 0b9d5ba1380..7edbfe2b998 100644 --- a/third_party/ssc/ssc/CMakeLists.txt +++ b/third_party/ssc/ssc/CMakeLists.txt @@ -232,7 +232,12 @@ foreach( name ${DEPENDENCIES} ) endforeach() if (UNIX) - target_link_libraries(ssc -lpthread -lm -ldl -lstdc++) + find_package(Threads REQUIRED) + target_link_libraries(ssc Threads::Threads ${CMAKE_DL_LIBS}) + find_library(MATH_LIBRARY m) + if(MATH_LIBRARY) + target_link_libraries(ssc ${MATH_LIBRARY}) + endif() endif() From 7dac977af18b59764d1ea8822a8c8d906e6f6cd7 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Fri, 22 Dec 2023 13:07:29 +0100 Subject: [PATCH 14/22] Update boost type traits to avoid warning ``` /Users/julien/Software/Others/EnergyPlus/third_party/kiva/vendor/boost-1.77.0/boost/type_traits/has_nothrow_constructor.hpp:27:84: warning: builtin __has_nothrow_constructor is deprecated; use __is_nothrow_constructible instead [-Wdeprecated-builtins] 27 | template struct has_nothrow_constructor : public integral_constant{}; ` `` I pulled the latest from develop for the move and type_traits boost projects, keeping only the macro changes I needed. --- .../boost/move/detail/type_traits.hpp | 12 ++++--- .../boost/type_traits/intrinsics.hpp | 35 +++++++++++++------ 2 files changed, 32 insertions(+), 15 deletions(-) diff --git a/third_party/kiva/vendor/boost-1.77.0/boost/move/detail/type_traits.hpp b/third_party/kiva/vendor/boost-1.77.0/boost/move/detail/type_traits.hpp index e44db125839..03bf59c219d 100644 --- a/third_party/kiva/vendor/boost-1.77.0/boost/move/detail/type_traits.hpp +++ b/third_party/kiva/vendor/boost-1.77.0/boost/move/detail/type_traits.hpp @@ -190,33 +190,37 @@ # endif // BOOST_MOVE_HAS_TRIVIAL_MOVE_CONSTRUCTOR -# if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && BOOST_MOVE_HAS_TRAIT(is_constructible) && BOOST_MOVE_HAS_TRAIT(is_trivially_constructible) +# if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) + +# if BOOST_MOVE_HAS_TRAIT(is_constructible) && BOOST_MOVE_HAS_TRAIT(is_trivially_constructible) # define BOOST_MOVE_HAS_TRIVIAL_MOVE_CONSTRUCTOR(T) (__is_constructible(T, T&&) && __is_trivially_constructible(T, T&&)) # elif BOOST_MOVE_HAS_TRAIT(has_trivial_move_constructor) # define BOOST_MOVE_HAS_TRIVIAL_MOVE_CONSTRUCTOR(T) __has_trivial_move_constructor(T) # endif // BOOST_MOVE_HAS_TRIVIAL_MOVE_ASSIGN -# if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && BOOST_MOVE_HAS_TRAIT(is_assignable) && BOOST_MOVE_HAS_TRAIT(is_trivially_assignable) +# if BOOST_MOVE_HAS_TRAIT(is_assignable) && BOOST_MOVE_HAS_TRAIT(is_trivially_assignable) # define BOOST_MOVE_HAS_TRIVIAL_MOVE_ASSIGN(T) (__is_assignable(T, T&&) && __is_trivially_assignable(T, T&&)) # elif BOOST_MOVE_HAS_TRAIT(has_trivial_move_assign) # define BOOST_MOVE_HAS_TRIVIAL_MOVE_ASSIGN(T) __has_trivial_move_assign(T) # endif // BOOST_MOVE_HAS_NOTHROW_MOVE_CONSTRUCTOR -# if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && BOOST_MOVE_HAS_TRAIT(is_constructible) && BOOST_MOVE_HAS_TRAIT(is_nothrow_constructible) +# if BOOST_MOVE_HAS_TRAIT(is_constructible) && BOOST_MOVE_HAS_TRAIT(is_nothrow_constructible) # define BOOST_MOVE_HAS_NOTHROW_MOVE_CONSTRUCTOR(T) (__is_constructible(T, T&&) && __is_nothrow_constructible(T, T&&)) # elif BOOST_MOVE_HAS_TRAIT(has_nothrow_move_constructor) # define BOOST_MOVE_HAS_NOTHROW_MOVE_CONSTRUCTOR(T) __has_nothrow_move_constructor(T) # endif // BOOST_MOVE_HAS_NOTHROW_MOVE_ASSIGN -# if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && BOOST_MOVE_HAS_TRAIT(is_assignable) && BOOST_MOVE_HAS_TRAIT(is_nothrow_assignable) +# if BOOST_MOVE_HAS_TRAIT(is_assignable) && BOOST_MOVE_HAS_TRAIT(is_nothrow_assignable) # define BOOST_MOVE_HAS_NOTHROW_MOVE_ASSIGN(T) (__is_assignable(T, T&&) && __is_nothrow_assignable(T, T&&)) # elif BOOST_MOVE_HAS_TRAIT(has_nothrow_move_assign) # define BOOST_MOVE_HAS_NOTHROW_MOVE_ASSIGN(T) __has_nothrow_move_assign(T) # endif +# endif //BOOST_NO_CXX11_RVALUE_REFERENCES + // BOOST_MOVE_ALIGNMENT_OF # define BOOST_MOVE_ALIGNMENT_OF(T) __alignof(T) diff --git a/third_party/kiva/vendor/boost-1.77.0/boost/type_traits/intrinsics.hpp b/third_party/kiva/vendor/boost-1.77.0/boost/type_traits/intrinsics.hpp index 02f2a0315b9..4b34ad65583 100644 --- a/third_party/kiva/vendor/boost-1.77.0/boost/type_traits/intrinsics.hpp +++ b/third_party/kiva/vendor/boost-1.77.0/boost/type_traits/intrinsics.hpp @@ -78,7 +78,7 @@ #if defined(__MSL_CPP__) && (__MSL_CPP__ >= 0x8000) // Metrowerks compiler is acquiring intrinsic type traits support // post version 8. We hook into the published interface to pick up - // user defined specializations as well as compiler intrinsics as + // user defined specializations as well as compiler intrinsics as // and when they become available: # include # define BOOST_IS_UNION(T) BOOST_STD_EXTENSION_NAMESPACE::is_union::value @@ -160,11 +160,11 @@ # define BOOST_HAS_TYPE_TRAITS_INTRINSICS #endif -#if defined(BOOST_CLANG) && defined(__has_feature) && !defined(__CUDACC__) +#if defined(BOOST_CLANG) && defined(__has_feature) && defined(__has_builtin) && (!(defined(__CUDACC__) && (__CUDACC_VER_MAJOR__ < 11)) || defined(__CUDA__)) // // Note that these intrinsics are disabled for the CUDA meta-compiler as it appears // to not support them, even though the underlying clang compiler does so. -// This is a rubbish fix as it basically stops type traits from working correctly, +// This is a rubbish fix as it basically stops type traits from working correctly, // but maybe the best we can do for now. See https://svn.boost.org/trac/boost/ticket/10694 // // @@ -183,25 +183,39 @@ # if (!defined(__GLIBCXX__) || (__GLIBCXX__ >= 20080306 && __GLIBCXX__ != 20080519)) && __has_feature(is_empty) # define BOOST_IS_EMPTY(T) __is_empty(T) # endif -# if __has_feature(has_trivial_constructor) +# if __has_builtin(__is_trivially_constructible) +# define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) __is_trivially_constructible(T) +# elif __has_feature(has_trivial_constructor) # define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) __has_trivial_constructor(T) # endif -# if __has_feature(has_trivial_copy) +# if __has_builtin(__is_trivially_copyable) +# define BOOST_HAS_TRIVIAL_COPY(T) (__is_trivially_copyable(T) && !is_reference::value) +# elif __has_feature(has_trivial_copy) # define BOOST_HAS_TRIVIAL_COPY(T) (__has_trivial_copy(T) && !is_reference::value) # endif -# if __has_feature(has_trivial_assign) +# if __has_builtin(__is_trivially_assignable) +# define BOOST_HAS_TRIVIAL_ASSIGN(T) (__is_trivially_assignable(T&, const T&) && !is_volatile::value && is_assignable::value) +# elif __has_feature(has_trivial_assign) # define BOOST_HAS_TRIVIAL_ASSIGN(T) (__has_trivial_assign(T) && !is_volatile::value && is_assignable::value) # endif -# if __has_feature(has_trivial_destructor) +# if __has_builtin(__is_trivially_destructible) +# define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) (__is_trivially_destructible(T) && is_destructible::value) +# elif __has_feature(has_trivial_destructor) # define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) (__has_trivial_destructor(T) && is_destructible::value) # endif -# if __has_feature(has_nothrow_constructor) +# if __has_builtin(__is_nothrow_constructible) +# define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) (__is_nothrow_constructible(T) && is_default_constructible::value) +# elif __has_feature(has_nothrow_constructor) # define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) (__has_nothrow_constructor(T) && is_default_constructible::value) # endif -# if __has_feature(has_nothrow_copy) +# if __has_builtin(__is_nothrow_constructible) +# define BOOST_HAS_NOTHROW_COPY(T) (__is_nothrow_constructible(T, const T&) && !is_volatile::value && !is_reference::value && is_copy_constructible::value) +# elif __has_feature(has_nothrow_copy) # define BOOST_HAS_NOTHROW_COPY(T) (__has_nothrow_copy(T) && !is_volatile::value && !is_reference::value && is_copy_constructible::value) # endif -# if __has_feature(has_nothrow_assign) +# if __has_builtin(__is_nothrow_assignable) +# define BOOST_HAS_NOTHROW_ASSIGN(T) (__is_nothrow_assignable(T&, const T&) && !is_volatile::value && is_assignable::value) +# elif __has_feature(has_nothrow_assign) # define BOOST_HAS_NOTHROW_ASSIGN(T) (__has_nothrow_assign(T) && !is_volatile::value && is_assignable::value) # endif # if __has_feature(has_virtual_destructor) @@ -388,4 +402,3 @@ #endif // BOOST_TT_DISABLE_INTRINSICS #endif // BOOST_TT_INTRINSICS_HPP_INCLUDED - From cc20b31ff3e52f9a0411710aa66a5f301bb0795e Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Fri, 22 Dec 2023 13:12:30 +0100 Subject: [PATCH 15/22] Shush some Wunused-but-set-variable --- third_party/eigen/Eigen/src/SparseCore/TriangularSolver.h | 4 ++-- .../boost/geometry/policies/relate/intersection_points.hpp | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/third_party/eigen/Eigen/src/SparseCore/TriangularSolver.h b/third_party/eigen/Eigen/src/SparseCore/TriangularSolver.h index f9c56ba7980..baf2671767a 100644 --- a/third_party/eigen/Eigen/src/SparseCore/TriangularSolver.h +++ b/third_party/eigen/Eigen/src/SparseCore/TriangularSolver.h @@ -10,7 +10,7 @@ #ifndef EIGEN_SPARSETRIANGULARSOLVER_H #define EIGEN_SPARSETRIANGULARSOLVER_H -namespace Eigen { +namespace Eigen { namespace internal { @@ -270,7 +270,7 @@ struct sparse_solve_triangular_sparse_selector } - Index count = 0; + [[maybe_unused]] Index count = 0; // FIXME compute a reference value to filter zeros for (typename AmbiVector::Iterator it(tempVector/*,1e-12*/); it; ++it) { diff --git a/third_party/kiva/vendor/boost-1.77.0/boost/geometry/policies/relate/intersection_points.hpp b/third_party/kiva/vendor/boost-1.77.0/boost/geometry/policies/relate/intersection_points.hpp index 1ba08452fdd..4209c44d2bc 100644 --- a/third_party/kiva/vendor/boost-1.77.0/boost/geometry/policies/relate/intersection_points.hpp +++ b/third_party/kiva/vendor/boost-1.77.0/boost/geometry/policies/relate/intersection_points.hpp @@ -68,7 +68,9 @@ struct segments_intersection_points Ratio const& rb_from_wrt_a, Ratio const& rb_to_wrt_a) { return_type result; - unsigned int index = 0, count_a = 0, count_b = 0; + unsigned int index = 0; + [[maybe_unused]] unsigned int count_a = 0; + [[maybe_unused]] unsigned int count_b = 0; Ratio on_a[2]; // The conditions "index < 2" are necessary for non-robust handling, From 0e3b9f49a74f673b276c735ef5ae3090ad9c59d8 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Fri, 22 Dec 2023 13:26:25 +0100 Subject: [PATCH 16/22] #10345 - suppress all warnings from major third_party offenders --- third_party/CMakeLists.txt | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index 8467006cdf1..8396a24a7fb 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -67,7 +67,7 @@ elseif(MSVC) # VisualStudio endif() target_compile_features(ssc PRIVATE cxx_std_11) -# C++17 flag is intentionally after ssd +# C++17 flag is intentionally after ssc set(CMAKE_CXX_STANDARD 17) #Note: the Tarcog files are improperly initializing their virtual base classes, and this 4589 warning @@ -123,21 +123,32 @@ endif() add_subdirectory(ObjexxFCL) set_target_properties(objexx PROPERTIES FOLDER ThirdParty/ObjexxFCL) + add_subdirectory(BCVTB) set_target_properties(bcvtb PROPERTIES FOLDER ThirdParty/BCVTB) + add_subdirectory(Expat) set_target_properties(epexpat PROPERTIES FOLDER ThirdParty/Expat) + add_subdirectory(FMI) set_target_properties(epfmiimport PROPERTIES FOLDER ThirdParty/FMI) +target_compile_options(epfmiimport PRIVATE "-w") + add_subdirectory(zlib) set_target_properties(miniziplib PROPERTIES FOLDER ThirdParty/zlib) +target_compile_options(miniziplib PRIVATE "-w") + add_subdirectory(DElight) set_target_properties(DElight PROPERTIES FOLDER ThirdParty/DElight) +target_compile_options(DElight PRIVATE "-w") + add_subdirectory(re2) set_target_properties(re2 PROPERTIES FOLDER ThirdParty/re2) + add_subdirectory(fmt-8.0.1) target_compile_definitions(fmt PRIVATE FMT_USE_FULL_CACHE_DRAGONBOX=1) set_target_properties(fmt PROPERTIES FOLDER ThirdParty/fmt) + add_subdirectory(cpgfunctionEP) set_target_properties(cpgfunctionEP PROPERTIES FOLDER ThirdParty/cpgfunctionEP) @@ -152,8 +163,9 @@ set(KIVA_3D OFF CACHE BOOL "" FORCE) set(KIVA_GROUND_PLOT ${BUILD_GROUND_PLOT} CACHE BOOL "" FORCE) set(KIVA_COVERAGE OFF CACHE BOOL "" FORCE) -add_subdirectory("kiva") +add_subdirectory(kiva) set_target_properties(libkiva PROPERTIES FOLDER ThirdParty/Kiva) +target_compile_options(libkiva PRIVATE "-w") if(NOT APPLE) add_subdirectory(FMUParser) From 604ea9836c7e8ac94d06589b4b243eb9fcc322b4 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Fri, 22 Dec 2023 13:51:42 +0100 Subject: [PATCH 17/22] Redo with an interface library `turn_off_warnings` (note: can't link to ssc because it tries to export/install) --- CMakeLists.txt | 2 ++ cmake/CompilerFlags.cmake | 8 ++++++++ third_party/CMakeLists.txt | 13 ++++++++----- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ceca25eec6e..fb91a099b4d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -59,6 +59,8 @@ add_library(project_fp_options INTERFACE) add_library(project_warnings INTERFACE) +add_library(turn_off_warnings INTERFACE) + set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads) target_link_libraries(project_options INTERFACE Threads::Threads) diff --git a/cmake/CompilerFlags.cmake b/cmake/CompilerFlags.cmake index c622c9d0b1e..275a839fa19 100644 --- a/cmake/CompilerFlags.cmake +++ b/cmake/CompilerFlags.cmake @@ -77,6 +77,9 @@ if(MSVC AND NOT ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")) # Visual C++ (VS target_compile_options(project_options INTERFACE $<$:/RTCsu>) # Runtime checks target_compile_options(project_fp_options INTERFACE $<$:/fp:strict>) # Floating point model target_compile_options(project_options INTERFACE $<$:/DMSVC_DEBUG>) # Triggers code in main.cc to catch floating point NaNs + + target_compile_options(turn_off_warnings INTERFACE /W0) + elseif(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang") # g++/Clang # TODO: after we fix all test, enable this by default on Debug builds @@ -139,6 +142,8 @@ elseif(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" O target_compile_options(project_options INTERFACE $<$:-fno-stack-protector>) # ADD_CXX_RELEASE_DEFINITIONS("-Ofast") # -Ofast (or -ffast-math) needed to auto-vectorize floating point loops + target_compile_options(turn_off_warnings INTERFACE -w) + elseif(WIN32 AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") # Disabled Warnings: Enable some of these as more serious warnings are addressed @@ -192,6 +197,8 @@ elseif(WIN32 AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") target_compile_options(project_fp_options INTERFACE $<$:/Qfp-stack-check>) target_compile_options(project_options INTERFACE $<$:/traceback>) # Enables traceback on error + target_compile_options(turn_off_warnings INTERFACE /w) + elseif(UNIX AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") # Disabled Warnings: Enable some of these as more serious warnings are addressed @@ -237,6 +244,7 @@ elseif(UNIX AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") target_compile_options(project_fp_options INTERFACE $<$:-fp-stack-check>) # Check the floating point stack after every function call target_compile_options(project_options INTERFACE $<$:-traceback>) # Enables traceback on error + target_compile_options(turn_off_warnings INTERFACE -w) endif() # COMPILER TYPE # Add Color Output if Using Ninja: diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index 8396a24a7fb..3dde207ae7c 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -73,6 +73,9 @@ set(CMAKE_CXX_STANDARD 17) #Note: the Tarcog files are improperly initializing their virtual base classes, and this 4589 warning # on MSVC is legitimate, but silencing the warning because it's a third-party library +# Shush every warning for any lib added after it? +# link_libraries(turn_off_warnings) + if(NOT MSVC) add_compile_options(-Wno-pedantic -Wno-unused-parameter -Wno-unknown-pragmas) else() @@ -93,7 +96,7 @@ set(RE2_BUILD_TESTING # CACHE BOOL "" FORCE) #endif() -# We don't want to enable the global warnings for any of the third party projects +# We don't want to enable the global project_warnings for any of the third party projects link_libraries(project_options) add_subdirectory(SQLite) set_target_properties(sqlite PROPERTIES FOLDER ThirdParty/SQLite) @@ -132,15 +135,15 @@ set_target_properties(epexpat PROPERTIES FOLDER ThirdParty/Expat) add_subdirectory(FMI) set_target_properties(epfmiimport PROPERTIES FOLDER ThirdParty/FMI) -target_compile_options(epfmiimport PRIVATE "-w") +target_link_libraries(epfmiimport turn_off_warnings) add_subdirectory(zlib) set_target_properties(miniziplib PROPERTIES FOLDER ThirdParty/zlib) -target_compile_options(miniziplib PRIVATE "-w") +target_link_libraries(miniziplib PRIVATE turn_off_warnings) add_subdirectory(DElight) set_target_properties(DElight PROPERTIES FOLDER ThirdParty/DElight) -target_compile_options(DElight PRIVATE "-w") +target_link_libraries(DElight PRIVATE turn_off_warnings) add_subdirectory(re2) set_target_properties(re2 PROPERTIES FOLDER ThirdParty/re2) @@ -165,7 +168,7 @@ set(KIVA_COVERAGE OFF CACHE BOOL "" FORCE) add_subdirectory(kiva) set_target_properties(libkiva PROPERTIES FOLDER ThirdParty/Kiva) -target_compile_options(libkiva PRIVATE "-w") +target_link_libraries(libkiva PRIVATE turn_off_warnings) if(NOT APPLE) add_subdirectory(FMUParser) From a32540da19a68c700e1ad03420be118933e3b5b5 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Fri, 22 Dec 2023 13:59:09 +0100 Subject: [PATCH 18/22] Remove kiva from lists of third_party project were I suppress all warnings for now --- third_party/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index 3dde207ae7c..3167db5390e 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -168,7 +168,6 @@ set(KIVA_COVERAGE OFF CACHE BOOL "" FORCE) add_subdirectory(kiva) set_target_properties(libkiva PROPERTIES FOLDER ThirdParty/Kiva) -target_link_libraries(libkiva PRIVATE turn_off_warnings) if(NOT APPLE) add_subdirectory(FMUParser) From 1c80e2bc630b5fa0ed7b343150cbd5af746d39e7 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Fri, 22 Dec 2023 13:58:37 +0100 Subject: [PATCH 19/22] Treat nlohmann includes as SYSTEM --- third_party/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index 3167db5390e..b6d3fe740f9 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -10,7 +10,7 @@ target_compile_definitions( ) target_include_directories( nlohmann_json - INTERFACE + SYSTEM INTERFACE $ ) From 19be5722de58ff42f4b11b2f06ddc0892b21a940 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Fri, 22 Dec 2023 14:09:55 +0100 Subject: [PATCH 20/22] Try to silence nlohmann's deprecated warning (not workin) ``` In file included from /Users/julien/Software/Others/EnergyPlus/src/EnergyPlus/FileSystem.hh:56: /Users/julien/Software/Others/EnergyPlus/third_party/nlohmann/json.hpp:5350:32: warning: 'char_traits' is deprecated: char_traits for T not equal to char, wchar_t, char8_t, char16_t or char32_t is non-standard and is provided for a temporary period. It will be removed in LLVM 18, so please migrate off of it. [-Wdeprecated-declarations] ``` --- third_party/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index b6d3fe740f9..88928ae2590 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -13,6 +13,11 @@ target_include_directories( SYSTEM INTERFACE $ ) +set_source_files_properties( + $/json.hpp + TARGET_DIRECTORY nlohmann_json + PROPERTIES COMPILE_FLAGS -Wno-deprecated-declarations +) # To avoid modifying every third_party library # we link the project_options in here for every library in this From 561d0fb4e901f685c13b81d51f8b953e31b7f05b Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Fri, 22 Dec 2023 15:52:46 +0100 Subject: [PATCH 21/22] Make initPython non member (no point - and avoids having to define it even if not LINK_WITH_PYTHON) --- src/EnergyPlus/PluginManager.cc | 4 ++-- src/EnergyPlus/PluginManager.hh | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/EnergyPlus/PluginManager.cc b/src/EnergyPlus/PluginManager.cc index 19eed55b70c..5bda370ae44 100644 --- a/src/EnergyPlus/PluginManager.cc +++ b/src/EnergyPlus/PluginManager.cc @@ -412,7 +412,7 @@ void PluginManager::setupOutputVariables([[maybe_unused]] EnergyPlusData &state) } #if LINK_WITH_PYTHON -void PluginManager::initPython(EnergyPlusData &state, fs::path const &pathToPythonPackages) +void initPython(EnergyPlusData &state, fs::path const &pathToPythonPackages) { PyStatus status; @@ -507,7 +507,7 @@ PluginManager::PluginManager(EnergyPlusData &state) : eplusRunningViaPythonAPI(s } fs::path const pathToPythonPackages = programDir / "python_standard_lib"; - PluginManager::initPython(state, pathToPythonPackages); + initPython(state, pathToPythonPackages); // Take control of the global interpreter lock while we are here, make sure to release it... PyGILState_STATE gil = PyGILState_Ensure(); diff --git a/src/EnergyPlus/PluginManager.hh b/src/EnergyPlus/PluginManager.hh index bafb7550bf5..34cf2084174 100644 --- a/src/EnergyPlus/PluginManager.hh +++ b/src/EnergyPlus/PluginManager.hh @@ -183,8 +183,6 @@ namespace PluginManagement { explicit PluginManager(EnergyPlusData &state); ~PluginManager(); - static void initPython(EnergyPlusData &state, fs::path const &pathToPythonPackages); - static int numActiveCallbacks(EnergyPlusData &state); static void addToPythonPath(EnergyPlusData &state, const fs::path &includePath, bool userDefinedPath); static void setupOutputVariables(EnergyPlusData &state); From cc6b54f4767effcf0863f5c40bdc4616ae5d8020 Mon Sep 17 00:00:00 2001 From: Edwin Lee Date: Fri, 22 Dec 2023 09:34:59 -0600 Subject: [PATCH 22/22] Add updated Cmake supported version to hush cmake warnings --- third_party/DElight/CMakeLists.txt | 2 +- third_party/Windows-CalcEngine/CMakeLists.txt | 2 +- third_party/gtest/CMakeLists.txt | 2 +- third_party/gtest/googlemock/CMakeLists.txt | 2 +- third_party/gtest/googletest/CMakeLists.txt | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/third_party/DElight/CMakeLists.txt b/third_party/DElight/CMakeLists.txt index 97eb3b95959..0ff4b238745 100644 --- a/third_party/DElight/CMakeLists.txt +++ b/third_party/DElight/CMakeLists.txt @@ -1,4 +1,4 @@ -CMAKE_MINIMUM_REQUIRED( VERSION 2.8.12 ) +CMAKE_MINIMUM_REQUIRED( VERSION 2.8.12...3.5 ) # bumped max support to 3.5 to hush a cmake deprecation warning PROJECT(DElight) diff --git a/third_party/Windows-CalcEngine/CMakeLists.txt b/third_party/Windows-CalcEngine/CMakeLists.txt index 1e600c72a3a..401d5e1cc2a 100644 --- a/third_party/Windows-CalcEngine/CMakeLists.txt +++ b/third_party/Windows-CalcEngine/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required( VERSION 2.8.12 ) +cmake_minimum_required( VERSION 2.8.12...3.5) # bumped max support to 3.5 to hush a cmake deprecation warning set( target_name Windows-CalcEngine ) diff --git a/third_party/gtest/CMakeLists.txt b/third_party/gtest/CMakeLists.txt index ea81ab1292d..2aed8ea188b 100644 --- a/third_party/gtest/CMakeLists.txt +++ b/third_party/gtest/CMakeLists.txt @@ -1,7 +1,7 @@ # Note: CMake support is community-based. The maintainers do not use CMake # internally. -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 2.8.12...3.5) # bumped max support to 3.5 to hush a cmake deprecation warning if (POLICY CMP0048) cmake_policy(SET CMP0048 NEW) diff --git a/third_party/gtest/googlemock/CMakeLists.txt b/third_party/gtest/googlemock/CMakeLists.txt index e7df8ec53d0..c577b3d78fe 100644 --- a/third_party/gtest/googlemock/CMakeLists.txt +++ b/third_party/gtest/googlemock/CMakeLists.txt @@ -42,7 +42,7 @@ else() cmake_policy(SET CMP0048 NEW) project(gmock VERSION ${GOOGLETEST_VERSION} LANGUAGES CXX C) endif() -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 2.8.12...3.5) # bumped max support to 3.5 to hush a cmake deprecation warning if (COMMAND set_up_hermetic_build) set_up_hermetic_build() diff --git a/third_party/gtest/googletest/CMakeLists.txt b/third_party/gtest/googletest/CMakeLists.txt index abdd98b79a4..6d64d8b6c87 100644 --- a/third_party/gtest/googletest/CMakeLists.txt +++ b/third_party/gtest/googletest/CMakeLists.txt @@ -53,7 +53,7 @@ else() cmake_policy(SET CMP0048 NEW) project(gtest VERSION ${GOOGLETEST_VERSION} LANGUAGES CXX C) endif() -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 2.8.12...3.5) # bumped max support to 3.5 to hush a cmake deprecation warning if (POLICY CMP0063) # Visibility cmake_policy(SET CMP0063 NEW)