From f6ae40d7e90cb6b563b248128cb20b7718cca11c Mon Sep 17 00:00:00 2001 From: "Jason W. DeGraw" Date: Wed, 30 Dec 2020 07:58:54 -0500 Subject: [PATCH] Move an object array --- .../include/AirflowNetwork/Elements.hpp | 4 +- .../AirflowNetwork/src/Elements.cpp | 8 +- src/EnergyPlus/AirflowNetwork/src/Solver.cpp | 31 +- .../AirflowNetworkBalanceManager.cc | 736 +++++++++--------- .../AirflowNetworkBalanceManager.hh | 7 + src/EnergyPlus/CrossVentMgr.cc | 24 +- src/EnergyPlus/DisplacementVentMgr.cc | 8 +- src/EnergyPlus/RoomAirModelAirflowNetwork.cc | 5 +- .../unit/AirflowNetworkBalanceManager.unit.cc | 29 +- tst/EnergyPlus/unit/CrossVentMgr.unit.cc | 4 +- .../unit/RoomAirflowNetwork.unit.cc | 22 +- 11 files changed, 463 insertions(+), 415 deletions(-) diff --git a/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Elements.hpp b/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Elements.hpp index 0893eec59b0..3a8d453c8a9 100644 --- a/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Elements.hpp +++ b/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Elements.hpp @@ -216,7 +216,7 @@ namespace AirflowNetwork { // = NumOfLinksMultiZone+NumOfLinksDistribution // RoomAirManager use //extern int AirflowNetworkNumOfSurfaces; // The number of surfaces for multizone calculation - extern int AirflowNetworkNumOfZones; // The number of zones for multizone calculation + //extern int AirflowNetworkNumOfZones; // The number of zones for multizone calculation extern bool RollBackFlag; // Roll back flag when system time step down shifting extern Array1D ANZT; // Local zone air temperature for roll back use @@ -1637,7 +1637,7 @@ namespace AirflowNetwork { // Object Data extern Array1D AirflowNetworkNodeSimu; - extern Array1D AirflowNetworkLinkSimu; + //extern Array1D AirflowNetworkLinkSimu; extern AirflowNetworkSimuProp AirflowNetworkSimu; // unique object name | AirflowNetwork control | Wind pressure coefficient input control | Integer equivalent for WPCCntr diff --git a/src/EnergyPlus/AirflowNetwork/src/Elements.cpp b/src/EnergyPlus/AirflowNetwork/src/Elements.cpp index 2a756ab53a9..2efdcf80b3c 100644 --- a/src/EnergyPlus/AirflowNetwork/src/Elements.cpp +++ b/src/EnergyPlus/AirflowNetwork/src/Elements.cpp @@ -166,7 +166,7 @@ namespace AirflowNetwork { // = NumOfLinksMultiZone+NumOfLinksDistribution // RoomAirManager use //int AirflowNetworkNumOfSurfaces(0); // The number of surfaces for multizone calculation - int AirflowNetworkNumOfZones(0); // The number of zones for multizone calculation + //int AirflowNetworkNumOfZones(0); // The number of zones for multizone calculation bool RollBackFlag(false); // Roll back flag when system time step down shifting Array1D ANZT; // Local zone air temperature for roll back use @@ -188,7 +188,7 @@ namespace AirflowNetwork { // Object Data Array1D AirflowNetworkNodeSimu; - Array1D AirflowNetworkLinkSimu; + //Array1D AirflowNetworkLinkSimu; //Array1D AirflowNetworkExchangeData; //Array1D AirflowNetworkMultiExchangeData; //Array1D AirflowNetworkLinkReport; @@ -3837,7 +3837,7 @@ namespace AirflowNetwork { AirflowNetworkNumOfComps = 0; AirflowNetworkNumOfLinks = 0; //AirflowNetworkNumOfSurfaces = 0; - AirflowNetworkNumOfZones = 0; + //AirflowNetworkNumOfZones = 0; RollBackFlag = false; ANZT.deallocate(); ANZW.deallocate(); @@ -3851,7 +3851,7 @@ namespace AirflowNetwork { VAVTerminalRatio = 0.0; VAVSystem = false; AirflowNetworkNodeSimu.deallocate(); - AirflowNetworkLinkSimu.deallocate(); + //AirflowNetworkLinkSimu.deallocate(); //AirflowNetworkExchangeData.deallocate(); //AirflowNetworkMultiExchangeData.deallocate(); //AirflowNetworkLinkReport.deallocate(); diff --git a/src/EnergyPlus/AirflowNetwork/src/Solver.cpp b/src/EnergyPlus/AirflowNetwork/src/Solver.cpp index 5de8cfb462c..e2657fdbbaa 100644 --- a/src/EnergyPlus/AirflowNetwork/src/Solver.cpp +++ b/src/EnergyPlus/AirflowNetwork/src/Solver.cpp @@ -56,6 +56,7 @@ #include #include #include +#include #include "../../Data/EnergyPlusData.hh" @@ -569,34 +570,34 @@ namespace AirflowNetwork { if (AFLOW2(i) != 0.0) { } if (AFLOW(i) > 0.0) { - AirflowNetworkLinkSimu(i).FLOW = AFLOW(i); - AirflowNetworkLinkSimu(i).FLOW2 = 0.0; + state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW = AFLOW(i); + state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 = 0.0; } else { - AirflowNetworkLinkSimu(i).FLOW = 0.0; - AirflowNetworkLinkSimu(i).FLOW2 = -AFLOW(i); + state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW = 0.0; + state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 = -AFLOW(i); } if (AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == CompTypeNum_HOP) { if (AFLOW(i) > 0.0) { - AirflowNetworkLinkSimu(i).FLOW = AFLOW(i) + AFLOW2(i); - AirflowNetworkLinkSimu(i).FLOW2 = AFLOW2(i); + state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW = AFLOW(i) + AFLOW2(i); + state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 = AFLOW2(i); } else { - AirflowNetworkLinkSimu(i).FLOW = AFLOW2(i); - AirflowNetworkLinkSimu(i).FLOW2 = -AFLOW(i) + AFLOW2(i); + state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW = AFLOW2(i); + state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 = -AFLOW(i) + AFLOW2(i); } } if (AirflowNetworkLinkageData(i).DetOpenNum > 0) { if (AFLOW2(i) != 0.0) { - AirflowNetworkLinkSimu(i).FLOW = AFLOW(i) + AFLOW2(i); - AirflowNetworkLinkSimu(i).FLOW2 = AFLOW2(i); + state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW = AFLOW(i) + AFLOW2(i); + state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 = AFLOW2(i); } } if (AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == CompTypeNum_SOP && AFLOW2(i) != 0.0) { if (AFLOW(i) >= 0.0) { - AirflowNetworkLinkSimu(i).FLOW = AFLOW(i); - AirflowNetworkLinkSimu(i).FLOW2 = std::abs(AFLOW2(i)); + state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW = AFLOW(i); + state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 = std::abs(AFLOW2(i)); } else { - AirflowNetworkLinkSimu(i).FLOW = std::abs(AFLOW2(i)); - AirflowNetworkLinkSimu(i).FLOW2 = -AFLOW(i); + state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW = std::abs(AFLOW2(i)); + state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 = -AFLOW(i); } } } @@ -913,7 +914,7 @@ namespace AirflowNetwork { DP = DisSysCompCPDData(AirflowNetworkCompData(j).TypeNum).DP; } - AirflowNetworkLinkSimu(i).DP = DP; + state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).DP = DP; AFLOW(i) = F[0]; AFLOW2(i) = 0.0; if (AirflowNetworkCompData(j).CompTypeNum == CompTypeNum_DOP) { diff --git a/src/EnergyPlus/AirflowNetworkBalanceManager.cc b/src/EnergyPlus/AirflowNetworkBalanceManager.cc index 1e7a74d665c..84dcc17df99 100644 --- a/src/EnergyPlus/AirflowNetworkBalanceManager.cc +++ b/src/EnergyPlus/AirflowNetworkBalanceManager.cc @@ -2008,11 +2008,11 @@ namespace AirflowNetwork { // *** Read AirflowNetwork simulation zone data CurrentModuleObject = "AirflowNetwork:MultiZone:Zone"; - AirflowNetworkNumOfZones = inputProcessor->getNumObjectsFound(state, CurrentModuleObject); - if (AirflowNetworkNumOfZones > 0) { - MultizoneZoneData.allocate(AirflowNetworkNumOfZones); + state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones = inputProcessor->getNumObjectsFound(state, CurrentModuleObject); + if (state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones > 0) { + MultizoneZoneData.allocate(state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones); AirflowNetworkZoneFlag.dimension(state.dataGlobal->NumOfZones, false); // AirflowNetwork zone flag - for (int i = 1; i <= AirflowNetworkNumOfZones; ++i) { + for (int i = 1; i <= state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones; ++i) { inputProcessor->getObjectItem(state, CurrentModuleObject, i, @@ -2088,7 +2088,7 @@ namespace AirflowNetwork { } // ==> Zone data validation - for (int i = 1; i <= AirflowNetworkNumOfZones; ++i) { + for (int i = 1; i <= state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones; ++i) { // Zone name validation MultizoneZoneData(i).ZoneNum = UtilityRoutines::FindItemInList(MultizoneZoneData(i).ZoneName, Zone); if (MultizoneZoneData(i).ZoneNum == 0) { @@ -2253,7 +2253,8 @@ namespace AirflowNetwork { " is required, but a blank is found."); ShowContinueError(state, format("The default value is assigned as {:.1R}", Numbers(1))); } - MultizoneExternalNodeData(i).ExtNum = AirflowNetworkNumOfZones + i; // External node number + MultizoneExternalNodeData(i).ExtNum = + state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones + i; // External node number MultizoneExternalNodeData(i).curve = CurveManager::GetCurveIndex(state, Alphas(2)); // Wind pressure curve if (MultizoneExternalNodeData(i).curve == 0) { ShowSevereError(state, RoutineName + "Invalid " + cAlphaFields(2) + "=" + Alphas(2)); @@ -2335,7 +2336,8 @@ namespace AirflowNetwork { ObjectIsParent); MultizoneExternalNodeData(i).OutAirNodeNum = NodeNum; // Name of outdoor air node MultizoneExternalNodeData(i).height = Node(NodeNum).Height; // Nodal height - MultizoneExternalNodeData(i).ExtNum = AirflowNetworkNumOfZones + i; // External node number + MultizoneExternalNodeData(i).ExtNum = + state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones + i; // External node number } } } else { @@ -2550,7 +2552,7 @@ namespace AirflowNetwork { // Ensure zones defined in inside and outside environment are used in the object of AIRFLOWNETWORK:MULTIZONE:ZONE found = false; n = Surface(MultizoneSurfaceData(i).SurfNum).Zone; - for (j = 1; j <= AirflowNetworkNumOfZones; ++j) { + for (j = 1; j <= state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones; ++j) { if (MultizoneZoneData(j).ZoneNum == n) { found = true; break; @@ -2705,7 +2707,7 @@ namespace AirflowNetwork { } } found = false; - for (j = 1; j <= AirflowNetworkNumOfZones; ++j) { + for (j = 1; j <= state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones; ++j) { if (MultizoneZoneData(j).ZoneNum == Surface(n).Zone) { found = true; break; @@ -2726,7 +2728,7 @@ namespace AirflowNetwork { n = Surface(MultizoneSurfaceData(i).SurfNum).ExtBoundCond; if (n >= 1) { // exterior boundary condition is a surface found = false; - for (j = 1; j <= AirflowNetworkNumOfZones; ++j) { + for (j = 1; j <= state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones; ++j) { if (MultizoneZoneData(j).ZoneNum == Surface(n).Zone) { found = true; break; @@ -3091,7 +3093,7 @@ namespace AirflowNetwork { } if (state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfSingleSideZones > 0) { - for (int i = 1; i <= AirflowNetworkNumOfZones; ++i) { + for (int i = 1; i <= state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones; ++i) { if (MultizoneZoneData(i).SingleSidedCpType == "ADVANCED") { print(state.files.eio, "AirflowNetwork: Advanced Single-Sided Model: Difference in Opening Wind Pressure Coefficients (DeltaCP), "); @@ -3105,7 +3107,7 @@ namespace AirflowNetwork { } // If no zone object, exit - if (AirflowNetworkNumOfZones == 0) { + if (state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones == 0) { ShowFatalError(state, RoutineName + "Errors found getting inputs. Previous error(s) cause program termination."); } // If zone node number =0, exit. @@ -3119,22 +3121,22 @@ namespace AirflowNetwork { } // Ensure at least two surfaces are exposed to a zone - ZoneCheck.allocate(AirflowNetworkNumOfZones); - ZoneBCCheck.allocate(AirflowNetworkNumOfZones); + ZoneCheck.allocate(state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones); + ZoneBCCheck.allocate(state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones); ZoneCheck = 0; ZoneBCCheck = 0; CurrentModuleObject = "AirflowNetwork:MultiZone:Surface"; for (j = 1; j <= state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfSurfaces; ++j) { - if (MultizoneSurfaceData(j).NodeNums[0] <= AirflowNetworkNumOfZones) { + if (MultizoneSurfaceData(j).NodeNums[0] <= state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones) { ++ZoneCheck(MultizoneSurfaceData(j).NodeNums[0]); ZoneBCCheck(MultizoneSurfaceData(j).NodeNums[0]) = MultizoneSurfaceData(j).NodeNums[1]; } - if (MultizoneSurfaceData(j).NodeNums[1] <= AirflowNetworkNumOfZones) { + if (MultizoneSurfaceData(j).NodeNums[1] <= state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones) { ++ZoneCheck(MultizoneSurfaceData(j).NodeNums[1]); ZoneBCCheck(MultizoneSurfaceData(j).NodeNums[1]) = MultizoneSurfaceData(j).NodeNums[0]; } } - for (int i = 1; i <= AirflowNetworkNumOfZones; ++i) { + for (int i = 1; i <= state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones; ++i) { if (ZoneCheck(i) == 0) { ShowSevereError(state, RoutineName + "AirflowNetwork:Multizone:Zone = " + MultizoneZoneData(i).ZoneName); ShowContinueError(state, " does not have any surfaces defined in " + CurrentModuleObject); @@ -3202,7 +3204,7 @@ namespace AirflowNetwork { j = MultizoneSurfaceData(i).SurfNum; if (SurfWinOriginalClass(j) == SurfaceClass::Window || SurfWinOriginalClass(j) == SurfaceClass::Door || SurfWinOriginalClass(j) == SurfaceClass::GlassDoor) { - for (n = 1; n <= AirflowNetworkNumOfZones; ++n) { + for (n = 1; n <= state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones; ++n) { if (MultizoneZoneData(n).ZoneNum == Surface(j).Zone) { if (MultizoneZoneData(n).OccupantVentilationControlNum > 0 && MultizoneSurfaceData(i).OccupantVentilationControlNum == 0) { MultizoneSurfaceData(i).OccupantVentilationControlNum = MultizoneZoneData(n).OccupantVentilationControlNum; @@ -3241,8 +3243,8 @@ namespace AirflowNetwork { ShowSevereError(state, RoutineName + CurrentModuleObject + "='" + Alphas(1) + "' invalid name " + cAlphaFields(2) + "='" + Alphas(2)); ErrorsFound = true; } - IntraZoneNodeData(i).AFNZoneNum = - UtilityRoutines::FindItemInList(Alphas(3), MultizoneZoneData, &MultizoneZoneProp::ZoneName, AirflowNetworkNumOfZones); + IntraZoneNodeData(i).AFNZoneNum = UtilityRoutines::FindItemInList( + Alphas(3), MultizoneZoneData, &MultizoneZoneProp::ZoneName, state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones); if (MultizoneZoneData(IntraZoneNodeData(i).AFNZoneNum).RAFNNodeNum == 0) { GetRAFNNodeNum(state, MultizoneZoneData(IntraZoneNodeData(i).AFNZoneNum).ZoneName, @@ -3274,7 +3276,7 @@ namespace AirflowNetwork { NumOfNodesIntraZone = state.dataAirflowNetworkBalanceManager->IntraZoneNumOfNodes; // check zone node state.dataAirflowNetworkBalanceManager->IntraZoneNumOfZones = 0; - for (int i = 1; i <= AirflowNetworkNumOfZones; ++i) { + for (int i = 1; i <= state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones; ++i) { if (MultizoneZoneData(i).RAFNNodeNum > 0) { state.dataAirflowNetworkBalanceManager->IntraZoneNumOfZones += 1; } @@ -3332,8 +3334,8 @@ namespace AirflowNetwork { // Check valid node names IntraZoneLinkageData(i).NodeNums[0] = UtilityRoutines::FindItemInList(Alphas(2), IntraZoneNodeData, state.dataAirflowNetworkBalanceManager->IntraZoneNumOfNodes); if (IntraZoneLinkageData(i).NodeNums[0] == 0) { - IntraZoneLinkageData(i).NodeNums[0] = - UtilityRoutines::FindItemInList(Alphas(2), MultizoneZoneData, &MultizoneZoneProp::ZoneName, AirflowNetworkNumOfZones); + IntraZoneLinkageData(i).NodeNums[0] = UtilityRoutines::FindItemInList( + Alphas(2), MultizoneZoneData, &MultizoneZoneProp::ZoneName, state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones); IntraZoneLinkageData(i).NodeHeights[0] = Zone(MultizoneZoneData(IntraZoneLinkageData(i).NodeNums[0]).ZoneNum).Centroid.z; if (IntraZoneLinkageData(i).NodeNums[0] == 0) { ShowSevereError(state, RoutineName + CurrentModuleObject + "='" + Alphas(1) + "': Invalid " + cAlphaFields(2) + @@ -3342,12 +3344,14 @@ namespace AirflowNetwork { } } else { IntraZoneLinkageData(i).NodeHeights[0] = IntraZoneNodeData(IntraZoneLinkageData(i).NodeNums[0]).Height; - IntraZoneLinkageData(i).NodeNums[0] = IntraZoneLinkageData(i).NodeNums[0] + AirflowNetworkNumOfZones + state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfExtNode; + IntraZoneLinkageData(i).NodeNums[0] = IntraZoneLinkageData(i).NodeNums[0] + + state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones + + state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfExtNode; } IntraZoneLinkageData(i).NodeNums[1] = UtilityRoutines::FindItemInList(Alphas(3), IntraZoneNodeData, state.dataAirflowNetworkBalanceManager->IntraZoneNumOfNodes); if (IntraZoneLinkageData(i).NodeNums[1] == 0) { - IntraZoneLinkageData(i).NodeNums[1] = - UtilityRoutines::FindItemInList(Alphas(3), MultizoneZoneData, &MultizoneZoneProp::ZoneName, AirflowNetworkNumOfZones); + IntraZoneLinkageData(i).NodeNums[1] = UtilityRoutines::FindItemInList( + Alphas(3), MultizoneZoneData, &MultizoneZoneProp::ZoneName, state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones); if (IntraZoneLinkageData(i).NodeNums[1] > 0) { IntraZoneLinkageData(i).NodeHeights[1] = Zone(MultizoneZoneData(IntraZoneLinkageData(i).NodeNums[1]).ZoneNum).Centroid.z; } else { @@ -3373,29 +3377,39 @@ namespace AirflowNetwork { } } else { IntraZoneLinkageData(i).NodeHeights[1] = IntraZoneNodeData(IntraZoneLinkageData(i).NodeNums[1]).Height; - IntraZoneLinkageData(i).NodeNums[1] = IntraZoneLinkageData(i).NodeNums[1] + AirflowNetworkNumOfZones + state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfExtNode; + IntraZoneLinkageData(i).NodeNums[1] = IntraZoneLinkageData(i).NodeNums[1] + + state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones + + state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfExtNode; } // Ensure the both linked nodes for a surface are not zone nodes.One of nodes has to be an intrazone node - if (IntraZoneLinkageData(i).NodeNums[1] <= AirflowNetworkNumOfZones && - IntraZoneLinkageData(i).NodeNums[0] <= AirflowNetworkNumOfZones) { + if (IntraZoneLinkageData(i).NodeNums[1] <= state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones && + IntraZoneLinkageData(i).NodeNums[0] <= state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones) { ShowSevereError(state, RoutineName + CurrentModuleObject + "='" + Alphas(1) + "': Invalid node inputs " + Alphas(2) + " and " + Alphas(3) + " are zone nodes"); ErrorsFound = true; } - if (IntraZoneLinkageData(i).NodeNums[0] <= AirflowNetworkNumOfZones && - IntraZoneLinkageData(i).NodeNums[1] > AirflowNetworkNumOfZones + state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfExtNode && lAlphaBlanks(5)) { + if (IntraZoneLinkageData(i).NodeNums[0] <= state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones && + IntraZoneLinkageData(i).NodeNums[1] > state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones + + state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfExtNode && + lAlphaBlanks(5)) { if (IntraZoneLinkageData(i).NodeNums[0] != - IntraZoneNodeData(IntraZoneLinkageData(i).NodeNums[1] - AirflowNetworkNumOfZones - state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfExtNode).ZoneNum) { + IntraZoneNodeData(IntraZoneLinkageData(i).NodeNums[1] - state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones - + state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfExtNode) + .ZoneNum) { ShowSevereError(state, RoutineName + CurrentModuleObject + "='" + Alphas(1) + ": Invalid zone inputs between Node and Link " + Alphas(2) + " and " + MultizoneZoneData(IntraZoneNodeData(IntraZoneLinkageData(i).NodeNums[0]).ZoneNum).ZoneName); ErrorsFound = true; } } - if (IntraZoneLinkageData(i).NodeNums[1] <= AirflowNetworkNumOfZones && - IntraZoneLinkageData(i).NodeNums[0] > AirflowNetworkNumOfZones + state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfExtNode && lAlphaBlanks(5)) { + if (IntraZoneLinkageData(i).NodeNums[1] <= state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones && + IntraZoneLinkageData(i).NodeNums[0] > state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones + + state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfExtNode && + lAlphaBlanks(5)) { if (IntraZoneLinkageData(i).NodeNums[1] != - IntraZoneNodeData(IntraZoneLinkageData(i).NodeNums[0] - AirflowNetworkNumOfZones - state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfExtNode).ZoneNum) { + IntraZoneNodeData(IntraZoneLinkageData(i).NodeNums[0] - state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones - + state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfExtNode) + .ZoneNum) { ShowSevereError(state, RoutineName + CurrentModuleObject + "='" + Alphas(1) + ": Invalid zone inputs between Node and Link " + Alphas(3) + " and " + MultizoneZoneData(IntraZoneNodeData(IntraZoneLinkageData(i).NodeNums[1]).ZoneNum).ZoneName); @@ -3413,11 +3427,13 @@ namespace AirflowNetwork { NumOfLinksIntraZone = NumOfLinksIntraZone - 1; if (Surface(MultizoneSurfaceData(j).SurfNum).ExtBoundCond == 0) { // Exterior surface NodeNums[1] should be equal - if (IntraZoneLinkageData(i).NodeNums[0] > AirflowNetworkNumOfZones + state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfExtNode) { + if (IntraZoneLinkageData(i).NodeNums[0] > state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones + + state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfExtNode) { MultizoneSurfaceData(j).RAFNflag = true; MultizoneSurfaceData(j).ZonePtr = MultizoneSurfaceData(j).NodeNums[0]; MultizoneSurfaceData(j).NodeNums[0] = IntraZoneLinkageData(i).NodeNums[0]; - } else if (IntraZoneLinkageData(i).NodeNums[1] > AirflowNetworkNumOfZones + state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfExtNode) { + } else if (IntraZoneLinkageData(i).NodeNums[1] > state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones + + state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfExtNode) { MultizoneSurfaceData(j).RAFNflag = true; MultizoneSurfaceData(j).ZonePtr = MultizoneSurfaceData(j).NodeNums[0]; MultizoneSurfaceData(j).NodeNums[0] = IntraZoneLinkageData(i).NodeNums[1]; @@ -3429,11 +3445,15 @@ namespace AirflowNetwork { } } else { // Interior surface - if (IntraZoneLinkageData(i).NodeNums[0] > AirflowNetworkNumOfZones + state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfExtNode && - IntraZoneLinkageData(i).NodeNums[1] > AirflowNetworkNumOfZones + state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfExtNode) { + if (IntraZoneLinkageData(i).NodeNums[0] > state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones + + state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfExtNode && + IntraZoneLinkageData(i).NodeNums[1] > state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones + + state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfExtNode) { MultizoneSurfaceData(j).RAFNflag = true; if (MultizoneZoneData(MultizoneSurfaceData(j).NodeNums[0]).ZoneNum == - IntraZoneNodeData(IntraZoneLinkageData(i).NodeNums[0] - AirflowNetworkNumOfZones - state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfExtNode) + IntraZoneNodeData(IntraZoneLinkageData(i).NodeNums[0] - + state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones - + state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfExtNode) .ZoneNum) { MultizoneSurfaceData(j).ZonePtr = MultizoneSurfaceData(j).NodeNums[0]; MultizoneSurfaceData(j).NodeNums[0] = IntraZoneLinkageData(i).NodeNums[0]; @@ -3443,7 +3463,8 @@ namespace AirflowNetwork { MultizoneSurfaceData(j).NodeNums[0] = IntraZoneLinkageData(i).NodeNums[1]; MultizoneSurfaceData(j).NodeNums[1] = IntraZoneLinkageData(i).NodeNums[0]; } - } else if (IntraZoneLinkageData(i).NodeNums[0] > AirflowNetworkNumOfZones + state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfExtNode) { + } else if (IntraZoneLinkageData(i).NodeNums[0] > state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones + + state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfExtNode) { MultizoneSurfaceData(j).RAFNflag = true; if (IntraZoneLinkageData(i).NodeNums[1] == MultizoneSurfaceData(j).NodeNums[0]) { MultizoneSurfaceData(j).NodeNums[1] = IntraZoneLinkageData(i).NodeNums[0]; @@ -3456,7 +3477,8 @@ namespace AirflowNetwork { " and AirflowNetwork:Multizone:Surface = " + MultizoneSurfaceData(j).SurfName); ErrorsFound = true; } - } else if (IntraZoneLinkageData(i).NodeNums[1] > AirflowNetworkNumOfZones + state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfExtNode) { + } else if (IntraZoneLinkageData(i).NodeNums[1] > state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones + + state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfExtNode) { MultizoneSurfaceData(j).RAFNflag = true; if (IntraZoneLinkageData(i).NodeNums[0] == MultizoneSurfaceData(j).NodeNums[0]) { MultizoneSurfaceData(j).NodeNums[1] = IntraZoneLinkageData(i).NodeNums[1]; @@ -3689,8 +3711,8 @@ namespace AirflowNetwork { PressureControllerData(i).Name = Alphas(1); // Object Name PressureControllerData(i).ZoneName = Alphas(2); // Zone name PressureControllerData(i).ZoneNum = UtilityRoutines::FindItemInList(Alphas(2), Zone); - PressureControllerData(i).AFNNodeNum = - UtilityRoutines::FindItemInList(Alphas(2), MultizoneZoneData, &MultizoneZoneProp::ZoneName, AirflowNetworkNumOfZones); + PressureControllerData(i).AFNNodeNum = UtilityRoutines::FindItemInList( + Alphas(2), MultizoneZoneData, &MultizoneZoneProp::ZoneName, state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones); if (PressureControllerData(i).ZoneNum == 0) { ShowSevereError(state, RoutineName + CurrentModuleObject + " object, invalid " + cAlphaFields(2) + " given."); ShowContinueError(state, "..invalid " + cAlphaFields(2) + " = \"" + PressureControllerData(i).ZoneName + "\""); @@ -3766,9 +3788,11 @@ namespace AirflowNetwork { // Assign numbers of nodes and linkages if (SimulateAirflowNetwork > AirflowNetworkControlSimple) { if (AirflowNetworkSimu.iWPCCntr == iWPCCntr_Input) { - NumOfNodesMultiZone = AirflowNetworkNumOfZones + state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfExtNode; + NumOfNodesMultiZone = state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones + + state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfExtNode; } else { - NumOfNodesMultiZone = AirflowNetworkNumOfZones + state.dataAirflowNetworkBalanceManager->NumOfExtNodes; + NumOfNodesMultiZone = + state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones + state.dataAirflowNetworkBalanceManager->NumOfExtNodes; } NumOfLinksMultiZone = state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfSurfaces; AirflowNetworkNumOfNodes = NumOfNodesMultiZone; @@ -3783,7 +3807,7 @@ namespace AirflowNetwork { // Assign node data AirflowNetworkNodeData.allocate(AirflowNetworkNumOfNodes); // Zone node - for (int i = 1; i <= AirflowNetworkNumOfZones; ++i) { + for (int i = 1; i <= state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones; ++i) { AirflowNetworkNodeData(i).Name = MultizoneZoneData(i).ZoneName; AirflowNetworkNodeData(i).NodeTypeNum = 0; AirflowNetworkNodeData(i).EPlusZoneNum = MultizoneZoneData(i).ZoneNum; @@ -3791,17 +3815,19 @@ namespace AirflowNetwork { } // External node if (AirflowNetworkSimu.iWPCCntr == iWPCCntr_Input) { - for (int i = AirflowNetworkNumOfZones + 1; i <= NumOfNodesMultiZone; ++i) { - AirflowNetworkNodeData(i).Name = MultizoneExternalNodeData(i - AirflowNetworkNumOfZones).Name; + for (int i = state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones + 1; i <= NumOfNodesMultiZone; ++i) { + AirflowNetworkNodeData(i).Name = MultizoneExternalNodeData(i - state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones).Name; AirflowNetworkNodeData(i).NodeTypeNum = 1; AirflowNetworkNodeData(i).EPlusZoneNum = 0; - AirflowNetworkNodeData(i).NodeHeight = MultizoneExternalNodeData(i - AirflowNetworkNumOfZones).height; - AirflowNetworkNodeData(i).ExtNodeNum = i - AirflowNetworkNumOfZones; - AirflowNetworkNodeData(i).OutAirNodeNum = MultizoneExternalNodeData(i - AirflowNetworkNumOfZones).OutAirNodeNum; + AirflowNetworkNodeData(i).NodeHeight = + MultizoneExternalNodeData(i - state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones).height; + AirflowNetworkNodeData(i).ExtNodeNum = i - state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones; + AirflowNetworkNodeData(i).OutAirNodeNum = + MultizoneExternalNodeData(i - state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones).OutAirNodeNum; } } else { // Surface-Average input - for (int i = AirflowNetworkNumOfZones + 1; i <= NumOfNodesMultiZone; ++i) { - n = i - AirflowNetworkNumOfZones; + for (int i = state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones + 1; i <= NumOfNodesMultiZone; ++i) { + n = i - state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones; AirflowNetworkNodeData(i).Name = MultizoneExternalNodeData(n).Name; AirflowNetworkNodeData(i).NodeTypeNum = 1; AirflowNetworkNodeData(i).EPlusZoneNum = 0; @@ -3819,7 +3845,7 @@ namespace AirflowNetwork { AirflowNetworkNodeData(i).NodeHeight = IntraZoneNodeData(n).Height; AirflowNetworkNodeData(i).RAFNNodeNum = IntraZoneNodeData(n).RAFNNodeNum; } - for (int i = 1; i <= AirflowNetworkNumOfZones; ++i) { + for (int i = 1; i <= state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones; ++i) { if (MultizoneZoneData(i).RAFNNodeNum > 0) { AirflowNetworkNodeData(i).RAFNNodeNum = MultizoneZoneData(i).RAFNNodeNum; } @@ -4239,13 +4265,13 @@ namespace AirflowNetwork { AirflowNetworkLinkageData(count).NodeHeights[0] = Zone(MultizoneZoneData(AirflowNetworkLinkageData(count).NodeNums[0]).ZoneNum).Centroid.z; } - if (AirflowNetworkLinkageData(count).NodeNums[1] <= AirflowNetworkNumOfZones) { + if (AirflowNetworkLinkageData(count).NodeNums[1] <= state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones) { if (MultizoneZoneData(AirflowNetworkLinkageData(count).NodeNums[1]).ZoneNum > 0) { AirflowNetworkLinkageData(count).NodeHeights[1] = Zone(MultizoneZoneData(AirflowNetworkLinkageData(count).NodeNums[1]).ZoneNum).Centroid.z; } } - if (AirflowNetworkLinkageData(count).NodeNums[1] > AirflowNetworkNumOfZones) { + if (AirflowNetworkLinkageData(count).NodeNums[1] > state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones) { ShowSevereError(state, RoutineName + "AirflowNetworkComponent: The horizontal opening must be located between two thermal zones at " + AirflowNetworkLinkageData(count).Name); @@ -4903,8 +4929,8 @@ namespace AirflowNetwork { } for (i = 1; i <= AirflowNetwork::AirflowNetworkNumOfLinks; ++i) { - AirflowNetwork::AirflowNetworkLinkSimu(i).FLOW = 0.0; - AirflowNetwork::AirflowNetworkLinkSimu(i).FLOW2 = 0.0; + state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW = 0.0; + state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 = 0.0; } for (i = 1; i <= state.dataGlobal->NumOfZones; ++i) { @@ -5055,12 +5081,12 @@ namespace AirflowNetwork { int SurfNum; AirflowNetworkNodeSimu.allocate(AirflowNetworkNumOfNodes); // Node simulation variable in air distribution system - AirflowNetworkLinkSimu.allocate(AirflowNetworkNumOfLinks); // Link simulation variable in air distribution system + state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu.allocate(AirflowNetworkNumOfLinks); // Link simulation variable in air distribution system state.dataAirflowNetworkBalanceManager->linkReport.allocate(AirflowNetworkNumOfLinks); // Report link simulation variable in air distribution system for (i = 1; i <= state.dataAirflowNetworkBalanceManager->DisSysNumOfCVFs; i++) { if (DisSysCompCVFData(i).FanTypeNum == FanType_SimpleOnOff) { - state.dataAirflowNetworkBalanceManager->nodeReport.allocate(AirflowNetworkNumOfZones); + state.dataAirflowNetworkBalanceManager->nodeReport.allocate(state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones); state.dataAirflowNetworkBalanceManager->linkReport1.allocate(state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfSurfaces); break; } @@ -5116,7 +5142,8 @@ namespace AirflowNetwork { "Average", AirflowNetworkNodeData(i).Name); } - if (!(state.dataAirflowNetworkBalanceManager->SupplyFanType == FanType_SimpleOnOff && i <= AirflowNetworkNumOfZones)) { + if (!(state.dataAirflowNetworkBalanceManager->SupplyFanType == FanType_SimpleOnOff && + i <= state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones)) { SetupOutputVariable(state, "AFN Node Total Pressure", OutputProcessor::Unit::Pa, @@ -5170,7 +5197,7 @@ namespace AirflowNetwork { SetupOutputVariable(state, "AFN Linkage Node 1 to Node 2 Pressure Difference", OutputProcessor::Unit::Pa, - AirflowNetworkLinkSimu(i).DP, + state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).DP, "System", "Average", AirflowNetworkLinkageData(i).Name); @@ -5628,7 +5655,7 @@ namespace AirflowNetwork { } if (OnOffFanFlag) { - for (i = 1; i <= AirflowNetworkNumOfZones; ++i) { + for (i = 1; i <= state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones; ++i) { SetupOutputVariable(state, "AFN Zone Average Pressure", OutputProcessor::Unit::Pa, state.dataAirflowNetworkBalanceManager->nodeReport(i).PZ, "System", "Average", Zone(i).Name); SetupOutputVariable(state, @@ -6250,7 +6277,7 @@ namespace AirflowNetwork { AirflowNetworkNumOfExtNode = AirflowNetworkNumOfExtSurfaces; NumOfExtNodes = AirflowNetworkNumOfExtSurfaces; for (ExtNum = 1; ExtNum <= NumOfExtNodes; ++ExtNum) { - AirflowNetwork::MultizoneExternalNodeData(ExtNum).ExtNum = AirflowNetwork::AirflowNetworkNumOfZones + ExtNum; + AirflowNetwork::MultizoneExternalNodeData(ExtNum).ExtNum = state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones + ExtNum; AirflowNetwork::MultizoneExternalNodeData(ExtNum).Name = format("ExtNode{:4}", ExtNum); } @@ -6295,7 +6322,7 @@ namespace AirflowNetwork { } // Check if using the advanced single sided model - for (AFNZnNum = 1; AFNZnNum <= AirflowNetwork::AirflowNetworkNumOfZones; ++AFNZnNum) { + for (AFNZnNum = 1; AFNZnNum <= state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones; ++AFNZnNum) { if (AirflowNetwork::MultizoneZoneData(AFNZnNum).SingleSidedCpType == "ADVANCED") { ++AirflowNetworkNumOfSingleSideZones; } @@ -6717,7 +6744,7 @@ namespace AirflowNetwork { // Calculate duct conduction loss if (CompTypeNum == CompTypeNum_DWC && CompName == std::string()) { // Duct element only TypeNum = AirflowNetworkCompData(CompNum).TypeNum; - if (AirflowNetworkLinkSimu(i).FLOW > 0.0) { // flow direction is the same as input from node 1 to node 2 + if (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW > 0.0) { // flow direction is the same as input from node 1 to node 2 LF = AirflowNetworkLinkageData(i).NodeNums[0]; LT = AirflowNetworkLinkageData(i).NodeNums[1]; DirSign = 1.0; @@ -6727,7 +6754,8 @@ namespace AirflowNetwork { DirSign = -1.0; } // Fatal error when return flow is opposite to the desired direction - if (AirflowNetworkLinkSimu(i).FLOW == 0.0 && AirflowNetworkLinkSimu(i).FLOW2 > 0.0) { + if (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW == 0.0 && + state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 > 0.0) { if (state.dataAirflowNetworkBalanceManager->LoopOnOffFlag(AirflowNetworkLinkageData(i).AirLoopNum)) { ShowSevereError(state, "AirflowNetwork: The airflow direction is opposite to the intended direction (from node 1 to node 2) in " "AirflowNetwork:Distribution:Linkage = " + @@ -6779,7 +6807,7 @@ namespace AirflowNetwork { UThermal_iter = UThermal; Real64 RThermConvIn = CalcDuctInsideConvResist(Tin, - AirflowNetworkLinkSimu(i).FLOW, + state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW, DisSysCompDuctData(TypeNum).hydraulicDiameter, DisSysCompDuctData(TypeNum).InsideConvCoeff); Real64 RThermConvOut = CalcDuctOutsideConvResist(state, @@ -6795,14 +6823,14 @@ namespace AirflowNetwork { UThermal = pow(RThermTotal, -1); // Duct conduction, assuming effectiveness = 1 - exp(-NTU) - Ei = General::epexp(-UThermal * DuctSurfArea, (DirSign * AirflowNetworkLinkSimu(i).FLOW * CpAir)); - Real64 QCondDuct = std::abs(AirflowNetworkLinkSimu(i).FLOW) * CpAir * (Tamb - Tin) * (1 - Ei); + Ei = General::epexp(-UThermal * DuctSurfArea, (DirSign * state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW * CpAir)); + Real64 QCondDuct = std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW) * CpAir * (Tamb - Tin) * (1 - Ei); TDuctSurf = Tamb - QCondDuct * RThermConvOut / DuctSurfArea; } } else { // Air-to-air only. U and h values are all known Real64 RThermConvIn = CalcDuctInsideConvResist(Tin, - AirflowNetworkLinkSimu(i).FLOW, + state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW, DisSysCompDuctData(TypeNum).hydraulicDiameter, DisSysCompDuctData(TypeNum).InsideConvCoeff); Real64 RThermConvOut = CalcDuctOutsideConvResist(state, @@ -6833,7 +6861,7 @@ namespace AirflowNetwork { UThermal_iter = UThermal; Real64 RThermConvIn = CalcDuctInsideConvResist(Tin_ave, - AirflowNetworkLinkSimu(i).FLOW, + state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW, DisSysCompDuctData(TypeNum).hydraulicDiameter, DisSysCompDuctData(TypeNum).InsideConvCoeff); Real64 RThermConvOut = CalcDuctOutsideConvResist(state, @@ -6888,7 +6916,7 @@ namespace AirflowNetwork { Real64 RThermTotal = RThermConvIn + RThermConduct + 1 / (hOut + hrj_sum); UThermal = pow(RThermTotal, -1); - Real64 NTU = UThermal * DuctSurfArea / (DirSign * AirflowNetworkLinkSimu(i).FLOW * CpAir); + Real64 NTU = UThermal * DuctSurfArea / (DirSign * state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW * CpAir); Tin_ave = Tsurr + (Tin - Tsurr) * (1 / NTU) * (1 - exp(-NTU)); TDuctSurf = Tin_ave - UThermal * (RThermConvIn + RThermConduct) * (Tin_ave - Tsurr); @@ -6912,21 +6940,21 @@ namespace AirflowNetwork { UThermal = (VFObj.QRad + VFObj.QConv) / (DuctSurfArea * std::abs(Tsurr - Tin)); } - if (!state.dataAirflowNetworkBalanceManager->LoopOnOffFlag(AirflowNetworkLinkageData(i).AirLoopNum) && AirflowNetworkLinkSimu(i).FLOW <= 0.0) { - Ei = General::epexp(-UThermal * DuctSurfArea, (AirflowNetworkLinkSimu(i).FLOW2 * CpAir)); - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(AirflowNetworkLinkSimu(i).FLOW2) * CpAir; - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(AirflowNetworkLinkSimu(i).FLOW2) * CpAir * Ei; - state.dataAirflowNetworkBalanceManager->MV(LT) += std::abs(AirflowNetworkLinkSimu(i).FLOW2) * Tsurr * (1.0 - Ei) * CpAir; + if (!state.dataAirflowNetworkBalanceManager->LoopOnOffFlag(AirflowNetworkLinkageData(i).AirLoopNum) && state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW <= 0.0) { + Ei = General::epexp(-UThermal * DuctSurfArea, (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 * CpAir)); + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2) * CpAir; + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2) * CpAir * Ei; + state.dataAirflowNetworkBalanceManager->MV(LT) += std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2) * Tsurr * (1.0 - Ei) * CpAir; } else { - Ei = General::epexp(-UThermal * DuctSurfArea, (DirSign * AirflowNetworkLinkSimu(i).FLOW * CpAir)); - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(AirflowNetworkLinkSimu(i).FLOW) * CpAir; - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(AirflowNetworkLinkSimu(i).FLOW) * CpAir * Ei; - state.dataAirflowNetworkBalanceManager->MV(LT) += std::abs(AirflowNetworkLinkSimu(i).FLOW) * Tsurr * (1.0 - Ei) * CpAir; + Ei = General::epexp(-UThermal * DuctSurfArea, (DirSign * state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW * CpAir)); + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW) * CpAir; + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW) * CpAir * Ei; + state.dataAirflowNetworkBalanceManager->MV(LT) += std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW) * Tsurr * (1.0 - Ei) * CpAir; } } if (CompTypeNum == CompTypeNum_TMU) { // Reheat unit: SINGLE DUCT:CONST VOLUME:REHEAT TypeNum = AirflowNetworkCompData(CompNum).TypeNum; - if (AirflowNetworkLinkSimu(i).FLOW > 0.0) { // flow direction is the same as input from node 1 to node 2 + if (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW > 0.0) { // flow direction is the same as input from node 1 to node 2 LF = AirflowNetworkLinkageData(i).NodeNums[0]; LT = AirflowNetworkLinkageData(i).NodeNums[1]; DirSign = 1.0; @@ -6936,23 +6964,23 @@ namespace AirflowNetwork { DirSign = -1.0; } Ei = General::epexp(-0.001 * DisSysCompTermUnitData(TypeNum).L * DisSysCompTermUnitData(TypeNum).hydraulicDiameter * DataGlobalConstants::Pi, - (DirSign * AirflowNetworkLinkSimu(i).FLOW * CpAir)); + (DirSign * state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW * CpAir)); Tamb = AirflowNetworkNodeSimu(LT).TZ; - if (!state.dataAirflowNetworkBalanceManager->LoopOnOffFlag(AirflowNetworkLinkageData(i).AirLoopNum) && AirflowNetworkLinkSimu(i).FLOW <= 0.0) { + if (!state.dataAirflowNetworkBalanceManager->LoopOnOffFlag(AirflowNetworkLinkageData(i).AirLoopNum) && state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW <= 0.0) { Ei = General::epexp(-0.001 * DisSysCompTermUnitData(TypeNum).L * DisSysCompTermUnitData(TypeNum).hydraulicDiameter * DataGlobalConstants::Pi, - (AirflowNetworkLinkSimu(i).FLOW2 * CpAir)); - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(AirflowNetworkLinkSimu(i).FLOW2) * CpAir; - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(AirflowNetworkLinkSimu(i).FLOW2) * CpAir * Ei; - state.dataAirflowNetworkBalanceManager->MV(LT) += std::abs(AirflowNetworkLinkSimu(i).FLOW2) * Tamb * (1.0 - Ei) * CpAir; + (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 * CpAir)); + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2) * CpAir; + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2) * CpAir * Ei; + state.dataAirflowNetworkBalanceManager->MV(LT) += std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2) * Tamb * (1.0 - Ei) * CpAir; } else { - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(AirflowNetworkLinkSimu(i).FLOW) * CpAir; - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(AirflowNetworkLinkSimu(i).FLOW) * CpAir * Ei; - state.dataAirflowNetworkBalanceManager->MV(LT) += std::abs(AirflowNetworkLinkSimu(i).FLOW) * Tamb * (1.0 - Ei) * CpAir; + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW) * CpAir; + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW) * CpAir * Ei; + state.dataAirflowNetworkBalanceManager->MV(LT) += std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW) * Tamb * (1.0 - Ei) * CpAir; } } if (CompTypeNum == CompTypeNum_COI) { // heating or cooling coil TypeNum = AirflowNetworkCompData(CompNum).TypeNum; - if (AirflowNetworkLinkSimu(i).FLOW > 0.0) { // flow direction is the same as input from node 1 to node 2 + if (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW > 0.0) { // flow direction is the same as input from node 1 to node 2 LF = AirflowNetworkLinkageData(i).NodeNums[0]; LT = AirflowNetworkLinkageData(i).NodeNums[1]; DirSign = 1.0; @@ -6964,19 +6992,19 @@ namespace AirflowNetwork { } // Calculate temp in a constant pressure drop element if (CompTypeNum == CompTypeNum_CPD && CompName == std::string()) { // constant pressure element only - if (AirflowNetworkLinkSimu(i).FLOW > 0.0) { // flow direction is the same as input from node 1 to node 2 + if (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW > 0.0) { // flow direction is the same as input from node 1 to node 2 LF = AirflowNetworkLinkageData(i).NodeNums[0]; LT = AirflowNetworkLinkageData(i).NodeNums[1]; } else { // flow direction is the opposite as input from node 2 to node 1 LF = AirflowNetworkLinkageData(i).NodeNums[1]; LT = AirflowNetworkLinkageData(i).NodeNums[0]; } - if (!state.dataAirflowNetworkBalanceManager->LoopOnOffFlag(AirflowNetworkLinkageData(i).AirLoopNum) && AirflowNetworkLinkSimu(i).FLOW <= 0.0) { - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(AirflowNetworkLinkSimu(i).FLOW2) * CpAir; - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(AirflowNetworkLinkSimu(i).FLOW2) * CpAir; + if (!state.dataAirflowNetworkBalanceManager->LoopOnOffFlag(AirflowNetworkLinkageData(i).AirLoopNum) && state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW <= 0.0) { + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2) * CpAir; + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2) * CpAir; } else { - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(AirflowNetworkLinkSimu(i).FLOW) * CpAir; - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(AirflowNetworkLinkSimu(i).FLOW) * CpAir; + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW) * CpAir; + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW) * CpAir; } state.dataAirflowNetworkBalanceManager->MV(LT) = 0.0; } @@ -6984,32 +7012,32 @@ namespace AirflowNetwork { if ((CompTypeNum == CompTypeNum_PLR || CompTypeNum == CompTypeNum_ELR) && CompName == std::string()) { // Return leak element only if ((AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[0]).EPlusZoneNum > 0) && - (AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[1]).EPlusZoneNum == 0) && (AirflowNetworkLinkSimu(i).FLOW > 0.0)) { + (AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[1]).EPlusZoneNum == 0) && (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW > 0.0)) { LF = AirflowNetworkLinkageData(i).NodeNums[0]; LT = AirflowNetworkLinkageData(i).NodeNums[1]; - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(AirflowNetworkLinkSimu(i).FLOW) * CpAir; - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(AirflowNetworkLinkSimu(i).FLOW) * CpAir; + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW) * CpAir; + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW) * CpAir; } if ((AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[0]).ExtNodeNum > 0) && - (AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[1]).EPlusZoneNum == 0) && (AirflowNetworkLinkSimu(i).FLOW > 0.0)) { + (AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[1]).EPlusZoneNum == 0) && (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW > 0.0)) { LF = AirflowNetworkLinkageData(i).NodeNums[0]; LT = AirflowNetworkLinkageData(i).NodeNums[1]; - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(AirflowNetworkLinkSimu(i).FLOW) * CpAir; - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(AirflowNetworkLinkSimu(i).FLOW) * CpAir; + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW) * CpAir; + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW) * CpAir; } if ((AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[1]).EPlusZoneNum > 0) && - (AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[0]).EPlusZoneNum == 0) && (AirflowNetworkLinkSimu(i).FLOW2 > 0.0)) { + (AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[0]).EPlusZoneNum == 0) && (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 > 0.0)) { LF = AirflowNetworkLinkageData(i).NodeNums[1]; LT = AirflowNetworkLinkageData(i).NodeNums[0]; - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(AirflowNetworkLinkSimu(i).FLOW2) * CpAir; - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(AirflowNetworkLinkSimu(i).FLOW2) * CpAir; + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2) * CpAir; + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2) * CpAir; } if ((AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[1]).ExtNodeNum > 0) && - (AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[0]).EPlusZoneNum == 0) && (AirflowNetworkLinkSimu(i).FLOW2 > 0.0)) { + (AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[0]).EPlusZoneNum == 0) && (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 > 0.0)) { LF = AirflowNetworkLinkageData(i).NodeNums[1]; LT = AirflowNetworkLinkageData(i).NodeNums[0]; - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(AirflowNetworkLinkSimu(i).FLOW2) * CpAir; - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(AirflowNetworkLinkSimu(i).FLOW2) * CpAir; + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2) * CpAir; + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2) * CpAir; } } // Check reheat unit or coil @@ -7026,7 +7054,7 @@ namespace AirflowNetwork { ShowFatalError(state, "Node number in the primary air loop is not found in AIRFLOWNETWORK:DISTRIBUTION:NODE = " + AirflowNetworkLinkageData(i).Name); } - if (AirflowNetworkLinkSimu(i).FLOW > 0.0) { + if (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW > 0.0) { LF = AirflowNetworkLinkageData(i).NodeNums[0]; LT = AirflowNetworkLinkageData(i).NodeNums[1]; load = Node(NT).Temp - Node(NF).Temp; @@ -7036,7 +7064,7 @@ namespace AirflowNetwork { load = Node(NF).Temp - Node(NT).Temp; } CpAir = PsyCpAirFnW(Node(NT).HumRat); - state.dataAirflowNetworkBalanceManager->MV(LT) += AirflowNetworkLinkSimu(i).FLOW * CpAir * load; + state.dataAirflowNetworkBalanceManager->MV(LT) += state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW * CpAir * load; } } @@ -7187,7 +7215,7 @@ namespace AirflowNetwork { // Calculate duct moisture diffusion loss if (CompTypeNum == CompTypeNum_DWC && CompName == std::string()) { // Duct component only TypeNum = AirflowNetworkCompData(CompNum).TypeNum; - if (AirflowNetworkLinkSimu(i).FLOW > 0.0) { // flow direction is the same as input from node 1 to node 2 + if (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW > 0.0) { // flow direction is the same as input from node 1 to node 2 LF = AirflowNetworkLinkageData(i).NodeNums[0]; LT = AirflowNetworkLinkageData(i).NodeNums[1]; DirSign = 1.0; @@ -7197,7 +7225,7 @@ namespace AirflowNetwork { DirSign = -1.0; } Ei = General::epexp(-DisSysCompDuctData(TypeNum).UMoisture * DisSysCompDuctData(TypeNum).L * - DisSysCompDuctData(TypeNum).hydraulicDiameter * DataGlobalConstants::Pi, (DirSign * AirflowNetworkLinkSimu(i).FLOW)); + DisSysCompDuctData(TypeNum).hydraulicDiameter * DataGlobalConstants::Pi, (DirSign * state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW)); if (AirflowNetworkLinkageData(i).ZoneNum < 0) { Wamb = state.dataEnvrn->OutHumRat; } else if (AirflowNetworkLinkageData(i).ZoneNum == 0) { @@ -7205,21 +7233,21 @@ namespace AirflowNetwork { } else { Wamb = ANZW(AirflowNetworkLinkageData(i).ZoneNum); } - if (!state.dataAirflowNetworkBalanceManager->LoopOnOffFlag(AirflowNetworkLinkageData(i).AirLoopNum) && AirflowNetworkLinkSimu(i).FLOW <= 0.0) { + if (!state.dataAirflowNetworkBalanceManager->LoopOnOffFlag(AirflowNetworkLinkageData(i).AirLoopNum) && state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW <= 0.0) { Ei = General::epexp(-DisSysCompDuctData(TypeNum).UMoisture * DisSysCompDuctData(TypeNum).L * - DisSysCompDuctData(TypeNum).hydraulicDiameter * DataGlobalConstants::Pi, (AirflowNetworkLinkSimu(i).FLOW2)); - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(AirflowNetworkLinkSimu(i).FLOW2); - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(AirflowNetworkLinkSimu(i).FLOW2) * Ei; - state.dataAirflowNetworkBalanceManager->MV(LT) += std::abs(AirflowNetworkLinkSimu(i).FLOW2) * Wamb * (1.0 - Ei); + DisSysCompDuctData(TypeNum).hydraulicDiameter * DataGlobalConstants::Pi, (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2)); + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2); + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2) * Ei; + state.dataAirflowNetworkBalanceManager->MV(LT) += std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2) * Wamb * (1.0 - Ei); } else { - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(AirflowNetworkLinkSimu(i).FLOW); - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(AirflowNetworkLinkSimu(i).FLOW) * Ei; - state.dataAirflowNetworkBalanceManager->MV(LT) += std::abs(AirflowNetworkLinkSimu(i).FLOW) * Wamb * (1.0 - Ei); + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW); + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW) * Ei; + state.dataAirflowNetworkBalanceManager->MV(LT) += std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW) * Wamb * (1.0 - Ei); } } if (CompTypeNum == CompTypeNum_TMU) { // Reheat unit: SINGLE DUCT:CONST VOLUME:REHEAT TypeNum = AirflowNetworkCompData(CompNum).TypeNum; - if (AirflowNetworkLinkSimu(i).FLOW > 0.0) { // flow direction is the same as input from node 1 to node 2 + if (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW > 0.0) { // flow direction is the same as input from node 1 to node 2 LF = AirflowNetworkLinkageData(i).NodeNums[0]; LT = AirflowNetworkLinkageData(i).NodeNums[1]; DirSign = 1.0; @@ -7229,24 +7257,25 @@ namespace AirflowNetwork { DirSign = -1.0; } Ei = General::epexp(-0.0001 * DisSysCompTermUnitData(TypeNum).L * DisSysCompTermUnitData(TypeNum).hydraulicDiameter * DataGlobalConstants::Pi, - (DirSign * AirflowNetworkLinkSimu(i).FLOW)); + (DirSign * state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW)); Wamb = AirflowNetworkNodeSimu(LT).WZ; - if (!state.dataAirflowNetworkBalanceManager->LoopOnOffFlag(AirflowNetworkLinkageData(i).AirLoopNum) && AirflowNetworkLinkSimu(i).FLOW <= 0.0) { + if (!state.dataAirflowNetworkBalanceManager->LoopOnOffFlag(AirflowNetworkLinkageData(i).AirLoopNum) && + state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW <= 0.0) { Ei = General::epexp(-0.0001 * DisSysCompTermUnitData(TypeNum).L * DisSysCompTermUnitData(TypeNum).hydraulicDiameter * DataGlobalConstants::Pi, - (AirflowNetworkLinkSimu(i).FLOW2)); - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(AirflowNetworkLinkSimu(i).FLOW2); - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(AirflowNetworkLinkSimu(i).FLOW2) * Ei; - state.dataAirflowNetworkBalanceManager->MV(LT) += std::abs(AirflowNetworkLinkSimu(i).FLOW2) * Wamb * (1.0 - Ei); + (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2)); + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2); + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2) * Ei; + state.dataAirflowNetworkBalanceManager->MV(LT) += std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2) * Wamb * (1.0 - Ei); } else { - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(AirflowNetworkLinkSimu(i).FLOW); - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(AirflowNetworkLinkSimu(i).FLOW) * Ei; - state.dataAirflowNetworkBalanceManager->MV(LT) += std::abs(AirflowNetworkLinkSimu(i).FLOW) * Wamb * (1.0 - Ei); + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW); + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW) * Ei; + state.dataAirflowNetworkBalanceManager->MV(LT) += std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW) * Wamb * (1.0 - Ei); } } if (CompTypeNum == CompTypeNum_COI) { // heating or cooling coil TypeNum = AirflowNetworkCompData(CompNum).TypeNum; - if (AirflowNetworkLinkSimu(i).FLOW > 0.0) { // flow direction is the same as input from node 1 to node 2 + if (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW > 0.0) { // flow direction is the same as input from node 1 to node 2 LF = AirflowNetworkLinkageData(i).NodeNums[0]; LT = AirflowNetworkLinkageData(i).NodeNums[1]; DirSign = 1.0; @@ -7258,19 +7287,19 @@ namespace AirflowNetwork { } // Calculate temp in a constant pressure drop component if (CompTypeNum == CompTypeNum_CPD && CompName == std::string()) { // constant pressure element only - if (AirflowNetworkLinkSimu(i).FLOW > 0.0) { // flow direction is the same as input from node 1 to node 2 + if (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW > 0.0) { // flow direction is the same as input from node 1 to node 2 LF = AirflowNetworkLinkageData(i).NodeNums[0]; LT = AirflowNetworkLinkageData(i).NodeNums[1]; } else { // flow direction is the opposite as input from node 2 to node 1 LF = AirflowNetworkLinkageData(i).NodeNums[1]; LT = AirflowNetworkLinkageData(i).NodeNums[0]; } - if (!state.dataAirflowNetworkBalanceManager->LoopOnOffFlag(AirflowNetworkLinkageData(i).AirLoopNum) && AirflowNetworkLinkSimu(i).FLOW <= 0.0) { - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(AirflowNetworkLinkSimu(i).FLOW2); - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(AirflowNetworkLinkSimu(i).FLOW2); + if (!state.dataAirflowNetworkBalanceManager->LoopOnOffFlag(AirflowNetworkLinkageData(i).AirLoopNum) && state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW <= 0.0) { + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2); + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2); } else { - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(AirflowNetworkLinkSimu(i).FLOW); - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(AirflowNetworkLinkSimu(i).FLOW); + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW); + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW); } state.dataAirflowNetworkBalanceManager->MV(LT) = 0.0; } @@ -7278,32 +7307,32 @@ namespace AirflowNetwork { if ((CompTypeNum == CompTypeNum_PLR || CompTypeNum == CompTypeNum_ELR) && CompName == std::string()) { // Return leak component only if ((AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[0]).EPlusZoneNum > 0) && - (AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[1]).EPlusZoneNum == 0) && (AirflowNetworkLinkSimu(i).FLOW > 0.0)) { + (AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[1]).EPlusZoneNum == 0) && (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW > 0.0)) { LF = AirflowNetworkLinkageData(i).NodeNums[0]; LT = AirflowNetworkLinkageData(i).NodeNums[1]; - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(AirflowNetworkLinkSimu(i).FLOW); - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(AirflowNetworkLinkSimu(i).FLOW); + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW); + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW); } if ((AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[0]).ExtNodeNum > 0) && - (AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[1]).EPlusZoneNum == 0) && (AirflowNetworkLinkSimu(i).FLOW > 0.0)) { + (AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[1]).EPlusZoneNum == 0) && (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW > 0.0)) { LF = AirflowNetworkLinkageData(i).NodeNums[0]; LT = AirflowNetworkLinkageData(i).NodeNums[1]; - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(AirflowNetworkLinkSimu(i).FLOW); - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(AirflowNetworkLinkSimu(i).FLOW); + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW); + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW); } if ((AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[1]).EPlusZoneNum > 0) && - (AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[0]).EPlusZoneNum == 0) && (AirflowNetworkLinkSimu(i).FLOW2 > 0.0)) { + (AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[0]).EPlusZoneNum == 0) && (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 > 0.0)) { LF = AirflowNetworkLinkageData(i).NodeNums[1]; LT = AirflowNetworkLinkageData(i).NodeNums[0]; - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(AirflowNetworkLinkSimu(i).FLOW2); - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(AirflowNetworkLinkSimu(i).FLOW2); + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2); + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2); } if ((AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[1]).ExtNodeNum > 0) && - (AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[0]).EPlusZoneNum == 0) && (AirflowNetworkLinkSimu(i).FLOW2 > 0.0)) { + (AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[0]).EPlusZoneNum == 0) && (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 > 0.0)) { LF = AirflowNetworkLinkageData(i).NodeNums[1]; LT = AirflowNetworkLinkageData(i).NodeNums[0]; - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(AirflowNetworkLinkSimu(i).FLOW2); - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(AirflowNetworkLinkSimu(i).FLOW2); + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2); + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2); } } // Check reheat unit @@ -7320,7 +7349,7 @@ namespace AirflowNetwork { ShowFatalError(state, "Node number in the primary air loop is not found in AIRFLOWNETWORK:DISTRIBUTION:NODE = " + AirflowNetworkLinkageData(i).Name); } - if (AirflowNetworkLinkSimu(i).FLOW > 0.0) { + if (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW > 0.0) { LF = AirflowNetworkLinkageData(i).NodeNums[0]; LT = AirflowNetworkLinkageData(i).NodeNums[1]; load = Node(NT).HumRat - Node(NF).HumRat; @@ -7329,7 +7358,7 @@ namespace AirflowNetwork { LT = AirflowNetworkLinkageData(i).NodeNums[0]; load = Node(NF).HumRat - Node(NT).HumRat; } - state.dataAirflowNetworkBalanceManager->MV(LT) += AirflowNetworkLinkSimu(i).FLOW * load; + state.dataAirflowNetworkBalanceManager->MV(LT) += state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW * load; } } @@ -7465,7 +7494,7 @@ namespace AirflowNetwork { // Calculate duct moisture diffusion loss if (CompTypeNum == CompTypeNum_DWC && CompName == std::string()) { // Duct component only TypeNum = AirflowNetworkCompData(CompNum).TypeNum; - if (AirflowNetworkLinkSimu(i).FLOW > 0.0) { // flow direction is the same as input from node 1 to node 2 + if (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW > 0.0) { // flow direction is the same as input from node 1 to node 2 LF = AirflowNetworkLinkageData(i).NodeNums[0]; LT = AirflowNetworkLinkageData(i).NodeNums[1]; DirSign = 1.0; @@ -7474,12 +7503,12 @@ namespace AirflowNetwork { LT = AirflowNetworkLinkageData(i).NodeNums[0]; DirSign = -1.0; } - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(AirflowNetworkLinkSimu(i).FLOW); - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(AirflowNetworkLinkSimu(i).FLOW); + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW); + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW); } if (CompTypeNum == CompTypeNum_TMU) { // Reheat unit: SINGLE DUCT:CONST VOLUME:REHEAT TypeNum = AirflowNetworkCompData(CompNum).TypeNum; - if (AirflowNetworkLinkSimu(i).FLOW > 0.0) { // flow direction is the same as input from node 1 to node 2 + if (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW > 0.0) { // flow direction is the same as input from node 1 to node 2 LF = AirflowNetworkLinkageData(i).NodeNums[0]; LT = AirflowNetworkLinkageData(i).NodeNums[1]; DirSign = 1.0; @@ -7488,12 +7517,12 @@ namespace AirflowNetwork { LT = AirflowNetworkLinkageData(i).NodeNums[0]; DirSign = -1.0; } - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(AirflowNetworkLinkSimu(i).FLOW); - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(AirflowNetworkLinkSimu(i).FLOW); + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW); + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW); } if (CompTypeNum == CompTypeNum_COI) { // heating or cooling coil TypeNum = AirflowNetworkCompData(CompNum).TypeNum; - if (AirflowNetworkLinkSimu(i).FLOW > 0.0) { // flow direction is the same as input from node 1 to node 2 + if (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW > 0.0) { // flow direction is the same as input from node 1 to node 2 LF = AirflowNetworkLinkageData(i).NodeNums[0]; LT = AirflowNetworkLinkageData(i).NodeNums[1]; DirSign = 1.0; @@ -7505,47 +7534,47 @@ namespace AirflowNetwork { } // Calculate temp in a constant pressure drop component if (CompTypeNum == CompTypeNum_CPD && CompName == std::string()) { // constant pressure element only - if (AirflowNetworkLinkSimu(i).FLOW > 0.0) { // flow direction is the same as input from node 1 to node 2 + if (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW > 0.0) { // flow direction is the same as input from node 1 to node 2 LF = AirflowNetworkLinkageData(i).NodeNums[0]; LT = AirflowNetworkLinkageData(i).NodeNums[1]; } else { // flow direction is the opposite as input from node 2 to node 1 LF = AirflowNetworkLinkageData(i).NodeNums[1]; LT = AirflowNetworkLinkageData(i).NodeNums[0]; } - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(AirflowNetworkLinkSimu(i).FLOW); - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(AirflowNetworkLinkSimu(i).FLOW); + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW); + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW); state.dataAirflowNetworkBalanceManager->MV(LT) = 0.0; } // Calculate return leak if ((CompTypeNum == CompTypeNum_PLR || CompTypeNum == CompTypeNum_ELR) && CompName == std::string()) { // Return leak component only if ((AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[0]).EPlusZoneNum > 0) && - (AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[1]).EPlusZoneNum == 0) && (AirflowNetworkLinkSimu(i).FLOW > 0.0)) { + (AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[1]).EPlusZoneNum == 0) && (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW > 0.0)) { LF = AirflowNetworkLinkageData(i).NodeNums[0]; LT = AirflowNetworkLinkageData(i).NodeNums[1]; - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(AirflowNetworkLinkSimu(i).FLOW); - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(AirflowNetworkLinkSimu(i).FLOW); + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW); + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW); } if ((AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[0]).ExtNodeNum > 0) && - (AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[1]).EPlusZoneNum == 0) && (AirflowNetworkLinkSimu(i).FLOW > 0.0)) { + (AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[1]).EPlusZoneNum == 0) && (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW > 0.0)) { LF = AirflowNetworkLinkageData(i).NodeNums[0]; LT = AirflowNetworkLinkageData(i).NodeNums[1]; - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(AirflowNetworkLinkSimu(i).FLOW); - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(AirflowNetworkLinkSimu(i).FLOW); + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW); + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW); } if ((AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[1]).EPlusZoneNum > 0) && - (AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[0]).EPlusZoneNum == 0) && (AirflowNetworkLinkSimu(i).FLOW2 > 0.0)) { + (AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[0]).EPlusZoneNum == 0) && (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 > 0.0)) { LF = AirflowNetworkLinkageData(i).NodeNums[1]; LT = AirflowNetworkLinkageData(i).NodeNums[0]; - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(AirflowNetworkLinkSimu(i).FLOW2); - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(AirflowNetworkLinkSimu(i).FLOW2); + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2); + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2); } if ((AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[1]).ExtNodeNum > 0) && - (AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[0]).EPlusZoneNum == 0) && (AirflowNetworkLinkSimu(i).FLOW2 > 0.0)) { + (AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[0]).EPlusZoneNum == 0) && (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 > 0.0)) { LF = AirflowNetworkLinkageData(i).NodeNums[1]; LT = AirflowNetworkLinkageData(i).NodeNums[0]; - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(AirflowNetworkLinkSimu(i).FLOW2); - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(AirflowNetworkLinkSimu(i).FLOW2); + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2); + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2); } } } @@ -7675,7 +7704,7 @@ namespace AirflowNetwork { // Calculate duct moisture diffusion loss if (CompTypeNum == CompTypeNum_DWC && CompName == std::string()) { // Duct component only TypeNum = AirflowNetworkCompData(CompNum).TypeNum; - if (AirflowNetworkLinkSimu(i).FLOW > 0.0) { // flow direction is the same as input from node 1 to node 2 + if (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW > 0.0) { // flow direction is the same as input from node 1 to node 2 LF = AirflowNetworkLinkageData(i).NodeNums[0]; LT = AirflowNetworkLinkageData(i).NodeNums[1]; DirSign = 1.0; @@ -7684,12 +7713,12 @@ namespace AirflowNetwork { LT = AirflowNetworkLinkageData(i).NodeNums[0]; DirSign = -1.0; } - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(AirflowNetworkLinkSimu(i).FLOW); - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(AirflowNetworkLinkSimu(i).FLOW); + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW); + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW); } if (CompTypeNum == CompTypeNum_TMU) { // Reheat unit: SINGLE DUCT:CONST VOLUME:REHEAT TypeNum = AirflowNetworkCompData(CompNum).TypeNum; - if (AirflowNetworkLinkSimu(i).FLOW > 0.0) { // flow direction is the same as input from node 1 to node 2 + if (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW > 0.0) { // flow direction is the same as input from node 1 to node 2 LF = AirflowNetworkLinkageData(i).NodeNums[0]; LT = AirflowNetworkLinkageData(i).NodeNums[1]; DirSign = 1.0; @@ -7698,12 +7727,12 @@ namespace AirflowNetwork { LT = AirflowNetworkLinkageData(i).NodeNums[0]; DirSign = -1.0; } - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(AirflowNetworkLinkSimu(i).FLOW); - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(AirflowNetworkLinkSimu(i).FLOW); + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW); + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW); } if (CompTypeNum == CompTypeNum_COI) { // heating or cooling coil TypeNum = AirflowNetworkCompData(CompNum).TypeNum; - if (AirflowNetworkLinkSimu(i).FLOW > 0.0) { // flow direction is the same as input from node 1 to node 2 + if (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW > 0.0) { // flow direction is the same as input from node 1 to node 2 LF = AirflowNetworkLinkageData(i).NodeNums[0]; LT = AirflowNetworkLinkageData(i).NodeNums[1]; DirSign = 1.0; @@ -7715,47 +7744,47 @@ namespace AirflowNetwork { } // Calculate temp in a constant pressure drop component if (CompTypeNum == CompTypeNum_CPD && CompName == std::string()) { // constant pressure element only - if (AirflowNetworkLinkSimu(i).FLOW > 0.0) { // flow direction is the same as input from node 1 to node 2 + if (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW > 0.0) { // flow direction is the same as input from node 1 to node 2 LF = AirflowNetworkLinkageData(i).NodeNums[0]; LT = AirflowNetworkLinkageData(i).NodeNums[1]; } else { // flow direction is the opposite as input from node 2 to node 1 LF = AirflowNetworkLinkageData(i).NodeNums[1]; LT = AirflowNetworkLinkageData(i).NodeNums[0]; } - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(AirflowNetworkLinkSimu(i).FLOW); - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(AirflowNetworkLinkSimu(i).FLOW); + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW); + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW); state.dataAirflowNetworkBalanceManager->MV(LT) = 0.0; } // Calculate return leak if ((CompTypeNum == CompTypeNum_PLR || CompTypeNum == CompTypeNum_ELR) && CompName == std::string()) { // Return leak component only if ((AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[0]).EPlusZoneNum > 0) && - (AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[1]).EPlusZoneNum == 0) && (AirflowNetworkLinkSimu(i).FLOW > 0.0)) { + (AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[1]).EPlusZoneNum == 0) && (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW > 0.0)) { LF = AirflowNetworkLinkageData(i).NodeNums[0]; LT = AirflowNetworkLinkageData(i).NodeNums[1]; - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(AirflowNetworkLinkSimu(i).FLOW); - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(AirflowNetworkLinkSimu(i).FLOW); + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW); + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW); } if ((AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[0]).ExtNodeNum > 0) && - (AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[1]).EPlusZoneNum == 0) && (AirflowNetworkLinkSimu(i).FLOW > 0.0)) { + (AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[1]).EPlusZoneNum == 0) && (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW > 0.0)) { LF = AirflowNetworkLinkageData(i).NodeNums[0]; LT = AirflowNetworkLinkageData(i).NodeNums[1]; - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(AirflowNetworkLinkSimu(i).FLOW); - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(AirflowNetworkLinkSimu(i).FLOW); + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW); + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW); } if ((AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[1]).EPlusZoneNum > 0) && - (AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[0]).EPlusZoneNum == 0) && (AirflowNetworkLinkSimu(i).FLOW2 > 0.0)) { + (AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[0]).EPlusZoneNum == 0) && (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 > 0.0)) { LF = AirflowNetworkLinkageData(i).NodeNums[1]; LT = AirflowNetworkLinkageData(i).NodeNums[0]; - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(AirflowNetworkLinkSimu(i).FLOW2); - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(AirflowNetworkLinkSimu(i).FLOW2); + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2); + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2); } if ((AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[1]).ExtNodeNum > 0) && - (AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[0]).EPlusZoneNum == 0) && (AirflowNetworkLinkSimu(i).FLOW2 > 0.0)) { + (AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[0]).EPlusZoneNum == 0) && (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 > 0.0)) { LF = AirflowNetworkLinkageData(i).NodeNums[1]; LT = AirflowNetworkLinkageData(i).NodeNums[0]; - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(AirflowNetworkLinkSimu(i).FLOW2); - state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(AirflowNetworkLinkSimu(i).FLOW2); + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2); + state.dataAirflowNetworkBalanceManager->MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2); } } } @@ -8055,45 +8084,45 @@ namespace AirflowNetwork { if (AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == CompTypeNum_SCR || AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == CompTypeNum_SEL) { if (Tamb > MAT(ZN1)) { - AirflowNetworkReportData(ZN1).MultiZoneInfiSenGainW += (AirflowNetworkLinkSimu(i).FLOW2 * CpAir * (Tamb - MAT(ZN1))); + AirflowNetworkReportData(ZN1).MultiZoneInfiSenGainW += (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 * CpAir * (Tamb - MAT(ZN1))); AirflowNetworkReportData(ZN1).MultiZoneInfiSenGainJ += - (AirflowNetworkLinkSimu(i).FLOW2 * CpAir * (Tamb - MAT(ZN1))) * ReportingConstant; + (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 * CpAir * (Tamb - MAT(ZN1))) * ReportingConstant; } else { - AirflowNetworkReportData(ZN1).MultiZoneInfiSenLossW += (AirflowNetworkLinkSimu(i).FLOW2 * CpAir * (MAT(ZN1) - Tamb)); + AirflowNetworkReportData(ZN1).MultiZoneInfiSenLossW += (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 * CpAir * (MAT(ZN1) - Tamb)); AirflowNetworkReportData(ZN1).MultiZoneInfiSenLossJ += - (AirflowNetworkLinkSimu(i).FLOW2 * CpAir * (MAT(ZN1) - Tamb)) * ReportingConstant; + (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 * CpAir * (MAT(ZN1) - Tamb)) * ReportingConstant; } if (state.dataEnvrn->OutHumRat > ZoneAirHumRat(ZN1)) { AirflowNetworkReportData(ZN1).MultiZoneInfiLatGainW += - (AirflowNetworkLinkSimu(i).FLOW2 * (state.dataEnvrn->OutHumRat - ZoneAirHumRat(ZN1))) * hg; + (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 * (state.dataEnvrn->OutHumRat - ZoneAirHumRat(ZN1))) * hg; AirflowNetworkReportData(ZN1).MultiZoneInfiLatGainJ += - (AirflowNetworkLinkSimu(i).FLOW2 * (state.dataEnvrn->OutHumRat - ZoneAirHumRat(ZN1))) * hg * ReportingConstant; + (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 * (state.dataEnvrn->OutHumRat - ZoneAirHumRat(ZN1))) * hg * ReportingConstant; } else { AirflowNetworkReportData(ZN1).MultiZoneInfiLatLossW += - (AirflowNetworkLinkSimu(i).FLOW2 * (ZoneAirHumRat(ZN1) - state.dataEnvrn->OutHumRat)) * hg; + (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 * (ZoneAirHumRat(ZN1) - state.dataEnvrn->OutHumRat)) * hg; AirflowNetworkReportData(ZN1).MultiZoneInfiLatLossJ += - (AirflowNetworkLinkSimu(i).FLOW2 * (ZoneAirHumRat(ZN1) - state.dataEnvrn->OutHumRat)) * hg * ReportingConstant; + (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 * (ZoneAirHumRat(ZN1) - state.dataEnvrn->OutHumRat)) * hg * ReportingConstant; } } else { if (Tamb > MAT(ZN1)) { - AirflowNetworkReportData(ZN1).MultiZoneVentSenGainW += (AirflowNetworkLinkSimu(i).FLOW2 * CpAir * (Tamb - MAT(ZN1))); + AirflowNetworkReportData(ZN1).MultiZoneVentSenGainW += (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 * CpAir * (Tamb - MAT(ZN1))); AirflowNetworkReportData(ZN1).MultiZoneVentSenGainJ += - (AirflowNetworkLinkSimu(i).FLOW2 * CpAir * (Tamb - MAT(ZN1))) * ReportingConstant; + (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 * CpAir * (Tamb - MAT(ZN1))) * ReportingConstant; } else { - AirflowNetworkReportData(ZN1).MultiZoneVentSenLossW += (AirflowNetworkLinkSimu(i).FLOW2 * CpAir * (MAT(ZN1) - Tamb)); + AirflowNetworkReportData(ZN1).MultiZoneVentSenLossW += (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 * CpAir * (MAT(ZN1) - Tamb)); AirflowNetworkReportData(ZN1).MultiZoneVentSenLossJ += - (AirflowNetworkLinkSimu(i).FLOW2 * CpAir * (MAT(ZN1) - Tamb)) * ReportingConstant; + (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 * CpAir * (MAT(ZN1) - Tamb)) * ReportingConstant; } if (state.dataEnvrn->OutHumRat > ZoneAirHumRat(ZN1)) { AirflowNetworkReportData(ZN1).MultiZoneVentLatGainW += - (AirflowNetworkLinkSimu(i).FLOW2 * (state.dataEnvrn->OutHumRat - ZoneAirHumRat(ZN1))) * hg; + (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 * (state.dataEnvrn->OutHumRat - ZoneAirHumRat(ZN1))) * hg; AirflowNetworkReportData(ZN1).MultiZoneVentLatGainJ += - (AirflowNetworkLinkSimu(i).FLOW2 * (state.dataEnvrn->OutHumRat - ZoneAirHumRat(ZN1))) * hg * ReportingConstant; + (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 * (state.dataEnvrn->OutHumRat - ZoneAirHumRat(ZN1))) * hg * ReportingConstant; } else { AirflowNetworkReportData(ZN1).MultiZoneVentLatLossW += - (AirflowNetworkLinkSimu(i).FLOW2 * (ZoneAirHumRat(ZN1) - state.dataEnvrn->OutHumRat)) * hg; + (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 * (ZoneAirHumRat(ZN1) - state.dataEnvrn->OutHumRat)) * hg; AirflowNetworkReportData(ZN1).MultiZoneVentLatLossJ += - (AirflowNetworkLinkSimu(i).FLOW2 * (ZoneAirHumRat(ZN1) - state.dataEnvrn->OutHumRat)) * hg * ReportingConstant; + (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 * (ZoneAirHumRat(ZN1) - state.dataEnvrn->OutHumRat)) * hg * ReportingConstant; } } } @@ -8111,45 +8140,45 @@ namespace AirflowNetwork { if (AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == CompTypeNum_SCR || AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == CompTypeNum_SEL) { if (Tamb > MAT(ZN2)) { - AirflowNetworkReportData(ZN2).MultiZoneInfiSenGainW += (AirflowNetworkLinkSimu(i).FLOW * CpAir * (Tamb - MAT(ZN2))); + AirflowNetworkReportData(ZN2).MultiZoneInfiSenGainW += (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW * CpAir * (Tamb - MAT(ZN2))); AirflowNetworkReportData(ZN2).MultiZoneInfiSenGainJ += - (AirflowNetworkLinkSimu(i).FLOW * CpAir * (Tamb - MAT(ZN2))) * ReportingConstant; + (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW * CpAir * (Tamb - MAT(ZN2))) * ReportingConstant; } else { - AirflowNetworkReportData(ZN2).MultiZoneInfiSenLossW += (AirflowNetworkLinkSimu(i).FLOW * CpAir * (MAT(ZN2) - Tamb)); + AirflowNetworkReportData(ZN2).MultiZoneInfiSenLossW += (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW * CpAir * (MAT(ZN2) - Tamb)); AirflowNetworkReportData(ZN2).MultiZoneInfiSenLossJ += - (AirflowNetworkLinkSimu(i).FLOW * CpAir * (MAT(ZN2) - Tamb)) * ReportingConstant; + (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW * CpAir * (MAT(ZN2) - Tamb)) * ReportingConstant; } if (state.dataEnvrn->OutHumRat > ZoneAirHumRat(ZN2)) { AirflowNetworkReportData(ZN2).MultiZoneInfiLatGainW += - (AirflowNetworkLinkSimu(i).FLOW * (state.dataEnvrn->OutHumRat - ZoneAirHumRat(ZN2))) * hg; + (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW * (state.dataEnvrn->OutHumRat - ZoneAirHumRat(ZN2))) * hg; AirflowNetworkReportData(ZN2).MultiZoneInfiLatGainJ += - (AirflowNetworkLinkSimu(i).FLOW * (state.dataEnvrn->OutHumRat - ZoneAirHumRat(ZN2))) * hg * ReportingConstant; + (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW * (state.dataEnvrn->OutHumRat - ZoneAirHumRat(ZN2))) * hg * ReportingConstant; } else { AirflowNetworkReportData(ZN2).MultiZoneInfiLatLossW += - (AirflowNetworkLinkSimu(i).FLOW * (ZoneAirHumRat(ZN2) - state.dataEnvrn->OutHumRat)) * hg; + (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW * (ZoneAirHumRat(ZN2) - state.dataEnvrn->OutHumRat)) * hg; AirflowNetworkReportData(ZN2).MultiZoneInfiLatLossJ += - (AirflowNetworkLinkSimu(i).FLOW * (ZoneAirHumRat(ZN2) - state.dataEnvrn->OutHumRat)) * hg * ReportingConstant; + (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW * (ZoneAirHumRat(ZN2) - state.dataEnvrn->OutHumRat)) * hg * ReportingConstant; } } else { if (Tamb > MAT(ZN2)) { - AirflowNetworkReportData(ZN2).MultiZoneVentSenGainW += (AirflowNetworkLinkSimu(i).FLOW * CpAir * (Tamb - MAT(ZN2))); + AirflowNetworkReportData(ZN2).MultiZoneVentSenGainW += (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW * CpAir * (Tamb - MAT(ZN2))); AirflowNetworkReportData(ZN2).MultiZoneVentSenGainJ += - (AirflowNetworkLinkSimu(i).FLOW * CpAir * (Tamb - MAT(ZN2))) * ReportingConstant; + (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW * CpAir * (Tamb - MAT(ZN2))) * ReportingConstant; } else { - AirflowNetworkReportData(ZN2).MultiZoneVentSenLossW += (AirflowNetworkLinkSimu(i).FLOW * CpAir * (MAT(ZN2) - Tamb)); + AirflowNetworkReportData(ZN2).MultiZoneVentSenLossW += (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW * CpAir * (MAT(ZN2) - Tamb)); AirflowNetworkReportData(ZN2).MultiZoneVentSenLossJ += - (AirflowNetworkLinkSimu(i).FLOW * CpAir * (MAT(ZN2) - Tamb)) * ReportingConstant; + (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW * CpAir * (MAT(ZN2) - Tamb)) * ReportingConstant; } if (state.dataEnvrn->OutHumRat > ZoneAirHumRat(ZN2)) { AirflowNetworkReportData(ZN2).MultiZoneVentLatGainW += - (AirflowNetworkLinkSimu(i).FLOW * (state.dataEnvrn->OutHumRat - ZoneAirHumRat(ZN2))) * hg; + (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW * (state.dataEnvrn->OutHumRat - ZoneAirHumRat(ZN2))) * hg; AirflowNetworkReportData(ZN2).MultiZoneVentLatGainJ += - (AirflowNetworkLinkSimu(i).FLOW * (state.dataEnvrn->OutHumRat - ZoneAirHumRat(ZN2))) * hg * ReportingConstant; + (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW * (state.dataEnvrn->OutHumRat - ZoneAirHumRat(ZN2))) * hg * ReportingConstant; } else { AirflowNetworkReportData(ZN2).MultiZoneVentLatLossW += - (AirflowNetworkLinkSimu(i).FLOW * (ZoneAirHumRat(ZN2) - state.dataEnvrn->OutHumRat)) * hg; + (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW * (ZoneAirHumRat(ZN2) - state.dataEnvrn->OutHumRat)) * hg; AirflowNetworkReportData(ZN2).MultiZoneVentLatLossJ += - (AirflowNetworkLinkSimu(i).FLOW * (ZoneAirHumRat(ZN2) - state.dataEnvrn->OutHumRat)) * hg * ReportingConstant; + (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW * (ZoneAirHumRat(ZN2) - state.dataEnvrn->OutHumRat)) * hg * ReportingConstant; } } } @@ -8158,44 +8187,44 @@ namespace AirflowNetwork { CpAir = PsyCpAirFnW((ZoneAirHumRat(ZN1) + ZoneAirHumRat(ZN2))/2.0); hg = Psychrometrics::PsyHgAirFnWTdb((ZoneAirHumRat(ZN1) + ZoneAirHumRat(ZN2)) / 2.0, (MAT(ZN1) + MAT(ZN2)) / 2.0); if (MAT(ZN1) > MAT(ZN2)) { - AirflowNetworkReportData(ZN2).MultiZoneMixSenGainW += (AirflowNetworkLinkSimu(i).FLOW * CpAir * (MAT(ZN1) - MAT(ZN2))); + AirflowNetworkReportData(ZN2).MultiZoneMixSenGainW += (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW * CpAir * (MAT(ZN1) - MAT(ZN2))); AirflowNetworkReportData(ZN2).MultiZoneMixSenGainJ += - (AirflowNetworkLinkSimu(i).FLOW * CpAir * (MAT(ZN1) - MAT(ZN2))) * ReportingConstant; + (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW * CpAir * (MAT(ZN1) - MAT(ZN2))) * ReportingConstant; } else { - AirflowNetworkReportData(ZN2).MultiZoneMixSenLossW += (AirflowNetworkLinkSimu(i).FLOW * CpAir * (MAT(ZN2) - MAT(ZN1))); + AirflowNetworkReportData(ZN2).MultiZoneMixSenLossW += (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW * CpAir * (MAT(ZN2) - MAT(ZN1))); AirflowNetworkReportData(ZN2).MultiZoneMixSenLossJ += - (AirflowNetworkLinkSimu(i).FLOW * CpAir * (MAT(ZN2) - MAT(ZN1))) * ReportingConstant; + (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW * CpAir * (MAT(ZN2) - MAT(ZN1))) * ReportingConstant; } if (ZoneAirHumRat(ZN1) > ZoneAirHumRat(ZN2)) { AirflowNetworkReportData(ZN2).MultiZoneMixLatGainW += - (AirflowNetworkLinkSimu(i).FLOW * (ZoneAirHumRat(ZN1) - ZoneAirHumRat(ZN2))) * hg; + (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW * (ZoneAirHumRat(ZN1) - ZoneAirHumRat(ZN2))) * hg; AirflowNetworkReportData(ZN2).MultiZoneMixLatGainJ += - (AirflowNetworkLinkSimu(i).FLOW * (ZoneAirHumRat(ZN1) - ZoneAirHumRat(ZN2))) * hg * ReportingConstant; + (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW * (ZoneAirHumRat(ZN1) - ZoneAirHumRat(ZN2))) * hg * ReportingConstant; } else { AirflowNetworkReportData(ZN2).MultiZoneMixLatLossW += - (AirflowNetworkLinkSimu(i).FLOW * (ZoneAirHumRat(ZN2) - ZoneAirHumRat(ZN1))) * hg; + (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW * (ZoneAirHumRat(ZN2) - ZoneAirHumRat(ZN1))) * hg; AirflowNetworkReportData(ZN2).MultiZoneMixLatLossJ += - (AirflowNetworkLinkSimu(i).FLOW * (ZoneAirHumRat(ZN2) - ZoneAirHumRat(ZN1))) * hg * ReportingConstant; + (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW * (ZoneAirHumRat(ZN2) - ZoneAirHumRat(ZN1))) * hg * ReportingConstant; } if (MAT(ZN2) > MAT(ZN1)) { - AirflowNetworkReportData(ZN1).MultiZoneMixSenGainW += (AirflowNetworkLinkSimu(i).FLOW2 * CpAir * (MAT(ZN2) - MAT(ZN1))); + AirflowNetworkReportData(ZN1).MultiZoneMixSenGainW += (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 * CpAir * (MAT(ZN2) - MAT(ZN1))); AirflowNetworkReportData(ZN1).MultiZoneMixSenGainJ += - (AirflowNetworkLinkSimu(i).FLOW2 * CpAir * (MAT(ZN2) - MAT(ZN1))) * ReportingConstant; + (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 * CpAir * (MAT(ZN2) - MAT(ZN1))) * ReportingConstant; } else { - AirflowNetworkReportData(ZN1).MultiZoneMixSenLossW += (AirflowNetworkLinkSimu(i).FLOW2 * CpAir * (MAT(ZN1) - MAT(ZN2))); + AirflowNetworkReportData(ZN1).MultiZoneMixSenLossW += (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 * CpAir * (MAT(ZN1) - MAT(ZN2))); AirflowNetworkReportData(ZN1).MultiZoneMixSenLossJ += - (AirflowNetworkLinkSimu(i).FLOW2 * CpAir * (MAT(ZN1) - MAT(ZN2))) * ReportingConstant; + (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 * CpAir * (MAT(ZN1) - MAT(ZN2))) * ReportingConstant; } if (ZoneAirHumRat(ZN2) > ZoneAirHumRat(ZN1)) { AirflowNetworkReportData(ZN1).MultiZoneMixLatGainW += - (AirflowNetworkLinkSimu(i).FLOW2 * (ZoneAirHumRat(ZN2) - ZoneAirHumRat(ZN1))) * hg; + (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 * (ZoneAirHumRat(ZN2) - ZoneAirHumRat(ZN1))) * hg; AirflowNetworkReportData(ZN1).MultiZoneMixLatGainJ += - (AirflowNetworkLinkSimu(i).FLOW2 * (ZoneAirHumRat(ZN2) - ZoneAirHumRat(ZN1))) * hg * ReportingConstant; + (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 * (ZoneAirHumRat(ZN2) - ZoneAirHumRat(ZN1))) * hg * ReportingConstant; } else { AirflowNetworkReportData(ZN1).MultiZoneMixLatLossW += - std::abs(AirflowNetworkLinkSimu(i).FLOW2 * (ZoneAirHumRat(ZN1) - ZoneAirHumRat(ZN2))) * hg; + std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 * (ZoneAirHumRat(ZN1) - ZoneAirHumRat(ZN2))) * hg; AirflowNetworkReportData(ZN1).MultiZoneMixLatLossJ += - (AirflowNetworkLinkSimu(i).FLOW2 * (ZoneAirHumRat(ZN1) - ZoneAirHumRat(ZN2))) * hg * ReportingConstant; + (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 * (ZoneAirHumRat(ZN1) - ZoneAirHumRat(ZN2))) * hg * ReportingConstant; } } } @@ -8681,55 +8710,55 @@ namespace AirflowNetwork { // Find a linkage from outdoors to this zone Tamb = Zone(ZN1).OutDryBulbTemp; CpAir = PsyCpAirFnW(state.dataEnvrn->OutHumRat); - state.dataAirflowNetworkBalanceManager->exchangeData(ZN1).SumMCp += AirflowNetworkLinkSimu(i).FLOW2 * CpAir; - state.dataAirflowNetworkBalanceManager->exchangeData(ZN1).SumMCpT += AirflowNetworkLinkSimu(i).FLOW2 * CpAir * Tamb; - state.dataAirflowNetworkBalanceManager->exchangeData(ZN1).SumMHr += AirflowNetworkLinkSimu(i).FLOW2; - state.dataAirflowNetworkBalanceManager->exchangeData(ZN1).SumMHrW += AirflowNetworkLinkSimu(i).FLOW2 * state.dataEnvrn->OutHumRat; + state.dataAirflowNetworkBalanceManager->exchangeData(ZN1).SumMCp += state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 * CpAir; + state.dataAirflowNetworkBalanceManager->exchangeData(ZN1).SumMCpT += state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 * CpAir * Tamb; + state.dataAirflowNetworkBalanceManager->exchangeData(ZN1).SumMHr += state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2; + state.dataAirflowNetworkBalanceManager->exchangeData(ZN1).SumMHrW += state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 * state.dataEnvrn->OutHumRat; if (state.dataContaminantBalance->Contaminant.CO2Simulation) { - state.dataAirflowNetworkBalanceManager->exchangeData(ZN1).SumMHrCO += AirflowNetworkLinkSimu(i).FLOW2 * state.dataContaminantBalance->OutdoorCO2; + state.dataAirflowNetworkBalanceManager->exchangeData(ZN1).SumMHrCO += state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 * state.dataContaminantBalance->OutdoorCO2; } if (state.dataContaminantBalance->Contaminant.GenericContamSimulation) { - state.dataAirflowNetworkBalanceManager->exchangeData(ZN1).SumMHrGC += AirflowNetworkLinkSimu(i).FLOW2 * state.dataContaminantBalance->OutdoorGC; + state.dataAirflowNetworkBalanceManager->exchangeData(ZN1).SumMHrGC += state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 * state.dataContaminantBalance->OutdoorGC; } } if (ZN1 == 0 && ZN2 > 0) { // Find a linkage from outdoors to this zone Tamb = Zone(ZN2).OutDryBulbTemp; CpAir = PsyCpAirFnW(state.dataEnvrn->OutHumRat); - state.dataAirflowNetworkBalanceManager->exchangeData(ZN2).SumMCp += AirflowNetworkLinkSimu(i).FLOW * CpAir; - state.dataAirflowNetworkBalanceManager->exchangeData(ZN2).SumMCpT += AirflowNetworkLinkSimu(i).FLOW * CpAir * Tamb; - state.dataAirflowNetworkBalanceManager->exchangeData(ZN2).SumMHr += AirflowNetworkLinkSimu(i).FLOW; - state.dataAirflowNetworkBalanceManager->exchangeData(ZN2).SumMHrW += AirflowNetworkLinkSimu(i).FLOW * state.dataEnvrn->OutHumRat; + state.dataAirflowNetworkBalanceManager->exchangeData(ZN2).SumMCp += state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW * CpAir; + state.dataAirflowNetworkBalanceManager->exchangeData(ZN2).SumMCpT += state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW * CpAir * Tamb; + state.dataAirflowNetworkBalanceManager->exchangeData(ZN2).SumMHr += state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW; + state.dataAirflowNetworkBalanceManager->exchangeData(ZN2).SumMHrW += state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW * state.dataEnvrn->OutHumRat; if (state.dataContaminantBalance->Contaminant.CO2Simulation) { - state.dataAirflowNetworkBalanceManager->exchangeData(ZN2).SumMHrCO += AirflowNetworkLinkSimu(i).FLOW * state.dataContaminantBalance->OutdoorCO2; + state.dataAirflowNetworkBalanceManager->exchangeData(ZN2).SumMHrCO += state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW * state.dataContaminantBalance->OutdoorCO2; } if (state.dataContaminantBalance->Contaminant.GenericContamSimulation) { - state.dataAirflowNetworkBalanceManager->exchangeData(ZN2).SumMHrGC += AirflowNetworkLinkSimu(i).FLOW * state.dataContaminantBalance->OutdoorGC; + state.dataAirflowNetworkBalanceManager->exchangeData(ZN2).SumMHrGC += state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW * state.dataContaminantBalance->OutdoorGC; } } if (ZN1 > 0 && ZN2 > 0) { // Find a linkage from outdoors to this zone CpAir = PsyCpAirFnW(ANZW(ZN1)); - state.dataAirflowNetworkBalanceManager->exchangeData(ZN2).SumMMCp += AirflowNetworkLinkSimu(i).FLOW * CpAir; - state.dataAirflowNetworkBalanceManager->exchangeData(ZN2).SumMMCpT += AirflowNetworkLinkSimu(i).FLOW * CpAir * ANZT(ZN1); - state.dataAirflowNetworkBalanceManager->exchangeData(ZN2).SumMMHr += AirflowNetworkLinkSimu(i).FLOW; - state.dataAirflowNetworkBalanceManager->exchangeData(ZN2).SumMMHrW += AirflowNetworkLinkSimu(i).FLOW * ANZW(ZN1); + state.dataAirflowNetworkBalanceManager->exchangeData(ZN2).SumMMCp += state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW * CpAir; + state.dataAirflowNetworkBalanceManager->exchangeData(ZN2).SumMMCpT += state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW * CpAir * ANZT(ZN1); + state.dataAirflowNetworkBalanceManager->exchangeData(ZN2).SumMMHr += state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW; + state.dataAirflowNetworkBalanceManager->exchangeData(ZN2).SumMMHrW += state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW * ANZW(ZN1); if (state.dataContaminantBalance->Contaminant.CO2Simulation) { - state.dataAirflowNetworkBalanceManager->exchangeData(ZN2).SumMMHrCO += AirflowNetworkLinkSimu(i).FLOW * ANCO(ZN1); + state.dataAirflowNetworkBalanceManager->exchangeData(ZN2).SumMMHrCO += state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW * ANCO(ZN1); } if (state.dataContaminantBalance->Contaminant.GenericContamSimulation) { - state.dataAirflowNetworkBalanceManager->exchangeData(ZN2).SumMMHrGC += AirflowNetworkLinkSimu(i).FLOW * ANGC(ZN1); + state.dataAirflowNetworkBalanceManager->exchangeData(ZN2).SumMMHrGC += state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW * ANGC(ZN1); } CpAir = PsyCpAirFnW(ANZW(ZN2)); - state.dataAirflowNetworkBalanceManager->exchangeData(ZN1).SumMMCp += AirflowNetworkLinkSimu(i).FLOW2 * CpAir; - state.dataAirflowNetworkBalanceManager->exchangeData(ZN1).SumMMCpT += AirflowNetworkLinkSimu(i).FLOW2 * CpAir * ANZT(ZN2); - state.dataAirflowNetworkBalanceManager->exchangeData(ZN1).SumMMHr += AirflowNetworkLinkSimu(i).FLOW2; - state.dataAirflowNetworkBalanceManager->exchangeData(ZN1).SumMMHrW += AirflowNetworkLinkSimu(i).FLOW2 * ANZW(ZN2); + state.dataAirflowNetworkBalanceManager->exchangeData(ZN1).SumMMCp += state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 * CpAir; + state.dataAirflowNetworkBalanceManager->exchangeData(ZN1).SumMMCpT += state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 * CpAir * ANZT(ZN2); + state.dataAirflowNetworkBalanceManager->exchangeData(ZN1).SumMMHr += state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2; + state.dataAirflowNetworkBalanceManager->exchangeData(ZN1).SumMMHrW += state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 * ANZW(ZN2); if (state.dataContaminantBalance->Contaminant.CO2Simulation) { - state.dataAirflowNetworkBalanceManager->exchangeData(ZN1).SumMMHrCO += AirflowNetworkLinkSimu(i).FLOW2 * ANCO(ZN2); + state.dataAirflowNetworkBalanceManager->exchangeData(ZN1).SumMMHrCO += state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 * ANCO(ZN2); } if (state.dataContaminantBalance->Contaminant.GenericContamSimulation) { - state.dataAirflowNetworkBalanceManager->exchangeData(ZN1).SumMMHrGC += AirflowNetworkLinkSimu(i).FLOW2 * ANGC(ZN2); + state.dataAirflowNetworkBalanceManager->exchangeData(ZN1).SumMMHrGC += state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 * ANGC(ZN2); } } } @@ -8751,13 +8780,13 @@ namespace AirflowNetwork { for (i = 1; i <= NumOfLinksMultiZone; ++i) { Tamb = OutDryBulbTempAt(state, AirflowNetworkLinkageData(i).NodeHeights[0]); AirDensity = PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, Tamb, state.dataEnvrn->OutHumRat); - AirflowNetworkLinkSimu(i).VolFLOW = AirflowNetworkLinkSimu(i).FLOW / AirDensity; - AirflowNetworkLinkSimu(i).VolFLOW2 = AirflowNetworkLinkSimu(i).FLOW2 / AirDensity; + state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).VolFLOW = state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW / AirDensity; + state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).VolFLOW2 = state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 / AirDensity; } for (std::size_t i = 0; i < state.dataAirflowNetworkBalanceManager->linkReport.size(); ++i) { auto &r(state.dataAirflowNetworkBalanceManager->linkReport[i]); - auto &s(AirflowNetworkLinkSimu[i]); + auto &s(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu[i]); r.FLOW = s.FLOW; r.FLOW2 = s.FLOW2; r.VolFLOW = s.VolFLOW; @@ -8775,22 +8804,22 @@ namespace AirflowNetwork { if (present(FirstHVACIteration)) { if (FirstHVACIteration && OnOffFanFlag) { state.dataAirflowNetworkBalanceManager->multiExchangeData = state.dataAirflowNetworkBalanceManager->exchangeData; - for (i = 1; i <= AirflowNetworkNumOfZones; ++i) { + for (i = 1; i <= state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones; ++i) { state.dataAirflowNetworkBalanceManager->nodeReport(i).PZ = AirflowNetworkNodeSimu(i).PZ; state.dataAirflowNetworkBalanceManager->nodeReport(i).PZOFF = AirflowNetworkNodeSimu(i).PZ; state.dataAirflowNetworkBalanceManager->nodeReport(i).PZON = 0.0; } for (i = 1; i <= state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfSurfaces; ++i) { - state.dataAirflowNetworkBalanceManager->linkReport1(i).FLOW = AirflowNetworkLinkSimu(i).FLOW; - state.dataAirflowNetworkBalanceManager->linkReport1(i).FLOW2 = AirflowNetworkLinkSimu(i).FLOW2; - state.dataAirflowNetworkBalanceManager->linkReport1(i).VolFLOW = AirflowNetworkLinkSimu(i).VolFLOW; - state.dataAirflowNetworkBalanceManager->linkReport1(i).VolFLOW2 = AirflowNetworkLinkSimu(i).VolFLOW2; - state.dataAirflowNetworkBalanceManager->linkReport1(i).FLOWOFF = AirflowNetworkLinkSimu(i).FLOW; - state.dataAirflowNetworkBalanceManager->linkReport1(i).FLOW2OFF = AirflowNetworkLinkSimu(i).FLOW2; - state.dataAirflowNetworkBalanceManager->linkReport1(i).VolFLOWOFF = AirflowNetworkLinkSimu(i).VolFLOW; - state.dataAirflowNetworkBalanceManager->linkReport1(i).VolFLOW2OFF = AirflowNetworkLinkSimu(i).VolFLOW2; - state.dataAirflowNetworkBalanceManager->linkReport1(i).DP = AirflowNetworkLinkSimu(i).DP; - state.dataAirflowNetworkBalanceManager->linkReport1(i).DPOFF = AirflowNetworkLinkSimu(i).DP; + state.dataAirflowNetworkBalanceManager->linkReport1(i).FLOW = state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW; + state.dataAirflowNetworkBalanceManager->linkReport1(i).FLOW2 = state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2; + state.dataAirflowNetworkBalanceManager->linkReport1(i).VolFLOW = state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).VolFLOW; + state.dataAirflowNetworkBalanceManager->linkReport1(i).VolFLOW2 = state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).VolFLOW2; + state.dataAirflowNetworkBalanceManager->linkReport1(i).FLOWOFF = state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW; + state.dataAirflowNetworkBalanceManager->linkReport1(i).FLOW2OFF = state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2; + state.dataAirflowNetworkBalanceManager->linkReport1(i).VolFLOWOFF = state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).VolFLOW; + state.dataAirflowNetworkBalanceManager->linkReport1(i).VolFLOW2OFF = state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).VolFLOW2; + state.dataAirflowNetworkBalanceManager->linkReport1(i).DP = state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).DP; + state.dataAirflowNetworkBalanceManager->linkReport1(i).DPOFF = state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).DP; state.dataAirflowNetworkBalanceManager->linkReport1(i).DPON = 0.0; } } @@ -8801,7 +8830,7 @@ namespace AirflowNetwork { AirflowNetworkNodeSimu(i).PZ = 0.0; } for (i = state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfSurfaces + 1; i <= AirflowNetworkNumOfLinks; ++i) { - AirflowNetworkLinkSimu(i).DP = 0.0; + state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).DP = 0.0; state.dataAirflowNetworkBalanceManager->linkReport(i).FLOW = 0.0; state.dataAirflowNetworkBalanceManager->linkReport(i).FLOW2 = 0.0; state.dataAirflowNetworkBalanceManager->linkReport(i).VolFLOW = 0.0; @@ -8821,28 +8850,28 @@ namespace AirflowNetwork { if (ZN1 > 0 && ZN2 == 0) { Tamb = Zone(ZN1).OutDryBulbTemp; CpAir = PsyCpAirFnW(state.dataEnvrn->OutHumRat); - state.dataAirflowNetworkBalanceManager->exchangeData(ZN1).MultiZoneSen += AirflowNetworkLinkSimu(i).FLOW2 * CpAir * (Tamb - ANZT(ZN1)); - state.dataAirflowNetworkBalanceManager->exchangeData(ZN1).MultiZoneLat += AirflowNetworkLinkSimu(i).FLOW2 * (state.dataEnvrn->OutHumRat - ANZW(ZN1)); + state.dataAirflowNetworkBalanceManager->exchangeData(ZN1).MultiZoneSen += state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 * CpAir * (Tamb - ANZT(ZN1)); + state.dataAirflowNetworkBalanceManager->exchangeData(ZN1).MultiZoneLat += state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 * (state.dataEnvrn->OutHumRat - ANZW(ZN1)); } if (ZN1 == 0 && ZN2 > 0) { Tamb = Zone(ZN2).OutDryBulbTemp; CpAir = PsyCpAirFnW(state.dataEnvrn->OutHumRat); - state.dataAirflowNetworkBalanceManager->exchangeData(ZN2).MultiZoneSen += AirflowNetworkLinkSimu(i).FLOW * CpAir * (Tamb - ANZT(ZN2)); - state.dataAirflowNetworkBalanceManager->exchangeData(ZN2).MultiZoneLat += AirflowNetworkLinkSimu(i).FLOW * (state.dataEnvrn->OutHumRat - ANZW(ZN2)); + state.dataAirflowNetworkBalanceManager->exchangeData(ZN2).MultiZoneSen += state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW * CpAir * (Tamb - ANZT(ZN2)); + state.dataAirflowNetworkBalanceManager->exchangeData(ZN2).MultiZoneLat += state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW * (state.dataEnvrn->OutHumRat - ANZW(ZN2)); } if (ZN1 > 0 && ZN2 > 0) { - if (AirflowNetworkLinkSimu(i).FLOW > 0) { // Flow from ZN1 to ZN2 + if (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW > 0) { // Flow from ZN1 to ZN2 CpAir = PsyCpAirFnW(ANZW(ZN1)); - state.dataAirflowNetworkBalanceManager->exchangeData(ZN2).MultiZoneSen += AirflowNetworkLinkSimu(i).FLOW * CpAir * (ANZT(ZN1) - ANZT(ZN2)); - state.dataAirflowNetworkBalanceManager->exchangeData(ZN2).MultiZoneLat += AirflowNetworkLinkSimu(i).FLOW * (ANZW(ZN1) - ANZW(ZN2)); + state.dataAirflowNetworkBalanceManager->exchangeData(ZN2).MultiZoneSen += state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW * CpAir * (ANZT(ZN1) - ANZT(ZN2)); + state.dataAirflowNetworkBalanceManager->exchangeData(ZN2).MultiZoneLat += state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW * (ANZW(ZN1) - ANZW(ZN2)); CpAir = PsyCpAirFnW(ANZW(ZN2)); - state.dataAirflowNetworkBalanceManager->exchangeData(ZN1).MultiZoneSen += std::abs(AirflowNetworkLinkSimu(i).FLOW2) * CpAir * (ANZT(ZN2) - ANZT(ZN1)); - state.dataAirflowNetworkBalanceManager->exchangeData(ZN1).MultiZoneLat += std::abs(AirflowNetworkLinkSimu(i).FLOW2) * (ANZW(ZN2) - ANZW(ZN1)); + state.dataAirflowNetworkBalanceManager->exchangeData(ZN1).MultiZoneSen += std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2) * CpAir * (ANZT(ZN2) - ANZT(ZN1)); + state.dataAirflowNetworkBalanceManager->exchangeData(ZN1).MultiZoneLat += std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2) * (ANZW(ZN2) - ANZW(ZN1)); } else { CpAir = PsyCpAirFnW(ANZW(ZN2)); - state.dataAirflowNetworkBalanceManager->exchangeData(ZN1).MultiZoneSen += std::abs(AirflowNetworkLinkSimu(i).FLOW2) * CpAir * (ANZT(ZN2) - ANZT(ZN1)); - state.dataAirflowNetworkBalanceManager->exchangeData(ZN1).MultiZoneLat += std::abs(AirflowNetworkLinkSimu(i).FLOW2) * (ANZW(ZN2) - ANZW(ZN1)); + state.dataAirflowNetworkBalanceManager->exchangeData(ZN1).MultiZoneSen += std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2) * CpAir * (ANZT(ZN2) - ANZT(ZN1)); + state.dataAirflowNetworkBalanceManager->exchangeData(ZN1).MultiZoneLat += std::abs(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2) * (ANZW(ZN2) - ANZW(ZN1)); } } } @@ -8884,7 +8913,7 @@ namespace AirflowNetwork { if (DisSysCompCVFData(FanNum).FanTypeNum == FanType_SimpleOnOff && state.dataAirflowNetworkBalanceManager->LoopPartLoadRatio(AirLoopNum) < 1.0) { for (std::size_t i = 0; i < state.dataAirflowNetworkBalanceManager->linkReport.size(); ++i) { auto &r(state.dataAirflowNetworkBalanceManager->linkReport[i]); - auto &s(AirflowNetworkLinkSimu[i]); + auto &s(state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu[i]); auto &t(AirflowNetworkLinkageData[i]); if (t.AirLoopNum == AirLoopNum) { r.FLOW = s.FLOW * state.dataAirflowNetworkBalanceManager->LoopPartLoadRatio(AirLoopNum); @@ -8948,7 +8977,7 @@ namespace AirflowNetwork { if (AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).EPlusTypeNum == 0) continue; } NodeMass = Node(AirflowNetworkNodeData(Node3).EPlusNodeNum).MassFlowRate; - AFNMass = AirflowNetworkLinkSimu(i).FLOW; + AFNMass = state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW; if (NodeMass > 0.0 && AFNMass > NodeMass + 0.01) { ShowWarningError(state, "The mass flow rate difference is found between System Node = '" + NodeID(AirflowNetworkNodeData(Node3).EPlusNodeNum) + "' and AFN Link = '" + @@ -8980,23 +9009,23 @@ namespace AirflowNetwork { j = AirflowNetworkNodeData(Node1).EPlusNodeNum; if (j > 0 && AirflowNetworkNodeData(Node1).EPlusZoneNum == 0) { - Node(j).MassFlowRate = AirflowNetworkLinkSimu(i).FLOW * state.dataAirflowNetworkBalanceManager->LoopPartLoadRatio(AirflowNetworkNodeData(Node1).AirLoopNum); + Node(j).MassFlowRate = state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW * state.dataAirflowNetworkBalanceManager->LoopPartLoadRatio(AirflowNetworkNodeData(Node1).AirLoopNum); if (!state.dataAirflowNetworkBalanceManager->LoopOnOffFlag(AirflowNetworkLinkageData(i).AirLoopNum)) Node(j).MassFlowRate = 0.0; if (!(AirflowNetworkNodeData(Node1).EPlusTypeNum == EPlusTypeNum_DIN || AirflowNetworkNodeData(Node1).EPlusTypeNum == EPlusTypeNum_DOU)) { - Node(j).MassFlowRateMaxAvail = AirflowNetworkLinkSimu(i).FLOW * state.dataAirflowNetworkBalanceManager->LoopPartLoadRatio(AirflowNetworkNodeData(Node1).AirLoopNum); - Node(j).MassFlowRateMax = AirflowNetworkLinkSimu(i).FLOW; + Node(j).MassFlowRateMaxAvail = state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW * state.dataAirflowNetworkBalanceManager->LoopPartLoadRatio(AirflowNetworkNodeData(Node1).AirLoopNum); + Node(j).MassFlowRateMax = state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW; } } j = AirflowNetworkNodeData(Node2).EPlusNodeNum; if (j > 0) { - Node(j).MassFlowRate = AirflowNetworkLinkSimu(i).FLOW * state.dataAirflowNetworkBalanceManager->LoopPartLoadRatio(AirflowNetworkNodeData(Node2).AirLoopNum); + Node(j).MassFlowRate = state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW * state.dataAirflowNetworkBalanceManager->LoopPartLoadRatio(AirflowNetworkNodeData(Node2).AirLoopNum); if (!state.dataAirflowNetworkBalanceManager->LoopOnOffFlag(AirflowNetworkLinkageData(i).AirLoopNum)) Node(j).MassFlowRate = 0.0; if (!(AirflowNetworkNodeData(Node2).EPlusTypeNum == EPlusTypeNum_DIN || AirflowNetworkNodeData(Node2).EPlusTypeNum == EPlusTypeNum_DOU)) { - Node(j).MassFlowRateMaxAvail = AirflowNetworkLinkSimu(i).FLOW * state.dataAirflowNetworkBalanceManager->LoopPartLoadRatio(AirflowNetworkNodeData(Node2).AirLoopNum); - Node(j).MassFlowRateMax = AirflowNetworkLinkSimu(i).FLOW; + Node(j).MassFlowRateMaxAvail = state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW * state.dataAirflowNetworkBalanceManager->LoopPartLoadRatio(AirflowNetworkNodeData(Node2).AirLoopNum); + Node(j).MassFlowRateMax = state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW; } } } @@ -9026,7 +9055,7 @@ namespace AirflowNetwork { // Calculate sensible loads from duct conduction losses and loads from duct radiation if (AirflowNetworkLinkageData(i).ZoneNum > 0 && AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == CompTypeNum_DWC) { - Qsen = AirflowNetworkLinkSimu(i).FLOW * CpAir * (AirflowNetworkNodeSimu(Node2).TZ - AirflowNetworkNodeSimu(Node1).TZ); + Qsen = state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW * CpAir * (AirflowNetworkNodeSimu(Node2).TZ - AirflowNetworkNodeSimu(Node1).TZ); if (AirflowNetworkLinkageData(i).LinkageViewFactorObjectNum != 0) { auto &DuctRadObj(AirflowNetworkLinkageViewFactorData(AirflowNetworkLinkageData(i).LinkageViewFactorObjectNum)); Qsen -= DuctRadObj.QRad; @@ -9041,16 +9070,16 @@ namespace AirflowNetwork { AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == CompTypeNum_ELR) { // Calculate supply leak sensible losses if ((AirflowNetworkNodeData(Node2).EPlusZoneNum > 0) && (AirflowNetworkNodeData(Node1).EPlusNodeNum == 0) && - (AirflowNetworkLinkSimu(i).FLOW > 0.0)) { + (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW > 0.0)) { ZN2 = AirflowNetworkNodeData(Node2).EPlusZoneNum; - Qsen = AirflowNetworkLinkSimu(i).FLOW * CpAir * (AirflowNetworkNodeSimu(Node1).TZ - AirflowNetworkNodeSimu(Node2).TZ); + Qsen = state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW * CpAir * (AirflowNetworkNodeSimu(Node1).TZ - AirflowNetworkNodeSimu(Node2).TZ); if (!state.dataAirflowNetworkBalanceManager->LoopOnOffFlag(AirflowNetworkLinkageData(i).AirLoopNum)) Qsen = 0.0; state.dataAirflowNetworkBalanceManager->exchangeData(ZN2).LeakSen += Qsen; } if ((AirflowNetworkNodeData(Node1).EPlusZoneNum > 0) && (AirflowNetworkNodeData(Node2).EPlusNodeNum == 0) && - (AirflowNetworkLinkSimu(i).FLOW2 > 0.0)) { + (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 > 0.0)) { ZN1 = AirflowNetworkNodeData(Node1).EPlusZoneNum; - Qsen = AirflowNetworkLinkSimu(i).FLOW2 * CpAir * (AirflowNetworkNodeSimu(Node2).TZ - AirflowNetworkNodeSimu(Node1).TZ); + Qsen = state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 * CpAir * (AirflowNetworkNodeSimu(Node2).TZ - AirflowNetworkNodeSimu(Node1).TZ); if (!state.dataAirflowNetworkBalanceManager->LoopOnOffFlag(AirflowNetworkLinkageData(i).AirLoopNum)) Qsen = 0.0; state.dataAirflowNetworkBalanceManager->exchangeData(ZN1).LeakSen += Qsen; } @@ -9064,7 +9093,7 @@ namespace AirflowNetwork { // Calculate latent loads from duct conduction losses if (AirflowNetworkLinkageData(i).ZoneNum > 0 && AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == CompTypeNum_DWC) { - Qlat = AirflowNetworkLinkSimu(i).FLOW * (AirflowNetworkNodeSimu(Node2).WZ - AirflowNetworkNodeSimu(Node1).WZ); + Qlat = state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW * (AirflowNetworkNodeSimu(Node2).WZ - AirflowNetworkNodeSimu(Node1).WZ); if (!state.dataAirflowNetworkBalanceManager->LoopOnOffFlag(AirflowNetworkLinkageData(i).AirLoopNum)) Qlat = 0.0; state.dataAirflowNetworkBalanceManager->exchangeData(AirflowNetworkLinkageData(i).ZoneNum).DiffLat -= Qlat; } @@ -9073,33 +9102,33 @@ namespace AirflowNetwork { AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == CompTypeNum_ELR) { // Calculate supply leak latent losses if ((AirflowNetworkNodeData(Node2).EPlusZoneNum > 0) && (AirflowNetworkNodeData(Node1).EPlusNodeNum == 0) && - (AirflowNetworkLinkSimu(i).FLOW > 0.0)) { + (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW > 0.0)) { ZN2 = AirflowNetworkNodeData(Node2).EPlusZoneNum; - Qlat = AirflowNetworkLinkSimu(i).FLOW * (AirflowNetworkNodeSimu(Node1).WZ - AirflowNetworkNodeSimu(Node2).WZ); + Qlat = state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW * (AirflowNetworkNodeSimu(Node1).WZ - AirflowNetworkNodeSimu(Node2).WZ); if (!state.dataAirflowNetworkBalanceManager->LoopOnOffFlag(AirflowNetworkLinkageData(i).AirLoopNum)) Qlat = 0.0; state.dataAirflowNetworkBalanceManager->exchangeData(ZN2).LeakLat += Qlat; if (state.dataContaminantBalance->Contaminant.CO2Simulation) { state.dataAirflowNetworkBalanceManager->exchangeData(ZN2).TotalCO2 += - AirflowNetworkLinkSimu(i).FLOW * (AirflowNetworkNodeSimu(Node1).CO2Z - AirflowNetworkNodeSimu(Node2).CO2Z); + state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW * (AirflowNetworkNodeSimu(Node1).CO2Z - AirflowNetworkNodeSimu(Node2).CO2Z); } if (state.dataContaminantBalance->Contaminant.GenericContamSimulation) { state.dataAirflowNetworkBalanceManager->exchangeData(ZN2).TotalGC += - AirflowNetworkLinkSimu(i).FLOW * (AirflowNetworkNodeSimu(Node1).GCZ - AirflowNetworkNodeSimu(Node2).GCZ); + state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW * (AirflowNetworkNodeSimu(Node1).GCZ - AirflowNetworkNodeSimu(Node2).GCZ); } } if ((AirflowNetworkNodeData(Node1).EPlusZoneNum > 0) && (AirflowNetworkNodeData(Node2).EPlusNodeNum == 0) && - (AirflowNetworkLinkSimu(i).FLOW2 > 0.0)) { + (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 > 0.0)) { ZN1 = AirflowNetworkNodeData(Node1).EPlusZoneNum; - Qlat = AirflowNetworkLinkSimu(i).FLOW2 * (AirflowNetworkNodeSimu(Node2).WZ - AirflowNetworkNodeSimu(Node1).WZ); + Qlat = state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 * (AirflowNetworkNodeSimu(Node2).WZ - AirflowNetworkNodeSimu(Node1).WZ); if (!state.dataAirflowNetworkBalanceManager->LoopOnOffFlag(AirflowNetworkLinkageData(i).AirLoopNum)) Qlat = 0.0; state.dataAirflowNetworkBalanceManager->exchangeData(ZN1).LeakLat += Qlat; if (state.dataContaminantBalance->Contaminant.CO2Simulation) { state.dataAirflowNetworkBalanceManager->exchangeData(ZN1).TotalCO2 += - AirflowNetworkLinkSimu(i).FLOW2 * (AirflowNetworkNodeSimu(Node2).CO2Z - AirflowNetworkNodeSimu(Node1).CO2Z); + state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 * (AirflowNetworkNodeSimu(Node2).CO2Z - AirflowNetworkNodeSimu(Node1).CO2Z); } if (state.dataContaminantBalance->Contaminant.GenericContamSimulation) { state.dataAirflowNetworkBalanceManager->exchangeData(ZN1).TotalGC += - AirflowNetworkLinkSimu(i).FLOW2 * (AirflowNetworkNodeSimu(Node2).GCZ - AirflowNetworkNodeSimu(Node1).GCZ); + state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 * (AirflowNetworkNodeSimu(Node2).GCZ - AirflowNetworkNodeSimu(Node1).GCZ); } } } @@ -9168,7 +9197,7 @@ namespace AirflowNetwork { } if (DisSysCompCVFData(FanNum).FanTypeNum == FanType_SimpleOnOff) { - for (i = 1; i <= AirflowNetworkNumOfZones; ++i) { + for (i = 1; i <= state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones; ++i) { if (AirflowNetworkNodeData(i).AirLoopNum == AirLoopNum) { state.dataAirflowNetworkBalanceManager->nodeReport(i).PZ = AirflowNetworkNodeSimu(i).PZ * state.dataAirflowNetworkBalanceManager->LoopPartLoadRatio(AirLoopNum) + state.dataAirflowNetworkBalanceManager->nodeReport(i).PZOFF * (1.0 - state.dataAirflowNetworkBalanceManager->LoopPartLoadRatio(AirLoopNum)); @@ -9177,7 +9206,7 @@ namespace AirflowNetwork { } for (i = 1; i <= state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfSurfaces; ++i) { PartLoadRatio = MaxPartLoadRatio; - for (j = 1; j <= AirflowNetworkNumOfZones; ++j) { + for (j = 1; j <= state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones; ++j) { if (MultizoneZoneData(j).ZoneNum == MultizoneSurfaceData(i).ZonePtr) { if (AirflowNetworkNodeData(j).AirLoopNum == AirLoopNum) { PartLoadRatio = state.dataAirflowNetworkBalanceManager->LoopPartLoadRatio(AirLoopNum); @@ -9186,16 +9215,16 @@ namespace AirflowNetwork { } } state.dataAirflowNetworkBalanceManager->linkReport1(i).FLOW = - AirflowNetworkLinkSimu(i).FLOW * PartLoadRatio + state.dataAirflowNetworkBalanceManager->linkReport1(i).FLOWOFF * (1.0 - PartLoadRatio); + state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW * PartLoadRatio + state.dataAirflowNetworkBalanceManager->linkReport1(i).FLOWOFF * (1.0 - PartLoadRatio); state.dataAirflowNetworkBalanceManager->linkReport1(i).FLOW2 = - AirflowNetworkLinkSimu(i).FLOW2 * PartLoadRatio + state.dataAirflowNetworkBalanceManager->linkReport1(i).FLOW2OFF * (1.0 - PartLoadRatio); + state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).FLOW2 * PartLoadRatio + state.dataAirflowNetworkBalanceManager->linkReport1(i).FLOW2OFF * (1.0 - PartLoadRatio); state.dataAirflowNetworkBalanceManager->linkReport1(i).VolFLOW = - AirflowNetworkLinkSimu(i).VolFLOW * PartLoadRatio + state.dataAirflowNetworkBalanceManager->linkReport1(i).VolFLOWOFF * (1.0 - PartLoadRatio); + state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).VolFLOW * PartLoadRatio + state.dataAirflowNetworkBalanceManager->linkReport1(i).VolFLOWOFF * (1.0 - PartLoadRatio); state.dataAirflowNetworkBalanceManager->linkReport1(i).VolFLOW2 = - AirflowNetworkLinkSimu(i).VolFLOW2 * PartLoadRatio + state.dataAirflowNetworkBalanceManager->linkReport1(i).VolFLOW2OFF * (1.0 - PartLoadRatio); + state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).VolFLOW2 * PartLoadRatio + state.dataAirflowNetworkBalanceManager->linkReport1(i).VolFLOW2OFF * (1.0 - PartLoadRatio); state.dataAirflowNetworkBalanceManager->linkReport1(i).DP = - AirflowNetworkLinkSimu(i).DP * PartLoadRatio + state.dataAirflowNetworkBalanceManager->linkReport1(i).DPOFF * (1.0 - PartLoadRatio); - state.dataAirflowNetworkBalanceManager->linkReport1(i).DPON = AirflowNetworkLinkSimu(i).DP; + state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).DP * PartLoadRatio + state.dataAirflowNetworkBalanceManager->linkReport1(i).DPOFF * (1.0 - PartLoadRatio); + state.dataAirflowNetworkBalanceManager->linkReport1(i).DPON = state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).DP; } } } @@ -9448,7 +9477,7 @@ namespace AirflowNetwork { { // Assign the system Fan AirLoop Number based on the zone inlet node - for (int i = 1; i <= AirflowNetworkNumOfZones; i++) { + for (int i = 1; i <= state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones; i++) { for (int j = 1; j <= state.dataGlobal->NumOfZones; j++) { if (!ZoneEquipConfig(j).IsControlled) continue; if ((MultizoneZoneData(i).ZoneNum == j) && (ZoneEquipConfig(j).NumInletNodes > 0)) { @@ -9713,7 +9742,7 @@ namespace AirflowNetwork { // Assign AirLoop Number to every node and linkage // Zone first - for (i = 1; i <= AirflowNetworkNumOfZones; i++) { + for (i = 1; i <= state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones; i++) { for (j = 1; j <= state.dataGlobal->NumOfZones; j++) { if (!ZoneEquipConfig(j).IsControlled) continue; if ((MultizoneZoneData(i).ZoneNum == j) && (ZoneEquipConfig(j).NumInletNodes > 0)) { @@ -10120,7 +10149,7 @@ namespace AirflowNetwork { } } if (OnOffFanFlag) { - for (j = 1; j <= AirflowNetworkNumOfZones; ++j) { + for (j = 1; j <= state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones; ++j) { if (!ZoneEquipConfig(AirflowNetworkNodeData(j).EPlusZoneNum).IsControlled) continue; for (i = 1; i <= state.dataAirflowNetworkBalanceManager->DisSysNumOfCVFs; i++) { if (DisSysCompCVFData(i).AirLoopNum == AirflowNetworkNodeData(j).AirLoopNum && @@ -10165,7 +10194,7 @@ namespace AirflowNetwork { AirflowNetworkLinkageData(i).Name); SetupOutputVariable(state, "AFN Linkage Node 1 to Node 2 Pressure Difference", OutputProcessor::Unit::Pa, - AirflowNetworkLinkSimu(i).DP, + state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).DP, "System", "Average", AirflowNetworkLinkageData(i).Name); @@ -10215,7 +10244,7 @@ namespace AirflowNetwork { AirflowNetworkLinkageData(i).Name); SetupOutputVariable(state, "AFN Linkage Node 1 to Node 2 Pressure Difference", OutputProcessor::Unit::Pa, - AirflowNetworkLinkSimu(i).DP, + state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(i).DP, "System", "Average", AirflowNetworkLinkageData(i).Name); @@ -10634,8 +10663,8 @@ namespace AirflowNetwork { // Count the total number of exterior simple and detailed openings and the number in each zone // Verify that each zone with "ADVANCED" single sided wind pressure coefficients has exactly two openings. // If it doesn't have two openings, change "ADVANCED" to "STANDARD" - NumofExtSurfInZone.dimension(AirflowNetworkNumOfZones, 0); - for (AFNZnNum = 1; AFNZnNum <= AirflowNetworkNumOfZones; ++AFNZnNum) { + NumofExtSurfInZone.dimension(state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones, 0); + for (AFNZnNum = 1; AFNZnNum <= state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones; ++AFNZnNum) { if (MultizoneZoneData(AFNZnNum).SingleSidedCpType == "ADVANCED") { for (SrfNum = 1; SrfNum <= state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfSurfaces; ++SrfNum) { if (Surface(MultizoneSurfaceData(SrfNum).SurfNum).ExtBoundCond == ExternalEnvironment) { // check if outdoor boundary condition @@ -10692,7 +10721,7 @@ namespace AirflowNetwork { if (AFNNumOfExtOpenings == 0) return; // Recount the number of single sided zones state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfSingleSideZones = 0; - for (AFNZnNum = 1; AFNZnNum <= AirflowNetworkNumOfZones; ++AFNZnNum) { + for (AFNZnNum = 1; AFNZnNum <= state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones; ++AFNZnNum) { if (MultizoneZoneData(AFNZnNum).SingleSidedCpType == "ADVANCED") { ++state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfSingleSideZones; } @@ -10745,9 +10774,13 @@ namespace AirflowNetwork { MultizoneSurfaceData(SrfNum).Width * MultizoneSurfaceData(SrfNum).Height * MultizoneSurfaceData(SrfNum).OpenFactor; AFNExtSurfaces(ExtOpenNum).ExtNodeNum = MultizoneSurfaceData(ExtOpenNum).NodeNums[1]; AFNExtSurfaces(ExtOpenNum).facadeNum = - MultizoneExternalNodeData(AFNExtSurfaces(ExtOpenNum).ExtNodeNum - AirflowNetworkNumOfZones).facadeNum; + MultizoneExternalNodeData(AFNExtSurfaces(ExtOpenNum).ExtNodeNum - + state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones) + .facadeNum; AFNExtSurfaces(ExtOpenNum).curve = - MultizoneExternalNodeData(AFNExtSurfaces(ExtOpenNum).ExtNodeNum - AirflowNetworkNumOfZones).curve; + MultizoneExternalNodeData(AFNExtSurfaces(ExtOpenNum).ExtNodeNum - + state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones) + .curve; AFNExtSurfaces(ExtOpenNum).DischCoeff = MultizoneCompDetOpeningData(DetOpenNum).DischCoeff2; ++ExtOpenNum; } @@ -10769,8 +10802,9 @@ namespace AirflowNetwork { AFNExtSurfaces(ExtOpenNum).OpeningArea = MultizoneSurfaceData(SrfNum).Width * MultizoneSurfaceData(SrfNum).Height * MultizoneSurfaceData(SrfNum).OpenFactor; AFNExtSurfaces(ExtOpenNum).ExtNodeNum = MultizoneSurfaceData(ExtOpenNum).NodeNums[1]; - AFNExtSurfaces(ExtOpenNum).curve = - MultizoneExternalNodeData(AFNExtSurfaces(ExtOpenNum).ExtNodeNum - AirflowNetworkNumOfZones).curve; + AFNExtSurfaces(ExtOpenNum).curve = MultizoneExternalNodeData(AFNExtSurfaces(ExtOpenNum).ExtNodeNum - + state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones) + .curve; AFNExtSurfaces(ExtOpenNum).DischCoeff = MultizoneCompSimpleOpeningData(SimOpenNum).DischCoeff; ++ExtOpenNum; } @@ -10781,11 +10815,11 @@ namespace AirflowNetwork { // Calculate Sprime and DeltaCp for each zone. PiFormula.allocate(numWindDir); SigmaFormula.allocate(numWindDir); - DeltaCp.allocate(AirflowNetworkNumOfZones); - EPDeltaCP.allocate(AirflowNetworkNumOfZones); - Sprime.allocate(AirflowNetworkNumOfZones); - ZoneAng.allocate(AirflowNetworkNumOfZones); - for (ZnNum = 1; ZnNum <= AirflowNetworkNumOfZones; ++ZnNum) { + DeltaCp.allocate(state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones); + EPDeltaCP.allocate(state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones); + Sprime.allocate(state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones); + ZoneAng.allocate(state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones); + for (ZnNum = 1; ZnNum <= state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones; ++ZnNum) { DeltaCp(ZnNum).WindDir.allocate(numWindDir); EPDeltaCP(ZnNum).WindDir.allocate(numWindDir); for (windDirNum = 1; windDirNum <= numWindDir; ++windDirNum) { @@ -10795,7 +10829,7 @@ namespace AirflowNetwork { } Sprime = 0.0; ZoneAng = 0.0; - for (ZnNum = 1; ZnNum <= AirflowNetworkNumOfZones; ++ZnNum) { + for (ZnNum = 1; ZnNum <= state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones; ++ZnNum) { if (MultizoneZoneData(ZnNum).SingleSidedCpType == "ADVANCED") { OpenNuminZone = 1; for (ExtOpenNum = 1; ExtOpenNum <= AFNNumOfExtOpenings; ++ExtOpenNum) { @@ -10848,7 +10882,7 @@ namespace AirflowNetwork { CPV1 = 0.0; CPV2 = 0.0; SrfNum = 6; - for (ZnNum = 1; ZnNum <= AirflowNetworkNumOfZones; ++ZnNum) { + for (ZnNum = 1; ZnNum <= state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones; ++ZnNum) { if (MultizoneZoneData(ZnNum).SingleSidedCpType == "ADVANCED") { OpenNuminZone = 1; for (ExtOpenNum = 1; ExtOpenNum <= AFNNumOfExtOpenings; ++ExtOpenNum) { @@ -10864,7 +10898,9 @@ namespace AirflowNetwork { cpvalues[windDirNum - 1] = CPV1(windDirNum) = VelRatio_2 * unmodifiedValue; } valsByFacade.push_back(cpvalues); - MultizoneExternalNodeData(AFNExtSurfaces(ExtOpenNum).ExtNodeNum - AirflowNetworkNumOfZones).facadeNum = SrfNum; + MultizoneExternalNodeData(AFNExtSurfaces(ExtOpenNum).ExtNodeNum - + state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones) + .facadeNum = SrfNum; ++OpenNuminZone; ++SrfNum; } else if (OpenNuminZone == 2) { @@ -10876,7 +10912,9 @@ namespace AirflowNetwork { EPDeltaCP(ZnNum).WindDir(windDirNum) = std::abs(CPV2(windDirNum) - CPV1(windDirNum)); } valsByFacade.push_back(cpvalues); - MultizoneExternalNodeData(AFNExtSurfaces(ExtOpenNum).ExtNodeNum - AirflowNetworkNumOfZones).facadeNum = SrfNum; + MultizoneExternalNodeData(AFNExtSurfaces(ExtOpenNum).ExtNodeNum - + state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones) + .facadeNum = SrfNum; ++OpenNuminZone; ++SrfNum; } @@ -10886,7 +10924,7 @@ namespace AirflowNetwork { } // Rewrite the CPVNum for all nodes that correspond with a simple or detailed opening // Does this loop really do anything? - for (ZnNum = 1; ZnNum <= AirflowNetworkNumOfZones; ++ZnNum) { + for (ZnNum = 1; ZnNum <= state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones; ++ZnNum) { OpenNuminZone = 1; for (ExtOpenNum = 1; ExtOpenNum <= AFNNumOfExtOpenings; ++ExtOpenNum) { if (AFNExtSurfaces(ExtOpenNum).MZDZoneNum == ZnNum) { diff --git a/src/EnergyPlus/AirflowNetworkBalanceManager.hh b/src/EnergyPlus/AirflowNetworkBalanceManager.hh index 4e4412762b7..532304898aa 100644 --- a/src/EnergyPlus/AirflowNetworkBalanceManager.hh +++ b/src/EnergyPlus/AirflowNetworkBalanceManager.hh @@ -228,6 +228,7 @@ struct AirflowNetworkBalanceManagerData : BaseGlobalStruct { void calculateWindPressureCoeffs(EnergyPlusData &state); int AirflowNetworkNumOfSurfaces = 0; // The number of surfaces for multizone calculation + int AirflowNetworkNumOfZones = 0; // The number of zones for multizone calculation Array1D OccupantVentilationControl; Array1D_int SplitterNodeNumbers; @@ -293,6 +294,8 @@ struct AirflowNetworkBalanceManagerData : BaseGlobalStruct { Array1D AirflowNetworkZnRpt; std::unordered_map UniqueAirflowNetworkSurfaceName; + Array1D AirflowNetworkLinkSimu; + //AirflowNetwork::Solver solver; // Output and reporting @@ -304,6 +307,10 @@ struct AirflowNetworkBalanceManagerData : BaseGlobalStruct { void clear_state() override { + this->AirflowNetworkNumOfSurfaces = 0; + this->AirflowNetworkNumOfZones = 0; + this->AirflowNetworkLinkSimu.deallocate(); + this->OccupantVentilationControl.deallocate(); this->SplitterNodeNumbers.deallocate(); this->AirflowNetworkNumOfExtSurfaces = 0; diff --git a/src/EnergyPlus/CrossVentMgr.cc b/src/EnergyPlus/CrossVentMgr.cc index 9ce94b2873c..f0cfd1fbf1d 100644 --- a/src/EnergyPlus/CrossVentMgr.cc +++ b/src/EnergyPlus/CrossVentMgr.cc @@ -355,27 +355,27 @@ namespace CrossVentMgr { MaxSurf = state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(1, ZoneNum); if (Surface(AirflowNetwork::MultizoneSurfaceData(MaxSurf).SurfNum).Zone == ZoneNum) { // this is a direct airflow network aperture - SumToZone = AirflowNetwork::AirflowNetworkLinkSimu(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(1, ZoneNum)).VolFLOW2; - MaxFlux = AirflowNetwork::AirflowNetworkLinkSimu(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(1, ZoneNum)).VolFLOW2; + SumToZone = state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(1, ZoneNum)).VolFLOW2; + MaxFlux = state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(1, ZoneNum)).VolFLOW2; } else { // this is an indirect airflow network aperture - SumToZone = AirflowNetwork::AirflowNetworkLinkSimu(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(1, ZoneNum)).VolFLOW; - MaxFlux = AirflowNetwork::AirflowNetworkLinkSimu(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(1, ZoneNum)).VolFLOW; + SumToZone = state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(1, ZoneNum)).VolFLOW; + MaxFlux = state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(1, ZoneNum)).VolFLOW; } for (Ctd2 = 2; Ctd2 <= state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(0, ZoneNum); ++Ctd2) { if (Surface(AirflowNetwork::MultizoneSurfaceData(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Ctd2, ZoneNum)).SurfNum).Zone == ZoneNum) { - if (AirflowNetwork::AirflowNetworkLinkSimu(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Ctd2, ZoneNum)).VolFLOW2 > MaxFlux) { - MaxFlux = AirflowNetwork::AirflowNetworkLinkSimu(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Ctd2, ZoneNum)).VolFLOW2; + if (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Ctd2, ZoneNum)).VolFLOW2 > MaxFlux) { + MaxFlux = state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Ctd2, ZoneNum)).VolFLOW2; MaxSurf = state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Ctd2, ZoneNum); } - SumToZone += AirflowNetwork::AirflowNetworkLinkSimu(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Ctd2, ZoneNum)).VolFLOW2; + SumToZone += state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Ctd2, ZoneNum)).VolFLOW2; } else { - if (AirflowNetwork::AirflowNetworkLinkSimu(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Ctd2, ZoneNum)).VolFLOW > MaxFlux) { - MaxFlux = AirflowNetwork::AirflowNetworkLinkSimu(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Ctd2, ZoneNum)).VolFLOW; + if (state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Ctd2, ZoneNum)).VolFLOW > MaxFlux) { + MaxFlux = state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Ctd2, ZoneNum)).VolFLOW; MaxSurf = state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Ctd2, ZoneNum); } - SumToZone += AirflowNetwork::AirflowNetworkLinkSimu(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Ctd2, ZoneNum)).VolFLOW; + SumToZone += state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Ctd2, ZoneNum)).VolFLOW; } } @@ -493,10 +493,10 @@ namespace CrossVentMgr { for (Ctd = 1; Ctd <= state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(0, ZoneNum); ++Ctd) { if (Surface(AirflowNetwork::MultizoneSurfaceData(Ctd).SurfNum).Zone == ZoneNum) { // this is a direct airflow network aperture - state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).Fin = AirflowNetwork::AirflowNetworkLinkSimu(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Ctd, ZoneNum)).VolFLOW2; + state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).Fin = state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Ctd, ZoneNum)).VolFLOW2; } else { // this is an indirect airflow network aperture - state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).Fin = AirflowNetwork::AirflowNetworkLinkSimu(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Ctd, ZoneNum)).VolFLOW; + state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).Fin = state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Ctd, ZoneNum)).VolFLOW; } if (state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).Area != 0) { state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).Uin = state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).Fin / state.dataRoomAirMod->CVJetRecFlows(Ctd, ZoneNum).Area; diff --git a/src/EnergyPlus/DisplacementVentMgr.cc b/src/EnergyPlus/DisplacementVentMgr.cc index 8d499718e50..19b38e586fe 100644 --- a/src/EnergyPlus/DisplacementVentMgr.cc +++ b/src/EnergyPlus/DisplacementVentMgr.cc @@ -774,12 +774,12 @@ namespace DisplacementVentMgr { if (Surface(AirflowNetwork::MultizoneSurfaceData(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Loop, ZoneNum)).SurfNum).Zone == ZoneNum) { if ((state.dataRoomAirMod->SurfParametersCVDV(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Loop, ZoneNum)).Zmax < 0.8 && - AirflowNetwork::AirflowNetworkLinkSimu(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Loop, ZoneNum)).VolFLOW > 0)) { + state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Loop, ZoneNum)).VolFLOW > 0)) { FlagApertures = 0; break; } if (state.dataRoomAirMod->SurfParametersCVDV(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Loop, ZoneNum)).Zmin > 1.8 && - AirflowNetwork::AirflowNetworkLinkSimu(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Loop, ZoneNum)).VolFLOW2 > 0) { + state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Loop, ZoneNum)).VolFLOW2 > 0) { FlagApertures = 0; break; } @@ -798,7 +798,7 @@ namespace DisplacementVentMgr { Zone(Surface(AirflowNetwork::MultizoneSurfaceData(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Loop, ZoneNum)).SurfNum).Zone).OriginZ - Zone(ZoneNum).OriginZ < 0.8 && - AirflowNetwork::AirflowNetworkLinkSimu(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Loop, ZoneNum)).VolFLOW2 > 0) { + state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Loop, ZoneNum)).VolFLOW2 > 0) { FlagApertures = 0; break; } @@ -806,7 +806,7 @@ namespace DisplacementVentMgr { Zone(Surface(AirflowNetwork::MultizoneSurfaceData(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Loop, ZoneNum)).SurfNum).Zone).OriginZ - Zone(ZoneNum).OriginZ > 1.8 && - AirflowNetwork::AirflowNetworkLinkSimu(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Loop, ZoneNum)).VolFLOW > 0) { + state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(state.dataRoomAirMod->AirflowNetworkSurfaceUCSDCV(Loop, ZoneNum)).VolFLOW > 0) { FlagApertures = 0; break; } diff --git a/src/EnergyPlus/RoomAirModelAirflowNetwork.cc b/src/EnergyPlus/RoomAirModelAirflowNetwork.cc index 0e26e60e946..41ea685c338 100644 --- a/src/EnergyPlus/RoomAirModelAirflowNetwork.cc +++ b/src/EnergyPlus/RoomAirModelAirflowNetwork.cc @@ -52,6 +52,7 @@ // EnergyPlus Headers #include +#include #include #include #include @@ -589,13 +590,13 @@ namespace RoomAirModelAirflowNetwork { NodeIn = AirflowNetwork::AirflowNetworkLinkageData(Link).NodeNums[1]; ThisRAFNNode.Link(linkNum).TempIn = AirflowNetwork::AirflowNetworkNodeSimu(NodeIn).TZ; ThisRAFNNode.Link(linkNum).HumRatIn = AirflowNetwork::AirflowNetworkNodeSimu(NodeIn).WZ; - ThisRAFNNode.Link(linkNum).MdotIn = AirflowNetwork::AirflowNetworkLinkSimu(Link).FLOW2; + ThisRAFNNode.Link(linkNum).MdotIn = state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(Link).FLOW2; } if (AirflowNetwork::AirflowNetworkLinkageData(Link).NodeNums[1] == NodeNum) { // outgoing flow NodeIn = AirflowNetwork::AirflowNetworkLinkageData(Link).NodeNums[0]; ThisRAFNNode.Link(linkNum).TempIn = AirflowNetwork::AirflowNetworkNodeSimu(NodeIn).TZ; ThisRAFNNode.Link(linkNum).HumRatIn = AirflowNetwork::AirflowNetworkNodeSimu(NodeIn).WZ; - ThisRAFNNode.Link(linkNum).MdotIn = AirflowNetwork::AirflowNetworkLinkSimu(Link).FLOW; + ThisRAFNNode.Link(linkNum).MdotIn = state.dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(Link).FLOW; } } diff --git a/tst/EnergyPlus/unit/AirflowNetworkBalanceManager.unit.cc b/tst/EnergyPlus/unit/AirflowNetworkBalanceManager.unit.cc index 3f20685bc93..31ad855edac 100644 --- a/tst/EnergyPlus/unit/AirflowNetworkBalanceManager.unit.cc +++ b/tst/EnergyPlus/unit/AirflowNetworkBalanceManager.unit.cc @@ -2368,9 +2368,9 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestPressureStat) DataZoneEquipment::ZoneEquipConfig(4).IsControlled = false; DataHVACGlobals::TimeStepSys = 0.1; - AirflowNetwork::AirflowNetworkLinkSimu(1).FLOW2 = 0.1; - AirflowNetwork::AirflowNetworkLinkSimu(10).FLOW2 = 0.15; - AirflowNetwork::AirflowNetworkLinkSimu(13).FLOW2 = 0.1; + state->dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(1).FLOW2 = 0.1; + state->dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(10).FLOW2 = 0.15; + state->dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(13).FLOW2 = 0.1; ReportAirflowNetwork(*state); @@ -2386,12 +2386,13 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestPressureStat) Real64 hg = Psychrometrics::PsyHgAirFnWTdb(DataHeatBalFanSys::ZoneAirHumRat(1), DataHeatBalFanSys::MAT(1)); Real64 hzone = Psychrometrics::PsyHFnTdbW(DataHeatBalFanSys::MAT(1), DataHeatBalFanSys::ZoneAirHumRat(1)); Real64 hamb = Psychrometrics::PsyHFnTdbW(0.0, state->dataEnvrn->OutHumRat); - Real64 hdiff = AirflowNetwork::AirflowNetworkLinkSimu(1).FLOW2 * (hzone - hamb); + Real64 hdiff = state->dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(1).FLOW2 * (hzone - hamb); Real64 sum = AirflowNetwork::AirflowNetworkReportData(1).MultiZoneInfiSenLossW - AirflowNetwork::AirflowNetworkReportData(1).MultiZoneInfiLatGainW; // Existing code uses T_average to calculate hg, get close results EXPECT_NEAR(hdiff, sum, 0.4); - Real64 dhlatent = AirflowNetwork::AirflowNetworkLinkSimu(1).FLOW2 * hg * (DataHeatBalFanSys::ZoneAirHumRat(1) - state->dataEnvrn->OutHumRat); + Real64 dhlatent = state->dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(1).FLOW2 * hg * + (DataHeatBalFanSys::ZoneAirHumRat(1) - state->dataEnvrn->OutHumRat); // when hg is calculated with indoor temperature, get exact results sum = AirflowNetwork::AirflowNetworkReportData(1).MultiZoneInfiSenLossW + dhlatent; EXPECT_NEAR(hdiff, sum, 0.001); @@ -13174,11 +13175,11 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_MultiAirLoopTest) CalcAirflowNetworkAirBalance(*state); // Check mass flow rate - EXPECT_NEAR(1.40, AirflowNetwork::AirflowNetworkLinkSimu(42).FLOW, 0.0001); - EXPECT_NEAR(0.52, AirflowNetwork::AirflowNetworkLinkSimu(67).FLOW, 0.0001); - EXPECT_NEAR(0.2795108, AirflowNetwork::AirflowNetworkLinkSimu(51).FLOW, 0.0001); - EXPECT_NEAR(0.1095108, AirflowNetwork::AirflowNetworkLinkSimu(66).FLOW, 0.0001); - EXPECT_NEAR(0.1005046, AirflowNetwork::AirflowNetworkLinkSimu(15).FLOW, 0.0001); + EXPECT_NEAR(1.40, state->dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(42).FLOW, 0.0001); + EXPECT_NEAR(0.52, state->dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(67).FLOW, 0.0001); + EXPECT_NEAR(0.2795108, state->dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(51).FLOW, 0.0001); + EXPECT_NEAR(0.1095108, state->dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(66).FLOW, 0.0001); + EXPECT_NEAR(0.1005046, state->dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(15).FLOW, 0.0001); AirflowNetwork::AirflowNetworkFanActivated = false; // #7977 @@ -13201,7 +13202,7 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_MultiAirLoopTest) DataZoneEquipment::ZoneEquipConfig(4).IsControlled = false; DataZoneEquipment::ZoneEquipConfig(5).IsControlled = false; state->dataAirflowNetworkBalanceManager->exchangeData.allocate(5); - AirflowNetwork::AirflowNetworkLinkSimu(3).FLOW2 = 0.002364988; + state->dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(3).FLOW2 = 0.002364988; ReportAirflowNetwork(*state); EXPECT_NEAR(AirflowNetwork::AirflowNetworkReportData(1).MultiZoneInfiSenLossW, 95.89575, 0.001); @@ -15627,7 +15628,7 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestFanModel) CalcAirflowNetworkAirBalance(*state); // Fan:SystemModel - EXPECT_NEAR(1.23, AirflowNetwork::AirflowNetworkLinkSimu(20).FLOW, 0.0001); + EXPECT_NEAR(1.23, state->dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(20).FLOW, 0.0001); EXPECT_TRUE(AirflowNetwork::DisSysCompCVFData(1).FanModelFlag); for (i = 1; i <= 21; ++i) { @@ -15642,7 +15643,7 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestFanModel) // Fan:OnOff AirflowNetwork::DisSysCompCVFData(1).FanModelFlag = false; CalcAirflowNetworkAirBalance(*state); - EXPECT_NEAR(1.23, AirflowNetwork::AirflowNetworkLinkSimu(20).FLOW, 0.0001); + EXPECT_NEAR(1.23, state->dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(20).FLOW, 0.0001); state->dataAirLoop->AirLoopAFNInfo.deallocate(); } @@ -15769,7 +15770,7 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_CheckMultiZoneNodes_NoInletNode) DataZoneEquipment::ZoneEquipConfig(1).IsControlled = true; // One AirflowNetwork:MultiZone:Zone object - AirflowNetwork::AirflowNetworkNumOfZones = 1; + state->dataAirflowNetworkBalanceManager->AirflowNetworkNumOfZones = 1; AirflowNetwork::MultizoneZoneData.allocate(1); AirflowNetwork::MultizoneZoneData(1).ZoneNum = 1; AirflowNetwork::MultizoneZoneData(1).ZoneName = "ATTIC ZONE"; diff --git a/tst/EnergyPlus/unit/CrossVentMgr.unit.cc b/tst/EnergyPlus/unit/CrossVentMgr.unit.cc index 1d4d31e6dcf..e31e3c61145 100644 --- a/tst/EnergyPlus/unit/CrossVentMgr.unit.cc +++ b/tst/EnergyPlus/unit/CrossVentMgr.unit.cc @@ -116,8 +116,8 @@ TEST_F(EnergyPlusFixture, CrossVentMgr_EvolveParaUCSDCV_Test) EnergyPlus::DataHeatBalance::Zone(1).Volume = 996.75300003839993; EnergyPlus::DataHeatBalance::Zone(1).FloorArea = 297.28972800000003; - EnergyPlus::AirflowNetwork::AirflowNetworkLinkSimu.allocate(1); - EnergyPlus::AirflowNetwork::AirflowNetworkLinkSimu(1).VolFLOW2 = 27.142934345451458; + state->dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu.allocate(1); + state->dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(1).VolFLOW2 = 27.142934345451458; state->dataEnvrn->WindDir = 271.66666666666669; diff --git a/tst/EnergyPlus/unit/RoomAirflowNetwork.unit.cc b/tst/EnergyPlus/unit/RoomAirflowNetwork.unit.cc index 5b1e462d94b..ba559d6401b 100644 --- a/tst/EnergyPlus/unit/RoomAirflowNetwork.unit.cc +++ b/tst/EnergyPlus/unit/RoomAirflowNetwork.unit.cc @@ -125,7 +125,7 @@ class RoomAirflowNetworkTest : public EnergyPlusFixture ZoneAirHumRat.allocate(1); AirflowNetwork::AirflowNetworkLinkageData.allocate(5); AirflowNetwork::AirflowNetworkNodeSimu.allocate(6); - AirflowNetwork::AirflowNetworkLinkSimu.allocate(5); + state->dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu.allocate(5); RAFN.allocate(state->dataGlobal->NumOfZones); } @@ -222,16 +222,16 @@ TEST_F(RoomAirflowNetworkTest, RAFNTest) AirflowNetwork::AirflowNetworkNodeSimu(5).WZ = 0.0015; AirflowNetwork::AirflowNetworkNodeSimu(6).TZ = 20.0; AirflowNetwork::AirflowNetworkNodeSimu(6).WZ = 0.002; - AirflowNetwork::AirflowNetworkLinkSimu(1).FLOW = 0.0; - AirflowNetwork::AirflowNetworkLinkSimu(1).FLOW2 = 0.01; - AirflowNetwork::AirflowNetworkLinkSimu(2).FLOW = 0.0; - AirflowNetwork::AirflowNetworkLinkSimu(2).FLOW2 = 0.02; - AirflowNetwork::AirflowNetworkLinkSimu(3).FLOW = 0.01; - AirflowNetwork::AirflowNetworkLinkSimu(3).FLOW2 = 0.0; - AirflowNetwork::AirflowNetworkLinkSimu(4).FLOW = 0.0; - AirflowNetwork::AirflowNetworkLinkSimu(4).FLOW2 = 0.01; - AirflowNetwork::AirflowNetworkLinkSimu(5).FLOW = 0.01; - AirflowNetwork::AirflowNetworkLinkSimu(5).FLOW2 = 0.0; + state->dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(1).FLOW = 0.0; + state->dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(1).FLOW2 = 0.01; + state->dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(2).FLOW = 0.0; + state->dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(2).FLOW2 = 0.02; + state->dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(3).FLOW = 0.01; + state->dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(3).FLOW2 = 0.0; + state->dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(4).FLOW = 0.0; + state->dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(4).FLOW2 = 0.01; + state->dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(5).FLOW = 0.01; + state->dataAirflowNetworkBalanceManager->AirflowNetworkLinkSimu(5).FLOW2 = 0.0; ZoneEquipList(ZoneNum).NumOfEquipTypes = 1; ZoneEquipList(ZoneNum).EquipName.allocate(1);