LCOV - code coverage report
Current view: top level - EnergyPlus - RoomAirModelAirflowNetwork.cc (source / functions) Coverage Total Hit
Test: lcov.output.filtered Lines: 66.2 % 554 367
Test Date: 2025-06-02 07:23:51 Functions: 100.0 % 9 9

            Line data    Source code
       1              : // EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois,
       2              : // The Regents of the University of California, through Lawrence Berkeley National Laboratory
       3              : // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge
       4              : // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other
       5              : // contributors. All rights reserved.
       6              : //
       7              : // NOTICE: This Software was developed under funding from the U.S. Department of Energy and the
       8              : // U.S. Government consequently retains certain rights. As such, the U.S. Government has been
       9              : // granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable,
      10              : // worldwide license in the Software to reproduce, distribute copies to the public, prepare
      11              : // derivative works, and perform publicly and display publicly, and to permit others to do so.
      12              : //
      13              : // Redistribution and use in source and binary forms, with or without modification, are permitted
      14              : // provided that the following conditions are met:
      15              : //
      16              : // (1) Redistributions of source code must retain the above copyright notice, this list of
      17              : //     conditions and the following disclaimer.
      18              : //
      19              : // (2) Redistributions in binary form must reproduce the above copyright notice, this list of
      20              : //     conditions and the following disclaimer in the documentation and/or other materials
      21              : //     provided with the distribution.
      22              : //
      23              : // (3) Neither the name of the University of California, Lawrence Berkeley National Laboratory,
      24              : //     the University of Illinois, U.S. Dept. of Energy nor the names of its contributors may be
      25              : //     used to endorse or promote products derived from this software without specific prior
      26              : //     written permission.
      27              : //
      28              : // (4) Use of EnergyPlus(TM) Name. If Licensee (i) distributes the software in stand-alone form
      29              : //     without changes from the version obtained under this License, or (ii) Licensee makes a
      30              : //     reference solely to the software portion of its product, Licensee must refer to the
      31              : //     software as "EnergyPlus version X" software, where "X" is the version number Licensee
      32              : //     obtained under this License and may not use a different name for the software. Except as
      33              : //     specifically required in this Section (4), Licensee shall not use in a company name, a
      34              : //     product name, in advertising, publicity, or other promotional activities any name, trade
      35              : //     name, trademark, logo, or other designation of "EnergyPlus", "E+", "e+" or confusingly
      36              : //     similar designation, without the U.S. Department of Energy's prior written consent.
      37              : //
      38              : // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
      39              : // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
      40              : // AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
      41              : // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
      42              : // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
      43              : // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
      44              : // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
      45              : // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
      46              : // POSSIBILITY OF SUCH DAMAGE.
      47              : 
      48              : // ObjexxFCL Headers
      49              : #include <ObjexxFCL/Array.functions.hh>
      50              : #include <ObjexxFCL/Array1D.hh>
      51              : // #include <ObjexxFCL/Fmath.hh>
      52              : 
      53              : // EnergyPlus Headers
      54              : #include <AirflowNetwork/Solver.hpp>
      55              : #include <EnergyPlus/BaseboardElectric.hh>
      56              : #include <EnergyPlus/BaseboardRadiator.hh>
      57              : #include <EnergyPlus/Data/EnergyPlusData.hh>
      58              : #include <EnergyPlus/DataDefineEquip.hh>
      59              : #include <EnergyPlus/DataEnvironment.hh>
      60              : #include <EnergyPlus/DataHVACGlobals.hh>
      61              : #include <EnergyPlus/DataHeatBalSurface.hh>
      62              : #include <EnergyPlus/DataHeatBalance.hh>
      63              : #include <EnergyPlus/DataLoopNode.hh>
      64              : #include <EnergyPlus/DataMoistureBalance.hh>
      65              : #include <EnergyPlus/DataMoistureBalanceEMPD.hh>
      66              : #include <EnergyPlus/DataRoomAirModel.hh>
      67              : #include <EnergyPlus/DataSurfaceLists.hh>
      68              : #include <EnergyPlus/DataSurfaces.hh>
      69              : #include <EnergyPlus/DataZoneEquipment.hh>
      70              : #include <EnergyPlus/ElectricBaseboardRadiator.hh>
      71              : #include <EnergyPlus/FluidProperties.hh>
      72              : #include <EnergyPlus/General.hh>
      73              : #include <EnergyPlus/GlobalNames.hh>
      74              : #include <EnergyPlus/HWBaseboardRadiator.hh>
      75              : #include <EnergyPlus/HeatBalFiniteDiffManager.hh>
      76              : #include <EnergyPlus/HeatBalanceHAMTManager.hh>
      77              : #include <EnergyPlus/HighTempRadiantSystem.hh>
      78              : #include <EnergyPlus/InputProcessing/InputProcessor.hh>
      79              : #include <EnergyPlus/InternalHeatGains.hh>
      80              : #include <EnergyPlus/MoistureBalanceEMPDManager.hh>
      81              : #include <EnergyPlus/OutputProcessor.hh>
      82              : #include <EnergyPlus/Psychrometrics.hh>
      83              : #include <EnergyPlus/RefrigeratedCase.hh>
      84              : #include <EnergyPlus/RoomAirModelAirflowNetwork.hh>
      85              : #include <EnergyPlus/SteamBaseboardRadiator.hh>
      86              : #include <EnergyPlus/UtilityRoutines.hh>
      87              : #include <EnergyPlus/ZoneAirLoopEquipmentManager.hh>
      88              : #include <EnergyPlus/ZoneDehumidifier.hh>
      89              : #include <EnergyPlus/ZonePlenum.hh>
      90              : #include <EnergyPlus/ZoneTempPredictorCorrector.hh>
      91              : 
      92              : namespace EnergyPlus {
      93              : 
      94              : namespace RoomAir {
      95              : 
      96              :     // MODULE INFORMATION:
      97              :     //       AUTHOR         Brent Griffith
      98              :     //       DATE WRITTEN   November 2009
      99              :     //       MODIFIED       Lixing Gu, Aug. 2015 for v8.4 replease
     100              : 
     101              :     // PURPOSE OF THIS MODULE:
     102              :     // contains the RoomAir model portions of RoomAirflowNetwork modeling
     103              : 
     104              :     // METHODOLOGY EMPLOYED:
     105              :     // Interact with Surface HB, internal gain, HVAC system and Airflow Network Domains
     106              :     // Do heat and moisture balance calculations on roomair nodes.
     107              : 
     108              :     // Using/Aliasing
     109              :     using namespace DataHeatBalSurface;
     110              :     using namespace DataSurfaces;
     111              :     using namespace DataHeatBalance;
     112              : 
     113         7413 :     void SimRoomAirModelAFN(EnergyPlusData &state, int const zoneNum) // index number for the specified zone
     114              :     {
     115              : 
     116              :         // SUBROUTINE INFORMATION:
     117              :         //       AUTHOR         Brent Griffith
     118              :         //       DATE WRITTEN   January 2004/Aug 2005
     119              :         //       MODIFIED       Lixing Gu, Aug. 2015 for v8.4 replease
     120              : 
     121              :         // PURPOSE OF THIS SUBROUTINE:
     122              :         // This subroutine manages RoomAirflowNetwork model simulation
     123              : 
     124              :         // METHODOLOGY EMPLOYED:
     125              :         // calls subroutines (LOL)
     126              : 
     127         7413 :         auto const &afnZoneInfo = state.dataRoomAir->AFNZoneInfo(zoneNum);
     128              : 
     129              :         // model control volume for each roomAir:node in the zone.
     130        51891 :         for (int roomAirNodeNum = 1; roomAirNodeNum <= afnZoneInfo.NumOfAirNodes; ++roomAirNodeNum) {
     131        44478 :             InitRoomAirModelAFN(state, zoneNum, roomAirNodeNum);
     132        44478 :             CalcRoomAirModelAFN(state, zoneNum, roomAirNodeNum);
     133              :         }
     134              : 
     135         7413 :         UpdateRoomAirModelAFN(state, zoneNum);
     136              : 
     137         7413 :     } // SimRoomAirModelAirflowNetwork
     138              : 
     139              :     //****************************************************
     140              : 
     141         7413 :     void LoadPredictionRoomAirModelAFN(EnergyPlusData &state,
     142              :                                        int const zoneNum,
     143              :                                        int const roomAirNodeNum) // index number for the specified zone and node
     144              :     {
     145              : 
     146              :         // SUBROUTINE INFORMATION:
     147              :         //       AUTHOR         Lixing Gu
     148              :         //       DATE WRITTEN   June, 2015
     149              : 
     150              :         // PURPOSE OF THIS SUBROUTINE:
     151              :         // Predict zone loads at a controlled node
     152              : 
     153         7413 :         InitRoomAirModelAFN(state, zoneNum, roomAirNodeNum);
     154              : 
     155         7413 :     } // LoadPredictionRoomAirModelAirflowNetwork
     156              : 
     157              :     //****************************************************
     158              : 
     159        51891 :     void InitRoomAirModelAFN(EnergyPlusData &state, int const zoneNum,
     160              :                              int const roomAirNodeNum) // index number for the specified zone
     161              :     {
     162              : 
     163              :         // SUBROUTINE INFORMATION:
     164              :         //       AUTHOR         B. Griffith
     165              :         //       DATE WRITTEN   November 2009
     166              :         //       MODIFIED       Lixing Gu, Aug. 2015 for v8.4 release
     167              : 
     168              :         // PURPOSE OF THIS SUBROUTINE:
     169              :         // Perform one-time checking and term calculations
     170              : 
     171              :         using InternalHeatGains::SumInternalLatentGainsByTypes;
     172              :         using Psychrometrics::PsyCpAirFnW;
     173              :         using Psychrometrics::PsyRhoAirFnPbTdbW;
     174              : 
     175        51891 :         Array1D_bool NodeFound; // True if a node is found.
     176        51891 :         Array1D_bool EquipFound;
     177        51891 :         Array1D<Real64> SupplyFrac;
     178        51891 :         Array1D<Real64> ReturnFrac;
     179              : 
     180        51891 :         if (state.dataRoomAirflowNetModel->OneTimeFlag) { // then do one - time setup inits
     181              : 
     182              :             // loop over all zones with RoomAirflowNetwork model
     183            6 :             for (int iZone = 1; iZone <= state.dataGlobal->NumOfZones; ++iZone) {
     184            5 :                 auto &afnZoneInfo = state.dataRoomAir->AFNZoneInfo(iZone);
     185            5 :                 if (!afnZoneInfo.IsUsed) {
     186            4 :                     continue;
     187              :                 }
     188            1 :                 int NumSurfs = 0; // NumSurfs isn't used anywhere?
     189            2 :                 for (int spaceNum : state.dataHeatBal->Zone(iZone).spaceIndexes) {
     190            1 :                     auto const &thisSpace = state.dataHeatBal->space(spaceNum);
     191            1 :                     NumSurfs += thisSpace.HTSurfaceLast - thisSpace.HTSurfaceFirst + 1;
     192            1 :                 }
     193              : 
     194            7 :                 for (auto &afnNode : afnZoneInfo.Node) {
     195              :                     // calculate volume of air in node's control volume
     196            6 :                     afnNode.AirVolume = state.dataHeatBal->Zone(iZone).Volume * afnNode.ZoneVolumeFraction;
     197              : 
     198           12 :                     SetupOutputVariable(state,
     199              :                                         "RoomAirflowNetwork Node NonAirSystemResponse",
     200              :                                         Constant::Units::W,
     201            6 :                                         afnNode.NonAirSystemResponse,
     202              :                                         OutputProcessor::TimeStepType::System,
     203              :                                         OutputProcessor::StoreType::Average,
     204            6 :                                         afnNode.Name);
     205           12 :                     SetupOutputVariable(state,
     206              :                                         "RoomAirflowNetwork Node SysDepZoneLoadsLagged",
     207              :                                         Constant::Units::W,
     208            6 :                                         afnNode.SysDepZoneLoadsLagged,
     209              :                                         OutputProcessor::TimeStepType::System,
     210              :                                         OutputProcessor::StoreType::Average,
     211            6 :                                         afnNode.Name);
     212           12 :                     SetupOutputVariable(state,
     213              :                                         "RoomAirflowNetwork Node SumIntSensibleGain",
     214              :                                         Constant::Units::W,
     215            6 :                                         afnNode.SumIntSensibleGain,
     216              :                                         OutputProcessor::TimeStepType::System,
     217              :                                         OutputProcessor::StoreType::Average,
     218            6 :                                         afnNode.Name);
     219           12 :                     SetupOutputVariable(state,
     220              :                                         "RoomAirflowNetwork Node SumIntLatentGain",
     221              :                                         Constant::Units::W,
     222            6 :                                         afnNode.SumIntLatentGain,
     223              :                                         OutputProcessor::TimeStepType::System,
     224              :                                         OutputProcessor::StoreType::Average,
     225            6 :                                         afnNode.Name);
     226              :                 }
     227              :             }
     228            1 :             state.dataRoomAirflowNetModel->OneTimeFlag = false;
     229              :         }
     230              : 
     231        51891 :         if (state.dataRoomAirflowNetModel->OneTimeFlagConf) { // then do one - time setup inits
     232            1 :             if (allocated(state.dataZoneEquip->ZoneEquipConfig) && allocated(state.dataZoneEquip->ZoneEquipList)) {
     233            1 :                 int MaxNodeNum = 0;
     234            1 :                 int MaxEquipNum = 0;
     235            1 :                 bool ErrorsFound = false;
     236            6 :                 for (int iZone = 1; iZone <= state.dataGlobal->NumOfZones; ++iZone) {
     237            5 :                     if (!state.dataHeatBal->Zone(iZone).IsControlled) {
     238            4 :                         continue;
     239              :                     }
     240            1 :                     MaxEquipNum = max(MaxEquipNum, state.dataZoneEquip->ZoneEquipList(iZone).NumOfEquipTypes);
     241            1 :                     MaxNodeNum = max(MaxNodeNum, state.dataZoneEquip->ZoneEquipConfig(iZone).NumInletNodes);
     242              :                 }
     243            1 :                 if (MaxNodeNum > 0) {
     244            1 :                     NodeFound.allocate(MaxNodeNum);
     245            1 :                     NodeFound = false;
     246              :                 }
     247            1 :                 if (MaxEquipNum > 0) {
     248            1 :                     EquipFound.allocate(MaxEquipNum);
     249            1 :                     SupplyFrac.allocate(MaxEquipNum);
     250            1 :                     ReturnFrac.allocate(MaxEquipNum);
     251            1 :                     EquipFound = false;
     252            1 :                     SupplyFrac = 0.0;
     253            1 :                     ReturnFrac = 0.0;
     254              :                 }
     255              : 
     256              :                 // loop over all zones with RoomAirflowNetwork model
     257            6 :                 for (int iZone = 1; iZone <= state.dataGlobal->NumOfZones; ++iZone) {
     258            5 :                     auto const &zone = state.dataHeatBal->Zone(iZone);
     259            5 :                     if (!zone.IsControlled) {
     260            4 :                         continue;
     261              :                     }
     262              : 
     263            1 :                     auto &afnZoneInfo = state.dataRoomAir->AFNZoneInfo(iZone);
     264            1 :                     if (!afnZoneInfo.IsUsed) {
     265            0 :                         continue;
     266              :                     }
     267            1 :                     afnZoneInfo.ActualZoneID = iZone;
     268            1 :                     SupplyFrac = 0.0;
     269            1 :                     ReturnFrac = 0.0;
     270            1 :                     NodeFound = false;
     271            1 :                     int numAirDistUnits = 0;
     272              : 
     273            1 :                     auto const &zoneEquipList = state.dataZoneEquip->ZoneEquipList(iZone);
     274            1 :                     auto const &zoneEquipConfig = state.dataZoneEquip->ZoneEquipConfig(iZone);
     275              : 
     276              :                     // find supply air node number
     277            7 :                     for (auto &afnNode : afnZoneInfo.Node) {
     278           12 :                         for (auto &afnHVAC : afnNode.HVAC) {
     279           12 :                             for (int I = 1; I <= zoneEquipList.NumOfEquipTypes; ++I) { // loop over all equip types
     280            6 :                                 if (zoneEquipList.EquipType(I) == DataZoneEquipment::ZoneEquipType::AirDistributionUnit) {
     281            0 :                                     if (numAirDistUnits == 0) {
     282              :                                         numAirDistUnits =
     283            0 :                                             state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "ZoneHVAC:AirDistributionUnit");
     284              :                                     }
     285            0 :                                     if (state.dataZoneAirLoopEquipmentManager->GetAirDistUnitsFlag) {
     286            0 :                                         ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(state);
     287            0 :                                         state.dataZoneAirLoopEquipmentManager->GetAirDistUnitsFlag = false;
     288              :                                     }
     289              : 
     290            0 :                                     for (int AirDistUnitNum = 1; AirDistUnitNum <= numAirDistUnits; ++AirDistUnitNum) {
     291            0 :                                         if (zoneEquipList.EquipName(I) == state.dataDefineEquipment->AirDistUnit(AirDistUnitNum).Name) {
     292            0 :                                             if (afnHVAC.Name == state.dataDefineEquipment->AirDistUnit(AirDistUnitNum).EquipName(1)) {
     293            0 :                                                 if (afnHVAC.EquipConfigIndex == 0) {
     294            0 :                                                     afnHVAC.EquipConfigIndex = I;
     295              :                                                 }
     296            0 :                                                 EquipFound(I) = true;
     297            0 :                                                 SupplyFrac(I) += afnHVAC.SupplyFraction;
     298            0 :                                                 ReturnFrac(I) += afnHVAC.ReturnFraction;
     299              :                                             }
     300              :                                         }
     301              :                                     }
     302            6 :                                 } else if (Util::SameString(zoneEquipList.EquipName(I), afnHVAC.Name)) {
     303            6 :                                     if (afnHVAC.EquipConfigIndex == 0) {
     304            6 :                                         afnHVAC.EquipConfigIndex = I;
     305              :                                     }
     306            6 :                                     EquipFound(I) = true;
     307            6 :                                     SupplyFrac(I) += afnHVAC.SupplyFraction;
     308            6 :                                     ReturnFrac(I) += afnHVAC.ReturnFraction;
     309              :                                 }
     310              :                             }
     311           18 :                             for (int iNode = 1; iNode <= state.dataLoopNodes->NumOfNodes; ++iNode) { // loop over all nodes to find supply node ID
     312           18 :                                 if (Util::SameString(state.dataLoopNodes->NodeID(iNode), afnHVAC.SupplyNodeName)) {
     313            6 :                                     afnHVAC.SupNodeNum = iNode;
     314            6 :                                     break;
     315              :                                 }
     316              :                             }
     317              :                             // Verify inlet nodes
     318            6 :                             int inletNodeIndex = 0;
     319            6 :                             for (int iNode = 1; iNode <= zoneEquipConfig.NumInletNodes;
     320              :                                  ++iNode) { // loop over all supply inlet nodes in a single zone
     321              :                                 // !Get node conditions
     322            6 :                                 if (zoneEquipConfig.InletNode(iNode) == afnHVAC.SupNodeNum) {
     323            6 :                                     NodeFound(iNode) = true;
     324            6 :                                     inletNodeIndex = iNode;
     325            6 :                                     break;
     326              :                                 }
     327              :                             }
     328              : 
     329            6 :                             if (afnHVAC.SupNodeNum > 0 && afnHVAC.ReturnNodeName.empty()) {
     330              :                                 // Find matching return node
     331            0 :                                 for (int retNode = 1; retNode <= zoneEquipConfig.NumReturnNodes; ++retNode) {
     332            0 :                                     if ((zoneEquipConfig.ReturnNodeInletNum(retNode) == inletNodeIndex) &&
     333            0 :                                         (zoneEquipConfig.ReturnNode(retNode) > 0)) {
     334            0 :                                         afnHVAC.RetNodeNum = zoneEquipConfig.ReturnNode(retNode); // Zone return node
     335            0 :                                         break;
     336              :                                     }
     337              :                                 }
     338              :                             }
     339              : 
     340            6 :                             if (afnHVAC.RetNodeNum == 0) {
     341           12 :                                 for (int iNode = 1; iNode <= state.dataLoopNodes->NumOfNodes; ++iNode) { // loop over all nodes to find return node ID
     342           12 :                                     if (Util::SameString(state.dataLoopNodes->NodeID(iNode), afnHVAC.ReturnNodeName)) {
     343            6 :                                         afnHVAC.RetNodeNum = iNode;
     344            6 :                                         break;
     345              :                                     }
     346              :                                 }
     347              :                             }
     348           12 :                             SetupOutputVariable(state,
     349              :                                                 "RoomAirflowNetwork Node HVAC Supply Fraction",
     350              :                                                 Constant::Units::None,
     351            6 :                                                 afnHVAC.SupplyFraction,
     352              :                                                 OutputProcessor::TimeStepType::System,
     353              :                                                 OutputProcessor::StoreType::Average,
     354            6 :                                                 afnHVAC.Name);
     355           12 :                             SetupOutputVariable(state,
     356              :                                                 "RoomAirflowNetwork Node HVAC Return Fraction",
     357              :                                                 Constant::Units::None,
     358            6 :                                                 afnHVAC.ReturnFraction,
     359              :                                                 OutputProcessor::TimeStepType::System,
     360              :                                                 OutputProcessor::StoreType::Average,
     361            6 :                                                 afnHVAC.Name);
     362              :                         }
     363              :                     }
     364              :                     // Count node with.TRUE.
     365            1 :                     int ISum = 0;
     366            2 :                     for (int iNode = 1; iNode <= MaxNodeNum; ++iNode) { // loop over all supply inlet nodes in a single zone
     367            1 :                         if (NodeFound(iNode)) {
     368            1 :                             ++ISum;
     369              :                         }
     370              :                     }
     371              :                     // Provide error messages with incorrect supplu node inputs
     372            1 :                     if (ISum != zoneEquipConfig.NumInletNodes) {
     373            0 :                         if (ISum > zoneEquipConfig.NumInletNodes) {
     374            0 :                             ShowSevereError(
     375              :                                 state, "GetRoomAirflowNetworkData: The number of equipment listed in RoomAirflowNetwork:Node:HVACEquipment objects");
     376            0 :                             ShowContinueError(state, format("is greater than the number of zone configuration inlet nodes in {}", zone.Name));
     377            0 :                             ShowContinueError(state, "Please check inputs of both objects.");
     378            0 :                             ErrorsFound = true;
     379              :                         } else {
     380            0 :                             ShowSevereError(
     381              :                                 state, "GetRoomAirflowNetworkData: The number of equipment listed in RoomAirflowNetwork:Node:HVACEquipment objects");
     382            0 :                             ShowContinueError(state, format("is less than the number of zone configuration inlet nodes in {}", zone.Name));
     383            0 :                             ShowContinueError(state, "Please check inputs of both objects.");
     384            0 :                             ErrorsFound = true;
     385              :                         }
     386              :                     }
     387              : 
     388              :                     // Check equipment names to ensure they are used in RoomAirflowNetwork : Node : HVACEquipment objects
     389            2 :                     for (int I = 1; I <= zoneEquipList.NumOfEquipTypes; ++I) { // loop over all equip types
     390            1 :                         if (!EquipFound(I)) {
     391            0 :                             ShowSevereError(state,
     392              :                                             "GetRoomAirflowNetworkData: The equipment listed in ZoneEquipList is not found in the lsit of "
     393              :                                             "RoomAir:Node:AirflowNetwork:HVACEquipment objects =");
     394            0 :                             ShowContinueError(state, format("{}. Please check inputs of both objects.", zoneEquipList.EquipName(I)));
     395            0 :                             ErrorsFound = true;
     396              :                         }
     397              :                     }
     398              : 
     399              :                     // Check fraction to ensure sum = 1.0 for every equipment
     400            2 :                     for (int I = 1; I <= zoneEquipList.NumOfEquipTypes; ++I) { // loop over all equip types
     401            1 :                         if (std::abs(SupplyFrac(I) - 1.0) > 0.001) {
     402            0 :                             ShowSevereError(state, "GetRoomAirflowNetworkData: Invalid, zone supply fractions do not sum to 1.0");
     403            0 :                             ShowContinueError(
     404            0 :                                 state, format("Entered in {} defined in RoomAir:Node:AirflowNetwork:HVACEquipment", zoneEquipList.EquipName(I)));
     405            0 :                             ShowContinueError(state,
     406              :                                               "The Fraction of supply fraction values across all the roomair nodes in a zone needs to sum to 1.0.");
     407            0 :                             ShowContinueError(state, format("The sum of fractions entered = {:.3R}", SupplyFrac(I)));
     408            0 :                             ErrorsFound = true;
     409              :                         }
     410            1 :                         if (std::abs(ReturnFrac(I) - 1.0) > 0.001) {
     411            0 :                             ShowSevereError(state, "GetRoomAirflowNetworkData: Invalid, zone return fractions do not sum to 1.0");
     412            0 :                             ShowContinueError(
     413            0 :                                 state, format("Entered in {} defined in RoomAir:Node:AirflowNetwork:HVACEquipment", zoneEquipList.EquipName(I)));
     414            0 :                             ShowContinueError(state,
     415              :                                               "The Fraction of return fraction values across all the roomair nodes in a zone needs to sum to 1.0.");
     416            0 :                             ShowContinueError(state, format("The sum of fractions entered = {:.3R}", ReturnFrac(I)));
     417            0 :                             ErrorsFound = true;
     418              :                         }
     419              :                     }
     420              :                 }
     421            1 :                 state.dataRoomAirflowNetModel->OneTimeFlagConf = false;
     422            1 :                 if (allocated(NodeFound)) {
     423            1 :                     NodeFound.deallocate();
     424              :                 }
     425            1 :                 if (ErrorsFound) {
     426            0 :                     ShowFatalError(state, "GetRoomAirflowNetworkData: Errors found getting air model input.  Program terminates.");
     427              :                 }
     428              :             } // if (allocated)
     429              :         } // if (OneTimeFlagConf)
     430              : 
     431        51891 :         if (state.dataGlobal->BeginEnvrnFlag && state.dataRoomAirflowNetModel->EnvrnFlag) {
     432           54 :             for (int iZone = 1; iZone <= state.dataGlobal->NumOfZones; ++iZone) {
     433           45 :                 auto &afnZoneInfo = state.dataRoomAir->AFNZoneInfo(iZone);
     434           45 :                 if (!afnZoneInfo.IsUsed) {
     435           36 :                     continue;
     436              :                 }
     437           63 :                 for (auto &afnNode : afnZoneInfo.Node) {
     438           54 :                     afnNode.AirTemp = 23.0;
     439           54 :                     afnNode.AirTempX = {23.0, 23.0, 23.0, 23.0};
     440           54 :                     afnNode.AirTempDSX = {23.0, 23.0, 23.0, 23.0};
     441           54 :                     afnNode.AirTempT1 = 23.0;
     442           54 :                     afnNode.AirTempTX = 23.0;
     443           54 :                     afnNode.AirTempT2 = 23.0;
     444              : 
     445           54 :                     afnNode.HumRat = 0.0;
     446           54 :                     afnNode.HumRatX = {0.0, 0.0, 0.0, 0.0};
     447           54 :                     afnNode.HumRatDSX = {0.0, 0.0, 0.0, 0.0};
     448           54 :                     afnNode.HumRatT1 = 0.0;
     449           54 :                     afnNode.HumRatTX = 0.0;
     450           54 :                     afnNode.HumRatT2 = 0.0;
     451              : 
     452           54 :                     afnNode.SysDepZoneLoadsLagged = 0.0;
     453           54 :                     afnNode.SysDepZoneLoadsLaggedOld = 0.0;
     454              :                 }
     455              :             }
     456            9 :             state.dataRoomAirflowNetModel->EnvrnFlag = false;
     457              :         }
     458        51891 :         if (!state.dataGlobal->BeginEnvrnFlag) {
     459        51625 :             state.dataRoomAirflowNetModel->EnvrnFlag = true;
     460              :         }
     461              : 
     462              :         // reuse code in ZoneTempPredictorCorrector for sensible components.
     463        51891 :         CalcNodeSums(state, zoneNum, roomAirNodeNum);
     464              : 
     465        51891 :         SumNonAirSystemResponseForNode(state, zoneNum, roomAirNodeNum);
     466              : 
     467              :         // latent gains.
     468        51891 :         auto &afnZoneInfo = state.dataRoomAir->AFNZoneInfo(zoneNum);
     469        51891 :         auto &afnNode = afnZoneInfo.Node(roomAirNodeNum);
     470              : 
     471        51891 :         if (allocated(afnNode.SurfMask)) {
     472        51891 :             CalcSurfaceMoistureSums(state, zoneNum, roomAirNodeNum, afnNode.SumHmAW, afnNode.SumHmARa, afnNode.SumHmARaW, afnNode.SurfMask);
     473              :         }
     474              : 
     475              :         // prepare AirflowNetwor flow rates and temperatures
     476        51891 :         Real64 SumLinkMCp = 0.0;
     477        51891 :         Real64 SumLinkMCpT = 0.0;
     478        51891 :         Real64 SumLinkM = 0.0;
     479        51891 :         Real64 SumLinkMW = 0.0;
     480              : 
     481        51891 :         if (afnNode.AFNNodeID > 0) {
     482       370650 :             for (int iLink = 1; iLink <= afnNode.NumOfAirflowLinks; ++iLink) {
     483       318759 :                 auto &afnLink = afnNode.Link(iLink);
     484       318759 :                 int linkNum = afnLink.AFNSimuID;
     485       318759 :                 if (state.afn->AirflowNetworkLinkageData(linkNum).NodeNums[0] == afnNode.AFNNodeID) { // incoming flow
     486       170499 :                     int nodeInNum = state.afn->AirflowNetworkLinkageData(linkNum).NodeNums[1];
     487       170499 :                     afnLink.TempIn = state.afn->AirflowNetworkNodeSimu(nodeInNum).TZ;
     488       170499 :                     afnLink.HumRatIn = state.afn->AirflowNetworkNodeSimu(nodeInNum).WZ;
     489       170499 :                     afnLink.MdotIn = state.afn->AirflowNetworkLinkSimu(linkNum).FLOW2;
     490              :                 }
     491       318759 :                 if (state.afn->AirflowNetworkLinkageData(linkNum).NodeNums[1] == afnNode.AFNNodeID) { // outgoing flow
     492       148260 :                     int nodeInNum = state.afn->AirflowNetworkLinkageData(linkNum).NodeNums[0];
     493       148260 :                     afnLink.TempIn = state.afn->AirflowNetworkNodeSimu(nodeInNum).TZ;
     494       148260 :                     afnLink.HumRatIn = state.afn->AirflowNetworkNodeSimu(nodeInNum).WZ;
     495       148260 :                     afnLink.MdotIn = state.afn->AirflowNetworkLinkSimu(linkNum).FLOW;
     496              :                 }
     497              :             }
     498              : 
     499       370650 :             for (int iLink = 1; iLink <= afnNode.NumOfAirflowLinks; ++iLink) {
     500       318759 :                 auto &afnLink = afnNode.Link(iLink);
     501       318759 :                 Real64 CpAir = PsyCpAirFnW(afnLink.HumRatIn);
     502       318759 :                 SumLinkMCp += CpAir * afnLink.MdotIn;
     503       318759 :                 SumLinkMCpT += CpAir * afnLink.MdotIn * afnLink.TempIn;
     504       318759 :                 SumLinkM += afnLink.MdotIn;
     505       318759 :                 SumLinkMW += afnLink.MdotIn * afnLink.HumRatIn;
     506              :             }
     507              :         }
     508              : 
     509        51891 :         afnNode.SumLinkMCp = SumLinkMCp;
     510        51891 :         afnNode.SumLinkMCpT = SumLinkMCpT;
     511        51891 :         afnNode.SumLinkM = SumLinkM;
     512        51891 :         afnNode.SumLinkMW = SumLinkMW;
     513        51891 :         afnNode.SysDepZoneLoadsLagged = afnNode.SysDepZoneLoadsLaggedOld;
     514              : 
     515        51891 :         afnNode.RhoAir = PsyRhoAirFnPbTdbW(state, state.dataEnvrn->OutBaroPress, afnNode.AirTemp, afnNode.HumRat, "InitRoomAirModelAirflowNetwork");
     516              : 
     517        51891 :         afnNode.CpAir = PsyCpAirFnW(afnNode.HumRat);
     518              : 
     519        51891 :     } // InitRoomAirModelAirflowNetwork
     520              : 
     521              :     //*****************************************************************************************
     522              : 
     523        44478 :     void CalcRoomAirModelAFN(EnergyPlusData &state, int const zoneNum,
     524              :                              int const roomAirNodeNum) // index number for the specified zone and node
     525              :     {
     526              : 
     527              :         // SUBROUTINE INFORMATION:
     528              :         //       AUTHOR         Brent Griffith
     529              :         //       DATE WRITTEN   November 2009
     530              :         //       MODIFIED       Lixing Gu, Aug. 2015 for v8.4 replease
     531              : 
     532              :         // PURPOSE OF THIS SUBROUTINE:
     533              :         // calculate new values for temperature and humidity ratio for room air node
     534              : 
     535              :         // METHODOLOGY EMPLOYED:
     536              :         // take terms(updated in init routine) and use classic air balance equations
     537              :         // solved for state variables. Store results in structure.
     538              : 
     539              :         // Using/Aliasing
     540        44478 :         Real64 TimeStepSysSec = state.dataHVACGlobal->TimeStepSysSec;
     541              :         using Psychrometrics::PsyHgAirFnWTdb;
     542              :         using Psychrometrics::PsyRhFnTdbWPb;
     543              : 
     544              :         // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
     545              :         std::array<Real64, 3> NodeTempX;
     546              :         std::array<Real64, 3> NodeHumRatX;
     547              :         Real64 AirTempT1;
     548              :         Real64 HumRatT1;
     549              : 
     550        44478 :         auto &afnZoneInfo = state.dataRoomAir->AFNZoneInfo(zoneNum);
     551        44478 :         auto &afnNode = afnZoneInfo.Node(roomAirNodeNum);
     552              : 
     553        44478 :         if (state.dataHVACGlobal->UseZoneTimeStepHistory) {
     554        34650 :             NodeTempX[0] = afnNode.AirTempX[0];
     555        34650 :             NodeTempX[1] = afnNode.AirTempX[1];
     556        34650 :             NodeTempX[2] = afnNode.AirTempX[2];
     557              : 
     558        34650 :             NodeHumRatX[0] = afnNode.HumRatX[0];
     559        34650 :             NodeHumRatX[1] = afnNode.HumRatX[1];
     560        34650 :             NodeHumRatX[2] = afnNode.HumRatX[2];
     561              :         } else { // use down - stepped history
     562         9828 :             NodeTempX[0] = afnNode.AirTempDSX[0];
     563         9828 :             NodeTempX[1] = afnNode.AirTempDSX[1];
     564         9828 :             NodeTempX[2] = afnNode.AirTempDSX[2];
     565              : 
     566         9828 :             NodeHumRatX[0] = afnNode.HumRatDSX[0];
     567         9828 :             NodeHumRatX[1] = afnNode.HumRatDSX[1];
     568         9828 :             NodeHumRatX[2] = afnNode.HumRatDSX[2];
     569              :         }
     570              : 
     571        44478 :         if (state.dataHeatBal->ZoneAirSolutionAlgo != DataHeatBalance::SolutionAlgo::ThirdOrder) {
     572            0 :             AirTempT1 = afnNode.AirTempT1;
     573            0 :             HumRatT1 = afnNode.HumRatT1;
     574              :         }
     575              :         // solve for node drybulb temperature
     576        44478 :         Real64 TempDepCoef = afnNode.SumHA + afnNode.SumLinkMCp + afnNode.SumSysMCp;
     577        44478 :         Real64 TempIndCoef = afnNode.SumIntSensibleGain + afnNode.SumHATsurf - afnNode.SumHATref + afnNode.SumLinkMCpT + afnNode.SumSysMCpT +
     578        44478 :                              afnNode.NonAirSystemResponse + afnNode.SysDepZoneLoadsLagged;
     579        44478 :         Real64 AirCap = afnNode.AirVolume * state.dataHeatBal->Zone(zoneNum).ZoneVolCapMultpSens * afnNode.RhoAir * afnNode.CpAir / TimeStepSysSec;
     580              : 
     581        44478 :         if (state.dataHeatBal->ZoneAirSolutionAlgo == DataHeatBalance::SolutionAlgo::AnalyticalSolution) {
     582            0 :             if (TempDepCoef == 0.0) { // B=0
     583            0 :                 afnNode.AirTemp = AirTempT1 + TempIndCoef / AirCap;
     584              :             } else {
     585            0 :                 afnNode.AirTemp = (AirTempT1 - TempIndCoef / TempDepCoef) * std::exp(min(700.0, -TempDepCoef / AirCap)) + TempIndCoef / TempDepCoef;
     586              :             }
     587        44478 :         } else if (state.dataHeatBal->ZoneAirSolutionAlgo == DataHeatBalance::SolutionAlgo::EulerMethod) {
     588            0 :             afnNode.AirTemp = (AirCap * AirTempT1 + TempIndCoef) / (AirCap + TempDepCoef);
     589              :         } else {
     590        44478 :             afnNode.AirTemp = (TempIndCoef + AirCap * (3.0 * NodeTempX[0] - (3.0 / 2.0) * NodeTempX[1] + (1.0 / 3.0) * NodeTempX[2])) /
     591        44478 :                               ((11.0 / 6.0) * AirCap + TempDepCoef);
     592              :         }
     593              : 
     594              :         // solve for node humidity ratio using 3 algorithms
     595        44478 :         Real64 H2OHtOfVap = PsyHgAirFnWTdb(afnNode.HumRat, afnNode.AirTemp);
     596        44478 :         Real64 A = afnNode.SumLinkM + afnNode.SumHmARa + afnNode.SumSysM;
     597        44478 :         Real64 B = (afnNode.SumIntLatentGain / H2OHtOfVap) + afnNode.SumSysMW + afnNode.SumLinkMW + afnNode.SumHmARaW;
     598        44478 :         Real64 C = afnNode.RhoAir * afnNode.AirVolume * state.dataHeatBal->Zone(zoneNum).ZoneVolCapMultpMoist / TimeStepSysSec;
     599              : 
     600              :         // Exact solution
     601        44478 :         if (state.dataHeatBal->ZoneAirSolutionAlgo == DataHeatBalance::SolutionAlgo::AnalyticalSolution) {
     602            0 :             if (A == 0.0) { // B=0
     603            0 :                 afnNode.HumRat = HumRatT1 + B / C;
     604              :             } else {
     605            0 :                 afnNode.HumRat = (HumRatT1 - B / A) * std::exp(min(700., -A / C)) + B / A;
     606              :             }
     607        44478 :         } else if (state.dataHeatBal->ZoneAirSolutionAlgo == DataHeatBalance::SolutionAlgo::EulerMethod) {
     608            0 :             afnNode.HumRat = (C * HumRatT1 + B) / (C + A);
     609              :         } else {
     610        44478 :             afnNode.HumRat = (B + C * (3.0 * NodeHumRatX[0] - (3.0 / 2.0) * NodeHumRatX[1] + (1.0 / 3.0) * NodeHumRatX[2])) / ((11.0 / 6.0) * C + A);
     611              :         }
     612              : 
     613        44478 :         afnNode.AirCap = AirCap;
     614        44478 :         afnNode.AirHumRat = C;
     615              : 
     616        44478 :         afnNode.RelHumidity =
     617        44478 :             PsyRhFnTdbWPb(state, afnNode.AirTemp, afnNode.HumRat, state.dataEnvrn->OutBaroPress, "CalcRoomAirModelAirflowNetwork") * 100.0;
     618              : 
     619        44478 :     } // CalcRoomAirModelAirflowNetwork
     620              : 
     621         7413 :     void UpdateRoomAirModelAFN(EnergyPlusData &state, int const zoneNum)
     622              :     {
     623              : 
     624              :         // SUBROUTINE INFORMATION:
     625              :         //       AUTHOR         B Griffith
     626              :         //       DATE WRITTEN   November 2009
     627              :         //       MODIFIED       Lixing Gu, Aug. 2015 for v8.4 replease
     628              : 
     629              :         // PURPOSE OF THIS SUBROUTINE:
     630              :         // update variables
     631         7413 :         auto const &afnZoneInfo = state.dataRoomAir->AFNZoneInfo(zoneNum);
     632              : 
     633         7413 :         if (!afnZoneInfo.IsUsed) {
     634            0 :             return;
     635              :         }
     636              : 
     637         7413 :         if (!state.dataGlobal->ZoneSizingCalc) {
     638         3689 :             SumSystemDepResponseForNode(state, zoneNum);
     639              :         }
     640              : 
     641              :         // Update return node conditions
     642        14826 :         for (int I = 1; I <= state.dataZoneEquip->ZoneEquipList(zoneNum).NumOfEquipTypes; ++I) { // loop over all equip types
     643         7413 :             Real64 SumMass = 0.0;
     644         7413 :             Real64 SumMassT = 0.0;
     645         7413 :             Real64 SumMassW = 0.0;
     646         7413 :             int RetNodeNum = 0;
     647        51891 :             for (auto const &afnNode : afnZoneInfo.Node) {
     648        88956 :                 for (auto const &afnHVAC : afnNode.HVAC) {
     649        44478 :                     if (afnHVAC.EquipConfigIndex == I && afnHVAC.SupNodeNum > 0 && afnHVAC.RetNodeNum > 0) {
     650        44478 :                         Real64 NodeMass = state.dataLoopNodes->Node(afnHVAC.SupNodeNum).MassFlowRate * afnHVAC.ReturnFraction;
     651        44478 :                         SumMass += NodeMass;
     652        44478 :                         SumMassT += NodeMass * afnNode.AirTemp;
     653        44478 :                         SumMassW += NodeMass * afnNode.HumRat;
     654        44478 :                         RetNodeNum = afnHVAC.RetNodeNum;
     655              :                     }
     656              :                 }
     657              :             }
     658         7413 :             if (SumMass > 0.0) {
     659         7296 :                 state.dataLoopNodes->Node(RetNodeNum).Temp = SumMassT / SumMass;
     660         7296 :                 state.dataLoopNodes->Node(RetNodeNum).HumRat = SumMassW / SumMass;
     661              :             }
     662              :         }
     663              :     } // UpdateRoomAirModelAirflowNetwork
     664              : 
     665        51891 :     void CalcNodeSums(EnergyPlusData &state, int const zoneNum, int const roomAirNodeNum)
     666              :     {
     667              : 
     668              :         // SUBROUTINE INFORMATION:
     669              :         //       AUTHOR         B Griffith
     670              :         //       DATE WRITTEN   August 2009
     671              :         //       MODIFIED       Lixing Gu, Aug. 2015 for v8.4 replease
     672              :         //       RE - ENGINEERED  na
     673              : 
     674              :         // PURPOSE OF THIS SUBROUTINE :
     675              :         // This subroutine calculates the various sums that go into the zone heat balance
     676              :         // equation.This replaces the SUMC, SUMHA, and SUMHAT calculations that were
     677              :         // previously done in various places throughout the program.
     678              :         // The SumHAT portion of the code is reproduced in RadiantSystemHighTemp and
     679              :         // RadiantSystemLowTemp and should be updated accordingly.
     680              :         //
     681              :         // A reference temperature(Tref) is specified for use with the ceiling diffuser
     682              :         // convection correlation.A bogus value of Tref = -999.9 defaults to using
     683              :         // the zone air(i.e.outlet) temperature for the reference temperature.
     684              :         // If Tref is applied to all surfaces, SumHA = 0, and SumHATref /= 0.
     685              :         // If Tref is not used at all, SumHATref = 0, and SumHA /= 0.
     686              :         //
     687              : 
     688              :         // USE STATEMENTS:
     689              :         using InternalHeatGains::SumInternalConvectionGainsByIndices;
     690              :         using InternalHeatGains::SumInternalLatentGainsByIndices;
     691              :         using InternalHeatGains::SumReturnAirConvectionGainsByIndices;
     692              :         using InternalHeatGains::SumReturnAirConvectionGainsByTypes;
     693              :         using Psychrometrics::PsyCpAirFnW;
     694              :         using Psychrometrics::PsyRhoAirFnPbTdbW;
     695              : 
     696              :         // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
     697              :         Real64 HA;         //                     !Hc*Area
     698              :         Real64 Area;       //                   !Effective surface area
     699              :         Real64 RefAirTemp; //             !Reference air temperature for surface convection calculations
     700              :         bool Found;        //
     701              : 
     702        51891 :         Real64 SumIntGain = 0.0; // node sum of convective internal gains
     703        51891 :         Real64 SumHA = 0.0;      // Zone sum of Hc*Area
     704        51891 :         Real64 SumHATsurf = 0.0; // Zone sum of Hc*Area*Tsurf
     705        51891 :         Real64 SumHATref = 0.0;  // Zone sum of Hc*Area*Tref, for ceiling diffuser convection correlation
     706        51891 :         Real64 SumSysMCp = 0.0;  // Zone sum of air system MassFlowRate*Cp
     707        51891 :         Real64 SumSysMCpT = 0.0; // Zone sum of air system MassFlowRate*Cp*T
     708        51891 :         Real64 SumSysM = 0.0;    // Zone sum of air system MassFlowRate
     709        51891 :         Real64 SumSysMW = 0.0;   // Zone sum of air system MassFlowRate*W
     710              : 
     711        51891 :         auto const &zone = state.dataHeatBal->Zone(zoneNum);
     712        51891 :         auto &afnZoneInfo = state.dataRoomAir->AFNZoneInfo(zoneNum);
     713        51891 :         auto &afnNode = afnZoneInfo.Node(roomAirNodeNum);
     714              :         // Sum all convective internal gains: SumIntGain
     715       103782 :         afnNode.SumIntSensibleGain = SumInternalConvectionGainsByIndices(
     716        51891 :             state, afnNode.NumIntGains, afnNode.intGainsDeviceSpaces, afnNode.IntGainsDeviceIndices, afnNode.IntGainsFractions);
     717              : 
     718       103782 :         afnNode.SumIntLatentGain = SumInternalLatentGainsByIndices(
     719        51891 :             state, afnNode.NumIntGains, afnNode.intGainsDeviceSpaces, afnNode.IntGainsDeviceIndices, afnNode.IntGainsFractions);
     720              :         // Add heat to return air if zonal system(no return air) or cycling system(return air frequently very low or zero)
     721        51891 :         if (state.dataHeatBal->Zone(zoneNum).NoHeatToReturnAir) {
     722              :             // *******************************************
     723        51436 :             SumIntGain = SumReturnAirConvectionGainsByIndices(
     724        25718 :                 state, afnNode.NumIntGains, afnNode.intGainsDeviceSpaces, afnNode.IntGainsDeviceIndices, afnNode.IntGainsFractions);
     725        25718 :             afnNode.SumIntSensibleGain += SumIntGain;
     726              :         }
     727              : 
     728              :         // Check to see if this is a controlled zone
     729              :         // Check to see if this is a plenum zone
     730        51891 :         int zoneRetPlenumNum = 0;
     731        51891 :         for (int iPlenum = 1; iPlenum <= state.dataZonePlenum->NumZoneReturnPlenums; ++iPlenum) {
     732            0 :             if (state.dataZonePlenum->ZoneRetPlenCond(iPlenum).ActualZoneNum != zoneNum) {
     733            0 :                 continue;
     734              :             }
     735            0 :             zoneRetPlenumNum = iPlenum;
     736            0 :             break;
     737              :         }
     738        51891 :         bool zoneSupPlenumNum = false;
     739        51891 :         for (int iPlenum = 1; iPlenum <= state.dataZonePlenum->NumZoneSupplyPlenums; ++iPlenum) {
     740            0 :             if (state.dataZonePlenum->ZoneSupPlenCond(iPlenum).ActualZoneNum != zoneNum) {
     741            0 :                 continue;
     742              :             }
     743            0 :             zoneSupPlenumNum = iPlenum;
     744            0 :             break;
     745              :         }
     746              : 
     747              :         // Plenum and controlled zones have a different set of inlet nodes which must be calculated.
     748        51891 :         auto &zoneHB = state.dataZoneTempPredictorCorrector->zoneHeatBalance(zoneNum);
     749        51891 :         if (zone.IsControlled) {
     750        51891 :             auto &zoneEquipConfig = state.dataZoneEquip->ZoneEquipConfig(zoneNum);
     751       103782 :             for (int iNode = 1; iNode <= zoneEquipConfig.NumInletNodes; ++iNode) {
     752              :                 // Get node conditions
     753              :                 // this next block is of interest to irratic system loads... maybe nodes are not accurate at time of call ?
     754              :                 // how can we tell ? predict step must be lagged ? correct step, systems have run.
     755        51891 :                 auto const &inletNode = state.dataLoopNodes->Node(zoneEquipConfig.InletNode(iNode));
     756       103782 :                 for (auto const &afnHVAC : afnNode.HVAC) {
     757        51891 :                     if (afnHVAC.SupNodeNum == zoneEquipConfig.InletNode(iNode)) {
     758        51891 :                         Real64 MassFlowRate = inletNode.MassFlowRate * afnHVAC.SupplyFraction;
     759        51891 :                         Real64 CpAir = PsyCpAirFnW(zoneHB.airHumRat);
     760        51891 :                         SumSysMCp += MassFlowRate * CpAir;
     761        51891 :                         SumSysMCpT += MassFlowRate * CpAir * inletNode.Temp;
     762        51891 :                         SumSysM += MassFlowRate;
     763        51891 :                         SumSysMW += MassFlowRate * inletNode.HumRat;
     764              :                     }
     765              :                 } // EquipLoop
     766              :             } // NodeNum
     767            0 :         } else if (zoneRetPlenumNum != 0) {
     768            0 :             auto const &zoneRetPlenum = state.dataZonePlenum->ZoneRetPlenCond(zoneRetPlenumNum);
     769            0 :             for (int iNode = 1; iNode <= zoneRetPlenum.NumInletNodes; ++iNode) {
     770              :                 // Get node conditions
     771            0 :                 auto const &zoneRetPlenumNode = state.dataLoopNodes->Node(zoneRetPlenum.InletNode(iNode));
     772            0 :                 Real64 CpAir = PsyCpAirFnW(zoneHB.airHumRat);
     773            0 :                 SumSysMCp += zoneRetPlenumNode.MassFlowRate * CpAir;
     774            0 :                 SumSysMCpT += zoneRetPlenumNode.MassFlowRate * CpAir * zoneRetPlenumNode.Temp;
     775              :             } // NodeNum
     776              :             // add in the leaks
     777            0 :             for (int iADU = 1; iADU <= zoneRetPlenum.NumADUs; ++iADU) {
     778            0 :                 int ADUNum = zoneRetPlenum.ADUIndex(iADU);
     779            0 :                 auto const &adu = state.dataDefineEquipment->AirDistUnit(ADUNum);
     780            0 :                 if (adu.UpStreamLeak) {
     781            0 :                     Real64 CpAir = PsyCpAirFnW(zoneHB.airHumRat);
     782            0 :                     SumSysMCp += adu.MassFlowRateUpStrLk * CpAir;
     783            0 :                     SumSysMCpT += adu.MassFlowRateUpStrLk * CpAir * state.dataLoopNodes->Node(adu.InletNodeNum).Temp;
     784              :                 }
     785            0 :                 if (adu.DownStreamLeak) {
     786            0 :                     Real64 CpAir = PsyCpAirFnW(zoneHB.airHumRat);
     787            0 :                     SumSysMCp += adu.MassFlowRateDnStrLk * CpAir;
     788            0 :                     SumSysMCpT += adu.MassFlowRateDnStrLk * CpAir * state.dataLoopNodes->Node(adu.OutletNodeNum).Temp;
     789              :                 }
     790              :             } // ADUListIndex
     791            0 :         } else if (zoneSupPlenumNum != 0) {
     792              :             // Get node conditions
     793            0 :             auto const &zoneSupPlenum = state.dataZonePlenum->ZoneSupPlenCond(zoneSupPlenumNum);
     794            0 :             auto const &inletNode = state.dataLoopNodes->Node(zoneSupPlenum.InletNode);
     795            0 :             Real64 CpAir = PsyCpAirFnW(zoneHB.airHumRat);
     796            0 :             SumSysMCp += inletNode.MassFlowRate * CpAir;
     797            0 :             SumSysMCpT += inletNode.MassFlowRate * CpAir * inletNode.Temp;
     798              :         }
     799              : 
     800        51891 :         int ZoneMult = zone.Multiplier * zone.ListMultiplier;
     801              : 
     802        51891 :         SumSysMCp /= ZoneMult;
     803        51891 :         SumSysMCpT /= ZoneMult;
     804        51891 :         SumSysM /= ZoneMult;
     805        51891 :         SumSysMW /= ZoneMult;
     806              : 
     807              :         // Sum all surface convection : SumHA, SumHATsurf, SumHATref(and additional contributions to SumIntGain)
     808              :         // Modified by Gu to include assigned surfaces only shown in the surface lsit
     809        51891 :         if (!afnNode.HasSurfacesAssigned) {
     810            0 :             return;
     811              :         }
     812              : 
     813        51891 :         int surfCount = 0;
     814       103782 :         for (int spaceNum : state.dataHeatBal->Zone(zoneNum).spaceIndexes) {
     815        51891 :             auto const &thisSpace = state.dataHeatBal->space(spaceNum);
     816       882147 :             for (int SurfNum = thisSpace.HTSurfaceFirst; SurfNum <= thisSpace.HTSurfaceLast; ++SurfNum) {
     817       830256 :                 ++surfCount;
     818       830256 :                 if (afnZoneInfo.ControlAirNodeID == roomAirNodeNum) {
     819       237216 :                     Found = false;
     820      1408470 :                     for (int Loop = 1; Loop <= afnZoneInfo.NumOfAirNodes; ++Loop) {
     821      1245384 :                         if (Loop != roomAirNodeNum) {
     822      1037820 :                             if (afnZoneInfo.Node(Loop).SurfMask(surfCount)) {
     823        74130 :                                 Found = true;
     824        74130 :                                 break;
     825              :                             }
     826              :                         }
     827              :                     }
     828       237216 :                     if (Found) {
     829        74130 :                         continue;
     830              :                     }
     831              :                 } else {
     832       593040 :                     if (!afnNode.SurfMask(surfCount)) {
     833       555975 :                         continue;
     834              :                     }
     835              :                 }
     836              : 
     837       200151 :                 HA = 0.0;
     838       200151 :                 Area = state.dataSurface->Surface(SurfNum).Area; // For windows, this is the glazing area
     839              : 
     840       200151 :                 if (state.dataSurface->Surface(SurfNum).Class == DataSurfaces::SurfaceClass::Window) {
     841              : 
     842              :                     // Add to the convective internal gains
     843        29652 :                     if (ANY_INTERIOR_SHADE_BLIND(state.dataSurface->SurfWinShadingFlag(SurfNum))) {
     844              :                         // The shade area covers the area of the glazing plus the area of the dividers.
     845            0 :                         Area += state.dataSurface->SurfWinDividerArea(SurfNum);
     846            0 :                         SumIntGain += state.dataSurface->SurfWinDividerHeatGain(SurfNum);
     847              :                     }
     848              : 
     849              :                     // Convective heat gain from natural convection in gap between glass and interior shade or blind
     850        29652 :                     if (ANY_INTERIOR_SHADE_BLIND(state.dataSurface->SurfWinShadingFlag(SurfNum))) {
     851            0 :                         SumIntGain += state.dataSurface->SurfWinConvHeatFlowNatural(SurfNum);
     852              :                     }
     853              : 
     854              :                     // Convective heat gain from airflow window
     855        29652 :                     if (state.dataSurface->SurfWinAirflowThisTS(SurfNum) > 0.0) {
     856            0 :                         SumIntGain += state.dataSurface->SurfWinConvHeatGainToZoneAir(SurfNum);
     857            0 :                         if (zone.NoHeatToReturnAir) {
     858            0 :                             SumIntGain += state.dataSurface->SurfWinRetHeatGainToZoneAir(SurfNum);
     859            0 :                             state.dataSurface->SurfWinHeatGain(SurfNum) += state.dataSurface->SurfWinRetHeatGainToZoneAir(SurfNum);
     860            0 :                             if (state.dataSurface->SurfWinHeatGain(SurfNum) >= 0.0) {
     861            0 :                                 state.dataSurface->SurfWinHeatGainRep(SurfNum) = state.dataSurface->SurfWinHeatGain(SurfNum);
     862            0 :                                 state.dataSurface->SurfWinHeatGainRepEnergy(SurfNum) =
     863            0 :                                     state.dataSurface->SurfWinHeatGainRep(SurfNum) * state.dataGlobal->TimeStepZone * Constant::rSecsInHour;
     864              :                             } else {
     865            0 :                                 state.dataSurface->SurfWinHeatLossRep(SurfNum) = -state.dataSurface->SurfWinHeatGain(SurfNum);
     866            0 :                                 state.dataSurface->SurfWinHeatLossRepEnergy(SurfNum) =
     867            0 :                                     state.dataSurface->SurfWinHeatLossRep(SurfNum) * state.dataGlobal->TimeStepZone * Constant::rSecsInHour;
     868              :                             }
     869            0 :                             state.dataSurface->SurfWinHeatTransferRepEnergy(SurfNum) =
     870            0 :                                 state.dataSurface->SurfWinHeatGain(SurfNum) * state.dataGlobal->TimeStepZone * Constant::rSecsInHour;
     871              :                         }
     872              :                     }
     873              : 
     874              :                     // Add to the surface convection sums
     875        29652 :                     if (state.dataSurface->SurfWinFrameArea(SurfNum) > 0.0) {
     876              :                         // Window frame contribution
     877            0 :                         SumHATsurf += state.dataHeatBalSurf->SurfHConvInt(SurfNum) * state.dataSurface->SurfWinFrameArea(SurfNum) *
     878            0 :                                       (1.0 + state.dataSurface->SurfWinProjCorrFrIn(SurfNum)) * state.dataSurface->SurfWinFrameTempIn(SurfNum);
     879            0 :                         HA += state.dataHeatBalSurf->SurfHConvInt(SurfNum) * state.dataSurface->SurfWinFrameArea(SurfNum) *
     880            0 :                               (1.0 + state.dataSurface->SurfWinProjCorrFrIn(SurfNum));
     881              :                     }
     882              : 
     883        29652 :                     if (state.dataSurface->SurfWinDividerArea(SurfNum) > 0.0 &&
     884            0 :                         !ANY_INTERIOR_SHADE_BLIND(state.dataSurface->SurfWinShadingFlag(SurfNum))) {
     885              :                         // Window divider contribution(only from shade or blind for window with divider and interior shade or blind)
     886            0 :                         SumHATsurf += state.dataHeatBalSurf->SurfHConvInt(SurfNum) * state.dataSurface->SurfWinDividerArea(SurfNum) *
     887            0 :                                       (1.0 + 2.0 * state.dataSurface->SurfWinProjCorrDivIn(SurfNum)) *
     888            0 :                                       state.dataSurface->SurfWinDividerTempIn(SurfNum);
     889            0 :                         HA += state.dataHeatBalSurf->SurfHConvInt(SurfNum) * state.dataSurface->SurfWinDividerArea(SurfNum) *
     890            0 :                               (1.0 + 2.0 * state.dataSurface->SurfWinProjCorrDivIn(SurfNum));
     891              :                     }
     892              : 
     893              :                 } // End of check if window
     894              : 
     895       200151 :                 HA += state.dataHeatBalSurf->SurfHConvInt(SurfNum) * Area;
     896       200151 :                 SumHATsurf += state.dataHeatBalSurf->SurfHConvInt(SurfNum) * Area * state.dataHeatBalSurf->SurfTempInTmp(SurfNum);
     897              : 
     898       200151 :                 if (state.dataSurface->SurfTAirRef(SurfNum) == DataSurfaces::RefAirTemp::ZoneMeanAirTemp) {
     899              :                     // The zone air is the reference temperature(which is to be solved for in CorrectZoneAirTemp).
     900            0 :                     RefAirTemp = zoneHB.MAT;
     901            0 :                     SumHA += HA;
     902       200151 :                 } else if (state.dataSurface->SurfTAirRef(SurfNum) == DataSurfaces::RefAirTemp::AdjacentAirTemp) {
     903            0 :                     RefAirTemp = state.dataHeatBal->SurfTempEffBulkAir(SurfNum);
     904            0 :                     SumHATref += HA * RefAirTemp;
     905       200151 :                 } else if (state.dataSurface->SurfTAirRef(SurfNum) == DataSurfaces::RefAirTemp::ZoneSupplyAirTemp) {
     906              :                     // check whether this zone is a controlled zone or not
     907            0 :                     if (!zone.IsControlled) {
     908            0 :                         ShowFatalError(state,
     909            0 :                                        format("Zones must be controlled for Ceiling-Diffuser Convection model. No system serves zone {}", zone.Name));
     910            0 :                         return;
     911              :                     }
     912              :                     // determine supply air temperature as a weighted average of the inlet temperatures.
     913            0 :                     RefAirTemp = SumSysMCpT / SumSysMCp;
     914            0 :                     SumHATref += HA * RefAirTemp;
     915              :                 } else {
     916       200151 :                     RefAirTemp = zoneHB.MAT;
     917       200151 :                     SumHA += HA;
     918              :                 }
     919              : 
     920              :             } // SurfNum
     921        51891 :         }
     922              :         // Assemble values
     923        51891 :         afnNode.SumHA = SumHA;
     924        51891 :         afnNode.SumHATsurf = SumHATsurf;
     925        51891 :         afnNode.SumHATref = SumHATref;
     926        51891 :         afnNode.SumSysMCp = SumSysMCp;
     927        51891 :         afnNode.SumSysMCpT = SumSysMCpT;
     928        51891 :         afnNode.SumSysM = SumSysM;
     929        51891 :         afnNode.SumSysMW = SumSysMW;
     930              : 
     931              :     } // CalcNodeSums
     932              : 
     933        51891 :     void CalcSurfaceMoistureSums(EnergyPlusData &state,
     934              :                                  int const zoneNum,
     935              :                                  int const roomAirNodeNum,
     936              :                                  Real64 &SumHmAW,
     937              :                                  Real64 &SumHmARa,
     938              :                                  Real64 &SumHmARaW,
     939              :                                  [[maybe_unused]] Array1D<bool> const &SurfMask)
     940              :     {
     941              : 
     942              :         // SUBROUTINE INFORMATION:
     943              :         //       AUTHOR         B Griffith
     944              :         //                      derived from P. Biddulph-- HAMT, L. Gu -- EPMD,
     945              :         //       DATE WRITTEN   November 2009
     946              :         //       MODIFIED       Lixing Gu, Aug. 2015 for v8.4 replease
     947              : 
     948              :         // PURPOSE OF THIS SUBROUTINE:
     949              :         // Breakout summation of surface moisture interaction terms
     950              : 
     951              :         // Using/Aliasing
     952              : 
     953              :         using HeatBalanceHAMTManager::UpdateHeatBalHAMT;
     954              :         using MoistureBalanceEMPDManager::UpdateMoistureBalanceEMPD;
     955              :         using Psychrometrics::PsyRhFnTdbRhov;
     956              :         using Psychrometrics::PsyRhFnTdbRhovLBnd0C;
     957              :         using Psychrometrics::PsyRhoAirFnPbTdbW;
     958              :         using Psychrometrics::PsyWFnTdbRhPb;
     959              : 
     960        51891 :         SumHmAW = 0.0;
     961        51891 :         SumHmARa = 0.0;
     962        51891 :         SumHmARaW = 0.0;
     963              : 
     964        51891 :         auto &afnZoneInfo = state.dataRoomAir->AFNZoneInfo(zoneNum);
     965              : 
     966        51891 :         int surfCount = 1;
     967       103782 :         for (int spaceNum : state.dataHeatBal->Zone(zoneNum).spaceIndexes) {
     968        51891 :             auto const &thisSpace = state.dataHeatBal->space(spaceNum);
     969       882147 :             for (int SurfNum = thisSpace.HTSurfaceFirst; SurfNum <= thisSpace.HTSurfaceLast; ++SurfNum, ++surfCount) {
     970       830256 :                 auto const &surf = state.dataSurface->Surface(SurfNum);
     971       830256 :                 if (surf.Class == SurfaceClass::Window) {
     972       103782 :                     continue;
     973              :                 }
     974              : 
     975       726474 :                 if (afnZoneInfo.ControlAirNodeID == roomAirNodeNum) {
     976       207564 :                     bool Found = false;
     977      1275036 :                     for (int Loop = 1; Loop <= afnZoneInfo.NumOfAirNodes && !Found; ++Loop) {
     978              :                         // None - assigned surfaces belong to the zone node
     979      1067472 :                         Found = (Loop != roomAirNodeNum) && afnZoneInfo.Node(Loop).SurfMask(surfCount);
     980              :                     }
     981       207564 :                     if (Found) {
     982        74130 :                         continue;
     983              :                     }
     984              :                 } else {
     985       518910 :                     if (!afnZoneInfo.Node(roomAirNodeNum).SurfMask(surfCount)) {
     986       481845 :                         continue;
     987              :                     }
     988              :                 }
     989              : 
     990       170499 :                 auto const &HMassConvInFD = state.dataMstBal->HMassConvInFD(SurfNum);
     991       170499 :                 auto &RhoVaporSurfIn = state.dataMstBal->RhoVaporSurfIn(SurfNum);
     992       170499 :                 auto &RhoVaporAirIn = state.dataMstBal->RhoVaporAirIn(SurfNum);
     993       170499 :                 if (surf.HeatTransferAlgorithm == DataSurfaces::HeatTransferModel::HAMT) {
     994            0 :                     UpdateHeatBalHAMT(state, SurfNum);
     995              : 
     996            0 :                     SumHmAW += HMassConvInFD * surf.Area * (RhoVaporSurfIn - RhoVaporAirIn);
     997              : 
     998            0 :                     Real64 RhoAirZone = PsyRhoAirFnPbTdbW(
     999              :                         state,
    1000            0 :                         state.dataEnvrn->OutBaroPress,
    1001            0 :                         state.dataZoneTempPredictorCorrector->zoneHeatBalance(surf.Zone).MAT,
    1002            0 :                         PsyRhFnTdbRhov(state,
    1003            0 :                                        state.dataZoneTempPredictorCorrector->zoneHeatBalance(state.dataSurface->Surface(SurfNum).Zone).MAT,
    1004              :                                        RhoVaporAirIn,
    1005              :                                        "RhoAirZone"));
    1006              : 
    1007            0 :                     Real64 Wsurf = PsyWFnTdbRhPb(state,
    1008            0 :                                                  state.dataHeatBalSurf->SurfTempInTmp(SurfNum),
    1009            0 :                                                  PsyRhFnTdbRhov(state, state.dataHeatBalSurf->SurfTempInTmp(SurfNum), RhoVaporSurfIn, "Wsurf"),
    1010            0 :                                                  state.dataEnvrn->OutBaroPress);
    1011              : 
    1012            0 :                     SumHmARa += HMassConvInFD * surf.Area * RhoAirZone;
    1013            0 :                     SumHmARaW += HMassConvInFD * surf.Area * RhoAirZone * Wsurf;
    1014              :                 }
    1015              : 
    1016       170499 :                 else if (surf.HeatTransferAlgorithm == DataSurfaces::HeatTransferModel::EMPD) {
    1017              : 
    1018            0 :                     UpdateMoistureBalanceEMPD(state, SurfNum);
    1019            0 :                     RhoVaporSurfIn = state.dataMstBalEMPD->RVSurface(SurfNum);
    1020              : 
    1021            0 :                     SumHmAW += HMassConvInFD * surf.Area * (RhoVaporSurfIn - RhoVaporAirIn);
    1022            0 :                     SumHmARa +=
    1023            0 :                         HMassConvInFD * surf.Area *
    1024            0 :                         PsyRhoAirFnPbTdbW(state,
    1025            0 :                                           state.dataEnvrn->OutBaroPress,
    1026            0 :                                           state.dataHeatBalSurf->SurfTempInTmp(SurfNum),
    1027            0 :                                           PsyWFnTdbRhPb(state,
    1028            0 :                                                         state.dataHeatBalSurf->SurfTempInTmp(SurfNum),
    1029            0 :                                                         PsyRhFnTdbRhovLBnd0C(state, state.dataHeatBalSurf->SurfTempInTmp(SurfNum), RhoVaporAirIn),
    1030            0 :                                                         state.dataEnvrn->OutBaroPress));
    1031            0 :                     SumHmARaW += HMassConvInFD * surf.Area * RhoVaporSurfIn;
    1032              :                 }
    1033              :             } // for (SurfNum)
    1034        51891 :         } // for (spaceNum)
    1035              : 
    1036        51891 :     } // CalcSurfaceMoistureSums
    1037              : 
    1038        51891 :     void SumNonAirSystemResponseForNode(EnergyPlusData &state, int const zoneNum, int const roomAirNodeNum)
    1039              :     {
    1040              : 
    1041              :         // SUBROUTINE INFORMATION:
    1042              :         //       AUTHOR         B. Griffith
    1043              :         //       DATE WRITTEN   June 2012
    1044              :         //       MODIFIED       Lixing Gu, Aug. 2015 for v8.4 replease
    1045              : 
    1046              :         // PURPOSE OF THIS SUBROUTINE:
    1047              :         // Sum system response from none air systems
    1048              : 
    1049              :         // USE STATEMENTS:
    1050              :         using BaseboardElectric::SimElectricBaseboard;
    1051              :         using BaseboardRadiator::SimBaseboard;
    1052              :         using ElectricBaseboardRadiator::SimElecBaseboard;
    1053              :         using HighTempRadiantSystem::SimHighTempRadiantSystem;
    1054              :         using HWBaseboardRadiator::SimHWBaseboard;
    1055              :         using RefrigeratedCase::SimAirChillerSet;
    1056              :         using SteamBaseboardRadiator::SimSteamBaseboard;
    1057              : 
    1058              :         // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    1059              :         Real64 SysOutputProvided;
    1060              :         Real64 LatOutputProvided;
    1061              : 
    1062              :         // TODO
    1063        51891 :         auto &afnZoneInfo = state.dataRoomAir->AFNZoneInfo(zoneNum);
    1064        51891 :         auto &afnNode = afnZoneInfo.Node(roomAirNodeNum);
    1065              : 
    1066        51891 :         afnNode.NonAirSystemResponse = 0.0;
    1067              : 
    1068        51891 :         if (!allocated(state.dataZoneEquip->ZoneEquipConfig)) {
    1069            0 :             return;
    1070              :         }
    1071              : 
    1072       103782 :         for (auto &afnHVAC : afnNode.HVAC) {
    1073        51891 :             switch (afnHVAC.zoneEquipType) {
    1074              : 
    1075            0 :             case DataZoneEquipment::ZoneEquipType::BaseboardWater: {
    1076              :                 //'ZoneHVAC:Baseboard:RadiantConvective:Water' 13
    1077            0 :                 SimHWBaseboard(state, afnHVAC.Name, zoneNum, false, SysOutputProvided, afnHVAC.CompIndex);
    1078            0 :                 afnNode.NonAirSystemResponse += afnHVAC.SupplyFraction * SysOutputProvided;
    1079              :                 // LatOutputProvided = 0.0d0 !This baseboard does not add / remove any latent heat
    1080            0 :             } break;
    1081              : 
    1082            0 :             case DataZoneEquipment::ZoneEquipType::BaseboardSteam: {
    1083              :                 // CASE(BBSteam_Num) !'ZoneHVAC:Baseboard:RadiantConvective:Steam' 14
    1084            0 :                 SimSteamBaseboard(state, afnHVAC.Name, zoneNum, false, SysOutputProvided, afnHVAC.CompIndex);
    1085              : 
    1086            0 :                 afnNode.NonAirSystemResponse += afnHVAC.SupplyFraction * SysOutputProvided;
    1087              :                 // LatOutputProvided = 0.0d0 !This baseboard does not add / remove any latent heat
    1088            0 :             } break;
    1089              : 
    1090            0 :             case DataZoneEquipment::ZoneEquipType::BaseboardConvectiveWater: {
    1091              :                 // CASE(BBWaterConvective_Num)  !'ZoneHVAC:Baseboard:Convective:Water' 16
    1092            0 :                 SimBaseboard(state, afnHVAC.Name, zoneNum, false, SysOutputProvided, afnHVAC.CompIndex);
    1093            0 :                 afnNode.NonAirSystemResponse += afnHVAC.SupplyFraction * SysOutputProvided;
    1094              :                 // LatOutputProvided = 0.0d0 !This baseboard does not add / remove any latent heat
    1095            0 :             } break;
    1096              : 
    1097            0 :             case DataZoneEquipment::ZoneEquipType::BaseboardConvectiveElectric: {
    1098              :                 // CASE(BBElectricConvective_Num)  !'ZoneHVAC:Baseboard:Convective:Electric' 15
    1099            0 :                 SimElectricBaseboard(state, afnHVAC.Name, zoneNum, SysOutputProvided, afnHVAC.CompIndex);
    1100            0 :                 afnNode.NonAirSystemResponse += afnHVAC.SupplyFraction * SysOutputProvided;
    1101              :                 // LatOutputProvided = 0.0d0 !This baseboard does not add / remove any latent heat
    1102            0 :             } break;
    1103              : 
    1104            0 :             case DataZoneEquipment::ZoneEquipType::RefrigerationChillerSet: {
    1105              :                 // CASE(RefrigerationAirChillerSet_Num)  !'ZoneHVAC:RefrigerationChillerSet' 20
    1106            0 :                 SimAirChillerSet(state, afnHVAC.Name, zoneNum, false, SysOutputProvided, LatOutputProvided, afnHVAC.CompIndex);
    1107            0 :                 afnNode.NonAirSystemResponse += afnHVAC.SupplyFraction * SysOutputProvided;
    1108            0 :             } break;
    1109              : 
    1110            0 :             case DataZoneEquipment::ZoneEquipType::BaseboardElectric: {
    1111              :                 // CASE(BBElectric_Num)  !'ZoneHVAC:Baseboard:RadiantConvective:Electric' 12
    1112            0 :                 SimElecBaseboard(state, afnHVAC.Name, zoneNum, false, SysOutputProvided, afnHVAC.CompIndex);
    1113            0 :                 afnNode.NonAirSystemResponse += afnHVAC.SupplyFraction * SysOutputProvided;
    1114              :                 // LatOutputProvided = 0.0d0 !This baseboard does not add / remove any latent heat
    1115            0 :             } break;
    1116              : 
    1117            0 :             case DataZoneEquipment::ZoneEquipType::HighTemperatureRadiant: {
    1118              :                 // CASE(BBElectric_Num)  !'ZoneHVAC:HighTemperatureRadiant' 17
    1119            0 :                 SimHighTempRadiantSystem(state, afnHVAC.Name, false, SysOutputProvided, afnHVAC.CompIndex);
    1120            0 :                 afnNode.NonAirSystemResponse += afnHVAC.SupplyFraction * SysOutputProvided;
    1121              :                 // LatOutputProvided = 0.0d0 !This baseboard does not add / remove any latent heat
    1122            0 :             } break;
    1123              : 
    1124        51891 :             default: {
    1125        51891 :             } break;
    1126              :             } // switch
    1127              : 
    1128              :             // Zone sum of system convective gains, collected via NonAirSystemResponse
    1129              :         }
    1130              : 
    1131              :     } // SumNonAirSystemResponseForNode
    1132              : 
    1133              :     //*****************************************************************************************
    1134              : 
    1135         3689 :     void SumSystemDepResponseForNode(EnergyPlusData &state, int const zoneNum)
    1136              :     {
    1137              :         // SUBROUTINE INFORMATION:
    1138              :         //       AUTHOR         B.Griffith
    1139              :         //       DATE WRITTEN   aug 2005, Jan2004
    1140              :         //       MODIFIED       Lixing Gu, Aug. 2015 for v8.4 replease
    1141              : 
    1142              :         // PURPOSE OF THIS SUBROUTINE:
    1143              :         // Sum system sensible loads used at the next time step
    1144              : 
    1145              :         // USE STATEMENTS:
    1146              :         using ZoneDehumidifier::SimZoneDehumidifier;
    1147              : 
    1148              :         // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    1149              :         Real64 LatOutputProvided;
    1150              : 
    1151              :         // TODO
    1152              : 
    1153         3689 :         auto &afnZoneInfo = state.dataRoomAir->AFNZoneInfo(zoneNum);
    1154              : 
    1155              :         // SysDepZoneLoads saved to be added to zone heat balance next
    1156         3689 :         Real64 SysOutputProvided = 0.0;
    1157        25823 :         for (auto &afnNode : afnZoneInfo.Node) {
    1158        22134 :             afnNode.SysDepZoneLoadsLaggedOld = 0.0;
    1159        44268 :             for (auto &afnHVAC : afnNode.HVAC) {
    1160        22134 :                 if (afnHVAC.zoneEquipType == DataZoneEquipment::ZoneEquipType::DehumidifierDX) {
    1161            0 :                     if (SysOutputProvided == 0.0) {
    1162            0 :                         SimZoneDehumidifier(state, afnHVAC.Name, zoneNum, false, SysOutputProvided, LatOutputProvided, afnHVAC.CompIndex);
    1163              :                     }
    1164            0 :                     if (SysOutputProvided > 0.0) {
    1165            0 :                         break;
    1166              :                     }
    1167              :                 }
    1168              :             }
    1169              :         }
    1170              : 
    1171         3689 :         if (SysOutputProvided > 0.0) {
    1172            0 :             for (auto &afnNode : afnZoneInfo.Node) {
    1173            0 :                 for (auto const &afnHVAC : afnNode.HVAC) {
    1174            0 :                     if (afnHVAC.zoneEquipType == DataZoneEquipment::ZoneEquipType::DehumidifierDX) {
    1175            0 :                         afnNode.SysDepZoneLoadsLaggedOld += afnHVAC.SupplyFraction * SysOutputProvided;
    1176              :                     }
    1177              :                 }
    1178              :             }
    1179              :         }
    1180              : 
    1181         3689 :     } // SumSystemDepResponseForNode
    1182              : 
    1183              :     //*****************************************************************************************
    1184              : 
    1185              : } // namespace RoomAir
    1186              : 
    1187              : } // namespace EnergyPlus
        

Generated by: LCOV version 2.0-1