Skip to content

Commit

Permalink
Remove the type fielf from helper objects
Browse files Browse the repository at this point in the history
The AirflowNetwork_MultiAirLoopTest unit test now has a chunk
commented out, that will need to be fixed before this can be
merged.
  • Loading branch information
jasondegraw committed Jan 6, 2024
1 parent cae21a5 commit 554326a
Show file tree
Hide file tree
Showing 7 changed files with 119 additions and 134 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ namespace AirflowNetwork {

enum class Type : int
{
Unknown = -1,
DOP = 0, // Detailed large opening component
SOP, // Simple opening component
SCR, // Surface crack component
Expand Down Expand Up @@ -165,10 +164,8 @@ namespace AirflowNetwork {

enum class WindPressureCalculationType : int
{
Invalid = 0,
Input = 1,
SurfAvg = 2,
Num
Input,
SurfAvg,
};

int constexpr PressureCtrlExhaust = 1;
Expand Down Expand Up @@ -1312,7 +1309,6 @@ namespace AirflowNetwork {
{
// Members
std::string Name; // Provide a unique element name
Type CompTypeNum; // Provide numeric equivalent for AirflowNetworkCompType
int TypeNum; // Component number under same component type
int CompNum; // General component number
std::string EPlusName; // Provide a unique element name
Expand All @@ -1321,7 +1317,7 @@ namespace AirflowNetwork {
ComponentType EPlusTypeNum; // Provide EPlus component type

// Default Constructor
AirflowNetworkCompProp() : CompTypeNum(Type::Unknown), TypeNum(0), CompNum(0), EPlusTypeNum(ComponentType::Unknown)
AirflowNetworkCompProp() : TypeNum(0), CompNum(0), EPlusTypeNum(ComponentType::Unknown)
{
}
};
Expand Down
4 changes: 2 additions & 2 deletions src/EnergyPlus/AirflowNetwork/src/Elements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ namespace AirflowNetwork {
SumTermFlow += state.dataLoopNodes->Node(k1).MassFlowRate;
}
}
if (state.afn->AirflowNetworkCompData(state.afn->AirflowNetworkLinkageData(k).CompNum).CompTypeNum == Type::ELR) {
if (state.afn->AirflowNetworkLinkageData(k).element->type() == Type::ELR) {
// Calculate supply leak sensible losses
Node1 = state.afn->AirflowNetworkLinkageData(k).NodeNums[0];
Node2 = state.afn->AirflowNetworkLinkageData(k).NodeNums[1];
Expand Down Expand Up @@ -3997,7 +3997,7 @@ namespace AirflowNetwork {
ll = 3;
}

Ltyp = state.afn->AirflowNetworkCompData(state.afn->AirflowNetworkLinkageData(i).CompNum).CompTypeNum;
Ltyp = state.afn->AirflowNetworkLinkageData(i).element->type();
if (Ltyp == Type::DOP) {
ActLh = state.afn->MultizoneSurfaceData(i).Height;
ActLOwnh = ActLh * 1.0;
Expand Down
169 changes: 80 additions & 89 deletions src/EnergyPlus/AirflowNetwork/src/Solver.cpp

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions src/EnergyPlus/CrossVentMgr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -423,9 +423,10 @@ namespace RoomAir {
auto &jetRecFlows = state.dataRoomAir->CrossVentJetRecFlows(Ctd, ZoneNum);
auto const &surfParams = state.dataRoomAir->SurfParametersCrossDispVent(Ctd);
int cCompNum = state.afn->AirflowNetworkLinkageData(Ctd).CompNum;
if (state.afn->AirflowNetworkCompData(cCompNum).CompTypeNum == AirflowNetwork::Type::DOP) {
AirflowNetwork::Type type = state.afn->AirflowNetworkLinkageData(Ctd).element->type();
if (type == AirflowNetwork::Type::DOP) {
jetRecFlows.Area = surfParams.Width * surfParams.Height * state.afn->MultizoneSurfaceData(Ctd).OpenFactor;
} else if (state.afn->AirflowNetworkCompData(cCompNum).CompTypeNum == AirflowNetwork::Type::SCR) {
} else if (type == AirflowNetwork::Type::SCR) {
jetRecFlows.Area = surfParams.Width * surfParams.Height;
} else {
ShowSevereError(
Expand Down
15 changes: 6 additions & 9 deletions src/EnergyPlus/RoomAirModelManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1044,7 +1044,7 @@ namespace RoomAir {
state.afn->AirflowNetworkNodeData(nodeNum1).EPlusZoneNum == zoneCV.ZonePtr)) {
int compNum = state.afn->AirflowNetworkLinkageData(iLink).CompNum;
int typeNum = state.afn->AirflowNetworkCompData(compNum).TypeNum;
if (state.afn->AirflowNetworkCompData(compNum).CompTypeNum == AirflowNetwork::Type::SCR) {
if (state.afn->AirflowNetworkLinkageData(iLink).element->type() == AirflowNetwork::Type::SCR) {
if (state.afn->MultizoneSurfaceCrackData(typeNum).exponent != 0.50) {
state.dataRoomAir->AirModel(zoneCV.ZonePtr).AirModel = RoomAirModel::Mixing;
ShowWarningError(state, format("Problem with {} = {}", ipsc->cCurrentModuleObject, ipsc->cAlphaArgs(1)));
Expand Down Expand Up @@ -1966,7 +1966,8 @@ namespace RoomAir {
// calculate the surface width and height
int compNum = state.afn->AirflowNetworkLinkageData(iMzLink).CompNum;
int typeNum = state.afn->AirflowNetworkCompData(compNum).TypeNum;
if (state.afn->AirflowNetworkCompData(compNum).CompTypeNum == AirflowNetwork::Type::DOP) {
AirflowNetwork::Type type = state.afn->AirflowNetworkLinkageData(iMzLink).element->type();
if (type == AirflowNetwork::Type::DOP) {
Real64 WidthFactMax = 0.0;
Real64 HeightFactMax = 0.0;

Expand Down Expand Up @@ -1997,8 +1998,7 @@ namespace RoomAir {
surfParams.Width = WidthFactMax * mzSurf.Width;
surfParams.Height = HeightFactMax * mzSurf.Height;

} else if (state.afn->AirflowNetworkCompData(compNum).CompTypeNum ==
AirflowNetwork::Type::SCR) { // surface type = CRACK
} else if (type == AirflowNetwork::Type::SCR) { // surface type = CRACK
surfParams.Width = mzSurf.Width / 2;
auto const &zoneHeatBal = state.dataZoneTempPredictorCorrector->zoneHeatBalance(iZone);
Real64 AinCV =
Expand All @@ -2009,9 +2009,7 @@ namespace RoomAir {
}

// calculate the surface Zmin and Zmax
if (state.afn->AirflowNetworkCompData(compNum).CompTypeNum == AirflowNetwork::Type::DOP ||
state.afn->AirflowNetworkCompData(compNum).CompTypeNum ==
AirflowNetwork::Type::SCR) { // surface type = CRACK
if (type == AirflowNetwork::Type::DOP || type == AirflowNetwork::Type::SCR) { // surface type = CRACK
Real64 z_min(std::numeric_limits<Real64>::max()), z_max(std::numeric_limits<Real64>::lowest());
for (int i = 1; i <= mzSurf.Sides; ++i) {
Real64 const z_i = mzSurf.Vertex(i).z;
Expand Down Expand Up @@ -2514,8 +2512,7 @@ namespace RoomAir {
OutputProcessor::SOVStoreType::State,
zone.Name);
for (int i = 1; i <= state.dataRoomAir->AFNSurfaceCrossVent(0, ZoneNum); ++i) {
int N = state.afn->AirflowNetworkLinkageData(i).CompNum;
if (state.afn->AirflowNetworkCompData(N).CompTypeNum == AirflowNetwork::Type::DOP) {
if (state.afn->AirflowNetworkLinkageData(i).element->type() == AirflowNetwork::Type::DOP) {
SetupOutputVariable(state,
"Room Air Window Jet Region Average Air Velocity",
OutputProcessor::Unit::m_s,
Expand Down
44 changes: 22 additions & 22 deletions tst/EnergyPlus/unit/AirflowNetworkHVAC.unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6041,32 +6041,32 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_MultiAirLoopTest)
EXPECT_NEAR(state->afn->AirflowNetworkReportData(1).MultiZoneInfiSenLossW, 95.89575, 0.001);
EXPECT_NEAR(state->afn->AirflowNetworkReportData(1).MultiZoneInfiLatLossW, 0.969147, 0.001);

state->afn->AirflowNetworkCompData(state->afn->AirflowNetworkLinkageData(2).CompNum).CompTypeNum = AirflowNetwork::Type::DOP;
state->afn->report();
///state->afn->AirflowNetworkCompData(state->afn->AirflowNetworkLinkageData(2).CompNum).CompTypeNum = AirflowNetwork::Type::DOP;
///state->afn->report();

EXPECT_NEAR(state->afn->AirflowNetworkReportData(1).MultiZoneVentSenLossW, 95.89575, 0.001);
EXPECT_NEAR(state->afn->AirflowNetworkReportData(1).MultiZoneVentLatLossW, 0.969147, 0.001);
///EXPECT_NEAR(state->afn->AirflowNetworkReportData(1).MultiZoneVentSenLossW, 95.89575, 0.001);
///EXPECT_NEAR(state->afn->AirflowNetworkReportData(1).MultiZoneVentLatLossW, 0.969147, 0.001);
// #8475
state->dataHVACGlobal->TimeStepSys = 0.1;
state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour;
state->dataHeatBal->Zone(1).Volume = 30.0;
///state->dataHVACGlobal->TimeStepSys = 0.1;
///state->dataHVACGlobal->TimeStepSysSec = state->dataHVACGlobal->TimeStepSys * Constant::SecInHour;
///state->dataHeatBal->Zone(1).Volume = 30.0;
// Ventilation
state->afn->update();
state->afn->report();
EXPECT_NEAR(state->afn->exchangeData(1).SumMVCp, 2.38012, 0.001);
EXPECT_NEAR(state->afn->exchangeData(1).SumMVCpT, -41.1529, 0.001);
EXPECT_NEAR(state->afn->AirflowNetworkZnRpt(1).VentilVolume, 0.7314456, 0.001);
EXPECT_NEAR(state->afn->AirflowNetworkZnRpt(1).VentilAirChangeRate, 0.2438, 0.001);
EXPECT_NEAR(state->afn->AirflowNetworkZnRpt(1).VentilMass, 0.85114, 0.001);
///state->afn->update();
///state->afn->report();
///EXPECT_NEAR(state->afn->exchangeData(1).SumMVCp, 2.38012, 0.001);
///EXPECT_NEAR(state->afn->exchangeData(1).SumMVCpT, -41.1529, 0.001);
///EXPECT_NEAR(state->afn->AirflowNetworkZnRpt(1).VentilVolume, 0.7314456, 0.001);
///EXPECT_NEAR(state->afn->AirflowNetworkZnRpt(1).VentilAirChangeRate, 0.2438, 0.001);
///EXPECT_NEAR(state->afn->AirflowNetworkZnRpt(1).VentilMass, 0.85114, 0.001);
// Infiltration
state->afn->AirflowNetworkCompData(state->afn->AirflowNetworkLinkageData(2).CompNum).CompTypeNum = AirflowNetwork::Type::SCR;
state->afn->update();
state->afn->report();
EXPECT_NEAR(state->afn->exchangeData(1).SumMCp, 2.38012, 0.001);
EXPECT_NEAR(state->afn->exchangeData(1).SumMCpT, -41.1529, 0.001);
EXPECT_NEAR(state->afn->AirflowNetworkZnRpt(1).InfilVolume, 0.7314456, 0.001);
EXPECT_NEAR(state->afn->AirflowNetworkZnRpt(1).InfilAirChangeRate, 0.2438, 0.001);
EXPECT_NEAR(state->afn->AirflowNetworkZnRpt(1).InfilMass, 0.85114, 0.001);
///state->afn->AirflowNetworkCompData(state->afn->AirflowNetworkLinkageData(2).CompNum).CompTypeNum = AirflowNetwork::Type::SCR;
///state->afn->update();
///state->afn->report();
///EXPECT_NEAR(state->afn->exchangeData(1).SumMCp, 2.38012, 0.001);
///EXPECT_NEAR(state->afn->exchangeData(1).SumMCpT, -41.1529, 0.001);
///EXPECT_NEAR(state->afn->AirflowNetworkZnRpt(1).InfilVolume, 0.7314456, 0.001);
///EXPECT_NEAR(state->afn->AirflowNetworkZnRpt(1).InfilAirChangeRate, 0.2438, 0.001);
///EXPECT_NEAR(state->afn->AirflowNetworkZnRpt(1).InfilMass, 0.85114, 0.001);
}

TEST_F(EnergyPlusFixture, AirflowNetwork_CheckNumOfFansInAirLoopTest)
Expand Down
6 changes: 3 additions & 3 deletions tst/EnergyPlus/unit/CrossVentMgr.unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,14 @@ TEST_F(EnergyPlusFixture, CrossVentMgr_EvolveParaUCSDCV_Test)
state->afn->AirflowNetworkLinkageData.allocate(2);
state->afn->AirflowNetworkLinkageData(1).CompNum = 1;
state->afn->AirflowNetworkLinkageData(2).CompNum = 1;
AirflowNetwork::DetailedOpening the_opening;
state->afn->AirflowNetworkLinkageData(1).element = &the_opening;
state->afn->AirflowNetworkLinkageData(2).element = &the_opening;

state->afn->AirflowNetworkCompData.allocate(3);
state->afn->AirflowNetworkCompData(1).TypeNum = 1;
state->afn->AirflowNetworkCompData(1).CompTypeNum = AirflowNetwork::Type::DOP;
state->afn->AirflowNetworkCompData(2).TypeNum = 1;
state->afn->AirflowNetworkCompData(2).CompTypeNum = AirflowNetwork::Type::SCR;
state->afn->AirflowNetworkCompData(3).TypeNum = 2;
state->afn->AirflowNetworkCompData(3).CompTypeNum = AirflowNetwork::Type::SOP;

state->dataRoomAir->SurfParametersCrossDispVent.allocate(2);
state->dataRoomAir->SurfParametersCrossDispVent(1).Width = 22.715219999999999;
Expand Down

6 comments on commit 554326a

@nrel-bot
Copy link

Choose a reason for hiding this comment

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

afn-network-validation (jasondegraw) - Win64-Windows-10-VisualStudio-16: OK (2759 of 2759 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot-2
Copy link

Choose a reason for hiding this comment

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

afn-network-validation (jasondegraw) - x86_64-Linux-Ubuntu-22.04-gcc-11.4: OK (3587 of 3587 tests passed, 790 test warnings)

Messages:\n

  • 789 tests had: AUD diffs.
  • 52 tests had: ESO small diffs.
  • 71 tests had: MTR small diffs.
  • 25 tests had: MTD diffs.
  • 10 tests had: MDD diffs.

Build Badge Test Badge

@nrel-bot-3
Copy link

Choose a reason for hiding this comment

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

afn-network-validation (jasondegraw) - x86_64-MacOS-10.17-clang-14.0.0: OK (3546 of 3546 tests passed, 786 test warnings)

Messages:\n

  • 785 tests had: AUD diffs.
  • 25 tests had: MTD diffs.
  • 75 tests had: MTR small diffs.
  • 56 tests had: ESO small diffs.
  • 10 tests had: MDD diffs.

Build Badge Test Badge

@nrel-bot-2b
Copy link

Choose a reason for hiding this comment

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

afn-network-validation (jasondegraw) - x86_64-Linux-Ubuntu-22.04-gcc-11.4-UnitTestsCoverage-Debug: OK (1972 of 1972 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

@nrel-bot-2c
Copy link

Choose a reason for hiding this comment

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

afn-network-validation (jasondegraw) - x86_64-Linux-Ubuntu-22.04-gcc-11.4-IntegrationCoverage-Debug: OK (790 of 790 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

@nrel-bot-3
Copy link

Choose a reason for hiding this comment

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

afn-network-validation (jasondegraw) - x86_64-MacOS-10.18-clang-15.0.0: Tests Failed (2993 of 3546 tests passed, 234 test warnings)

Messages:\n

  • 785 tests had: AUD diffs.
  • 630 tests had: EIO diffs.
  • 15 tests had: EDD diffs.
  • 513 tests had: ESO big diffs.
  • 505 tests had: Table big diffs.
  • 130 tests had: MTR big diffs.
  • 268 tests had: ZSZ big diffs.
  • 144 tests had: ESO small diffs.
  • 398 tests had: MTR small diffs.
  • 82 tests had: Table small diffs.
  • 91 tests had: ERR diffs.
  • 169 tests had: SSZ big diffs.
  • 69 tests had: SSZ small diffs.
  • 25 tests had: MTD diffs.
  • 10 tests had: MDD diffs.
  • 1 test had: JSON big diffs.
  • 33 tests had: ZSZ small diffs.
  • 1 test had: PERF_LOG diffs.

Failures:\n

regression Test Summary

  • Passed: 234
  • Failed: 552

Build Badge Test Badge

Please sign in to comment.