LCOV - code coverage report
Current view: top level - EnergyPlus - SetPointManager.cc (source / functions) Hit Total Coverage
Test: lcov.output.filtered Lines: 3727 4891 76.2 %
Date: 2023-01-17 19:17:23 Functions: 54 55 98.2 %

          Line data    Source code
       1             : // EnergyPlus, Copyright (c) 1996-2023, 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             : // C++ Headers
      49             : #include <cmath>
      50             : 
      51             : // ObjexxFCL Headers
      52             : #include <ObjexxFCL/Array.functions.hh>
      53             : #include <ObjexxFCL/Fmath.hh>
      54             : 
      55             : // EnergyPlus Headers
      56             : #include <EnergyPlus/CurveManager.hh>
      57             : #include <EnergyPlus/Data/EnergyPlusData.hh>
      58             : #include <EnergyPlus/DataAirLoop.hh>
      59             : #include <EnergyPlus/DataAirSystems.hh>
      60             : #include <EnergyPlus/DataConvergParams.hh>
      61             : #include <EnergyPlus/DataEnvironment.hh>
      62             : #include <EnergyPlus/DataHVACGlobals.hh>
      63             : #include <EnergyPlus/DataHeatBalance.hh>
      64             : #include <EnergyPlus/DataIPShortCuts.hh>
      65             : #include <EnergyPlus/DataLoopNode.hh>
      66             : #include <EnergyPlus/DataPrecisionGlobals.hh>
      67             : #include <EnergyPlus/DataZoneControls.hh>
      68             : #include <EnergyPlus/DataZoneEnergyDemands.hh>
      69             : #include <EnergyPlus/DataZoneEquipment.hh>
      70             : #include <EnergyPlus/EMSManager.hh>
      71             : #include <EnergyPlus/FluidProperties.hh>
      72             : #include <EnergyPlus/General.hh>
      73             : #include <EnergyPlus/InputProcessing/InputProcessor.hh>
      74             : #include <EnergyPlus/NodeInputManager.hh>
      75             : #include <EnergyPlus/OutAirNodeManager.hh>
      76             : #include <EnergyPlus/OutputProcessor.hh>
      77             : #include <EnergyPlus/Plant/DataPlant.hh>
      78             : #include <EnergyPlus/PlantUtilities.hh>
      79             : #include <EnergyPlus/Psychrometrics.hh>
      80             : #include <EnergyPlus/ScheduleManager.hh>
      81             : #include <EnergyPlus/SetPointManager.hh>
      82             : #include <EnergyPlus/UtilityRoutines.hh>
      83             : 
      84             : namespace EnergyPlus::SetPointManager {
      85             : 
      86             : // Module containing the SetPoint Manager routines
      87             : 
      88             : // MODULE INFORMATION:
      89             : //       AUTHOR         Fred Buhl
      90             : //       DATE WRITTEN   July 1998
      91             : //       MODIFIED       Shirey/Raustad (FSEC), Jan 2004
      92             : //                      Nov 2004 - Jan 2005 M. J. Witte, GARD Analytics, Inc.
      93             : //                        Add new setpoint managers:
      94             : //                          SET POINT MANAGER:SINGLE ZONE HEATING and
      95             : //                          SET POINT MANAGER:SINGLE ZONE COOLING
      96             : //                          SET POINT MANAGER:OUTSIDE AIR PRETREAT
      97             : //                        Work supported by ASHRAE research project 1254-RP
      98             : //                      Phil Haves Oct 2004
      99             : //                      B. Griffith Aug. 2006.
     100             : //                      R. Raustad - FSEC: added AllSetPtMgr used for node conflict checks
     101             : //                      July 2010 B.A. Nigusse, FSEC/UCF
     102             : //                        Added new setpoint managers:
     103             : //                          SetpointManager:MultiZone:Heating:Average
     104             : //                          SetpointManager:MultiZone:Cooling:Average
     105             : //                          SetpointManager:MultiZone:MinimumHumidity:Average
     106             : //                          SetpointManager:MultiZone:MaximumHumidity:Average
     107             : //                       22Aug2010 Craig Wray - added Fan:ComponentModel
     108             : //                      Aug 2010 B.A. Nigusse, FSEC/UCF
     109             : //                        Added new setpoint managers:
     110             : //                          SetpointManager:MultiZone:Humidity:Minimum
     111             : //                          SetpointManager:MultiZone:Humidity:Maximum
     112             : //                      July 2011 Chandan Sharma, FSEC/UCF
     113             : //                        Added new setpoint managers:
     114             : //                          SetpointManager:FollowOutdoorAirTemperature
     115             : //                          SetpointManager:FollowSystemNodeTemperature
     116             : //                          SetpointManager:FollowGroundTemperature
     117             : //                      March 2012, Atefe Makhmalbaf and Heejin Cho, PNNL
     118             : //                        Added new setpoint manager:
     119             : //                          SetpointManager:CondenserEnteringReset
     120             : //                      Jan 2022 Wooyoung Jung, Jeremy Lerond and Jian Zhang, PNNL
     121             : //                        Added new setpoint managers:
     122             : //                          SetpointManager:SystemNodeReset:Temperature
     123             : //                          SetpointManager:SystemNodeReset:Humidity
     124             : //       RE-ENGINEERED  na
     125             : 
     126             : // PURPOSE OF THIS MODULE:
     127             : // To encapsulate the data and algorithms required to
     128             : // determine all the controller setpoints in the problem.
     129             : 
     130             : // METHODOLOGY EMPLOYED:
     131             : // Previous time step node data will be used, in a set of fixed, precoded algorithms,
     132             : // to determine the current time step's controller setpoints.
     133             : 
     134             : using namespace DataLoopNode;
     135             : using namespace DataAirLoop;
     136             : using namespace ScheduleManager;
     137             : using namespace Curve;
     138             : using Psychrometrics::PsyCpAirFnW;
     139             : using Psychrometrics::PsyHFnTdbW;
     140             : 
     141             : constexpr std::array<std::string_view, static_cast<int>(CtrlVarType::Num)> controlTypeName = {"Temperature",
     142             :                                                                                               "MaximumTemperature",
     143             :                                                                                               "MinimumTemperature",
     144             :                                                                                               "HumidityRatio",
     145             :                                                                                               "MaximumHumidityRatio",
     146             :                                                                                               "MinimumHumidityRatio",
     147             :                                                                                               "MassFlowRate",
     148             :                                                                                               "MaximumMassFlowRate",
     149             :                                                                                               "MinimumMassFlowRate"};
     150             : 
     151             : constexpr std::array<std::string_view, static_cast<int>(CtrlVarType::Num)> controlTypeNameUC = {"TEMPERATURE",
     152             :                                                                                                 "MAXIMUMTEMPERATURE",
     153             :                                                                                                 "MINIMUMTEMPERATURE",
     154             :                                                                                                 "HUMIDITYRATIO",
     155             :                                                                                                 "MAXIMUMHUMIDITYRATIO",
     156             :                                                                                                 "MINIMUMHUMIDITYRATIO",
     157             :                                                                                                 "MASSFLOWRATE",
     158             :                                                                                                 "MAXIMUMMASSFLOWRATE",
     159             :                                                                                                 "MINIMUMMASSFLOWRATE"};
     160             : 
     161             : constexpr std::array<std::string_view, static_cast<int>(ControlStrategy::Num)> strategyNamesUC = {
     162             :     "TEMPERATUREFIRST",
     163             :     "FLOWFIRST",
     164             : };
     165             : 
     166             : constexpr std::array<std::string_view, static_cast<int>(SetPointManagerType::Num)> managerTypeName = {
     167             :     "SetpointManager:Scheduled",
     168             :     "SetpointManager:Scheduled:DualSetpoint",
     169             :     "SetpointManager:OutdoorAirReset",
     170             :     "SetpointManager:SingleZone:Reheat",
     171             :     "SetpointManager:SingleZone:Heating",
     172             :     "SetpointManager:SingleZone:Cooling",
     173             :     "SetpointManager:SingleZone:Humidity:Minimum",
     174             :     "SetpointManager:SingleZone:Humidity:Maximum",
     175             :     "SetpointManager:MixedAir",
     176             :     "SetpointManager:OutdoorAirPretreat",
     177             :     "SetpointManager:Warmest",
     178             :     "SetpointManager:Coldest",
     179             :     "SetpointManager:WarmestTemperatureFlow",
     180             :     "SetpointManager:ReturnAirBypassFlow",
     181             :     "SetpointManager:MultiZone:Cooling:Average",
     182             :     "SetpointManager:MultiZone:Heating:Average",
     183             :     "SetpointManager:MultiZone:MinimumHumidity:Average",
     184             :     "SetpointManager:MultiZone:MaximumHumidity:Average",
     185             :     "SetpointManager:MultiZone:Humidity:Minimum",
     186             :     "SetpointManager:MultiZone:Humidity:Maximum",
     187             :     "SetpointManager:FollowOutdoorAirTemperature",
     188             :     "SetpointManager:FollowSystemNodeTemperature",
     189             :     "SetpointManager:FollowGroundTemperature",
     190             :     "SetpointManager:CondenserEnteringReset",
     191             :     "SetpointManager:CondenserEnteringReset:Ideal",
     192             :     "SetpointManager:SingleZone:OneStageCooling",
     193             :     "SetpointManager:SingleZone:OneStageHeating",
     194             :     "SetpointManager:ReturnTemperature:ChilledWater",
     195             :     "SetpointManager:ReturnTemperature:HotWater",
     196             :     "SetpointManager:ScheduledTES",
     197             :     "SetpointManager:SystemNodeReset:Temperature",
     198             :     "SetpointManager:SystemNodeReset:Humidity"};
     199             : 
     200     2639643 : void ManageSetPoints(EnergyPlusData &state)
     201             : {
     202             :     // SUBROUTINE INFORMATION:
     203             :     //       AUTHOR         Russ Taylor, Rick Strand
     204             :     //       DATE WRITTEN   May 1998
     205             :     //       MODIFIED       Fred Buhl May 2000
     206             :     //       RE-ENGINEERED  na
     207             : 
     208             :     // PURPOSE OF THIS SUBROUTINE:
     209             : 
     210             :     // METHODOLOGY EMPLOYED:
     211             :     // Each flag is checked and the appropriate manager is then called.
     212             : 
     213             :     // REFERENCES:
     214             :     // na
     215             : 
     216             :     // USE STATEMENTS:
     217             : 
     218             :     // Locals
     219             :     // SUBROUTINE PARAMETER DEFINITIONS:
     220             :     // na
     221             : 
     222             :     // INTERFACE BLOCK SPECIFICATIONS
     223             :     // na
     224             : 
     225             :     // DERIVED TYPE DEFINITIONS
     226             :     // na
     227             : 
     228             :     // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
     229             :     int SetPtMgrNum; // loop index
     230             : 
     231             :     // First time ManageSetPoints is called, get the input for all the setpoint managers
     232     2639643 :     if (state.dataSetPointManager->GetInputFlag) {
     233         771 :         GetSetPointManagerInputs(state);
     234         771 :         state.dataSetPointManager->GetInputFlag = false;
     235             :     }
     236             : 
     237     2639643 :     InitSetPointManagers(state);
     238             : 
     239     2639643 :     if (state.dataSetPointManager->ManagerOn) {
     240     2633608 :         SimSetPointManagers(state);
     241     2633608 :         UpdateSetPointManagers(state);
     242             :         // The Mixed Air Setpoint Managers (since they depend on other setpoints, they must be calculated
     243             :         // and updated next to last).
     244     9175243 :         for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumMixedAirSetPtMgrs; ++SetPtMgrNum) {
     245     6541635 :             state.dataSetPointManager->MixedAirSetPtMgr(SetPtMgrNum).calculate(state);
     246             :         }
     247     2633608 :         UpdateMixedAirSetPoints(state);
     248             :         // The Outside Air Pretreat Setpoint Managers (since they depend on other setpoints, they must be calculated
     249             :         // and updated last).
     250     2656375 :         for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumOAPretreatSetPtMgrs; ++SetPtMgrNum) {
     251       22767 :             state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).calculate(state);
     252             :         }
     253     2633608 :         UpdateOAPretreatSetPoints(state);
     254             :     }
     255     2639643 : }
     256             : 
     257         771 : void GetSetPointManagerInputs(EnergyPlusData &state)
     258             : {
     259             :     // wrapper for GetInput to allow unit testing when fatal inputs are detected
     260         771 :     bool ErrorsFound(false);
     261         771 :     const char *RoutineName("GetSetPointManagerInputs: "); // include trailing blank space
     262             : 
     263         771 :     GetSetPointManagerInputData(state, ErrorsFound);
     264             : 
     265         771 :     if (ErrorsFound) {
     266           0 :         ShowFatalError(state, format("{}Errors found in input.  Program terminates.", RoutineName));
     267             :     }
     268         771 : }
     269             : 
     270         775 : void GetSetPointManagerInputData(EnergyPlusData &state, bool &ErrorsFound)
     271             : {
     272             : 
     273             :     // SUBROUTINE INFORMATION:
     274             :     //       AUTHOR         Fred Buhl
     275             :     //       DATE WRITTEN   July 1998
     276             :     //       MODIFIED       Shirey/Raustad (FSEC), Jan 2004
     277             :     //                      Nov 2004 - Jan 2005 M. J. Witte, GARD Analytics, Inc.
     278             :     //                        Add new setpoint managers:
     279             :     //                          SET POINT MANAGER:SINGLE ZONE HEATING and
     280             :     //                          SET POINT MANAGER:SINGLE ZONE COOLING
     281             :     //                          SET POINT MANAGER:OUTSIDE AIR PRETREAT
     282             :     //                        Work supported by ASHRAE research project 1254-RP
     283             :     //                      Haves October 2004
     284             :     //                      Witte (GARD), Sep 2006
     285             :     //                      July 2010 B.A. Nigusse, FSEC/UCF
     286             :     //                        Added new setpoint managers:
     287             :     //                          SetpointManager:MultiZone:Heating:Average
     288             :     //                          SetpointManager:MultiZone:Cooling:Average
     289             :     //                          SetpointManager:MultiZone:MinimumHumidity:Average
     290             :     //                          SetpointManager:MultiZone:MaximumHumidity:Average
     291             :     //                      Aug 2010 B.A. Nigusse, FSEC/UCF
     292             :     //                        Added new setpoint managers:
     293             :     //                          SetpointManager:MultiZone:Humidity:Minimum
     294             :     //                          SetpointManager:MultiZone:Humidity:Maximum
     295             :     //                      Jan 2022 Wooyoung Jung, Jeremy Lerond, and Jian Zhang, PNNL
     296             :     //                        Added new setpoint managers:
     297             :     //                          SetpointManager:SystemNodeReset:Temperature
     298             :     //                          SetpointManager:SystemNodeReset:Humidity
     299             : 
     300             :     //       RE-ENGINEERED  na
     301             : 
     302             :     // PURPOSE OF THIS SUBROUTINE
     303             :     // Input the SetPointManager data and store it in the SetPtMgrIn array.
     304             :     // Examine the Controllers in the input data and determine which ones
     305             :     // will have their setpoints set by a particular Setpoint Manager.
     306             : 
     307             :     // METHODOLOGY EMPLOYED:
     308             :     // Use the Get routines from the InputProcessor module.
     309             : 
     310             :     // Using/Aliasing
     311             :     using DataZoneEquipment::GetSystemNodeNumberForZone;
     312             :     using General::FindNumberInList;
     313             : 
     314             :     using NodeInputManager::GetNodeNums;
     315             :     using NodeInputManager::GetOnlySingleNode;
     316             :     using ScheduleManager::CheckScheduleValueMinMax;
     317             :     using ScheduleManager::GetScheduleIndex;
     318             : 
     319             :     // Locals
     320             :     // SUBROUTINE PARAMETER DEFINITIONS:
     321             :     static constexpr std::string_view RoutineName{"GetSetPointManagerInputs"};
     322             : 
     323             :     // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
     324        1550 :     Array1D_string cAlphaFieldNames;
     325        1550 :     Array1D_string cNumericFieldNames;
     326        1550 :     Array1D_bool lNumericFieldBlanks;
     327        1550 :     Array1D_bool lAlphaFieldBlanks;
     328        1550 :     Array1D_string cAlphaArgs;
     329        1550 :     Array1D<Real64> rNumericArgs;
     330        1550 :     std::string cCurrentModuleObject;
     331             : 
     332             :     int NumNums;   // Number of real numbers returned by GetObjectItem
     333             :     int NumAlphas; // Number of alphanumerics returned by GetObjectItem
     334             :     int NumParams;
     335             :     int SetPtMgrNum;    // Setpoint Manager index
     336             :     int AllSetPtMgrNum; // Setpoint Manager index to ALL setpoint managers in single TYPE
     337             :     int IOStat;         // Status flag from GetObjectItem
     338             :     int NumNodesCtrld;  // number of controlled nodes in input node list
     339             :     int CtrldNodeNum;   // index of the items in the controlled node node list
     340             :     int NumZones;       // number of zone nodes in input node list
     341             :     int ZoneNum;        // loop index for zone nodes
     342             :     int NumNodes;
     343        1550 :     Array1D_int NodeNums;
     344         775 :     bool NodeListError(false);
     345             :     bool ErrInList;
     346             :     int Found;
     347             : 
     348         775 :     NumNodesCtrld = 0;
     349         775 :     CtrldNodeNum = 0;
     350         775 :     NumZones = 0;
     351         775 :     ZoneNum = 0;
     352             : 
     353         775 :     cCurrentModuleObject = "SetpointManager:Scheduled";
     354         775 :     state.dataSetPointManager->NumSchSetPtMgrs =
     355         775 :         state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); // 'SetpointManager:Scheduled'
     356         775 :     state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, cCurrentModuleObject, NumParams, NumAlphas, NumNums);
     357         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers = NumNums;
     358         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas = NumAlphas;
     359             : 
     360         775 :     cCurrentModuleObject = "SetpointManager:Scheduled:DualSetpoint";
     361         775 :     state.dataSetPointManager->NumDualSchSetPtMgrs =
     362         775 :         state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); // 'SetpointManager:Scheduled:DualSetpoint'
     363         775 :     state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, cCurrentModuleObject, NumParams, NumAlphas, NumNums);
     364         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers = max(state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers, NumNums);
     365         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas = max(state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas, NumAlphas);
     366             : 
     367         775 :     cCurrentModuleObject = "SetpointManager:OutdoorAirReset";
     368         775 :     state.dataSetPointManager->NumOutAirSetPtMgrs =
     369         775 :         state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); // 'SetpointManager:OutdoorAirReset'
     370         775 :     state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, cCurrentModuleObject, NumParams, NumAlphas, NumNums);
     371         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers = max(state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers, NumNums);
     372         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas = max(state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas, NumAlphas);
     373             : 
     374         775 :     cCurrentModuleObject = "SetpointManager:SingleZone:Reheat";
     375         775 :     state.dataSetPointManager->NumSZRhSetPtMgrs =
     376         775 :         state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); // 'SetpointManager:SingleZone:Reheat'
     377         775 :     state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, cCurrentModuleObject, NumParams, NumAlphas, NumNums);
     378         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers = max(state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers, NumNums);
     379         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas = max(state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas, NumAlphas);
     380             : 
     381         775 :     cCurrentModuleObject = "SetpointManager:SingleZone:Heating";
     382         775 :     state.dataSetPointManager->NumSZHtSetPtMgrs =
     383         775 :         state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); // 'SetpointManager:SingleZone:Heating'
     384         775 :     state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, cCurrentModuleObject, NumParams, NumAlphas, NumNums);
     385         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers = max(state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers, NumNums);
     386         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas = max(state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas, NumAlphas);
     387             : 
     388         775 :     cCurrentModuleObject = "SetpointManager:SingleZone:Cooling";
     389         775 :     state.dataSetPointManager->NumSZClSetPtMgrs =
     390         775 :         state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); // 'SetpointManager:SingleZone:Cooling'
     391         775 :     state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, cCurrentModuleObject, NumParams, NumAlphas, NumNums);
     392         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers = max(state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers, NumNums);
     393         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas = max(state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas, NumAlphas);
     394             : 
     395         775 :     cCurrentModuleObject = "SetpointManager:SingleZone:Humidity:Minimum";
     396         775 :     state.dataSetPointManager->NumSZMinHumSetPtMgrs =
     397         775 :         state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); // 'SetpointManager:SingleZone:Humidity:Minimum'
     398         775 :     state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, cCurrentModuleObject, NumParams, NumAlphas, NumNums);
     399         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers = max(state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers, NumNums);
     400         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas = max(state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas, NumAlphas);
     401             : 
     402         775 :     cCurrentModuleObject = "SetpointManager:SingleZone:Humidity:Maximum";
     403         775 :     state.dataSetPointManager->NumSZMaxHumSetPtMgrs =
     404         775 :         state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); // 'SetpointManager:SingleZone:Humidity:Maximum'
     405         775 :     state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, cCurrentModuleObject, NumParams, NumAlphas, NumNums);
     406         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers = max(state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers, NumNums);
     407         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas = max(state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas, NumAlphas);
     408             : 
     409         775 :     cCurrentModuleObject = "SetpointManager:MixedAir";
     410         775 :     state.dataSetPointManager->NumMixedAirSetPtMgrs =
     411         775 :         state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); // 'SetpointManager:MixedAir'
     412         775 :     state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, cCurrentModuleObject, NumParams, NumAlphas, NumNums);
     413         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers = max(state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers, NumNums);
     414         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas = max(state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas, NumAlphas);
     415             : 
     416         775 :     cCurrentModuleObject = "SetpointManager:OutdoorAirPretreat";
     417         775 :     state.dataSetPointManager->NumOAPretreatSetPtMgrs =
     418         775 :         state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); // 'SetpointManager:OutdoorAirPretreat'
     419         775 :     state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, cCurrentModuleObject, NumParams, NumAlphas, NumNums);
     420         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers = max(state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers, NumNums);
     421         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas = max(state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas, NumAlphas);
     422             : 
     423         775 :     cCurrentModuleObject = "SetpointManager:Warmest";
     424         775 :     state.dataSetPointManager->NumWarmestSetPtMgrs =
     425         775 :         state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); // 'SetpointManager:Warmest'
     426         775 :     state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, cCurrentModuleObject, NumParams, NumAlphas, NumNums);
     427         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers = max(state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers, NumNums);
     428         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas = max(state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas, NumAlphas);
     429             : 
     430         775 :     cCurrentModuleObject = "SetpointManager:Coldest";
     431         775 :     state.dataSetPointManager->NumColdestSetPtMgrs =
     432         775 :         state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); // 'SetpointManager:Coldest'
     433         775 :     state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, cCurrentModuleObject, NumParams, NumAlphas, NumNums);
     434         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers = max(state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers, NumNums);
     435         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas = max(state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas, NumAlphas);
     436             : 
     437         775 :     cCurrentModuleObject = "SetpointManager:WarmestTemperatureFlow";
     438         775 :     state.dataSetPointManager->NumWarmestSetPtMgrsTempFlow =
     439         775 :         state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); // 'SetpointManager:WarmestTemperatureFlow'
     440         775 :     state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, cCurrentModuleObject, NumParams, NumAlphas, NumNums);
     441         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers = max(state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers, NumNums);
     442         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas = max(state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas, NumAlphas);
     443             : 
     444         775 :     cCurrentModuleObject = "SetpointManager:ReturnAirBypassFlow";
     445         775 :     state.dataSetPointManager->NumRABFlowSetPtMgrs =
     446         775 :         state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); // 'SetpointManager:ReturnAirBypassFlow'
     447         775 :     state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, cCurrentModuleObject, NumParams, NumAlphas, NumNums);
     448         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers = max(state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers, NumNums);
     449         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas = max(state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas, NumAlphas);
     450             : 
     451         775 :     cCurrentModuleObject = "SetpointManager:MultiZone:Cooling:Average";
     452         775 :     state.dataSetPointManager->NumMZClgAverageSetPtMgrs =
     453         775 :         state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); // 'SetpointManager:MultiZone:Cooling:Average'
     454         775 :     state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, cCurrentModuleObject, NumParams, NumAlphas, NumNums);
     455         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers = max(state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers, NumNums);
     456         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas = max(state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas, NumAlphas);
     457             : 
     458         775 :     cCurrentModuleObject = "SetpointManager:MultiZone:Heating:Average";
     459         775 :     state.dataSetPointManager->NumMZHtgAverageSetPtMgrs =
     460         775 :         state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); // 'SetpointManager:MultiZone:Heating:Average'
     461         775 :     state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, cCurrentModuleObject, NumParams, NumAlphas, NumNums);
     462         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers = max(state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers, NumNums);
     463         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas = max(state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas, NumAlphas);
     464             : 
     465         775 :     cCurrentModuleObject = "SetpointManager:MultiZone:MinimumHumidity:Average";
     466         775 :     state.dataSetPointManager->NumMZAverageMinHumSetPtMgrs = state.dataInputProcessing->inputProcessor->getNumObjectsFound(
     467             :         state, cCurrentModuleObject); // 'SetpointManager:MultiZone:MinimumHumidity:Average'
     468         775 :     state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, cCurrentModuleObject, NumParams, NumAlphas, NumNums);
     469         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers = max(state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers, NumNums);
     470         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas = max(state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas, NumAlphas);
     471             : 
     472         775 :     cCurrentModuleObject = "SetpointManager:MultiZone:MaximumHumidity:Average";
     473         775 :     state.dataSetPointManager->NumMZAverageMaxHumSetPtMgrs = state.dataInputProcessing->inputProcessor->getNumObjectsFound(
     474             :         state, cCurrentModuleObject); // 'SetpointManager:MultiZone:MaximumHumidity:Average'
     475         775 :     state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, cCurrentModuleObject, NumParams, NumAlphas, NumNums);
     476         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers = max(state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers, NumNums);
     477         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas = max(state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas, NumAlphas);
     478             : 
     479         775 :     cCurrentModuleObject = "SetpointManager:MultiZone:Humidity:Minimum";
     480         775 :     state.dataSetPointManager->NumMZMinHumSetPtMgrs =
     481         775 :         state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); // 'SetpointManager:MultiZone:Humidity:Minimum'
     482         775 :     state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, cCurrentModuleObject, NumParams, NumAlphas, NumNums);
     483         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers = max(state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers, NumNums);
     484         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas = max(state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas, NumAlphas);
     485             : 
     486         775 :     cCurrentModuleObject = "SetpointManager:MultiZone:Humidity:Maximum";
     487         775 :     state.dataSetPointManager->NumMZMaxHumSetPtMgrs =
     488         775 :         state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); // 'SetpointManager:MultiZone:Humidity:Maximum'
     489         775 :     state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, cCurrentModuleObject, NumParams, NumAlphas, NumNums);
     490         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers = max(state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers, NumNums);
     491         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas = max(state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas, NumAlphas);
     492             : 
     493         775 :     cCurrentModuleObject = "SetpointManager:FollowOutdoorAirTemperature";
     494         775 :     state.dataSetPointManager->NumFollowOATempSetPtMgrs =
     495         775 :         state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); // 'SetpointManager:FollowOutdoorAirTemperature'
     496         775 :     state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, cCurrentModuleObject, NumParams, NumAlphas, NumNums);
     497         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers = max(state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers, NumNums);
     498         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas = max(state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas, NumAlphas);
     499             : 
     500         775 :     cCurrentModuleObject = "SetpointManager:FollowSystemNodeTemperature";
     501         775 :     state.dataSetPointManager->NumFollowSysNodeTempSetPtMgrs =
     502         775 :         state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); // 'SetpointManager:FollowSystemNodeTemperature'
     503         775 :     state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, cCurrentModuleObject, NumParams, NumAlphas, NumNums);
     504         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers = max(state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers, NumNums);
     505         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas = max(state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas, NumAlphas);
     506             : 
     507         775 :     cCurrentModuleObject = "SetpointManager:FollowGroundTemperature";
     508         775 :     state.dataSetPointManager->NumGroundTempSetPtMgrs =
     509         775 :         state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); // 'SetpointManager:FollowGroundTemperature'
     510         775 :     state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, cCurrentModuleObject, NumParams, NumAlphas, NumNums);
     511         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers = max(state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers, NumNums);
     512         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas = max(state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas, NumAlphas);
     513             : 
     514         775 :     cCurrentModuleObject = "SetpointManager:CondenserEnteringReset";
     515         775 :     state.dataSetPointManager->NumCondEntSetPtMgrs =
     516         775 :         state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); // 'SetpointManager:CondenserEnteringReset'
     517         775 :     state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, cCurrentModuleObject, NumParams, NumAlphas, NumNums);
     518         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers = max(state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers, NumNums);
     519         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas = max(state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas, NumAlphas);
     520             : 
     521         775 :     cCurrentModuleObject = "SetpointManager:CondenserEnteringReset:Ideal";
     522         775 :     state.dataSetPointManager->NumIdealCondEntSetPtMgrs =
     523         775 :         state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject); // 'SetpointManager:CondenserEnteringReset:Ideal'
     524         775 :     state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, cCurrentModuleObject, NumParams, NumAlphas, NumNums);
     525         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers = max(state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers, NumNums);
     526         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas = max(state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas, NumAlphas);
     527             : 
     528         775 :     cCurrentModuleObject = "SetpointManager:SingleZone:OneStageCooling";
     529         775 :     state.dataSetPointManager->NumSZOneStageCoolingSetPtMgrs =
     530         775 :         state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject);
     531         775 :     state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, cCurrentModuleObject, NumParams, NumAlphas, NumNums);
     532         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers = max(state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers, NumNums);
     533         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas = max(state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas, NumAlphas);
     534             : 
     535         775 :     cCurrentModuleObject = "SetpointManager:SingleZone:OneStageHeating";
     536         775 :     state.dataSetPointManager->NumSZOneStageHeatingSetPtMgrs =
     537         775 :         state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject);
     538         775 :     state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, cCurrentModuleObject, NumParams, NumAlphas, NumNums);
     539         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers = max(state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers, NumNums);
     540         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas = max(state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas, NumAlphas);
     541             : 
     542         775 :     cCurrentModuleObject = "SetpointManager:ReturnTemperature:ChilledWater";
     543         775 :     state.dataSetPointManager->NumReturnWaterResetChWSetPtMgrs =
     544         775 :         state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject);
     545         775 :     state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, cCurrentModuleObject, NumParams, NumAlphas, NumNums);
     546         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers = max(state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers, NumNums);
     547         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas = max(state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas, NumAlphas);
     548             : 
     549         775 :     cCurrentModuleObject = "SetpointManager:ReturnTemperature:HotWater";
     550         775 :     state.dataSetPointManager->NumReturnWaterResetHWSetPtMgrs =
     551         775 :         state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject);
     552         775 :     state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, cCurrentModuleObject, NumParams, NumAlphas, NumNums);
     553         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers = max(state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers, NumNums);
     554         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas = max(state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas, NumAlphas);
     555             : 
     556         775 :     cCurrentModuleObject = "SetpointManager:SystemNodeReset:Temperature";
     557         775 :     state.dataSetPointManager->NumSystemNodeResetTempSetPtMgrs =
     558         775 :         state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject);
     559         775 :     state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, cCurrentModuleObject, NumParams, NumAlphas, NumNums);
     560         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers = max(state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers, NumNums);
     561         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas = max(state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas, NumAlphas);
     562             : 
     563         775 :     cCurrentModuleObject = "SetpointManager:SystemNodeReset:Humidity";
     564         775 :     state.dataSetPointManager->NumSystemNodeResetHumSetPtMgrs =
     565         775 :         state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject);
     566         775 :     state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, cCurrentModuleObject, NumParams, NumAlphas, NumNums);
     567         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers = max(state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers, NumNums);
     568         775 :     state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas = max(state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas, NumAlphas);
     569             : 
     570         775 :     state.dataSetPointManager->NumAllSetPtMgrs =
     571        1550 :         state.dataSetPointManager->NumSchSetPtMgrs + state.dataSetPointManager->NumDualSchSetPtMgrs + state.dataSetPointManager->NumOutAirSetPtMgrs +
     572        2325 :         state.dataSetPointManager->NumSZRhSetPtMgrs + state.dataSetPointManager->NumSZHtSetPtMgrs + state.dataSetPointManager->NumSZClSetPtMgrs +
     573        2325 :         state.dataSetPointManager->NumSZMinHumSetPtMgrs + state.dataSetPointManager->NumSZMaxHumSetPtMgrs +
     574        2325 :         state.dataSetPointManager->NumMixedAirSetPtMgrs + state.dataSetPointManager->NumOAPretreatSetPtMgrs +
     575        2325 :         state.dataSetPointManager->NumWarmestSetPtMgrs + state.dataSetPointManager->NumColdestSetPtMgrs +
     576        2325 :         state.dataSetPointManager->NumWarmestSetPtMgrsTempFlow + state.dataSetPointManager->NumRABFlowSetPtMgrs +
     577        2325 :         state.dataSetPointManager->NumMZClgAverageSetPtMgrs + state.dataSetPointManager->NumMZHtgAverageSetPtMgrs +
     578        2325 :         state.dataSetPointManager->NumMZAverageMinHumSetPtMgrs + state.dataSetPointManager->NumMZAverageMaxHumSetPtMgrs +
     579        2325 :         state.dataSetPointManager->NumMZMinHumSetPtMgrs + state.dataSetPointManager->NumMZMaxHumSetPtMgrs +
     580        2325 :         state.dataSetPointManager->NumFollowOATempSetPtMgrs + state.dataSetPointManager->NumFollowSysNodeTempSetPtMgrs +
     581        2325 :         state.dataSetPointManager->NumGroundTempSetPtMgrs + state.dataSetPointManager->NumCondEntSetPtMgrs +
     582        2325 :         state.dataSetPointManager->NumIdealCondEntSetPtMgrs + state.dataSetPointManager->NumSZOneStageCoolingSetPtMgrs +
     583        2325 :         state.dataSetPointManager->NumSZOneStageHeatingSetPtMgrs + state.dataSetPointManager->NumReturnWaterResetChWSetPtMgrs +
     584        2325 :         state.dataSetPointManager->NumReturnWaterResetHWSetPtMgrs + state.dataSetPointManager->NumSystemNodeResetTempSetPtMgrs +
     585         775 :         state.dataSetPointManager->NumSystemNodeResetHumSetPtMgrs;
     586             : 
     587         775 :     cAlphaFieldNames.allocate(state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas);
     588         775 :     cAlphaArgs.allocate(state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas);
     589         775 :     lAlphaFieldBlanks.dimension(state.dataSetPointManager->GetSetPointManagerInputMaxNumAlphas, false);
     590         775 :     cNumericFieldNames.allocate(state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers);
     591         775 :     rNumericArgs.dimension(state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers, 0.0);
     592         775 :     lNumericFieldBlanks.dimension(state.dataSetPointManager->GetSetPointManagerInputMaxNumNumbers, false);
     593             : 
     594         775 :     state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, "NodeList", NumParams, NumAlphas, NumNums);
     595         775 :     NodeNums.dimension(NumParams, 0);
     596             : 
     597         775 :     if (state.dataSetPointManager->NumAllSetPtMgrs > 0)
     598        1078 :         state.dataSetPointManager->AllSetPtMgr.allocate(
     599        1078 :             state.dataSetPointManager->NumAllSetPtMgrs); // Allocate the entire Setpoint Manager input data array
     600             : 
     601             :     // Input the Scheduled Setpoint Managers
     602             : 
     603         775 :     if (state.dataSetPointManager->NumSchSetPtMgrs > 0)
     604         450 :         state.dataSetPointManager->SchSetPtMgr.allocate(state.dataSetPointManager->NumSchSetPtMgrs); // Allocate the Setpoint Manager input data array
     605             : 
     606             :     // Input the data for each Setpoint Manager
     607             : 
     608         775 :     cCurrentModuleObject = "SetpointManager:Scheduled";
     609             : 
     610        2638 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumSchSetPtMgrs; ++SetPtMgrNum) {
     611        1863 :         state.dataInputProcessing->inputProcessor->getObjectItem(state,
     612             :                                                                  cCurrentModuleObject,
     613             :                                                                  SetPtMgrNum,
     614             :                                                                  cAlphaArgs,
     615             :                                                                  NumAlphas,
     616             :                                                                  rNumericArgs,
     617             :                                                                  NumNums,
     618             :                                                                  IOStat,
     619             :                                                                  lNumericFieldBlanks,
     620             :                                                                  lAlphaFieldBlanks,
     621             :                                                                  cAlphaFieldNames,
     622             :                                                                  cNumericFieldNames);
     623        1863 :         UtilityRoutines::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound);
     624             : 
     625        1863 :         state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).Name = cAlphaArgs(1);
     626        1863 :         state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).ctrlVarType = cAlphaArgs(2);
     627             :         // setup program flow control integers
     628        1863 :         if (UtilityRoutines::SameString(state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).ctrlVarType, "Temperature")) {
     629        1853 :             state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).CtrlTypeMode = CtrlVarType::Temp;
     630          10 :         } else if (UtilityRoutines::SameString(state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).ctrlVarType, "MaximumTemperature")) {
     631           0 :             state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).CtrlTypeMode = CtrlVarType::MaxTemp;
     632          10 :         } else if (UtilityRoutines::SameString(state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).ctrlVarType, "MinimumTemperature")) {
     633           0 :             state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).CtrlTypeMode = CtrlVarType::MinTemp;
     634          10 :         } else if (UtilityRoutines::SameString(state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).ctrlVarType, "HumidityRatio")) {
     635           0 :             state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).CtrlTypeMode = CtrlVarType::HumRat;
     636          10 :         } else if (UtilityRoutines::SameString(state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).ctrlVarType, "MaximumHumidityRatio")) {
     637           9 :             state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).CtrlTypeMode = CtrlVarType::MaxHumRat;
     638           1 :         } else if (UtilityRoutines::SameString(state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).ctrlVarType, "MinimumHumidityRatio")) {
     639           1 :             state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).CtrlTypeMode = CtrlVarType::MinHumRat;
     640           0 :         } else if (UtilityRoutines::SameString(state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).ctrlVarType, "MassFlowRate")) {
     641           0 :             state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).CtrlTypeMode = CtrlVarType::MassFlow;
     642           0 :         } else if (UtilityRoutines::SameString(state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).ctrlVarType, "MaximumMassFlowRate")) {
     643           0 :             state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).CtrlTypeMode = CtrlVarType::MaxMassFlow;
     644           0 :         } else if (UtilityRoutines::SameString(state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).ctrlVarType, "MinimumMassFlowRate")) {
     645           0 :             state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).CtrlTypeMode = CtrlVarType::MinMassFlow;
     646             :         } else {
     647           0 :             ShowSevereError(state, format("{}: {}=\"{}\", invalid field.", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
     648           0 :             ShowContinueError(state, "..invalid " + cAlphaFieldNames(2) + "=\"" + cAlphaArgs(2) + "\".");
     649           0 :             ShowContinueError(state, R"(..Valid values are "Temperature","MaximumTemperature","MinimumTemperature",)");
     650           0 :             ShowContinueError(state, R"(     "HumidityRatio","MaximumHumidityRatio","MinimumHumidityRatio","MassFlowRate",)");
     651           0 :             ShowContinueError(state, R"(     "MaximumMassFlowRate" or "MinimumMassFlowRate")");
     652           0 :             ErrorsFound = true;
     653             :         }
     654             : 
     655        1863 :         state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).Sched = cAlphaArgs(3);
     656        1863 :         state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).SchedPtr = GetScheduleIndex(state, cAlphaArgs(3));
     657        1863 :         if (state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).SchedPtr == 0) {
     658           0 :             if (lAlphaFieldBlanks(3)) {
     659           0 :                 ShowSevereError(state, format("{}: {}=\"{}\", blank required field.", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
     660           0 :                 ShowContinueError(state, "..required field " + cAlphaFieldNames(3));
     661             :             } else {
     662           0 :                 ShowSevereError(state, format("{}: {}=\"{}\", invalid field.", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
     663           0 :                 ShowContinueError(state, "..invalid " + cAlphaFieldNames(3) + "=\"" + cAlphaArgs(3) + "\".");
     664             :             }
     665           0 :             ErrorsFound = true;
     666             :         }
     667        1863 :         state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).CtrlNodeListName = cAlphaArgs(4);
     668        1863 :         NodeListError = false;
     669        3726 :         GetNodeNums(state,
     670        1863 :                     state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).CtrlNodeListName,
     671             :                     NumNodes,
     672             :                     NodeNums,
     673             :                     NodeListError,
     674             :                     DataLoopNode::NodeFluidType::Blank,
     675             :                     DataLoopNode::ConnectionObjectType::SetpointManagerScheduled,
     676        1863 :                     cAlphaArgs(1),
     677             :                     DataLoopNode::ConnectionType::SetPoint,
     678             :                     NodeInputManager::CompFluidStream::Primary,
     679             :                     ObjectIsNotParent,
     680             :                     false,
     681        1863 :                     cAlphaFieldNames(4));
     682             : 
     683        1863 :         if (!NodeListError) {
     684        1863 :             NumNodesCtrld = NumNodes;
     685        1863 :             state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld);
     686        1863 :             state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).NumCtrlNodes = NumNodesCtrld;
     687        1863 :             state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).SetPt = 0.0;
     688             : 
     689        3766 :             for (CtrldNodeNum = 1; CtrldNodeNum <= NumNodesCtrld; ++CtrldNodeNum) {
     690        1903 :                 state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum) = NodeNums(CtrldNodeNum);
     691             :             }
     692             :         } else {
     693           0 :             ErrorsFound = true;
     694             :         }
     695             : 
     696        1863 :         AllSetPtMgrNum = SetPtMgrNum;
     697             : 
     698        1863 :         if (!NodeListError) {
     699        1863 :             state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld);
     700        1863 :             state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlNodes = state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).CtrlNodes;
     701             :         }
     702        1863 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).Name = state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).Name;
     703        1863 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).SPMType = SetPointManagerType::Scheduled;
     704        1863 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).SPMIndex = SetPtMgrNum;
     705        1863 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlTypeMode = state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).CtrlTypeMode;
     706        1863 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).NumCtrlNodes = state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).NumCtrlNodes;
     707             :     }
     708             : 
     709             :     // Input the Scheduled Setpoint Managers DUAL SETPOINT
     710             : 
     711         775 :     if (state.dataSetPointManager->NumDualSchSetPtMgrs > 0)
     712          30 :         state.dataSetPointManager->DualSchSetPtMgr.allocate(
     713          30 :             state.dataSetPointManager->NumDualSchSetPtMgrs); // Allocate the Setpoint Manager input data array
     714             : 
     715             :     // Input the data for each Setpoint Manager
     716         775 :     cCurrentModuleObject = "SetpointManager:Scheduled:DualSetpoint";
     717             : 
     718         797 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumDualSchSetPtMgrs; ++SetPtMgrNum) {
     719          22 :         state.dataInputProcessing->inputProcessor->getObjectItem(state,
     720             :                                                                  cCurrentModuleObject,
     721             :                                                                  SetPtMgrNum,
     722             :                                                                  cAlphaArgs,
     723             :                                                                  NumAlphas,
     724             :                                                                  rNumericArgs,
     725             :                                                                  NumNums,
     726             :                                                                  IOStat,
     727             :                                                                  lNumericFieldBlanks,
     728             :                                                                  lAlphaFieldBlanks,
     729             :                                                                  cAlphaFieldNames,
     730             :                                                                  cNumericFieldNames);
     731          22 :         UtilityRoutines::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound);
     732             : 
     733          22 :         state.dataSetPointManager->DualSchSetPtMgr(SetPtMgrNum).Name = cAlphaArgs(1);
     734          22 :         state.dataSetPointManager->DualSchSetPtMgr(SetPtMgrNum).ctrlVarType = cAlphaArgs(2);
     735          22 :         if (UtilityRoutines::SameString(state.dataSetPointManager->DualSchSetPtMgr(SetPtMgrNum).ctrlVarType, "Temperature")) {
     736          22 :             state.dataSetPointManager->DualSchSetPtMgr(SetPtMgrNum).CtrlTypeMode = CtrlVarType::Temp;
     737             :         } else {
     738             :             // should not come here if idd type choice and key list is working
     739           0 :             ShowSevereError(state, format("{}: {}=\"{}\", invalid field.", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
     740           0 :             ShowContinueError(state, "..invalid " + cAlphaFieldNames(2) + "=\"" + cAlphaArgs(2) + "\".");
     741           0 :             ShowContinueError(state, "..Valid value is \"Temperature\".");
     742           0 :             ErrorsFound = true;
     743             :         }
     744          22 :         state.dataSetPointManager->DualSchSetPtMgr(SetPtMgrNum).SchedHi = cAlphaArgs(3);
     745          22 :         state.dataSetPointManager->DualSchSetPtMgr(SetPtMgrNum).SchedPtrHi = GetScheduleIndex(state, cAlphaArgs(3));
     746          22 :         if (state.dataSetPointManager->DualSchSetPtMgr(SetPtMgrNum).SchedPtrHi == 0) {
     747           0 :             if (lAlphaFieldBlanks(3)) {
     748           0 :                 ShowSevereError(state, format("{}: {}=\"{}\", blank required field.", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
     749           0 :                 ShowContinueError(state, "..required field " + cAlphaFieldNames(3));
     750             :             } else {
     751           0 :                 ShowSevereError(state, format("{}: {}=\"{}\", invalid field.", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
     752           0 :                 ShowContinueError(state, "..invalid " + cAlphaFieldNames(3) + "=\"" + cAlphaArgs(3) + "\".");
     753             :             }
     754           0 :             ErrorsFound = true;
     755             :         }
     756          22 :         state.dataSetPointManager->DualSchSetPtMgr(SetPtMgrNum).SchedLo = cAlphaArgs(4);
     757          22 :         state.dataSetPointManager->DualSchSetPtMgr(SetPtMgrNum).SchedPtrLo = GetScheduleIndex(state, cAlphaArgs(4));
     758          22 :         if (state.dataSetPointManager->DualSchSetPtMgr(SetPtMgrNum).SchedPtrLo == 0) {
     759           0 :             if (lAlphaFieldBlanks(4)) {
     760           0 :                 ShowSevereError(state, format("{}: {}=\"{}\", blank required field.", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
     761           0 :                 ShowContinueError(state, "..required field " + cAlphaFieldNames(4));
     762             :             } else {
     763           0 :                 ShowSevereError(state, format("{}: {}=\"{}\", invalid field.", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
     764           0 :                 ShowContinueError(state, "..invalid " + cAlphaFieldNames(4) + "=\"" + cAlphaArgs(4) + "\".");
     765             :             }
     766           0 :             ErrorsFound = true;
     767             :         }
     768          22 :         state.dataSetPointManager->DualSchSetPtMgr(SetPtMgrNum).CtrlNodeListName = cAlphaArgs(5);
     769          22 :         NodeListError = false;
     770          44 :         GetNodeNums(state,
     771          22 :                     state.dataSetPointManager->DualSchSetPtMgr(SetPtMgrNum).CtrlNodeListName,
     772             :                     NumNodes,
     773             :                     NodeNums,
     774             :                     NodeListError,
     775             :                     DataLoopNode::NodeFluidType::Blank,
     776             :                     DataLoopNode::ConnectionObjectType::SetpointManagerScheduledDualSetpoint,
     777          22 :                     cAlphaArgs(1),
     778             :                     DataLoopNode::ConnectionType::SetPoint,
     779             :                     NodeInputManager::CompFluidStream::Primary,
     780             :                     ObjectIsNotParent,
     781             :                     false,
     782          22 :                     cAlphaFieldNames(5));
     783             : 
     784          22 :         if (!NodeListError) {
     785          22 :             NumNodesCtrld = NumNodes;
     786          22 :             state.dataSetPointManager->DualSchSetPtMgr(SetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld);
     787          22 :             state.dataSetPointManager->DualSchSetPtMgr(SetPtMgrNum).NumCtrlNodes = NumNodesCtrld;
     788          22 :             state.dataSetPointManager->DualSchSetPtMgr(SetPtMgrNum).SetPtHi = 0.0;
     789          22 :             state.dataSetPointManager->DualSchSetPtMgr(SetPtMgrNum).SetPtLo = 0.0;
     790             : 
     791          52 :             for (CtrldNodeNum = 1; CtrldNodeNum <= NumNodesCtrld; ++CtrldNodeNum) {
     792          30 :                 state.dataSetPointManager->DualSchSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum) = NodeNums(CtrldNodeNum);
     793             :             }
     794             :         } else { // check getnodenums/nodelist
     795           0 :             ErrorsFound = true;
     796             :         }
     797             : 
     798          22 :         AllSetPtMgrNum = SetPtMgrNum + state.dataSetPointManager->NumSchSetPtMgrs;
     799             : 
     800          22 :         if (!NodeListError) {
     801          22 :             state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld);
     802          22 :             state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlNodes = state.dataSetPointManager->DualSchSetPtMgr(SetPtMgrNum).CtrlNodes;
     803             :         }
     804          22 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).Name = state.dataSetPointManager->DualSchSetPtMgr(SetPtMgrNum).Name;
     805          22 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).SPMType = SetPointManagerType::ScheduledDual;
     806          22 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).SPMIndex = SetPtMgrNum;
     807          22 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlTypeMode = state.dataSetPointManager->DualSchSetPtMgr(SetPtMgrNum).CtrlTypeMode;
     808          22 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).NumCtrlNodes = state.dataSetPointManager->DualSchSetPtMgr(SetPtMgrNum).NumCtrlNodes;
     809             :     }
     810             : 
     811             :     // Input the Outside Air Setpoint Managers
     812             : 
     813         775 :     if (state.dataSetPointManager->NumOutAirSetPtMgrs > 0)
     814          98 :         state.dataSetPointManager->OutAirSetPtMgr.allocate(
     815          98 :             state.dataSetPointManager->NumOutAirSetPtMgrs); // Allocate the Setpoint Manager input data array
     816             : 
     817             :     // Input the data for each Setpoint Manager
     818         775 :     cCurrentModuleObject = "SetpointManager:OutdoorAirReset";
     819             : 
     820         874 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumOutAirSetPtMgrs; ++SetPtMgrNum) {
     821          99 :         state.dataInputProcessing->inputProcessor->getObjectItem(state,
     822             :                                                                  cCurrentModuleObject,
     823             :                                                                  SetPtMgrNum,
     824             :                                                                  cAlphaArgs,
     825             :                                                                  NumAlphas,
     826             :                                                                  rNumericArgs,
     827             :                                                                  NumNums,
     828             :                                                                  IOStat,
     829             :                                                                  lNumericFieldBlanks,
     830             :                                                                  lAlphaFieldBlanks,
     831             :                                                                  cAlphaFieldNames,
     832             :                                                                  cNumericFieldNames);
     833          99 :         UtilityRoutines::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound);
     834             : 
     835          99 :         auto &thisOASetPtMgr = state.dataSetPointManager->OutAirSetPtMgr(SetPtMgrNum);
     836             : 
     837          99 :         thisOASetPtMgr.Name = cAlphaArgs(1);
     838          99 :         thisOASetPtMgr.ctrlVarType = cAlphaArgs(2);
     839          99 :         if (UtilityRoutines::SameString(thisOASetPtMgr.ctrlVarType, "Temperature")) {
     840          99 :             thisOASetPtMgr.CtrlTypeMode = CtrlVarType::Temp;
     841           0 :         } else if (UtilityRoutines::SameString(thisOASetPtMgr.ctrlVarType, "MaximumTemperature")) {
     842           0 :             thisOASetPtMgr.CtrlTypeMode = CtrlVarType::MaxTemp;
     843           0 :         } else if (UtilityRoutines::SameString(thisOASetPtMgr.ctrlVarType, "MinimumTemperature")) {
     844           0 :             thisOASetPtMgr.CtrlTypeMode = CtrlVarType::MinTemp;
     845             :         } else {
     846             :             // should not come here if idd type choice and key list is working
     847           0 :             ShowSevereError(state, format("{}: {}=\"{}\", invalid field.", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
     848           0 :             ShowContinueError(state, "..invalid " + cAlphaFieldNames(2) + "=\"" + cAlphaArgs(2) + "\".");
     849           0 :             ShowContinueError(state, "..Valid value is \"Temperature\".");
     850           0 :             ErrorsFound = true;
     851             :         }
     852          99 :         thisOASetPtMgr.OutLowSetPt1 = rNumericArgs(1);
     853          99 :         thisOASetPtMgr.OutLow1 = rNumericArgs(2);
     854          99 :         thisOASetPtMgr.OutHighSetPt1 = rNumericArgs(3);
     855          99 :         thisOASetPtMgr.OutHigh1 = rNumericArgs(4);
     856          99 :         thisOASetPtMgr.CtrlNodeListName = cAlphaArgs(3);
     857          99 :         if (thisOASetPtMgr.OutHigh1 < thisOASetPtMgr.OutLow1) {
     858           0 :             ShowWarningError(state, format("{}: {}=\"{}\", invalid field.", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
     859           0 :             ShowContinueError(state,
     860           0 :                               format("...{}=[{:.1R}] is less than {}=[{:.1R}].",
     861             :                                      cNumericFieldNames(4),
     862             :                                      thisOASetPtMgr.OutHigh1,
     863             :                                      cNumericFieldNames(2),
     864           0 :                                      thisOASetPtMgr.OutLow1));
     865             :         }
     866             :         // Get optional input: schedule and 2nd reset rule
     867          99 :         if (NumAlphas == 4 && NumNums == 8) {
     868           0 :             thisOASetPtMgr.SchedPtr = GetScheduleIndex(state, cAlphaArgs(4)); // Schedule is optional here, so no check on SchedPtr
     869           0 :             if (thisOASetPtMgr.SchedPtr > 0) {                                // Only check schedule values if a schedule was entered
     870           0 :                 Real64 minValSched = GetScheduleMinValue(state, thisOASetPtMgr.SchedPtr);
     871           0 :                 Real64 maxValSched = GetScheduleMaxValue(state, thisOASetPtMgr.SchedPtr);
     872           0 :                 if ((minValSched < 1.0) || (maxValSched > 2.0)) {
     873           0 :                     ShowSevereError(state, format("{}: {}=\"{}\", invalid field.", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
     874           0 :                     ShowContinueError(state, "..Schedule Values for the Outdoor Reset Schedule must be either 1 or 2");
     875           0 :                     ShowContinueError(state, format("..Minimum Schedule Value = {} ", minValSched));
     876           0 :                     ShowContinueError(state, format("..Maximum Schedule Value = {} ", minValSched));
     877           0 :                     ShowContinueError(
     878           0 :                         state, format("..Adjust the schedule values so that all of them are either 1 or 2 in schedule = \"{}\"", cAlphaArgs(4)));
     879           0 :                     ErrorsFound = true;
     880             :                 }
     881             :             }
     882           0 :             thisOASetPtMgr.OutLowSetPt2 = rNumericArgs(5);
     883           0 :             thisOASetPtMgr.OutLow2 = rNumericArgs(6);
     884           0 :             thisOASetPtMgr.OutHighSetPt2 = rNumericArgs(7);
     885           0 :             thisOASetPtMgr.OutHigh2 = rNumericArgs(8);
     886           0 :             if (thisOASetPtMgr.OutHigh2 < thisOASetPtMgr.OutLow2) {
     887           0 :                 ShowWarningError(state, format("{}: {}=\"{}\", invalid field.", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
     888           0 :                 ShowContinueError(state,
     889           0 :                                   format("...{}=[{:.1R}] is less than {}=[{:.1R}].",
     890             :                                          cNumericFieldNames(8),
     891             :                                          thisOASetPtMgr.OutHigh2,
     892             :                                          cNumericFieldNames(6),
     893           0 :                                          thisOASetPtMgr.OutLow2));
     894           0 :             }
     895             :         } else {
     896          99 :             thisOASetPtMgr.SchedPtr = 0;
     897          99 :             thisOASetPtMgr.OutLowSetPt2 = 0.0;
     898          99 :             thisOASetPtMgr.OutLow2 = 0.0;
     899          99 :             thisOASetPtMgr.OutHighSetPt2 = 0.0;
     900          99 :             thisOASetPtMgr.OutHigh2 = 0.0;
     901             :         }
     902          99 :         NodeListError = false;
     903         198 :         GetNodeNums(state,
     904             :                     thisOASetPtMgr.CtrlNodeListName,
     905             :                     NumNodes,
     906             :                     NodeNums,
     907             :                     NodeListError,
     908             :                     DataLoopNode::NodeFluidType::Blank,
     909             :                     DataLoopNode::ConnectionObjectType::SetpointManagerOutdoorAirReset,
     910          99 :                     cAlphaArgs(1),
     911             :                     DataLoopNode::ConnectionType::SetPoint,
     912             :                     NodeInputManager::CompFluidStream::Primary,
     913             :                     ObjectIsNotParent,
     914             :                     false,
     915          99 :                     cAlphaFieldNames(3));
     916          99 :         if (!NodeListError) {
     917          99 :             NumNodesCtrld = NumNodes;
     918          99 :             thisOASetPtMgr.CtrlNodes.allocate(NumNodesCtrld);
     919          99 :             thisOASetPtMgr.NumCtrlNodes = NumNodesCtrld;
     920          99 :             thisOASetPtMgr.SetPt = 0.0;
     921             : 
     922         226 :             for (CtrldNodeNum = 1; CtrldNodeNum <= NumNodesCtrld; ++CtrldNodeNum) {
     923         127 :                 thisOASetPtMgr.CtrlNodes(CtrldNodeNum) = NodeNums(CtrldNodeNum);
     924             :             }
     925             :         } else {
     926           0 :             ErrorsFound = true;
     927             :         }
     928             : 
     929          99 :         AllSetPtMgrNum = SetPtMgrNum + state.dataSetPointManager->NumSchSetPtMgrs + state.dataSetPointManager->NumDualSchSetPtMgrs;
     930          99 :         auto &allOASetPtMgr = state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum);
     931          99 :         if (!NodeListError) {
     932          99 :             allOASetPtMgr.CtrlNodes.allocate(NumNodesCtrld);
     933          99 :             allOASetPtMgr.CtrlNodes = thisOASetPtMgr.CtrlNodes;
     934             :         }
     935          99 :         allOASetPtMgr.Name = thisOASetPtMgr.Name;
     936          99 :         allOASetPtMgr.SPMType = SetPointManagerType::OutsideAir;
     937          99 :         allOASetPtMgr.SPMIndex = SetPtMgrNum;
     938          99 :         allOASetPtMgr.CtrlTypeMode = thisOASetPtMgr.CtrlTypeMode;
     939          99 :         allOASetPtMgr.NumCtrlNodes = thisOASetPtMgr.NumCtrlNodes;
     940             :     }
     941             : 
     942             :     // Input the Single Zone Reheat Setpoint Managers
     943             : 
     944         775 :     if (state.dataSetPointManager->NumSZRhSetPtMgrs > 0)
     945         144 :         state.dataSetPointManager->SingZoneRhSetPtMgr.allocate(
     946         144 :             state.dataSetPointManager->NumSZRhSetPtMgrs); // Allocate the Setpoint Manager input data array
     947             : 
     948             :     // Input the data for each Setpoint Manager
     949         775 :     cCurrentModuleObject = "SetpointManager:SingleZone:Reheat";
     950             : 
     951        1061 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumSZRhSetPtMgrs; ++SetPtMgrNum) {
     952         286 :         state.dataInputProcessing->inputProcessor->getObjectItem(state,
     953             :                                                                  cCurrentModuleObject,
     954             :                                                                  SetPtMgrNum,
     955             :                                                                  cAlphaArgs,
     956             :                                                                  NumAlphas,
     957             :                                                                  rNumericArgs,
     958             :                                                                  NumNums,
     959             :                                                                  IOStat,
     960             :                                                                  lNumericFieldBlanks,
     961             :                                                                  lAlphaFieldBlanks,
     962             :                                                                  cAlphaFieldNames,
     963             :                                                                  cNumericFieldNames);
     964         286 :         UtilityRoutines::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound);
     965             : 
     966         286 :         state.dataSetPointManager->SingZoneRhSetPtMgr(SetPtMgrNum).Name = cAlphaArgs(1);
     967         286 :         state.dataSetPointManager->SingZoneRhSetPtMgr(SetPtMgrNum).ctrlVarType = cAlphaArgs(2);
     968         286 :         if (UtilityRoutines::SameString(state.dataSetPointManager->SingZoneRhSetPtMgr(SetPtMgrNum).ctrlVarType, "Temperature")) {
     969         286 :             state.dataSetPointManager->SingZoneRhSetPtMgr(SetPtMgrNum).CtrlTypeMode = CtrlVarType::Temp;
     970             :         } else {
     971             :             // should not come here if idd type choice and key list is working
     972           0 :             ShowSevereError(state, format("{}: {}=\"{}\", invalid field.", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
     973           0 :             ShowContinueError(state, "..invalid " + cAlphaFieldNames(2) + "=\"" + cAlphaArgs(2) + "\".");
     974           0 :             ShowContinueError(state, "..Valid value is \"Temperature\".");
     975           0 :             ErrorsFound = true;
     976             :         }
     977         286 :         state.dataSetPointManager->SingZoneRhSetPtMgr(SetPtMgrNum).ControlZoneName = cAlphaArgs(3);
     978         286 :         state.dataSetPointManager->SingZoneRhSetPtMgr(SetPtMgrNum).MinSetTemp = rNumericArgs(1);
     979         286 :         state.dataSetPointManager->SingZoneRhSetPtMgr(SetPtMgrNum).MaxSetTemp = rNumericArgs(2);
     980         572 :         if (state.dataSetPointManager->SingZoneRhSetPtMgr(SetPtMgrNum).MaxSetTemp <
     981         286 :             state.dataSetPointManager->SingZoneRhSetPtMgr(SetPtMgrNum).MinSetTemp) {
     982           0 :             ShowWarningError(state, format("{}: {}=\"{}\",", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
     983           0 :             ShowContinueError(state,
     984           0 :                               format("...{}=[{:.1R}] is less than {}=[{:.1R}].",
     985             :                                      cNumericFieldNames(2),
     986           0 :                                      state.dataSetPointManager->SingZoneRhSetPtMgr(SetPtMgrNum).MaxSetTemp,
     987             :                                      cNumericFieldNames(1),
     988           0 :                                      state.dataSetPointManager->SingZoneRhSetPtMgr(SetPtMgrNum).MinSetTemp));
     989             :         }
     990         286 :         state.dataSetPointManager->SingZoneRhSetPtMgr(SetPtMgrNum).ZoneNodeNum =
     991         572 :             GetOnlySingleNode(state,
     992         286 :                               cAlphaArgs(4),
     993             :                               ErrorsFound,
     994             :                               DataLoopNode::ConnectionObjectType::SetpointManagerSingleZoneReheat,
     995         286 :                               cAlphaArgs(1),
     996             :                               DataLoopNode::NodeFluidType::Air,
     997             :                               DataLoopNode::ConnectionType::Sensor,
     998             :                               NodeInputManager::CompFluidStream::Primary,
     999         286 :                               ObjectIsNotParent);
    1000         286 :         state.dataSetPointManager->SingZoneRhSetPtMgr(SetPtMgrNum).ZoneInletNodeNum =
    1001         572 :             GetOnlySingleNode(state,
    1002         286 :                               cAlphaArgs(5),
    1003             :                               ErrorsFound,
    1004             :                               DataLoopNode::ConnectionObjectType::SetpointManagerSingleZoneReheat,
    1005         286 :                               cAlphaArgs(1),
    1006             :                               DataLoopNode::NodeFluidType::Air,
    1007             :                               DataLoopNode::ConnectionType::Sensor,
    1008             :                               NodeInputManager::CompFluidStream::Primary,
    1009         286 :                               ObjectIsNotParent);
    1010         286 :         NodeListError = false;
    1011         572 :         GetNodeNums(state,
    1012         286 :                     cAlphaArgs(6),
    1013             :                     NumNodes,
    1014             :                     NodeNums,
    1015             :                     NodeListError,
    1016             :                     DataLoopNode::NodeFluidType::Blank,
    1017             :                     DataLoopNode::ConnectionObjectType::SetpointManagerSingleZoneReheat,
    1018         286 :                     cAlphaArgs(1),
    1019             :                     DataLoopNode::ConnectionType::SetPoint,
    1020             :                     NodeInputManager::CompFluidStream::Primary,
    1021             :                     ObjectIsNotParent,
    1022             :                     false,
    1023         286 :                     cAlphaFieldNames(6)); // setpoint nodes
    1024         286 :         if (!NodeListError) {
    1025         286 :             NumNodesCtrld = NumNodes;
    1026         286 :             state.dataSetPointManager->SingZoneRhSetPtMgr(SetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld);
    1027         286 :             state.dataSetPointManager->SingZoneRhSetPtMgr(SetPtMgrNum).NumCtrlNodes = NumNodesCtrld;
    1028         286 :             state.dataSetPointManager->SingZoneRhSetPtMgr(SetPtMgrNum).SetPt = 0.0;
    1029             : 
    1030         595 :             for (CtrldNodeNum = 1; CtrldNodeNum <= NumNodesCtrld; ++CtrldNodeNum) {
    1031         309 :                 state.dataSetPointManager->SingZoneRhSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum) = NodeNums(CtrldNodeNum);
    1032             :             }
    1033             :         } else {
    1034           0 :             ErrorsFound = true;
    1035             :         }
    1036             : 
    1037             :         // get the actual zone number of the control zone
    1038         286 :         state.dataSetPointManager->SingZoneRhSetPtMgr(SetPtMgrNum).ControlZoneNum =
    1039         286 :             UtilityRoutines::FindItemInList(cAlphaArgs(3), state.dataHeatBal->Zone);
    1040         286 :         if (state.dataSetPointManager->SingZoneRhSetPtMgr(SetPtMgrNum).ControlZoneNum == 0) {
    1041           0 :             ShowSevereError(state, format("{}: {}=\"{}\", invalid field.", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
    1042           0 :             ShowContinueError(state, "..invalid " + cAlphaFieldNames(3) + "=\"" + cAlphaArgs(3) + "\".");
    1043           0 :             ErrorsFound = true;
    1044             :         }
    1045         286 :         state.dataSetPointManager->SingZoneRhSetPtMgr(SetPtMgrNum).SetPt = 0.0;
    1046             : 
    1047         572 :         AllSetPtMgrNum = SetPtMgrNum + state.dataSetPointManager->NumSchSetPtMgrs + state.dataSetPointManager->NumDualSchSetPtMgrs +
    1048         286 :                          state.dataSetPointManager->NumOutAirSetPtMgrs;
    1049             : 
    1050         286 :         if (!NodeListError) {
    1051         286 :             state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld);
    1052         286 :             state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlNodes = state.dataSetPointManager->SingZoneRhSetPtMgr(SetPtMgrNum).CtrlNodes;
    1053             :         }
    1054         286 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).Name = state.dataSetPointManager->SingZoneRhSetPtMgr(SetPtMgrNum).Name;
    1055         286 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).SPMType = SetPointManagerType::SZReheat;
    1056         286 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).SPMIndex = SetPtMgrNum;
    1057         286 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlTypeMode = state.dataSetPointManager->SingZoneRhSetPtMgr(SetPtMgrNum).CtrlTypeMode;
    1058         286 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).NumCtrlNodes = state.dataSetPointManager->SingZoneRhSetPtMgr(SetPtMgrNum).NumCtrlNodes;
    1059             :     }
    1060             : 
    1061             :     // Input the Single Zone Heating Setpoint Managers
    1062             : 
    1063         775 :     if (state.dataSetPointManager->NumSZHtSetPtMgrs > 0)
    1064          40 :         state.dataSetPointManager->SingZoneHtSetPtMgr.allocate(
    1065          40 :             state.dataSetPointManager->NumSZHtSetPtMgrs); // Allocate the Setpoint Manager input data array
    1066             : 
    1067             :     // Input the data for each Setpoint Manager
    1068         775 :     cCurrentModuleObject = "SetpointManager:SingleZone:Heating";
    1069             : 
    1070         862 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumSZHtSetPtMgrs; ++SetPtMgrNum) {
    1071          87 :         state.dataInputProcessing->inputProcessor->getObjectItem(state,
    1072             :                                                                  cCurrentModuleObject,
    1073             :                                                                  SetPtMgrNum,
    1074             :                                                                  cAlphaArgs,
    1075             :                                                                  NumAlphas,
    1076             :                                                                  rNumericArgs,
    1077             :                                                                  NumNums,
    1078             :                                                                  IOStat,
    1079             :                                                                  lNumericFieldBlanks,
    1080             :                                                                  lAlphaFieldBlanks,
    1081             :                                                                  cAlphaFieldNames,
    1082             :                                                                  cNumericFieldNames);
    1083          87 :         UtilityRoutines::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound);
    1084             : 
    1085          87 :         state.dataSetPointManager->SingZoneHtSetPtMgr(SetPtMgrNum).Name = cAlphaArgs(1);
    1086          87 :         state.dataSetPointManager->SingZoneHtSetPtMgr(SetPtMgrNum).ctrlVarType = cAlphaArgs(2);
    1087          87 :         if (UtilityRoutines::SameString(state.dataSetPointManager->SingZoneHtSetPtMgr(SetPtMgrNum).ctrlVarType, "Temperature")) {
    1088          87 :             state.dataSetPointManager->SingZoneHtSetPtMgr(SetPtMgrNum).CtrlTypeMode = CtrlVarType::Temp;
    1089             :         } else {
    1090             :             // should not come here if idd type choice and key list is working
    1091           0 :             ShowSevereError(state, format("{}: {}=\"{}\", invalid field.", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
    1092           0 :             ShowContinueError(state, "..invalid " + cAlphaFieldNames(2) + "=\"" + cAlphaArgs(2) + "\".");
    1093           0 :             ShowContinueError(state, "..Valid value is \"Temperature\".");
    1094           0 :             ErrorsFound = true;
    1095             :         }
    1096          87 :         state.dataSetPointManager->SingZoneHtSetPtMgr(SetPtMgrNum).ControlZoneName = cAlphaArgs(3);
    1097          87 :         state.dataSetPointManager->SingZoneHtSetPtMgr(SetPtMgrNum).MinSetTemp = rNumericArgs(1);
    1098          87 :         state.dataSetPointManager->SingZoneHtSetPtMgr(SetPtMgrNum).MaxSetTemp = rNumericArgs(2);
    1099         174 :         if (state.dataSetPointManager->SingZoneHtSetPtMgr(SetPtMgrNum).MaxSetTemp <
    1100          87 :             state.dataSetPointManager->SingZoneHtSetPtMgr(SetPtMgrNum).MinSetTemp) {
    1101           0 :             ShowWarningError(state, format("{}: {}=\"{}\",", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
    1102           0 :             ShowContinueError(state,
    1103           0 :                               format("...{}=[{:.1R}] is less than {}=[{:.1R}].",
    1104             :                                      cNumericFieldNames(2),
    1105           0 :                                      state.dataSetPointManager->SingZoneHtSetPtMgr(SetPtMgrNum).MaxSetTemp,
    1106             :                                      cNumericFieldNames(1),
    1107           0 :                                      state.dataSetPointManager->SingZoneHtSetPtMgr(SetPtMgrNum).MinSetTemp));
    1108             :         }
    1109          87 :         state.dataSetPointManager->SingZoneHtSetPtMgr(SetPtMgrNum).ZoneNodeNum =
    1110         174 :             GetOnlySingleNode(state,
    1111          87 :                               cAlphaArgs(4),
    1112             :                               ErrorsFound,
    1113             :                               DataLoopNode::ConnectionObjectType::SetpointManagerSingleZoneHeating,
    1114          87 :                               cAlphaArgs(1),
    1115             :                               DataLoopNode::NodeFluidType::Air,
    1116             :                               DataLoopNode::ConnectionType::Sensor,
    1117             :                               NodeInputManager::CompFluidStream::Primary,
    1118          87 :                               ObjectIsNotParent);
    1119          87 :         state.dataSetPointManager->SingZoneHtSetPtMgr(SetPtMgrNum).ZoneInletNodeNum =
    1120         174 :             GetOnlySingleNode(state,
    1121          87 :                               cAlphaArgs(5),
    1122             :                               ErrorsFound,
    1123             :                               DataLoopNode::ConnectionObjectType::SetpointManagerSingleZoneHeating,
    1124          87 :                               cAlphaArgs(1),
    1125             :                               DataLoopNode::NodeFluidType::Air,
    1126             :                               DataLoopNode::ConnectionType::Sensor,
    1127             :                               NodeInputManager::CompFluidStream::Primary,
    1128          87 :                               ObjectIsNotParent);
    1129          87 :         NodeListError = false;
    1130         174 :         GetNodeNums(state,
    1131          87 :                     cAlphaArgs(6),
    1132             :                     NumNodes,
    1133             :                     NodeNums,
    1134             :                     NodeListError,
    1135             :                     DataLoopNode::NodeFluidType::Blank,
    1136             :                     DataLoopNode::ConnectionObjectType::SetpointManagerSingleZoneHeating,
    1137          87 :                     cAlphaArgs(1),
    1138             :                     DataLoopNode::ConnectionType::SetPoint,
    1139             :                     NodeInputManager::CompFluidStream::Primary,
    1140             :                     ObjectIsNotParent,
    1141             :                     false,
    1142          87 :                     cAlphaFieldNames(6)); // setpoint nodes
    1143          87 :         if (!NodeListError) {
    1144          87 :             NumNodesCtrld = NumNodes;
    1145          87 :             state.dataSetPointManager->SingZoneHtSetPtMgr(SetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld);
    1146          87 :             state.dataSetPointManager->SingZoneHtSetPtMgr(SetPtMgrNum).NumCtrlNodes = NumNodesCtrld;
    1147          87 :             state.dataSetPointManager->SingZoneHtSetPtMgr(SetPtMgrNum).SetPt = 0.0;
    1148             : 
    1149         175 :             for (CtrldNodeNum = 1; CtrldNodeNum <= NumNodesCtrld; ++CtrldNodeNum) {
    1150          88 :                 state.dataSetPointManager->SingZoneHtSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum) = NodeNums(CtrldNodeNum);
    1151             :             }
    1152             :         } else {
    1153           0 :             ErrorsFound = true;
    1154             :         }
    1155             : 
    1156             :         // get the actual zone number of the control zone
    1157          87 :         state.dataSetPointManager->SingZoneHtSetPtMgr(SetPtMgrNum).ControlZoneNum =
    1158          87 :             UtilityRoutines::FindItemInList(cAlphaArgs(3), state.dataHeatBal->Zone);
    1159          87 :         if (state.dataSetPointManager->SingZoneHtSetPtMgr(SetPtMgrNum).ControlZoneNum == 0) {
    1160           0 :             ShowSevereError(state, format("{}: {}=\"{}\", invalid field.", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
    1161           0 :             ShowContinueError(state, "..invalid " + cAlphaFieldNames(3) + "=\"" + cAlphaArgs(3) + "\".");
    1162           0 :             ErrorsFound = true;
    1163             :         }
    1164          87 :         state.dataSetPointManager->SingZoneHtSetPtMgr(SetPtMgrNum).SetPt = 0.0;
    1165             : 
    1166         261 :         AllSetPtMgrNum = SetPtMgrNum + state.dataSetPointManager->NumSchSetPtMgrs + state.dataSetPointManager->NumDualSchSetPtMgrs +
    1167         174 :                          state.dataSetPointManager->NumOutAirSetPtMgrs + state.dataSetPointManager->NumSZRhSetPtMgrs;
    1168             : 
    1169          87 :         if (!NodeListError) {
    1170          87 :             state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld);
    1171          87 :             state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlNodes = state.dataSetPointManager->SingZoneHtSetPtMgr(SetPtMgrNum).CtrlNodes;
    1172             :         }
    1173          87 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).Name = state.dataSetPointManager->SingZoneHtSetPtMgr(SetPtMgrNum).Name;
    1174          87 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).SPMType = SetPointManagerType::SZHeating;
    1175          87 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).SPMIndex = SetPtMgrNum;
    1176          87 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlTypeMode = state.dataSetPointManager->SingZoneHtSetPtMgr(SetPtMgrNum).CtrlTypeMode;
    1177          87 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).NumCtrlNodes = state.dataSetPointManager->SingZoneHtSetPtMgr(SetPtMgrNum).NumCtrlNodes;
    1178             :     }
    1179             : 
    1180             :     // Input the Single Zone Cooling Setpoint Managers
    1181             : 
    1182         775 :     if (state.dataSetPointManager->NumSZClSetPtMgrs > 0)
    1183         100 :         state.dataSetPointManager->SingZoneClSetPtMgr.allocate(
    1184         100 :             state.dataSetPointManager->NumSZClSetPtMgrs); // Allocate the Setpoint Manager input data array
    1185             : 
    1186             :     // Input the data for each Setpoint Manager
    1187         775 :     cCurrentModuleObject = "SetpointManager:SingleZone:Cooling";
    1188         981 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumSZClSetPtMgrs; ++SetPtMgrNum) {
    1189         206 :         state.dataInputProcessing->inputProcessor->getObjectItem(state,
    1190             :                                                                  cCurrentModuleObject,
    1191             :                                                                  SetPtMgrNum,
    1192             :                                                                  cAlphaArgs,
    1193             :                                                                  NumAlphas,
    1194             :                                                                  rNumericArgs,
    1195             :                                                                  NumNums,
    1196             :                                                                  IOStat,
    1197             :                                                                  lNumericFieldBlanks,
    1198             :                                                                  lAlphaFieldBlanks,
    1199             :                                                                  cAlphaFieldNames,
    1200             :                                                                  cNumericFieldNames);
    1201         206 :         UtilityRoutines::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound);
    1202             : 
    1203         206 :         state.dataSetPointManager->SingZoneClSetPtMgr(SetPtMgrNum).Name = cAlphaArgs(1);
    1204         206 :         state.dataSetPointManager->SingZoneClSetPtMgr(SetPtMgrNum).ctrlVarType = cAlphaArgs(2);
    1205         206 :         if (UtilityRoutines::SameString(state.dataSetPointManager->SingZoneClSetPtMgr(SetPtMgrNum).ctrlVarType, "Temperature")) {
    1206         206 :             state.dataSetPointManager->SingZoneClSetPtMgr(SetPtMgrNum).CtrlTypeMode = CtrlVarType::Temp;
    1207             :         } else {
    1208             :             // should not come here if idd type choice and key list is working
    1209           0 :             ShowSevereError(state, format("{}: {}=\"{}\", invalid field.", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
    1210           0 :             ShowContinueError(state, "..invalid " + cAlphaFieldNames(2) + "=\"" + cAlphaArgs(2) + "\".");
    1211           0 :             ShowContinueError(state, "..Valid value is \"Temperature\".");
    1212           0 :             ErrorsFound = true;
    1213             :         }
    1214         206 :         state.dataSetPointManager->SingZoneClSetPtMgr(SetPtMgrNum).ControlZoneName = cAlphaArgs(3);
    1215         206 :         state.dataSetPointManager->SingZoneClSetPtMgr(SetPtMgrNum).MinSetTemp = rNumericArgs(1);
    1216         206 :         state.dataSetPointManager->SingZoneClSetPtMgr(SetPtMgrNum).MaxSetTemp = rNumericArgs(2);
    1217         412 :         if (state.dataSetPointManager->SingZoneClSetPtMgr(SetPtMgrNum).MaxSetTemp <
    1218         206 :             state.dataSetPointManager->SingZoneClSetPtMgr(SetPtMgrNum).MinSetTemp) {
    1219           0 :             ShowWarningError(state, format("{}: {}=\"{}\",", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
    1220           0 :             ShowContinueError(state,
    1221           0 :                               format("...{}=[{:.1R}] is less than {}=[{:.1R}].",
    1222             :                                      cNumericFieldNames(2),
    1223           0 :                                      state.dataSetPointManager->SingZoneClSetPtMgr(SetPtMgrNum).MaxSetTemp,
    1224             :                                      cNumericFieldNames(1),
    1225           0 :                                      state.dataSetPointManager->SingZoneClSetPtMgr(SetPtMgrNum).MinSetTemp));
    1226             :         }
    1227         206 :         state.dataSetPointManager->SingZoneClSetPtMgr(SetPtMgrNum).ZoneNodeNum =
    1228         412 :             GetOnlySingleNode(state,
    1229         206 :                               cAlphaArgs(4),
    1230             :                               ErrorsFound,
    1231             :                               DataLoopNode::ConnectionObjectType::SetpointManagerSingleZoneCooling,
    1232         206 :                               cAlphaArgs(1),
    1233             :                               DataLoopNode::NodeFluidType::Air,
    1234             :                               DataLoopNode::ConnectionType::Sensor,
    1235             :                               NodeInputManager::CompFluidStream::Primary,
    1236         206 :                               ObjectIsNotParent);
    1237         206 :         state.dataSetPointManager->SingZoneClSetPtMgr(SetPtMgrNum).ZoneInletNodeNum =
    1238         412 :             GetOnlySingleNode(state,
    1239         206 :                               cAlphaArgs(5),
    1240             :                               ErrorsFound,
    1241             :                               DataLoopNode::ConnectionObjectType::SetpointManagerSingleZoneCooling,
    1242         206 :                               cAlphaArgs(1),
    1243             :                               DataLoopNode::NodeFluidType::Air,
    1244             :                               DataLoopNode::ConnectionType::Sensor,
    1245             :                               NodeInputManager::CompFluidStream::Primary,
    1246         206 :                               ObjectIsNotParent);
    1247         206 :         NodeListError = false;
    1248         412 :         GetNodeNums(state,
    1249         206 :                     cAlphaArgs(6),
    1250             :                     NumNodes,
    1251             :                     NodeNums,
    1252             :                     NodeListError,
    1253             :                     DataLoopNode::NodeFluidType::Blank,
    1254             :                     DataLoopNode::ConnectionObjectType::SetpointManagerSingleZoneCooling,
    1255         206 :                     cAlphaArgs(1),
    1256             :                     DataLoopNode::ConnectionType::SetPoint,
    1257             :                     NodeInputManager::CompFluidStream::Primary,
    1258             :                     ObjectIsNotParent,
    1259             :                     false,
    1260         206 :                     cAlphaFieldNames(6)); // setpoint nodes
    1261         206 :         if (!NodeListError) {
    1262         206 :             NumNodesCtrld = NumNodes;
    1263         206 :             state.dataSetPointManager->SingZoneClSetPtMgr(SetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld);
    1264         206 :             state.dataSetPointManager->SingZoneClSetPtMgr(SetPtMgrNum).NumCtrlNodes = NumNodesCtrld;
    1265         206 :             state.dataSetPointManager->SingZoneClSetPtMgr(SetPtMgrNum).SetPt = 0.0;
    1266             : 
    1267         436 :             for (CtrldNodeNum = 1; CtrldNodeNum <= NumNodesCtrld; ++CtrldNodeNum) {
    1268         230 :                 state.dataSetPointManager->SingZoneClSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum) = NodeNums(CtrldNodeNum);
    1269             :             }
    1270             :         } else {
    1271           0 :             ErrorsFound = true;
    1272             :         }
    1273             : 
    1274             :         // get the actual zone number of the control zone
    1275         206 :         state.dataSetPointManager->SingZoneClSetPtMgr(SetPtMgrNum).ControlZoneNum =
    1276         206 :             UtilityRoutines::FindItemInList(cAlphaArgs(3), state.dataHeatBal->Zone);
    1277         206 :         if (state.dataSetPointManager->SingZoneClSetPtMgr(SetPtMgrNum).ControlZoneNum == 0) {
    1278           0 :             ShowSevereError(state, format("{}: {}=\"{}\", invalid field.", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
    1279           0 :             ShowContinueError(state, "..invalid " + cAlphaFieldNames(3) + "=\"" + cAlphaArgs(3) + "\".");
    1280           0 :             ErrorsFound = true;
    1281             :         }
    1282         206 :         state.dataSetPointManager->SingZoneClSetPtMgr(SetPtMgrNum).SetPt = 0.0;
    1283             : 
    1284         618 :         AllSetPtMgrNum = SetPtMgrNum + state.dataSetPointManager->NumSchSetPtMgrs + state.dataSetPointManager->NumDualSchSetPtMgrs +
    1285         412 :                          state.dataSetPointManager->NumOutAirSetPtMgrs + state.dataSetPointManager->NumSZRhSetPtMgrs +
    1286         206 :                          state.dataSetPointManager->NumSZHtSetPtMgrs;
    1287             : 
    1288         206 :         if (!NodeListError) {
    1289         206 :             state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld);
    1290         206 :             state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlNodes = state.dataSetPointManager->SingZoneClSetPtMgr(SetPtMgrNum).CtrlNodes;
    1291             :         }
    1292         206 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).Name = state.dataSetPointManager->SingZoneClSetPtMgr(SetPtMgrNum).Name;
    1293         206 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).SPMType = SetPointManagerType::SZCooling;
    1294         206 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).SPMIndex = SetPtMgrNum;
    1295         206 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlTypeMode = state.dataSetPointManager->SingZoneClSetPtMgr(SetPtMgrNum).CtrlTypeMode;
    1296         206 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).NumCtrlNodes = state.dataSetPointManager->SingZoneClSetPtMgr(SetPtMgrNum).NumCtrlNodes;
    1297             :     }
    1298             : 
    1299             :     // Input the Single Zone Minimum Humidity Setpoint Managers
    1300             : 
    1301         775 :     if (state.dataSetPointManager->NumSZMinHumSetPtMgrs > 0)
    1302          17 :         state.dataSetPointManager->SZMinHumSetPtMgr.allocate(state.dataSetPointManager->NumSZMinHumSetPtMgrs);
    1303             : 
    1304             :     // Input the data for each Setpoint Manager
    1305         775 :     cCurrentModuleObject = "SetpointManager:SingleZone:Humidity:Minimum";
    1306         801 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumSZMinHumSetPtMgrs; ++SetPtMgrNum) {
    1307          26 :         state.dataInputProcessing->inputProcessor->getObjectItem(state,
    1308             :                                                                  cCurrentModuleObject,
    1309             :                                                                  SetPtMgrNum,
    1310             :                                                                  cAlphaArgs,
    1311             :                                                                  NumAlphas,
    1312             :                                                                  rNumericArgs,
    1313             :                                                                  NumNums,
    1314             :                                                                  IOStat,
    1315             :                                                                  lNumericFieldBlanks,
    1316             :                                                                  lAlphaFieldBlanks,
    1317             :                                                                  cAlphaFieldNames,
    1318             :                                                                  cNumericFieldNames);
    1319          26 :         UtilityRoutines::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound);
    1320             : 
    1321          26 :         state.dataSetPointManager->SZMinHumSetPtMgr(SetPtMgrNum).Name = cAlphaArgs(1);
    1322          26 :         state.dataSetPointManager->SZMinHumSetPtMgr(SetPtMgrNum).ctrlVarType = "MinimumHumidityRatio";
    1323          26 :         state.dataSetPointManager->SZMinHumSetPtMgr(SetPtMgrNum).CtrlTypeMode = CtrlVarType::MinHumRat;
    1324             : 
    1325          26 :         NodeListError = false;
    1326          52 :         GetNodeNums(state,
    1327          26 :                     cAlphaArgs(2),
    1328             :                     NumNodes,
    1329             :                     NodeNums,
    1330             :                     NodeListError,
    1331             :                     DataLoopNode::NodeFluidType::Air,
    1332             :                     DataLoopNode::ConnectionObjectType::SetpointManagerSingleZoneHumidityMinimum,
    1333          26 :                     cAlphaArgs(1),
    1334             :                     DataLoopNode::ConnectionType::SetPoint,
    1335             :                     NodeInputManager::CompFluidStream::Primary,
    1336             :                     ObjectIsNotParent,
    1337             :                     false,
    1338          26 :                     cAlphaFieldNames(4)); // nodes whose min humidity ratio will be set
    1339          26 :         if (!NodeListError) {
    1340          26 :             NumNodesCtrld = NumNodes;
    1341          26 :             state.dataSetPointManager->SZMinHumSetPtMgr(SetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld);
    1342          26 :             state.dataSetPointManager->SZMinHumSetPtMgr(SetPtMgrNum).NumCtrlNodes = NumNodesCtrld;
    1343          26 :             state.dataSetPointManager->SZMinHumSetPtMgr(SetPtMgrNum).SetPt = 0.0;
    1344             : 
    1345          52 :             for (CtrldNodeNum = 1; CtrldNodeNum <= NumNodesCtrld; ++CtrldNodeNum) {
    1346          26 :                 state.dataSetPointManager->SZMinHumSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum) = NodeNums(CtrldNodeNum);
    1347             :             }
    1348             :         } else {
    1349           0 :             ErrorsFound = true;
    1350             :         }
    1351             : 
    1352          26 :         ErrInList = false;
    1353          52 :         GetNodeNums(state,
    1354          26 :                     cAlphaArgs(3),
    1355             :                     NumNodes,
    1356             :                     NodeNums,
    1357             :                     ErrInList,
    1358             :                     DataLoopNode::NodeFluidType::Air,
    1359             :                     DataLoopNode::ConnectionObjectType::SetpointManagerSingleZoneHumidityMinimum,
    1360          26 :                     cAlphaArgs(1),
    1361             :                     DataLoopNode::ConnectionType::Sensor,
    1362             :                     NodeInputManager::CompFluidStream::Primary,
    1363             :                     ObjectIsNotParent,
    1364             :                     false,
    1365          26 :                     cAlphaFieldNames(3)); // nodes of zones whose humidity is being controlled
    1366          26 :         if (ErrInList) {
    1367           0 :             ErrorsFound = true;
    1368             :         }
    1369          26 :         NumZones = NumNodes;
    1370          26 :         state.dataSetPointManager->SZMinHumSetPtMgr(SetPtMgrNum).NumZones = NumZones;
    1371             :         // only allow one control zone for now
    1372          26 :         if (NumNodes > 1) {
    1373           0 :             ShowSevereError(state, format("{}: {}=\"{}\", entered nodelist.", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
    1374           0 :             ShowContinueError(state, "..invalid " + cAlphaFieldNames(3) + "=\"" + cAlphaArgs(3) + "\".");
    1375           0 :             ShowContinueError(state, "..only one control zone is allowed.");
    1376           0 :             ErrorsFound = true;
    1377             :         }
    1378          26 :         state.dataSetPointManager->SZMinHumSetPtMgr(SetPtMgrNum).ZoneNodes.allocate(NumZones);
    1379          26 :         state.dataSetPointManager->SZMinHumSetPtMgr(SetPtMgrNum).CtrlZoneNum.allocate(NumZones);
    1380             : 
    1381          52 :         for (ZoneNum = 1; ZoneNum <= NumZones; ++ZoneNum) {
    1382          26 :             state.dataSetPointManager->SZMinHumSetPtMgr(SetPtMgrNum).ZoneNodes(ZoneNum) = NodeNums(ZoneNum);
    1383          26 :             state.dataSetPointManager->SZMinHumSetPtMgr(SetPtMgrNum).CtrlZoneNum(ZoneNum) = 0;
    1384             :         }
    1385             : 
    1386          78 :         AllSetPtMgrNum = SetPtMgrNum + state.dataSetPointManager->NumSchSetPtMgrs + state.dataSetPointManager->NumDualSchSetPtMgrs +
    1387          78 :                          state.dataSetPointManager->NumOutAirSetPtMgrs + state.dataSetPointManager->NumSZRhSetPtMgrs +
    1388          52 :                          state.dataSetPointManager->NumSZHtSetPtMgrs + state.dataSetPointManager->NumSZClSetPtMgrs;
    1389             : 
    1390          26 :         if (!NodeListError) {
    1391          26 :             state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld);
    1392          26 :             state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlNodes = state.dataSetPointManager->SZMinHumSetPtMgr(SetPtMgrNum).CtrlNodes;
    1393             :         }
    1394          26 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).Name = state.dataSetPointManager->SZMinHumSetPtMgr(SetPtMgrNum).Name;
    1395          26 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).SPMType = SetPointManagerType::SZMinHum;
    1396          26 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).SPMIndex = SetPtMgrNum;
    1397          26 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlTypeMode = state.dataSetPointManager->SZMinHumSetPtMgr(SetPtMgrNum).CtrlTypeMode;
    1398          26 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).NumCtrlNodes = state.dataSetPointManager->SZMinHumSetPtMgr(SetPtMgrNum).NumCtrlNodes;
    1399             :     }
    1400             : 
    1401             :     // Input the Single Zone Maximum Humidity Setpoint Managers
    1402             : 
    1403         775 :     if (state.dataSetPointManager->NumSZMaxHumSetPtMgrs > 0)
    1404          23 :         state.dataSetPointManager->SZMaxHumSetPtMgr.allocate(state.dataSetPointManager->NumSZMaxHumSetPtMgrs);
    1405             : 
    1406             :     // Input the data for each Setpoint Manager
    1407         775 :     cCurrentModuleObject = "SetpointManager:SingleZone:Humidity:Maximum";
    1408         819 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumSZMaxHumSetPtMgrs; ++SetPtMgrNum) {
    1409          44 :         state.dataInputProcessing->inputProcessor->getObjectItem(state,
    1410             :                                                                  cCurrentModuleObject,
    1411             :                                                                  SetPtMgrNum,
    1412             :                                                                  cAlphaArgs,
    1413             :                                                                  NumAlphas,
    1414             :                                                                  rNumericArgs,
    1415             :                                                                  NumNums,
    1416             :                                                                  IOStat,
    1417             :                                                                  lNumericFieldBlanks,
    1418             :                                                                  lAlphaFieldBlanks,
    1419             :                                                                  cAlphaFieldNames,
    1420             :                                                                  cNumericFieldNames);
    1421          44 :         UtilityRoutines::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound);
    1422             : 
    1423          44 :         state.dataSetPointManager->SZMaxHumSetPtMgr(SetPtMgrNum).Name = cAlphaArgs(1);
    1424          44 :         state.dataSetPointManager->SZMaxHumSetPtMgr(SetPtMgrNum).ctrlVarType = "MaximumHumidityRatio";
    1425          44 :         state.dataSetPointManager->SZMaxHumSetPtMgr(SetPtMgrNum).CtrlTypeMode = CtrlVarType::MaxHumRat;
    1426             : 
    1427          44 :         NodeListError = false;
    1428          88 :         GetNodeNums(state,
    1429          44 :                     cAlphaArgs(2),
    1430             :                     NumNodes,
    1431             :                     NodeNums,
    1432             :                     NodeListError,
    1433             :                     DataLoopNode::NodeFluidType::Air,
    1434             :                     DataLoopNode::ConnectionObjectType::SetpointManagerSingleZoneHumidityMaximum,
    1435          44 :                     cAlphaArgs(1),
    1436             :                     DataLoopNode::ConnectionType::SetPoint,
    1437             :                     NodeInputManager::CompFluidStream::Primary,
    1438             :                     ObjectIsNotParent,
    1439             :                     false,
    1440          44 :                     cAlphaFieldNames(2)); // nodes whose max humidity ratio will be set
    1441          44 :         if (!NodeListError) {
    1442          44 :             NumNodesCtrld = NumNodes;
    1443          44 :             state.dataSetPointManager->SZMaxHumSetPtMgr(SetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld);
    1444          44 :             state.dataSetPointManager->SZMaxHumSetPtMgr(SetPtMgrNum).NumCtrlNodes = NumNodesCtrld;
    1445          44 :             state.dataSetPointManager->SZMaxHumSetPtMgr(SetPtMgrNum).SetPt = 0.0;
    1446             : 
    1447          88 :             for (CtrldNodeNum = 1; CtrldNodeNum <= NumNodesCtrld; ++CtrldNodeNum) {
    1448          44 :                 state.dataSetPointManager->SZMaxHumSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum) = NodeNums(CtrldNodeNum);
    1449             :             }
    1450             :         } else {
    1451           0 :             ErrorsFound = true;
    1452             :         }
    1453             : 
    1454          44 :         ErrInList = false;
    1455          88 :         GetNodeNums(state,
    1456          44 :                     cAlphaArgs(3),
    1457             :                     NumNodes,
    1458             :                     NodeNums,
    1459             :                     ErrInList,
    1460             :                     DataLoopNode::NodeFluidType::Air,
    1461             :                     DataLoopNode::ConnectionObjectType::SetpointManagerSingleZoneHumidityMaximum,
    1462          44 :                     cAlphaArgs(1),
    1463             :                     DataLoopNode::ConnectionType::Sensor,
    1464             :                     NodeInputManager::CompFluidStream::Primary,
    1465             :                     ObjectIsNotParent,
    1466             :                     false,
    1467          44 :                     cAlphaFieldNames(3)); // nodes of zones whose humidity is being controlled
    1468          44 :         if (ErrInList) {
    1469           0 :             ErrorsFound = true;
    1470             :         }
    1471          44 :         NumZones = NumNodes;
    1472          44 :         state.dataSetPointManager->SZMaxHumSetPtMgr(SetPtMgrNum).NumZones = NumZones;
    1473             :         // only allow one control zone for now
    1474          44 :         if (NumNodes > 1) {
    1475           0 :             ShowSevereError(state, format("{}: {}=\"{}\", entered nodelist.", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
    1476           0 :             ShowContinueError(state, "..invalid " + cAlphaFieldNames(5) + "=\"" + cAlphaArgs(5) + "\".");
    1477           0 :             ShowContinueError(state, "..only one control zone is allowed.");
    1478           0 :             ErrorsFound = true;
    1479             :         }
    1480          44 :         state.dataSetPointManager->SZMaxHumSetPtMgr(SetPtMgrNum).ZoneNodes.allocate(NumZones);
    1481          44 :         state.dataSetPointManager->SZMaxHumSetPtMgr(SetPtMgrNum).CtrlZoneNum.allocate(NumZones);
    1482             : 
    1483          88 :         for (ZoneNum = 1; ZoneNum <= NumZones; ++ZoneNum) {
    1484          44 :             state.dataSetPointManager->SZMaxHumSetPtMgr(SetPtMgrNum).ZoneNodes(ZoneNum) = NodeNums(ZoneNum);
    1485             :             //   Actual zone node and controlled zone numbers set in Init subroutine
    1486          44 :             state.dataSetPointManager->SZMaxHumSetPtMgr(SetPtMgrNum).CtrlZoneNum(ZoneNum) = 0;
    1487             :         }
    1488             : 
    1489         132 :         AllSetPtMgrNum = SetPtMgrNum + state.dataSetPointManager->NumSchSetPtMgrs + state.dataSetPointManager->NumDualSchSetPtMgrs +
    1490         132 :                          state.dataSetPointManager->NumOutAirSetPtMgrs + state.dataSetPointManager->NumSZRhSetPtMgrs +
    1491          88 :                          state.dataSetPointManager->NumSZHtSetPtMgrs + state.dataSetPointManager->NumSZClSetPtMgrs +
    1492          44 :                          state.dataSetPointManager->NumSZMinHumSetPtMgrs;
    1493             : 
    1494          44 :         if (!NodeListError) {
    1495          44 :             state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld);
    1496          44 :             state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlNodes = state.dataSetPointManager->SZMaxHumSetPtMgr(SetPtMgrNum).CtrlNodes;
    1497             :         }
    1498          44 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).Name = state.dataSetPointManager->SZMaxHumSetPtMgr(SetPtMgrNum).Name;
    1499          44 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).SPMType = SetPointManagerType::SZMaxHum;
    1500          44 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).SPMIndex = SetPtMgrNum;
    1501          44 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlTypeMode = state.dataSetPointManager->SZMaxHumSetPtMgr(SetPtMgrNum).CtrlTypeMode;
    1502          44 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).NumCtrlNodes = state.dataSetPointManager->SZMaxHumSetPtMgr(SetPtMgrNum).NumCtrlNodes;
    1503             :     }
    1504             : 
    1505             :     // Input the Mixed Air Setpoint Managers
    1506             : 
    1507         775 :     if (state.dataSetPointManager->NumMixedAirSetPtMgrs > 0)
    1508         298 :         state.dataSetPointManager->MixedAirSetPtMgr.allocate(state.dataSetPointManager->NumMixedAirSetPtMgrs);
    1509             : 
    1510             :     // Input the data for each Setpoint Manager
    1511         775 :     cCurrentModuleObject = "SetpointManager:MixedAir";
    1512        2385 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumMixedAirSetPtMgrs; ++SetPtMgrNum) {
    1513        1610 :         state.dataInputProcessing->inputProcessor->getObjectItem(state,
    1514             :                                                                  cCurrentModuleObject,
    1515             :                                                                  SetPtMgrNum,
    1516             :                                                                  cAlphaArgs,
    1517             :                                                                  NumAlphas,
    1518             :                                                                  rNumericArgs,
    1519             :                                                                  NumNums,
    1520             :                                                                  IOStat,
    1521             :                                                                  lNumericFieldBlanks,
    1522             :                                                                  lAlphaFieldBlanks,
    1523             :                                                                  cAlphaFieldNames,
    1524             :                                                                  cNumericFieldNames);
    1525        1610 :         UtilityRoutines::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound);
    1526             : 
    1527        1610 :         state.dataSetPointManager->MixedAirSetPtMgr(SetPtMgrNum).Name = cAlphaArgs(1);
    1528        1610 :         state.dataSetPointManager->MixedAirSetPtMgr(SetPtMgrNum).ctrlVarType = cAlphaArgs(2);
    1529        1610 :         if (UtilityRoutines::SameString(state.dataSetPointManager->MixedAirSetPtMgr(SetPtMgrNum).ctrlVarType, "Temperature")) {
    1530        1610 :             state.dataSetPointManager->MixedAirSetPtMgr(SetPtMgrNum).CtrlTypeMode = CtrlVarType::Temp;
    1531             :         } else {
    1532             :             // should not come here if idd type choice and key list is working
    1533           0 :             ShowSevereError(state, format("{}: {}=\"{}\", invalid field.", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
    1534           0 :             ShowContinueError(state, "..invalid " + cAlphaFieldNames(2) + "=\"" + cAlphaArgs(2) + "\".");
    1535           0 :             ShowContinueError(state, "..Valid value is \"Temperature\".");
    1536           0 :             ErrorsFound = true;
    1537             :         }
    1538        1610 :         state.dataSetPointManager->MixedAirSetPtMgr(SetPtMgrNum).RefNode =
    1539        3220 :             GetOnlySingleNode(state,
    1540        1610 :                               cAlphaArgs(3),
    1541             :                               ErrorsFound,
    1542             :                               DataLoopNode::ConnectionObjectType::SetpointManagerMixedAir,
    1543        1610 :                               cAlphaArgs(1),
    1544             :                               DataLoopNode::NodeFluidType::Air,
    1545             :                               DataLoopNode::ConnectionType::Sensor,
    1546             :                               NodeInputManager::CompFluidStream::Primary,
    1547        1610 :                               ObjectIsNotParent);
    1548        1610 :         state.dataSetPointManager->MixedAirSetPtMgr(SetPtMgrNum).FanInNode =
    1549        3220 :             GetOnlySingleNode(state,
    1550        1610 :                               cAlphaArgs(4),
    1551             :                               ErrorsFound,
    1552             :                               DataLoopNode::ConnectionObjectType::SetpointManagerMixedAir,
    1553        1610 :                               cAlphaArgs(1),
    1554             :                               DataLoopNode::NodeFluidType::Air,
    1555             :                               DataLoopNode::ConnectionType::Sensor,
    1556             :                               NodeInputManager::CompFluidStream::Primary,
    1557        1610 :                               ObjectIsNotParent);
    1558        1610 :         state.dataSetPointManager->MixedAirSetPtMgr(SetPtMgrNum).FanOutNode =
    1559        3220 :             GetOnlySingleNode(state,
    1560        1610 :                               cAlphaArgs(5),
    1561             :                               ErrorsFound,
    1562             :                               DataLoopNode::ConnectionObjectType::SetpointManagerMixedAir,
    1563        1610 :                               cAlphaArgs(1),
    1564             :                               DataLoopNode::NodeFluidType::Air,
    1565             :                               DataLoopNode::ConnectionType::Sensor,
    1566             :                               NodeInputManager::CompFluidStream::Primary,
    1567        1610 :                               ObjectIsNotParent);
    1568        1610 :         NodeListError = false;
    1569        3220 :         GetNodeNums(state,
    1570        1610 :                     cAlphaArgs(6),
    1571             :                     NumNodes,
    1572             :                     NodeNums,
    1573             :                     NodeListError,
    1574             :                     DataLoopNode::NodeFluidType::Air,
    1575             :                     DataLoopNode::ConnectionObjectType::SetpointManagerMixedAir,
    1576        1610 :                     cAlphaArgs(1),
    1577             :                     DataLoopNode::ConnectionType::SetPoint,
    1578             :                     NodeInputManager::CompFluidStream::Primary,
    1579             :                     ObjectIsNotParent,
    1580             :                     false,
    1581        1610 :                     cAlphaFieldNames(6)); // setpoint nodes
    1582        1610 :         if (!NodeListError) {
    1583        1610 :             NumNodesCtrld = NumNodes;
    1584        1610 :             state.dataSetPointManager->MixedAirSetPtMgr(SetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld);
    1585        1610 :             state.dataSetPointManager->MixedAirSetPtMgr(SetPtMgrNum).NumCtrlNodes = NumNodesCtrld;
    1586        1610 :             state.dataSetPointManager->MixedAirSetPtMgr(SetPtMgrNum).SetPt = 0.0;
    1587             : 
    1588        3490 :             for (CtrldNodeNum = 1; CtrldNodeNum <= NumNodesCtrld; ++CtrldNodeNum) {
    1589        1880 :                 state.dataSetPointManager->MixedAirSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum) = NodeNums(CtrldNodeNum);
    1590             :             }
    1591             :         } else {
    1592           0 :             ErrorsFound = true;
    1593             :         }
    1594             : 
    1595        3220 :         Found = FindNumberInList(state.dataSetPointManager->MixedAirSetPtMgr(SetPtMgrNum).RefNode,
    1596        1610 :                                  state.dataSetPointManager->MixedAirSetPtMgr(SetPtMgrNum).CtrlNodes,
    1597        1610 :                                  state.dataSetPointManager->MixedAirSetPtMgr(SetPtMgrNum).NumCtrlNodes);
    1598        1610 :         if (Found > 0) {
    1599           0 :             ShowSevereError(state, format("{}: {}=\"{}\", reference node.", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
    1600           0 :             if (state.dataSetPointManager->MixedAirSetPtMgr(SetPtMgrNum).NumCtrlNodes > 1) {
    1601           0 :                 ShowContinueError(state, "..Reference Node is the same as one of the nodes in SetPoint NodeList");
    1602             :             } else {
    1603           0 :                 ShowContinueError(state, "..Reference Node is the same as the SetPoint Node");
    1604             :             }
    1605           0 :             ShowContinueError(state,
    1606           0 :                               "Reference Node Name=\"" +
    1607           0 :                                   state.dataLoopNodes->NodeID(state.dataSetPointManager->MixedAirSetPtMgr(SetPtMgrNum).RefNode) + "\".");
    1608           0 :             ErrorsFound = true;
    1609             :         }
    1610             : 
    1611        4830 :         AllSetPtMgrNum = SetPtMgrNum + state.dataSetPointManager->NumSchSetPtMgrs + state.dataSetPointManager->NumDualSchSetPtMgrs +
    1612        4830 :                          state.dataSetPointManager->NumOutAirSetPtMgrs + state.dataSetPointManager->NumSZRhSetPtMgrs +
    1613        4830 :                          state.dataSetPointManager->NumSZHtSetPtMgrs + state.dataSetPointManager->NumSZClSetPtMgrs +
    1614        3220 :                          state.dataSetPointManager->NumSZMinHumSetPtMgrs + state.dataSetPointManager->NumSZMaxHumSetPtMgrs;
    1615             : 
    1616        1610 :         if (NumAlphas > 7) {
    1617           1 :             state.dataSetPointManager->MixedAirSetPtMgr(SetPtMgrNum).CoolCoilInNode =
    1618           2 :                 GetOnlySingleNode(state,
    1619           1 :                                   cAlphaArgs(7),
    1620             :                                   ErrorsFound,
    1621             :                                   DataLoopNode::ConnectionObjectType::SetpointManagerMixedAir,
    1622           1 :                                   cAlphaArgs(1),
    1623             :                                   DataLoopNode::NodeFluidType::Air,
    1624             :                                   DataLoopNode::ConnectionType::Sensor,
    1625             :                                   NodeInputManager::CompFluidStream::Primary,
    1626           1 :                                   ObjectIsNotParent);
    1627           1 :             state.dataSetPointManager->MixedAirSetPtMgr(SetPtMgrNum).CoolCoilOutNode =
    1628           2 :                 GetOnlySingleNode(state,
    1629           1 :                                   cAlphaArgs(8),
    1630             :                                   ErrorsFound,
    1631             :                                   DataLoopNode::ConnectionObjectType::SetpointManagerMixedAir,
    1632           1 :                                   cAlphaArgs(1),
    1633             :                                   DataLoopNode::NodeFluidType::Air,
    1634             :                                   DataLoopNode::ConnectionType::Sensor,
    1635             :                                   NodeInputManager::CompFluidStream::Primary,
    1636           1 :                                   ObjectIsNotParent);
    1637           1 :             if (NumNums == 1) {
    1638           1 :                 state.dataSetPointManager->MixedAirSetPtMgr(SetPtMgrNum).MinCoolCoilOutTemp = rNumericArgs(1);
    1639             :             }
    1640             :         }
    1641             : 
    1642        1610 :         if (!NodeListError) {
    1643        1610 :             state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld);
    1644        1610 :             state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlNodes = state.dataSetPointManager->MixedAirSetPtMgr(SetPtMgrNum).CtrlNodes;
    1645             :         }
    1646        1610 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).Name = state.dataSetPointManager->MixedAirSetPtMgr(SetPtMgrNum).Name;
    1647        1610 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).SPMType = SetPointManagerType::MixedAir;
    1648        1610 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).SPMIndex = SetPtMgrNum;
    1649        1610 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlTypeMode = state.dataSetPointManager->MixedAirSetPtMgr(SetPtMgrNum).CtrlTypeMode;
    1650        1610 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).NumCtrlNodes = state.dataSetPointManager->MixedAirSetPtMgr(SetPtMgrNum).NumCtrlNodes;
    1651        1610 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).RefNode = state.dataSetPointManager->MixedAirSetPtMgr(SetPtMgrNum).RefNode;
    1652             :     }
    1653             : 
    1654             :     // Input the Outside Air Pretreat Setpoint Managers
    1655             : 
    1656         775 :     if (state.dataSetPointManager->NumOAPretreatSetPtMgrs > 0)
    1657           6 :         state.dataSetPointManager->OAPretreatSetPtMgr.allocate(state.dataSetPointManager->NumOAPretreatSetPtMgrs);
    1658             : 
    1659             :     // Input the data for each Setpoint Manager
    1660         775 :     cCurrentModuleObject = "SetpointManager:OutdoorAirPretreat";
    1661         784 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumOAPretreatSetPtMgrs; ++SetPtMgrNum) {
    1662           9 :         state.dataInputProcessing->inputProcessor->getObjectItem(state,
    1663             :                                                                  cCurrentModuleObject,
    1664             :                                                                  SetPtMgrNum,
    1665             :                                                                  cAlphaArgs,
    1666             :                                                                  NumAlphas,
    1667             :                                                                  rNumericArgs,
    1668             :                                                                  NumNums,
    1669             :                                                                  IOStat,
    1670             :                                                                  lNumericFieldBlanks,
    1671             :                                                                  lAlphaFieldBlanks,
    1672             :                                                                  cAlphaFieldNames,
    1673             :                                                                  cNumericFieldNames);
    1674           9 :         UtilityRoutines::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound);
    1675             : 
    1676           9 :         state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).Name = cAlphaArgs(1);
    1677           9 :         state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).ctrlVarType = cAlphaArgs(2);
    1678             : 
    1679             :         // setup program flow control integers.
    1680          18 :         state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).CtrlTypeMode = static_cast<CtrlVarType>(getEnumerationValue(
    1681          27 :             controlTypeNameUC, UtilityRoutines::MakeUPPERCase(state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).ctrlVarType)));
    1682           9 :         if (state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::Invalid) {
    1683             :             // should not come here if idd type choice and key list is working
    1684           0 :             ShowSevereError(state, format("{}: {}=\"{}\", invalid field.", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
    1685           0 :             ShowContinueError(state, "..invalid " + cAlphaFieldNames(2) + "=\"" + cAlphaArgs(2) + "\".");
    1686           0 :             ShowContinueError(state, R"(..Valid values are "Temperature","HumidityRatio","MaximumHumidityRatio" or "MinimumHumidityRatio".)");
    1687           0 :             ErrorsFound = true;
    1688             :         }
    1689             : 
    1690           9 :         state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).MinSetTemp = rNumericArgs(1);
    1691           9 :         state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).MaxSetTemp = rNumericArgs(2);
    1692          18 :         if (state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).MaxSetTemp <
    1693           9 :             state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).MinSetTemp) {
    1694           0 :             ShowWarningError(state, format("{}: {}=\"{}\",", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
    1695           0 :             ShowContinueError(state,
    1696           0 :                               format("...{}=[{:.1R}] is less than {}=[{:.1R}].",
    1697             :                                      cNumericFieldNames(2),
    1698           0 :                                      state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).MaxSetTemp,
    1699             :                                      cNumericFieldNames(1),
    1700           0 :                                      state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).MinSetTemp));
    1701             :         }
    1702           9 :         state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).MinSetHumRat = rNumericArgs(3);
    1703           9 :         state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).MaxSetHumRat = rNumericArgs(4);
    1704          18 :         if (state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).MaxSetHumRat <
    1705           9 :             state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).MinSetHumRat) {
    1706           0 :             ShowWarningError(state, format("{}: {}=\"{}\",", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
    1707           0 :             ShowContinueError(state,
    1708           0 :                               format("...{}=[{:.1R}] is less than {}=[{:.1R}].",
    1709             :                                      cNumericFieldNames(4),
    1710           0 :                                      state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).MaxSetHumRat,
    1711             :                                      cNumericFieldNames(3),
    1712           0 :                                      state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).MinSetHumRat));
    1713             :         }
    1714             : 
    1715             :         // Because a zero humidity ratio setpoint is a special value indicating "off" or "no load"
    1716             :         // must not allow MinSetHumRat or MaxSetHumRat to be <=0.0
    1717           9 :         if (state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).MinSetHumRat <= 0.0) {
    1718           0 :             ShowWarningError(state, format("{}: {}=\"{}\", invalid value.", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
    1719           0 :             ShowContinueError(state, "Minimum setpoint humidity ratio <=0.0, resetting to 0.00001");
    1720           0 :             state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).MinSetHumRat = 0.00001;
    1721             :         }
    1722           9 :         if (state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).MaxSetHumRat <= 0.0) {
    1723           0 :             ShowWarningError(state, format("{}: {}=\"{}\", invalid value.", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
    1724           0 :             ShowContinueError(state, "Maximum setpoint humidity ratio <=0.0, resetting to 0.00001");
    1725           0 :             state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).MaxSetHumRat = 0.00001;
    1726             :         }
    1727             : 
    1728           9 :         state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).RefNode =
    1729          18 :             GetOnlySingleNode(state,
    1730           9 :                               cAlphaArgs(3),
    1731             :                               ErrorsFound,
    1732             :                               DataLoopNode::ConnectionObjectType::SetpointManagerOutdoorAirPretreat,
    1733           9 :                               cAlphaArgs(1),
    1734             :                               DataLoopNode::NodeFluidType::Air,
    1735             :                               DataLoopNode::ConnectionType::Sensor,
    1736             :                               NodeInputManager::CompFluidStream::Primary,
    1737           9 :                               ObjectIsNotParent);
    1738           9 :         state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).MixedOutNode =
    1739          18 :             GetOnlySingleNode(state,
    1740           9 :                               cAlphaArgs(4),
    1741             :                               ErrorsFound,
    1742             :                               DataLoopNode::ConnectionObjectType::SetpointManagerOutdoorAirPretreat,
    1743           9 :                               cAlphaArgs(1),
    1744             :                               DataLoopNode::NodeFluidType::Air,
    1745             :                               DataLoopNode::ConnectionType::Sensor,
    1746             :                               NodeInputManager::CompFluidStream::Primary,
    1747           9 :                               ObjectIsNotParent);
    1748           9 :         state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).OAInNode =
    1749          18 :             GetOnlySingleNode(state,
    1750           9 :                               cAlphaArgs(5),
    1751             :                               ErrorsFound,
    1752             :                               DataLoopNode::ConnectionObjectType::SetpointManagerOutdoorAirPretreat,
    1753           9 :                               cAlphaArgs(1),
    1754             :                               DataLoopNode::NodeFluidType::Air,
    1755             :                               DataLoopNode::ConnectionType::Sensor,
    1756             :                               NodeInputManager::CompFluidStream::Primary,
    1757           9 :                               ObjectIsNotParent);
    1758           9 :         state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).ReturnInNode =
    1759          18 :             GetOnlySingleNode(state,
    1760           9 :                               cAlphaArgs(6),
    1761             :                               ErrorsFound,
    1762             :                               DataLoopNode::ConnectionObjectType::SetpointManagerOutdoorAirPretreat,
    1763           9 :                               cAlphaArgs(1),
    1764             :                               DataLoopNode::NodeFluidType::Air,
    1765             :                               DataLoopNode::ConnectionType::Sensor,
    1766             :                               NodeInputManager::CompFluidStream::Primary,
    1767           9 :                               ObjectIsNotParent);
    1768           9 :         NodeListError = false;
    1769          18 :         GetNodeNums(state,
    1770           9 :                     cAlphaArgs(7),
    1771             :                     NumNodes,
    1772             :                     NodeNums,
    1773             :                     NodeListError,
    1774             :                     DataLoopNode::NodeFluidType::Air,
    1775             :                     DataLoopNode::ConnectionObjectType::SetpointManagerOutdoorAirPretreat,
    1776           9 :                     cAlphaArgs(1),
    1777             :                     DataLoopNode::ConnectionType::SetPoint,
    1778             :                     NodeInputManager::CompFluidStream::Primary,
    1779             :                     ObjectIsNotParent,
    1780             :                     false,
    1781           9 :                     cAlphaFieldNames(7)); // setpoint nodes
    1782           9 :         if (!NodeListError) {
    1783           9 :             NumNodesCtrld = NumNodes;
    1784           9 :             state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld);
    1785           9 :             state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).NumCtrlNodes = NumNodesCtrld;
    1786           9 :             state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).SetPt = 0.0;
    1787             : 
    1788          18 :             for (CtrldNodeNum = 1; CtrldNodeNum <= NumNodesCtrld; ++CtrldNodeNum) {
    1789           9 :                 state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum) = NodeNums(CtrldNodeNum);
    1790             :             }
    1791             :         } else {
    1792           0 :             ErrorsFound = true;
    1793             :         }
    1794             : 
    1795          18 :         Found = FindNumberInList(state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).RefNode,
    1796           9 :                                  state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).CtrlNodes,
    1797           9 :                                  state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).NumCtrlNodes);
    1798           9 :         if (Found > 0) {
    1799           0 :             ShowSevereError(state, format("{}: {}=\"{}\", reference node.", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
    1800           0 :             if (state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).NumCtrlNodes > 1) {
    1801           0 :                 ShowContinueError(state, "..Reference Node is the same as one of the nodes in SetPoint NodeList");
    1802             :             } else {
    1803           0 :                 ShowContinueError(state, "..Reference Node is the same as the SetPoint Node");
    1804             :             }
    1805           0 :             ShowContinueError(state,
    1806           0 :                               "Reference Node Name=\"" +
    1807           0 :                                   state.dataLoopNodes->NodeID(state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).RefNode) + "\".");
    1808           0 :             ErrorsFound = true;
    1809             :         }
    1810             : 
    1811          27 :         AllSetPtMgrNum = SetPtMgrNum + state.dataSetPointManager->NumSchSetPtMgrs + state.dataSetPointManager->NumDualSchSetPtMgrs +
    1812          27 :                          state.dataSetPointManager->NumOutAirSetPtMgrs + state.dataSetPointManager->NumSZRhSetPtMgrs +
    1813          27 :                          state.dataSetPointManager->NumSZHtSetPtMgrs + state.dataSetPointManager->NumSZClSetPtMgrs +
    1814          18 :                          state.dataSetPointManager->NumSZMinHumSetPtMgrs + state.dataSetPointManager->NumSZMaxHumSetPtMgrs +
    1815           9 :                          state.dataSetPointManager->NumMixedAirSetPtMgrs;
    1816             : 
    1817           9 :         if (!NodeListError) {
    1818           9 :             state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld);
    1819           9 :             state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlNodes = state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).CtrlNodes;
    1820             :         }
    1821           9 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).Name = state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).Name;
    1822           9 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).SPMType = SetPointManagerType::OutsideAirPretreat;
    1823           9 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).SPMIndex = SetPtMgrNum;
    1824           9 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlTypeMode = state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).CtrlTypeMode;
    1825           9 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).NumCtrlNodes = state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).NumCtrlNodes;
    1826             :     }
    1827             : 
    1828             :     // Input the Warmest Setpoint Managers
    1829             : 
    1830         775 :     if (state.dataSetPointManager->NumWarmestSetPtMgrs > 0)
    1831          23 :         state.dataSetPointManager->WarmestSetPtMgr.allocate(state.dataSetPointManager->NumWarmestSetPtMgrs);
    1832             : 
    1833             :     // Input the data for each Setpoint Manager
    1834         775 :     cCurrentModuleObject = "SetpointManager:Warmest";
    1835         798 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumWarmestSetPtMgrs; ++SetPtMgrNum) {
    1836          23 :         state.dataInputProcessing->inputProcessor->getObjectItem(state,
    1837             :                                                                  cCurrentModuleObject,
    1838             :                                                                  SetPtMgrNum,
    1839             :                                                                  cAlphaArgs,
    1840             :                                                                  NumAlphas,
    1841             :                                                                  rNumericArgs,
    1842             :                                                                  NumNums,
    1843             :                                                                  IOStat,
    1844             :                                                                  lNumericFieldBlanks,
    1845             :                                                                  lAlphaFieldBlanks,
    1846             :                                                                  cAlphaFieldNames,
    1847             :                                                                  cNumericFieldNames);
    1848          23 :         UtilityRoutines::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound);
    1849             : 
    1850          23 :         state.dataSetPointManager->WarmestSetPtMgr(SetPtMgrNum).Name = cAlphaArgs(1);
    1851          23 :         state.dataSetPointManager->WarmestSetPtMgr(SetPtMgrNum).ctrlVarType = cAlphaArgs(2);
    1852          23 :         if (UtilityRoutines::SameString(state.dataSetPointManager->WarmestSetPtMgr(SetPtMgrNum).ctrlVarType, "Temperature")) {
    1853          23 :             state.dataSetPointManager->WarmestSetPtMgr(SetPtMgrNum).CtrlTypeMode = CtrlVarType::Temp;
    1854             :         } else {
    1855             :             // should not come here if idd type choice and key list is working
    1856           0 :             ShowSevereError(state, format("{}: {}=\"{}\", invalid field.", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
    1857           0 :             ShowContinueError(state, "..invalid " + cAlphaFieldNames(2) + "=\"" + cAlphaArgs(2) + "\".");
    1858           0 :             ShowContinueError(state, "..Valid value is \"Temperature\".");
    1859           0 :             ErrorsFound = true;
    1860             :         }
    1861          23 :         state.dataSetPointManager->WarmestSetPtMgr(SetPtMgrNum).AirLoopName = cAlphaArgs(3);
    1862          23 :         state.dataSetPointManager->WarmestSetPtMgr(SetPtMgrNum).AirLoopNum = 0;
    1863          23 :         state.dataSetPointManager->WarmestSetPtMgr(SetPtMgrNum).MinSetTemp = rNumericArgs(1);
    1864          23 :         state.dataSetPointManager->WarmestSetPtMgr(SetPtMgrNum).MaxSetTemp = rNumericArgs(2);
    1865          23 :         if (state.dataSetPointManager->WarmestSetPtMgr(SetPtMgrNum).MaxSetTemp < state.dataSetPointManager->WarmestSetPtMgr(SetPtMgrNum).MinSetTemp) {
    1866           0 :             ShowWarningError(state, format("{}: {}=\"{}\",", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
    1867           0 :             ShowContinueError(state,
    1868           0 :                               format("...{}=[{:.1R}] is less than {}=[{:.1R}].",
    1869             :                                      cNumericFieldNames(2),
    1870           0 :                                      state.dataSetPointManager->WarmestSetPtMgr(SetPtMgrNum).MaxSetTemp,
    1871             :                                      cNumericFieldNames(1),
    1872           0 :                                      state.dataSetPointManager->WarmestSetPtMgr(SetPtMgrNum).MinSetTemp));
    1873             :         }
    1874             : 
    1875          23 :         if (UtilityRoutines::MakeUPPERCase(cAlphaArgs(4)) == controlTypeNameUC[static_cast<int>(CtrlVarType::MaxTemp)]) {
    1876          23 :             state.dataSetPointManager->WarmestSetPtMgr(SetPtMgrNum).Strategy = SupplyFlowTempStrategy::MaxTemp;
    1877             :         } else {
    1878           0 :             ShowSevereError(state, format("{}: {}=\"{}\", invalid field.", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
    1879           0 :             ShowContinueError(state, "..invalid " + cAlphaFieldNames(4) + "=\"" + cAlphaArgs(4) + "\".");
    1880           0 :             ShowContinueError(state, "..Valid value is \"MaximumTemperature\".");
    1881           0 :             ErrorsFound = true;
    1882             :         }
    1883             : 
    1884          23 :         NodeListError = false;
    1885          46 :         GetNodeNums(state,
    1886          23 :                     cAlphaArgs(5),
    1887             :                     NumNodes,
    1888             :                     NodeNums,
    1889             :                     NodeListError,
    1890             :                     DataLoopNode::NodeFluidType::Air,
    1891             :                     DataLoopNode::ConnectionObjectType::SetpointManagerWarmest,
    1892          23 :                     cAlphaArgs(1),
    1893             :                     DataLoopNode::ConnectionType::SetPoint,
    1894             :                     NodeInputManager::CompFluidStream::Primary,
    1895             :                     ObjectIsNotParent,
    1896             :                     false,
    1897          23 :                     cAlphaFieldNames(5)); // setpoint nodes
    1898          23 :         if (!NodeListError) {
    1899          23 :             NumNodesCtrld = NumNodes;
    1900          23 :             state.dataSetPointManager->WarmestSetPtMgr(SetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld);
    1901          23 :             state.dataSetPointManager->WarmestSetPtMgr(SetPtMgrNum).NumCtrlNodes = NumNodesCtrld;
    1902          23 :             state.dataSetPointManager->WarmestSetPtMgr(SetPtMgrNum).SetPt = 0.0;
    1903             : 
    1904          46 :             for (CtrldNodeNum = 1; CtrldNodeNum <= NumNodesCtrld; ++CtrldNodeNum) {
    1905          23 :                 state.dataSetPointManager->WarmestSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum) = NodeNums(CtrldNodeNum);
    1906             :             }
    1907             :         } else {
    1908           0 :             ErrorsFound = true;
    1909             :         }
    1910             : 
    1911          69 :         AllSetPtMgrNum = SetPtMgrNum + state.dataSetPointManager->NumSchSetPtMgrs + state.dataSetPointManager->NumDualSchSetPtMgrs +
    1912          69 :                          state.dataSetPointManager->NumOutAirSetPtMgrs + state.dataSetPointManager->NumSZRhSetPtMgrs +
    1913          69 :                          state.dataSetPointManager->NumSZHtSetPtMgrs + state.dataSetPointManager->NumSZClSetPtMgrs +
    1914          69 :                          state.dataSetPointManager->NumSZMinHumSetPtMgrs + state.dataSetPointManager->NumSZMaxHumSetPtMgrs +
    1915          46 :                          state.dataSetPointManager->NumMixedAirSetPtMgrs + state.dataSetPointManager->NumOAPretreatSetPtMgrs;
    1916             : 
    1917          23 :         if (!NodeListError) {
    1918          23 :             state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld);
    1919          23 :             state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlNodes = state.dataSetPointManager->WarmestSetPtMgr(SetPtMgrNum).CtrlNodes;
    1920             :         }
    1921          23 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).Name = state.dataSetPointManager->WarmestSetPtMgr(SetPtMgrNum).Name;
    1922          23 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).SPMType = SetPointManagerType::Warmest;
    1923          23 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).SPMIndex = SetPtMgrNum;
    1924          23 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlTypeMode = state.dataSetPointManager->WarmestSetPtMgr(SetPtMgrNum).CtrlTypeMode;
    1925          23 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).NumCtrlNodes = state.dataSetPointManager->WarmestSetPtMgr(SetPtMgrNum).NumCtrlNodes;
    1926             :     }
    1927             : 
    1928             :     // Input the Coldest Setpoint Managers
    1929             : 
    1930         775 :     if (state.dataSetPointManager->NumColdestSetPtMgrs > 0)
    1931           1 :         state.dataSetPointManager->ColdestSetPtMgr.allocate(state.dataSetPointManager->NumColdestSetPtMgrs);
    1932             : 
    1933             :     // Input the data for each Setpoint Manager
    1934         775 :     cCurrentModuleObject = "SetpointManager:Coldest";
    1935         776 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumColdestSetPtMgrs; ++SetPtMgrNum) {
    1936           1 :         state.dataInputProcessing->inputProcessor->getObjectItem(state,
    1937             :                                                                  cCurrentModuleObject,
    1938             :                                                                  SetPtMgrNum,
    1939             :                                                                  cAlphaArgs,
    1940             :                                                                  NumAlphas,
    1941             :                                                                  rNumericArgs,
    1942             :                                                                  NumNums,
    1943             :                                                                  IOStat,
    1944             :                                                                  lNumericFieldBlanks,
    1945             :                                                                  lAlphaFieldBlanks,
    1946             :                                                                  cAlphaFieldNames,
    1947             :                                                                  cNumericFieldNames);
    1948           1 :         UtilityRoutines::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound);
    1949             : 
    1950           1 :         state.dataSetPointManager->ColdestSetPtMgr(SetPtMgrNum).Name = cAlphaArgs(1);
    1951           1 :         state.dataSetPointManager->ColdestSetPtMgr(SetPtMgrNum).ctrlVarType = cAlphaArgs(2);
    1952           1 :         if (UtilityRoutines::SameString(state.dataSetPointManager->ColdestSetPtMgr(SetPtMgrNum).ctrlVarType, "Temperature")) {
    1953           1 :             state.dataSetPointManager->ColdestSetPtMgr(SetPtMgrNum).CtrlTypeMode = CtrlVarType::Temp;
    1954             :         } else {
    1955             :             // should not come here if idd type choice and key list is working
    1956           0 :             ShowSevereError(state, format("{}: {}=\"{}\", invalid field.", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
    1957           0 :             ShowContinueError(state, "..invalid " + cAlphaFieldNames(2) + "=\"" + cAlphaArgs(2) + "\".");
    1958           0 :             ShowContinueError(state, "..Valid value is \"Temperature\".");
    1959           0 :             ErrorsFound = true;
    1960             :         }
    1961           1 :         state.dataSetPointManager->ColdestSetPtMgr(SetPtMgrNum).AirLoopName = cAlphaArgs(3);
    1962           1 :         state.dataSetPointManager->ColdestSetPtMgr(SetPtMgrNum).AirLoopNum = 0;
    1963           1 :         state.dataSetPointManager->ColdestSetPtMgr(SetPtMgrNum).MinSetTemp = rNumericArgs(1);
    1964           1 :         state.dataSetPointManager->ColdestSetPtMgr(SetPtMgrNum).MaxSetTemp = rNumericArgs(2);
    1965           1 :         if (state.dataSetPointManager->ColdestSetPtMgr(SetPtMgrNum).MaxSetTemp < state.dataSetPointManager->ColdestSetPtMgr(SetPtMgrNum).MinSetTemp) {
    1966           0 :             ShowWarningError(state, format("{}: {}=\"{}\",", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
    1967           0 :             ShowContinueError(state,
    1968           0 :                               format("...{}=[{:.1R}] is less than {}=[{:.1R}].",
    1969             :                                      cNumericFieldNames(2),
    1970           0 :                                      state.dataSetPointManager->ColdestSetPtMgr(SetPtMgrNum).MaxSetTemp,
    1971             :                                      cNumericFieldNames(1),
    1972           0 :                                      state.dataSetPointManager->ColdestSetPtMgr(SetPtMgrNum).MinSetTemp));
    1973             :         }
    1974             : 
    1975           1 :         if (UtilityRoutines::MakeUPPERCase(cAlphaArgs(4)) == controlTypeNameUC[static_cast<int>(CtrlVarType::MinTemp)]) {
    1976           1 :             state.dataSetPointManager->ColdestSetPtMgr(SetPtMgrNum).Strategy = SupplyFlowTempStrategy::MinTemp;
    1977             :         } else {
    1978           0 :             ShowSevereError(state, format("{}: {}=\"{}\", invalid field.", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
    1979           0 :             ShowContinueError(state, "..invalid " + cAlphaFieldNames(4) + "=\"" + cAlphaArgs(4) + "\".");
    1980           0 :             ShowContinueError(state, "..Valid value is \"MinimumTemperature\".");
    1981           0 :             ErrorsFound = true;
    1982             :         }
    1983             : 
    1984           1 :         NodeListError = false;
    1985           2 :         GetNodeNums(state,
    1986           1 :                     cAlphaArgs(5),
    1987             :                     NumNodes,
    1988             :                     NodeNums,
    1989             :                     NodeListError,
    1990             :                     DataLoopNode::NodeFluidType::Air,
    1991             :                     DataLoopNode::ConnectionObjectType::SetpointManagerColdest,
    1992           1 :                     cAlphaArgs(1),
    1993             :                     DataLoopNode::ConnectionType::SetPoint,
    1994             :                     NodeInputManager::CompFluidStream::Primary,
    1995             :                     ObjectIsNotParent,
    1996             :                     false,
    1997           1 :                     cAlphaFieldNames(5)); // setpoint nodes
    1998           1 :         if (!NodeListError) {
    1999           1 :             NumNodesCtrld = NumNodes;
    2000           1 :             state.dataSetPointManager->ColdestSetPtMgr(SetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld);
    2001           1 :             state.dataSetPointManager->ColdestSetPtMgr(SetPtMgrNum).NumCtrlNodes = NumNodesCtrld;
    2002           1 :             state.dataSetPointManager->ColdestSetPtMgr(SetPtMgrNum).SetPt = 0.0;
    2003             : 
    2004           2 :             for (CtrldNodeNum = 1; CtrldNodeNum <= NumNodesCtrld; ++CtrldNodeNum) {
    2005           1 :                 state.dataSetPointManager->ColdestSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum) = NodeNums(CtrldNodeNum);
    2006             :             }
    2007             :         } else {
    2008           0 :             ErrorsFound = true;
    2009             :         }
    2010             : 
    2011           3 :         AllSetPtMgrNum = SetPtMgrNum + state.dataSetPointManager->NumSchSetPtMgrs + state.dataSetPointManager->NumDualSchSetPtMgrs +
    2012           3 :                          state.dataSetPointManager->NumOutAirSetPtMgrs + state.dataSetPointManager->NumSZRhSetPtMgrs +
    2013           3 :                          state.dataSetPointManager->NumSZHtSetPtMgrs + state.dataSetPointManager->NumSZClSetPtMgrs +
    2014           3 :                          state.dataSetPointManager->NumSZMinHumSetPtMgrs + state.dataSetPointManager->NumSZMaxHumSetPtMgrs +
    2015           2 :                          state.dataSetPointManager->NumMixedAirSetPtMgrs + state.dataSetPointManager->NumOAPretreatSetPtMgrs +
    2016           1 :                          state.dataSetPointManager->NumWarmestSetPtMgrs;
    2017             : 
    2018           1 :         if (!NodeListError) {
    2019           1 :             state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld);
    2020           1 :             state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlNodes = state.dataSetPointManager->ColdestSetPtMgr(SetPtMgrNum).CtrlNodes;
    2021             :         }
    2022           1 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).Name = state.dataSetPointManager->ColdestSetPtMgr(SetPtMgrNum).Name;
    2023           1 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).SPMType = SetPointManagerType::Coldest;
    2024           1 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).SPMIndex = SetPtMgrNum;
    2025           1 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlTypeMode = state.dataSetPointManager->ColdestSetPtMgr(SetPtMgrNum).CtrlTypeMode;
    2026           1 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).NumCtrlNodes = state.dataSetPointManager->ColdestSetPtMgr(SetPtMgrNum).NumCtrlNodes;
    2027             :     }
    2028             : 
    2029             :     // Input the Warmest Temp Flow Setpoint Managers
    2030             : 
    2031         775 :     if (state.dataSetPointManager->NumWarmestSetPtMgrsTempFlow > 0)
    2032           4 :         state.dataSetPointManager->WarmestSetPtMgrTempFlow.allocate(state.dataSetPointManager->NumWarmestSetPtMgrsTempFlow);
    2033             : 
    2034             :     // Input the data for each Setpoint Manager
    2035         775 :     cCurrentModuleObject = "SetpointManager:WarmestTemperatureFlow";
    2036         779 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumWarmestSetPtMgrsTempFlow; ++SetPtMgrNum) {
    2037           4 :         state.dataInputProcessing->inputProcessor->getObjectItem(state,
    2038             :                                                                  cCurrentModuleObject,
    2039             :                                                                  SetPtMgrNum,
    2040             :                                                                  cAlphaArgs,
    2041             :                                                                  NumAlphas,
    2042             :                                                                  rNumericArgs,
    2043             :                                                                  NumNums,
    2044             :                                                                  IOStat,
    2045             :                                                                  lNumericFieldBlanks,
    2046             :                                                                  lAlphaFieldBlanks,
    2047             :                                                                  cAlphaFieldNames,
    2048             :                                                                  cNumericFieldNames);
    2049           4 :         UtilityRoutines::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound);
    2050             : 
    2051           4 :         state.dataSetPointManager->WarmestSetPtMgrTempFlow(SetPtMgrNum).Name = cAlphaArgs(1);
    2052           4 :         state.dataSetPointManager->WarmestSetPtMgrTempFlow(SetPtMgrNum).ctrlVarType = cAlphaArgs(2);
    2053           4 :         if (UtilityRoutines::SameString(state.dataSetPointManager->WarmestSetPtMgrTempFlow(SetPtMgrNum).ctrlVarType, "Temperature")) {
    2054           4 :             state.dataSetPointManager->WarmestSetPtMgrTempFlow(SetPtMgrNum).CtrlTypeMode = CtrlVarType::Temp;
    2055             :         } else {
    2056             :             // should not come here if idd type choice and key list is working
    2057           0 :             ShowSevereError(state, format("{}: {}=\"{}\", invalid field.", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
    2058           0 :             ShowContinueError(state, "..invalid " + cAlphaFieldNames(2) + "=\"" + cAlphaArgs(2) + "\".");
    2059           0 :             ShowContinueError(state, "..Valid value is \"Temperature\".");
    2060           0 :             ErrorsFound = true;
    2061             :         }
    2062           4 :         state.dataSetPointManager->WarmestSetPtMgrTempFlow(SetPtMgrNum).AirLoopName = cAlphaArgs(3);
    2063           4 :         state.dataSetPointManager->WarmestSetPtMgrTempFlow(SetPtMgrNum).AirLoopNum = 0;
    2064           4 :         state.dataSetPointManager->WarmestSetPtMgrTempFlow(SetPtMgrNum).MinSetTemp = rNumericArgs(1);
    2065           4 :         state.dataSetPointManager->WarmestSetPtMgrTempFlow(SetPtMgrNum).MaxSetTemp = rNumericArgs(2);
    2066           8 :         if (state.dataSetPointManager->WarmestSetPtMgrTempFlow(SetPtMgrNum).MaxSetTemp <
    2067           4 :             state.dataSetPointManager->WarmestSetPtMgrTempFlow(SetPtMgrNum).MinSetTemp) {
    2068           0 :             ShowWarningError(state, format("{}: {}=\"{}\",", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
    2069           0 :             ShowContinueError(state,
    2070           0 :                               format("...{}=[{:.1R}] is less than {}=[{:.1R}].",
    2071             :                                      cNumericFieldNames(2),
    2072           0 :                                      state.dataSetPointManager->WarmestSetPtMgrTempFlow(SetPtMgrNum).MaxSetTemp,
    2073             :                                      cNumericFieldNames(1),
    2074           0 :                                      state.dataSetPointManager->WarmestSetPtMgrTempFlow(SetPtMgrNum).MinSetTemp));
    2075             :         }
    2076           4 :         state.dataSetPointManager->WarmestSetPtMgrTempFlow(SetPtMgrNum).MinTurndown = rNumericArgs(3);
    2077           4 :         if (state.dataSetPointManager->WarmestSetPtMgrTempFlow(SetPtMgrNum).MinTurndown >= 0.8) {
    2078           0 :             ShowWarningError(state, format("{}: {}=\"{}\",", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
    2079           0 :             ShowContinueError(state,
    2080           0 :                               format("...{}=[{:.2R}] is greater than 0.8;",
    2081             :                                      cNumericFieldNames(3),
    2082           0 :                                      state.dataSetPointManager->WarmestSetPtMgrTempFlow(SetPtMgrNum).MinTurndown));
    2083           0 :             ShowContinueError(state, "...typical values for " + cNumericFieldNames(3) + " are less than 0.8.");
    2084             :         }
    2085             : 
    2086           4 :         state.dataSetPointManager->WarmestSetPtMgrTempFlow(SetPtMgrNum).Strategy =
    2087           8 :             static_cast<ControlStrategy>(getEnumerationValue(strategyNamesUC, UtilityRoutines::MakeUPPERCase(cAlphaArgs(4))));
    2088           4 :         if (state.dataSetPointManager->WarmestSetPtMgrTempFlow(SetPtMgrNum).Strategy == ControlStrategy::Invalid) {
    2089           0 :             ShowSevereError(state, format("{}: {}=\"{}\", invalid field.", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
    2090           0 :             ShowContinueError(state, "..invalid " + cAlphaFieldNames(4) + "=\"" + cAlphaArgs(4) + "\".");
    2091           0 :             ShowContinueError(state, R"(..Valid values are "TemperatureFirst" or "FlowFirst".)");
    2092           0 :             ErrorsFound = true;
    2093             :         }
    2094             : 
    2095           4 :         NodeListError = false;
    2096           8 :         GetNodeNums(state,
    2097           4 :                     cAlphaArgs(5),
    2098             :                     NumNodes,
    2099             :                     NodeNums,
    2100             :                     NodeListError,
    2101             :                     DataLoopNode::NodeFluidType::Air,
    2102             :                     DataLoopNode::ConnectionObjectType::SetpointManagerWarmestTemperatureFlow,
    2103           4 :                     cAlphaArgs(1),
    2104             :                     DataLoopNode::ConnectionType::SetPoint,
    2105             :                     NodeInputManager::CompFluidStream::Primary,
    2106             :                     ObjectIsNotParent,
    2107             :                     false,
    2108           4 :                     cAlphaFieldNames(5)); // setpoint nodes
    2109           4 :         if (!NodeListError) {
    2110           4 :             NumNodesCtrld = NumNodes;
    2111           4 :             state.dataSetPointManager->WarmestSetPtMgrTempFlow(SetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld);
    2112           4 :             state.dataSetPointManager->WarmestSetPtMgrTempFlow(SetPtMgrNum).NumCtrlNodes = NumNodesCtrld;
    2113           4 :             state.dataSetPointManager->WarmestSetPtMgrTempFlow(SetPtMgrNum).SetPt = 0.0;
    2114             : 
    2115           8 :             for (CtrldNodeNum = 1; CtrldNodeNum <= NumNodesCtrld; ++CtrldNodeNum) {
    2116           4 :                 state.dataSetPointManager->WarmestSetPtMgrTempFlow(SetPtMgrNum).CtrlNodes(CtrldNodeNum) = NodeNums(CtrldNodeNum);
    2117             :             }
    2118             :         } else {
    2119           0 :             ErrorsFound = true;
    2120             :         }
    2121             : 
    2122          12 :         AllSetPtMgrNum = SetPtMgrNum + state.dataSetPointManager->NumSchSetPtMgrs + state.dataSetPointManager->NumDualSchSetPtMgrs +
    2123          12 :                          state.dataSetPointManager->NumOutAirSetPtMgrs + state.dataSetPointManager->NumSZRhSetPtMgrs +
    2124          12 :                          state.dataSetPointManager->NumSZHtSetPtMgrs + state.dataSetPointManager->NumSZClSetPtMgrs +
    2125          12 :                          state.dataSetPointManager->NumSZMinHumSetPtMgrs + state.dataSetPointManager->NumSZMaxHumSetPtMgrs +
    2126          12 :                          state.dataSetPointManager->NumMixedAirSetPtMgrs + state.dataSetPointManager->NumOAPretreatSetPtMgrs +
    2127           8 :                          state.dataSetPointManager->NumWarmestSetPtMgrs + state.dataSetPointManager->NumColdestSetPtMgrs;
    2128             : 
    2129           4 :         if (!NodeListError) {
    2130           4 :             state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld);
    2131           8 :             state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlNodes =
    2132           8 :                 state.dataSetPointManager->WarmestSetPtMgrTempFlow(SetPtMgrNum).CtrlNodes;
    2133             :         }
    2134           4 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).Name = state.dataSetPointManager->WarmestSetPtMgrTempFlow(SetPtMgrNum).Name;
    2135           4 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).SPMType = SetPointManagerType::WarmestTempFlow;
    2136           4 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).SPMIndex = SetPtMgrNum;
    2137           4 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlTypeMode =
    2138           4 :             state.dataSetPointManager->WarmestSetPtMgrTempFlow(SetPtMgrNum).CtrlTypeMode;
    2139           4 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).NumCtrlNodes =
    2140           4 :             state.dataSetPointManager->WarmestSetPtMgrTempFlow(SetPtMgrNum).NumCtrlNodes;
    2141             :     }
    2142             : 
    2143             :     // Input the Return Air Bypass Flow Setpoint Managers
    2144             : 
    2145         775 :     if (state.dataSetPointManager->NumRABFlowSetPtMgrs > 0)
    2146           1 :         state.dataSetPointManager->RABFlowSetPtMgr.allocate(state.dataSetPointManager->NumRABFlowSetPtMgrs);
    2147             : 
    2148             :     // Input the data for each Setpoint Manager
    2149         775 :     cCurrentModuleObject = "SetpointManager:ReturnAirBypassFlow";
    2150         776 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumRABFlowSetPtMgrs; ++SetPtMgrNum) {
    2151           1 :         state.dataInputProcessing->inputProcessor->getObjectItem(state,
    2152             :                                                                  cCurrentModuleObject,
    2153             :                                                                  SetPtMgrNum,
    2154             :                                                                  cAlphaArgs,
    2155             :                                                                  NumAlphas,
    2156             :                                                                  rNumericArgs,
    2157             :                                                                  NumNums,
    2158             :                                                                  IOStat,
    2159             :                                                                  lNumericFieldBlanks,
    2160             :                                                                  lAlphaFieldBlanks,
    2161             :                                                                  cAlphaFieldNames,
    2162             :                                                                  cNumericFieldNames);
    2163           1 :         UtilityRoutines::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound);
    2164             : 
    2165           1 :         state.dataSetPointManager->RABFlowSetPtMgr(SetPtMgrNum).Name = cAlphaArgs(1);
    2166           1 :         state.dataSetPointManager->RABFlowSetPtMgr(SetPtMgrNum).ctrlVarType = cAlphaArgs(2);
    2167           1 :         state.dataSetPointManager->RABFlowSetPtMgr(SetPtMgrNum).NumCtrlNodes = 1;
    2168           1 :         NumNodesCtrld = 1;
    2169             : 
    2170           1 :         if (UtilityRoutines::SameString(state.dataSetPointManager->RABFlowSetPtMgr(SetPtMgrNum).ctrlVarType, "Flow")) {
    2171           1 :             state.dataSetPointManager->RABFlowSetPtMgr(SetPtMgrNum).CtrlTypeMode = CtrlVarType::MassFlow;
    2172             :         } else {
    2173             :             // should not come here if idd type choice and key list is working
    2174           0 :             ShowSevereError(state, format("{}: {}=\"{}\", invalid field.", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
    2175           0 :             ShowContinueError(state, "..invalid " + cAlphaFieldNames(2) + "=\"" + cAlphaArgs(2) + "\".");
    2176           0 :             ShowContinueError(state, "..Valid value is \"Temperature\".");
    2177           0 :             ErrorsFound = true;
    2178             :         }
    2179           1 :         state.dataSetPointManager->RABFlowSetPtMgr(SetPtMgrNum).AirLoopName = cAlphaArgs(3);
    2180           1 :         state.dataSetPointManager->RABFlowSetPtMgr(SetPtMgrNum).AirLoopNum = 0;
    2181           1 :         state.dataSetPointManager->RABFlowSetPtMgr(SetPtMgrNum).Sched = cAlphaArgs(4);
    2182           1 :         state.dataSetPointManager->RABFlowSetPtMgr(SetPtMgrNum).SchedPtr = GetScheduleIndex(state, cAlphaArgs(4));
    2183           1 :         if (state.dataSetPointManager->RABFlowSetPtMgr(SetPtMgrNum).SchedPtr == 0) {
    2184           0 :             if (lAlphaFieldBlanks(4)) {
    2185           0 :                 ShowSevereError(state, format("{}: {}=\"{}\", bland required field.", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
    2186           0 :                 ShowContinueError(state, "..required field " + cAlphaFieldNames(4));
    2187             :             } else {
    2188           0 :                 ShowSevereError(state, format("{}: {}=\"{}\", invalid field.", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
    2189           0 :                 ShowContinueError(state, "..invalid " + cAlphaFieldNames(4) + "=\"" + cAlphaArgs(4) + "\".");
    2190             :             }
    2191           0 :             ErrorsFound = true;
    2192             :         }
    2193             : 
    2194           3 :         AllSetPtMgrNum = SetPtMgrNum + state.dataSetPointManager->NumSchSetPtMgrs + state.dataSetPointManager->NumDualSchSetPtMgrs +
    2195           3 :                          state.dataSetPointManager->NumOutAirSetPtMgrs + state.dataSetPointManager->NumSZRhSetPtMgrs +
    2196           3 :                          state.dataSetPointManager->NumSZHtSetPtMgrs + state.dataSetPointManager->NumSZClSetPtMgrs +
    2197           3 :                          state.dataSetPointManager->NumSZMinHumSetPtMgrs + state.dataSetPointManager->NumSZMaxHumSetPtMgrs +
    2198           3 :                          state.dataSetPointManager->NumMixedAirSetPtMgrs + state.dataSetPointManager->NumOAPretreatSetPtMgrs +
    2199           2 :                          state.dataSetPointManager->NumWarmestSetPtMgrs + state.dataSetPointManager->NumColdestSetPtMgrs +
    2200           1 :                          state.dataSetPointManager->NumWarmestSetPtMgrsTempFlow;
    2201             : 
    2202           1 :         state.dataSetPointManager->RABFlowSetPtMgr(SetPtMgrNum).AllSetPtMgrIndex = AllSetPtMgrNum;
    2203           1 :         state.dataSetPointManager->RABFlowSetPtMgr(SetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld);
    2204           1 :         state.dataSetPointManager->RABFlowSetPtMgr(SetPtMgrNum).CtrlNodes = 0;
    2205           1 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld);
    2206             :         // need to reset this to the control node (RABSplitOutNode) in Init, will be 0 here
    2207           1 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlNodes = state.dataSetPointManager->RABFlowSetPtMgr(SetPtMgrNum).CtrlNodes;
    2208           1 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).Name = state.dataSetPointManager->RABFlowSetPtMgr(SetPtMgrNum).Name;
    2209           1 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).SPMType = SetPointManagerType::RAB;
    2210           1 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).SPMIndex = SetPtMgrNum;
    2211           1 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlTypeMode = state.dataSetPointManager->RABFlowSetPtMgr(SetPtMgrNum).CtrlTypeMode;
    2212           1 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).NumCtrlNodes = state.dataSetPointManager->RABFlowSetPtMgr(SetPtMgrNum).NumCtrlNodes;
    2213             :     }
    2214             : 
    2215             :     // Input the MultiZone Average Cooling Setpoint Managers
    2216         775 :     if (state.dataSetPointManager->NumMZClgAverageSetPtMgrs > 0)
    2217           1 :         state.dataSetPointManager->MZAverageCoolingSetPtMgr.allocate(state.dataSetPointManager->NumMZClgAverageSetPtMgrs);
    2218             : 
    2219             :     // Input the data for each setpoint manager
    2220         775 :     cCurrentModuleObject = "SetpointManager:MultiZone:Cooling:Average";
    2221         776 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumMZClgAverageSetPtMgrs; ++SetPtMgrNum) {
    2222           1 :         state.dataInputProcessing->inputProcessor->getObjectItem(state,
    2223             :                                                                  cCurrentModuleObject,
    2224             :                                                                  SetPtMgrNum,
    2225             :                                                                  cAlphaArgs,
    2226             :                                                                  NumAlphas,
    2227             :                                                                  rNumericArgs,
    2228             :                                                                  NumNums,
    2229             :                                                                  IOStat,
    2230             :                                                                  lNumericFieldBlanks,
    2231             :                                                                  lAlphaFieldBlanks,
    2232             :                                                                  cAlphaFieldNames,
    2233             :                                                                  cNumericFieldNames);
    2234           1 :         UtilityRoutines::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound);
    2235             : 
    2236           1 :         state.dataSetPointManager->MZAverageCoolingSetPtMgr(SetPtMgrNum).Name = cAlphaArgs(1);
    2237           1 :         state.dataSetPointManager->MZAverageCoolingSetPtMgr(SetPtMgrNum).AirLoopName = cAlphaArgs(2);
    2238           1 :         state.dataSetPointManager->MZAverageCoolingSetPtMgr(SetPtMgrNum).AirLoopNum = 0;
    2239           1 :         state.dataSetPointManager->MZAverageCoolingSetPtMgr(SetPtMgrNum).MinSetTemp = rNumericArgs(1);
    2240           1 :         state.dataSetPointManager->MZAverageCoolingSetPtMgr(SetPtMgrNum).MaxSetTemp = rNumericArgs(2);
    2241           1 :         state.dataSetPointManager->MZAverageCoolingSetPtMgr(SetPtMgrNum).ctrlVarType = "Temperature";
    2242           1 :         state.dataSetPointManager->MZAverageCoolingSetPtMgr(SetPtMgrNum).CtrlTypeMode = CtrlVarType::Temp;
    2243             : 
    2244           2 :         if (state.dataSetPointManager->MZAverageCoolingSetPtMgr(SetPtMgrNum).MaxSetTemp <
    2245           1 :             state.dataSetPointManager->MZAverageCoolingSetPtMgr(SetPtMgrNum).MinSetTemp) {
    2246           0 :             ShowWarningError(state, format("{}: {}=\"{}\",", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
    2247           0 :             ShowContinueError(state,
    2248           0 :                               format("...{}=[{:.1R}] is less than {}=[{:.1R}].",
    2249             :                                      cNumericFieldNames(2),
    2250           0 :                                      state.dataSetPointManager->MZAverageCoolingSetPtMgr(SetPtMgrNum).MaxSetTemp,
    2251             :                                      cNumericFieldNames(1),
    2252           0 :                                      state.dataSetPointManager->MZAverageCoolingSetPtMgr(SetPtMgrNum).MinSetTemp));
    2253             :         }
    2254             : 
    2255           1 :         NodeListError = false;
    2256           2 :         GetNodeNums(state,
    2257           1 :                     cAlphaArgs(3),
    2258             :                     NumNodes,
    2259             :                     NodeNums,
    2260             :                     NodeListError,
    2261             :                     DataLoopNode::NodeFluidType::Air,
    2262             :                     DataLoopNode::ConnectionObjectType::SetpointManagerMultiZoneCoolingAverage,
    2263           1 :                     cAlphaArgs(1),
    2264             :                     DataLoopNode::ConnectionType::SetPoint,
    2265             :                     NodeInputManager::CompFluidStream::Primary,
    2266             :                     ObjectIsNotParent,
    2267             :                     false,
    2268           1 :                     cAlphaFieldNames(3)); // setpoint nodes
    2269           1 :         if (!NodeListError) {
    2270           1 :             NumNodesCtrld = NumNodes;
    2271           1 :             state.dataSetPointManager->MZAverageCoolingSetPtMgr(SetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld);
    2272           1 :             state.dataSetPointManager->MZAverageCoolingSetPtMgr(SetPtMgrNum).NumCtrlNodes = NumNodesCtrld;
    2273           1 :             state.dataSetPointManager->MZAverageCoolingSetPtMgr(SetPtMgrNum).SetPt = 0.0;
    2274             : 
    2275           2 :             for (CtrldNodeNum = 1; CtrldNodeNum <= NumNodesCtrld; ++CtrldNodeNum) {
    2276           1 :                 state.dataSetPointManager->MZAverageCoolingSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum) = NodeNums(CtrldNodeNum);
    2277             :             }
    2278             :         } else {
    2279           0 :             ErrorsFound = true;
    2280             :         }
    2281             : 
    2282           3 :         AllSetPtMgrNum = SetPtMgrNum + state.dataSetPointManager->NumSchSetPtMgrs + state.dataSetPointManager->NumDualSchSetPtMgrs +
    2283           3 :                          state.dataSetPointManager->NumOutAirSetPtMgrs + state.dataSetPointManager->NumSZRhSetPtMgrs +
    2284           3 :                          state.dataSetPointManager->NumSZHtSetPtMgrs + state.dataSetPointManager->NumSZClSetPtMgrs +
    2285           3 :                          state.dataSetPointManager->NumSZMinHumSetPtMgrs + state.dataSetPointManager->NumSZMaxHumSetPtMgrs +
    2286           3 :                          state.dataSetPointManager->NumMixedAirSetPtMgrs + state.dataSetPointManager->NumOAPretreatSetPtMgrs +
    2287           3 :                          state.dataSetPointManager->NumWarmestSetPtMgrs + state.dataSetPointManager->NumColdestSetPtMgrs +
    2288           2 :                          state.dataSetPointManager->NumWarmestSetPtMgrsTempFlow + state.dataSetPointManager->NumRABFlowSetPtMgrs;
    2289             : 
    2290           1 :         if (!NodeListError) {
    2291           1 :             state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld);
    2292           2 :             state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlNodes =
    2293           2 :                 state.dataSetPointManager->MZAverageCoolingSetPtMgr(SetPtMgrNum).CtrlNodes;
    2294             :         }
    2295           1 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).Name = state.dataSetPointManager->MZAverageCoolingSetPtMgr(SetPtMgrNum).Name;
    2296           1 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).SPMType = SetPointManagerType::MZCoolingAverage;
    2297           1 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).SPMIndex = SetPtMgrNum;
    2298           1 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlTypeMode =
    2299           1 :             state.dataSetPointManager->MZAverageCoolingSetPtMgr(SetPtMgrNum).CtrlTypeMode;
    2300           1 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).NumCtrlNodes =
    2301           1 :             state.dataSetPointManager->MZAverageCoolingSetPtMgr(SetPtMgrNum).NumCtrlNodes;
    2302             :     }
    2303             : 
    2304             :     // Input the MultiZone Average Heating Setpoint Managers
    2305         775 :     if (state.dataSetPointManager->NumMZHtgAverageSetPtMgrs > 0)
    2306           1 :         state.dataSetPointManager->MZAverageHeatingSetPtMgr.allocate(state.dataSetPointManager->NumMZHtgAverageSetPtMgrs);
    2307             : 
    2308             :     // Input the data for each setpoint manager
    2309         775 :     cCurrentModuleObject = "SetpointManager:MultiZone:Heating:Average";
    2310         776 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumMZHtgAverageSetPtMgrs; ++SetPtMgrNum) {
    2311           1 :         state.dataInputProcessing->inputProcessor->getObjectItem(state,
    2312             :                                                                  cCurrentModuleObject,
    2313             :                                                                  SetPtMgrNum,
    2314             :                                                                  cAlphaArgs,
    2315             :                                                                  NumAlphas,
    2316             :                                                                  rNumericArgs,
    2317             :                                                                  NumNums,
    2318             :                                                                  IOStat,
    2319             :                                                                  lNumericFieldBlanks,
    2320             :                                                                  lAlphaFieldBlanks,
    2321             :                                                                  cAlphaFieldNames,
    2322             :                                                                  cNumericFieldNames);
    2323           1 :         UtilityRoutines::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound);
    2324             : 
    2325           1 :         state.dataSetPointManager->MZAverageHeatingSetPtMgr(SetPtMgrNum).Name = cAlphaArgs(1);
    2326           1 :         state.dataSetPointManager->MZAverageHeatingSetPtMgr(SetPtMgrNum).AirLoopName = cAlphaArgs(2);
    2327           1 :         state.dataSetPointManager->MZAverageHeatingSetPtMgr(SetPtMgrNum).AirLoopNum = 0;
    2328           1 :         state.dataSetPointManager->MZAverageHeatingSetPtMgr(SetPtMgrNum).MinSetTemp = rNumericArgs(1);
    2329           1 :         state.dataSetPointManager->MZAverageHeatingSetPtMgr(SetPtMgrNum).MaxSetTemp = rNumericArgs(2);
    2330           1 :         state.dataSetPointManager->MZAverageHeatingSetPtMgr(SetPtMgrNum).ctrlVarType = "Temperature";
    2331           1 :         state.dataSetPointManager->MZAverageHeatingSetPtMgr(SetPtMgrNum).CtrlTypeMode = CtrlVarType::Temp;
    2332             : 
    2333           2 :         if (state.dataSetPointManager->MZAverageHeatingSetPtMgr(SetPtMgrNum).MaxSetTemp <
    2334           1 :             state.dataSetPointManager->MZAverageHeatingSetPtMgr(SetPtMgrNum).MinSetTemp) {
    2335           0 :             ShowWarningError(state, format("{}: {}=\"{}\",", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
    2336           0 :             ShowContinueError(state,
    2337           0 :                               format("...{}=[{:.1R}] is less than {}=[{:.1R}].",
    2338             :                                      cNumericFieldNames(2),
    2339           0 :                                      state.dataSetPointManager->MZAverageHeatingSetPtMgr(SetPtMgrNum).MaxSetTemp,
    2340             :                                      cNumericFieldNames(1),
    2341           0 :                                      state.dataSetPointManager->MZAverageHeatingSetPtMgr(SetPtMgrNum).MinSetTemp));
    2342             :         }
    2343             : 
    2344           1 :         NodeListError = false;
    2345           2 :         GetNodeNums(state,
    2346           1 :                     cAlphaArgs(3),
    2347             :                     NumNodes,
    2348             :                     NodeNums,
    2349             :                     NodeListError,
    2350             :                     DataLoopNode::NodeFluidType::Air,
    2351             :                     DataLoopNode::ConnectionObjectType::SetpointManagerMultiZoneHeatingAverage,
    2352           1 :                     cAlphaArgs(1),
    2353             :                     DataLoopNode::ConnectionType::SetPoint,
    2354             :                     NodeInputManager::CompFluidStream::Primary,
    2355             :                     ObjectIsNotParent,
    2356             :                     false,
    2357           1 :                     cAlphaFieldNames(3)); // setpoint nodes
    2358           1 :         if (!NodeListError) {
    2359           1 :             NumNodesCtrld = NumNodes;
    2360           1 :             state.dataSetPointManager->MZAverageHeatingSetPtMgr(SetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld);
    2361           1 :             state.dataSetPointManager->MZAverageHeatingSetPtMgr(SetPtMgrNum).NumCtrlNodes = NumNodesCtrld;
    2362           1 :             state.dataSetPointManager->MZAverageHeatingSetPtMgr(SetPtMgrNum).SetPt = 0.0;
    2363             : 
    2364           2 :             for (CtrldNodeNum = 1; CtrldNodeNum <= NumNodesCtrld; ++CtrldNodeNum) {
    2365           1 :                 state.dataSetPointManager->MZAverageHeatingSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum) = NodeNums(CtrldNodeNum);
    2366             :             }
    2367             :         } else {
    2368           0 :             ErrorsFound = true;
    2369             :         }
    2370             : 
    2371           3 :         AllSetPtMgrNum = SetPtMgrNum + state.dataSetPointManager->NumSchSetPtMgrs + state.dataSetPointManager->NumDualSchSetPtMgrs +
    2372           3 :                          state.dataSetPointManager->NumOutAirSetPtMgrs + state.dataSetPointManager->NumSZRhSetPtMgrs +
    2373           3 :                          state.dataSetPointManager->NumSZHtSetPtMgrs + state.dataSetPointManager->NumSZClSetPtMgrs +
    2374           3 :                          state.dataSetPointManager->NumSZMinHumSetPtMgrs + state.dataSetPointManager->NumSZMaxHumSetPtMgrs +
    2375           3 :                          state.dataSetPointManager->NumMixedAirSetPtMgrs + state.dataSetPointManager->NumOAPretreatSetPtMgrs +
    2376           3 :                          state.dataSetPointManager->NumWarmestSetPtMgrs + state.dataSetPointManager->NumColdestSetPtMgrs +
    2377           2 :                          state.dataSetPointManager->NumWarmestSetPtMgrsTempFlow + state.dataSetPointManager->NumRABFlowSetPtMgrs +
    2378           1 :                          state.dataSetPointManager->NumMZClgAverageSetPtMgrs;
    2379             : 
    2380           1 :         if (!NodeListError) {
    2381           1 :             state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld);
    2382           2 :             state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlNodes =
    2383           2 :                 state.dataSetPointManager->MZAverageHeatingSetPtMgr(SetPtMgrNum).CtrlNodes;
    2384             :         }
    2385           1 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).Name = state.dataSetPointManager->MZAverageHeatingSetPtMgr(SetPtMgrNum).Name;
    2386           1 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).SPMType = SetPointManagerType::MZHeatingAverage;
    2387           1 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).SPMIndex = SetPtMgrNum;
    2388           1 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlTypeMode =
    2389           1 :             state.dataSetPointManager->MZAverageHeatingSetPtMgr(SetPtMgrNum).CtrlTypeMode;
    2390           1 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).NumCtrlNodes =
    2391           1 :             state.dataSetPointManager->MZAverageHeatingSetPtMgr(SetPtMgrNum).NumCtrlNodes;
    2392             :     }
    2393             : 
    2394             :     // Input the MultiZone Average Minimum Humidity Setpoint Managers
    2395         775 :     if (state.dataSetPointManager->NumMZAverageMinHumSetPtMgrs > 0)
    2396           1 :         state.dataSetPointManager->MZAverageMinHumSetPtMgr.allocate(state.dataSetPointManager->NumMZAverageMinHumSetPtMgrs);
    2397             : 
    2398             :     // Input the data for each setpoint manager
    2399         775 :     cCurrentModuleObject = "SetpointManager:MultiZone:MinimumHumidity:Average";
    2400         776 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumMZAverageMinHumSetPtMgrs; ++SetPtMgrNum) {
    2401           1 :         state.dataInputProcessing->inputProcessor->getObjectItem(state,
    2402             :                                                                  cCurrentModuleObject,
    2403             :                                                                  SetPtMgrNum,
    2404             :                                                                  cAlphaArgs,
    2405             :                                                                  NumAlphas,
    2406             :                                                                  rNumericArgs,
    2407             :                                                                  NumNums,
    2408             :                                                                  IOStat,
    2409             :                                                                  lNumericFieldBlanks,
    2410             :                                                                  lAlphaFieldBlanks,
    2411             :                                                                  cAlphaFieldNames,
    2412             :                                                                  cNumericFieldNames);
    2413           1 :         UtilityRoutines::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound);
    2414             : 
    2415           1 :         state.dataSetPointManager->MZAverageMinHumSetPtMgr(SetPtMgrNum).Name = cAlphaArgs(1);
    2416           1 :         state.dataSetPointManager->MZAverageMinHumSetPtMgr(SetPtMgrNum).AirLoopName = cAlphaArgs(2);
    2417           1 :         state.dataSetPointManager->MZAverageMinHumSetPtMgr(SetPtMgrNum).AirLoopNum = 0;
    2418           1 :         state.dataSetPointManager->MZAverageMinHumSetPtMgr(SetPtMgrNum).MinSetHum = rNumericArgs(1);
    2419           1 :         state.dataSetPointManager->MZAverageMinHumSetPtMgr(SetPtMgrNum).MaxSetHum = rNumericArgs(2);
    2420           1 :         state.dataSetPointManager->MZAverageMinHumSetPtMgr(SetPtMgrNum).ctrlVarType = "MinimumHumidityRatio";
    2421           1 :         state.dataSetPointManager->MZAverageMinHumSetPtMgr(SetPtMgrNum).CtrlTypeMode = CtrlVarType::MinHumRat;
    2422             : 
    2423           2 :         if (state.dataSetPointManager->MZAverageMinHumSetPtMgr(SetPtMgrNum).MaxSetHum <
    2424           1 :             state.dataSetPointManager->MZAverageMinHumSetPtMgr(SetPtMgrNum).MinSetHum) {
    2425           0 :             ShowWarningError(state, format("{}: {}=\"{}\",", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
    2426           0 :             ShowContinueError(state,
    2427           0 :                               format("...{}=[{:.3R}] is less than {}=[{:.3R}].",
    2428             :                                      cNumericFieldNames(2),
    2429           0 :                                      state.dataSetPointManager->MZAverageMinHumSetPtMgr(SetPtMgrNum).MaxSetHum,
    2430             :                                      cNumericFieldNames(1),
    2431           0 :                                      state.dataSetPointManager->MZAverageMinHumSetPtMgr(SetPtMgrNum).MinSetHum));
    2432             :         }
    2433             : 
    2434           1 :         NodeListError = false;
    2435           2 :         GetNodeNums(state,
    2436           1 :                     cAlphaArgs(3),
    2437             :                     NumNodes,
    2438             :                     NodeNums,
    2439             :                     NodeListError,
    2440             :                     DataLoopNode::NodeFluidType::Air,
    2441             :                     DataLoopNode::ConnectionObjectType::SetpointManagerMultiZoneMinimumHumidityAverage,
    2442           1 :                     cAlphaArgs(1),
    2443             :                     DataLoopNode::ConnectionType::SetPoint,
    2444             :                     NodeInputManager::CompFluidStream::Primary,
    2445             :                     ObjectIsNotParent,
    2446             :                     false,
    2447           1 :                     cAlphaFieldNames(3)); // setpoint nodes
    2448           1 :         if (!NodeListError) {
    2449           1 :             NumNodesCtrld = NumNodes;
    2450           1 :             state.dataSetPointManager->MZAverageMinHumSetPtMgr(SetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld);
    2451           1 :             state.dataSetPointManager->MZAverageMinHumSetPtMgr(SetPtMgrNum).NumCtrlNodes = NumNodesCtrld;
    2452           1 :             state.dataSetPointManager->MZAverageMinHumSetPtMgr(SetPtMgrNum).SetPt = 0.0;
    2453             : 
    2454           2 :             for (CtrldNodeNum = 1; CtrldNodeNum <= NumNodesCtrld; ++CtrldNodeNum) {
    2455           1 :                 state.dataSetPointManager->MZAverageMinHumSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum) = NodeNums(CtrldNodeNum);
    2456             :             }
    2457             :         } else {
    2458           0 :             ErrorsFound = true;
    2459             :         }
    2460             : 
    2461           3 :         AllSetPtMgrNum = SetPtMgrNum + state.dataSetPointManager->NumSchSetPtMgrs + state.dataSetPointManager->NumDualSchSetPtMgrs +
    2462           3 :                          state.dataSetPointManager->NumOutAirSetPtMgrs + state.dataSetPointManager->NumSZRhSetPtMgrs +
    2463           3 :                          state.dataSetPointManager->NumSZHtSetPtMgrs + state.dataSetPointManager->NumSZClSetPtMgrs +
    2464           3 :                          state.dataSetPointManager->NumSZMinHumSetPtMgrs + state.dataSetPointManager->NumSZMaxHumSetPtMgrs +
    2465           3 :                          state.dataSetPointManager->NumMixedAirSetPtMgrs + state.dataSetPointManager->NumOAPretreatSetPtMgrs +
    2466           3 :                          state.dataSetPointManager->NumWarmestSetPtMgrs + state.dataSetPointManager->NumColdestSetPtMgrs +
    2467           3 :                          state.dataSetPointManager->NumWarmestSetPtMgrsTempFlow + state.dataSetPointManager->NumRABFlowSetPtMgrs +
    2468           2 :                          state.dataSetPointManager->NumMZClgAverageSetPtMgrs + state.dataSetPointManager->NumMZHtgAverageSetPtMgrs;
    2469             : 
    2470           1 :         if (!NodeListError) {
    2471           1 :             state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld);
    2472           2 :             state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlNodes =
    2473           2 :                 state.dataSetPointManager->MZAverageMinHumSetPtMgr(SetPtMgrNum).CtrlNodes;
    2474             :         }
    2475           1 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).Name = state.dataSetPointManager->MZAverageMinHumSetPtMgr(SetPtMgrNum).Name;
    2476           1 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).SPMType = SetPointManagerType::MZMinHumAverage;
    2477           1 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).SPMIndex = SetPtMgrNum;
    2478           1 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlTypeMode =
    2479           1 :             state.dataSetPointManager->MZAverageMinHumSetPtMgr(SetPtMgrNum).CtrlTypeMode;
    2480           1 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).NumCtrlNodes =
    2481           1 :             state.dataSetPointManager->MZAverageMinHumSetPtMgr(SetPtMgrNum).NumCtrlNodes;
    2482             :     }
    2483             : 
    2484             :     // Input the MultiZone Average Maximum Humidity SetPoint Managers
    2485         775 :     if (state.dataSetPointManager->NumMZAverageMaxHumSetPtMgrs > 0)
    2486           1 :         state.dataSetPointManager->MZAverageMaxHumSetPtMgr.allocate(state.dataSetPointManager->NumMZAverageMaxHumSetPtMgrs);
    2487             : 
    2488             :     // Input the data for each setpoint manager
    2489         775 :     cCurrentModuleObject = "SetpointManager:MultiZone:MaximumHumidity:Average";
    2490         776 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumMZAverageMaxHumSetPtMgrs; ++SetPtMgrNum) {
    2491           1 :         state.dataInputProcessing->inputProcessor->getObjectItem(state,
    2492             :                                                                  cCurrentModuleObject,
    2493             :                                                                  SetPtMgrNum,
    2494             :                                                                  cAlphaArgs,
    2495             :                                                                  NumAlphas,
    2496             :                                                                  rNumericArgs,
    2497             :                                                                  NumNums,
    2498             :                                                                  IOStat,
    2499             :                                                                  lNumericFieldBlanks,
    2500             :                                                                  lAlphaFieldBlanks,
    2501             :                                                                  cAlphaFieldNames,
    2502             :                                                                  cNumericFieldNames);
    2503           1 :         UtilityRoutines::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound);
    2504             : 
    2505           1 :         state.dataSetPointManager->MZAverageMaxHumSetPtMgr(SetPtMgrNum).Name = cAlphaArgs(1);
    2506           1 :         state.dataSetPointManager->MZAverageMaxHumSetPtMgr(SetPtMgrNum).AirLoopName = cAlphaArgs(2);
    2507           1 :         state.dataSetPointManager->MZAverageMaxHumSetPtMgr(SetPtMgrNum).AirLoopNum = 0;
    2508           1 :         state.dataSetPointManager->MZAverageMaxHumSetPtMgr(SetPtMgrNum).MinSetHum = rNumericArgs(1);
    2509           1 :         state.dataSetPointManager->MZAverageMaxHumSetPtMgr(SetPtMgrNum).MaxSetHum = rNumericArgs(2);
    2510           1 :         state.dataSetPointManager->MZAverageMaxHumSetPtMgr(SetPtMgrNum).ctrlVarType = "MaximumHumidityRatio";
    2511           1 :         state.dataSetPointManager->MZAverageMaxHumSetPtMgr(SetPtMgrNum).CtrlTypeMode = CtrlVarType::MaxHumRat;
    2512             : 
    2513           2 :         if (state.dataSetPointManager->MZAverageMaxHumSetPtMgr(SetPtMgrNum).MaxSetHum <
    2514           1 :             state.dataSetPointManager->MZAverageMaxHumSetPtMgr(SetPtMgrNum).MinSetHum) {
    2515           0 :             ShowWarningError(state, format("{}: {}=\"{}\",", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
    2516           0 :             ShowContinueError(state,
    2517           0 :                               format("...{}=[{:.3R}] is less than {}=[{:.3R}].",
    2518             :                                      cNumericFieldNames(2),
    2519           0 :                                      state.dataSetPointManager->MZAverageMaxHumSetPtMgr(SetPtMgrNum).MaxSetHum,
    2520             :                                      cNumericFieldNames(1),
    2521           0 :                                      state.dataSetPointManager->MZAverageMaxHumSetPtMgr(SetPtMgrNum).MinSetHum));
    2522             :         }
    2523             : 
    2524           1 :         NodeListError = false;
    2525           2 :         GetNodeNums(state,
    2526           1 :                     cAlphaArgs(3),
    2527             :                     NumNodes,
    2528             :                     NodeNums,
    2529             :                     NodeListError,
    2530             :                     DataLoopNode::NodeFluidType::Air,
    2531             :                     DataLoopNode::ConnectionObjectType::SetpointManagerMultiZoneMaximumHumidityAverage,
    2532           1 :                     cAlphaArgs(1),
    2533             :                     DataLoopNode::ConnectionType::SetPoint,
    2534             :                     NodeInputManager::CompFluidStream::Primary,
    2535             :                     ObjectIsNotParent,
    2536             :                     false,
    2537           1 :                     cAlphaFieldNames(3)); // setpoint nodes
    2538           1 :         if (!NodeListError) {
    2539           1 :             NumNodesCtrld = NumNodes;
    2540           1 :             state.dataSetPointManager->MZAverageMaxHumSetPtMgr(SetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld);
    2541           1 :             state.dataSetPointManager->MZAverageMaxHumSetPtMgr(SetPtMgrNum).NumCtrlNodes = NumNodesCtrld;
    2542           1 :             state.dataSetPointManager->MZAverageMaxHumSetPtMgr(SetPtMgrNum).SetPt = 0.0;
    2543             : 
    2544           2 :             for (CtrldNodeNum = 1; CtrldNodeNum <= NumNodesCtrld; ++CtrldNodeNum) {
    2545           1 :                 state.dataSetPointManager->MZAverageMaxHumSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum) = NodeNums(CtrldNodeNum);
    2546             :             }
    2547             :         } else {
    2548           0 :             ErrorsFound = true;
    2549             :         }
    2550             : 
    2551           3 :         AllSetPtMgrNum = SetPtMgrNum + state.dataSetPointManager->NumSchSetPtMgrs + state.dataSetPointManager->NumDualSchSetPtMgrs +
    2552           3 :                          state.dataSetPointManager->NumOutAirSetPtMgrs + state.dataSetPointManager->NumSZRhSetPtMgrs +
    2553           3 :                          state.dataSetPointManager->NumSZHtSetPtMgrs + state.dataSetPointManager->NumSZClSetPtMgrs +
    2554           3 :                          state.dataSetPointManager->NumSZMinHumSetPtMgrs + state.dataSetPointManager->NumSZMaxHumSetPtMgrs +
    2555           3 :                          state.dataSetPointManager->NumMixedAirSetPtMgrs + state.dataSetPointManager->NumOAPretreatSetPtMgrs +
    2556           3 :                          state.dataSetPointManager->NumWarmestSetPtMgrs + state.dataSetPointManager->NumColdestSetPtMgrs +
    2557           3 :                          state.dataSetPointManager->NumWarmestSetPtMgrsTempFlow + state.dataSetPointManager->NumRABFlowSetPtMgrs +
    2558           2 :                          state.dataSetPointManager->NumMZClgAverageSetPtMgrs + state.dataSetPointManager->NumMZHtgAverageSetPtMgrs +
    2559           1 :                          state.dataSetPointManager->NumMZAverageMinHumSetPtMgrs;
    2560             : 
    2561           1 :         if (!NodeListError) {
    2562           1 :             state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld);
    2563           2 :             state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlNodes =
    2564           2 :                 state.dataSetPointManager->MZAverageMaxHumSetPtMgr(SetPtMgrNum).CtrlNodes;
    2565             :         }
    2566           1 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).Name = state.dataSetPointManager->MZAverageMaxHumSetPtMgr(SetPtMgrNum).Name;
    2567           1 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).SPMType = SetPointManagerType::MZMaxHumAverage;
    2568           1 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).SPMIndex = SetPtMgrNum;
    2569           1 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlTypeMode =
    2570           1 :             state.dataSetPointManager->MZAverageMaxHumSetPtMgr(SetPtMgrNum).CtrlTypeMode;
    2571           1 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).NumCtrlNodes =
    2572           1 :             state.dataSetPointManager->MZAverageMaxHumSetPtMgr(SetPtMgrNum).NumCtrlNodes;
    2573             :     }
    2574             : 
    2575             :     // Input the Multizone Minimum Humidity Ratio SetPoint Managers
    2576         775 :     if (state.dataSetPointManager->NumMZMinHumSetPtMgrs > 0)
    2577           4 :         state.dataSetPointManager->MZMinHumSetPtMgr.allocate(state.dataSetPointManager->NumMZMinHumSetPtMgrs);
    2578             : 
    2579             :     // Input the data for each setpoint manager
    2580         775 :     cCurrentModuleObject = "SetpointManager:MultiZone:Humidity:Minimum";
    2581         783 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumMZMinHumSetPtMgrs; ++SetPtMgrNum) {
    2582           8 :         state.dataInputProcessing->inputProcessor->getObjectItem(state,
    2583             :                                                                  cCurrentModuleObject,
    2584             :                                                                  SetPtMgrNum,
    2585             :                                                                  cAlphaArgs,
    2586             :                                                                  NumAlphas,
    2587             :                                                                  rNumericArgs,
    2588             :                                                                  NumNums,
    2589             :                                                                  IOStat,
    2590             :                                                                  lNumericFieldBlanks,
    2591             :                                                                  lAlphaFieldBlanks,
    2592             :                                                                  cAlphaFieldNames,
    2593             :                                                                  cNumericFieldNames);
    2594           8 :         UtilityRoutines::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound);
    2595             : 
    2596           8 :         state.dataSetPointManager->MZMinHumSetPtMgr(SetPtMgrNum).Name = cAlphaArgs(1);
    2597           8 :         state.dataSetPointManager->MZMinHumSetPtMgr(SetPtMgrNum).AirLoopName = cAlphaArgs(2);
    2598           8 :         state.dataSetPointManager->MZMinHumSetPtMgr(SetPtMgrNum).AirLoopNum = 0;
    2599           8 :         state.dataSetPointManager->MZMinHumSetPtMgr(SetPtMgrNum).MinSetHum = rNumericArgs(1);
    2600           8 :         state.dataSetPointManager->MZMinHumSetPtMgr(SetPtMgrNum).MaxSetHum = rNumericArgs(2);
    2601           8 :         state.dataSetPointManager->MZMinHumSetPtMgr(SetPtMgrNum).ctrlVarType = "MinimumHumidityRatio";
    2602           8 :         state.dataSetPointManager->MZMinHumSetPtMgr(SetPtMgrNum).CtrlTypeMode = CtrlVarType::MinHumRat;
    2603             : 
    2604           8 :         if (state.dataSetPointManager->MZMinHumSetPtMgr(SetPtMgrNum).MaxSetHum < state.dataSetPointManager->MZMinHumSetPtMgr(SetPtMgrNum).MinSetHum) {
    2605           0 :             ShowWarningError(state, format("{}: {}=\"{}\",", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
    2606           0 :             ShowContinueError(state,
    2607           0 :                               format("...{}=[{:.3R}] is less than {}=[{:.3R}].",
    2608             :                                      cNumericFieldNames(2),
    2609           0 :                                      state.dataSetPointManager->MZMinHumSetPtMgr(SetPtMgrNum).MaxSetHum,
    2610             :                                      cNumericFieldNames(1),
    2611           0 :                                      state.dataSetPointManager->MZMinHumSetPtMgr(SetPtMgrNum).MinSetHum));
    2612             :         }
    2613             : 
    2614           8 :         NodeListError = false;
    2615          16 :         GetNodeNums(state,
    2616           8 :                     cAlphaArgs(3),
    2617             :                     NumNodes,
    2618             :                     NodeNums,
    2619             :                     NodeListError,
    2620             :                     DataLoopNode::NodeFluidType::Air,
    2621             :                     DataLoopNode::ConnectionObjectType::SetpointManagerMultiZoneHumidityMinimum,
    2622           8 :                     cAlphaArgs(1),
    2623             :                     DataLoopNode::ConnectionType::SetPoint,
    2624             :                     NodeInputManager::CompFluidStream::Primary,
    2625             :                     ObjectIsNotParent,
    2626             :                     false,
    2627           8 :                     cAlphaFieldNames(3)); // setpoint nodes
    2628           8 :         if (!NodeListError) {
    2629           8 :             NumNodesCtrld = NumNodes;
    2630           8 :             state.dataSetPointManager->MZMinHumSetPtMgr(SetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld);
    2631           8 :             state.dataSetPointManager->MZMinHumSetPtMgr(SetPtMgrNum).NumCtrlNodes = NumNodesCtrld;
    2632           8 :             state.dataSetPointManager->MZMinHumSetPtMgr(SetPtMgrNum).SetPt = 0.0;
    2633             : 
    2634          16 :             for (CtrldNodeNum = 1; CtrldNodeNum <= NumNodesCtrld; ++CtrldNodeNum) {
    2635           8 :                 state.dataSetPointManager->MZMinHumSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum) = NodeNums(CtrldNodeNum);
    2636             :             }
    2637             :         } else {
    2638           0 :             ErrorsFound = true;
    2639             :         }
    2640             : 
    2641          24 :         AllSetPtMgrNum = SetPtMgrNum + state.dataSetPointManager->NumSchSetPtMgrs + state.dataSetPointManager->NumDualSchSetPtMgrs +
    2642          24 :                          state.dataSetPointManager->NumOutAirSetPtMgrs + state.dataSetPointManager->NumSZRhSetPtMgrs +
    2643          24 :                          state.dataSetPointManager->NumSZHtSetPtMgrs + state.dataSetPointManager->NumSZClSetPtMgrs +
    2644          24 :                          state.dataSetPointManager->NumSZMinHumSetPtMgrs + state.dataSetPointManager->NumSZMaxHumSetPtMgrs +
    2645          24 :                          state.dataSetPointManager->NumMixedAirSetPtMgrs + state.dataSetPointManager->NumOAPretreatSetPtMgrs +
    2646          24 :                          state.dataSetPointManager->NumWarmestSetPtMgrs + state.dataSetPointManager->NumColdestSetPtMgrs +
    2647          24 :                          state.dataSetPointManager->NumWarmestSetPtMgrsTempFlow + state.dataSetPointManager->NumRABFlowSetPtMgrs +
    2648          24 :                          state.dataSetPointManager->NumMZClgAverageSetPtMgrs + state.dataSetPointManager->NumMZHtgAverageSetPtMgrs +
    2649          16 :                          state.dataSetPointManager->NumMZAverageMinHumSetPtMgrs + state.dataSetPointManager->NumMZAverageMaxHumSetPtMgrs;
    2650             : 
    2651           8 :         if (!NodeListError) {
    2652           8 :             state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld);
    2653           8 :             state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlNodes = state.dataSetPointManager->MZMinHumSetPtMgr(SetPtMgrNum).CtrlNodes;
    2654             :         }
    2655           8 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).Name = state.dataSetPointManager->MZMinHumSetPtMgr(SetPtMgrNum).Name;
    2656           8 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).SPMType = SetPointManagerType::MZMinHum;
    2657           8 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).SPMIndex = SetPtMgrNum;
    2658           8 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlTypeMode = state.dataSetPointManager->MZMinHumSetPtMgr(SetPtMgrNum).CtrlTypeMode;
    2659           8 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).NumCtrlNodes = state.dataSetPointManager->MZMinHumSetPtMgr(SetPtMgrNum).NumCtrlNodes;
    2660             :     }
    2661             : 
    2662             :     // Input the Multizone Maximum Humidity Ratio SetPoint Managers
    2663         775 :     if (state.dataSetPointManager->NumMZMaxHumSetPtMgrs > 0)
    2664          10 :         state.dataSetPointManager->MZMaxHumSetPtMgr.allocate(state.dataSetPointManager->NumMZMaxHumSetPtMgrs);
    2665             : 
    2666             :     // Input the data for each setpoint manager
    2667         775 :     cCurrentModuleObject = "SetpointManager:MultiZone:Humidity:Maximum";
    2668         789 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumMZMaxHumSetPtMgrs; ++SetPtMgrNum) {
    2669          14 :         state.dataInputProcessing->inputProcessor->getObjectItem(state,
    2670             :                                                                  cCurrentModuleObject,
    2671             :                                                                  SetPtMgrNum,
    2672             :                                                                  cAlphaArgs,
    2673             :                                                                  NumAlphas,
    2674             :                                                                  rNumericArgs,
    2675             :                                                                  NumNums,
    2676             :                                                                  IOStat,
    2677             :                                                                  lNumericFieldBlanks,
    2678             :                                                                  lAlphaFieldBlanks,
    2679             :                                                                  cAlphaFieldNames,
    2680             :                                                                  cNumericFieldNames);
    2681          14 :         UtilityRoutines::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound);
    2682             : 
    2683          14 :         state.dataSetPointManager->MZMaxHumSetPtMgr(SetPtMgrNum).Name = cAlphaArgs(1);
    2684          14 :         state.dataSetPointManager->MZMaxHumSetPtMgr(SetPtMgrNum).AirLoopName = cAlphaArgs(2);
    2685          14 :         state.dataSetPointManager->MZMaxHumSetPtMgr(SetPtMgrNum).AirLoopNum = 0;
    2686          14 :         state.dataSetPointManager->MZMaxHumSetPtMgr(SetPtMgrNum).MinSetHum = rNumericArgs(1);
    2687          14 :         state.dataSetPointManager->MZMaxHumSetPtMgr(SetPtMgrNum).MaxSetHum = rNumericArgs(2);
    2688          14 :         state.dataSetPointManager->MZMaxHumSetPtMgr(SetPtMgrNum).ctrlVarType = "MaximumHumidityRatio";
    2689          14 :         state.dataSetPointManager->MZMaxHumSetPtMgr(SetPtMgrNum).CtrlTypeMode = CtrlVarType::MaxHumRat;
    2690             : 
    2691          14 :         if (state.dataSetPointManager->MZMaxHumSetPtMgr(SetPtMgrNum).MaxSetHum < state.dataSetPointManager->MZMaxHumSetPtMgr(SetPtMgrNum).MinSetHum) {
    2692           0 :             ShowWarningError(state, format("{}: {}=\"{}\",", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
    2693           0 :             ShowContinueError(state,
    2694           0 :                               format("...{}=[{:.3R}] is less than {}=[{:.3R}].",
    2695             :                                      cNumericFieldNames(2),
    2696           0 :                                      state.dataSetPointManager->MZMaxHumSetPtMgr(SetPtMgrNum).MaxSetHum,
    2697             :                                      cNumericFieldNames(1),
    2698           0 :                                      state.dataSetPointManager->MZMaxHumSetPtMgr(SetPtMgrNum).MinSetHum));
    2699             :         }
    2700             : 
    2701          14 :         NodeListError = false;
    2702          28 :         GetNodeNums(state,
    2703          14 :                     cAlphaArgs(3),
    2704             :                     NumNodes,
    2705             :                     NodeNums,
    2706             :                     NodeListError,
    2707             :                     DataLoopNode::NodeFluidType::Air,
    2708             :                     DataLoopNode::ConnectionObjectType::SetpointManagerMultiZoneHumidityMaximum,
    2709          14 :                     cAlphaArgs(1),
    2710             :                     DataLoopNode::ConnectionType::SetPoint,
    2711             :                     NodeInputManager::CompFluidStream::Primary,
    2712             :                     ObjectIsNotParent,
    2713             :                     false,
    2714          14 :                     cAlphaFieldNames(3)); // setpoint nodes
    2715          14 :         if (!NodeListError) {
    2716          14 :             NumNodesCtrld = NumNodes;
    2717          14 :             state.dataSetPointManager->MZMaxHumSetPtMgr(SetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld);
    2718          14 :             state.dataSetPointManager->MZMaxHumSetPtMgr(SetPtMgrNum).NumCtrlNodes = NumNodesCtrld;
    2719          14 :             state.dataSetPointManager->MZMaxHumSetPtMgr(SetPtMgrNum).SetPt = 0.0;
    2720             : 
    2721          32 :             for (CtrldNodeNum = 1; CtrldNodeNum <= NumNodesCtrld; ++CtrldNodeNum) {
    2722          18 :                 state.dataSetPointManager->MZMaxHumSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum) = NodeNums(CtrldNodeNum);
    2723             :             }
    2724             :         } else {
    2725           0 :             ErrorsFound = true;
    2726             :         }
    2727             : 
    2728          42 :         AllSetPtMgrNum = SetPtMgrNum + state.dataSetPointManager->NumSchSetPtMgrs + state.dataSetPointManager->NumDualSchSetPtMgrs +
    2729          42 :                          state.dataSetPointManager->NumOutAirSetPtMgrs + state.dataSetPointManager->NumSZRhSetPtMgrs +
    2730          42 :                          state.dataSetPointManager->NumSZHtSetPtMgrs + state.dataSetPointManager->NumSZClSetPtMgrs +
    2731          42 :                          state.dataSetPointManager->NumSZMinHumSetPtMgrs + state.dataSetPointManager->NumSZMaxHumSetPtMgrs +
    2732          42 :                          state.dataSetPointManager->NumMixedAirSetPtMgrs + state.dataSetPointManager->NumOAPretreatSetPtMgrs +
    2733          42 :                          state.dataSetPointManager->NumWarmestSetPtMgrs + state.dataSetPointManager->NumColdestSetPtMgrs +
    2734          42 :                          state.dataSetPointManager->NumWarmestSetPtMgrsTempFlow + state.dataSetPointManager->NumRABFlowSetPtMgrs +
    2735          42 :                          state.dataSetPointManager->NumMZClgAverageSetPtMgrs + state.dataSetPointManager->NumMZHtgAverageSetPtMgrs +
    2736          28 :                          state.dataSetPointManager->NumMZAverageMinHumSetPtMgrs + state.dataSetPointManager->NumMZAverageMaxHumSetPtMgrs +
    2737          14 :                          state.dataSetPointManager->NumMZMinHumSetPtMgrs;
    2738             : 
    2739          14 :         if (!NodeListError) {
    2740          14 :             state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld);
    2741          14 :             state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlNodes = state.dataSetPointManager->MZMaxHumSetPtMgr(SetPtMgrNum).CtrlNodes;
    2742             :         }
    2743          14 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).Name = state.dataSetPointManager->MZMaxHumSetPtMgr(SetPtMgrNum).Name;
    2744          14 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).SPMType = SetPointManagerType::MZMaxHum;
    2745          14 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).SPMIndex = SetPtMgrNum;
    2746          14 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlTypeMode = state.dataSetPointManager->MZMaxHumSetPtMgr(SetPtMgrNum).CtrlTypeMode;
    2747          14 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).NumCtrlNodes = state.dataSetPointManager->MZMaxHumSetPtMgr(SetPtMgrNum).NumCtrlNodes;
    2748             :     }
    2749             : 
    2750             :     // Input the Follow Outdoor Air Temperature Setpoint Managers
    2751             : 
    2752         775 :     if (state.dataSetPointManager->NumFollowOATempSetPtMgrs > 0)
    2753         203 :         state.dataSetPointManager->FollowOATempSetPtMgr.allocate(state.dataSetPointManager->NumFollowOATempSetPtMgrs);
    2754             : 
    2755             :     // Input the data for each Setpoint Manager
    2756         775 :     cCurrentModuleObject = "SetpointManager:FollowOutdoorAirTemperature";
    2757         979 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumFollowOATempSetPtMgrs; ++SetPtMgrNum) {
    2758         204 :         state.dataInputProcessing->inputProcessor->getObjectItem(state,
    2759             :                                                                  cCurrentModuleObject,
    2760             :                                                                  SetPtMgrNum,
    2761             :                                                                  cAlphaArgs,
    2762             :                                                                  NumAlphas,
    2763             :                                                                  rNumericArgs,
    2764             :                                                                  NumNums,
    2765             :                                                                  IOStat,
    2766             :                                                                  lNumericFieldBlanks,
    2767             :                                                                  lAlphaFieldBlanks,
    2768             :                                                                  cAlphaFieldNames,
    2769             :                                                                  cNumericFieldNames);
    2770         204 :         UtilityRoutines::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound);
    2771             : 
    2772         204 :         state.dataSetPointManager->FollowOATempSetPtMgr(SetPtMgrNum).Name = cAlphaArgs(1);
    2773         204 :         state.dataSetPointManager->FollowOATempSetPtMgr(SetPtMgrNum).ctrlVarType = cAlphaArgs(2);
    2774         204 :         if (UtilityRoutines::SameString(state.dataSetPointManager->FollowOATempSetPtMgr(SetPtMgrNum).ctrlVarType, "Temperature")) {
    2775         204 :             state.dataSetPointManager->FollowOATempSetPtMgr(SetPtMgrNum).CtrlTypeMode = CtrlVarType::Temp;
    2776           0 :         } else if (UtilityRoutines::SameString(state.dataSetPointManager->FollowOATempSetPtMgr(SetPtMgrNum).ctrlVarType, "MaximumTemperature")) {
    2777           0 :             state.dataSetPointManager->FollowOATempSetPtMgr(SetPtMgrNum).CtrlTypeMode = CtrlVarType::MaxTemp;
    2778           0 :         } else if (UtilityRoutines::SameString(state.dataSetPointManager->FollowOATempSetPtMgr(SetPtMgrNum).ctrlVarType, "MinimumTemperature")) {
    2779           0 :             state.dataSetPointManager->FollowOATempSetPtMgr(SetPtMgrNum).CtrlTypeMode = CtrlVarType::MinTemp;
    2780             :         } else {
    2781             :             // should not come here if idd type choice and key list is working
    2782           0 :             ShowSevereError(state, format("{}: {}=\"{}\", invalid field.", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
    2783           0 :             ShowContinueError(state, "..invalid " + cAlphaFieldNames(2) + "=\"" + cAlphaArgs(2) + "\".");
    2784           0 :             ShowContinueError(state, R"(..Valid values are "Temperature","MaximumTemperature" or "MinimumTemperature".)");
    2785           0 :             ErrorsFound = true;
    2786             :         }
    2787         204 :         state.dataSetPointManager->FollowOATempSetPtMgr(SetPtMgrNum).RefTempType = cAlphaArgs(3);
    2788         204 :         if (UtilityRoutines::SameString(state.dataSetPointManager->FollowOATempSetPtMgr(SetPtMgrNum).RefTempType, "OutdoorAirWetBulb")) {
    2789         202 :             state.dataSetPointManager->FollowOATempSetPtMgr(SetPtMgrNum).RefTypeMode = ReferenceTempType::WetBulb;
    2790           2 :         } else if (UtilityRoutines::SameString(state.dataSetPointManager->FollowOATempSetPtMgr(SetPtMgrNum).RefTempType, "OutdoorAirDryBulb")) {
    2791           2 :             state.dataSetPointManager->FollowOATempSetPtMgr(SetPtMgrNum).RefTypeMode = ReferenceTempType::DryBulb;
    2792             :         } else {
    2793           0 :             ShowSevereError(state, format("{}: {}=\"{}\", invalid field.", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
    2794           0 :             ShowContinueError(state, "..invalid " + cAlphaFieldNames(3) + "=\"" + cAlphaArgs(3) + "\".");
    2795           0 :             ShowContinueError(state, R"(..Valid values are "OutdoorAirWetBulb" or "OutdoorAirDryBulb".)");
    2796           0 :             ErrorsFound = true;
    2797             :         }
    2798         204 :         state.dataSetPointManager->FollowOATempSetPtMgr(SetPtMgrNum).Offset = rNumericArgs(1);
    2799         204 :         state.dataSetPointManager->FollowOATempSetPtMgr(SetPtMgrNum).MaxSetTemp = rNumericArgs(2);
    2800         204 :         state.dataSetPointManager->FollowOATempSetPtMgr(SetPtMgrNum).MinSetTemp = rNumericArgs(3);
    2801         408 :         if (state.dataSetPointManager->FollowOATempSetPtMgr(SetPtMgrNum).MaxSetTemp <
    2802         204 :             state.dataSetPointManager->FollowOATempSetPtMgr(SetPtMgrNum).MinSetTemp) {
    2803           0 :             ShowWarningError(state, format("{}: {}=\"{}\",", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
    2804           0 :             ShowContinueError(state,
    2805           0 :                               format("...{}=[{:.1R}] is less than {}=[{:.1R}].",
    2806             :                                      cNumericFieldNames(2),
    2807           0 :                                      state.dataSetPointManager->FollowOATempSetPtMgr(SetPtMgrNum).MaxSetTemp,
    2808             :                                      cNumericFieldNames(3),
    2809           0 :                                      state.dataSetPointManager->FollowOATempSetPtMgr(SetPtMgrNum).MinSetTemp));
    2810             :         }
    2811             : 
    2812         204 :         NodeListError = false;
    2813         408 :         GetNodeNums(state,
    2814         204 :                     cAlphaArgs(4),
    2815             :                     NumNodes,
    2816             :                     NodeNums,
    2817             :                     NodeListError,
    2818             :                     DataLoopNode::NodeFluidType::Blank,
    2819             :                     DataLoopNode::ConnectionObjectType::SetpointManagerFollowOutdoorAirTemperature,
    2820         204 :                     cAlphaArgs(1),
    2821             :                     DataLoopNode::ConnectionType::SetPoint,
    2822             :                     NodeInputManager::CompFluidStream::Primary,
    2823             :                     ObjectIsNotParent,
    2824             :                     false,
    2825         204 :                     cAlphaFieldNames(4)); // setpoint nodes
    2826         204 :         if (!NodeListError) {
    2827         204 :             NumNodesCtrld = NumNodes;
    2828         204 :             state.dataSetPointManager->FollowOATempSetPtMgr(SetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld);
    2829         204 :             state.dataSetPointManager->FollowOATempSetPtMgr(SetPtMgrNum).NumCtrlNodes = NumNodesCtrld;
    2830         204 :             state.dataSetPointManager->FollowOATempSetPtMgr(SetPtMgrNum).SetPt = 0.0;
    2831             : 
    2832         408 :             for (CtrldNodeNum = 1; CtrldNodeNum <= NumNodesCtrld; ++CtrldNodeNum) {
    2833         204 :                 state.dataSetPointManager->FollowOATempSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum) = NodeNums(CtrldNodeNum);
    2834             :             }
    2835             :         } else {
    2836           0 :             ErrorsFound = true;
    2837             :         }
    2838             : 
    2839         612 :         AllSetPtMgrNum = SetPtMgrNum + state.dataSetPointManager->NumSchSetPtMgrs + state.dataSetPointManager->NumDualSchSetPtMgrs +
    2840         612 :                          state.dataSetPointManager->NumOutAirSetPtMgrs + state.dataSetPointManager->NumSZRhSetPtMgrs +
    2841         612 :                          state.dataSetPointManager->NumSZHtSetPtMgrs + state.dataSetPointManager->NumSZClSetPtMgrs +
    2842         612 :                          state.dataSetPointManager->NumSZMinHumSetPtMgrs + state.dataSetPointManager->NumSZMaxHumSetPtMgrs +
    2843         612 :                          state.dataSetPointManager->NumMixedAirSetPtMgrs + state.dataSetPointManager->NumOAPretreatSetPtMgrs +
    2844         612 :                          state.dataSetPointManager->NumWarmestSetPtMgrs + state.dataSetPointManager->NumColdestSetPtMgrs +
    2845         612 :                          state.dataSetPointManager->NumWarmestSetPtMgrsTempFlow + state.dataSetPointManager->NumRABFlowSetPtMgrs +
    2846         612 :                          state.dataSetPointManager->NumMZClgAverageSetPtMgrs + state.dataSetPointManager->NumMZHtgAverageSetPtMgrs +
    2847         612 :                          state.dataSetPointManager->NumMZAverageMinHumSetPtMgrs + state.dataSetPointManager->NumMZAverageMaxHumSetPtMgrs +
    2848         408 :                          state.dataSetPointManager->NumMZMinHumSetPtMgrs + state.dataSetPointManager->NumMZMaxHumSetPtMgrs;
    2849             : 
    2850         204 :         if (!NodeListError) {
    2851         204 :             state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld);
    2852         204 :             state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlNodes = state.dataSetPointManager->FollowOATempSetPtMgr(SetPtMgrNum).CtrlNodes;
    2853             :         }
    2854         204 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).Name = state.dataSetPointManager->FollowOATempSetPtMgr(SetPtMgrNum).Name;
    2855         204 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).SPMType = SetPointManagerType::FollowOATemp;
    2856         204 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).SPMIndex = SetPtMgrNum;
    2857         204 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlTypeMode =
    2858         204 :             state.dataSetPointManager->FollowOATempSetPtMgr(SetPtMgrNum).CtrlTypeMode;
    2859         204 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).NumCtrlNodes =
    2860         204 :             state.dataSetPointManager->FollowOATempSetPtMgr(SetPtMgrNum).NumCtrlNodes;
    2861             :     }
    2862             : 
    2863             :     // Input the Follow System Node Temperature Setpoint Managers
    2864             : 
    2865         775 :     if (state.dataSetPointManager->NumFollowSysNodeTempSetPtMgrs > 0)
    2866           1 :         state.dataSetPointManager->FollowSysNodeTempSetPtMgr.allocate(state.dataSetPointManager->NumFollowSysNodeTempSetPtMgrs);
    2867             : 
    2868             :     // Input the data for each Setpoint Manager
    2869         775 :     cCurrentModuleObject = "SetpointManager:FollowSystemNodeTemperature";
    2870         776 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumFollowSysNodeTempSetPtMgrs; ++SetPtMgrNum) {
    2871           1 :         state.dataInputProcessing->inputProcessor->getObjectItem(state,
    2872             :                                                                  cCurrentModuleObject,
    2873             :                                                                  SetPtMgrNum,
    2874             :                                                                  cAlphaArgs,
    2875             :                                                                  NumAlphas,
    2876             :                                                                  rNumericArgs,
    2877             :                                                                  NumNums,
    2878             :                                                                  IOStat,
    2879             :                                                                  lNumericFieldBlanks,
    2880             :                                                                  lAlphaFieldBlanks,
    2881             :                                                                  cAlphaFieldNames,
    2882             :                                                                  cNumericFieldNames);
    2883           1 :         UtilityRoutines::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound);
    2884             : 
    2885           1 :         state.dataSetPointManager->FollowSysNodeTempSetPtMgr(SetPtMgrNum).Name = cAlphaArgs(1);
    2886           1 :         state.dataSetPointManager->FollowSysNodeTempSetPtMgr(SetPtMgrNum).ctrlVarType = cAlphaArgs(2);
    2887           1 :         if (UtilityRoutines::SameString(state.dataSetPointManager->FollowSysNodeTempSetPtMgr(SetPtMgrNum).ctrlVarType, "Temperature")) {
    2888           1 :             state.dataSetPointManager->FollowSysNodeTempSetPtMgr(SetPtMgrNum).CtrlTypeMode = CtrlVarType::Temp;
    2889           0 :         } else if (UtilityRoutines::SameString(state.dataSetPointManager->FollowSysNodeTempSetPtMgr(SetPtMgrNum).ctrlVarType, "MaximumTemperature")) {
    2890           0 :             state.dataSetPointManager->FollowSysNodeTempSetPtMgr(SetPtMgrNum).CtrlTypeMode = CtrlVarType::MaxTemp;
    2891           0 :         } else if (UtilityRoutines::SameString(state.dataSetPointManager->FollowSysNodeTempSetPtMgr(SetPtMgrNum).ctrlVarType, "MinimumTemperature")) {
    2892           0 :             state.dataSetPointManager->FollowSysNodeTempSetPtMgr(SetPtMgrNum).CtrlTypeMode = CtrlVarType::MinTemp;
    2893             :         } else {
    2894             :             // should not come here if idd type choice and key list is working
    2895           0 :             ShowSevereError(state, format("{}: {}=\"{}\", invalid field.", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
    2896           0 :             ShowContinueError(state, "..invalid " + cAlphaFieldNames(2) + "=\"" + cAlphaArgs(2) + "\".");
    2897           0 :             ShowContinueError(state, R"(..Valid values are "Temperature","MaximumTemperature" or "MinimumTemperature".)");
    2898           0 :             ErrorsFound = true;
    2899             :         }
    2900           1 :         state.dataSetPointManager->FollowSysNodeTempSetPtMgr(SetPtMgrNum).RefNodeNum =
    2901           2 :             GetOnlySingleNode(state,
    2902           1 :                               cAlphaArgs(3),
    2903             :                               ErrorsFound,
    2904             :                               DataLoopNode::ConnectionObjectType::SetpointManagerFollowSystemNodeTemperature,
    2905           1 :                               cAlphaArgs(1),
    2906             :                               DataLoopNode::NodeFluidType::Blank,
    2907             :                               DataLoopNode::ConnectionType::Sensor,
    2908             :                               NodeInputManager::CompFluidStream::Primary,
    2909           1 :                               ObjectIsNotParent);
    2910           1 :         state.dataSetPointManager->FollowSysNodeTempSetPtMgr(SetPtMgrNum).RefTempType = cAlphaArgs(4);
    2911           1 :         if (UtilityRoutines::SameString(state.dataSetPointManager->FollowSysNodeTempSetPtMgr(SetPtMgrNum).RefTempType, "NodeWetBulb")) {
    2912           1 :             state.dataSetPointManager->FollowSysNodeTempSetPtMgr(SetPtMgrNum).RefTypeMode = ReferenceTempType::WetBulb;
    2913           0 :         } else if (UtilityRoutines::SameString(state.dataSetPointManager->FollowSysNodeTempSetPtMgr(SetPtMgrNum).RefTempType, "NodeDryBulb")) {
    2914           0 :             state.dataSetPointManager->FollowSysNodeTempSetPtMgr(SetPtMgrNum).RefTypeMode = ReferenceTempType::DryBulb;
    2915             :         } else {
    2916             :             // should not come here if idd type choice and key list is working
    2917           0 :             ShowSevereError(state, format("{}: {}=\"{}\", invalid field.", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
    2918           0 :             ShowContinueError(state, "..invalid " + cAlphaFieldNames(3) + "=\"" + cAlphaArgs(3) + "\".");
    2919           0 :             ShowContinueError(state, R"(..Valid values are "NodeWetBulb" or "NodeDryBulb".)");
    2920           0 :             ErrorsFound = true;
    2921             :         }
    2922           1 :         state.dataSetPointManager->FollowSysNodeTempSetPtMgr(SetPtMgrNum).Offset = rNumericArgs(1);
    2923           1 :         state.dataSetPointManager->FollowSysNodeTempSetPtMgr(SetPtMgrNum).MaxSetTemp = rNumericArgs(2);
    2924           1 :         state.dataSetPointManager->FollowSysNodeTempSetPtMgr(SetPtMgrNum).MinSetTemp = rNumericArgs(3);
    2925           2 :         if (state.dataSetPointManager->FollowSysNodeTempSetPtMgr(SetPtMgrNum).MaxSetTemp <
    2926           1 :             state.dataSetPointManager->FollowSysNodeTempSetPtMgr(SetPtMgrNum).MinSetTemp) {
    2927           0 :             ShowWarningError(state, format("{}: {}=\"{}\",", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
    2928           0 :             ShowContinueError(state,
    2929           0 :                               format("...{}=[{:.1R}] is less than {}=[{:.1R}].",
    2930             :                                      cNumericFieldNames(2),
    2931           0 :                                      state.dataSetPointManager->FollowSysNodeTempSetPtMgr(SetPtMgrNum).MaxSetTemp,
    2932             :                                      cNumericFieldNames(3),
    2933           0 :                                      state.dataSetPointManager->FollowSysNodeTempSetPtMgr(SetPtMgrNum).MinSetTemp));
    2934             :         }
    2935             : 
    2936           1 :         NodeListError = false;
    2937           2 :         GetNodeNums(state,
    2938           1 :                     cAlphaArgs(5),
    2939             :                     NumNodes,
    2940             :                     NodeNums,
    2941             :                     NodeListError,
    2942             :                     DataLoopNode::NodeFluidType::Blank,
    2943             :                     DataLoopNode::ConnectionObjectType::SetpointManagerFollowSystemNodeTemperature,
    2944           1 :                     cAlphaArgs(1),
    2945             :                     DataLoopNode::ConnectionType::SetPoint,
    2946             :                     NodeInputManager::CompFluidStream::Primary,
    2947             :                     ObjectIsNotParent,
    2948             :                     false,
    2949           1 :                     cAlphaFieldNames(5)); // setpoint nodes
    2950           1 :         if (!NodeListError) {
    2951           1 :             NumNodesCtrld = NumNodes;
    2952           1 :             state.dataSetPointManager->FollowSysNodeTempSetPtMgr(SetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld);
    2953           1 :             state.dataSetPointManager->FollowSysNodeTempSetPtMgr(SetPtMgrNum).NumCtrlNodes = NumNodesCtrld;
    2954           1 :             state.dataSetPointManager->FollowSysNodeTempSetPtMgr(SetPtMgrNum).SetPt = 0.0;
    2955             : 
    2956           2 :             for (CtrldNodeNum = 1; CtrldNodeNum <= NumNodesCtrld; ++CtrldNodeNum) {
    2957           1 :                 state.dataSetPointManager->FollowSysNodeTempSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum) = NodeNums(CtrldNodeNum);
    2958             :             }
    2959             :         } else {
    2960           0 :             ErrorsFound = true;
    2961             :         }
    2962             : 
    2963           3 :         AllSetPtMgrNum = SetPtMgrNum + state.dataSetPointManager->NumSchSetPtMgrs + state.dataSetPointManager->NumDualSchSetPtMgrs +
    2964           3 :                          state.dataSetPointManager->NumOutAirSetPtMgrs + state.dataSetPointManager->NumSZRhSetPtMgrs +
    2965           3 :                          state.dataSetPointManager->NumSZHtSetPtMgrs + state.dataSetPointManager->NumSZClSetPtMgrs +
    2966           3 :                          state.dataSetPointManager->NumSZMinHumSetPtMgrs + state.dataSetPointManager->NumSZMaxHumSetPtMgrs +
    2967           3 :                          state.dataSetPointManager->NumMixedAirSetPtMgrs + state.dataSetPointManager->NumOAPretreatSetPtMgrs +
    2968           3 :                          state.dataSetPointManager->NumWarmestSetPtMgrs + state.dataSetPointManager->NumColdestSetPtMgrs +
    2969           3 :                          state.dataSetPointManager->NumWarmestSetPtMgrsTempFlow + state.dataSetPointManager->NumRABFlowSetPtMgrs +
    2970           3 :                          state.dataSetPointManager->NumMZClgAverageSetPtMgrs + state.dataSetPointManager->NumMZHtgAverageSetPtMgrs +
    2971           3 :                          state.dataSetPointManager->NumMZAverageMinHumSetPtMgrs + state.dataSetPointManager->NumMZAverageMaxHumSetPtMgrs +
    2972           2 :                          state.dataSetPointManager->NumMZMinHumSetPtMgrs + state.dataSetPointManager->NumMZMaxHumSetPtMgrs +
    2973           1 :                          state.dataSetPointManager->NumFollowOATempSetPtMgrs;
    2974             : 
    2975           1 :         if (!NodeListError) {
    2976           1 :             state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld);
    2977           2 :             state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlNodes =
    2978           2 :                 state.dataSetPointManager->FollowSysNodeTempSetPtMgr(SetPtMgrNum).CtrlNodes;
    2979             :         }
    2980           1 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).Name = state.dataSetPointManager->FollowSysNodeTempSetPtMgr(SetPtMgrNum).Name;
    2981           1 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).SPMType = SetPointManagerType::FollowSysNodeTemp;
    2982           1 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).SPMIndex = SetPtMgrNum;
    2983           1 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlTypeMode =
    2984           1 :             state.dataSetPointManager->FollowSysNodeTempSetPtMgr(SetPtMgrNum).CtrlTypeMode;
    2985           1 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).NumCtrlNodes =
    2986           1 :             state.dataSetPointManager->FollowSysNodeTempSetPtMgr(SetPtMgrNum).NumCtrlNodes;
    2987             :     }
    2988             : 
    2989             :     // Input the Ground Temperature Setpoint Managers
    2990             : 
    2991         775 :     if (state.dataSetPointManager->NumGroundTempSetPtMgrs > 0)
    2992          19 :         state.dataSetPointManager->GroundTempSetPtMgr.allocate(state.dataSetPointManager->NumGroundTempSetPtMgrs);
    2993             : 
    2994             :     // Input the data for each Setpoint Manager
    2995         775 :     cCurrentModuleObject = "SetpointManager:FollowGroundTemperature";
    2996         794 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumGroundTempSetPtMgrs; ++SetPtMgrNum) {
    2997          19 :         state.dataInputProcessing->inputProcessor->getObjectItem(state,
    2998             :                                                                  cCurrentModuleObject,
    2999             :                                                                  SetPtMgrNum,
    3000             :                                                                  cAlphaArgs,
    3001             :                                                                  NumAlphas,
    3002             :                                                                  rNumericArgs,
    3003             :                                                                  NumNums,
    3004             :                                                                  IOStat,
    3005             :                                                                  lNumericFieldBlanks,
    3006             :                                                                  lAlphaFieldBlanks,
    3007             :                                                                  cAlphaFieldNames,
    3008             :                                                                  cNumericFieldNames);
    3009          19 :         UtilityRoutines::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound);
    3010             : 
    3011          19 :         state.dataSetPointManager->GroundTempSetPtMgr(SetPtMgrNum).Name = cAlphaArgs(1);
    3012          19 :         state.dataSetPointManager->GroundTempSetPtMgr(SetPtMgrNum).ctrlVarType = cAlphaArgs(2);
    3013          19 :         if (UtilityRoutines::SameString(state.dataSetPointManager->GroundTempSetPtMgr(SetPtMgrNum).ctrlVarType, "Temperature")) {
    3014          19 :             state.dataSetPointManager->GroundTempSetPtMgr(SetPtMgrNum).CtrlTypeMode = CtrlVarType::Temp;
    3015           0 :         } else if (UtilityRoutines::SameString(state.dataSetPointManager->GroundTempSetPtMgr(SetPtMgrNum).ctrlVarType, "MaximumTemperature")) {
    3016           0 :             state.dataSetPointManager->GroundTempSetPtMgr(SetPtMgrNum).CtrlTypeMode = CtrlVarType::MaxTemp;
    3017           0 :         } else if (UtilityRoutines::SameString(state.dataSetPointManager->GroundTempSetPtMgr(SetPtMgrNum).ctrlVarType, "MinimumTemperature")) {
    3018           0 :             state.dataSetPointManager->GroundTempSetPtMgr(SetPtMgrNum).CtrlTypeMode = CtrlVarType::MinTemp;
    3019             :         } else {
    3020             :             // should not come here if idd type choice and key list is working
    3021           0 :             ShowSevereError(state, format("{}: {}=\"{}\", invalid field.", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
    3022           0 :             ShowContinueError(state, "..invalid " + cAlphaFieldNames(2) + "=\"" + cAlphaArgs(2) + "\".");
    3023           0 :             ShowContinueError(state, R"(..Valid values are "Temperature","MaximumTemperature" or "MinimumTemperature".)");
    3024           0 :             ErrorsFound = true;
    3025             :         }
    3026          19 :         state.dataSetPointManager->GroundTempSetPtMgr(SetPtMgrNum).RefGroundTempObjType = cAlphaArgs(3);
    3027          19 :         if (UtilityRoutines::SameString(state.dataSetPointManager->GroundTempSetPtMgr(SetPtMgrNum).RefGroundTempObjType,
    3028          19 :                                         "Site:GroundTemperature:BuildingSurface")) {
    3029           0 :             state.dataSetPointManager->GroundTempSetPtMgr(SetPtMgrNum).RefTypeMode = ReferenceGroundTempObjectType::BuildingSurface;
    3030           0 :             if (state.dataSetPointManager->NoSurfaceGroundTempObjWarning) {
    3031           0 :                 if (!state.dataEnvrn->GroundTempObjInput) {
    3032           0 :                     ShowWarningError(state,
    3033           0 :                                      format("{}: {}=\"{}\" requires \"Site:GroundTemperature:BuildingSurface\" in the input..",
    3034             :                                             RoutineName,
    3035             :                                             cCurrentModuleObject,
    3036           0 :                                             cAlphaArgs(1)));
    3037           0 :                     ShowContinueError(state, format("Defaults, constant throughout the year of ({:.1R}) will be used.", state.dataEnvrn->GroundTemp));
    3038             :                 }
    3039           0 :                 state.dataSetPointManager->NoSurfaceGroundTempObjWarning = false;
    3040             :             }
    3041          19 :         } else if (UtilityRoutines::SameString(state.dataSetPointManager->GroundTempSetPtMgr(SetPtMgrNum).RefGroundTempObjType,
    3042          19 :                                                "Site:GroundTemperature:Shallow")) {
    3043           0 :             state.dataSetPointManager->GroundTempSetPtMgr(SetPtMgrNum).RefTypeMode = ReferenceGroundTempObjectType::Shallow;
    3044           0 :             if (state.dataSetPointManager->NoShallowGroundTempObjWarning) {
    3045           0 :                 if (!state.dataEnvrn->GroundTemp_SurfaceObjInput) {
    3046           0 :                     ShowWarningError(state,
    3047           0 :                                      format("{}: {}=\"{}\" requires \"Site:GroundTemperature:Shallow\" in the input.",
    3048             :                                             RoutineName,
    3049             :                                             cCurrentModuleObject,
    3050           0 :                                             cAlphaArgs(1)));
    3051           0 :                     ShowContinueError(
    3052           0 :                         state, format("Defaults, constant throughout the year of ({:.1R}) will be used.", state.dataEnvrn->GroundTemp_Surface));
    3053             :                 }
    3054           0 :                 state.dataSetPointManager->NoShallowGroundTempObjWarning = false;
    3055             :             }
    3056          19 :         } else if (UtilityRoutines::SameString(state.dataSetPointManager->GroundTempSetPtMgr(SetPtMgrNum).RefGroundTempObjType,
    3057          19 :                                                "Site:GroundTemperature:Deep")) {
    3058          19 :             state.dataSetPointManager->GroundTempSetPtMgr(SetPtMgrNum).RefTypeMode = ReferenceGroundTempObjectType::Deep;
    3059          19 :             if (state.dataSetPointManager->NoDeepGroundTempObjWarning) {
    3060          19 :                 if (!state.dataEnvrn->GroundTemp_DeepObjInput) {
    3061           0 :                     ShowWarningError(state,
    3062           0 :                                      format("{}: {}=\"{}\" requires \"Site:GroundTemperature:Deep\" in the input.",
    3063             :                                             RoutineName,
    3064             :                                             cCurrentModuleObject,
    3065           0 :                                             cAlphaArgs(1)));
    3066           0 :                     ShowContinueError(state,
    3067           0 :                                       format("Defaults, constant throughout the year of ({:.1R}) will be used.", state.dataEnvrn->GroundTemp_Deep));
    3068             :                 }
    3069          19 :                 state.dataSetPointManager->NoDeepGroundTempObjWarning = false;
    3070             :             }
    3071           0 :         } else if (UtilityRoutines::SameString(state.dataSetPointManager->GroundTempSetPtMgr(SetPtMgrNum).RefGroundTempObjType,
    3072           0 :                                                "Site:GroundTemperature:FCfactorMethod")) {
    3073           0 :             state.dataSetPointManager->GroundTempSetPtMgr(SetPtMgrNum).RefTypeMode = ReferenceGroundTempObjectType::FCFactorMethod;
    3074           0 :             if (state.dataSetPointManager->NoFCGroundTempObjWarning) {
    3075           0 :                 if (!state.dataEnvrn->FCGroundTemps) {
    3076           0 :                     ShowWarningError(state,
    3077           0 :                                      format("{}: {}=\"{}\" requires \"Site:GroundTemperature:FCfactorMethod\" in the input.",
    3078             :                                             RoutineName,
    3079             :                                             cCurrentModuleObject,
    3080           0 :                                             cAlphaArgs(1)));
    3081           0 :                     ShowContinueError(state,
    3082           0 :                                       format("Defaults, constant throughout the year of ({:.1R}) will be used.", state.dataEnvrn->GroundTempFC));
    3083             :                 }
    3084           0 :                 state.dataSetPointManager->NoFCGroundTempObjWarning = false;
    3085             :             }
    3086             :         } else {
    3087             :             // should not come here if idd type choice and key list is working
    3088           0 :             ShowSevereError(state, format("{}: {}=\"{}\", invalid field.", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
    3089           0 :             ShowContinueError(state, "..invalid " + cAlphaFieldNames(3) + "=\"" + cAlphaArgs(3) + "\".");
    3090           0 :             ShowContinueError(state, R"(..Valid values are "Site:GroundTemperature:BuildingSurface", "Site:GroundTemperature:Shallow",)");
    3091           0 :             ShowContinueError(state, R"(     "Site:GroundTemperature:Deep" or "Site:GroundTemperature:FCfactorMethod".)");
    3092           0 :             ErrorsFound = true;
    3093             :         }
    3094          19 :         state.dataSetPointManager->GroundTempSetPtMgr(SetPtMgrNum).Offset = rNumericArgs(1);
    3095          19 :         state.dataSetPointManager->GroundTempSetPtMgr(SetPtMgrNum).MaxSetTemp = rNumericArgs(2);
    3096          19 :         state.dataSetPointManager->GroundTempSetPtMgr(SetPtMgrNum).MinSetTemp = rNumericArgs(3);
    3097          38 :         if (state.dataSetPointManager->GroundTempSetPtMgr(SetPtMgrNum).MaxSetTemp <
    3098          19 :             state.dataSetPointManager->GroundTempSetPtMgr(SetPtMgrNum).MinSetTemp) {
    3099           0 :             ShowWarningError(state, format("{}: {}=\"{}\",", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
    3100           0 :             ShowContinueError(state,
    3101           0 :                               format("...{}=[{:.1R}] is less than {}=[{:.1R}].",
    3102             :                                      cNumericFieldNames(2),
    3103           0 :                                      state.dataSetPointManager->GroundTempSetPtMgr(SetPtMgrNum).MaxSetTemp,
    3104             :                                      cNumericFieldNames(3),
    3105           0 :                                      state.dataSetPointManager->GroundTempSetPtMgr(SetPtMgrNum).MinSetTemp));
    3106             :         }
    3107             : 
    3108          19 :         NodeListError = false;
    3109          38 :         GetNodeNums(state,
    3110          19 :                     cAlphaArgs(4),
    3111             :                     NumNodes,
    3112             :                     NodeNums,
    3113             :                     NodeListError,
    3114             :                     DataLoopNode::NodeFluidType::Blank,
    3115             :                     DataLoopNode::ConnectionObjectType::SetpointManagerFollowGroundTemperature,
    3116          19 :                     cAlphaArgs(1),
    3117             :                     DataLoopNode::ConnectionType::SetPoint,
    3118             :                     NodeInputManager::CompFluidStream::Primary,
    3119             :                     ObjectIsNotParent,
    3120             :                     false,
    3121          19 :                     cAlphaFieldNames(4)); // setpoint nodes
    3122          19 :         if (!NodeListError) {
    3123          19 :             NumNodesCtrld = NumNodes;
    3124          19 :             state.dataSetPointManager->GroundTempSetPtMgr(SetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld);
    3125          19 :             state.dataSetPointManager->GroundTempSetPtMgr(SetPtMgrNum).NumCtrlNodes = NumNodesCtrld;
    3126          19 :             state.dataSetPointManager->GroundTempSetPtMgr(SetPtMgrNum).SetPt = 0.0;
    3127             : 
    3128          38 :             for (CtrldNodeNum = 1; CtrldNodeNum <= NumNodesCtrld; ++CtrldNodeNum) {
    3129          19 :                 state.dataSetPointManager->GroundTempSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum) = NodeNums(CtrldNodeNum);
    3130             :             }
    3131             :         } else {
    3132           0 :             ErrorsFound = true;
    3133             :         }
    3134             : 
    3135          57 :         AllSetPtMgrNum = SetPtMgrNum + state.dataSetPointManager->NumSchSetPtMgrs + state.dataSetPointManager->NumDualSchSetPtMgrs +
    3136          57 :                          state.dataSetPointManager->NumOutAirSetPtMgrs + state.dataSetPointManager->NumSZRhSetPtMgrs +
    3137          57 :                          state.dataSetPointManager->NumSZHtSetPtMgrs + state.dataSetPointManager->NumSZClSetPtMgrs +
    3138          57 :                          state.dataSetPointManager->NumSZMinHumSetPtMgrs + state.dataSetPointManager->NumSZMaxHumSetPtMgrs +
    3139          57 :                          state.dataSetPointManager->NumMixedAirSetPtMgrs + state.dataSetPointManager->NumOAPretreatSetPtMgrs +
    3140          57 :                          state.dataSetPointManager->NumWarmestSetPtMgrs + state.dataSetPointManager->NumColdestSetPtMgrs +
    3141          57 :                          state.dataSetPointManager->NumWarmestSetPtMgrsTempFlow + state.dataSetPointManager->NumRABFlowSetPtMgrs +
    3142          57 :                          state.dataSetPointManager->NumMZClgAverageSetPtMgrs + state.dataSetPointManager->NumMZHtgAverageSetPtMgrs +
    3143          57 :                          state.dataSetPointManager->NumMZAverageMinHumSetPtMgrs + state.dataSetPointManager->NumMZAverageMaxHumSetPtMgrs +
    3144          57 :                          state.dataSetPointManager->NumMZMinHumSetPtMgrs + state.dataSetPointManager->NumMZMaxHumSetPtMgrs +
    3145          38 :                          state.dataSetPointManager->NumFollowOATempSetPtMgrs + state.dataSetPointManager->NumFollowSysNodeTempSetPtMgrs;
    3146             : 
    3147          19 :         if (!NodeListError) {
    3148          19 :             state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld);
    3149          19 :             state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlNodes = state.dataSetPointManager->GroundTempSetPtMgr(SetPtMgrNum).CtrlNodes;
    3150             :         }
    3151          19 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).Name = state.dataSetPointManager->GroundTempSetPtMgr(SetPtMgrNum).Name;
    3152          19 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).SPMType = SetPointManagerType::GroundTemp;
    3153          19 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).SPMIndex = SetPtMgrNum;
    3154          19 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlTypeMode = state.dataSetPointManager->GroundTempSetPtMgr(SetPtMgrNum).CtrlTypeMode;
    3155          19 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).NumCtrlNodes = state.dataSetPointManager->GroundTempSetPtMgr(SetPtMgrNum).NumCtrlNodes;
    3156             :     }
    3157             : 
    3158         779 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumWarmestSetPtMgrsTempFlow; ++SetPtMgrNum) {
    3159          16 :         SetupOutputVariable(state,
    3160             :                             "Setpoint Manager Warmest Temperature Critical Zone Number",
    3161             :                             OutputProcessor::Unit::None,
    3162           4 :                             state.dataSetPointManager->WarmestSetPtMgrTempFlow(SetPtMgrNum).CritZoneNum,
    3163             :                             OutputProcessor::SOVTimeStepType::System,
    3164             :                             OutputProcessor::SOVStoreType::Average,
    3165           8 :                             state.dataSetPointManager->WarmestSetPtMgrTempFlow(SetPtMgrNum).Name);
    3166          16 :         SetupOutputVariable(state,
    3167             :                             "Setpoint Manager Warmest Temperature Turndown Flow Fraction",
    3168             :                             OutputProcessor::Unit::None,
    3169           4 :                             state.dataSetPointManager->WarmestSetPtMgrTempFlow(SetPtMgrNum).Turndown,
    3170             :                             OutputProcessor::SOVTimeStepType::System,
    3171             :                             OutputProcessor::SOVStoreType::Average,
    3172           8 :                             state.dataSetPointManager->WarmestSetPtMgrTempFlow(SetPtMgrNum).Name);
    3173             :     }
    3174             : 
    3175             :     // Input the Condenser Entering Set Point Managers
    3176             : 
    3177         775 :     if (state.dataSetPointManager->NumCondEntSetPtMgrs > 0)
    3178           6 :         state.dataSetPointManager->CondEntSetPtMgr.allocate(
    3179           6 :             state.dataSetPointManager->NumCondEntSetPtMgrs); // Allocate the Set Point Manager input data array
    3180             : 
    3181             :     // Input the data for each Set Point Manager
    3182         775 :     cCurrentModuleObject = "SetpointManager:CondenserEnteringReset";
    3183             : 
    3184         778 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumCondEntSetPtMgrs; ++SetPtMgrNum) {
    3185           3 :         state.dataInputProcessing->inputProcessor->getObjectItem(state,
    3186             :                                                                  cCurrentModuleObject,
    3187             :                                                                  SetPtMgrNum,
    3188             :                                                                  cAlphaArgs,
    3189             :                                                                  NumAlphas,
    3190             :                                                                  rNumericArgs,
    3191             :                                                                  NumNums,
    3192             :                                                                  IOStat,
    3193             :                                                                  lNumericFieldBlanks,
    3194             :                                                                  lAlphaFieldBlanks,
    3195             :                                                                  cAlphaFieldNames,
    3196             :                                                                  cNumericFieldNames);
    3197           3 :         UtilityRoutines::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound);
    3198             : 
    3199           3 :         state.dataSetPointManager->CondEntSetPtMgr(SetPtMgrNum).Name = cAlphaArgs(1);
    3200           3 :         state.dataSetPointManager->CondEntSetPtMgr(SetPtMgrNum).ctrlVarType = cAlphaArgs(2);
    3201           3 :         if (UtilityRoutines::SameString(state.dataSetPointManager->CondEntSetPtMgr(SetPtMgrNum).ctrlVarType, "Temperature")) {
    3202           3 :             state.dataSetPointManager->CondEntSetPtMgr(SetPtMgrNum).CtrlTypeMode = CtrlVarType::Temp;
    3203             :         } else {
    3204             :             // should not come here if idd type choice and key list is working
    3205           0 :             ShowSevereError(state, " found invalid control type of " + cAlphaArgs(2) + " in " + cCurrentModuleObject + " = " + cAlphaArgs(1));
    3206           0 :             ErrorsFound = true;
    3207             :         }
    3208           3 :         state.dataSetPointManager->CondEntSetPtMgr(SetPtMgrNum).CondEntTempSched = cAlphaArgs(3);
    3209           3 :         state.dataSetPointManager->CondEntSetPtMgr(SetPtMgrNum).CondEntTempSchedPtr = GetScheduleIndex(state, cAlphaArgs(3));
    3210           3 :         state.dataSetPointManager->CondEntSetPtMgr(SetPtMgrNum).MinTwrWbCurve = GetCurveIndex(state, cAlphaArgs(4));
    3211           3 :         state.dataSetPointManager->CondEntSetPtMgr(SetPtMgrNum).MinOaWbCurve = GetCurveIndex(state, cAlphaArgs(5));
    3212           3 :         state.dataSetPointManager->CondEntSetPtMgr(SetPtMgrNum).OptCondEntCurve = GetCurveIndex(state, cAlphaArgs(6));
    3213           3 :         state.dataSetPointManager->CondEntSetPtMgr(SetPtMgrNum).MinimumLiftTD = rNumericArgs(1);
    3214           3 :         state.dataSetPointManager->CondEntSetPtMgr(SetPtMgrNum).MaxCondEntTemp = rNumericArgs(2);
    3215           3 :         state.dataSetPointManager->CondEntSetPtMgr(SetPtMgrNum).TowerDsnInletAirWetBulb = rNumericArgs(3);
    3216           3 :         state.dataSetPointManager->CondEntSetPtMgr(SetPtMgrNum).CtrlNodeListName = cAlphaArgs(7);
    3217           6 :         if (state.dataSetPointManager->CondEntSetPtMgr(SetPtMgrNum).MaxCondEntTemp <
    3218           3 :             state.dataSetPointManager->CondEntSetPtMgr(SetPtMgrNum).TowerDsnInletAirWetBulb) {
    3219           0 :             ShowWarningError(state, format("{}: {}=\"{}\",", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
    3220           0 :             ShowContinueError(state,
    3221           0 :                               format("...{}=[{:.1R}] is less than {}=[{:.1R}].",
    3222             :                                      cNumericFieldNames(2),
    3223           0 :                                      state.dataSetPointManager->CondEntSetPtMgr(SetPtMgrNum).MaxCondEntTemp,
    3224             :                                      cNumericFieldNames(1),
    3225           0 :                                      state.dataSetPointManager->CondEntSetPtMgr(SetPtMgrNum).TowerDsnInletAirWetBulb));
    3226             :         }
    3227             : 
    3228           3 :         NodeListError = false;
    3229           6 :         GetNodeNums(state,
    3230           3 :                     state.dataSetPointManager->CondEntSetPtMgr(SetPtMgrNum).CtrlNodeListName,
    3231             :                     NumNodes,
    3232             :                     NodeNums,
    3233             :                     NodeListError,
    3234             :                     DataLoopNode::NodeFluidType::Blank,
    3235             :                     DataLoopNode::ConnectionObjectType::SetpointManagerCondenserEnteringReset,
    3236           3 :                     cAlphaArgs(1),
    3237             :                     DataLoopNode::ConnectionType::SetPoint,
    3238             :                     NodeInputManager::CompFluidStream::Primary,
    3239             :                     ObjectIsNotParent,
    3240             :                     false,
    3241           3 :                     cAlphaFieldNames(7));
    3242           3 :         if (!NodeListError) {
    3243           3 :             NumNodesCtrld = NumNodes;
    3244           3 :             state.dataSetPointManager->CondEntSetPtMgr(SetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld);
    3245           3 :             state.dataSetPointManager->CondEntSetPtMgr(SetPtMgrNum).NumCtrlNodes = NumNodesCtrld;
    3246           3 :             state.dataSetPointManager->CondEntSetPtMgr(SetPtMgrNum).SetPt = 0.0;
    3247             : 
    3248           6 :             for (CtrldNodeNum = 1; CtrldNodeNum <= NumNodesCtrld; ++CtrldNodeNum) {
    3249           3 :                 state.dataSetPointManager->CondEntSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum) = NodeNums(CtrldNodeNum);
    3250             :             }
    3251             :         } else {
    3252           0 :             ErrorsFound = true;
    3253             :         }
    3254             : 
    3255           9 :         AllSetPtMgrNum = SetPtMgrNum + state.dataSetPointManager->NumSchSetPtMgrs + state.dataSetPointManager->NumDualSchSetPtMgrs +
    3256           9 :                          state.dataSetPointManager->NumOutAirSetPtMgrs + state.dataSetPointManager->NumSZRhSetPtMgrs +
    3257           9 :                          state.dataSetPointManager->NumSZHtSetPtMgrs + state.dataSetPointManager->NumSZClSetPtMgrs +
    3258           9 :                          state.dataSetPointManager->NumSZMinHumSetPtMgrs + state.dataSetPointManager->NumSZMaxHumSetPtMgrs +
    3259           9 :                          state.dataSetPointManager->NumMixedAirSetPtMgrs + state.dataSetPointManager->NumOAPretreatSetPtMgrs +
    3260           9 :                          state.dataSetPointManager->NumWarmestSetPtMgrs + state.dataSetPointManager->NumColdestSetPtMgrs +
    3261           9 :                          state.dataSetPointManager->NumWarmestSetPtMgrsTempFlow + state.dataSetPointManager->NumRABFlowSetPtMgrs +
    3262           9 :                          state.dataSetPointManager->NumMZClgAverageSetPtMgrs + state.dataSetPointManager->NumMZHtgAverageSetPtMgrs +
    3263           9 :                          state.dataSetPointManager->NumMZAverageMinHumSetPtMgrs + state.dataSetPointManager->NumMZAverageMaxHumSetPtMgrs +
    3264           9 :                          state.dataSetPointManager->NumMZMinHumSetPtMgrs + state.dataSetPointManager->NumMZMaxHumSetPtMgrs +
    3265           6 :                          state.dataSetPointManager->NumFollowOATempSetPtMgrs + state.dataSetPointManager->NumFollowSysNodeTempSetPtMgrs +
    3266           3 :                          state.dataSetPointManager->NumGroundTempSetPtMgrs;
    3267             : 
    3268           3 :         if (!NodeListError) {
    3269           3 :             state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld);
    3270           3 :             state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlNodes = state.dataSetPointManager->CondEntSetPtMgr(SetPtMgrNum).CtrlNodes;
    3271             :         }
    3272           3 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).Name = state.dataSetPointManager->CondEntSetPtMgr(SetPtMgrNum).Name;
    3273           3 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).SPMType = SetPointManagerType::CondEntReset;
    3274           3 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).SPMIndex = SetPtMgrNum;
    3275           3 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlTypeMode = state.dataSetPointManager->CondEntSetPtMgr(SetPtMgrNum).CtrlTypeMode;
    3276           3 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).NumCtrlNodes = state.dataSetPointManager->CondEntSetPtMgr(SetPtMgrNum).NumCtrlNodes;
    3277             :     }
    3278             : 
    3279             :     // Input the Ideal Condenser Entering Set Point Managers
    3280             : 
    3281             :     // Allocate the Set Point Manager input data array
    3282         775 :     if (state.dataSetPointManager->NumIdealCondEntSetPtMgrs > 0)
    3283           2 :         state.dataSetPointManager->IdealCondEntSetPtMgr.allocate(state.dataSetPointManager->NumIdealCondEntSetPtMgrs);
    3284             : 
    3285             :     // Input the data for each Set Point Manager
    3286         775 :     cCurrentModuleObject = "SetpointManager:CondenserEnteringReset:Ideal";
    3287             : 
    3288         777 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumIdealCondEntSetPtMgrs; ++SetPtMgrNum) {
    3289           2 :         state.dataInputProcessing->inputProcessor->getObjectItem(state,
    3290             :                                                                  cCurrentModuleObject,
    3291             :                                                                  SetPtMgrNum,
    3292             :                                                                  cAlphaArgs,
    3293             :                                                                  NumAlphas,
    3294             :                                                                  rNumericArgs,
    3295             :                                                                  NumNums,
    3296             :                                                                  IOStat,
    3297             :                                                                  lNumericFieldBlanks,
    3298             :                                                                  lAlphaFieldBlanks,
    3299             :                                                                  cAlphaFieldNames,
    3300             :                                                                  cNumericFieldNames);
    3301           2 :         UtilityRoutines::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound);
    3302             : 
    3303           2 :         state.dataSetPointManager->IdealCondEntSetPtMgr(SetPtMgrNum).Name = cAlphaArgs(1);
    3304           2 :         state.dataSetPointManager->IdealCondEntSetPtMgr(SetPtMgrNum).ctrlVarType = cAlphaArgs(2);
    3305           2 :         if (UtilityRoutines::SameString(state.dataSetPointManager->IdealCondEntSetPtMgr(SetPtMgrNum).ctrlVarType, "Temperature")) {
    3306           2 :             state.dataSetPointManager->IdealCondEntSetPtMgr(SetPtMgrNum).CtrlTypeMode = CtrlVarType::Temp;
    3307             :         } else {
    3308           0 :             ShowSevereError(state, " found invalid control type of " + cAlphaArgs(2) + " in " + cCurrentModuleObject + " = " + cAlphaArgs(1));
    3309           0 :             ErrorsFound = true;
    3310             :         }
    3311           2 :         state.dataSetPointManager->IdealCondEntSetPtMgr(SetPtMgrNum).MinimumLiftTD = rNumericArgs(1);
    3312           2 :         state.dataSetPointManager->IdealCondEntSetPtMgr(SetPtMgrNum).MaxCondEntTemp = rNumericArgs(2);
    3313           2 :         state.dataSetPointManager->IdealCondEntSetPtMgr(SetPtMgrNum).CtrlNodeListName = cAlphaArgs(3);
    3314             : 
    3315           2 :         NodeListError = false;
    3316           4 :         GetNodeNums(state,
    3317           2 :                     state.dataSetPointManager->IdealCondEntSetPtMgr(SetPtMgrNum).CtrlNodeListName,
    3318             :                     NumNodes,
    3319             :                     NodeNums,
    3320             :                     NodeListError,
    3321             :                     DataLoopNode::NodeFluidType::Blank,
    3322             :                     DataLoopNode::ConnectionObjectType::SetpointManagerCondenserEnteringResetIdeal,
    3323           2 :                     cAlphaArgs(1),
    3324             :                     DataLoopNode::ConnectionType::SetPoint,
    3325             :                     NodeInputManager::CompFluidStream::Primary,
    3326             :                     ObjectIsNotParent,
    3327             :                     false,
    3328           2 :                     cAlphaFieldNames(3));
    3329           2 :         if (!NodeListError) {
    3330           2 :             NumNodesCtrld = NumNodes;
    3331           2 :             state.dataSetPointManager->IdealCondEntSetPtMgr(SetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld);
    3332           2 :             state.dataSetPointManager->IdealCondEntSetPtMgr(SetPtMgrNum).NumCtrlNodes = NumNodesCtrld;
    3333           2 :             state.dataSetPointManager->IdealCondEntSetPtMgr(SetPtMgrNum).SetPt = 0.0;
    3334             : 
    3335           5 :             for (CtrldNodeNum = 1; CtrldNodeNum <= NumNodesCtrld; ++CtrldNodeNum) {
    3336           3 :                 state.dataSetPointManager->IdealCondEntSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum) = NodeNums(CtrldNodeNum);
    3337             :             }
    3338             :         } else {
    3339           0 :             ErrorsFound = true;
    3340             :         }
    3341             : 
    3342           6 :         AllSetPtMgrNum = SetPtMgrNum + state.dataSetPointManager->NumSchSetPtMgrs + state.dataSetPointManager->NumDualSchSetPtMgrs +
    3343           6 :                          state.dataSetPointManager->NumOutAirSetPtMgrs + state.dataSetPointManager->NumSZRhSetPtMgrs +
    3344           6 :                          state.dataSetPointManager->NumSZHtSetPtMgrs + state.dataSetPointManager->NumSZClSetPtMgrs +
    3345           6 :                          state.dataSetPointManager->NumSZMinHumSetPtMgrs + state.dataSetPointManager->NumSZMaxHumSetPtMgrs +
    3346           6 :                          state.dataSetPointManager->NumMixedAirSetPtMgrs + state.dataSetPointManager->NumOAPretreatSetPtMgrs +
    3347           6 :                          state.dataSetPointManager->NumWarmestSetPtMgrs + state.dataSetPointManager->NumColdestSetPtMgrs +
    3348           6 :                          state.dataSetPointManager->NumWarmestSetPtMgrsTempFlow + state.dataSetPointManager->NumRABFlowSetPtMgrs +
    3349           6 :                          state.dataSetPointManager->NumMZClgAverageSetPtMgrs + state.dataSetPointManager->NumMZHtgAverageSetPtMgrs +
    3350           6 :                          state.dataSetPointManager->NumMZAverageMinHumSetPtMgrs + state.dataSetPointManager->NumMZAverageMaxHumSetPtMgrs +
    3351           6 :                          state.dataSetPointManager->NumMZMinHumSetPtMgrs + state.dataSetPointManager->NumMZMaxHumSetPtMgrs +
    3352           6 :                          state.dataSetPointManager->NumFollowOATempSetPtMgrs + state.dataSetPointManager->NumFollowSysNodeTempSetPtMgrs +
    3353           4 :                          state.dataSetPointManager->NumGroundTempSetPtMgrs + state.dataSetPointManager->NumCondEntSetPtMgrs;
    3354             : 
    3355           2 :         if (!NodeListError) {
    3356           2 :             state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld);
    3357           2 :             state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlNodes = state.dataSetPointManager->IdealCondEntSetPtMgr(SetPtMgrNum).CtrlNodes;
    3358             :         }
    3359           2 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).Name = state.dataSetPointManager->IdealCondEntSetPtMgr(SetPtMgrNum).Name;
    3360           2 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).SPMType = SetPointManagerType::IdealCondEntReset;
    3361           2 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).SPMIndex = SetPtMgrNum;
    3362           2 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlTypeMode =
    3363           2 :             state.dataSetPointManager->IdealCondEntSetPtMgr(SetPtMgrNum).CtrlTypeMode;
    3364           2 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).NumCtrlNodes =
    3365           2 :             state.dataSetPointManager->IdealCondEntSetPtMgr(SetPtMgrNum).NumCtrlNodes;
    3366             :     }
    3367             : 
    3368         775 :     if (state.dataSetPointManager->NumSZOneStageCoolingSetPtMgrs > 0)
    3369           1 :         state.dataSetPointManager->SZOneStageCoolingSetPtMgr.allocate(state.dataSetPointManager->NumSZOneStageCoolingSetPtMgrs);
    3370             : 
    3371         775 :     cCurrentModuleObject = "SetpointManager:SingleZone:OneStageCooling";
    3372         779 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumSZOneStageCoolingSetPtMgrs; ++SetPtMgrNum) {
    3373           4 :         state.dataInputProcessing->inputProcessor->getObjectItem(state,
    3374             :                                                                  cCurrentModuleObject,
    3375             :                                                                  SetPtMgrNum,
    3376             :                                                                  cAlphaArgs,
    3377             :                                                                  NumAlphas,
    3378             :                                                                  rNumericArgs,
    3379             :                                                                  NumNums,
    3380             :                                                                  IOStat,
    3381             :                                                                  lNumericFieldBlanks,
    3382             :                                                                  lAlphaFieldBlanks,
    3383             :                                                                  cAlphaFieldNames,
    3384             :                                                                  cNumericFieldNames);
    3385           4 :         UtilityRoutines::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound);
    3386             : 
    3387           4 :         state.dataSetPointManager->SZOneStageCoolingSetPtMgr(SetPtMgrNum).Name = cAlphaArgs(1);
    3388           4 :         state.dataSetPointManager->SZOneStageCoolingSetPtMgr(SetPtMgrNum).ctrlVarType = "Temperature";
    3389           4 :         state.dataSetPointManager->SZOneStageCoolingSetPtMgr(SetPtMgrNum).CtrlTypeMode = CtrlVarType::Temp;
    3390           4 :         state.dataSetPointManager->SZOneStageCoolingSetPtMgr(SetPtMgrNum).CoolingOnTemp = rNumericArgs(1);
    3391           4 :         state.dataSetPointManager->SZOneStageCoolingSetPtMgr(SetPtMgrNum).CoolingOffTemp = rNumericArgs(2);
    3392             : 
    3393           8 :         if (state.dataSetPointManager->SZOneStageCoolingSetPtMgr(SetPtMgrNum).CoolingOffTemp <
    3394           4 :             state.dataSetPointManager->SZOneStageCoolingSetPtMgr(SetPtMgrNum).CoolingOnTemp) {
    3395             :             // throw warning, off must be warmer than on
    3396           0 :             ShowWarningError(state, format("{}: {}=\"{}\",", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
    3397           0 :             ShowContinueError(state,
    3398           0 :                               format("...{}=[{:.1R}] is less than {}=[{:.1R}].",
    3399             :                                      cNumericFieldNames(2),
    3400           0 :                                      state.dataSetPointManager->SZOneStageCoolingSetPtMgr(SetPtMgrNum).CoolingOffTemp,
    3401             :                                      cNumericFieldNames(1),
    3402           0 :                                      state.dataSetPointManager->SZOneStageCoolingSetPtMgr(SetPtMgrNum).CoolingOnTemp));
    3403             :         }
    3404             : 
    3405           4 :         state.dataSetPointManager->SZOneStageCoolingSetPtMgr(SetPtMgrNum).ControlZoneName = cAlphaArgs(2);
    3406             :         // get the actual zone number of the control zone
    3407           4 :         state.dataSetPointManager->SZOneStageCoolingSetPtMgr(SetPtMgrNum).ControlZoneNum =
    3408           4 :             UtilityRoutines::FindItemInList(cAlphaArgs(2), state.dataHeatBal->Zone);
    3409           4 :         if (state.dataSetPointManager->SZOneStageCoolingSetPtMgr(SetPtMgrNum).ControlZoneNum == 0) {
    3410           0 :             ShowSevereError(state, format("{}: {}=\"{}\", invalid field.", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
    3411           0 :             ShowContinueError(state, "..invalid " + cAlphaFieldNames(2) + "=\"" + cAlphaArgs(2) + "\".");
    3412           0 :             ErrorsFound = true;
    3413             :         } else {
    3414           4 :             state.dataSetPointManager->SZOneStageCoolingSetPtMgr(SetPtMgrNum).ZoneNodeNum =
    3415           4 :                 GetSystemNodeNumberForZone(state, state.dataSetPointManager->SZOneStageCoolingSetPtMgr(SetPtMgrNum).ControlZoneNum);
    3416           4 :             if (allocated(state.dataZoneCtrls->StageZoneLogic)) {
    3417           4 :                 if (!state.dataZoneCtrls->StageZoneLogic(state.dataSetPointManager->SZOneStageCoolingSetPtMgr(SetPtMgrNum).ControlZoneNum)) {
    3418           0 :                     ShowSevereError(state, format("{}: {}=\"{}\", invalid field.", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
    3419           0 :                     ShowContinueError(state, "..invalid " + cAlphaFieldNames(2) + "=\"" + cAlphaArgs(2) + "\".");
    3420           0 :                     ShowContinueError(state, "Zone thermostat must use ZoneControl:Thermostat:StagedDualSetpoint.");
    3421           0 :                     ErrorsFound = true;
    3422             :                 }
    3423             :             }
    3424             :         }
    3425             : 
    3426           4 :         NodeListError = false;
    3427           8 :         GetNodeNums(state,
    3428           4 :                     cAlphaArgs(3),
    3429             :                     NumNodes,
    3430             :                     NodeNums,
    3431             :                     NodeListError,
    3432             :                     DataLoopNode::NodeFluidType::Blank,
    3433             :                     DataLoopNode::ConnectionObjectType::SetpointManagerSingleZoneOneStageCooling,
    3434           4 :                     cAlphaArgs(1),
    3435             :                     DataLoopNode::ConnectionType::SetPoint,
    3436             :                     NodeInputManager::CompFluidStream::Primary,
    3437             :                     ObjectIsNotParent,
    3438             :                     false,
    3439           4 :                     cAlphaFieldNames(3)); // setpoint nodes
    3440           4 :         if (!NodeListError) {
    3441           4 :             NumNodesCtrld = NumNodes;
    3442           4 :             state.dataSetPointManager->SZOneStageCoolingSetPtMgr(SetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld);
    3443           4 :             state.dataSetPointManager->SZOneStageCoolingSetPtMgr(SetPtMgrNum).NumCtrlNodes = NumNodesCtrld;
    3444           4 :             state.dataSetPointManager->SZOneStageCoolingSetPtMgr(SetPtMgrNum).SetPt = 0.0;
    3445             : 
    3446           8 :             for (CtrldNodeNum = 1; CtrldNodeNum <= NumNodesCtrld; ++CtrldNodeNum) {
    3447           4 :                 state.dataSetPointManager->SZOneStageCoolingSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum) = NodeNums(CtrldNodeNum);
    3448             :             }
    3449             :         } else {
    3450           0 :             ErrorsFound = true;
    3451             :         }
    3452             : 
    3453          12 :         AllSetPtMgrNum = SetPtMgrNum + state.dataSetPointManager->NumSchSetPtMgrs + state.dataSetPointManager->NumDualSchSetPtMgrs +
    3454          12 :                          state.dataSetPointManager->NumOutAirSetPtMgrs + state.dataSetPointManager->NumSZRhSetPtMgrs +
    3455          12 :                          state.dataSetPointManager->NumSZHtSetPtMgrs + state.dataSetPointManager->NumSZClSetPtMgrs +
    3456          12 :                          state.dataSetPointManager->NumSZMinHumSetPtMgrs + state.dataSetPointManager->NumSZMaxHumSetPtMgrs +
    3457          12 :                          state.dataSetPointManager->NumMixedAirSetPtMgrs + state.dataSetPointManager->NumOAPretreatSetPtMgrs +
    3458          12 :                          state.dataSetPointManager->NumWarmestSetPtMgrs + state.dataSetPointManager->NumColdestSetPtMgrs +
    3459          12 :                          state.dataSetPointManager->NumWarmestSetPtMgrsTempFlow + state.dataSetPointManager->NumRABFlowSetPtMgrs +
    3460          12 :                          state.dataSetPointManager->NumMZClgAverageSetPtMgrs + state.dataSetPointManager->NumMZHtgAverageSetPtMgrs +
    3461          12 :                          state.dataSetPointManager->NumMZAverageMinHumSetPtMgrs + state.dataSetPointManager->NumMZAverageMaxHumSetPtMgrs +
    3462          12 :                          state.dataSetPointManager->NumMZMinHumSetPtMgrs + state.dataSetPointManager->NumMZMaxHumSetPtMgrs +
    3463          12 :                          state.dataSetPointManager->NumFollowOATempSetPtMgrs + state.dataSetPointManager->NumFollowSysNodeTempSetPtMgrs +
    3464           8 :                          state.dataSetPointManager->NumGroundTempSetPtMgrs + state.dataSetPointManager->NumCondEntSetPtMgrs +
    3465           4 :                          state.dataSetPointManager->NumIdealCondEntSetPtMgrs;
    3466           4 :         if (!NodeListError) {
    3467           4 :             state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld);
    3468           8 :             state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlNodes =
    3469           8 :                 state.dataSetPointManager->SZOneStageCoolingSetPtMgr(SetPtMgrNum).CtrlNodes;
    3470             :         }
    3471           4 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).Name = state.dataSetPointManager->SZOneStageCoolingSetPtMgr(SetPtMgrNum).Name;
    3472           4 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).SPMType = SetPointManagerType::SZOneStageCooling;
    3473           4 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).SPMIndex = SetPtMgrNum;
    3474           4 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlTypeMode =
    3475           4 :             state.dataSetPointManager->SZOneStageCoolingSetPtMgr(SetPtMgrNum).CtrlTypeMode;
    3476           4 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).NumCtrlNodes =
    3477           4 :             state.dataSetPointManager->SZOneStageCoolingSetPtMgr(SetPtMgrNum).NumCtrlNodes;
    3478             :     }
    3479             : 
    3480         775 :     if (state.dataSetPointManager->NumSZOneStageHeatingSetPtMgrs > 0)
    3481           1 :         state.dataSetPointManager->SZOneStageHeatingSetPtMgr.allocate(state.dataSetPointManager->NumSZOneStageHeatingSetPtMgrs);
    3482             : 
    3483         775 :     cCurrentModuleObject = "SetpointManager:SingleZone:OneStageHeating";
    3484         779 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumSZOneStageHeatingSetPtMgrs; ++SetPtMgrNum) {
    3485           4 :         state.dataInputProcessing->inputProcessor->getObjectItem(state,
    3486             :                                                                  cCurrentModuleObject,
    3487             :                                                                  SetPtMgrNum,
    3488             :                                                                  cAlphaArgs,
    3489             :                                                                  NumAlphas,
    3490             :                                                                  rNumericArgs,
    3491             :                                                                  NumNums,
    3492             :                                                                  IOStat,
    3493             :                                                                  lNumericFieldBlanks,
    3494             :                                                                  lAlphaFieldBlanks,
    3495             :                                                                  cAlphaFieldNames,
    3496             :                                                                  cNumericFieldNames);
    3497           4 :         UtilityRoutines::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound);
    3498             : 
    3499           4 :         state.dataSetPointManager->SZOneStageHeatingSetPtMgr(SetPtMgrNum).Name = cAlphaArgs(1);
    3500           4 :         state.dataSetPointManager->SZOneStageHeatingSetPtMgr(SetPtMgrNum).ctrlVarType = "Temperature";
    3501           4 :         state.dataSetPointManager->SZOneStageHeatingSetPtMgr(SetPtMgrNum).CtrlTypeMode = CtrlVarType::Temp;
    3502           4 :         state.dataSetPointManager->SZOneStageHeatingSetPtMgr(SetPtMgrNum).HeatingOnTemp = rNumericArgs(1);
    3503           4 :         state.dataSetPointManager->SZOneStageHeatingSetPtMgr(SetPtMgrNum).HeatingOffTemp = rNumericArgs(2);
    3504             : 
    3505           8 :         if (state.dataSetPointManager->SZOneStageHeatingSetPtMgr(SetPtMgrNum).HeatingOffTemp >
    3506           4 :             state.dataSetPointManager->SZOneStageHeatingSetPtMgr(SetPtMgrNum).HeatingOnTemp) {
    3507             :             // throw warning, off must be cooler than on
    3508           0 :             ShowWarningError(state, format("{}: {}=\"{}\",", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
    3509           0 :             ShowContinueError(state,
    3510           0 :                               format("...{}=[{:.1R}] is less than {}=[{:.1R}].",
    3511             :                                      cNumericFieldNames(2),
    3512           0 :                                      state.dataSetPointManager->SZOneStageHeatingSetPtMgr(SetPtMgrNum).HeatingOnTemp,
    3513             :                                      cNumericFieldNames(1),
    3514           0 :                                      state.dataSetPointManager->SZOneStageHeatingSetPtMgr(SetPtMgrNum).HeatingOffTemp));
    3515             :         }
    3516             : 
    3517           4 :         state.dataSetPointManager->SZOneStageHeatingSetPtMgr(SetPtMgrNum).ControlZoneName = cAlphaArgs(2);
    3518             :         // get the actual zone number of the control zone
    3519           4 :         state.dataSetPointManager->SZOneStageHeatingSetPtMgr(SetPtMgrNum).ControlZoneNum =
    3520           4 :             UtilityRoutines::FindItemInList(cAlphaArgs(2), state.dataHeatBal->Zone);
    3521           4 :         if (state.dataSetPointManager->SZOneStageHeatingSetPtMgr(SetPtMgrNum).ControlZoneNum == 0) {
    3522           0 :             ShowSevereError(state, format("{}: {}=\"{}\", invalid field.", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
    3523           0 :             ShowContinueError(state, "..invalid " + cAlphaFieldNames(2) + "=\"" + cAlphaArgs(2) + "\".");
    3524           0 :             ErrorsFound = true;
    3525             :         } else {
    3526           4 :             state.dataSetPointManager->SZOneStageHeatingSetPtMgr(SetPtMgrNum).ZoneNodeNum =
    3527           4 :                 GetSystemNodeNumberForZone(state, state.dataSetPointManager->SZOneStageHeatingSetPtMgr(SetPtMgrNum).ControlZoneNum);
    3528           4 :             if (allocated(state.dataZoneCtrls->StageZoneLogic)) {
    3529           4 :                 if (!state.dataZoneCtrls->StageZoneLogic(state.dataSetPointManager->SZOneStageHeatingSetPtMgr(SetPtMgrNum).ControlZoneNum)) {
    3530           0 :                     ShowSevereError(state, format("{}: {}=\"{}\", invalid field.", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
    3531           0 :                     ShowContinueError(state, "..invalid " + cAlphaFieldNames(2) + "=\"" + cAlphaArgs(2) + "\".");
    3532           0 :                     ShowContinueError(state, "Zone thermostat must use ZoneControl:Thermostat:StagedDualSetpoint.");
    3533           0 :                     ErrorsFound = true;
    3534             :                 }
    3535             :             }
    3536             :         }
    3537             : 
    3538           4 :         NodeListError = false;
    3539           8 :         GetNodeNums(state,
    3540           4 :                     cAlphaArgs(3),
    3541             :                     NumNodes,
    3542             :                     NodeNums,
    3543             :                     NodeListError,
    3544             :                     DataLoopNode::NodeFluidType::Blank,
    3545             :                     DataLoopNode::ConnectionObjectType::SetpointManagerSingleZoneOneStageHeating,
    3546           4 :                     cAlphaArgs(1),
    3547             :                     DataLoopNode::ConnectionType::SetPoint,
    3548             :                     NodeInputManager::CompFluidStream::Primary,
    3549             :                     ObjectIsNotParent,
    3550             :                     false,
    3551           4 :                     cAlphaFieldNames(3)); // setpoint nodes
    3552           4 :         if (!NodeListError) {
    3553           4 :             NumNodesCtrld = NumNodes;
    3554           4 :             state.dataSetPointManager->SZOneStageHeatingSetPtMgr(SetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld);
    3555           4 :             state.dataSetPointManager->SZOneStageHeatingSetPtMgr(SetPtMgrNum).NumCtrlNodes = NumNodesCtrld;
    3556           4 :             state.dataSetPointManager->SZOneStageHeatingSetPtMgr(SetPtMgrNum).SetPt = 0.0;
    3557             : 
    3558           8 :             for (CtrldNodeNum = 1; CtrldNodeNum <= NumNodesCtrld; ++CtrldNodeNum) {
    3559           4 :                 state.dataSetPointManager->SZOneStageHeatingSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum) = NodeNums(CtrldNodeNum);
    3560             :             }
    3561             :         } else {
    3562           0 :             ErrorsFound = true;
    3563             :         }
    3564             : 
    3565          12 :         AllSetPtMgrNum = SetPtMgrNum + state.dataSetPointManager->NumSchSetPtMgrs + state.dataSetPointManager->NumDualSchSetPtMgrs +
    3566          12 :                          state.dataSetPointManager->NumOutAirSetPtMgrs + state.dataSetPointManager->NumSZRhSetPtMgrs +
    3567          12 :                          state.dataSetPointManager->NumSZHtSetPtMgrs + state.dataSetPointManager->NumSZClSetPtMgrs +
    3568          12 :                          state.dataSetPointManager->NumSZMinHumSetPtMgrs + state.dataSetPointManager->NumSZMaxHumSetPtMgrs +
    3569          12 :                          state.dataSetPointManager->NumMixedAirSetPtMgrs + state.dataSetPointManager->NumOAPretreatSetPtMgrs +
    3570          12 :                          state.dataSetPointManager->NumWarmestSetPtMgrs + state.dataSetPointManager->NumColdestSetPtMgrs +
    3571          12 :                          state.dataSetPointManager->NumWarmestSetPtMgrsTempFlow + state.dataSetPointManager->NumRABFlowSetPtMgrs +
    3572          12 :                          state.dataSetPointManager->NumMZClgAverageSetPtMgrs + state.dataSetPointManager->NumMZHtgAverageSetPtMgrs +
    3573          12 :                          state.dataSetPointManager->NumMZAverageMinHumSetPtMgrs + state.dataSetPointManager->NumMZAverageMaxHumSetPtMgrs +
    3574          12 :                          state.dataSetPointManager->NumMZMinHumSetPtMgrs + state.dataSetPointManager->NumMZMaxHumSetPtMgrs +
    3575          12 :                          state.dataSetPointManager->NumFollowOATempSetPtMgrs + state.dataSetPointManager->NumFollowSysNodeTempSetPtMgrs +
    3576          12 :                          state.dataSetPointManager->NumGroundTempSetPtMgrs + state.dataSetPointManager->NumCondEntSetPtMgrs +
    3577           8 :                          state.dataSetPointManager->NumIdealCondEntSetPtMgrs + state.dataSetPointManager->NumSZOneStageCoolingSetPtMgrs;
    3578           4 :         if (!NodeListError) {
    3579           4 :             state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld);
    3580           8 :             state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlNodes =
    3581           8 :                 state.dataSetPointManager->SZOneStageHeatingSetPtMgr(SetPtMgrNum).CtrlNodes;
    3582             :         }
    3583           4 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).Name = state.dataSetPointManager->SZOneStageHeatingSetPtMgr(SetPtMgrNum).Name;
    3584           4 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).SPMType = SetPointManagerType::SZOneStageHeating;
    3585           4 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).SPMIndex = SetPtMgrNum;
    3586           4 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlTypeMode =
    3587           4 :             state.dataSetPointManager->SZOneStageHeatingSetPtMgr(SetPtMgrNum).CtrlTypeMode;
    3588           4 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).NumCtrlNodes =
    3589           4 :             state.dataSetPointManager->SZOneStageHeatingSetPtMgr(SetPtMgrNum).NumCtrlNodes;
    3590             :     }
    3591             : 
    3592         775 :     if (state.dataSetPointManager->NumReturnWaterResetChWSetPtMgrs > 0)
    3593           3 :         state.dataSetPointManager->ReturnWaterResetChWSetPtMgr.allocate(state.dataSetPointManager->NumReturnWaterResetChWSetPtMgrs);
    3594             : 
    3595         775 :     cCurrentModuleObject = "SetpointManager:ReturnTemperature:ChilledWater";
    3596         778 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumReturnWaterResetChWSetPtMgrs; ++SetPtMgrNum) {
    3597             : 
    3598             :         // get the object inputs
    3599           3 :         state.dataInputProcessing->inputProcessor->getObjectItem(state,
    3600             :                                                                  cCurrentModuleObject,
    3601             :                                                                  SetPtMgrNum,
    3602             :                                                                  cAlphaArgs,
    3603             :                                                                  NumAlphas,
    3604             :                                                                  rNumericArgs,
    3605             :                                                                  NumNums,
    3606             :                                                                  IOStat,
    3607             :                                                                  lNumericFieldBlanks,
    3608             :                                                                  lAlphaFieldBlanks,
    3609             :                                                                  cAlphaFieldNames,
    3610             :                                                                  cNumericFieldNames);
    3611           3 :         UtilityRoutines::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound);
    3612             : 
    3613           3 :         state.dataSetPointManager->ReturnWaterResetChWSetPtMgr(SetPtMgrNum).Name = cAlphaArgs(1);
    3614             : 
    3615             :         // process the sense and actuate nodes
    3616           3 :         bool errFlag = false;
    3617           3 :         state.dataSetPointManager->ReturnWaterResetChWSetPtMgr(SetPtMgrNum).supplyNodeIndex =
    3618           6 :             GetOnlySingleNode(state,
    3619           3 :                               cAlphaArgs(2),
    3620             :                               errFlag,
    3621             :                               DataLoopNode::ConnectionObjectType::SetpointManagerReturnTemperatureChilledWater,
    3622           3 :                               cAlphaArgs(1),
    3623             :                               DataLoopNode::NodeFluidType::Blank,
    3624             :                               DataLoopNode::ConnectionType::SetPoint,
    3625             :                               NodeInputManager::CompFluidStream::Primary,
    3626             :                               ObjectIsNotParent,
    3627           3 :                               cAlphaFieldNames(2)); // setpoint nodes
    3628           3 :         state.dataSetPointManager->ReturnWaterResetChWSetPtMgr(SetPtMgrNum).returnNodeIndex =
    3629           6 :             GetOnlySingleNode(state,
    3630           3 :                               cAlphaArgs(3),
    3631             :                               errFlag,
    3632             :                               DataLoopNode::ConnectionObjectType::SetpointManagerReturnTemperatureChilledWater,
    3633           3 :                               cAlphaArgs(1),
    3634             :                               DataLoopNode::NodeFluidType::Blank,
    3635             :                               DataLoopNode::ConnectionType::Sensor,
    3636             :                               NodeInputManager::CompFluidStream::Primary,
    3637             :                               ObjectIsNotParent,
    3638           3 :                               cAlphaFieldNames(3)); // setpoint nodes
    3639             : 
    3640             :         // process the setpoint inputs
    3641           3 :         state.dataSetPointManager->ReturnWaterResetChWSetPtMgr(SetPtMgrNum).minimumChilledWaterSetpoint = rNumericArgs(1);
    3642           3 :         state.dataSetPointManager->ReturnWaterResetChWSetPtMgr(SetPtMgrNum).maximumChilledWaterSetpoint = rNumericArgs(2);
    3643             : 
    3644             :         // process the return temperature type/value
    3645           6 :         std::string returnType(cAlphaArgs(4));
    3646           3 :         if (UtilityRoutines::SameString(returnType, "SCHEDULED")) {
    3647           0 :             state.dataSetPointManager->ReturnWaterResetChWSetPtMgr(SetPtMgrNum).returnTemperatureScheduleIndex =
    3648           0 :                 GetScheduleIndex(state, cAlphaArgs(5));
    3649           0 :             if (state.dataSetPointManager->ReturnWaterResetChWSetPtMgr(SetPtMgrNum).returnTemperatureScheduleIndex == 0) {
    3650           0 :                 ShowSevereError(state, format("{}: {}=\"{}\", invalid field.", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
    3651           0 :                 ShowContinueError(state, "..invalid " + cAlphaFieldNames(5) + "=\"" + cAlphaArgs(5) + "\".");
    3652           0 :                 ErrorsFound = true;
    3653             :             }
    3654           3 :         } else if (UtilityRoutines::SameString(returnType, "CONSTANT")) {
    3655           2 :             state.dataSetPointManager->ReturnWaterResetChWSetPtMgr(SetPtMgrNum).returnTemperatureConstantTarget = rNumericArgs(3);
    3656           1 :         } else if (UtilityRoutines::SameString(returnType, "RETURNTEMPERATURESETPOINT")) {
    3657           1 :             state.dataSetPointManager->ReturnWaterResetChWSetPtMgr(SetPtMgrNum).useReturnTempSetpoint = true;
    3658             :         } else {
    3659           0 :             ShowSevereError(state, format("{}: {}=\"{}\", invalid field.", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
    3660           0 :             ShowContinueError(state, "..invalid " + cAlphaFieldNames(4) + "=\"" + cAlphaArgs(4) + "\".");
    3661           0 :             ErrorsFound = true;
    3662             :         }
    3663             : 
    3664             :         // setup the "base" class
    3665           9 :         AllSetPtMgrNum = SetPtMgrNum + state.dataSetPointManager->NumSchSetPtMgrs + state.dataSetPointManager->NumDualSchSetPtMgrs +
    3666           9 :                          state.dataSetPointManager->NumOutAirSetPtMgrs + state.dataSetPointManager->NumSZRhSetPtMgrs +
    3667           9 :                          state.dataSetPointManager->NumSZHtSetPtMgrs + state.dataSetPointManager->NumSZClSetPtMgrs +
    3668           9 :                          state.dataSetPointManager->NumSZMinHumSetPtMgrs + state.dataSetPointManager->NumSZMaxHumSetPtMgrs +
    3669           9 :                          state.dataSetPointManager->NumMixedAirSetPtMgrs + state.dataSetPointManager->NumOAPretreatSetPtMgrs +
    3670           9 :                          state.dataSetPointManager->NumWarmestSetPtMgrs + state.dataSetPointManager->NumColdestSetPtMgrs +
    3671           9 :                          state.dataSetPointManager->NumWarmestSetPtMgrsTempFlow + state.dataSetPointManager->NumRABFlowSetPtMgrs +
    3672           9 :                          state.dataSetPointManager->NumMZClgAverageSetPtMgrs + state.dataSetPointManager->NumMZHtgAverageSetPtMgrs +
    3673           9 :                          state.dataSetPointManager->NumMZAverageMinHumSetPtMgrs + state.dataSetPointManager->NumMZAverageMaxHumSetPtMgrs +
    3674           9 :                          state.dataSetPointManager->NumMZMinHumSetPtMgrs + state.dataSetPointManager->NumMZMaxHumSetPtMgrs +
    3675           9 :                          state.dataSetPointManager->NumFollowOATempSetPtMgrs + state.dataSetPointManager->NumFollowSysNodeTempSetPtMgrs +
    3676           9 :                          state.dataSetPointManager->NumGroundTempSetPtMgrs + state.dataSetPointManager->NumCondEntSetPtMgrs +
    3677           6 :                          state.dataSetPointManager->NumIdealCondEntSetPtMgrs + state.dataSetPointManager->NumSZOneStageCoolingSetPtMgrs +
    3678           3 :                          state.dataSetPointManager->NumSZOneStageHeatingSetPtMgrs;
    3679           3 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlNodes.allocate(1);
    3680           3 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlNodes(1) =
    3681           3 :             state.dataSetPointManager->ReturnWaterResetChWSetPtMgr(SetPtMgrNum).supplyNodeIndex;
    3682           3 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).Name = state.dataSetPointManager->ReturnWaterResetChWSetPtMgr(SetPtMgrNum).Name;
    3683           3 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).SPMType = SetPointManagerType::ReturnWaterResetChW;
    3684           3 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).SPMIndex = SetPtMgrNum;
    3685           3 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlTypeMode = CtrlVarType::Temp;
    3686           3 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).NumCtrlNodes = 1;
    3687             :     }
    3688             : 
    3689         775 :     if (state.dataSetPointManager->NumReturnWaterResetHWSetPtMgrs > 0)
    3690           1 :         state.dataSetPointManager->ReturnWaterResetHWSetPtMgr.allocate(state.dataSetPointManager->NumReturnWaterResetHWSetPtMgrs);
    3691             : 
    3692         775 :     cCurrentModuleObject = "SetpointManager:ReturnTemperature:HotWater";
    3693         776 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumReturnWaterResetHWSetPtMgrs; ++SetPtMgrNum) {
    3694             : 
    3695             :         // get the object inputs
    3696           1 :         state.dataInputProcessing->inputProcessor->getObjectItem(state,
    3697             :                                                                  cCurrentModuleObject,
    3698             :                                                                  SetPtMgrNum,
    3699             :                                                                  cAlphaArgs,
    3700             :                                                                  NumAlphas,
    3701             :                                                                  rNumericArgs,
    3702             :                                                                  NumNums,
    3703             :                                                                  IOStat,
    3704             :                                                                  lNumericFieldBlanks,
    3705             :                                                                  lAlphaFieldBlanks,
    3706             :                                                                  cAlphaFieldNames,
    3707             :                                                                  cNumericFieldNames);
    3708           1 :         UtilityRoutines::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound);
    3709             : 
    3710           1 :         state.dataSetPointManager->ReturnWaterResetHWSetPtMgr(SetPtMgrNum).Name = cAlphaArgs(1);
    3711             : 
    3712             :         // process the sense and actuate nodes
    3713           1 :         bool errFlag = false;
    3714           1 :         state.dataSetPointManager->ReturnWaterResetHWSetPtMgr(SetPtMgrNum).supplyNodeIndex =
    3715           2 :             GetOnlySingleNode(state,
    3716           1 :                               cAlphaArgs(2),
    3717             :                               errFlag,
    3718             :                               DataLoopNode::ConnectionObjectType::SetpointManagerReturnTemperatureHotWater,
    3719           1 :                               cAlphaArgs(1),
    3720             :                               DataLoopNode::NodeFluidType::Blank,
    3721             :                               DataLoopNode::ConnectionType::SetPoint,
    3722             :                               NodeInputManager::CompFluidStream::Primary,
    3723             :                               ObjectIsNotParent,
    3724           1 :                               cAlphaFieldNames(2)); // setpoint nodes
    3725           1 :         state.dataSetPointManager->ReturnWaterResetHWSetPtMgr(SetPtMgrNum).returnNodeIndex =
    3726           2 :             GetOnlySingleNode(state,
    3727           1 :                               cAlphaArgs(3),
    3728             :                               errFlag,
    3729             :                               DataLoopNode::ConnectionObjectType::SetpointManagerReturnTemperatureHotWater,
    3730           1 :                               cAlphaArgs(1),
    3731             :                               DataLoopNode::NodeFluidType::Blank,
    3732             :                               DataLoopNode::ConnectionType::Sensor,
    3733             :                               NodeInputManager::CompFluidStream::Primary,
    3734             :                               ObjectIsNotParent,
    3735           1 :                               cAlphaFieldNames(3)); // setpoint nodes
    3736             : 
    3737             :         // process the setpoint inputs
    3738           1 :         state.dataSetPointManager->ReturnWaterResetHWSetPtMgr(SetPtMgrNum).minimumHotWaterSetpoint = rNumericArgs(1);
    3739           1 :         state.dataSetPointManager->ReturnWaterResetHWSetPtMgr(SetPtMgrNum).maximumHotWaterSetpoint = rNumericArgs(2);
    3740             : 
    3741             :         // process the return temperature type/value
    3742           2 :         std::string returnType(cAlphaArgs(4));
    3743           1 :         if (UtilityRoutines::SameString(returnType, "SCHEDULED")) {
    3744           0 :             state.dataSetPointManager->ReturnWaterResetHWSetPtMgr(SetPtMgrNum).returnTemperatureScheduleIndex =
    3745           0 :                 GetScheduleIndex(state, cAlphaArgs(5));
    3746           0 :             if (state.dataSetPointManager->ReturnWaterResetHWSetPtMgr(SetPtMgrNum).returnTemperatureScheduleIndex == 0) {
    3747           0 :                 ShowSevereError(state, format("{}: {}=\"{}\", invalid field.", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
    3748           0 :                 ShowContinueError(state, "..invalid " + cAlphaFieldNames(5) + "=\"" + cAlphaArgs(5) + "\".");
    3749           0 :                 ErrorsFound = true;
    3750             :             }
    3751           1 :         } else if (UtilityRoutines::SameString(returnType, "CONSTANT")) {
    3752           1 :             state.dataSetPointManager->ReturnWaterResetHWSetPtMgr(SetPtMgrNum).returnTemperatureConstantTarget = rNumericArgs(3);
    3753           0 :         } else if (UtilityRoutines::SameString(returnType, "RETURNTEMPERATURESETPOINT")) {
    3754           0 :             state.dataSetPointManager->ReturnWaterResetHWSetPtMgr(SetPtMgrNum).useReturnTempSetpoint = true;
    3755             :         } else {
    3756           0 :             ShowSevereError(state, format("{}: {}=\"{}\", invalid field.", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
    3757           0 :             ShowContinueError(state, "..invalid " + cAlphaFieldNames(4) + "=\"" + cAlphaArgs(4) + "\".");
    3758           0 :             ErrorsFound = true;
    3759             :         }
    3760             : 
    3761             :         // setup the "base" class
    3762           3 :         AllSetPtMgrNum = SetPtMgrNum + state.dataSetPointManager->NumSchSetPtMgrs + state.dataSetPointManager->NumDualSchSetPtMgrs +
    3763           3 :                          state.dataSetPointManager->NumOutAirSetPtMgrs + state.dataSetPointManager->NumSZRhSetPtMgrs +
    3764           3 :                          state.dataSetPointManager->NumSZHtSetPtMgrs + state.dataSetPointManager->NumSZClSetPtMgrs +
    3765           3 :                          state.dataSetPointManager->NumSZMinHumSetPtMgrs + state.dataSetPointManager->NumSZMaxHumSetPtMgrs +
    3766           3 :                          state.dataSetPointManager->NumMixedAirSetPtMgrs + state.dataSetPointManager->NumOAPretreatSetPtMgrs +
    3767           3 :                          state.dataSetPointManager->NumWarmestSetPtMgrs + state.dataSetPointManager->NumColdestSetPtMgrs +
    3768           3 :                          state.dataSetPointManager->NumWarmestSetPtMgrsTempFlow + state.dataSetPointManager->NumRABFlowSetPtMgrs +
    3769           3 :                          state.dataSetPointManager->NumMZClgAverageSetPtMgrs + state.dataSetPointManager->NumMZHtgAverageSetPtMgrs +
    3770           3 :                          state.dataSetPointManager->NumMZAverageMinHumSetPtMgrs + state.dataSetPointManager->NumMZAverageMaxHumSetPtMgrs +
    3771           3 :                          state.dataSetPointManager->NumMZMinHumSetPtMgrs + state.dataSetPointManager->NumMZMaxHumSetPtMgrs +
    3772           3 :                          state.dataSetPointManager->NumFollowOATempSetPtMgrs + state.dataSetPointManager->NumFollowSysNodeTempSetPtMgrs +
    3773           3 :                          state.dataSetPointManager->NumGroundTempSetPtMgrs + state.dataSetPointManager->NumCondEntSetPtMgrs +
    3774           3 :                          state.dataSetPointManager->NumIdealCondEntSetPtMgrs + state.dataSetPointManager->NumSZOneStageCoolingSetPtMgrs +
    3775           2 :                          state.dataSetPointManager->NumSZOneStageHeatingSetPtMgrs + state.dataSetPointManager->NumReturnWaterResetChWSetPtMgrs;
    3776           1 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlNodes.allocate(1);
    3777           1 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlNodes(1) =
    3778           1 :             state.dataSetPointManager->ReturnWaterResetHWSetPtMgr(SetPtMgrNum).supplyNodeIndex;
    3779           1 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).Name = state.dataSetPointManager->ReturnWaterResetHWSetPtMgr(SetPtMgrNum).Name;
    3780           1 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).SPMType = SetPointManagerType::ReturnWaterResetHW;
    3781           1 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).SPMIndex = SetPtMgrNum;
    3782           1 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlTypeMode = CtrlVarType::Temp;
    3783           1 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).NumCtrlNodes = 1;
    3784             :     }
    3785             : 
    3786             :     // Input the System Node Reset Temperature Setpoint Managers
    3787             : 
    3788         775 :     if (state.dataSetPointManager->NumSystemNodeResetTempSetPtMgrs > 0 || state.dataSetPointManager->NumSystemNodeResetHumSetPtMgrs > 0)
    3789           2 :         state.dataSetPointManager->SystemNodeResetSetPtMgr.allocate(
    3790           1 :             state.dataSetPointManager->NumSystemNodeResetTempSetPtMgrs +
    3791           3 :             state.dataSetPointManager->NumSystemNodeResetHumSetPtMgrs); // Allocate the Setpoint Manager input data array
    3792             : 
    3793             :     // Input the data for each Setpoint Manager
    3794         775 :     cCurrentModuleObject = "SetpointManager:SystemNodeReset:Temperature";
    3795             : 
    3796         778 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumSystemNodeResetTempSetPtMgrs; ++SetPtMgrNum) {
    3797           3 :         state.dataInputProcessing->inputProcessor->getObjectItem(state,
    3798             :                                                                  cCurrentModuleObject,
    3799             :                                                                  SetPtMgrNum,
    3800             :                                                                  cAlphaArgs,
    3801             :                                                                  NumAlphas,
    3802             :                                                                  rNumericArgs,
    3803             :                                                                  NumNums,
    3804             :                                                                  IOStat,
    3805             :                                                                  lNumericFieldBlanks,
    3806             :                                                                  lAlphaFieldBlanks,
    3807             :                                                                  cAlphaFieldNames,
    3808             :                                                                  cNumericFieldNames);
    3809           3 :         UtilityRoutines::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound);
    3810             : 
    3811           3 :         auto &setpointManager = state.dataSetPointManager->SystemNodeResetSetPtMgr(SetPtMgrNum);
    3812             : 
    3813           3 :         setpointManager.Name = cAlphaArgs(1);
    3814           3 :         setpointManager.ctrlVarType = cAlphaArgs(2);
    3815             : 
    3816           3 :         int typeNum = getEnumerationValue(SetPointManager::controlTypeNameUC, cAlphaArgs(2));
    3817           3 :         setpointManager.CtrlTypeMode = static_cast<SetPointManager::CtrlVarType>(typeNum);
    3818           3 :         if (setpointManager.CtrlTypeMode == SetPointManager::CtrlVarType::Invalid) {
    3819             :             // should not come here if idd type choice and key list is working
    3820           0 :             ShowSevereError(state, format("{}: {}=\"{}\", invalid field.", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
    3821           0 :             ShowContinueError(state, "..invalid " + cAlphaFieldNames(2) + "=\"" + cAlphaArgs(2) + "\".");
    3822           0 :             ShowContinueError(state, "..Valid values are \"Temperature\", \"MaximumTemperature\", or \"MinimumTemperature\".");
    3823           0 :             ErrorsFound = true;
    3824             :         }
    3825             : 
    3826           3 :         setpointManager.SpAtLowRef = rNumericArgs(1);
    3827           3 :         setpointManager.SpAtHighRef = rNumericArgs(2);
    3828           3 :         setpointManager.LowRef = rNumericArgs(3);
    3829           3 :         setpointManager.HighRef = rNumericArgs(4);
    3830             : 
    3831           3 :         setpointManager.RefNodeNum = GetOnlySingleNode(state,
    3832           3 :                                                        cAlphaArgs(3),
    3833             :                                                        ErrorsFound,
    3834             :                                                        DataLoopNode::ConnectionObjectType::SetpointManagerSystemNodeResetTemperature,
    3835           3 :                                                        cAlphaArgs(1),
    3836             :                                                        DataLoopNode::NodeFluidType::Blank,
    3837             :                                                        DataLoopNode::ConnectionType::Sensor,
    3838             :                                                        NodeInputManager::CompFluidStream::Primary,
    3839           3 :                                                        ObjectIsNotParent);
    3840             : 
    3841           3 :         setpointManager.CtrlNodeListName = cAlphaArgs(4);
    3842           3 :         if (setpointManager.HighRef < setpointManager.LowRef) {
    3843           0 :             ShowWarningError(state, format("{}: {}=\"{}\", invalid field.", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
    3844           0 :             ShowContinueError(state,
    3845           0 :                               format("...{}=[{:.1R}] is less than {}=[{:.1R}].",
    3846             :                                      cNumericFieldNames(3),
    3847             :                                      setpointManager.LowRef,
    3848             :                                      cNumericFieldNames(4),
    3849           0 :                                      setpointManager.HighRef));
    3850             :         }
    3851             : 
    3852           3 :         NodeListError = false;
    3853             : 
    3854           6 :         GetNodeNums(state,
    3855             :                     setpointManager.CtrlNodeListName,
    3856             :                     NumNodes,
    3857             :                     NodeNums,
    3858             :                     NodeListError,
    3859             :                     DataLoopNode::NodeFluidType::Blank,
    3860             :                     DataLoopNode::ConnectionObjectType::SetpointManagerSystemNodeResetTemperature,
    3861           3 :                     cAlphaArgs(1),
    3862             :                     DataLoopNode::ConnectionType::SetPoint,
    3863             :                     NodeInputManager::CompFluidStream::Primary,
    3864             :                     ObjectIsNotParent,
    3865             :                     false,
    3866           3 :                     cAlphaFieldNames(4));
    3867             : 
    3868           3 :         if (!NodeListError) {
    3869           3 :             NumNodesCtrld = NumNodes;
    3870           3 :             setpointManager.CtrlNodes.allocate(NumNodesCtrld);
    3871           3 :             setpointManager.NumCtrlNodes = NumNodesCtrld;
    3872           3 :             setpointManager.SetPt = 0.0;
    3873             : 
    3874           6 :             for (CtrldNodeNum = 1; CtrldNodeNum <= NumNodesCtrld; ++CtrldNodeNum) {
    3875           3 :                 setpointManager.CtrlNodes(CtrldNodeNum) = NodeNums(CtrldNodeNum);
    3876             :             }
    3877             :         } else {
    3878           0 :             ErrorsFound = true;
    3879             :         }
    3880             : 
    3881           9 :         AllSetPtMgrNum = SetPtMgrNum + state.dataSetPointManager->NumSchSetPtMgrs + state.dataSetPointManager->NumDualSchSetPtMgrs +
    3882           9 :                          state.dataSetPointManager->NumOutAirSetPtMgrs + state.dataSetPointManager->NumSZRhSetPtMgrs +
    3883           9 :                          state.dataSetPointManager->NumSZHtSetPtMgrs + state.dataSetPointManager->NumSZClSetPtMgrs +
    3884           9 :                          state.dataSetPointManager->NumSZMinHumSetPtMgrs + state.dataSetPointManager->NumSZMaxHumSetPtMgrs +
    3885           9 :                          state.dataSetPointManager->NumMixedAirSetPtMgrs + state.dataSetPointManager->NumOAPretreatSetPtMgrs +
    3886           9 :                          state.dataSetPointManager->NumWarmestSetPtMgrs + state.dataSetPointManager->NumColdestSetPtMgrs +
    3887           9 :                          state.dataSetPointManager->NumWarmestSetPtMgrsTempFlow + state.dataSetPointManager->NumRABFlowSetPtMgrs +
    3888           9 :                          state.dataSetPointManager->NumMZClgAverageSetPtMgrs + state.dataSetPointManager->NumMZHtgAverageSetPtMgrs +
    3889           9 :                          state.dataSetPointManager->NumMZAverageMinHumSetPtMgrs + state.dataSetPointManager->NumMZAverageMaxHumSetPtMgrs +
    3890           9 :                          state.dataSetPointManager->NumMZMinHumSetPtMgrs + state.dataSetPointManager->NumMZMaxHumSetPtMgrs +
    3891           9 :                          state.dataSetPointManager->NumFollowOATempSetPtMgrs + state.dataSetPointManager->NumFollowSysNodeTempSetPtMgrs +
    3892           9 :                          state.dataSetPointManager->NumGroundTempSetPtMgrs + state.dataSetPointManager->NumCondEntSetPtMgrs +
    3893           9 :                          state.dataSetPointManager->NumIdealCondEntSetPtMgrs + state.dataSetPointManager->NumSZOneStageCoolingSetPtMgrs +
    3894           6 :                          state.dataSetPointManager->NumSZOneStageHeatingSetPtMgrs + state.dataSetPointManager->NumReturnWaterResetChWSetPtMgrs +
    3895           3 :                          state.dataSetPointManager->NumReturnWaterResetHWSetPtMgrs;
    3896             : 
    3897           3 :         if (!NodeListError) {
    3898           3 :             state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld);
    3899           6 :             state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlNodes =
    3900           6 :                 state.dataSetPointManager->SystemNodeResetSetPtMgr(SetPtMgrNum).CtrlNodes;
    3901             :         }
    3902           3 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).Name = state.dataSetPointManager->SystemNodeResetSetPtMgr(SetPtMgrNum).Name;
    3903           3 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).SPMType = SetPointManagerType::SystemNodeResetTemp;
    3904           3 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).SPMIndex = SetPtMgrNum;
    3905           3 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlTypeMode =
    3906           3 :             state.dataSetPointManager->SystemNodeResetSetPtMgr(SetPtMgrNum).CtrlTypeMode;
    3907           3 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).NumCtrlNodes =
    3908           3 :             state.dataSetPointManager->SystemNodeResetSetPtMgr(SetPtMgrNum).NumCtrlNodes;
    3909             :     }
    3910             : 
    3911             :     // Input the System Node Reset Humidity Setpoint Managers
    3912             : 
    3913             :     // Input the data for each Setpoint Manager
    3914         775 :     cCurrentModuleObject = "SetpointManager:SystemNodeReset:Humidity";
    3915             : 
    3916         776 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumSystemNodeResetHumSetPtMgrs; ++SetPtMgrNum) {
    3917           1 :         state.dataInputProcessing->inputProcessor->getObjectItem(state,
    3918             :                                                                  cCurrentModuleObject,
    3919             :                                                                  SetPtMgrNum,
    3920             :                                                                  cAlphaArgs,
    3921             :                                                                  NumAlphas,
    3922             :                                                                  rNumericArgs,
    3923             :                                                                  NumNums,
    3924             :                                                                  IOStat,
    3925             :                                                                  lNumericFieldBlanks,
    3926             :                                                                  lAlphaFieldBlanks,
    3927             :                                                                  cAlphaFieldNames,
    3928             :                                                                  cNumericFieldNames);
    3929           1 :         UtilityRoutines::IsNameEmpty(state, cAlphaArgs(1), cCurrentModuleObject, ErrorsFound);
    3930             : 
    3931           1 :         int SetPtRstMgrNum = SetPtMgrNum + state.dataSetPointManager->NumSystemNodeResetTempSetPtMgrs;
    3932             : 
    3933           1 :         auto &setpointManager = state.dataSetPointManager->SystemNodeResetSetPtMgr(SetPtRstMgrNum);
    3934             : 
    3935           1 :         setpointManager.Name = cAlphaArgs(1);
    3936           1 :         setpointManager.ctrlVarType = cAlphaArgs(2);
    3937             : 
    3938           1 :         int typeNum = getEnumerationValue(SetPointManager::controlTypeNameUC, cAlphaArgs(2));
    3939           1 :         setpointManager.CtrlTypeMode = static_cast<SetPointManager::CtrlVarType>(typeNum);
    3940           1 :         if (setpointManager.CtrlTypeMode == SetPointManager::CtrlVarType::Invalid) {
    3941             :             // should not come here if idd type choice and key list is working
    3942           0 :             ShowSevereError(state, format("{}: {}=\"{}\", invalid field.", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
    3943           0 :             ShowContinueError(state, "..invalid " + cAlphaFieldNames(2) + "=\"" + cAlphaArgs(2) + "\".");
    3944           0 :             ShowContinueError(state, "..Valid values are \"HumidityRatio\", \"MaximumHumidityRatio\", or \"MinimumHumidityRatio\".");
    3945           0 :             ErrorsFound = true;
    3946             :         }
    3947             : 
    3948           1 :         setpointManager.SpAtLowRef = rNumericArgs(1);
    3949           1 :         setpointManager.SpAtHighRef = rNumericArgs(2);
    3950           1 :         setpointManager.LowRef = rNumericArgs(3);
    3951           1 :         setpointManager.HighRef = rNumericArgs(4);
    3952             : 
    3953           1 :         setpointManager.RefNodeNum = GetOnlySingleNode(state,
    3954           1 :                                                        cAlphaArgs(3),
    3955             :                                                        ErrorsFound,
    3956             :                                                        DataLoopNode::ConnectionObjectType::SetpointManagerSystemNodeResetHumidity,
    3957           1 :                                                        cAlphaArgs(1),
    3958             :                                                        DataLoopNode::NodeFluidType::Blank,
    3959             :                                                        DataLoopNode::ConnectionType::Sensor,
    3960             :                                                        NodeInputManager::CompFluidStream::Primary,
    3961           1 :                                                        ObjectIsNotParent);
    3962             : 
    3963           1 :         setpointManager.CtrlNodeListName = cAlphaArgs(4);
    3964           1 :         if (setpointManager.HighRef < setpointManager.LowRef) {
    3965           0 :             ShowWarningError(state, format("{}: {}=\"{}\", invalid field.", RoutineName, cCurrentModuleObject, cAlphaArgs(1)));
    3966           0 :             ShowContinueError(state,
    3967           0 :                               format("...{}=[{:.1R}] is less than {}=[{:.1R}].",
    3968             :                                      cNumericFieldNames(3),
    3969             :                                      setpointManager.LowRef,
    3970             :                                      cNumericFieldNames(4),
    3971           0 :                                      setpointManager.HighRef));
    3972             :         }
    3973             : 
    3974           1 :         NodeListError = false;
    3975             : 
    3976           2 :         GetNodeNums(state,
    3977             :                     setpointManager.CtrlNodeListName,
    3978             :                     NumNodes,
    3979             :                     NodeNums,
    3980             :                     NodeListError,
    3981             :                     DataLoopNode::NodeFluidType::Blank,
    3982             :                     DataLoopNode::ConnectionObjectType::SetpointManagerSystemNodeResetHumidity,
    3983           1 :                     cAlphaArgs(1),
    3984             :                     DataLoopNode::ConnectionType::SetPoint,
    3985             :                     NodeInputManager::CompFluidStream::Primary,
    3986             :                     ObjectIsNotParent,
    3987             :                     false,
    3988           1 :                     cAlphaFieldNames(4));
    3989             : 
    3990           1 :         if (!NodeListError) {
    3991           1 :             NumNodesCtrld = NumNodes;
    3992           1 :             setpointManager.CtrlNodes.allocate(NumNodesCtrld);
    3993           1 :             setpointManager.NumCtrlNodes = NumNodesCtrld;
    3994           1 :             setpointManager.SetPt = 0.0;
    3995             : 
    3996           2 :             for (CtrldNodeNum = 1; CtrldNodeNum <= NumNodesCtrld; ++CtrldNodeNum) {
    3997           1 :                 setpointManager.CtrlNodes(CtrldNodeNum) = NodeNums(CtrldNodeNum);
    3998             :             }
    3999             :         } else {
    4000           0 :             ErrorsFound = true;
    4001             :         }
    4002             : 
    4003           3 :         AllSetPtMgrNum = SetPtMgrNum + state.dataSetPointManager->NumSchSetPtMgrs + state.dataSetPointManager->NumDualSchSetPtMgrs +
    4004           3 :                          state.dataSetPointManager->NumOutAirSetPtMgrs + state.dataSetPointManager->NumSZRhSetPtMgrs +
    4005           3 :                          state.dataSetPointManager->NumSZHtSetPtMgrs + state.dataSetPointManager->NumSZClSetPtMgrs +
    4006           3 :                          state.dataSetPointManager->NumSZMinHumSetPtMgrs + state.dataSetPointManager->NumSZMaxHumSetPtMgrs +
    4007           3 :                          state.dataSetPointManager->NumMixedAirSetPtMgrs + state.dataSetPointManager->NumOAPretreatSetPtMgrs +
    4008           3 :                          state.dataSetPointManager->NumWarmestSetPtMgrs + state.dataSetPointManager->NumColdestSetPtMgrs +
    4009           3 :                          state.dataSetPointManager->NumWarmestSetPtMgrsTempFlow + state.dataSetPointManager->NumRABFlowSetPtMgrs +
    4010           3 :                          state.dataSetPointManager->NumMZClgAverageSetPtMgrs + state.dataSetPointManager->NumMZHtgAverageSetPtMgrs +
    4011           3 :                          state.dataSetPointManager->NumMZAverageMinHumSetPtMgrs + state.dataSetPointManager->NumMZAverageMaxHumSetPtMgrs +
    4012           3 :                          state.dataSetPointManager->NumMZMinHumSetPtMgrs + state.dataSetPointManager->NumMZMaxHumSetPtMgrs +
    4013           3 :                          state.dataSetPointManager->NumFollowOATempSetPtMgrs + state.dataSetPointManager->NumFollowSysNodeTempSetPtMgrs +
    4014           3 :                          state.dataSetPointManager->NumGroundTempSetPtMgrs + state.dataSetPointManager->NumCondEntSetPtMgrs +
    4015           3 :                          state.dataSetPointManager->NumIdealCondEntSetPtMgrs + state.dataSetPointManager->NumSZOneStageCoolingSetPtMgrs +
    4016           3 :                          state.dataSetPointManager->NumSZOneStageHeatingSetPtMgrs + state.dataSetPointManager->NumReturnWaterResetChWSetPtMgrs +
    4017           2 :                          state.dataSetPointManager->NumReturnWaterResetHWSetPtMgrs + state.dataSetPointManager->NumSystemNodeResetTempSetPtMgrs;
    4018             : 
    4019           1 :         if (!NodeListError) {
    4020           1 :             state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlNodes.allocate(NumNodesCtrld);
    4021           2 :             state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlNodes =
    4022           2 :                 state.dataSetPointManager->SystemNodeResetSetPtMgr(SetPtRstMgrNum).CtrlNodes;
    4023             :         }
    4024           1 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).Name = state.dataSetPointManager->SystemNodeResetSetPtMgr(SetPtMgrNum).Name;
    4025           1 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).SPMType = SetPointManagerType::SystemNodeResetHum;
    4026           1 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).SPMIndex = SetPtMgrNum;
    4027           1 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).CtrlTypeMode =
    4028           1 :             state.dataSetPointManager->SystemNodeResetSetPtMgr(SetPtRstMgrNum).CtrlTypeMode;
    4029           1 :         state.dataSetPointManager->AllSetPtMgr(AllSetPtMgrNum).NumCtrlNodes =
    4030           1 :             state.dataSetPointManager->SystemNodeResetSetPtMgr(SetPtRstMgrNum).NumCtrlNodes;
    4031             :     }
    4032             : 
    4033         775 :     cAlphaFieldNames.deallocate();
    4034         775 :     cAlphaArgs.deallocate();
    4035         775 :     lAlphaFieldBlanks.deallocate();
    4036         775 :     cNumericFieldNames.deallocate();
    4037         775 :     rNumericArgs.deallocate();
    4038         775 :     lNumericFieldBlanks.deallocate();
    4039         775 : }
    4040             : 
    4041         771 : void VerifySetPointManagers(EnergyPlusData &state, [[maybe_unused]] bool &ErrorsFound) // flag to denote node conflicts in input. !unused1208
    4042             : {
    4043             : 
    4044             :     // SUBROUTINE INFORMATION:
    4045             :     //       AUTHOR         Richard Raustad, FSEC
    4046             :     //       DATE WRITTEN   July 2008
    4047             :     //       MODIFIED       Rick Strand, Aug 2014 (removed deallocation of AllSetPtMgrs so ScheduledTES could also verify control nodes)
    4048             :     //       RE-ENGINEERED  na
    4049             : 
    4050             :     // PURPOSE OF THIS SUBROUTINE
    4051             :     // Check the SetPointManager data to eliminate conflicts.
    4052             : 
    4053             :     // METHODOLOGY EMPLOYED:
    4054             :     // 1) Check for duplicate names in individual setpoint managers.
    4055             :     // Control nodes = A B C D
    4056             :     // Check A with B, C, and D
    4057             :     // Check B with C and D
    4058             :     // Check C with D
    4059             :     // 2) Check for duplicate names in all other setpoint managers
    4060             :     //    Verify setpoint managers use same control type (e.g. TEMP) and then check for duplicate nodes
    4061             :     // SPM 1 - Control nodes A - D, SPM 2 - Control nodes E - H, SPM 3 - Control nodes I - L
    4062             :     // If SPM 1 has same control type as SPM 2 and SPM 3 (e.g. all use SPM%CtrlTypeMode = CtrlVarType::Temp) then:
    4063             :     // Check A with E-H and I-L
    4064             :     // Check B with E-H and I-L
    4065             :     // Check C with E-H and I-L
    4066             :     // Check D with E-H and I-L
    4067             :     // Then check SPM 2 nodes with SPM 3. Check E with I-L, F with I-L, etc.
    4068             :     // 3) For SET POINT MANAGER:RETURN AIR BYPASS FLOW
    4069             :     //    check for duplicate air loop names.
    4070             : 
    4071             :     // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    4072             : 
    4073             :     int SetPtMgrNum;      // Setpoint Manager index
    4074             :     int TempSetPtMgrNum;  // Setpoint Manager index for warning messages
    4075             :     int CtrldNodeNum;     // index of the items in the controlled node node list
    4076             :     int TempCtrldNodeNum; // index of the items in the controlled node node list, used for warning messages
    4077             : 
    4078        5282 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumAllSetPtMgrs; ++SetPtMgrNum) {
    4079             : 
    4080             :         // check for duplicate nodes in each setpoint managers control node list (node lists of size 1 do not need verification)
    4081             :         // issue warning only since duplicate node names within a setpoint manager does not cause a conflict (i.e., same
    4082             :         // value written to node) but may indicate an error in the node name.
    4083        4902 :         for (CtrldNodeNum = 1; CtrldNodeNum <= state.dataSetPointManager->AllSetPtMgr(SetPtMgrNum).NumCtrlNodes - 1; ++CtrldNodeNum) {
    4084         945 :             for (TempCtrldNodeNum = CtrldNodeNum + 1; TempCtrldNodeNum <= state.dataSetPointManager->AllSetPtMgr(SetPtMgrNum).NumCtrlNodes;
    4085             :                  ++TempCtrldNodeNum) {
    4086        1108 :                 if (state.dataSetPointManager->AllSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum) !=
    4087         554 :                     state.dataSetPointManager->AllSetPtMgr(SetPtMgrNum).CtrlNodes(TempCtrldNodeNum))
    4088         554 :                     continue;
    4089           0 :                 ShowWarningError(state,
    4090           0 :                                  format("{} =\"{}\"",
    4091           0 :                                         managerTypeName[static_cast<int>(state.dataSetPointManager->AllSetPtMgr(SetPtMgrNum).SPMType)],
    4092           0 :                                         state.dataSetPointManager->AllSetPtMgr(SetPtMgrNum).Name));
    4093           0 :                 ShowContinueError(state,
    4094           0 :                                   format("...duplicate node specified = {}",
    4095           0 :                                          state.dataLoopNodes->NodeID(state.dataSetPointManager->AllSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum))));
    4096           0 :                 ShowContinueError(state,
    4097           0 :                                   format("...control type variable    = {}",
    4098           0 :                                          controlTypeName[static_cast<int>(state.dataSetPointManager->AllSetPtMgr(SetPtMgrNum).CtrlTypeMode)]));
    4099             :             }
    4100             :         }
    4101             : 
    4102             :         // check for node conflicts in all other setpoint managers
    4103       43855 :         for (TempSetPtMgrNum = SetPtMgrNum + 1; TempSetPtMgrNum <= state.dataSetPointManager->NumAllSetPtMgrs; ++TempSetPtMgrNum) {
    4104             : 
    4105       39345 :             if ((state.dataSetPointManager->AllSetPtMgr(SetPtMgrNum).SPMType == SetPointManagerType::RAB &&
    4106           1 :                  state.dataSetPointManager->AllSetPtMgr(TempSetPtMgrNum).SPMType == SetPointManagerType::RAB)) {
    4107             : 
    4108             :                 //     check the air loop name for duplicates in this SP manager type
    4109           0 :                 if (state.dataSetPointManager->AllSetPtMgr(SetPtMgrNum).AirLoopNum ==
    4110           0 :                     state.dataSetPointManager->AllSetPtMgr(TempSetPtMgrNum).AirLoopNum) {
    4111           0 :                     ShowWarningError(state,
    4112           0 :                                      format("{}=\"{}\"",
    4113           0 :                                             managerTypeName[static_cast<int>(state.dataSetPointManager->AllSetPtMgr(SetPtMgrNum).SPMType)],
    4114           0 :                                             state.dataSetPointManager->AllSetPtMgr(SetPtMgrNum).Name));
    4115           0 :                     ShowContinueError(state, "...air loop name conflicts with another setpoint manager.");
    4116           0 :                     ShowContinueError(state,
    4117           0 :                                       format("...conflicting setpoint manager = {} \"{}\"",
    4118           0 :                                              managerTypeName[static_cast<int>(state.dataSetPointManager->AllSetPtMgr(TempSetPtMgrNum).SPMType)],
    4119           0 :                                              state.dataSetPointManager->AllSetPtMgr(TempSetPtMgrNum).Name));
    4120           0 :                     ShowContinueError(state, "...conflicting air loop name = " + state.dataSetPointManager->AllSetPtMgr(SetPtMgrNum).AirLoopName);
    4121             :                     //        ErrorsFound=.TRUE.
    4122             :                 }
    4123             : 
    4124             :                 //     check for duplicate control nodes
    4125           0 :                 if (state.dataSetPointManager->AllSetPtMgr(SetPtMgrNum).CtrlTypeMode !=
    4126           0 :                     state.dataSetPointManager->AllSetPtMgr(TempSetPtMgrNum).CtrlTypeMode)
    4127           0 :                     continue;
    4128             : 
    4129           0 :                 for (CtrldNodeNum = 1; CtrldNodeNum <= state.dataSetPointManager->AllSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrldNodeNum) {
    4130           0 :                     for (TempCtrldNodeNum = 1; TempCtrldNodeNum <= state.dataSetPointManager->AllSetPtMgr(TempSetPtMgrNum).NumCtrlNodes;
    4131             :                          ++TempCtrldNodeNum) {
    4132           0 :                         if ((state.dataSetPointManager->AllSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum) ==
    4133           0 :                              state.dataSetPointManager->AllSetPtMgr(TempSetPtMgrNum).CtrlNodes(TempCtrldNodeNum)) &&
    4134           0 :                             state.dataSetPointManager->AllSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum) != 0) {
    4135           0 :                             ShowWarningError(state,
    4136           0 :                                              format("{}=\"{}\"",
    4137           0 :                                                     managerTypeName[static_cast<int>(state.dataSetPointManager->AllSetPtMgr(SetPtMgrNum).SPMType)],
    4138           0 :                                                     state.dataSetPointManager->AllSetPtMgr(SetPtMgrNum).Name));
    4139           0 :                             ShowContinueError(state, "...setpoint node conflicts with another setpoint manager.");
    4140           0 :                             ShowContinueError(
    4141             :                                 state,
    4142           0 :                                 format("...conflicting setpoint manager = {} \"{}\"",
    4143           0 :                                        managerTypeName[static_cast<int>(state.dataSetPointManager->AllSetPtMgr(TempSetPtMgrNum).SPMType)],
    4144           0 :                                        state.dataSetPointManager->AllSetPtMgr(TempSetPtMgrNum).Name));
    4145           0 :                             ShowContinueError(
    4146             :                                 state,
    4147           0 :                                 "...conflicting node name = " +
    4148           0 :                                     state.dataLoopNodes->NodeID(state.dataSetPointManager->AllSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum)));
    4149           0 :                             ShowContinueError(
    4150             :                                 state,
    4151           0 :                                 format("...control type variable = {}",
    4152           0 :                                        controlTypeName[static_cast<int>(state.dataSetPointManager->AllSetPtMgr(SetPtMgrNum).CtrlTypeMode)]));
    4153             :                             //            ErrorsFound=.TRUE.
    4154             :                         }
    4155             :                     }
    4156             :                 }
    4157             : 
    4158             :             } else { // not a RAB setpoint manager
    4159             : 
    4160             :                 //     check just the control nodes for other types of SP managers
    4161       78688 :                 if (state.dataSetPointManager->AllSetPtMgr(SetPtMgrNum).CtrlTypeMode !=
    4162       39344 :                     state.dataSetPointManager->AllSetPtMgr(TempSetPtMgrNum).CtrlTypeMode)
    4163        2925 :                     continue;
    4164             : 
    4165       73341 :                 for (CtrldNodeNum = 1; CtrldNodeNum <= state.dataSetPointManager->AllSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrldNodeNum) {
    4166       75543 :                     for (TempCtrldNodeNum = 1; TempCtrldNodeNum <= state.dataSetPointManager->AllSetPtMgr(TempSetPtMgrNum).NumCtrlNodes;
    4167             :                          ++TempCtrldNodeNum) {
    4168             : 
    4169       77242 :                         if (state.dataSetPointManager->AllSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum) !=
    4170       38621 :                             state.dataSetPointManager->AllSetPtMgr(TempSetPtMgrNum).CtrlNodes(TempCtrldNodeNum))
    4171       38620 :                             continue;
    4172             : 
    4173             :                         //         only warn if scheduled setpoint manager is setting mass flow rate on the same node used by RAB
    4174           2 :                         if (state.dataSetPointManager->AllSetPtMgr(SetPtMgrNum).SPMType == SetPointManagerType::RAB ||
    4175           1 :                             state.dataSetPointManager->AllSetPtMgr(TempSetPtMgrNum).SPMType == SetPointManagerType::RAB) {
    4176           0 :                             ShowWarningError(state,
    4177           0 :                                              format("{}=\"{}\"",
    4178           0 :                                                     managerTypeName[static_cast<int>(state.dataSetPointManager->AllSetPtMgr(SetPtMgrNum).SPMType)],
    4179           0 :                                                     state.dataSetPointManager->AllSetPtMgr(SetPtMgrNum).Name));
    4180           0 :                             ShowContinueError(state, "...setpoint node conflicts with another setpoint manager.");
    4181           0 :                             ShowContinueError(
    4182             :                                 state,
    4183           0 :                                 format("...conflicting setpoint manager ={}:\"{}\"",
    4184           0 :                                        managerTypeName[static_cast<int>(state.dataSetPointManager->AllSetPtMgr(TempSetPtMgrNum).SPMType)],
    4185           0 :                                        state.dataSetPointManager->AllSetPtMgr(TempSetPtMgrNum).Name));
    4186           0 :                             ShowContinueError(
    4187             :                                 state,
    4188           0 :                                 "...conflicting node name = " +
    4189           0 :                                     state.dataLoopNodes->NodeID(state.dataSetPointManager->AllSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum)));
    4190           0 :                             ShowContinueError(
    4191             :                                 state,
    4192           0 :                                 format("...control type variable = {}",
    4193           0 :                                        controlTypeName[static_cast<int>(state.dataSetPointManager->AllSetPtMgr(SetPtMgrNum).CtrlTypeMode)]));
    4194           0 :                             ShowContinueError(state,
    4195             :                                               "...return air bypass flow setpoint manager will have priority setting mass flow rate on this node.");
    4196             :                         } else { // severe error for other SP manager types
    4197           3 :                             ShowWarningError(state,
    4198           3 :                                              format("{}=\"{}\"",
    4199           1 :                                                     managerTypeName[static_cast<int>(state.dataSetPointManager->AllSetPtMgr(SetPtMgrNum).SPMType)],
    4200           2 :                                                     state.dataSetPointManager->AllSetPtMgr(SetPtMgrNum).Name));
    4201           1 :                             ShowContinueError(state, "...setpoint node conflicts with another setpoint manager.");
    4202           3 :                             ShowContinueError(
    4203             :                                 state,
    4204           3 :                                 format("...conflicting setpoint manager = {}:\"{}\"",
    4205           1 :                                        managerTypeName[static_cast<int>(state.dataSetPointManager->AllSetPtMgr(TempSetPtMgrNum).SPMType)],
    4206           2 :                                        state.dataSetPointManager->AllSetPtMgr(TempSetPtMgrNum).Name));
    4207           3 :                             ShowContinueError(
    4208             :                                 state,
    4209           2 :                                 "...conflicting node name = " +
    4210           1 :                                     state.dataLoopNodes->NodeID(state.dataSetPointManager->AllSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum)));
    4211           3 :                             ShowContinueError(
    4212             :                                 state,
    4213           2 :                                 format("...control type variable = {}",
    4214           1 :                                        controlTypeName[static_cast<int>(state.dataSetPointManager->AllSetPtMgr(SetPtMgrNum).CtrlTypeMode)]));
    4215             :                             //            ErrorsFound=.TRUE.
    4216             :                         }
    4217             :                     }
    4218             :                 }
    4219             :             }
    4220             : 
    4221             :         } // DO TempSetPtMgrNum = SetPtMgrNum+1, AllSetPtMgrs
    4222             : 
    4223             :     } // DO SetPtMgrNum = 1, AllSetPtMgrs
    4224             : 
    4225             :     // Removed the following line for ScheduledTES control implementation
    4226             :     // if ( allocated( AllSetPtMgr ) ) AllSetPtMgr.deallocate();
    4227         771 : }
    4228             : 
    4229     2639643 : void InitSetPointManagers(EnergyPlusData &state)
    4230             : {
    4231             : 
    4232             :     // SUBROUTINE INFORMATION:
    4233             :     //       AUTHOR         Fred Buhl
    4234             :     //       DATE WRITTEN   October 2000
    4235             :     //       MODIFIED       Shirey/Raustad (FSEC), Jan 2004
    4236             :     //                      Nov 2004 - Jan 2005 M. J. Witte, GARD Analytics, Inc.
    4237             :     //                        Add new setpoint managers:
    4238             :     //                          SET POINT MANAGER:SINGLE ZONE HEATING and
    4239             :     //                          SET POINT MANAGER:SINGLE ZONE COOLING
    4240             :     //                          SET POINT MANAGER:OUTSIDE AIR PRETREAT
    4241             :     //                        Work supported by ASHRAE research project 1254-RP
    4242             :     //                      Haves Oct 2004
    4243             :     //                      July 2010 B.A. Nigusse, FSEC/UCF
    4244             :     //                        Added new setpoint managers:
    4245             :     //                          SetpointManager:MultiZone:Heating:Average
    4246             :     //                          SetpointManager:MultiZone:Cooling:Average
    4247             :     //                          SetpointManager:MultiZone:MinimumHumidity:Average
    4248             :     //                          SetpointManager:MultiZone:MaximumHumidity:Average
    4249             :     //                      Aug 2010 B.A. Nigusse, FSEC/UCF
    4250             :     //                        Added new setpoint managers:
    4251             :     //                          SetpointManager:MultiZone:Humidity:Minimum
    4252             :     //                          SetpointManager:MultiZone:Humidity:Maximum
    4253             :     //                      Sep 2010 B.A. Nigusse, FSEC/UCF
    4254             :     //                         Added control varibles for SetpointManage:Scheduled
    4255             :     //                      Jan 2022 Wooyoung Jung, Jeremy Lerond and Jian Zhang, PNNL
    4256             :     //                         Added new setpoint managers:
    4257             :     //                          SetpointManager:SystemNodeReset:Temperature
    4258             :     //                          SetpointManager:SystemNodeReset:Humidity
    4259             :     //
    4260             :     //       RE-ENGINEERED  na
    4261             : 
    4262             :     // PURPOSE OF THIS SUBROUTINE:
    4263             :     // This subroutine is for initializations of the Setpoint Manager objects.
    4264             : 
    4265             :     // METHODOLOGY EMPLOYED:
    4266             :     // Uses the status flags to trigger initializations.
    4267             : 
    4268             :     // Using/Aliasing
    4269             :     using namespace DataPlant;
    4270             :     using OutAirNodeManager::CheckOutAirNodeNumber;
    4271             : 
    4272             :     // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    4273             : 
    4274             :     int SetZoneNum;
    4275             :     int ControlledZoneNum;
    4276             :     int ZoneNode;
    4277             :     int ZoneInletNode;
    4278             :     int SetPtMgrNum;
    4279             :     int ZoneIndex;
    4280             :     int CtrlNodeIndex;
    4281             :     int NodeNum;
    4282             :     int AirLoopNum;
    4283             :     int LoopNum;
    4284             :     int LoopNum2;
    4285     2639643 :     bool ErrorsFound(false);
    4286             :     int ConZoneNum;
    4287             :     int MixedAirNode;
    4288             :     int BranchNum;
    4289             :     int BranchNum2;
    4290             :     int InletBranchNum;
    4291             :     int CompNum;
    4292             :     int CompNum2;
    4293     5279286 :     std::string CompType;
    4294     5279286 :     std::string cSetPointManagerType;
    4295             :     int FanNodeIn;
    4296             :     int FanNodeOut;
    4297             :     int LoopInNode;
    4298             :     int HStatZoneNum;
    4299             :     bool HstatZoneFound;
    4300             :     int ZonesCooledIndex; // Cooled zones index in an air loop
    4301             :     int BranchNumPlantSide;
    4302             :     int CompNumPlantSide;
    4303             : 
    4304     2639643 :     state.dataSetPointManager->ManagerOn = true;
    4305             : 
    4306             :     // One time initializations
    4307             : 
    4308     5279044 :     if (state.dataZoneEquip->ZoneEquipInputsFilled &&
    4309     2639401 :         state.dataAirLoop->AirLoopInputsFilled) { // check that the zone equipment and air loop data has been read in
    4310             : 
    4311     2638103 :         if (state.dataSetPointManager->InitSetPointManagersOneTimeFlag) {
    4312             : 
    4313             :             // "SetpointManager:SingleZone:Heating"
    4314         769 :             cSetPointManagerType = managerTypeName[static_cast<int>(SetPointManagerType::SZHeating)];
    4315         856 :             for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumSZHtSetPtMgrs; ++SetPtMgrNum) {
    4316          87 :                 ZoneInletNode = state.dataSetPointManager->SingZoneHtSetPtMgr(SetPtMgrNum).ZoneInletNodeNum;
    4317          87 :                 ZoneNode = state.dataSetPointManager->SingZoneHtSetPtMgr(SetPtMgrNum).ZoneNodeNum;
    4318             :                 // find the index in the ZoneEquipConfig array of the control zone (the one with the main or only thermostat)
    4319          87 :                 ConZoneNum = 0;
    4320        2017 :                 for (ControlledZoneNum = 1; ControlledZoneNum <= state.dataGlobal->NumOfZones; ++ControlledZoneNum) {
    4321        1930 :                     if (state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum).ZoneNode == ZoneNode) {
    4322          87 :                         ConZoneNum = ControlledZoneNum;
    4323             :                     }
    4324             :                 }
    4325          87 :                 if (ConZoneNum == 0) {
    4326           0 :                     ShowSevereError(state,
    4327           0 :                                     cSetPointManagerType + "=\"" + state.dataSetPointManager->SingZoneHtSetPtMgr(SetPtMgrNum).Name +
    4328             :                                         "\", Zone Node not found:");
    4329           0 :                     ShowContinueError(state,
    4330           0 :                                       "Node=\"" +
    4331           0 :                                           state.dataLoopNodes->NodeID(state.dataSetPointManager->SingZoneHtSetPtMgr(SetPtMgrNum).ZoneNodeNum) +
    4332             :                                           "\", not found in any controlled Zone");
    4333           0 :                     ErrorsFound = true;
    4334             :                 } else {
    4335          87 :                     bool found = false;
    4336         197 :                     for (int zoneInNode = 1; zoneInNode <= state.dataZoneEquip->ZoneEquipConfig(ConZoneNum).NumInletNodes; ++zoneInNode) {
    4337         220 :                         if (state.dataSetPointManager->SingZoneHtSetPtMgr(SetPtMgrNum).ZoneInletNodeNum ==
    4338         110 :                             state.dataZoneEquip->ZoneEquipConfig(ConZoneNum).InletNode(zoneInNode)) {
    4339          87 :                             found = true;
    4340             :                         }
    4341             :                     }
    4342          87 :                     if (!found) {
    4343           0 :                         ShowSevereError(state,
    4344           0 :                                         cSetPointManagerType + "=\"" + state.dataSetPointManager->SingZoneHtSetPtMgr(SetPtMgrNum).Name +
    4345           0 :                                             "\", The zone inlet node of " +
    4346           0 :                                             state.dataLoopNodes->NodeID(state.dataSetPointManager->SingZoneHtSetPtMgr(SetPtMgrNum).ZoneInletNodeNum));
    4347           0 :                         ShowContinueError(
    4348           0 :                             state, "is not found in Zone = " + state.dataZoneEquip->ZoneEquipConfig(ConZoneNum).ZoneName + ". Please check inputs.");
    4349           0 :                         ErrorsFound = true;
    4350             :                     }
    4351             :                 }
    4352             :             }
    4353             : 
    4354             :             // "SetpointManager:SingleZone:Cooling"
    4355         769 :             cSetPointManagerType = managerTypeName[static_cast<int>(SetPointManagerType::SZCooling)];
    4356         971 :             for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumSZClSetPtMgrs; ++SetPtMgrNum) {
    4357         202 :                 ZoneInletNode = state.dataSetPointManager->SingZoneClSetPtMgr(SetPtMgrNum).ZoneInletNodeNum;
    4358         202 :                 ZoneNode = state.dataSetPointManager->SingZoneClSetPtMgr(SetPtMgrNum).ZoneNodeNum;
    4359             :                 // find the index in the ZoneEquipConfig array of the control zone (the one with the main or only thermostat)
    4360         202 :                 ConZoneNum = 0;
    4361        2866 :                 for (ControlledZoneNum = 1; ControlledZoneNum <= state.dataGlobal->NumOfZones; ++ControlledZoneNum) {
    4362        2664 :                     if (state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum).ZoneNode == ZoneNode) {
    4363         202 :                         ConZoneNum = ControlledZoneNum;
    4364             :                     }
    4365             :                 }
    4366         202 :                 if (ConZoneNum == 0) {
    4367           0 :                     ShowSevereError(state,
    4368           0 :                                     cSetPointManagerType + "=\"" + state.dataSetPointManager->SingZoneClSetPtMgr(SetPtMgrNum).Name +
    4369             :                                         "\", Zone Node not found:");
    4370           0 :                     ShowContinueError(state,
    4371           0 :                                       "Node=\"" +
    4372           0 :                                           state.dataLoopNodes->NodeID(state.dataSetPointManager->SingZoneClSetPtMgr(SetPtMgrNum).ZoneNodeNum) +
    4373             :                                           "\", not found in any controlled Zone");
    4374           0 :                     ErrorsFound = true;
    4375             :                 } else {
    4376         202 :                     bool found = false;
    4377         427 :                     for (int zoneInNode = 1; zoneInNode <= state.dataZoneEquip->ZoneEquipConfig(ConZoneNum).NumInletNodes; ++zoneInNode) {
    4378         450 :                         if (state.dataSetPointManager->SingZoneClSetPtMgr(SetPtMgrNum).ZoneInletNodeNum ==
    4379         225 :                             state.dataZoneEquip->ZoneEquipConfig(ConZoneNum).InletNode(zoneInNode)) {
    4380         202 :                             found = true;
    4381             :                         }
    4382             :                     }
    4383         202 :                     if (!found) {
    4384           0 :                         ShowSevereError(state,
    4385           0 :                                         cSetPointManagerType + "=\"" + state.dataSetPointManager->SingZoneClSetPtMgr(SetPtMgrNum).Name +
    4386           0 :                                             "\", The zone inlet node of " +
    4387           0 :                                             state.dataLoopNodes->NodeID(state.dataSetPointManager->SingZoneClSetPtMgr(SetPtMgrNum).ZoneInletNodeNum));
    4388           0 :                         ShowContinueError(
    4389           0 :                             state, "is not found in Zone = " + state.dataZoneEquip->ZoneEquipConfig(ConZoneNum).ZoneName + ". Please check inputs.");
    4390           0 :                         ErrorsFound = true;
    4391             :                     }
    4392             :                 }
    4393             :             }
    4394             : 
    4395             :             // Minimum humidity setpoint managers
    4396         769 :             cSetPointManagerType = managerTypeName[static_cast<int>(SetPointManagerType::SZMinHum)];
    4397         795 :             for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumSZMinHumSetPtMgrs; ++SetPtMgrNum) {
    4398          52 :                 for (SetZoneNum = 1; SetZoneNum <= state.dataSetPointManager->SZMinHumSetPtMgr(SetPtMgrNum).NumZones; ++SetZoneNum) {
    4399             :                     // set the actual and controlled zone numbers
    4400         882 :                     for (ControlledZoneNum = 1; ControlledZoneNum <= state.dataGlobal->NumOfZones; ++ControlledZoneNum) {
    4401        1764 :                         if (state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum).ZoneNode ==
    4402         882 :                             state.dataSetPointManager->SZMinHumSetPtMgr(SetPtMgrNum).ZoneNodes(SetZoneNum)) {
    4403          26 :                             state.dataSetPointManager->SZMinHumSetPtMgr(SetPtMgrNum).CtrlZoneNum(SetZoneNum) = ControlledZoneNum;
    4404          26 :                             break;
    4405             :                         }
    4406             :                     }
    4407             :                     // still need to validate...
    4408          26 :                     if (state.dataSetPointManager->SZMinHumSetPtMgr(SetPtMgrNum).CtrlZoneNum(SetZoneNum) == 0) { // didn't find
    4409           0 :                         ShowSevereError(
    4410           0 :                             state, cSetPointManagerType + "=\"" + state.dataSetPointManager->SZMinHumSetPtMgr(SetPtMgrNum).Name + "\", invalid zone");
    4411           0 :                         ShowContinueError(
    4412             :                             state,
    4413           0 :                             "could not find Controlled Zone=" +
    4414           0 :                                 state.dataHeatBal->Zone(state.dataSetPointManager->SZMinHumSetPtMgr(SetPtMgrNum).CtrlZoneNum(SetZoneNum)).Name);
    4415           0 :                         ErrorsFound = true;
    4416             :                     } else {
    4417             :                         // make sure humidity controlled zone
    4418          26 :                         HstatZoneFound = false;
    4419          47 :                         for (HStatZoneNum = 1; HStatZoneNum <= state.dataZoneCtrls->NumHumidityControlZones; ++HStatZoneNum) {
    4420          94 :                             if (state.dataZoneCtrls->HumidityControlZone(HStatZoneNum).ActualZoneNum !=
    4421          47 :                                 state.dataSetPointManager->SZMinHumSetPtMgr(SetPtMgrNum).CtrlZoneNum(SetZoneNum))
    4422          21 :                                 continue;
    4423          26 :                             HstatZoneFound = true;
    4424          26 :                             break;
    4425             :                         }
    4426          26 :                         if (!HstatZoneFound) {
    4427           0 :                             ShowSevereError(state,
    4428           0 :                                             cSetPointManagerType + "=\"" + state.dataSetPointManager->SZMinHumSetPtMgr(SetPtMgrNum).Name +
    4429             :                                                 "\", invalid humidistat specification");
    4430           0 :                             ShowContinueError(
    4431             :                                 state,
    4432           0 :                                 "could not locate Humidistat in Zone=" +
    4433           0 :                                     state.dataHeatBal->Zone(state.dataSetPointManager->SZMinHumSetPtMgr(SetPtMgrNum).CtrlZoneNum(SetZoneNum)).Name);
    4434           0 :                             ErrorsFound = true;
    4435             :                         }
    4436             :                     }
    4437             :                 }
    4438             :             }
    4439             : 
    4440             :             // Maximum humidity setpoint managers
    4441         769 :             cSetPointManagerType = managerTypeName[static_cast<int>(SetPointManagerType::SZMaxHum)];
    4442         813 :             for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumSZMaxHumSetPtMgrs; ++SetPtMgrNum) {
    4443          88 :                 for (SetZoneNum = 1; SetZoneNum <= state.dataSetPointManager->SZMaxHumSetPtMgr(SetPtMgrNum).NumZones; ++SetZoneNum) {
    4444             :                     // set the actual and controlled zone numbers
    4445        1488 :                     for (ControlledZoneNum = 1; ControlledZoneNum <= state.dataGlobal->NumOfZones; ++ControlledZoneNum) {
    4446        2976 :                         if (state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum).ZoneNode ==
    4447        1488 :                             state.dataSetPointManager->SZMaxHumSetPtMgr(SetPtMgrNum).ZoneNodes(SetZoneNum)) {
    4448          44 :                             state.dataSetPointManager->SZMaxHumSetPtMgr(SetPtMgrNum).CtrlZoneNum(SetZoneNum) = ControlledZoneNum;
    4449          44 :                             break;
    4450             :                         }
    4451             :                     }
    4452             :                     // still need to validate...
    4453          44 :                     if (state.dataSetPointManager->SZMaxHumSetPtMgr(SetPtMgrNum).CtrlZoneNum(SetZoneNum) == 0) { // didn't find
    4454           0 :                         ShowSevereError(
    4455           0 :                             state, cSetPointManagerType + "=\"" + state.dataSetPointManager->SZMaxHumSetPtMgr(SetPtMgrNum).Name + "\", invalid zone");
    4456           0 :                         ShowContinueError(
    4457             :                             state,
    4458           0 :                             "could not find Controlled Zone=" +
    4459           0 :                                 state.dataHeatBal->Zone(state.dataSetPointManager->SZMaxHumSetPtMgr(SetPtMgrNum).CtrlZoneNum(SetZoneNum)).Name);
    4460           0 :                         ErrorsFound = true;
    4461             :                     } else {
    4462             :                         // make sure humidity controlled zone
    4463          44 :                         HstatZoneFound = false;
    4464          87 :                         for (HStatZoneNum = 1; HStatZoneNum <= state.dataZoneCtrls->NumHumidityControlZones; ++HStatZoneNum) {
    4465         174 :                             if (state.dataZoneCtrls->HumidityControlZone(HStatZoneNum).ActualZoneNum !=
    4466          87 :                                 state.dataSetPointManager->SZMaxHumSetPtMgr(SetPtMgrNum).CtrlZoneNum(SetZoneNum))
    4467          43 :                                 continue;
    4468          44 :                             HstatZoneFound = true;
    4469          44 :                             break;
    4470             :                         }
    4471          44 :                         if (!HstatZoneFound) {
    4472           0 :                             ShowSevereError(state,
    4473           0 :                                             cSetPointManagerType + "=\"" + state.dataSetPointManager->SZMaxHumSetPtMgr(SetPtMgrNum).Name +
    4474             :                                                 "\", invalid humidistat specification");
    4475           0 :                             ShowContinueError(
    4476             :                                 state,
    4477           0 :                                 "could not locate Humidistat in Zone=" +
    4478           0 :                                     state.dataHeatBal->Zone(state.dataSetPointManager->SZMaxHumSetPtMgr(SetPtMgrNum).CtrlZoneNum(SetZoneNum)).Name);
    4479           0 :                             ErrorsFound = true;
    4480             :                         }
    4481             :                     }
    4482             :                 }
    4483             :             }
    4484             : 
    4485             :             // single zone reheat setpoint manager
    4486         769 :             cSetPointManagerType = managerTypeName[static_cast<int>(SetPointManagerType::SZReheat)];
    4487        1045 :             for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumSZRhSetPtMgrs; ++SetPtMgrNum) {
    4488         276 :                 FanNodeIn = 0;
    4489         276 :                 FanNodeOut = 0;
    4490         276 :                 MixedAirNode = 0;
    4491         276 :                 AirLoopNum = 0;
    4492         276 :                 InletBranchNum = 0;
    4493         276 :                 LoopInNode = 0;
    4494         276 :                 bool LookForFan = false;
    4495         276 :                 ZoneInletNode = state.dataSetPointManager->SingZoneRhSetPtMgr(SetPtMgrNum).ZoneInletNodeNum;
    4496         276 :                 ZoneNode = state.dataSetPointManager->SingZoneRhSetPtMgr(SetPtMgrNum).ZoneNodeNum;
    4497             :                 // find the index in the ZoneEquipConfig array of the control zone (the one with the main or only thermostat)
    4498         276 :                 ConZoneNum = 0;
    4499        4687 :                 for (ControlledZoneNum = 1; ControlledZoneNum <= state.dataGlobal->NumOfZones; ++ControlledZoneNum) {
    4500        4411 :                     if (state.dataZoneEquip->ZoneEquipConfig(ControlledZoneNum).ZoneNode == ZoneNode) {
    4501         276 :                         ConZoneNum = ControlledZoneNum;
    4502             :                     }
    4503             :                 }
    4504         276 :                 if (ConZoneNum == 0) {
    4505           0 :                     ShowSevereError(state,
    4506           0 :                                     cSetPointManagerType + "=\"" + state.dataSetPointManager->SingZoneRhSetPtMgr(SetPtMgrNum).Name +
    4507             :                                         "\", Zone Node not found:");
    4508           0 :                     ShowContinueError(state,
    4509           0 :                                       "Node=\"" +
    4510           0 :                                           state.dataLoopNodes->NodeID(state.dataSetPointManager->SingZoneRhSetPtMgr(SetPtMgrNum).ZoneNodeNum) +
    4511             :                                           "\", not found in any controlled Zone");
    4512           0 :                     ErrorsFound = true;
    4513             :                 } else {
    4514         276 :                     bool found = false;
    4515         556 :                     for (int zoneInNode = 1; zoneInNode <= state.dataZoneEquip->ZoneEquipConfig(ConZoneNum).NumInletNodes; ++zoneInNode) {
    4516         560 :                         if (state.dataSetPointManager->SingZoneRhSetPtMgr(SetPtMgrNum).ZoneInletNodeNum ==
    4517         280 :                             state.dataZoneEquip->ZoneEquipConfig(ConZoneNum).InletNode(zoneInNode)) {
    4518         276 :                             found = true;
    4519         276 :                             AirLoopNum = state.dataZoneEquip->ZoneEquipConfig(ConZoneNum).InletNodeAirLoopNum(zoneInNode);
    4520             :                         }
    4521             :                     }
    4522         276 :                     if (!found) {
    4523           0 :                         ShowSevereError(state,
    4524           0 :                                         cSetPointManagerType + "=\"" + state.dataSetPointManager->SingZoneRhSetPtMgr(SetPtMgrNum).Name +
    4525           0 :                                             "\", The zone inlet node of " +
    4526           0 :                                             state.dataLoopNodes->NodeID(state.dataSetPointManager->SingZoneRhSetPtMgr(SetPtMgrNum).ZoneInletNodeNum));
    4527           0 :                         ShowContinueError(
    4528           0 :                             state, "is not found in Zone = " + state.dataZoneEquip->ZoneEquipConfig(ConZoneNum).ZoneName + ". Please check inputs.");
    4529           0 :                         ErrorsFound = true;
    4530             :                     }
    4531         276 :                     if (AirLoopNum == 0) {
    4532           0 :                         ShowSevereError(state,
    4533           0 :                                         cSetPointManagerType + "=\"" + state.dataSetPointManager->SingZoneRhSetPtMgr(SetPtMgrNum).Name +
    4534             :                                             "\", The zone inlet node is not connected to an air loop.");
    4535           0 :                         ErrorsFound = true;
    4536           0 :                         continue;
    4537             :                     }
    4538         276 :                     MixedAirNode = state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).OASysOutletNodeNum;
    4539         276 :                     InletBranchNum = state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).InletBranchNum[0];
    4540         276 :                     LoopInNode = state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(InletBranchNum).NodeNumIn;
    4541             :                     // get the supply fan inlet and outlet nodes
    4542         276 :                     if (MixedAirNode > 0) {
    4543         548 :                         for (BranchNum = 1; BranchNum <= state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).NumBranches; ++BranchNum) {
    4544        1012 :                             for (CompNum = 1; CompNum <= state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).TotalComponents;
    4545             :                                  ++CompNum) {
    4546         944 :                                 CompType = state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(CompNum).TypeOf;
    4547         944 :                                 if (MixedAirNode ==
    4548         944 :                                     state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(CompNum).NodeNumIn) {
    4549         274 :                                     LookForFan = true;
    4550             :                                 }
    4551         944 :                                 if (LookForFan) {
    4552        1804 :                                     if (UtilityRoutines::SameString(CompType, "Fan:ConstantVolume") ||
    4553        1598 :                                         UtilityRoutines::SameString(CompType, "Fan:VariableVolume") ||
    4554        2268 :                                         UtilityRoutines::SameString(CompType, "Fan:OnOff") ||
    4555        1134 :                                         UtilityRoutines::SameString(CompType, "Fan:ComponentModel")) {
    4556         206 :                                         FanNodeIn = state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(CompNum).NodeNumIn;
    4557         206 :                                         FanNodeOut =
    4558         206 :                                             state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(CompNum).NodeNumOut;
    4559         206 :                                         break;
    4560             :                                     }
    4561             :                                 }
    4562             :                             }
    4563             :                         }
    4564             :                     } else {
    4565           4 :                         for (BranchNum = 1; BranchNum <= state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).NumBranches; ++BranchNum) {
    4566           8 :                             for (CompNum = 1; CompNum <= state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).TotalComponents;
    4567             :                                  ++CompNum) {
    4568           6 :                                 CompType = state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(CompNum).TypeOf;
    4569          16 :                                 if (UtilityRoutines::SameString(CompType, "Fan:ConstantVolume") ||
    4570          14 :                                     UtilityRoutines::SameString(CompType, "Fan:VariableVolume") ||
    4571          20 :                                     UtilityRoutines::SameString(CompType, "Fan:OnOff") ||
    4572          10 :                                     UtilityRoutines::SameString(CompType, "Fan:ComponentModel")) {
    4573           2 :                                     FanNodeIn = state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(CompNum).NodeNumIn;
    4574           2 :                                     FanNodeOut = state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(CompNum).NodeNumOut;
    4575             :                                 }
    4576             :                             }
    4577             :                         }
    4578             :                     }
    4579         276 :                     state.dataSetPointManager->SingZoneRhSetPtMgr(SetPtMgrNum).FanNodeIn = FanNodeIn;
    4580         276 :                     state.dataSetPointManager->SingZoneRhSetPtMgr(SetPtMgrNum).FanNodeOut = FanNodeOut;
    4581         276 :                     state.dataSetPointManager->SingZoneRhSetPtMgr(SetPtMgrNum).MixedAirNode = MixedAirNode;
    4582         276 :                     state.dataSetPointManager->SingZoneRhSetPtMgr(SetPtMgrNum).AirLoopNum = AirLoopNum;
    4583         276 :                     state.dataSetPointManager->SingZoneRhSetPtMgr(SetPtMgrNum).OAInNode =
    4584         276 :                         state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).OAMixOAInNodeNum;
    4585             :                     // this next line assumes that OA system is the first thing on the branch, what if there is a relief fan or heat recovery coil
    4586             :                     // or other component in there first? does it matter?
    4587         276 :                     state.dataSetPointManager->SingZoneRhSetPtMgr(SetPtMgrNum).RetNode =
    4588         276 :                         state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).OASysInletNodeNum;
    4589         276 :                     state.dataSetPointManager->SingZoneRhSetPtMgr(SetPtMgrNum).LoopInNode = LoopInNode;
    4590             :                 }
    4591             :             }
    4592             : 
    4593             :             // Warmest Setpoint Managers
    4594         769 :             cSetPointManagerType = managerTypeName[static_cast<int>(SetPointManagerType::Warmest)];
    4595         790 :             for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumWarmestSetPtMgrs; ++SetPtMgrNum) {
    4596          21 :                 if (state.dataHVACGlobal->NumPrimaryAirSys > 0) {
    4597          21 :                     AirLoopNum = UtilityRoutines::FindItemInList(state.dataSetPointManager->WarmestSetPtMgr(SetPtMgrNum).AirLoopName,
    4598          21 :                                                                  state.dataAirLoop->AirToZoneNodeInfo,
    4599             :                                                                  &AirLoopZoneEquipConnectData::AirLoopName);
    4600          21 :                     if (AirLoopNum == 0) {
    4601           0 :                         ShowSevereError(state,
    4602           0 :                                         cSetPointManagerType + "=\"" + state.dataSetPointManager->WarmestSetPtMgr(SetPtMgrNum).Name +
    4603             :                                             "\", invalid Air Loop specified:");
    4604           0 :                         ShowContinueError(state,
    4605           0 :                                           "Air Loop not found =\"" + state.dataSetPointManager->WarmestSetPtMgr(SetPtMgrNum).AirLoopName + "\".");
    4606           0 :                         ErrorsFound = true;
    4607             :                     } else {
    4608          21 :                         state.dataSetPointManager->WarmestSetPtMgr(SetPtMgrNum).AirLoopNum = AirLoopNum;
    4609             :                     }
    4610          21 :                     if (state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).NumZonesCooled == 0) {
    4611           0 :                         ShowSevereError(state,
    4612           0 :                                         cSetPointManagerType + "=\"" + state.dataSetPointManager->WarmestSetPtMgr(SetPtMgrNum).Name +
    4613             :                                             "\", no zones with cooling found:");
    4614           0 :                         ShowContinueError(state,
    4615           0 :                                           "Air Loop provides no cooling, Air Loop=\"" +
    4616           0 :                                               state.dataSetPointManager->WarmestSetPtMgr(SetPtMgrNum).AirLoopName + "\".");
    4617           0 :                         ErrorsFound = true;
    4618             :                     }
    4619             :                 } else {
    4620           0 :                     ShowSevereError(state,
    4621           0 :                                     cSetPointManagerType + "=\"" + state.dataSetPointManager->WarmestSetPtMgr(SetPtMgrNum).Name +
    4622             :                                         "\", no AirLoopHVAC objects found:");
    4623           0 :                     ShowContinueError(state, "Setpoint Manager needs an AirLoopHVAC to operate.");
    4624           0 :                     ErrorsFound = true;
    4625             :                 }
    4626             :             }
    4627             : 
    4628             :             // Coldest Setpoint Managers
    4629         769 :             cSetPointManagerType = managerTypeName[static_cast<int>(SetPointManagerType::Coldest)];
    4630         770 :             for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumColdestSetPtMgrs; ++SetPtMgrNum) {
    4631           1 :                 if (state.dataHVACGlobal->NumPrimaryAirSys > 0) {
    4632           1 :                     AirLoopNum = UtilityRoutines::FindItemInList(state.dataSetPointManager->ColdestSetPtMgr(SetPtMgrNum).AirLoopName,
    4633           1 :                                                                  state.dataAirLoop->AirToZoneNodeInfo,
    4634             :                                                                  &AirLoopZoneEquipConnectData::AirLoopName);
    4635           1 :                     if (AirLoopNum == 0) {
    4636           0 :                         ShowSevereError(state,
    4637           0 :                                         cSetPointManagerType + "=\"" + state.dataSetPointManager->ColdestSetPtMgr(SetPtMgrNum).Name +
    4638             :                                             "\", invalid Air Loop specified:");
    4639           0 :                         ShowContinueError(state,
    4640           0 :                                           "Air Loop not found =\"" + state.dataSetPointManager->ColdestSetPtMgr(SetPtMgrNum).AirLoopName + "\".");
    4641           0 :                         ErrorsFound = true;
    4642             :                     } else {
    4643           1 :                         state.dataSetPointManager->ColdestSetPtMgr(SetPtMgrNum).AirLoopNum = AirLoopNum;
    4644             :                     }
    4645           1 :                     if (state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).NumZonesHeated == 0) {
    4646           0 :                         if (state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).NumZonesCooled == 0) {
    4647           0 :                             ShowSevereError(state,
    4648           0 :                                             cSetPointManagerType + "=\"" + state.dataSetPointManager->ColdestSetPtMgr(SetPtMgrNum).Name +
    4649             :                                                 "\", no zones with heating or cooling found:");
    4650           0 :                             ShowContinueError(state,
    4651           0 :                                               "Air Loop provides no heating or cooling, Air Loop=\"" +
    4652           0 :                                                   state.dataSetPointManager->ColdestSetPtMgr(SetPtMgrNum).AirLoopName + "\".");
    4653           0 :                             ErrorsFound = true;
    4654             :                         }
    4655             :                     }
    4656             :                 } else {
    4657           0 :                     ShowSevereError(state,
    4658           0 :                                     cSetPointManagerType + "=\"" + state.dataSetPointManager->ColdestSetPtMgr(SetPtMgrNum).Name +
    4659             :                                         "\", no AirLoopHVAC objects found:");
    4660           0 :                     ShowContinueError(state, "Setpoint Manager needs an AirLoopHVAC to operate.");
    4661           0 :                     ErrorsFound = true;
    4662             :                 }
    4663             :             }
    4664             : 
    4665             :             // Warmest Temp Flow Setpoint Managers
    4666         769 :             cSetPointManagerType = managerTypeName[static_cast<int>(SetPointManagerType::WarmestTempFlow)];
    4667         773 :             for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumWarmestSetPtMgrsTempFlow; ++SetPtMgrNum) {
    4668           4 :                 if (state.dataHVACGlobal->NumPrimaryAirSys > 0) {
    4669           4 :                     AirLoopNum = UtilityRoutines::FindItemInList(state.dataSetPointManager->WarmestSetPtMgrTempFlow(SetPtMgrNum).AirLoopName,
    4670           4 :                                                                  state.dataAirLoop->AirToZoneNodeInfo,
    4671             :                                                                  &AirLoopZoneEquipConnectData::AirLoopName);
    4672           4 :                     if (AirLoopNum == 0) {
    4673           0 :                         ShowSevereError(state,
    4674           0 :                                         cSetPointManagerType + "=\"" + state.dataSetPointManager->WarmestSetPtMgrTempFlow(SetPtMgrNum).Name +
    4675             :                                             "\", invalid Air Loop specified:");
    4676           0 :                         ShowContinueError(
    4677           0 :                             state, "Air Loop not found =\"" + state.dataSetPointManager->WarmestSetPtMgrTempFlow(SetPtMgrNum).AirLoopName + "\".");
    4678           0 :                         ErrorsFound = true;
    4679             :                     } else {
    4680           4 :                         state.dataSetPointManager->WarmestSetPtMgrTempFlow(SetPtMgrNum).AirLoopNum = AirLoopNum;
    4681           4 :                         state.dataSetPointManager->WarmestSetPtMgrTempFlow(SetPtMgrNum).SimReady = true;
    4682             :                     }
    4683           4 :                     if (state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).NumZonesCooled == 0) {
    4684           0 :                         ShowSevereError(state,
    4685           0 :                                         cSetPointManagerType + "=\"" + state.dataSetPointManager->WarmestSetPtMgrTempFlow(SetPtMgrNum).Name +
    4686             :                                             "\", no zones with cooling found:");
    4687           0 :                         ShowContinueError(state,
    4688           0 :                                           "Air Loop provides no cooling, Air Loop=\"" +
    4689           0 :                                               state.dataSetPointManager->WarmestSetPtMgrTempFlow(SetPtMgrNum).AirLoopName + "\".");
    4690           0 :                         ErrorsFound = true;
    4691             :                     }
    4692             :                 } else {
    4693           0 :                     ShowSevereError(state,
    4694           0 :                                     cSetPointManagerType + "=\"" + state.dataSetPointManager->WarmestSetPtMgrTempFlow(SetPtMgrNum).Name +
    4695             :                                         "\", no AirLoopHVAC objects found:");
    4696           0 :                     ShowContinueError(state, "Setpoint Manager needs an AirLoopHVAC to operate.");
    4697           0 :                     ErrorsFound = true;
    4698             :                 }
    4699             :             }
    4700             : 
    4701             :             // return air bypass flow set manager
    4702         769 :             cSetPointManagerType = managerTypeName[static_cast<int>(SetPointManagerType::RAB)];
    4703         770 :             for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumRABFlowSetPtMgrs; ++SetPtMgrNum) {
    4704           1 :                 if (state.dataHVACGlobal->NumPrimaryAirSys > 0) {
    4705           1 :                     AirLoopNum = UtilityRoutines::FindItemInList(state.dataSetPointManager->RABFlowSetPtMgr(SetPtMgrNum).AirLoopName,
    4706           1 :                                                                  state.dataAirLoop->AirToZoneNodeInfo,
    4707             :                                                                  &AirLoopZoneEquipConnectData::AirLoopName);
    4708           1 :                     state.dataSetPointManager->AllSetPtMgr(state.dataSetPointManager->RABFlowSetPtMgr(SetPtMgrNum).AllSetPtMgrIndex).AirLoopNum =
    4709             :                         AirLoopNum;
    4710           2 :                     state.dataSetPointManager->AllSetPtMgr(state.dataSetPointManager->RABFlowSetPtMgr(SetPtMgrNum).AllSetPtMgrIndex).AirLoopName =
    4711           2 :                         state.dataSetPointManager->RABFlowSetPtMgr(SetPtMgrNum).AirLoopName;
    4712           1 :                     if (AirLoopNum == 0) {
    4713           0 :                         ShowSevereError(state,
    4714           0 :                                         cSetPointManagerType + "=\"" + state.dataSetPointManager->RABFlowSetPtMgr(SetPtMgrNum).Name +
    4715             :                                             "\", invalid Air Loop specified:");
    4716           0 :                         ShowContinueError(state,
    4717           0 :                                           "Air Loop not found =\"" + state.dataSetPointManager->RABFlowSetPtMgr(SetPtMgrNum).AirLoopName + "\".");
    4718           0 :                         ErrorsFound = true;
    4719             :                     } else {
    4720           1 :                         state.dataSetPointManager->RABFlowSetPtMgr(SetPtMgrNum).AirLoopNum = AirLoopNum;
    4721           1 :                         if (state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).RABExists) {
    4722           1 :                             state.dataSetPointManager->RABFlowSetPtMgr(SetPtMgrNum).RABMixInNode =
    4723           1 :                                 state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).RABMixInNode;
    4724           1 :                             state.dataSetPointManager->RABFlowSetPtMgr(SetPtMgrNum).SupMixInNode =
    4725           1 :                                 state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).SupMixInNode;
    4726           1 :                             state.dataSetPointManager->RABFlowSetPtMgr(SetPtMgrNum).MixOutNode =
    4727           1 :                                 state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).MixOutNode;
    4728           1 :                             state.dataSetPointManager->RABFlowSetPtMgr(SetPtMgrNum).RABSplitOutNode =
    4729           1 :                                 state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).RABSplitOutNode;
    4730           1 :                             state.dataSetPointManager->RABFlowSetPtMgr(SetPtMgrNum).SysOutNode =
    4731           1 :                                 state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).AirLoopSupplyNodeNum(1);
    4732           1 :                             state.dataSetPointManager->RABFlowSetPtMgr(SetPtMgrNum).CtrlNodes(1) =
    4733           1 :                                 state.dataSetPointManager->RABFlowSetPtMgr(SetPtMgrNum).RABSplitOutNode;
    4734           1 :                             state.dataSetPointManager->AllSetPtMgr(state.dataSetPointManager->RABFlowSetPtMgr(SetPtMgrNum).AllSetPtMgrIndex)
    4735           2 :                                 .CtrlNodes(1) = state.dataSetPointManager->RABFlowSetPtMgr(SetPtMgrNum).RABSplitOutNode;
    4736             :                         } else {
    4737           0 :                             ShowSevereError(state,
    4738           0 :                                             cSetPointManagerType + "=\"" + state.dataSetPointManager->RABFlowSetPtMgr(SetPtMgrNum).Name +
    4739             :                                                 "\", no RAB in air loop found:");
    4740           0 :                             ShowContinueError(state, "Air Loop=\"" + state.dataSetPointManager->RABFlowSetPtMgr(SetPtMgrNum).AirLoopName + "\".");
    4741           0 :                             ErrorsFound = true;
    4742             :                         }
    4743             :                     }
    4744             :                 } else {
    4745           0 :                     ShowSevereError(state,
    4746           0 :                                     cSetPointManagerType + "=\"" + state.dataSetPointManager->RABFlowSetPtMgr(SetPtMgrNum).Name +
    4747             :                                         "\", no AirLoopHVAC objects found:");
    4748           0 :                     ShowContinueError(state, "Setpoint Manager needs an AirLoopHVAC to operate.");
    4749           0 :                     ErrorsFound = true;
    4750             :                 }
    4751             :             }
    4752             : 
    4753             :             // MultiZone Average Cooling Setpoint Managers
    4754         769 :             cSetPointManagerType = managerTypeName[static_cast<int>(SetPointManagerType::MZCoolingAverage)];
    4755         770 :             for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumMZClgAverageSetPtMgrs; ++SetPtMgrNum) {
    4756           1 :                 if (state.dataHVACGlobal->NumPrimaryAirSys > 0) {
    4757           1 :                     AirLoopNum = UtilityRoutines::FindItemInList(state.dataSetPointManager->MZAverageCoolingSetPtMgr(SetPtMgrNum).AirLoopName,
    4758           1 :                                                                  state.dataAirLoop->AirToZoneNodeInfo,
    4759             :                                                                  &AirLoopZoneEquipConnectData::AirLoopName);
    4760           1 :                     if (AirLoopNum == 0) {
    4761           0 :                         ShowSevereError(state,
    4762           0 :                                         cSetPointManagerType + "=\"" + state.dataSetPointManager->MZAverageCoolingSetPtMgr(SetPtMgrNum).Name +
    4763             :                                             "\", invalid Air Loop specified:");
    4764           0 :                         ShowContinueError(
    4765           0 :                             state, "Air Loop not found =\"" + state.dataSetPointManager->MZAverageCoolingSetPtMgr(SetPtMgrNum).AirLoopName + "\".");
    4766           0 :                         ErrorsFound = true;
    4767             :                     } else {
    4768           1 :                         state.dataSetPointManager->MZAverageCoolingSetPtMgr(SetPtMgrNum).AirLoopNum = AirLoopNum;
    4769             :                     }
    4770           1 :                     if (state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).NumZonesCooled == 0) {
    4771           0 :                         ShowSevereError(state,
    4772           0 :                                         cSetPointManagerType + "=\"" + state.dataSetPointManager->MZAverageCoolingSetPtMgr(SetPtMgrNum).Name +
    4773             :                                             "\", no zones with cooling found:");
    4774           0 :                         ShowContinueError(state,
    4775           0 :                                           "Air Loop provides no cooling, Air Loop=\"" +
    4776           0 :                                               state.dataSetPointManager->MZAverageCoolingSetPtMgr(SetPtMgrNum).AirLoopName + "\".");
    4777           0 :                         ErrorsFound = true;
    4778             :                     }
    4779             :                 } else {
    4780           0 :                     ShowSevereError(state,
    4781           0 :                                     cSetPointManagerType + "=\"" + state.dataSetPointManager->MZAverageCoolingSetPtMgr(SetPtMgrNum).Name +
    4782             :                                         "\", no AirLoopHVAC objects found:");
    4783           0 :                     ShowContinueError(state, "Setpoint Manager needs an AirLoopHVAC to operate.");
    4784           0 :                     ErrorsFound = true;
    4785             :                 }
    4786             :             }
    4787             : 
    4788             :             // MultiZone Average Heating Setpoint Managers
    4789         769 :             cSetPointManagerType = managerTypeName[static_cast<int>(SetPointManagerType::MZHeatingAverage)];
    4790         770 :             for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumMZHtgAverageSetPtMgrs; ++SetPtMgrNum) {
    4791           1 :                 if (state.dataHVACGlobal->NumPrimaryAirSys > 0) {
    4792           1 :                     AirLoopNum = UtilityRoutines::FindItemInList(state.dataSetPointManager->MZAverageHeatingSetPtMgr(SetPtMgrNum).AirLoopName,
    4793           1 :                                                                  state.dataAirLoop->AirToZoneNodeInfo,
    4794             :                                                                  &AirLoopZoneEquipConnectData::AirLoopName);
    4795           1 :                     if (AirLoopNum == 0) {
    4796           0 :                         ShowSevereError(state,
    4797           0 :                                         cSetPointManagerType + "=\"" + state.dataSetPointManager->MZAverageHeatingSetPtMgr(SetPtMgrNum).Name +
    4798             :                                             "\", invalid Air Loop specified:");
    4799           0 :                         ShowContinueError(
    4800           0 :                             state, "Air Loop not found =\"" + state.dataSetPointManager->MZAverageHeatingSetPtMgr(SetPtMgrNum).AirLoopName + "\".");
    4801           0 :                         ErrorsFound = true;
    4802             :                     } else {
    4803           1 :                         state.dataSetPointManager->MZAverageHeatingSetPtMgr(SetPtMgrNum).AirLoopNum = AirLoopNum;
    4804             :                     }
    4805             :                     // Commented out as we are using %NumZonesCooled instead of %NumZonesHeated for all systems for now
    4806             :                     // IF (AirToZoneNodeInfo(AirLoopNum)%NumZonesHeated == 0) THEN
    4807             :                     //  CALL ShowSevereError(state, TRIM(cSetPointManagerType)//': Air Loop provides no heating ' // &
    4808             :                     //                       TRIM(MZAverageHeatingSetPtMgr(SetPtMgrNum)%Name))
    4809             :                     //  CALL ShowContinueError(state, 'Occurs in Setpoint Manager='//TRIM(MZAverageHeatingSetPtMgr(SetPtMgrNum)%Name))
    4810             :                     //  ErrorsFound = .TRUE.
    4811             :                     // END IF
    4812             :                 } else {
    4813           0 :                     ShowSevereError(state,
    4814           0 :                                     cSetPointManagerType + "=\"" + state.dataSetPointManager->MZAverageHeatingSetPtMgr(SetPtMgrNum).Name +
    4815             :                                         "\", no AirLoopHVAC objects found:");
    4816           0 :                     ShowContinueError(state, "Setpoint Manager needs an AirLoopHVAC to operate.");
    4817           0 :                     ErrorsFound = true;
    4818             :                 }
    4819             :             }
    4820             : 
    4821             :             // MultiZone Average Minimum Humidity Setpoint Managers
    4822         769 :             cSetPointManagerType = managerTypeName[static_cast<int>(SetPointManagerType::MZMinHumAverage)];
    4823         770 :             for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumMZAverageMinHumSetPtMgrs; ++SetPtMgrNum) {
    4824           1 :                 if (state.dataHVACGlobal->NumPrimaryAirSys > 0) {
    4825           1 :                     AirLoopNum = UtilityRoutines::FindItemInList(state.dataSetPointManager->MZAverageMinHumSetPtMgr(SetPtMgrNum).AirLoopName,
    4826           1 :                                                                  state.dataAirLoop->AirToZoneNodeInfo,
    4827             :                                                                  &AirLoopZoneEquipConnectData::AirLoopName);
    4828           1 :                     if (AirLoopNum == 0) {
    4829           0 :                         ShowSevereError(state,
    4830           0 :                                         cSetPointManagerType + "=\"" + state.dataSetPointManager->MZAverageMinHumSetPtMgr(SetPtMgrNum).Name +
    4831             :                                             "\", invalid Air Loop specified:");
    4832           0 :                         ShowContinueError(
    4833           0 :                             state, "Air Loop not found =\"" + state.dataSetPointManager->MZAverageMinHumSetPtMgr(SetPtMgrNum).AirLoopName + "\".");
    4834           0 :                         ErrorsFound = true;
    4835             :                     } else {
    4836           1 :                         state.dataSetPointManager->MZAverageMinHumSetPtMgr(SetPtMgrNum).AirLoopNum = AirLoopNum;
    4837             :                         // make sure humidity controlled zone
    4838           1 :                         HstatZoneFound = false;
    4839           6 :                         for (HStatZoneNum = 1; HStatZoneNum <= state.dataZoneCtrls->NumHumidityControlZones; ++HStatZoneNum) {
    4840          15 :                             for (ZonesCooledIndex = 1;
    4841          15 :                                  ZonesCooledIndex <=
    4842          15 :                                  state.dataAirLoop->AirToZoneNodeInfo(state.dataSetPointManager->MZAverageMinHumSetPtMgr(SetPtMgrNum).AirLoopNum)
    4843          15 :                                      .NumZonesCooled;
    4844             :                                  ++ZonesCooledIndex) {
    4845          30 :                                 if (state.dataZoneCtrls->HumidityControlZone(HStatZoneNum).ActualZoneNum !=
    4846          15 :                                     state.dataAirLoop->AirToZoneNodeInfo(state.dataSetPointManager->MZAverageMinHumSetPtMgr(SetPtMgrNum).AirLoopNum)
    4847          15 :                                         .CoolCtrlZoneNums(ZonesCooledIndex))
    4848          10 :                                     continue;
    4849           5 :                                 HstatZoneFound = true;
    4850           5 :                                 break;
    4851             :                             }
    4852             :                         }
    4853           1 :                         if (!HstatZoneFound) {
    4854           0 :                             ShowSevereError(state,
    4855           0 :                                             cSetPointManagerType + "=\"" + state.dataSetPointManager->MZAverageMinHumSetPtMgr(SetPtMgrNum).Name +
    4856             :                                                 "\", invalid humidistat specification");
    4857           0 :                             ShowContinueError(state,
    4858           0 :                                               "could not locate Humidistat in any of the zones served by the Air loop=" +
    4859           0 :                                                   state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Name);
    4860           0 :                             ErrorsFound = true;
    4861             :                         }
    4862             :                     }
    4863             :                 } else {
    4864           0 :                     ShowSevereError(state,
    4865           0 :                                     cSetPointManagerType + "=\"" + state.dataSetPointManager->MZAverageMinHumSetPtMgr(SetPtMgrNum).Name +
    4866             :                                         "\", no AirLoopHVAC objects found:");
    4867           0 :                     ShowContinueError(state, "Setpoint Manager needs an AirLoopHVAC to operate.");
    4868           0 :                     ErrorsFound = true;
    4869             :                 }
    4870             :             }
    4871             : 
    4872             :             // MultiZone Average Maximum Humidity Setpoint Managers
    4873         769 :             cSetPointManagerType = managerTypeName[static_cast<int>(SetPointManagerType::MZMaxHumAverage)];
    4874         770 :             for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumMZAverageMaxHumSetPtMgrs; ++SetPtMgrNum) {
    4875           1 :                 if (state.dataHVACGlobal->NumPrimaryAirSys > 0) {
    4876           1 :                     AirLoopNum = UtilityRoutines::FindItemInList(state.dataSetPointManager->MZAverageMaxHumSetPtMgr(SetPtMgrNum).AirLoopName,
    4877           1 :                                                                  state.dataAirLoop->AirToZoneNodeInfo,
    4878             :                                                                  &AirLoopZoneEquipConnectData::AirLoopName);
    4879           1 :                     if (AirLoopNum == 0) {
    4880           0 :                         ShowSevereError(state,
    4881           0 :                                         cSetPointManagerType + "=\"" + state.dataSetPointManager->MZAverageMaxHumSetPtMgr(SetPtMgrNum).Name +
    4882             :                                             "\", invalid Air Loop specified:");
    4883           0 :                         ShowContinueError(
    4884           0 :                             state, "Air Loop not found =\"" + state.dataSetPointManager->MZAverageMaxHumSetPtMgr(SetPtMgrNum).AirLoopName + "\".");
    4885           0 :                         ErrorsFound = true;
    4886             :                     } else {
    4887           1 :                         state.dataSetPointManager->MZAverageMaxHumSetPtMgr(SetPtMgrNum).AirLoopNum = AirLoopNum;
    4888             :                         // make sure humidity controlled zone
    4889           1 :                         HstatZoneFound = false;
    4890           6 :                         for (HStatZoneNum = 1; HStatZoneNum <= state.dataZoneCtrls->NumHumidityControlZones; ++HStatZoneNum) {
    4891          15 :                             for (ZonesCooledIndex = 1;
    4892          15 :                                  ZonesCooledIndex <=
    4893          15 :                                  state.dataAirLoop->AirToZoneNodeInfo(state.dataSetPointManager->MZAverageMaxHumSetPtMgr(SetPtMgrNum).AirLoopNum)
    4894          15 :                                      .NumZonesCooled;
    4895             :                                  ++ZonesCooledIndex) {
    4896          30 :                                 if (state.dataZoneCtrls->HumidityControlZone(HStatZoneNum).ActualZoneNum !=
    4897          15 :                                     state.dataAirLoop->AirToZoneNodeInfo(state.dataSetPointManager->MZAverageMaxHumSetPtMgr(SetPtMgrNum).AirLoopNum)
    4898          15 :                                         .CoolCtrlZoneNums(ZonesCooledIndex))
    4899          10 :                                     continue;
    4900           5 :                                 HstatZoneFound = true;
    4901           5 :                                 break;
    4902             :                             }
    4903             :                         }
    4904           1 :                         if (!HstatZoneFound) {
    4905           0 :                             ShowSevereError(state,
    4906           0 :                                             cSetPointManagerType + "=\"" + state.dataSetPointManager->MZAverageMaxHumSetPtMgr(SetPtMgrNum).Name +
    4907             :                                                 "\", invalid humidistat specification");
    4908           0 :                             ShowContinueError(state,
    4909           0 :                                               "could not locate Humidistat in any of the zones served by the Air loop=" +
    4910           0 :                                                   state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Name);
    4911           0 :                             ErrorsFound = true;
    4912             :                         }
    4913             :                     }
    4914             :                 } else {
    4915           0 :                     ShowSevereError(state,
    4916           0 :                                     cSetPointManagerType + "=\"" + state.dataSetPointManager->MZAverageMaxHumSetPtMgr(SetPtMgrNum).Name +
    4917             :                                         "\", no AirLoopHVAC objects found:");
    4918           0 :                     ShowContinueError(state, "Setpoint Manager needs an AirLoopHVAC to operate.");
    4919           0 :                     ErrorsFound = true;
    4920             :                 }
    4921             :             }
    4922             : 
    4923             :             // Multizone Minimum Humidity Ratio Setpoint Managers
    4924         769 :             cSetPointManagerType = managerTypeName[static_cast<int>(SetPointManagerType::MZMinHum)];
    4925         777 :             for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumMZMinHumSetPtMgrs; ++SetPtMgrNum) {
    4926           8 :                 if (state.dataHVACGlobal->NumPrimaryAirSys > 0) {
    4927           8 :                     AirLoopNum = UtilityRoutines::FindItemInList(state.dataSetPointManager->MZMinHumSetPtMgr(SetPtMgrNum).AirLoopName,
    4928           8 :                                                                  state.dataAirLoop->AirToZoneNodeInfo,
    4929             :                                                                  &AirLoopZoneEquipConnectData::AirLoopName);
    4930           8 :                     if (AirLoopNum == 0) {
    4931           0 :                         ShowSevereError(state,
    4932           0 :                                         cSetPointManagerType + "=\"" + state.dataSetPointManager->MZMinHumSetPtMgr(SetPtMgrNum).Name +
    4933             :                                             "\", invalid Air Loop specified:");
    4934           0 :                         ShowContinueError(state,
    4935           0 :                                           "Air Loop not found =\"" + state.dataSetPointManager->MZMinHumSetPtMgr(SetPtMgrNum).AirLoopName + "\".");
    4936           0 :                         ErrorsFound = true;
    4937             :                     } else {
    4938           8 :                         state.dataSetPointManager->MZMinHumSetPtMgr(SetPtMgrNum).AirLoopNum = AirLoopNum;
    4939             :                         // make sure humidity controlled zone
    4940           8 :                         HstatZoneFound = false;
    4941          44 :                         for (HStatZoneNum = 1; HStatZoneNum <= state.dataZoneCtrls->NumHumidityControlZones; ++HStatZoneNum) {
    4942         227 :                             for (ZonesCooledIndex = 1;
    4943         227 :                                  ZonesCooledIndex <=
    4944         227 :                                  state.dataAirLoop->AirToZoneNodeInfo(state.dataSetPointManager->MZMinHumSetPtMgr(SetPtMgrNum).AirLoopNum)
    4945         227 :                                      .NumZonesCooled;
    4946             :                                  ++ZonesCooledIndex) {
    4947         414 :                                 if (state.dataZoneCtrls->HumidityControlZone(HStatZoneNum).ActualZoneNum !=
    4948         207 :                                     state.dataAirLoop->AirToZoneNodeInfo(state.dataSetPointManager->MZMinHumSetPtMgr(SetPtMgrNum).AirLoopNum)
    4949         207 :                                         .CoolCtrlZoneNums(ZonesCooledIndex))
    4950         191 :                                     continue;
    4951          16 :                                 HstatZoneFound = true;
    4952          16 :                                 break;
    4953             :                             }
    4954             :                         }
    4955           8 :                         if (!HstatZoneFound) {
    4956           0 :                             ShowSevereError(state,
    4957           0 :                                             cSetPointManagerType + "=\"" + state.dataSetPointManager->MZMinHumSetPtMgr(SetPtMgrNum).Name +
    4958             :                                                 "\", invalid humidistat specification");
    4959           0 :                             ShowContinueError(state,
    4960           0 :                                               "could not locate Humidistat in any of the zones served by the Air loop=" +
    4961           0 :                                                   state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Name);
    4962           0 :                             ErrorsFound = true;
    4963             :                         }
    4964             :                     }
    4965             :                 } else {
    4966           0 :                     ShowSevereError(state,
    4967           0 :                                     cSetPointManagerType + "=\"" + state.dataSetPointManager->MZMinHumSetPtMgr(SetPtMgrNum).Name +
    4968             :                                         "\", no AirLoopHVAC objects found:");
    4969           0 :                     ShowContinueError(state, "Setpoint Manager needs an AirLoopHVAC to operate.");
    4970           0 :                     ErrorsFound = true;
    4971             :                 }
    4972             :             }
    4973             : 
    4974             :             // Multizone Maximum Humidity Ratio Setpoint Managers
    4975         769 :             cSetPointManagerType = managerTypeName[static_cast<int>(SetPointManagerType::MZMaxHum)];
    4976         783 :             for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumMZMaxHumSetPtMgrs; ++SetPtMgrNum) {
    4977          14 :                 if (state.dataHVACGlobal->NumPrimaryAirSys > 0) {
    4978          14 :                     AirLoopNum = UtilityRoutines::FindItemInList(state.dataSetPointManager->MZMaxHumSetPtMgr(SetPtMgrNum).AirLoopName,
    4979          14 :                                                                  state.dataAirLoop->AirToZoneNodeInfo,
    4980             :                                                                  &AirLoopZoneEquipConnectData::AirLoopName);
    4981          14 :                     if (AirLoopNum == 0) {
    4982           0 :                         ShowSevereError(state,
    4983           0 :                                         cSetPointManagerType + "=\"" + state.dataSetPointManager->MZMaxHumSetPtMgr(SetPtMgrNum).Name +
    4984             :                                             "\", invalid Air Loop specified:");
    4985           0 :                         ShowContinueError(state,
    4986           0 :                                           "Air Loop not found =\"" + state.dataSetPointManager->MZMaxHumSetPtMgr(SetPtMgrNum).AirLoopName + "\".");
    4987           0 :                         ErrorsFound = true;
    4988             :                     } else {
    4989          14 :                         state.dataSetPointManager->MZMaxHumSetPtMgr(SetPtMgrNum).AirLoopNum = AirLoopNum;
    4990             :                         // make sure humidity controlled zone
    4991          14 :                         HstatZoneFound = false;
    4992          80 :                         for (HStatZoneNum = 1; HStatZoneNum <= state.dataZoneCtrls->NumHumidityControlZones; ++HStatZoneNum) {
    4993         317 :                             for (ZonesCooledIndex = 1;
    4994         317 :                                  ZonesCooledIndex <=
    4995         317 :                                  state.dataAirLoop->AirToZoneNodeInfo(state.dataSetPointManager->MZMaxHumSetPtMgr(SetPtMgrNum).AirLoopNum)
    4996         317 :                                      .NumZonesCooled;
    4997             :                                  ++ZonesCooledIndex) {
    4998         594 :                                 if (state.dataZoneCtrls->HumidityControlZone(HStatZoneNum).ActualZoneNum !=
    4999         297 :                                     state.dataAirLoop->AirToZoneNodeInfo(state.dataSetPointManager->MZMaxHumSetPtMgr(SetPtMgrNum).AirLoopNum)
    5000         297 :                                         .CoolCtrlZoneNums(ZonesCooledIndex))
    5001         251 :                                     continue;
    5002          46 :                                 HstatZoneFound = true;
    5003          46 :                                 break;
    5004             :                             }
    5005             :                         }
    5006          14 :                         if (!HstatZoneFound) {
    5007           0 :                             ShowSevereError(state,
    5008           0 :                                             cSetPointManagerType + "=\"" + state.dataSetPointManager->MZMaxHumSetPtMgr(SetPtMgrNum).Name +
    5009             :                                                 "\", invalid humidistat specification");
    5010           0 :                             ShowContinueError(state,
    5011           0 :                                               "could not locate Humidistat in any of the zones served by the Air loop=" +
    5012           0 :                                                   state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Name);
    5013           0 :                             ErrorsFound = true;
    5014             :                         }
    5015             :                     }
    5016             :                 } else {
    5017           0 :                     ShowSevereError(state,
    5018           0 :                                     cSetPointManagerType + "=\"" + state.dataSetPointManager->MZMaxHumSetPtMgr(SetPtMgrNum).Name +
    5019             :                                         "\", no AirLoopHVAC objects found:");
    5020           0 :                     ShowContinueError(state, "Setpoint Manager needs an AirLoopHVAC to operate.");
    5021           0 :                     ErrorsFound = true;
    5022             :                 }
    5023             :             }
    5024             : 
    5025             :             // condenser entering water temperature reset setpoint manager
    5026         769 :             cSetPointManagerType = managerTypeName[static_cast<int>(SetPointManagerType::CondEntReset)];
    5027         772 :             for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumCondEntSetPtMgrs; ++SetPtMgrNum) {
    5028             :                 // Scan loops and find the loop index that includes the condenser cooling tower node used as setpoint
    5029          12 :                 for (LoopNum = 1; LoopNum <= state.dataHVACGlobal->NumCondLoops + state.dataHVACGlobal->NumPlantLoops;
    5030             :                      ++LoopNum) { // Begin demand side loops ... When condenser is added becomes NumLoops
    5031          18 :                     for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->CondEntSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) {
    5032          18 :                         if (state.dataPlnt->PlantLoop(LoopNum).TempSetPointNodeNum ==
    5033           9 :                             state.dataSetPointManager->CondEntSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex)) {
    5034          16 :                             for (BranchNum = 1; BranchNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).TotalBranches;
    5035             :                                  ++BranchNum) {
    5036          26 :                                 for (CompNum = 1;
    5037          26 :                                      CompNum <=
    5038          26 :                                      state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).Branch(BranchNum).TotalComponents;
    5039             :                                      ++CompNum) {
    5040             :                                     // Check if cooling tower is single speed and generate and error
    5041          13 :                                     state.dataSetPointManager->InitType =
    5042          13 :                                         state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).Branch(BranchNum).Comp(CompNum).Type;
    5043          13 :                                     if (state.dataSetPointManager->InitType == PlantEquipmentType::CoolingTower_SingleSpd) {
    5044           0 :                                         ShowSevereError(state,
    5045           0 :                                                         cSetPointManagerType + "=\"" + state.dataSetPointManager->CondEntSetPtMgr(SetPtMgrNum).Name +
    5046             :                                                             "\", invalid tower found");
    5047           0 :                                         ShowContinueError(state,
    5048           0 :                                                           "Found SingleSpeed Cooling Tower, Cooling Tower=" + state.dataPlnt->PlantLoop(LoopNum)
    5049           0 :                                                                                                                   .LoopSide(LoopSideLocation::Supply)
    5050           0 :                                                                                                                   .Branch(BranchNum)
    5051           0 :                                                                                                                   .Comp(CompNum)
    5052             :                                                                                                                   .Name);
    5053           0 :                                         ShowContinueError(state, "SingleSpeed cooling towers cannot be used with this setpoint manager.");
    5054           0 :                                         ErrorsFound = true;
    5055             :                                     }
    5056             :                                 }
    5057             :                             }
    5058             :                             // Scan all attached chillers in the condenser loop index found to find the chiller index
    5059          16 :                             for (BranchNum = 1; BranchNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).TotalBranches;
    5060             :                                  ++BranchNum) {
    5061          26 :                                 for (CompNum = 1;
    5062          26 :                                      CompNum <=
    5063          26 :                                      state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).Branch(BranchNum).TotalComponents;
    5064             :                                      ++CompNum) {
    5065          13 :                                     state.dataSetPointManager->InitType =
    5066          13 :                                         state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).Branch(BranchNum).Comp(CompNum).Type;
    5067          13 :                                     switch (state.dataSetPointManager->InitType) {
    5068             : 
    5069           4 :                                     case PlantEquipmentType::Chiller_Absorption:
    5070             :                                     case PlantEquipmentType::Chiller_Indirect_Absorption:
    5071             :                                     case PlantEquipmentType::Chiller_CombTurbine:
    5072             :                                     case PlantEquipmentType::Chiller_ConstCOP:
    5073             :                                     case PlantEquipmentType::Chiller_Electric:
    5074             :                                     case PlantEquipmentType::Chiller_ElectricEIR:
    5075             :                                     case PlantEquipmentType::Chiller_DFAbsorption:
    5076             :                                     case PlantEquipmentType::Chiller_ElectricReformEIR:
    5077             :                                     case PlantEquipmentType::Chiller_EngineDriven: {
    5078             :                                         // Scan the supply side to find the chiller index and branch index on plantloop
    5079           8 :                                         state.dataSetPointManager->ChillerType = state.dataPlnt->PlantLoop(LoopNum)
    5080           4 :                                                                                      .LoopSide(LoopSideLocation::Demand)
    5081           4 :                                                                                      .Branch(BranchNum)
    5082           4 :                                                                                      .Comp(CompNum)
    5083           4 :                                                                                      .Type;
    5084          16 :                                         for (LoopNum2 = 1; LoopNum2 <= state.dataHVACGlobal->NumCondLoops + state.dataHVACGlobal->NumPlantLoops;
    5085             :                                              ++LoopNum2) {
    5086          65 :                                             for (BranchNumPlantSide = 1;
    5087          65 :                                                  BranchNumPlantSide <=
    5088          65 :                                                  state.dataPlnt->PlantLoop(LoopNum2).LoopSide(LoopSideLocation::Supply).TotalBranches;
    5089             :                                                  ++BranchNumPlantSide) {
    5090         212 :                                                 for (CompNumPlantSide = 1; CompNumPlantSide <= state.dataPlnt->PlantLoop(LoopNum2)
    5091         106 :                                                                                                    .LoopSide(LoopSideLocation::Supply)
    5092         106 :                                                                                                    .Branch(BranchNumPlantSide)
    5093         106 :                                                                                                    .TotalComponents;
    5094             :                                                      ++CompNumPlantSide) {
    5095         106 :                                                     if (state.dataPlnt->PlantLoop(LoopNum2)
    5096          53 :                                                             .LoopSide(LoopSideLocation::Supply)
    5097          53 :                                                             .Branch(BranchNumPlantSide)
    5098          53 :                                                             .Comp(CompNumPlantSide)
    5099          53 :                                                             .Type == state.dataSetPointManager->ChillerType) {
    5100           4 :                                                         state.dataSetPointManager->CondEntSetPtMgr(SetPtMgrNum).LoopIndexPlantSide = LoopNum2;
    5101           4 :                                                         state.dataSetPointManager->CondEntSetPtMgr(SetPtMgrNum).ChillerIndexPlantSide =
    5102             :                                                             CompNumPlantSide;
    5103           4 :                                                         state.dataSetPointManager->CondEntSetPtMgr(SetPtMgrNum).BranchIndexPlantSide =
    5104             :                                                             BranchNumPlantSide;
    5105             :                                                     }
    5106             :                                                 }
    5107             :                                             }
    5108             :                                         }
    5109           4 :                                         state.dataSetPointManager->CondEntSetPtMgr(SetPtMgrNum).Type = state.dataSetPointManager->ChillerType;
    5110           4 :                                         state.dataSetPointManager->CondEntSetPtMgr(SetPtMgrNum).LoopIndexDemandSide = LoopNum;
    5111           4 :                                         state.dataSetPointManager->CondEntSetPtMgr(SetPtMgrNum).ChillerIndexDemandSide = CompNum;
    5112           4 :                                         state.dataSetPointManager->CondEntSetPtMgr(SetPtMgrNum).BranchIndexDemandSide = BranchNum;
    5113           4 :                                     } break;
    5114             : 
    5115           9 :                                     default:
    5116           9 :                                         break;
    5117             :                                     }
    5118             :                                 }
    5119             :                             }
    5120             :                         }
    5121             :                     }
    5122             :                 }
    5123             :             }
    5124             : 
    5125             :             // Ideal condenser entering water temperature reset setpoint manager
    5126         769 :             cSetPointManagerType = managerTypeName[static_cast<int>(SetPointManagerType::IdealCondEntReset)];
    5127         769 :             state.dataSetPointManager->InitSetPointManagerNumChiller = 0;
    5128         771 :             for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumIdealCondEntSetPtMgrs; ++SetPtMgrNum) {
    5129             :                 // Scan loops and find the loop index that includes the condenser cooling tower node used as setpoint
    5130           8 :                 for (LoopNum = 1; LoopNum <= state.dataHVACGlobal->NumCondLoops + state.dataHVACGlobal->NumPlantLoops;
    5131             :                      ++LoopNum) { // Begin demand side loops ... When condenser is added becomes NumLoops
    5132          15 :                     for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->IdealCondEntSetPtMgr(SetPtMgrNum).NumCtrlNodes;
    5133             :                          ++CtrlNodeIndex) {
    5134          18 :                         if (state.dataPlnt->PlantLoop(LoopNum).TempSetPointNodeNum ==
    5135           9 :                             state.dataSetPointManager->IdealCondEntSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex)) {
    5136          11 :                             for (BranchNum = 1; BranchNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).TotalBranches;
    5137             :                                  ++BranchNum) {
    5138          18 :                                 for (CompNum = 1;
    5139          18 :                                      CompNum <=
    5140          18 :                                      state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).Branch(BranchNum).TotalComponents;
    5141             :                                      ++CompNum) {
    5142             :                                     // Check if cooling tower is single speed and generate and error
    5143           9 :                                     state.dataSetPointManager->InitType =
    5144           9 :                                         state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).Branch(BranchNum).Comp(CompNum).Type;
    5145           9 :                                     if (state.dataSetPointManager->InitType == PlantEquipmentType::CoolingTower_SingleSpd) {
    5146           0 :                                         ShowSevereError(state,
    5147           0 :                                                         cSetPointManagerType + "=\"" +
    5148           0 :                                                             state.dataSetPointManager->IdealCondEntSetPtMgr(SetPtMgrNum).Name +
    5149             :                                                             "\", invalid cooling tower found");
    5150           0 :                                         ShowContinueError(state,
    5151           0 :                                                           "Found Single Speed Cooling Tower, Cooling Tower=" + state.dataPlnt->PlantLoop(LoopNum)
    5152           0 :                                                                                                                    .LoopSide(LoopSideLocation::Supply)
    5153           0 :                                                                                                                    .Branch(BranchNum)
    5154           0 :                                                                                                                    .Comp(CompNum)
    5155             :                                                                                                                    .Name);
    5156           0 :                                         ShowContinueError(state, "SingleSpeed cooling towers cannot be used with this setpoint manager on each loop");
    5157           0 :                                         ErrorsFound = true;
    5158          18 :                                     } else if (state.dataSetPointManager->InitType == PlantEquipmentType::CoolingTower_TwoSpd ||
    5159           9 :                                                state.dataSetPointManager->InitType == PlantEquipmentType::CoolingTower_VarSpd) {
    5160           3 :                                         state.dataSetPointManager->IdealCondEntSetPtMgr(SetPtMgrNum).CondTowerBranchNum.push_back(BranchNum);
    5161           3 :                                         state.dataSetPointManager->IdealCondEntSetPtMgr(SetPtMgrNum).TowerNum.push_back(CompNum);
    5162           3 :                                         state.dataSetPointManager->IdealCondEntSetPtMgr(SetPtMgrNum).numTowers++;
    5163             :                                     }
    5164             :                                     // Scan the pump on the condenser water loop
    5165          16 :                                     if (state.dataSetPointManager->InitType == PlantEquipmentType::PumpVariableSpeed ||
    5166           7 :                                         state.dataSetPointManager->InitType == PlantEquipmentType::PumpConstantSpeed) {
    5167           2 :                                         state.dataSetPointManager->IdealCondEntSetPtMgr(SetPtMgrNum).CondPumpNum = CompNum;
    5168           2 :                                         state.dataSetPointManager->IdealCondEntSetPtMgr(SetPtMgrNum).CondPumpBranchNum = BranchNum;
    5169             :                                     }
    5170             :                                 }
    5171             :                             }
    5172             :                             // Scan all attached chillers in the condenser loop index found to find the chiller index
    5173          10 :                             for (BranchNum = 1; BranchNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).TotalBranches;
    5174             :                                  ++BranchNum) {
    5175          16 :                                 for (CompNum = 1;
    5176          16 :                                      CompNum <=
    5177          16 :                                      state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).Branch(BranchNum).TotalComponents;
    5178             :                                      ++CompNum) {
    5179           8 :                                     state.dataSetPointManager->InitType =
    5180           8 :                                         state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).Branch(BranchNum).Comp(CompNum).Type;
    5181             : 
    5182           8 :                                     switch (state.dataSetPointManager->InitType) {
    5183             : 
    5184           2 :                                     case PlantEquipmentType::Chiller_Absorption:
    5185             :                                     case PlantEquipmentType::Chiller_Indirect_Absorption:
    5186             :                                     case PlantEquipmentType::Chiller_CombTurbine:
    5187             :                                     case PlantEquipmentType::Chiller_ConstCOP:
    5188             :                                     case PlantEquipmentType::Chiller_Electric:
    5189             :                                     case PlantEquipmentType::Chiller_ElectricEIR:
    5190             :                                     case PlantEquipmentType::Chiller_DFAbsorption:
    5191             :                                     case PlantEquipmentType::Chiller_ElectricReformEIR:
    5192             :                                     case PlantEquipmentType::Chiller_EngineDriven: {
    5193             :                                         // Scan the supply side to find the chiller index and branch index on plantloop
    5194           4 :                                         state.dataSetPointManager->ChillerType = state.dataPlnt->PlantLoop(LoopNum)
    5195           2 :                                                                                      .LoopSide(LoopSideLocation::Demand)
    5196           2 :                                                                                      .Branch(BranchNum)
    5197           2 :                                                                                      .Comp(CompNum)
    5198           2 :                                                                                      .Type;
    5199           8 :                                         for (LoopNum2 = 1; LoopNum2 <= state.dataHVACGlobal->NumCondLoops + state.dataHVACGlobal->NumPlantLoops;
    5200             :                                              ++LoopNum2) {
    5201          31 :                                             for (BranchNumPlantSide = 1;
    5202          31 :                                                  BranchNumPlantSide <=
    5203          31 :                                                  state.dataPlnt->PlantLoop(LoopNum2).LoopSide(LoopSideLocation::Supply).TotalBranches;
    5204             :                                                  ++BranchNumPlantSide) {
    5205         100 :                                                 for (CompNumPlantSide = 1; CompNumPlantSide <= state.dataPlnt->PlantLoop(LoopNum2)
    5206          50 :                                                                                                    .LoopSide(LoopSideLocation::Supply)
    5207          50 :                                                                                                    .Branch(BranchNumPlantSide)
    5208          50 :                                                                                                    .TotalComponents;
    5209             :                                                      ++CompNumPlantSide) {
    5210          50 :                                                     state.dataSetPointManager->InitType = state.dataPlnt->PlantLoop(LoopNum2)
    5211          25 :                                                                                               .LoopSide(LoopSideLocation::Supply)
    5212          25 :                                                                                               .Branch(BranchNumPlantSide)
    5213          25 :                                                                                               .Comp(CompNumPlantSide)
    5214          25 :                                                                                               .Type;
    5215          25 :                                                     if (state.dataSetPointManager->InitType == state.dataSetPointManager->ChillerType) {
    5216           2 :                                                         ++state.dataSetPointManager->InitSetPointManagerNumChiller;
    5217           2 :                                                         state.dataSetPointManager->IdealCondEntSetPtMgr(SetPtMgrNum).LoopIndexPlantSide = LoopNum2;
    5218           2 :                                                         state.dataSetPointManager->IdealCondEntSetPtMgr(SetPtMgrNum).ChillerIndexPlantSide =
    5219             :                                                             CompNumPlantSide;
    5220           2 :                                                         state.dataSetPointManager->IdealCondEntSetPtMgr(SetPtMgrNum).BranchIndexPlantSide =
    5221             :                                                             BranchNumPlantSide;
    5222             :                                                         // Scan the pump on the chilled water loop
    5223          10 :                                                         for (BranchNum2 = 1;
    5224          10 :                                                              BranchNum2 <=
    5225          10 :                                                              state.dataPlnt->PlantLoop(LoopNum2).LoopSide(LoopSideLocation::Supply).TotalBranches;
    5226             :                                                              ++BranchNum2) {
    5227          32 :                                                             for (CompNum2 = 1; CompNum2 <= state.dataPlnt->PlantLoop(LoopNum2)
    5228          16 :                                                                                                .LoopSide(LoopSideLocation::Supply)
    5229          16 :                                                                                                .Branch(BranchNum2)
    5230          16 :                                                                                                .TotalComponents;
    5231             :                                                                  ++CompNum2) {
    5232          16 :                                                                 state.dataSetPointManager->InitType = state.dataPlnt->PlantLoop(LoopNum2)
    5233           8 :                                                                                                           .LoopSide(LoopSideLocation::Supply)
    5234           8 :                                                                                                           .Branch(BranchNum2)
    5235           8 :                                                                                                           .Comp(CompNum2)
    5236           8 :                                                                                                           .Type;
    5237          14 :                                                                 if (state.dataSetPointManager->InitType == PlantEquipmentType::PumpVariableSpeed ||
    5238           6 :                                                                     state.dataSetPointManager->InitType == PlantEquipmentType::PumpConstantSpeed) {
    5239           2 :                                                                     state.dataSetPointManager->IdealCondEntSetPtMgr(SetPtMgrNum).ChilledPumpNum =
    5240             :                                                                         CompNum2;
    5241           2 :                                                                     state.dataSetPointManager->IdealCondEntSetPtMgr(SetPtMgrNum)
    5242           4 :                                                                         .ChilledPumpBranchNum = BranchNum2;
    5243             :                                                                 }
    5244             :                                                             }
    5245             :                                                         }
    5246             :                                                     }
    5247             :                                                 }
    5248             :                                             }
    5249             :                                         }
    5250           2 :                                         if (state.dataSetPointManager->InitSetPointManagerNumChiller > 1) {
    5251           0 :                                             ShowSevereError(state,
    5252           0 :                                                             cSetPointManagerType + "=\"" +
    5253           0 :                                                                 state.dataSetPointManager->IdealCondEntSetPtMgr(SetPtMgrNum).Name +
    5254             :                                                                 "\", too many chillers found");
    5255           0 :                                             ShowContinueError(state, "only one chiller can be used with this setpoint manager on each loop");
    5256           0 :                                             ShowContinueError(state,
    5257           0 :                                                               "Found more than one chiller, chiller =" + state.dataPlnt->PlantLoop(LoopNum)
    5258           0 :                                                                                                              .LoopSide(LoopSideLocation::Demand)
    5259           0 :                                                                                                              .Branch(BranchNum)
    5260           0 :                                                                                                              .Comp(CompNum)
    5261             :                                                                                                              .Name);
    5262           0 :                                             ErrorsFound = true;
    5263             :                                         }
    5264           2 :                                         state.dataSetPointManager->IdealCondEntSetPtMgr(SetPtMgrNum).Type = state.dataSetPointManager->ChillerType;
    5265           2 :                                         state.dataSetPointManager->IdealCondEntSetPtMgr(SetPtMgrNum).CondLoopNum = LoopNum;
    5266           2 :                                     } break;
    5267             : 
    5268           6 :                                     default:
    5269           6 :                                         break;
    5270             :                                     }
    5271             :                                 }
    5272             :                             }
    5273           2 :                             state.dataSetPointManager->InitSetPointManagerNumChiller = 0;
    5274             :                         }
    5275             :                     }
    5276             :                 }
    5277             :             }
    5278             : 
    5279         769 :             VerifySetPointManagers(state, ErrorsFound);
    5280             :         }
    5281             : 
    5282     2638103 :         state.dataSetPointManager->InitSetPointManagersOneTimeFlag = false;
    5283             : 
    5284     2638103 :         if (ErrorsFound) {
    5285           0 :             ShowFatalError(state, "InitSetPointManagers: Errors found in getting SetPointManager input.");
    5286             :         }
    5287             :     }
    5288             : 
    5289     5274789 :     if ((state.dataGlobal->BeginEnvrnFlag && state.dataSetPointManager->InitSetPointManagersMyEnvrnFlag) ||
    5290     2635146 :         state.dataSetPointManager->InitSetPointManagersOneTimeFlag2) {
    5291             : 
    5292        6035 :         state.dataSetPointManager->ManagerOn = false;
    5293             : 
    5294       21396 :         for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumSchSetPtMgrs; ++SetPtMgrNum) {
    5295       31038 :             for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) {
    5296       15677 :                 NodeNum = state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number
    5297             :                 // Initialize scheduled setpoints
    5298       15677 :                 switch (state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).CtrlTypeMode) {
    5299       15598 :                 case CtrlVarType::Temp: {
    5300       15598 :                     state.dataLoopNodes->Node(NodeNum).TempSetPoint =
    5301       15598 :                         GetCurrentScheduleValue(state, state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).SchedPtr);
    5302       15598 :                 } break;
    5303           0 :                 case CtrlVarType::MaxTemp: {
    5304           0 :                     state.dataLoopNodes->Node(NodeNum).TempSetPointHi =
    5305           0 :                         GetCurrentScheduleValue(state, state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).SchedPtr);
    5306           0 :                 } break;
    5307           0 :                 case CtrlVarType::MinTemp: {
    5308           0 :                     state.dataLoopNodes->Node(NodeNum).TempSetPointLo =
    5309           0 :                         GetCurrentScheduleValue(state, state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).SchedPtr);
    5310           0 :                 } break;
    5311           0 :                 case CtrlVarType::HumRat: {
    5312           0 :                     state.dataLoopNodes->Node(NodeNum).HumRatSetPoint =
    5313           0 :                         GetCurrentScheduleValue(state, state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).SchedPtr);
    5314           0 :                 } break;
    5315          71 :                 case CtrlVarType::MaxHumRat: {
    5316          71 :                     state.dataLoopNodes->Node(NodeNum).HumRatMax =
    5317          71 :                         GetCurrentScheduleValue(state, state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).SchedPtr);
    5318          71 :                 } break;
    5319           8 :                 case CtrlVarType::MinHumRat: {
    5320           8 :                     state.dataLoopNodes->Node(NodeNum).HumRatMin =
    5321           8 :                         GetCurrentScheduleValue(state, state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).SchedPtr);
    5322           8 :                 } break;
    5323           0 :                 case CtrlVarType::MassFlow: {
    5324           0 :                     state.dataLoopNodes->Node(NodeNum).MassFlowRateSetPoint =
    5325           0 :                         GetCurrentScheduleValue(state, state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).SchedPtr);
    5326           0 :                 } break;
    5327           0 :                 case CtrlVarType::MaxMassFlow: {
    5328           0 :                     state.dataLoopNodes->Node(NodeNum).MassFlowRateMax =
    5329           0 :                         GetCurrentScheduleValue(state, state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).SchedPtr);
    5330           0 :                 } break;
    5331           0 :                 case CtrlVarType::MinMassFlow: {
    5332           0 :                     state.dataLoopNodes->Node(NodeNum).MassFlowRateMin =
    5333           0 :                         GetCurrentScheduleValue(state, state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).SchedPtr);
    5334           0 :                 } break;
    5335           0 :                 default:
    5336           0 :                     break;
    5337             :                 }
    5338             :             }
    5339             :         }
    5340             : 
    5341        6214 :         for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumDualSchSetPtMgrs; ++SetPtMgrNum) {
    5342         420 :             for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->DualSchSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) {
    5343         241 :                 NodeNum = state.dataSetPointManager->DualSchSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number
    5344         241 :                 if (state.dataSetPointManager->DualSchSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::Temp) {
    5345         241 :                     state.dataLoopNodes->Node(NodeNum).TempSetPointHi =
    5346         241 :                         GetCurrentScheduleValue(state, state.dataSetPointManager->DualSchSetPtMgr(SetPtMgrNum).SchedPtrHi);
    5347         241 :                     state.dataLoopNodes->Node(NodeNum).TempSetPointLo =
    5348         241 :                         GetCurrentScheduleValue(state, state.dataSetPointManager->DualSchSetPtMgr(SetPtMgrNum).SchedPtrLo);
    5349         241 :                     state.dataLoopNodes->Node(NodeNum).TempSetPoint =
    5350         241 :                         (state.dataLoopNodes->Node(NodeNum).TempSetPointHi + state.dataLoopNodes->Node(NodeNum).TempSetPointLo) / 2.0;
    5351             :                 }
    5352             :             }
    5353             :         }
    5354             : 
    5355        6976 :         for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumOutAirSetPtMgrs; ++SetPtMgrNum) {
    5356        2112 :             for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->OutAirSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) {
    5357        1171 :                 state.dataSetPointManager->OutAirSetPtMgr(SetPtMgrNum).calculate(state);
    5358        1171 :                 NodeNum = state.dataSetPointManager->OutAirSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number
    5359        1171 :                 if (state.dataSetPointManager->OutAirSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::Temp) {
    5360        1171 :                     state.dataLoopNodes->Node(NodeNum).TempSetPoint = state.dataSetPointManager->OutAirSetPtMgr(SetPtMgrNum).SetPt;
    5361           0 :                 } else if (state.dataSetPointManager->OutAirSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::MaxTemp) {
    5362           0 :                     state.dataLoopNodes->Node(NodeNum).TempSetPointHi = state.dataSetPointManager->OutAirSetPtMgr(SetPtMgrNum).SetPt;
    5363           0 :                 } else if (state.dataSetPointManager->OutAirSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::MinTemp) {
    5364           0 :                     state.dataLoopNodes->Node(NodeNum).TempSetPointLo = state.dataSetPointManager->OutAirSetPtMgr(SetPtMgrNum).SetPt;
    5365             :                 }
    5366             :             }
    5367             :         }
    5368             : 
    5369        6251 :         for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumSZMinHumSetPtMgrs; ++SetPtMgrNum) { // Minimum humidity setpoint managers
    5370         432 :             for (ZoneIndex = 1; ZoneIndex <= state.dataSetPointManager->SZMinHumSetPtMgr(SetPtMgrNum).NumZones; ++ZoneIndex) {
    5371         216 :                 ZoneNode = state.dataSetPointManager->SZMinHumSetPtMgr(SetPtMgrNum).ZoneNodes(ZoneIndex);
    5372         216 :                 state.dataLoopNodes->Node(ZoneNode).MassFlowRate = 0.0;
    5373             :             }
    5374         432 :             for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->SZMinHumSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) {
    5375         216 :                 NodeNum = state.dataSetPointManager->SZMinHumSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number
    5376         216 :                 state.dataLoopNodes->Node(NodeNum).HumRatMin = 0.007;                                        // Set the setpoint
    5377             :             }
    5378             :         }
    5379             : 
    5380        6401 :         for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumSZMaxHumSetPtMgrs; ++SetPtMgrNum) { // Maximum humidity setpoint managers
    5381         732 :             for (ZoneIndex = 1; ZoneIndex <= state.dataSetPointManager->SZMaxHumSetPtMgr(SetPtMgrNum).NumZones; ++ZoneIndex) {
    5382         366 :                 ZoneNode = state.dataSetPointManager->SZMaxHumSetPtMgr(SetPtMgrNum).ZoneNodes(ZoneIndex);
    5383         366 :                 state.dataLoopNodes->Node(ZoneNode).MassFlowRate = 0.0;
    5384             :             }
    5385         732 :             for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->SZMaxHumSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) {
    5386         366 :                 NodeNum = state.dataSetPointManager->SZMaxHumSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number
    5387         366 :                 state.dataLoopNodes->Node(NodeNum).HumRatMax = 0.011;                                        // Set the setpoint
    5388             :             }
    5389             :         }
    5390             : 
    5391        8086 :         for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumSZRhSetPtMgrs; ++SetPtMgrNum) { // single zone reheat setpoint managers
    5392        2051 :             ZoneInletNode = state.dataSetPointManager->SingZoneRhSetPtMgr(SetPtMgrNum).ZoneInletNodeNum;
    5393        2051 :             ZoneNode = state.dataSetPointManager->SingZoneRhSetPtMgr(SetPtMgrNum).ZoneNodeNum;
    5394        2051 :             state.dataLoopNodes->Node(ZoneInletNode).MassFlowRate = 0.0;
    5395        2051 :             state.dataLoopNodes->Node(ZoneNode).MassFlowRate = 0.0;
    5396        4283 :             for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->SingZoneRhSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) {
    5397        2232 :                 NodeNum = state.dataSetPointManager->SingZoneRhSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number
    5398        2232 :                 if (state.dataSetPointManager->SingZoneRhSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::Temp) {
    5399        2232 :                     state.dataLoopNodes->Node(NodeNum).TempSetPoint = 20.0; // Set the setpoint
    5400             :                 }
    5401             :             }
    5402             :         }
    5403             : 
    5404        6812 :         for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumSZHtSetPtMgrs; ++SetPtMgrNum) { // single zone heating setpoint managers
    5405         777 :             ZoneInletNode = state.dataSetPointManager->SingZoneHtSetPtMgr(SetPtMgrNum).ZoneInletNodeNum;
    5406         777 :             ZoneNode = state.dataSetPointManager->SingZoneHtSetPtMgr(SetPtMgrNum).ZoneNodeNum;
    5407         777 :             state.dataLoopNodes->Node(ZoneInletNode).MassFlowRate = 0.0;
    5408         777 :             state.dataLoopNodes->Node(ZoneNode).MassFlowRate = 0.0;
    5409        1562 :             for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->SingZoneHtSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) {
    5410         785 :                 NodeNum = state.dataSetPointManager->SingZoneHtSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number
    5411         785 :                 if (state.dataSetPointManager->SingZoneHtSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::Temp) {
    5412         785 :                     state.dataLoopNodes->Node(NodeNum).TempSetPoint = 20.0; // Set the setpoint
    5413             :                 }
    5414             :             }
    5415             :         }
    5416             : 
    5417        7698 :         for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumSZClSetPtMgrs; ++SetPtMgrNum) { // single zone cooling setpoint managers
    5418        1663 :             ZoneInletNode = state.dataSetPointManager->SingZoneClSetPtMgr(SetPtMgrNum).ZoneInletNodeNum;
    5419        1663 :             ZoneNode = state.dataSetPointManager->SingZoneClSetPtMgr(SetPtMgrNum).ZoneNodeNum;
    5420        1663 :             state.dataLoopNodes->Node(ZoneInletNode).MassFlowRate = 0.0;
    5421        1663 :             state.dataLoopNodes->Node(ZoneNode).MassFlowRate = 0.0;
    5422        3446 :             for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->SingZoneClSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) {
    5423        1783 :                 NodeNum = state.dataSetPointManager->SingZoneClSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number
    5424        1783 :                 if (state.dataSetPointManager->SingZoneClSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::Temp) {
    5425        1783 :                     state.dataLoopNodes->Node(NodeNum).TempSetPoint = 20.0; // Set the setpoint
    5426             :                 }
    5427             :             }
    5428             :         }
    5429             : 
    5430       19483 :         for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumMixedAirSetPtMgrs; ++SetPtMgrNum) { // mixed air setpoint managers
    5431             : 
    5432       13448 :             state.dataLoopNodes->Node(state.dataSetPointManager->MixedAirSetPtMgr(SetPtMgrNum).RefNode).MassFlowRate = 0.0;
    5433       13448 :             state.dataLoopNodes->Node(state.dataSetPointManager->MixedAirSetPtMgr(SetPtMgrNum).FanInNode).MassFlowRate = 0.0;
    5434       13448 :             state.dataLoopNodes->Node(state.dataSetPointManager->MixedAirSetPtMgr(SetPtMgrNum).FanOutNode).MassFlowRate = 0.0;
    5435       13448 :             state.dataLoopNodes->Node(state.dataSetPointManager->MixedAirSetPtMgr(SetPtMgrNum).RefNode).Temp = 20.0;
    5436       13448 :             state.dataLoopNodes->Node(state.dataSetPointManager->MixedAirSetPtMgr(SetPtMgrNum).FanInNode).Temp = 20.0;
    5437       13448 :             state.dataLoopNodes->Node(state.dataSetPointManager->MixedAirSetPtMgr(SetPtMgrNum).FanOutNode).Temp = 20.0;
    5438       13448 :             state.dataLoopNodes->Node(state.dataSetPointManager->MixedAirSetPtMgr(SetPtMgrNum).RefNode).HumRat = state.dataEnvrn->OutHumRat;
    5439       13448 :             state.dataLoopNodes->Node(state.dataSetPointManager->MixedAirSetPtMgr(SetPtMgrNum).FanInNode).HumRat = state.dataEnvrn->OutHumRat;
    5440       13448 :             state.dataLoopNodes->Node(state.dataSetPointManager->MixedAirSetPtMgr(SetPtMgrNum).FanOutNode).HumRat = state.dataEnvrn->OutHumRat;
    5441       13448 :             state.dataLoopNodes->Node(state.dataSetPointManager->MixedAirSetPtMgr(SetPtMgrNum).RefNode).Quality = 1.0;
    5442       13448 :             state.dataLoopNodes->Node(state.dataSetPointManager->MixedAirSetPtMgr(SetPtMgrNum).FanInNode).Quality = 1.0;
    5443       13448 :             state.dataLoopNodes->Node(state.dataSetPointManager->MixedAirSetPtMgr(SetPtMgrNum).FanOutNode).Quality = 1.0;
    5444       13448 :             state.dataLoopNodes->Node(state.dataSetPointManager->MixedAirSetPtMgr(SetPtMgrNum).RefNode).Press = state.dataEnvrn->OutBaroPress;
    5445       13448 :             state.dataLoopNodes->Node(state.dataSetPointManager->MixedAirSetPtMgr(SetPtMgrNum).FanInNode).Press = state.dataEnvrn->OutBaroPress;
    5446       13448 :             state.dataLoopNodes->Node(state.dataSetPointManager->MixedAirSetPtMgr(SetPtMgrNum).FanOutNode).Press = state.dataEnvrn->OutBaroPress;
    5447       13448 :             state.dataLoopNodes->Node(state.dataSetPointManager->MixedAirSetPtMgr(SetPtMgrNum).RefNode).Enthalpy =
    5448       13448 :                 PsyHFnTdbW(DataPrecisionGlobals::constant_twenty, state.dataEnvrn->OutHumRat);
    5449       13448 :             state.dataLoopNodes->Node(state.dataSetPointManager->MixedAirSetPtMgr(SetPtMgrNum).FanInNode).Enthalpy =
    5450       13448 :                 PsyHFnTdbW(DataPrecisionGlobals::constant_twenty, state.dataEnvrn->OutHumRat);
    5451       13448 :             state.dataLoopNodes->Node(state.dataSetPointManager->MixedAirSetPtMgr(SetPtMgrNum).FanOutNode).Enthalpy =
    5452       13448 :                 PsyHFnTdbW(DataPrecisionGlobals::constant_twenty, state.dataEnvrn->OutHumRat);
    5453       29004 :             for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->MixedAirSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) {
    5454       15556 :                 NodeNum = state.dataSetPointManager->MixedAirSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number
    5455       15556 :                 if (state.dataSetPointManager->MixedAirSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::Temp) {
    5456       15556 :                     state.dataLoopNodes->Node(NodeNum).TempSetPoint = 20.0; // Set the setpoint
    5457             :                 }
    5458             :             }
    5459             :         }
    5460             : 
    5461        6110 :         for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumOAPretreatSetPtMgrs;
    5462             :              ++SetPtMgrNum) { // Outside Air Pretreat setpoint managers
    5463             : 
    5464          75 :             state.dataLoopNodes->Node(state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).RefNode).MassFlowRate = 0.0;
    5465          75 :             state.dataLoopNodes->Node(state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).MixedOutNode).MassFlowRate = 0.0;
    5466          75 :             state.dataLoopNodes->Node(state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).OAInNode).MassFlowRate = 0.0;
    5467          75 :             state.dataLoopNodes->Node(state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).ReturnInNode).MassFlowRate = 0.0;
    5468          75 :             state.dataLoopNodes->Node(state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).RefNode).Temp = 20.0;
    5469          75 :             state.dataLoopNodes->Node(state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).MixedOutNode).Temp = 20.0;
    5470          75 :             state.dataLoopNodes->Node(state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).OAInNode).Temp = 20.0;
    5471          75 :             state.dataLoopNodes->Node(state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).ReturnInNode).Temp = 20.0;
    5472          75 :             state.dataLoopNodes->Node(state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).RefNode).HumRat = state.dataEnvrn->OutHumRat;
    5473          75 :             state.dataLoopNodes->Node(state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).MixedOutNode).HumRat = state.dataEnvrn->OutHumRat;
    5474          75 :             state.dataLoopNodes->Node(state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).OAInNode).HumRat = state.dataEnvrn->OutHumRat;
    5475          75 :             state.dataLoopNodes->Node(state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).ReturnInNode).HumRat = state.dataEnvrn->OutHumRat;
    5476          75 :             state.dataLoopNodes->Node(state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).RefNode).Quality = 1.0;
    5477          75 :             state.dataLoopNodes->Node(state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).MixedOutNode).Quality = 1.0;
    5478          75 :             state.dataLoopNodes->Node(state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).OAInNode).Quality = 1.0;
    5479          75 :             state.dataLoopNodes->Node(state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).ReturnInNode).Quality = 1.0;
    5480          75 :             state.dataLoopNodes->Node(state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).RefNode).Press = state.dataEnvrn->OutBaroPress;
    5481          75 :             state.dataLoopNodes->Node(state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).MixedOutNode).Press = state.dataEnvrn->OutBaroPress;
    5482          75 :             state.dataLoopNodes->Node(state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).OAInNode).Press = state.dataEnvrn->OutBaroPress;
    5483          75 :             state.dataLoopNodes->Node(state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).ReturnInNode).Press = state.dataEnvrn->OutBaroPress;
    5484          75 :             state.dataLoopNodes->Node(state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).RefNode).Enthalpy =
    5485          75 :                 PsyHFnTdbW(DataPrecisionGlobals::constant_twenty, state.dataEnvrn->OutHumRat);
    5486          75 :             state.dataLoopNodes->Node(state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).MixedOutNode).Enthalpy =
    5487          75 :                 PsyHFnTdbW(DataPrecisionGlobals::constant_twenty, state.dataEnvrn->OutHumRat);
    5488          75 :             state.dataLoopNodes->Node(state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).OAInNode).Enthalpy =
    5489          75 :                 PsyHFnTdbW(DataPrecisionGlobals::constant_twenty, state.dataEnvrn->OutHumRat);
    5490          75 :             state.dataLoopNodes->Node(state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).ReturnInNode).Enthalpy =
    5491          75 :                 PsyHFnTdbW(DataPrecisionGlobals::constant_twenty, state.dataEnvrn->OutHumRat);
    5492         150 :             for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) {
    5493          75 :                 NodeNum = state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number
    5494          75 :                 if (state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::Temp) {
    5495          45 :                     state.dataLoopNodes->Node(NodeNum).TempSetPoint = 20.0; // Set the setpoint
    5496             :                 }
    5497          75 :                 if (state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::MaxHumRat) {
    5498          30 :                     state.dataLoopNodes->Node(NodeNum).HumRatMax = state.dataEnvrn->OutHumRat; // Set the setpoint
    5499             :                 }
    5500          75 :                 if (state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::MinHumRat) {
    5501           0 :                     state.dataLoopNodes->Node(NodeNum).HumRatMin = state.dataEnvrn->OutHumRat; // Set the setpoint
    5502             :                 }
    5503          75 :                 if (state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::HumRat) {
    5504           0 :                     state.dataLoopNodes->Node(NodeNum).HumRatSetPoint = state.dataEnvrn->OutHumRat; // Set the setpoint
    5505             :                 }
    5506             :             }
    5507             :         }
    5508             : 
    5509        6218 :         for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumWarmestSetPtMgrs; ++SetPtMgrNum) {
    5510         366 :             for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->WarmestSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) {
    5511         183 :                 NodeNum = state.dataSetPointManager->WarmestSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number
    5512         183 :                 if (state.dataSetPointManager->WarmestSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::Temp) {
    5513         183 :                     state.dataLoopNodes->Node(NodeNum).TempSetPoint = 20.0; // Set the setpoint
    5514             :                 }
    5515             :             }
    5516             :         }
    5517             : 
    5518        6043 :         for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumColdestSetPtMgrs; ++SetPtMgrNum) {
    5519          16 :             for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->ColdestSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) {
    5520           8 :                 NodeNum = state.dataSetPointManager->ColdestSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number
    5521           8 :                 if (state.dataSetPointManager->ColdestSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::Temp) {
    5522           8 :                     state.dataLoopNodes->Node(NodeNum).TempSetPoint = 20.0; // Set the setpoint
    5523             :                 }
    5524             :             }
    5525             :         }
    5526             : 
    5527        6064 :         for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumWarmestSetPtMgrsTempFlow; ++SetPtMgrNum) {
    5528          58 :             for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->WarmestSetPtMgrTempFlow(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) {
    5529          29 :                 NodeNum = state.dataSetPointManager->WarmestSetPtMgrTempFlow(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number
    5530          29 :                 if (state.dataSetPointManager->WarmestSetPtMgrTempFlow(SetPtMgrNum).CtrlTypeMode == CtrlVarType::Temp) {
    5531          29 :                     state.dataLoopNodes->Node(NodeNum).TempSetPoint = 20.0; // Set the temperature setpoint
    5532          29 :                     if (state.dataSetPointManager->WarmestSetPtMgrTempFlow(SetPtMgrNum).AirLoopNum != 0) {
    5533          21 :                         state.dataAirLoop->AirLoopFlow(state.dataSetPointManager->WarmestSetPtMgrTempFlow(SetPtMgrNum).AirLoopNum).ReqSupplyFrac =
    5534             :                             1.0; // PH 10/09/04 Set the flow
    5535          21 :                         state.dataAirLoop->AirLoopControlInfo(state.dataSetPointManager->WarmestSetPtMgrTempFlow(SetPtMgrNum).AirLoopNum)
    5536          21 :                             .LoopFlowRateSet = true; // PH 10/09/04 Set the flag
    5537             :                     }
    5538             :                 }
    5539             :             }
    5540             :         }
    5541             : 
    5542        6035 :         if (state.dataZoneEquip->ZoneEquipInputsFilled && state.dataAirLoop->AirLoopInputsFilled) {
    5543        4501 :             for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumRABFlowSetPtMgrs; ++SetPtMgrNum) {
    5544           6 :                 NodeNum = state.dataSetPointManager->RABFlowSetPtMgr(SetPtMgrNum).RABSplitOutNode;
    5545           6 :                 if (state.dataSetPointManager->RABFlowSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::MassFlow) {
    5546           6 :                     state.dataLoopNodes->Node(NodeNum).MassFlowRateSetPoint = 0.0;
    5547             :                 }
    5548             :             }
    5549             :         }
    5550             : 
    5551        6043 :         for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumMZClgAverageSetPtMgrs; ++SetPtMgrNum) {
    5552          16 :             for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->MZAverageCoolingSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) {
    5553           8 :                 NodeNum = state.dataSetPointManager->MZAverageCoolingSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number
    5554           8 :                 if (state.dataSetPointManager->MZAverageCoolingSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::Temp) {
    5555           8 :                     state.dataLoopNodes->Node(NodeNum).TempSetPoint = 20.0; // Set the setpoint
    5556             :                 }
    5557             :             }
    5558             :         }
    5559             : 
    5560        6043 :         for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumMZHtgAverageSetPtMgrs; ++SetPtMgrNum) {
    5561          16 :             for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->MZAverageHeatingSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) {
    5562           8 :                 NodeNum = state.dataSetPointManager->MZAverageHeatingSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number
    5563           8 :                 if (state.dataSetPointManager->MZAverageHeatingSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::Temp) {
    5564           8 :                     state.dataLoopNodes->Node(NodeNum).TempSetPoint = 20.0; // Set the setpoint
    5565             :                 }
    5566             :             }
    5567             :         }
    5568             : 
    5569        6043 :         for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumMZAverageMinHumSetPtMgrs; ++SetPtMgrNum) {
    5570          16 :             for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->MZAverageMinHumSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) {
    5571           8 :                 NodeNum = state.dataSetPointManager->MZAverageMinHumSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number
    5572           8 :                 state.dataLoopNodes->Node(NodeNum).HumRatMin = 0.007;                                               // Set the setpoint
    5573             :             }
    5574             :         }
    5575             : 
    5576        6043 :         for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumMZAverageMaxHumSetPtMgrs; ++SetPtMgrNum) {
    5577          16 :             for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->MZAverageMaxHumSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) {
    5578           8 :                 NodeNum = state.dataSetPointManager->MZAverageMaxHumSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number
    5579           8 :                 state.dataLoopNodes->Node(NodeNum).HumRatMax = 0.011;                                               // Set the setpoint
    5580             :             }
    5581             :         }
    5582             : 
    5583        6105 :         for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumMZMinHumSetPtMgrs; ++SetPtMgrNum) {
    5584         140 :             for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->MZMinHumSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) {
    5585          70 :                 NodeNum = state.dataSetPointManager->MZMinHumSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number
    5586          70 :                 state.dataLoopNodes->Node(NodeNum).HumRatMin = 0.007;                                        // Set the setpoint
    5587             :             }
    5588             :         }
    5589             : 
    5590        6156 :         for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumMZMaxHumSetPtMgrs; ++SetPtMgrNum) {
    5591         282 :             for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->MZMaxHumSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) {
    5592         161 :                 NodeNum = state.dataSetPointManager->MZMaxHumSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number
    5593         161 :                 state.dataLoopNodes->Node(NodeNum).HumRatMax = 0.011;                                        // Set the setpoint
    5594             :             }
    5595             :         }
    5596             : 
    5597        7707 :         for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumFollowOATempSetPtMgrs; ++SetPtMgrNum) {
    5598        3344 :             for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->FollowOATempSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) {
    5599        1672 :                 NodeNum = state.dataSetPointManager->FollowOATempSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number
    5600        1672 :                 if (state.dataSetPointManager->FollowOATempSetPtMgr(SetPtMgrNum).RefTypeMode == ReferenceTempType::WetBulb) {
    5601        1656 :                     if (state.dataSetPointManager->FollowOATempSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::Temp) {
    5602        1656 :                         state.dataLoopNodes->Node(NodeNum).TempSetPoint = state.dataEnvrn->OutWetBulbTemp; // Set the setpoint
    5603           0 :                     } else if (state.dataSetPointManager->FollowOATempSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::MaxTemp) {
    5604           0 :                         state.dataLoopNodes->Node(NodeNum).TempSetPointHi = state.dataEnvrn->OutWetBulbTemp; // Set the setpoint
    5605           0 :                     } else if (state.dataSetPointManager->FollowOATempSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::MinTemp) {
    5606           0 :                         state.dataLoopNodes->Node(NodeNum).TempSetPointLo = state.dataEnvrn->OutWetBulbTemp; // Set the setpoint
    5607             :                     }
    5608          16 :                 } else if (state.dataSetPointManager->FollowOATempSetPtMgr(SetPtMgrNum).RefTypeMode == ReferenceTempType::DryBulb) {
    5609          16 :                     if (state.dataSetPointManager->FollowOATempSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::Temp) {
    5610          16 :                         state.dataLoopNodes->Node(NodeNum).TempSetPoint = state.dataEnvrn->OutDryBulbTemp; // Set the setpoint
    5611           0 :                     } else if (state.dataSetPointManager->FollowOATempSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::MaxTemp) {
    5612           0 :                         state.dataLoopNodes->Node(NodeNum).TempSetPointHi = state.dataEnvrn->OutDryBulbTemp; // Set the setpoint
    5613           0 :                     } else if (state.dataSetPointManager->FollowOATempSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::MinTemp) {
    5614           0 :                         state.dataLoopNodes->Node(NodeNum).TempSetPointLo = state.dataEnvrn->OutDryBulbTemp; // Set the setpoint
    5615             :                     }
    5616             :                 }
    5617             :             }
    5618             :         }
    5619             : 
    5620        6043 :         for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumFollowSysNodeTempSetPtMgrs; ++SetPtMgrNum) {
    5621          16 :             for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->FollowSysNodeTempSetPtMgr(SetPtMgrNum).NumCtrlNodes;
    5622             :                  ++CtrlNodeIndex) {
    5623           8 :                 NodeNum = state.dataSetPointManager->FollowSysNodeTempSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number
    5624           8 :                 if (CheckOutAirNodeNumber(state, state.dataSetPointManager->FollowSysNodeTempSetPtMgr(SetPtMgrNum).RefNodeNum)) {
    5625           8 :                     if (state.dataSetPointManager->FollowSysNodeTempSetPtMgr(SetPtMgrNum).RefTypeMode == ReferenceTempType::WetBulb) {
    5626           8 :                         state.dataLoopNodes->Node(state.dataSetPointManager->FollowSysNodeTempSetPtMgr(SetPtMgrNum).RefNodeNum).SPMNodeWetBulbRepReq =
    5627             :                             true;
    5628           8 :                         if (state.dataSetPointManager->FollowSysNodeTempSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::Temp) {
    5629           8 :                             state.dataLoopNodes->Node(NodeNum).TempSetPoint = state.dataEnvrn->OutWetBulbTemp; // Set the setpoint
    5630           0 :                         } else if (state.dataSetPointManager->FollowSysNodeTempSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::MaxTemp) {
    5631           0 :                             state.dataLoopNodes->Node(NodeNum).TempSetPointHi = state.dataEnvrn->OutWetBulbTemp; // Set the setpoint
    5632           0 :                         } else if (state.dataSetPointManager->FollowSysNodeTempSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::MinTemp) {
    5633           0 :                             state.dataLoopNodes->Node(NodeNum).TempSetPointLo = state.dataEnvrn->OutWetBulbTemp; // Set the setpoint
    5634             :                         }
    5635           0 :                     } else if (state.dataSetPointManager->FollowSysNodeTempSetPtMgr(SetPtMgrNum).RefTypeMode == ReferenceTempType::DryBulb) {
    5636           0 :                         if (state.dataSetPointManager->FollowSysNodeTempSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::Temp) {
    5637           0 :                             state.dataLoopNodes->Node(NodeNum).TempSetPoint = state.dataEnvrn->OutDryBulbTemp; // Set the setpoint
    5638           0 :                         } else if (state.dataSetPointManager->FollowSysNodeTempSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::MaxTemp) {
    5639           0 :                             state.dataLoopNodes->Node(NodeNum).TempSetPointHi = state.dataEnvrn->OutDryBulbTemp; // Set the setpoint
    5640           0 :                         } else if (state.dataSetPointManager->FollowSysNodeTempSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::MinTemp) {
    5641           0 :                             state.dataLoopNodes->Node(NodeNum).TempSetPointLo = state.dataEnvrn->OutDryBulbTemp; // Set the setpoint
    5642             :                         }
    5643             :                     }
    5644             :                 } else {
    5645             :                     // If reference node is a water node, then set RefTypeMode to NodeDryBulb
    5646           0 :                     if (state.dataLoopNodes->Node(state.dataSetPointManager->FollowSysNodeTempSetPtMgr(SetPtMgrNum).RefNodeNum).FluidType ==
    5647             :                         DataLoopNode::NodeFluidType::Water) {
    5648           0 :                         state.dataSetPointManager->FollowSysNodeTempSetPtMgr(SetPtMgrNum).RefTypeMode = ReferenceTempType::DryBulb;
    5649           0 :                     } else if (state.dataLoopNodes->Node(state.dataSetPointManager->FollowSysNodeTempSetPtMgr(SetPtMgrNum).RefNodeNum).FluidType ==
    5650             :                                DataLoopNode::NodeFluidType::Air) {
    5651           0 :                         if (state.dataSetPointManager->FollowSysNodeTempSetPtMgr(SetPtMgrNum).RefTypeMode == ReferenceTempType::WetBulb) {
    5652           0 :                             state.dataLoopNodes->Node(state.dataSetPointManager->FollowSysNodeTempSetPtMgr(SetPtMgrNum).RefNodeNum)
    5653           0 :                                 .SPMNodeWetBulbRepReq = true;
    5654             :                         }
    5655             :                     }
    5656           0 :                     if (state.dataSetPointManager->FollowSysNodeTempSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::Temp) {
    5657           0 :                         state.dataLoopNodes->Node(NodeNum).TempSetPoint = 20.0; // Set the setpoint
    5658           0 :                     } else if (state.dataSetPointManager->FollowSysNodeTempSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::MaxTemp) {
    5659           0 :                         state.dataLoopNodes->Node(NodeNum).TempSetPointHi = 20.0; // Set the setpoint
    5660           0 :                     } else if (state.dataSetPointManager->FollowSysNodeTempSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::MinTemp) {
    5661           0 :                         state.dataLoopNodes->Node(NodeNum).TempSetPointLo = 20.0; // Set the setpoint
    5662             :                     }
    5663             :                 }
    5664             :             }
    5665             :         }
    5666             : 
    5667        6177 :         for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumGroundTempSetPtMgrs; ++SetPtMgrNum) {
    5668         284 :             for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->GroundTempSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) {
    5669         142 :                 NodeNum = state.dataSetPointManager->GroundTempSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number
    5670         142 :                 if (state.dataSetPointManager->GroundTempSetPtMgr(SetPtMgrNum).RefTypeMode == ReferenceGroundTempObjectType::BuildingSurface) {
    5671           0 :                     if (state.dataSetPointManager->GroundTempSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::Temp) {
    5672           0 :                         state.dataLoopNodes->Node(NodeNum).TempSetPoint = state.dataEnvrn->GroundTemp; // Set the setpoint
    5673           0 :                     } else if (state.dataSetPointManager->GroundTempSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::MaxTemp) {
    5674           0 :                         state.dataLoopNodes->Node(NodeNum).TempSetPointHi = state.dataEnvrn->GroundTemp; // Set the setpoint
    5675           0 :                     } else if (state.dataSetPointManager->GroundTempSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::MinTemp) {
    5676           0 :                         state.dataLoopNodes->Node(NodeNum).TempSetPointLo = state.dataEnvrn->GroundTemp; // Set the setpoint
    5677             :                     }
    5678         142 :                 } else if (state.dataSetPointManager->GroundTempSetPtMgr(SetPtMgrNum).RefTypeMode == ReferenceGroundTempObjectType::Shallow) {
    5679           0 :                     if (state.dataSetPointManager->GroundTempSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::Temp) {
    5680           0 :                         state.dataLoopNodes->Node(NodeNum).TempSetPoint = state.dataEnvrn->GroundTemp_Surface; // Set the setpoint
    5681           0 :                     } else if (state.dataSetPointManager->GroundTempSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::MaxTemp) {
    5682           0 :                         state.dataLoopNodes->Node(NodeNum).TempSetPointHi = state.dataEnvrn->GroundTemp_Surface; // Set the setpoint
    5683           0 :                     } else if (state.dataSetPointManager->GroundTempSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::MinTemp) {
    5684           0 :                         state.dataLoopNodes->Node(NodeNum).TempSetPointLo = state.dataEnvrn->GroundTemp_Surface; // Set the setpoint
    5685             :                     }
    5686         142 :                 } else if (state.dataSetPointManager->GroundTempSetPtMgr(SetPtMgrNum).RefTypeMode == ReferenceGroundTempObjectType::Deep) {
    5687         142 :                     if (state.dataSetPointManager->GroundTempSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::Temp) {
    5688         142 :                         state.dataLoopNodes->Node(NodeNum).TempSetPoint = state.dataEnvrn->GroundTemp_Deep; // Set the setpoint
    5689           0 :                     } else if (state.dataSetPointManager->GroundTempSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::MaxTemp) {
    5690           0 :                         state.dataLoopNodes->Node(NodeNum).TempSetPointHi = state.dataEnvrn->GroundTemp_Deep; // Set the setpoint
    5691           0 :                     } else if (state.dataSetPointManager->GroundTempSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::MinTemp) {
    5692           0 :                         state.dataLoopNodes->Node(NodeNum).TempSetPointLo = state.dataEnvrn->GroundTemp_Deep; // Set the setpoint
    5693             :                     }
    5694           0 :                 } else if (state.dataSetPointManager->GroundTempSetPtMgr(SetPtMgrNum).RefTypeMode == ReferenceGroundTempObjectType::FCFactorMethod) {
    5695           0 :                     if (state.dataSetPointManager->GroundTempSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::Temp) {
    5696           0 :                         state.dataLoopNodes->Node(NodeNum).TempSetPoint = state.dataEnvrn->GroundTempFC; // Set the setpoint
    5697           0 :                     } else if (state.dataSetPointManager->GroundTempSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::MaxTemp) {
    5698           0 :                         state.dataLoopNodes->Node(NodeNum).TempSetPointHi = state.dataEnvrn->GroundTempFC; // Set the setpoint
    5699           0 :                     } else if (state.dataSetPointManager->GroundTempSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::MinTemp) {
    5700           0 :                         state.dataLoopNodes->Node(NodeNum).TempSetPointLo = state.dataEnvrn->GroundTempFC; // Set the setpoint
    5701             :                     }
    5702             :                 }
    5703             :             }
    5704             :         }
    5705             : 
    5706        6059 :         for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumCondEntSetPtMgrs;
    5707             :              ++SetPtMgrNum) { // Condenser entering water Set point managers
    5708          48 :             for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->CondEntSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) {
    5709          24 :                 NodeNum = state.dataSetPointManager->CondEntSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number
    5710          24 :                 if (state.dataSetPointManager->CondEntSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::Temp) {
    5711          24 :                     state.dataLoopNodes->Node(NodeNum).TempSetPoint =
    5712          24 :                         GetCurrentScheduleValue(state, state.dataSetPointManager->CondEntSetPtMgr(SetPtMgrNum).CondEntTempSchedPtr);
    5713             :                 }
    5714             :             }
    5715             :         }
    5716             : 
    5717        6050 :         for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumIdealCondEntSetPtMgrs;
    5718             :              ++SetPtMgrNum) { // Ideal Condenser entering water Set point managers
    5719          37 :             for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->IdealCondEntSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) {
    5720          22 :                 NodeNum = state.dataSetPointManager->IdealCondEntSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number
    5721          22 :                 if (state.dataSetPointManager->IdealCondEntSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::Temp) {
    5722          22 :                     state.dataLoopNodes->Node(NodeNum).TempSetPoint = state.dataSetPointManager->IdealCondEntSetPtMgr(SetPtMgrNum).MaxCondEntTemp;
    5723             :                 }
    5724             :             }
    5725             :         }
    5726             : 
    5727        6063 :         for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumSZOneStageCoolingSetPtMgrs; ++SetPtMgrNum) {
    5728          56 :             for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->SZOneStageCoolingSetPtMgr(SetPtMgrNum).NumCtrlNodes;
    5729             :                  ++CtrlNodeIndex) {
    5730          28 :                 NodeNum = state.dataSetPointManager->SZOneStageCoolingSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number
    5731          28 :                 if (state.dataSetPointManager->SZOneStageCoolingSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::Temp) {
    5732          28 :                     state.dataLoopNodes->Node(NodeNum).TempSetPoint =
    5733          28 :                         state.dataSetPointManager->SZOneStageCoolingSetPtMgr(SetPtMgrNum).CoolingOffTemp;
    5734             :                 }
    5735             :             }
    5736             :         }
    5737             : 
    5738        6063 :         for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumSZOneStageHeatingSetPtMgrs; ++SetPtMgrNum) {
    5739          56 :             for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->SZOneStageHeatingSetPtMgr(SetPtMgrNum).NumCtrlNodes;
    5740             :                  ++CtrlNodeIndex) {
    5741          28 :                 NodeNum = state.dataSetPointManager->SZOneStageHeatingSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number
    5742          28 :                 if (state.dataSetPointManager->SZOneStageHeatingSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::Temp) {
    5743          28 :                     state.dataLoopNodes->Node(NodeNum).TempSetPoint =
    5744          28 :                         state.dataSetPointManager->SZOneStageHeatingSetPtMgr(SetPtMgrNum).HeatingOffTemp;
    5745             :                 }
    5746             :             }
    5747             :         }
    5748             : 
    5749        6072 :         for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumReturnWaterResetChWSetPtMgrs; ++SetPtMgrNum) {
    5750          37 :             state.dataLoopNodes->Node(state.dataSetPointManager->ReturnWaterResetChWSetPtMgr(SetPtMgrNum).supplyNodeIndex).TempSetPoint =
    5751          37 :                 state.dataSetPointManager->ReturnWaterResetChWSetPtMgr(SetPtMgrNum).minimumChilledWaterSetpoint;
    5752             :         }
    5753             : 
    5754        6058 :         for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumReturnWaterResetHWSetPtMgrs; ++SetPtMgrNum) {
    5755          23 :             state.dataLoopNodes->Node(state.dataSetPointManager->ReturnWaterResetHWSetPtMgr(SetPtMgrNum).supplyNodeIndex).TempSetPoint =
    5756          23 :                 state.dataSetPointManager->ReturnWaterResetHWSetPtMgr(SetPtMgrNum).maximumHotWaterSetpoint;
    5757             :         }
    5758             : 
    5759             :         // System Node Reset Temperature and Humidity
    5760        6059 :         for (int SetPtMgrNum = 1;
    5761        6059 :              SetPtMgrNum <= (state.dataSetPointManager->NumSystemNodeResetTempSetPtMgrs + state.dataSetPointManager->NumSystemNodeResetHumSetPtMgrs);
    5762             :              ++SetPtMgrNum) {
    5763          48 :             for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->SystemNodeResetSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) {
    5764          24 :                 state.dataSetPointManager->SystemNodeResetSetPtMgr(SetPtMgrNum).calculate(state);
    5765          24 :                 NodeNum = state.dataSetPointManager->SystemNodeResetSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number
    5766          24 :                 switch (state.dataSetPointManager->SystemNodeResetSetPtMgr(SetPtMgrNum).CtrlTypeMode) {
    5767          18 :                 case CtrlVarType::Temp:
    5768          18 :                     state.dataLoopNodes->Node(NodeNum).TempSetPoint = state.dataSetPointManager->SystemNodeResetSetPtMgr(SetPtMgrNum).SetPt;
    5769          18 :                     break;
    5770           0 :                 case CtrlVarType::MaxTemp:
    5771           0 :                     state.dataLoopNodes->Node(NodeNum).TempSetPointHi = state.dataSetPointManager->SystemNodeResetSetPtMgr(SetPtMgrNum).SetPt;
    5772           0 :                     break;
    5773           0 :                 case CtrlVarType::MinTemp:
    5774           0 :                     state.dataLoopNodes->Node(NodeNum).TempSetPointLo = state.dataSetPointManager->SystemNodeResetSetPtMgr(SetPtMgrNum).SetPt;
    5775           0 :                     break;
    5776           0 :                 case CtrlVarType::HumRat:
    5777           0 :                     state.dataLoopNodes->Node(NodeNum).HumRatSetPoint = state.dataSetPointManager->SystemNodeResetSetPtMgr(SetPtMgrNum).SetPt;
    5778           0 :                     break;
    5779           6 :                 case CtrlVarType::MaxHumRat:
    5780           6 :                     state.dataLoopNodes->Node(NodeNum).HumRatMax = state.dataSetPointManager->SystemNodeResetSetPtMgr(SetPtMgrNum).SetPt;
    5781           6 :                     break;
    5782           0 :                 case CtrlVarType::MinHumRat:
    5783           0 :                     state.dataLoopNodes->Node(NodeNum).HumRatMin = state.dataSetPointManager->SystemNodeResetSetPtMgr(SetPtMgrNum).SetPt;
    5784           0 :                     break;
    5785           0 :                 default:
    5786           0 :                     break;
    5787             :                 }
    5788             :             }
    5789             :         }
    5790             : 
    5791        6035 :         state.dataSetPointManager->InitSetPointManagersMyEnvrnFlag = false;
    5792        6035 :         if (!state.dataSetPointManager->InitSetPointManagersOneTimeFlag) state.dataSetPointManager->InitSetPointManagersOneTimeFlag2 = false;
    5793             : 
    5794        6035 :         if (ErrorsFound) {
    5795           0 :             ShowFatalError(state, "InitSetPointManagers: Errors found. Program Terminates.");
    5796             :         }
    5797             : 
    5798             :     } // end begin environment inits
    5799     2639643 :     if (!state.dataGlobal->BeginEnvrnFlag) {
    5800     2628393 :         state.dataSetPointManager->InitSetPointManagersMyEnvrnFlag = true;
    5801             :     }
    5802     2639643 : }
    5803             : 
    5804     2633608 : void SimSetPointManagers(EnergyPlusData &state)
    5805             : {
    5806             : 
    5807             :     // SUBROUTINE INFORMATION:
    5808             :     //       AUTHOR         Fred Buhl
    5809             :     //       DATE WRITTEN   July 1998
    5810             :     //       MODIFIED       Shirey/Raustad (FSEC), Jan 2004
    5811             :     //                      Nov 2004 M. J. Witte, GARD Analytics, Inc.
    5812             :     //                        Add new setpoint managers:
    5813             :     //                          SET POINT MANAGER:SINGLE ZONE HEATING and
    5814             :     //                          SET POINT MANAGER:SINGLE ZONE COOLING
    5815             :     //                        Work supported by ASHRAE research project 1254-RP
    5816             :     //                      Haves Oct 2004
    5817             :     //                      July 2010 B.A. Nigusse, FSEC/UCF
    5818             :     //                        Added new setpoint managers
    5819             :     //                          SetpointManager:MultiZone:Heating:Average
    5820             :     //                          SetpointManager:MultiZone:Cooling:Average
    5821             :     //                          SetpointManager:MultiZone:MinimumHumidity:Average
    5822             :     //                          SetpointManager:MultiZone:MaximumHumidity:Average
    5823             :     //                      Aug 2010 B.A. Nigusse, FSEC/UCF
    5824             :     //                        Added new setpoint managers:
    5825             :     //                          SetpointManager:MultiZone:Humidity:Minimum
    5826             :     //                          SetpointManager:MultiZone:Humidity:Maximum
    5827             :     //                      Aug 2014 Rick Strand, UIUC
    5828             :     //                         SetpointManager:ScheduleTES (internally defined)
    5829             :     //                      Jan 2022 Wooyoung Jung, Jeremy Lerond and Jian Zhang, PNNL
    5830             :     //                        Added new setpoint managers:
    5831             :     //                          SetpointManager:SystemNodeReset:Temperature
    5832             :     //                          SetpointManager:SystemNodeReset:Humidity
    5833             :     //       RE-ENGINEERED  na
    5834             : 
    5835             :     // PURPOSE OF THIS SUBROUTINE
    5836             :     // Loop over all the Setpoint Managers and invoke the correct
    5837             :     // Setpoint Manager algorithm.
    5838             : 
    5839             :     // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    5840             :     int SetPtMgrNum;
    5841             : 
    5842             :     // Execute all the Setpoint Managers
    5843             : 
    5844             :     // The Scheduled Setpoint Managers
    5845             : 
    5846     9487280 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumSchSetPtMgrs; ++SetPtMgrNum) {
    5847     6853672 :         state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).calculate(state);
    5848             :     }
    5849             : 
    5850             :     // The Scheduled TES Setpoint Managers
    5851             : 
    5852     2637070 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumSchTESSetPtMgrs; ++SetPtMgrNum) {
    5853        3462 :         state.dataSetPointManager->SchTESSetPtMgr(SetPtMgrNum).calculate(state);
    5854             :     }
    5855             : 
    5856             :     // The Scheduled Dual Setpoint Managers
    5857             : 
    5858     2667263 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumDualSchSetPtMgrs; ++SetPtMgrNum) {
    5859       33655 :         state.dataSetPointManager->DualSchSetPtMgr(SetPtMgrNum).calculate(state);
    5860             :     }
    5861             : 
    5862             :     // The Outside Air Setpoint Managers
    5863             : 
    5864     3128197 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumOutAirSetPtMgrs; ++SetPtMgrNum) {
    5865      494589 :         state.dataSetPointManager->OutAirSetPtMgr(SetPtMgrNum).calculate(state);
    5866             :     }
    5867             : 
    5868             :     // The Single Zone Reheat Setpoint Managers
    5869             : 
    5870     3778686 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumSZRhSetPtMgrs; ++SetPtMgrNum) {
    5871     1145078 :         state.dataSetPointManager->SingZoneRhSetPtMgr(SetPtMgrNum).calculate(state);
    5872             :     }
    5873             : 
    5874             :     // The Single Zone Heating Setpoint Managers
    5875             : 
    5876     2775689 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumSZHtSetPtMgrs; ++SetPtMgrNum) {
    5877      142081 :         state.dataSetPointManager->SingZoneHtSetPtMgr(SetPtMgrNum).calculate(state);
    5878             :     }
    5879             : 
    5880             :     // The Single Zone Cooling Setpoint Managers
    5881             : 
    5882     2987292 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumSZClSetPtMgrs; ++SetPtMgrNum) {
    5883      353684 :         state.dataSetPointManager->SingZoneClSetPtMgr(SetPtMgrNum).calculate(state);
    5884             :     }
    5885             : 
    5886             :     // The Single Zone Minimum Humidity Setpoint Managers
    5887             : 
    5888     2705723 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumSZMinHumSetPtMgrs; ++SetPtMgrNum) {
    5889       72115 :         state.dataSetPointManager->SZMinHumSetPtMgr(SetPtMgrNum).calculate(state);
    5890             :     }
    5891             : 
    5892             :     // The Single Zone Maximum Humidity Setpoint Managers
    5893             : 
    5894     2770819 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumSZMaxHumSetPtMgrs; ++SetPtMgrNum) {
    5895      137211 :         state.dataSetPointManager->SZMaxHumSetPtMgr(SetPtMgrNum).calculate(state);
    5896             :     }
    5897             : 
    5898             :     // The Warmest Setpoint Managers
    5899             : 
    5900     2679238 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumWarmestSetPtMgrs; ++SetPtMgrNum) {
    5901       45630 :         state.dataSetPointManager->WarmestSetPtMgr(SetPtMgrNum).calculate(state);
    5902             :     }
    5903             : 
    5904             :     // The Coldest Setpoint Managers
    5905             : 
    5906     2636323 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumColdestSetPtMgrs; ++SetPtMgrNum) {
    5907        2715 :         state.dataSetPointManager->ColdestSetPtMgr(SetPtMgrNum).calculate(state);
    5908             :     }
    5909             : 
    5910             :     // The Warmest Temp Flow Setpoint Managers
    5911             : 
    5912     2640492 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumWarmestSetPtMgrsTempFlow; ++SetPtMgrNum) {
    5913        6884 :         state.dataSetPointManager->WarmestSetPtMgrTempFlow(SetPtMgrNum).calculate(state);
    5914             :     }
    5915             : 
    5916             :     // The RAB Temp Flow Setpoint Managers
    5917             : 
    5918     2635613 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumRABFlowSetPtMgrs; ++SetPtMgrNum) {
    5919        2005 :         state.dataSetPointManager->RABFlowSetPtMgr(SetPtMgrNum).calculate(state);
    5920             :     }
    5921             : 
    5922             :     // The Multizone Average Cooling Setpoint Managers
    5923             : 
    5924     2636308 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumMZClgAverageSetPtMgrs; ++SetPtMgrNum) {
    5925        2700 :         state.dataSetPointManager->MZAverageCoolingSetPtMgr(SetPtMgrNum).calculate(state);
    5926             :     }
    5927             : 
    5928             :     // The Multizone Average Heating Setpoint Managers
    5929             : 
    5930     2636308 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumMZHtgAverageSetPtMgrs; ++SetPtMgrNum) {
    5931        2700 :         state.dataSetPointManager->MZAverageHeatingSetPtMgr(SetPtMgrNum).calculate(state);
    5932             :     }
    5933             : 
    5934             :     // The Multizone Average Minimum Humidity Setpoint Managers
    5935             : 
    5936     2635118 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumMZAverageMinHumSetPtMgrs; ++SetPtMgrNum) {
    5937        1510 :         state.dataSetPointManager->MZAverageMinHumSetPtMgr(SetPtMgrNum).calculate(state);
    5938             :     }
    5939             : 
    5940             :     // The Multizone Average Maximum Humidity Setpoint Managers
    5941             : 
    5942     2635118 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumMZAverageMaxHumSetPtMgrs; ++SetPtMgrNum) {
    5943        1510 :         state.dataSetPointManager->MZAverageMaxHumSetPtMgr(SetPtMgrNum).calculate(state);
    5944             :     }
    5945             : 
    5946             :     // The Multizone Minimum Humidity Ratio Setpoint Managers
    5947     2649402 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumMZMinHumSetPtMgrs; ++SetPtMgrNum) {
    5948       15794 :         state.dataSetPointManager->MZMinHumSetPtMgr(SetPtMgrNum).calculate(state);
    5949             :     }
    5950             : 
    5951             :     // The Multizone Maximum Humidity Ratio Setpoint Managers
    5952     2661946 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumMZMaxHumSetPtMgrs; ++SetPtMgrNum) {
    5953       28338 :         state.dataSetPointManager->MZMaxHumSetPtMgr(SetPtMgrNum).calculate(state);
    5954             :     }
    5955             : 
    5956             :     // The Follow Outdoor Air  Temperature Setpoint Managers
    5957     3317339 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumFollowOATempSetPtMgrs; ++SetPtMgrNum) {
    5958      683731 :         state.dataSetPointManager->FollowOATempSetPtMgr(SetPtMgrNum).calculate(state);
    5959             :     }
    5960             : 
    5961             :     // The Follow System Node Temp Setpoint Managers
    5962     2636541 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumFollowSysNodeTempSetPtMgrs; ++SetPtMgrNum) {
    5963        2933 :         state.dataSetPointManager->FollowSysNodeTempSetPtMgr(SetPtMgrNum).calculate(state);
    5964             :     }
    5965             : 
    5966             :     // The Ground Temp Setpoint Managers
    5967     2669858 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumGroundTempSetPtMgrs; ++SetPtMgrNum) {
    5968       36250 :         state.dataSetPointManager->GroundTempSetPtMgr(SetPtMgrNum).calculate(state);
    5969             :     }
    5970             : 
    5971             :     // The Condenser Entering Water Temperature Set Point Managers
    5972     2639484 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumCondEntSetPtMgrs; ++SetPtMgrNum) {
    5973        5876 :         state.dataSetPointManager->CondEntSetPtMgr(SetPtMgrNum).calculate(state);
    5974             :     }
    5975             : 
    5976             :     // The Ideal Condenser Entering Water Temperature Set Point Managers
    5977     2638990 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumIdealCondEntSetPtMgrs; ++SetPtMgrNum) {
    5978        5382 :         state.dataSetPointManager->IdealCondEntSetPtMgr(SetPtMgrNum).calculate(state);
    5979             :     }
    5980             : 
    5981             :     // the single zone cooling on/off staged control setpoint managers
    5982     2720020 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumSZOneStageCoolingSetPtMgrs; ++SetPtMgrNum) {
    5983       86412 :         state.dataSetPointManager->SZOneStageCoolingSetPtMgr(SetPtMgrNum).calculate(state);
    5984             :     }
    5985             : 
    5986             :     // the single zone heating on/off staged control setpoint managers
    5987     2720020 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumSZOneStageHeatingSetPtMgrs; ++SetPtMgrNum) {
    5988       86412 :         state.dataSetPointManager->SZOneStageHeatingSetPtMgr(SetPtMgrNum).calculate(state);
    5989             :     }
    5990             : 
    5991             :     // return water reset
    5992     2650254 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumReturnWaterResetChWSetPtMgrs; ++SetPtMgrNum) {
    5993       16646 :         auto &returnWaterSPM(state.dataSetPointManager->ReturnWaterResetChWSetPtMgr(SetPtMgrNum));
    5994       33292 :         returnWaterSPM.calculate(
    5995       33292 :             state, state.dataLoopNodes->Node(returnWaterSPM.returnNodeIndex), state.dataLoopNodes->Node(returnWaterSPM.supplyNodeIndex));
    5996             :     }
    5997             : 
    5998             :     // hot-water return water reset
    5999     2648328 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumReturnWaterResetHWSetPtMgrs; ++SetPtMgrNum) {
    6000       14720 :         auto &returnWaterSPM(state.dataSetPointManager->ReturnWaterResetHWSetPtMgr(SetPtMgrNum));
    6001       29440 :         returnWaterSPM.calculate(
    6002       29440 :             state, state.dataLoopNodes->Node(returnWaterSPM.returnNodeIndex), state.dataLoopNodes->Node(returnWaterSPM.supplyNodeIndex));
    6003             :     }
    6004             : 
    6005             :     // The System Node Reset Temperature Setpoint Managers
    6006     2638801 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumSystemNodeResetTempSetPtMgrs; ++SetPtMgrNum) {
    6007        5193 :         state.dataSetPointManager->SystemNodeResetSetPtMgr(SetPtMgrNum).calculate(state);
    6008             :     }
    6009             : 
    6010             :     // The System Node Reset Humidity Setpoint Managers
    6011     2635339 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumSystemNodeResetHumSetPtMgrs; ++SetPtMgrNum) {
    6012        1731 :         state.dataSetPointManager->SystemNodeResetSetPtMgr(SetPtMgrNum + state.dataSetPointManager->NumSystemNodeResetTempSetPtMgrs).calculate(state);
    6013             :     }
    6014     2633608 : }
    6015             : 
    6016     6853672 : void DefineScheduledSetPointManager::calculate(EnergyPlusData &state)
    6017             : {
    6018             : 
    6019             :     // SUBROUTINE INFORMATION:
    6020             :     //       AUTHOR         Fred Buhl
    6021             :     //       DATE WRITTEN   July 1998
    6022             :     //       MODIFIED       na
    6023             :     //       RE-ENGINEERED  na
    6024             : 
    6025             :     // PURPOSE OF THIS SUBROUTINE:
    6026             :     // Set the setpoint using a simple schedule.
    6027             : 
    6028             :     // METHODOLOGY EMPLOYED:
    6029             : 
    6030             :     // REFERENCES:
    6031             :     // na
    6032             : 
    6033             :     // USE STATEMENTS:
    6034             : 
    6035             :     // Locals
    6036             :     // SUBROUTINE ARGUMENTS:
    6037             : 
    6038     6853672 :     this->SetPt = GetCurrentScheduleValue(state, this->SchedPtr);
    6039     6853672 : }
    6040             : 
    6041        3464 : void DefineScheduledTESSetPointManager::calculate(EnergyPlusData &state)
    6042             : {
    6043             : 
    6044             :     // SUBROUTINE INFORMATION:
    6045             :     //       AUTHOR         Rick Strand
    6046             :     //       DATE WRITTEN   Aug 2014
    6047             :     //       MODIFIED       na
    6048             :     //       RE-ENGINEERED  na
    6049             : 
    6050             :     // PURPOSE OF THIS SUBROUTINE:
    6051             :     // Set the setpoint using a simple schedule, then modify the value based on TES simple controls logic
    6052             : 
    6053             :     // METHODOLOGY EMPLOYED:
    6054             :     // Modified schedule setpoint manager logic
    6055             : 
    6056             :     // Locals
    6057             :     Real64 CurSchValOnPeak;
    6058             :     Real64 CurSchValCharge;
    6059        3464 :     Real64 constexpr OnVal(0.5);
    6060             : 
    6061        3464 :     CurSchValOnPeak = GetCurrentScheduleValue(state, this->SchedPtr);
    6062        3464 :     CurSchValCharge = GetCurrentScheduleValue(state, this->SchedPtrCharge);
    6063             : 
    6064             :     // CtrlType bug
    6065             :     //        if (this->CompOpType == DataPlant::CtrlType::CoolingOp) { // this is some sort of chiller
    6066        3464 :     if (this->CompOpType == DataPlant::CtrlType::HeatingOp) { // this is some sort of chiller
    6067        1732 :         if (CurSchValOnPeak >= OnVal) {
    6068         497 :             this->SetPt = this->NonChargeCHWTemp;
    6069        1235 :         } else if (CurSchValCharge < OnVal) {
    6070         693 :             this->SetPt = this->NonChargeCHWTemp;
    6071             :         } else {
    6072         542 :             this->SetPt = this->ChargeCHWTemp;
    6073             :         }
    6074             :         // CtrlType Bug
    6075             :         //        } else if (this->CompOpType == DataPlant::CtrlType::DualOp) { // this is some sort of ice storage system
    6076        1732 :     } else if (this->CompOpType == DataPlant::CtrlType::CoolingOp) { // this is some sort of ice storage system
    6077        1732 :         this->SetPt = this->NonChargeCHWTemp;
    6078             :     }
    6079        3464 : }
    6080             : 
    6081       33655 : void DefineSchedDualSetPointManager::calculate(EnergyPlusData &state)
    6082             : {
    6083             : 
    6084             :     // SUBROUTINE INFORMATION:
    6085             :     //       AUTHOR         Richard Liesen
    6086             :     //       DATE WRITTEN   May 2004
    6087             :     //       MODIFIED       na
    6088             :     //       RE-ENGINEERED  na
    6089             : 
    6090             :     // PURPOSE OF THIS SUBROUTINE:
    6091             :     // Set the both setpoint using a simple schedule.
    6092             : 
    6093             :     // METHODOLOGY EMPLOYED:
    6094             : 
    6095             :     // REFERENCES:
    6096             :     // na
    6097             : 
    6098             :     // USE STATEMENTS:
    6099             : 
    6100             :     // Locals
    6101             :     // SUBROUTINE ARGUMENTS:
    6102             : 
    6103       33655 :     this->SetPtHi = GetCurrentScheduleValue(state, this->SchedPtrHi);
    6104       33655 :     this->SetPtLo = GetCurrentScheduleValue(state, this->SchedPtrLo);
    6105       33655 : }
    6106             : 
    6107      495760 : void DefineOutsideAirSetPointManager::calculate(EnergyPlusData &state)
    6108             : {
    6109             : 
    6110             :     // SUBROUTINE ARGUMENTS:
    6111             : 
    6112             :     // Locals
    6113             :     // SUBROUTINE PARAMETER DEFINITIONS:
    6114             :     // na
    6115             : 
    6116             :     // INTERFACE BLOCK SPECIFICATIONS
    6117             :     // na
    6118             : 
    6119             :     // DERIVED TYPE DEFINITIONS
    6120             :     // na
    6121             : 
    6122             :     // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    6123             :     Real64 SchedVal;
    6124             :     Real64 OutLowTemp;
    6125             :     Real64 OutHighTemp;
    6126             :     Real64 SetTempAtOutLow;
    6127             :     Real64 SetTempAtOutHigh;
    6128             : 
    6129      495760 :     if (this->SchedPtr > 0) {
    6130           0 :         SchedVal = GetCurrentScheduleValue(state, this->SchedPtr);
    6131             :     } else {
    6132      495760 :         SchedVal = 0.0;
    6133             :     }
    6134             : 
    6135      495760 :     if (SchedVal == 2.0) {
    6136           0 :         OutLowTemp = this->OutLow2;
    6137           0 :         OutHighTemp = this->OutHigh2;
    6138           0 :         SetTempAtOutLow = this->OutLowSetPt2;
    6139           0 :         SetTempAtOutHigh = this->OutHighSetPt2;
    6140             :     } else {
    6141      495760 :         OutLowTemp = this->OutLow1;
    6142      495760 :         OutHighTemp = this->OutHigh1;
    6143      495760 :         SetTempAtOutLow = this->OutLowSetPt1;
    6144      495760 :         SetTempAtOutHigh = this->OutHighSetPt1;
    6145      495760 :         if ((this->SchedPtr > 0) && (SchedVal != 1.0)) { // Since schedule is optional, only check this if the user entered a schedule
    6146           0 :             ++this->setPtErrorCount;
    6147           0 :             if (this->setPtErrorCount <= 10) {
    6148           0 :                 ShowSevereError(state,
    6149           0 :                                 format("Schedule Values for the Outside Air Setpoint Manager = {} are something other than 1 or 2.", this->Name));
    6150           0 :                 ShowContinueError(state, format("...the value for the schedule currently is {}", SchedVal));
    6151           0 :                 ShowContinueError(state, "...the value is being interpreted as 1 for this run but should be fixed.");
    6152             :             } else {
    6153           0 :                 ShowRecurringSevereErrorAtEnd(
    6154             :                     state,
    6155           0 :                     format("Schedule Values for the Outside Air Setpoint Manager = {} are something other than 1 or 2.", this->Name),
    6156             :                     this->invalidSchedValErrorIndex);
    6157             :             }
    6158             :         }
    6159             :     }
    6160             : 
    6161      495760 :     this->SetPt = this->calcSetPointLinInt(OutLowTemp, OutHighTemp, state.dataEnvrn->OutDryBulbTemp, SetTempAtOutLow, SetTempAtOutHigh);
    6162      495760 : }
    6163             : 
    6164     1145078 : void DefineSZReheatSetPointManager::calculate(EnergyPlusData &state)
    6165             : {
    6166             : 
    6167             :     // SUBROUTINE INFORMATION:
    6168             :     //       AUTHOR         Fred Buhl
    6169             :     //       DATE WRITTEN   May 2000
    6170             :     //       MODIFIED       na
    6171             :     //       RE-ENGINEERED  na
    6172             : 
    6173             :     // PURPOSE OF THIS SUBROUTINE:
    6174             :     // From the heating or cooling load of the control zone, calculate the supply air setpoint
    6175             :     // needed to meet that zone load
    6176             : 
    6177             :     // METHODOLOGY EMPLOYED:
    6178             :     // na
    6179             : 
    6180             :     // REFERENCES:
    6181             :     // na
    6182             : 
    6183             :     // Using/Aliasing
    6184             :     using namespace DataZoneEnergyDemands;
    6185             :     using DataHVACGlobals::SmallLoad;
    6186             :     using DataHVACGlobals::SmallMassFlow;
    6187             :     using Psychrometrics::PsyTdbFnHW;
    6188             : 
    6189             :     // Locals
    6190             :     // SUBROUTINE ARGUMENT DEFINITIONS:
    6191             : 
    6192             :     // SUBROUTINE PARAMETER DEFINITIONS:
    6193             : 
    6194             :     // INTERFACE BLOCK SPECIFICATIONS
    6195             : 
    6196             :     // DERIVED TYPE DEFINITIONS
    6197             :     // na
    6198             : 
    6199             :     // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    6200             :     Real64 ZoneLoad;     // required zone load [W]
    6201             :     Real64 ZoneMassFlow; // zone inlet mass flow rate [kg/s]
    6202             :     Real64 CpAir;        // inlet air specific heat [J/kg-C]
    6203             :     int ZoneInletNode;
    6204             :     int ZoneNode;
    6205             :     int ZoneNum;
    6206             :     Real64 ZoneTemp;
    6207             :     Real64 ZoneLoadToCoolSetPt;
    6208             :     Real64 ZoneLoadToHeatSetPt;
    6209             :     Real64 TSetPt;
    6210             :     Real64 TSetPt1;
    6211             :     Real64 TSetPt2;
    6212             :     bool DeadBand;
    6213             :     int FanNodeIn;
    6214             :     int FanNodeOut;
    6215             :     int RetNode;
    6216             :     int OAMixOAInNode;
    6217             :     Real64 FanDeltaT;
    6218             :     Real64 TMixAtMinOA;
    6219             :     Real64 EnthMixAtMinOA;
    6220             :     Real64 HumRatMixAtMinOA;
    6221             :     int AirLoopNum;
    6222             :     Real64 OAFrac;
    6223             :     int LoopInNode;
    6224             : 
    6225     1145078 :     ZoneInletNode = this->ZoneInletNodeNum;
    6226     1145078 :     ZoneNum = this->ControlZoneNum;
    6227     1145078 :     ZoneNode = this->ZoneNodeNum;
    6228     1145078 :     FanNodeIn = this->FanNodeIn;
    6229     1145078 :     FanNodeOut = this->FanNodeOut;
    6230     1145078 :     RetNode = this->RetNode;
    6231     1145078 :     OAMixOAInNode = this->OAInNode;
    6232     1145078 :     AirLoopNum = this->AirLoopNum;
    6233     1145078 :     OAFrac =
    6234     1145078 :         state.dataAirLoop->AirLoopFlow(AirLoopNum).OAFrac; // changed from MinOAFrac, now updates to current oa fraction for improve deadband control
    6235     1145078 :     ZoneMassFlow = state.dataLoopNodes->Node(ZoneInletNode).MassFlowRate;
    6236     1145078 :     ZoneLoad = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ZoneNum).TotalOutputRequired;
    6237     1145078 :     ZoneLoadToCoolSetPt = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ZoneNum).OutputRequiredToCoolingSP;
    6238     1145078 :     ZoneLoadToHeatSetPt = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ZoneNum).OutputRequiredToHeatingSP;
    6239     1145078 :     DeadBand = state.dataZoneEnergyDemand->DeadBandOrSetback(ZoneNum);
    6240     1145078 :     ZoneTemp = state.dataLoopNodes->Node(ZoneNode).Temp;
    6241     1145078 :     LoopInNode = this->LoopInNode;
    6242     1145078 :     if (OAMixOAInNode > 0) {
    6243     1137583 :         HumRatMixAtMinOA = (1.0 - OAFrac) * state.dataLoopNodes->Node(RetNode).HumRat + OAFrac * state.dataLoopNodes->Node(OAMixOAInNode).HumRat;
    6244     1137583 :         EnthMixAtMinOA = (1.0 - OAFrac) * state.dataLoopNodes->Node(RetNode).Enthalpy + OAFrac * state.dataLoopNodes->Node(OAMixOAInNode).Enthalpy;
    6245     1137583 :         TMixAtMinOA = PsyTdbFnHW(EnthMixAtMinOA, HumRatMixAtMinOA);
    6246             :     } else {
    6247        7495 :         TMixAtMinOA = state.dataLoopNodes->Node(LoopInNode).Temp;
    6248             :     }
    6249     1145078 :     if (FanNodeOut > 0 && FanNodeIn > 0) {
    6250      926083 :         FanDeltaT = state.dataLoopNodes->Node(FanNodeOut).Temp - state.dataLoopNodes->Node(FanNodeIn).Temp;
    6251             :     } else {
    6252      218995 :         FanDeltaT = 0.0;
    6253             :     }
    6254     1145078 :     state.dataSetPointManager->TSupNoHC = TMixAtMinOA + FanDeltaT;
    6255     1145078 :     CpAir = PsyCpAirFnW(state.dataLoopNodes->Node(ZoneInletNode).HumRat);
    6256     1145078 :     state.dataSetPointManager->ExtrRateNoHC = CpAir * ZoneMassFlow * (state.dataSetPointManager->TSupNoHC - ZoneTemp);
    6257     1145078 :     if (ZoneMassFlow <= SmallMassFlow) {
    6258      312703 :         TSetPt = state.dataSetPointManager->TSupNoHC;
    6259      832375 :     } else if (DeadBand || std::abs(ZoneLoad) < SmallLoad) {
    6260             :         // if air with no active heating or cooling provides cooling
    6261       65126 :         if (state.dataSetPointManager->ExtrRateNoHC < 0.0) {
    6262             :             // if still in deadband, do no active heating or cooling;
    6263             :             // if below heating setpoint, set a supply temp that will cool to the heating setpoint
    6264       27650 :             if (state.dataSetPointManager->ExtrRateNoHC >= ZoneLoadToHeatSetPt) {
    6265        7295 :                 TSetPt = state.dataSetPointManager->TSupNoHC;
    6266             :             } else {
    6267       20355 :                 TSetPt = ZoneTemp + ZoneLoadToHeatSetPt / (CpAir * ZoneMassFlow);
    6268             :             }
    6269             :             // if air with no active heating or cooling provides heating
    6270       37476 :         } else if (state.dataSetPointManager->ExtrRateNoHC > 0.0) {
    6271             :             // if still in deadband, do no active heating or cooling;
    6272             :             // if above cooling setpoint, set a supply temp that will heat to the cooling setpoint
    6273       37476 :             if (state.dataSetPointManager->ExtrRateNoHC <= ZoneLoadToCoolSetPt) {
    6274       16529 :                 TSetPt = state.dataSetPointManager->TSupNoHC;
    6275             :             } else {
    6276       20947 :                 TSetPt = ZoneTemp + ZoneLoadToCoolSetPt / (CpAir * ZoneMassFlow);
    6277             :             }
    6278             :         } else {
    6279           0 :             TSetPt = state.dataSetPointManager->TSupNoHC;
    6280             :         }
    6281      767249 :     } else if (ZoneLoad < (-1.0 * SmallLoad)) {
    6282      348099 :         TSetPt1 = ZoneTemp + ZoneLoad / (CpAir * ZoneMassFlow);
    6283      348099 :         TSetPt2 = ZoneTemp + ZoneLoadToHeatSetPt / (CpAir * ZoneMassFlow);
    6284      348099 :         if (TSetPt1 > state.dataSetPointManager->TSupNoHC) {
    6285        2238 :             if (TSetPt2 > state.dataSetPointManager->TSupNoHC) {
    6286         489 :                 TSetPt = TSetPt2;
    6287             :             } else {
    6288        1749 :                 TSetPt = state.dataSetPointManager->TSupNoHC;
    6289             :             }
    6290             :         } else {
    6291      345861 :             TSetPt = TSetPt1;
    6292             :         }
    6293      419150 :     } else if (ZoneLoad > SmallLoad) {
    6294      419150 :         TSetPt1 = ZoneTemp + ZoneLoad / (CpAir * ZoneMassFlow);
    6295      419150 :         TSetPt2 = ZoneTemp + ZoneLoadToCoolSetPt / (CpAir * ZoneMassFlow);
    6296      419150 :         if (TSetPt1 < state.dataSetPointManager->TSupNoHC) {
    6297         939 :             if (TSetPt2 < state.dataSetPointManager->TSupNoHC) {
    6298         637 :                 TSetPt = TSetPt2;
    6299             :             } else {
    6300         302 :                 TSetPt = state.dataSetPointManager->TSupNoHC;
    6301             :             }
    6302             :         } else {
    6303      418211 :             TSetPt = TSetPt1;
    6304             :         }
    6305             :     } else {
    6306           0 :         TSetPt = state.dataSetPointManager->TSupNoHC;
    6307             :     }
    6308             : 
    6309     1145078 :     TSetPt = max(min(TSetPt, this->MaxSetTemp), this->MinSetTemp);
    6310     1145078 :     this->SetPt = TSetPt;
    6311     1145078 : }
    6312             : 
    6313      142081 : void DefineSZHeatingSetPointManager::calculate(EnergyPlusData &state)
    6314             : {
    6315             : 
    6316             :     // SUBROUTINE INFORMATION:
    6317             :     //       AUTHOR         M. J. Witte based on CalcSingZoneRhSetPoint by Fred Buhl,
    6318             :     //                        Work supported by ASHRAE research project 1254-RP
    6319             :     //       DATE WRITTEN   November 2004
    6320             :     //       MODIFIED       na
    6321             :     //       RE-ENGINEERED  na
    6322             : 
    6323             :     // PURPOSE OF THIS SUBROUTINE:
    6324             :     // From the heating load of the control zone, calculate the supply air setpoint
    6325             :     // needed to meet that zone load (based on CalcSingZoneRhSetPoint)
    6326             : 
    6327             :     using DataHVACGlobals::SmallLoad;
    6328             :     using DataHVACGlobals::SmallMassFlow;
    6329             : 
    6330             :     Real64 ZoneLoadtoHeatSP; // required zone load to zone heating setpoint [W]
    6331             :     Real64 ZoneMassFlow;     // zone inlet mass flow rate [kg/s]
    6332             :     Real64 CpAir;            // inlet air specific heat [J/kg-C]
    6333             :     int ZoneInletNode;
    6334             :     int ZoneNode;
    6335             :     int ZoneNum;
    6336             :     Real64 ZoneTemp;
    6337             : 
    6338      142081 :     ZoneInletNode = this->ZoneInletNodeNum;
    6339      142081 :     ZoneNum = this->ControlZoneNum;
    6340      142081 :     ZoneNode = this->ZoneNodeNum;
    6341      142081 :     ZoneMassFlow = state.dataLoopNodes->Node(ZoneInletNode).MassFlowRate;
    6342      142081 :     ZoneLoadtoHeatSP = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ZoneNum).OutputRequiredToHeatingSP;
    6343      142081 :     ZoneTemp = state.dataLoopNodes->Node(ZoneNode).Temp;
    6344      142081 :     if (ZoneMassFlow <= SmallMassFlow) {
    6345       18791 :         this->SetPt = this->MinSetTemp;
    6346             :     } else {
    6347      123290 :         CpAir = PsyCpAirFnW(state.dataLoopNodes->Node(ZoneInletNode).HumRat);
    6348      123290 :         this->SetPt = ZoneTemp + ZoneLoadtoHeatSP / (CpAir * ZoneMassFlow);
    6349      123290 :         this->SetPt = max(this->SetPt, this->MinSetTemp);
    6350      123290 :         this->SetPt = min(this->SetPt, this->MaxSetTemp);
    6351             :     }
    6352      142081 : }
    6353             : 
    6354      353684 : void DefineSZCoolingSetPointManager::calculate(EnergyPlusData &state)
    6355             : {
    6356             : 
    6357             :     // SUBROUTINE INFORMATION:
    6358             :     //       AUTHOR         M. J. Witte based on CalcSingZoneRhSetPoint by Fred Buhl,
    6359             :     //                        Work supported by ASHRAE research project 1254-RP
    6360             :     //       DATE WRITTEN   November 2004
    6361             :     //       MODIFIED       na
    6362             :     //       RE-ENGINEERED  na
    6363             : 
    6364             :     // PURPOSE OF THIS SUBROUTINE:
    6365             :     // From the Cooling load of the control zone, calculate the supply air setpoint
    6366             :     // needed to meet that zone load (based on CalcSingZoneRhSetPoint)
    6367             : 
    6368             :     using DataHVACGlobals::SmallLoad;
    6369             :     using DataHVACGlobals::SmallMassFlow;
    6370             : 
    6371             :     Real64 ZoneLoadtoCoolSP; // required zone load to zone Cooling setpoint [W]
    6372             :     Real64 ZoneMassFlow;     // zone inlet mass flow rate [kg/s]
    6373             :     Real64 CpAir;            // inlet air specific Cool [J/kg-C]
    6374             :     int ZoneInletNode;
    6375             :     int ZoneNode;
    6376             :     int ZoneNum;
    6377             :     Real64 ZoneTemp;
    6378             : 
    6379      353684 :     ZoneInletNode = this->ZoneInletNodeNum;
    6380      353684 :     ZoneNum = this->ControlZoneNum;
    6381      353684 :     ZoneNode = this->ZoneNodeNum;
    6382      353684 :     ZoneMassFlow = state.dataLoopNodes->Node(ZoneInletNode).MassFlowRate;
    6383      353684 :     ZoneLoadtoCoolSP = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(ZoneNum).OutputRequiredToCoolingSP;
    6384      353684 :     ZoneTemp = state.dataLoopNodes->Node(ZoneNode).Temp;
    6385      353684 :     if (ZoneMassFlow <= SmallMassFlow) {
    6386       24277 :         this->SetPt = this->MaxSetTemp;
    6387             :     } else {
    6388      329407 :         CpAir = PsyCpAirFnW(state.dataLoopNodes->Node(ZoneInletNode).HumRat);
    6389      329407 :         this->SetPt = ZoneTemp + ZoneLoadtoCoolSP / (CpAir * ZoneMassFlow);
    6390      329407 :         this->SetPt = max(this->SetPt, this->MinSetTemp);
    6391      329407 :         this->SetPt = min(this->SetPt, this->MaxSetTemp);
    6392             :     }
    6393      353684 : }
    6394             : 
    6395       86412 : void DefineSZOneStageCoolinggSetPointManager::calculate(EnergyPlusData &state)
    6396             : {
    6397             : 
    6398             :     // SUBROUTINE INFORMATION:
    6399             :     //       AUTHOR         B. Griffith
    6400             :     //       DATE WRITTEN   August 2013
    6401             :     //       MODIFIED       na
    6402             :     //       RE-ENGINEERED  na
    6403             : 
    6404             :     // PURPOSE OF THIS SUBROUTINE:
    6405             :     // calculate the setpoint for staged on/off cooling
    6406             : 
    6407             :     // METHODOLOGY EMPLOYED:
    6408             :     // Evaluate stage in zone energy demand structure and choose setpoint accordingly
    6409             : 
    6410       86412 :     if (state.dataZoneEnergyDemand->ZoneSysEnergyDemand(this->ControlZoneNum).StageNum >= 0) {
    6411       74244 :         this->SetPt = this->CoolingOffTemp;
    6412             :     } else { // negative so a cooling stage is set
    6413       12168 :         this->SetPt = this->CoolingOnTemp;
    6414             :     }
    6415       86412 : }
    6416             : 
    6417       86412 : void DefineSZOneStageHeatingSetPointManager::calculate(EnergyPlusData &state)
    6418             : {
    6419             : 
    6420             :     // SUBROUTINE INFORMATION:
    6421             :     //       AUTHOR         B. Griffith
    6422             :     //       DATE WRITTEN   August 2013
    6423             :     //       MODIFIED       na
    6424             :     //       RE-ENGINEERED  na
    6425             : 
    6426             :     // PURPOSE OF THIS SUBROUTINE:
    6427             :     // calculate the setpoint for staged on/off control
    6428             : 
    6429             :     // METHODOLOGY EMPLOYED:
    6430             :     // Evaluate stage in zone energy demand structure and choose setpoint accordingly
    6431             : 
    6432       86412 :     if (state.dataZoneEnergyDemand->ZoneSysEnergyDemand(this->ControlZoneNum).StageNum <= 0) {
    6433       53334 :         this->SetPt = this->HeatingOffTemp;
    6434             :     } else { // positive so a heating stage is set
    6435       33078 :         this->SetPt = this->HeatingOnTemp;
    6436             :     }
    6437       86412 : }
    6438             : 
    6439       72115 : void DefineSZMinHumSetPointManager::calculate(EnergyPlusData &state)
    6440             : {
    6441             : 
    6442             :     // SUBROUTINE INFORMATION:
    6443             :     //       AUTHOR         Fred Buhl
    6444             :     //       DATE WRITTEN   October 2000
    6445             :     //       MODIFIED       Shirey/Raustad Jan 2002
    6446             :     //                      Gu, Dec 2007
    6447             : 
    6448             :     // PURPOSE OF THIS SUBROUTINE:
    6449             :     // From humidity load of the control zone, calculate the supply air humidity
    6450             :     // needed to meet the minimum humidity setpoint
    6451             : 
    6452             :     // METHODOLOGY EMPLOYED:
    6453             :     // Zone moisture load from ZoneTempPredictorCorrector (via DataZoneEnergyDemands)
    6454             :     // is used to calculate the minimum supply air humidity ratio
    6455             :     // needed to meet minimum zone relative humidity requirement
    6456             : 
    6457             :     // Using/Aliasing
    6458             :     using DataHVACGlobals::SmallMassFlow;
    6459             :     using Psychrometrics::PsyWFnTdbRhPb;
    6460             : 
    6461             :     Real64 MoistureLoad; // Zone moisture load (kg moisture/second) required to meet the relative humidity setpoint
    6462             :     // Value obtained from ZoneTempPredictorCorrector (via ZoneSysMoistureDemand in DataZoneEnergyDemands)
    6463             :     Real64 SupplyAirHumRat; // Desired air humidity ratio
    6464             : 
    6465       72115 :     this->SetPt = 0.0;
    6466             :     // Only use one zone for now
    6467       72115 :     int ZoneNode = this->ZoneNodes(1);
    6468       72115 :     Real64 ZoneMassFlow = state.dataLoopNodes->Node(ZoneNode).MassFlowRate;
    6469             : 
    6470       72115 :     if (ZoneMassFlow > SmallMassFlow) {
    6471             : 
    6472       71057 :         MoistureLoad = state.dataZoneEnergyDemand->ZoneSysMoistureDemand(this->CtrlZoneNum(1)).OutputRequiredToHumidifyingSP;
    6473             : 
    6474       71057 :         SupplyAirHumRat = max(0.0, state.dataLoopNodes->Node(ZoneNode).HumRat + MoistureLoad / ZoneMassFlow);
    6475             : 
    6476             :         // Positive Humidity Ratio MoistureLoad means a humidification load and only humidifying can raise up to a minimum
    6477             :         //  IF(MoistureLoad .GT. 0.0) SZMinHumSetPtMgr(SetPtMgrNum)%SetPt = SupplyAirHumRat
    6478       71057 :         this->SetPt = SupplyAirHumRat;
    6479             :     }
    6480       72115 : }
    6481             : 
    6482      137211 : void DefineSZMaxHumSetPointManager::calculate(EnergyPlusData &state)
    6483             : {
    6484             : 
    6485             :     // SUBROUTINE INFORMATION:
    6486             :     //       AUTHOR         Raustad/Shirey, FSEC
    6487             :     //       DATE WRITTEN   January 2004
    6488             :     //       MODIFIED       Gu, Dec. 2007
    6489             : 
    6490             :     // PURPOSE OF THIS SUBROUTINE:
    6491             :     // From humidity load of the control zone, calculate the supply air humidity
    6492             :     // needed to meet the maximum humidity setpoint
    6493             : 
    6494             :     // METHODOLOGY EMPLOYED:
    6495             :     // Zone moisture load from ZoneTempPredictorCorrector (via DataZoneEnergyDemands)
    6496             :     // is used to calculate the maximum supply air humidity ratio
    6497             :     // needed to meet maximum zone relative humidity requirement
    6498             : 
    6499             :     // Using/Aliasing
    6500             :     using DataHVACGlobals::SmallMassFlow;
    6501             :     using Psychrometrics::PsyWFnTdbRhPb;
    6502             : 
    6503             :     int ZoneNode;        // Control zone air node number
    6504             :     Real64 ZoneMassFlow; // Zone air mass flow rate (kg/s)
    6505             :     Real64 MoistureLoad; // Zone moisture load (kg moisture/sec) required to meet the relative humidity setpoint
    6506             :     // Value obtained from ZoneTempPredictorCorrector (via ZoneSysMoistureDemand in DataZoneEnergyDemands)
    6507             :     Real64 SupplyAirHumRat; // Desired air humidity ratio
    6508             : 
    6509      137211 :     this->SetPt = 0.0;
    6510             :     // Only use one zone for now
    6511      137211 :     ZoneNode = this->ZoneNodes(1);
    6512      137211 :     ZoneMassFlow = state.dataLoopNodes->Node(ZoneNode).MassFlowRate;
    6513             : 
    6514      137211 :     if (ZoneMassFlow > SmallMassFlow) {
    6515             : 
    6516      135667 :         MoistureLoad = state.dataZoneEnergyDemand->ZoneSysMoistureDemand(this->CtrlZoneNum(1)).OutputRequiredToDehumidifyingSP;
    6517             : 
    6518             :         // MoistureLoad (negative for dehumidification) may be so large that a negative humrat results, cap at 0.00001
    6519      135667 :         SupplyAirHumRat = max(0.00001, state.dataLoopNodes->Node(ZoneNode).HumRat + MoistureLoad / ZoneMassFlow);
    6520             : 
    6521             :         // This hum rat is currently used in Controller:Simple, control variable "TEMPandHUMRAT" (Jan 2004)
    6522             :         // Negative MoistureLoad means a dehumidification load
    6523      135667 :         this->SetPt = SupplyAirHumRat;
    6524             :     }
    6525      137211 : }
    6526             : 
    6527     6541635 : void DefineMixedAirSetPointManager::calculate(EnergyPlusData &state)
    6528             : {
    6529             : 
    6530             :     // SUBROUTINE INFORMATION:
    6531             :     //       AUTHOR         Fred Buhl
    6532             :     //       DATE WRITTEN   May 2001
    6533             :     //       MODIFIED       na
    6534             :     //       RE-ENGINEERED  na
    6535             : 
    6536             :     // PURPOSE OF THIS SUBROUTINE:
    6537             :     // Starting with the setpoint at the reference node, subtract the supply fan
    6538             :     // temperature rise and set the resulting temperature at the mixed air node.
    6539             : 
    6540             :     // METHODOLOGY EMPLOYED:
    6541             :     // na
    6542             : 
    6543             :     // REFERENCES:
    6544             :     // na
    6545             : 
    6546             :     // Using/Aliasing
    6547             :     using EMSManager::CheckIfNodeSetPointManagedByEMS;
    6548             : 
    6549             :     // Locals
    6550             :     // SUBROUTINE ARGUMENT DEFINITIONS:
    6551             : 
    6552             :     // SUBROUTINE PARAMETER DEFINITIONS:
    6553             : 
    6554             :     // INTERFACE BLOCK SPECIFICATIONS
    6555             : 
    6556             :     // DERIVED TYPE DEFINITIONS
    6557             :     // na
    6558             : 
    6559             :     // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    6560             :     int FanInNode;       // supply fan inlet node number
    6561             :     int FanOutNode;      // supply fan outlet node number
    6562             :     int RefNode;         // setpoint reference node number
    6563             :     int CoolCoilInNode;  // Cooling coil inlet node number
    6564             :     int CoolCoilOutNode; // Cooling coil outlet node number
    6565             :     Real64 MinTemp;      // Minimum temperature at cooling coil outlet node
    6566             :     Real64 dtFan;        // Temperature difference across a fan
    6567             :     Real64 dtCoolCoil;   // Temperature difference across a coolig coil
    6568             : 
    6569     6541635 :     FanInNode = this->FanInNode;
    6570     6541635 :     FanOutNode = this->FanOutNode;
    6571     6541635 :     RefNode = this->RefNode;
    6572     6541635 :     CoolCoilInNode = this->CoolCoilInNode;
    6573     6541635 :     CoolCoilOutNode = this->CoolCoilOutNode;
    6574     6541635 :     MinTemp = this->MinCoolCoilOutTemp;
    6575     6541635 :     this->FreezeCheckEnable = false;
    6576             : 
    6577     6541635 :     if (!state.dataGlobal->SysSizingCalc && this->MySetPointCheckFlag) {
    6578             : 
    6579        1574 :         RefNode = this->RefNode;
    6580        1574 :         if (state.dataLoopNodes->Node(RefNode).TempSetPoint == SensedNodeFlagValue) {
    6581           0 :             if (!state.dataGlobal->AnyEnergyManagementSystemInModel) {
    6582           0 :                 ShowSevereError(state, "CalcMixedAirSetPoint: Missing reference temperature setpoint for Mixed Air Setpoint Manager " + this->Name);
    6583           0 :                 ShowContinueError(state, "Node Referenced =" + state.dataLoopNodes->NodeID(RefNode));
    6584           0 :                 ShowContinueError(
    6585             :                     state, "  use an additional Setpoint Manager with Control Variable = \"Temperature\" to establish a setpoint at this node.");
    6586           0 :                 state.dataHVACGlobal->SetPointErrorFlag = true;
    6587             :             } else {
    6588             :                 // need call to check if this is the target of an EnergyManagementSystem:Actuator object
    6589           0 :                 CheckIfNodeSetPointManagedByEMS(
    6590           0 :                     state, RefNode, EMSManager::SPControlType::TemperatureSetPoint, state.dataHVACGlobal->SetPointErrorFlag);
    6591           0 :                 if (state.dataHVACGlobal->SetPointErrorFlag) {
    6592           0 :                     ShowSevereError(state,
    6593           0 :                                     "CalcMixedAirSetPoint: Missing reference temperature setpoint for Mixed Air Setpoint Manager " + this->Name);
    6594           0 :                     ShowContinueError(state, "Node Referenced =" + state.dataLoopNodes->NodeID(RefNode));
    6595           0 :                     ShowContinueError(
    6596             :                         state, "  use an additional Setpoint Manager with Control Variable = \"Temperature\" to establish a setpoint at this node.");
    6597           0 :                     ShowContinueError(state, "Or add EMS Actuator to provide temperature setpoint at this node");
    6598             :                 }
    6599             :             }
    6600             :         }
    6601             : 
    6602        1574 :         this->MySetPointCheckFlag = false;
    6603             :     }
    6604             : 
    6605     6541635 :     this->SetPt =
    6606     6541635 :         state.dataLoopNodes->Node(RefNode).TempSetPoint - (state.dataLoopNodes->Node(FanOutNode).Temp - state.dataLoopNodes->Node(FanInNode).Temp);
    6607     6541635 :     if (CoolCoilInNode > 0 && CoolCoilOutNode > 0) {
    6608        2057 :         dtFan = state.dataLoopNodes->Node(FanOutNode).Temp - state.dataLoopNodes->Node(FanInNode).Temp;
    6609        2057 :         dtCoolCoil = state.dataLoopNodes->Node(CoolCoilInNode).Temp - state.dataLoopNodes->Node(CoolCoilOutNode).Temp;
    6610        2057 :         if (dtCoolCoil > 0.0 && MinTemp > state.dataEnvrn->OutDryBulbTemp) {
    6611           0 :             this->FreezeCheckEnable = true;
    6612           0 :             if (state.dataLoopNodes->Node(RefNode).Temp == state.dataLoopNodes->Node(CoolCoilOutNode).Temp) { // blow through
    6613           0 :                 this->SetPt = max(state.dataLoopNodes->Node(RefNode).TempSetPoint, MinTemp) - dtFan + dtCoolCoil;
    6614             :             } else {                              // draw through
    6615           0 :                 if (RefNode != CoolCoilOutNode) { // Ref node is outlet node
    6616           0 :                     this->SetPt = max(state.dataLoopNodes->Node(RefNode).TempSetPoint - dtFan, MinTemp) + dtCoolCoil;
    6617             :                 } else {
    6618           0 :                     this->SetPt = max(state.dataLoopNodes->Node(RefNode).TempSetPoint, MinTemp) + dtCoolCoil;
    6619             :                 }
    6620             :             }
    6621             :         }
    6622             :     }
    6623     6541635 : }
    6624             : 
    6625       22767 : void DefineOAPretreatSetPointManager::calculate(EnergyPlusData &state)
    6626             : {
    6627             : 
    6628             :     // SUBROUTINE INFORMATION:
    6629             :     //       AUTHOR         M. J. Witte based on CalcMixedAirSetPoint by Fred Buhl,
    6630             :     //                        Work supported by ASHRAE research project 1254-RP
    6631             :     //       DATE WRITTEN   January 2005
    6632             :     //       MODIFIED       Witte (GARD), Sep 2006
    6633             :     //                      Griffith( NREL), May 2009, added EMS setpoint checks
    6634             :     //       RE-ENGINEERED  na
    6635             : 
    6636             :     // PURPOSE OF THIS SUBROUTINE:
    6637             :     // Starting with the setpoint at the reference node, determine the required
    6638             :     // outside air inlet conditions which when mixed with return air result in
    6639             :     // the reference setpoint at the mixed air node.
    6640             :     // (based on CalcMixedAirSetPoint)
    6641             : 
    6642             :     // METHODOLOGY EMPLOYED:
    6643             :     // na
    6644             : 
    6645             :     // REFERENCES:
    6646             :     // na
    6647             : 
    6648             :     // Using/Aliasing
    6649             :     using EMSManager::CheckIfNodeSetPointManagedByEMS;
    6650             : 
    6651             :     // Locals
    6652             :     // SUBROUTINE ARGUMENT DEFINITIONS:
    6653             : 
    6654             :     // SUBROUTINE PARAMETER DEFINITIONS:
    6655             : 
    6656             :     // INTERFACE BLOCK SPECIFICATIONS
    6657             : 
    6658             :     // DERIVED TYPE DEFINITIONS
    6659             :     // na
    6660             : 
    6661             :     // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    6662             :     int RefNode;                // setpoint reference node number
    6663             :     int MixedOutNode;           // mixed air outlet node number
    6664             :     int OAInNode;               // outside air inlet node number
    6665             :     int ReturnInNode;           // return air inlet node number
    6666             :     Real64 OAFraction;          // outside air fraction of mixed flow rate
    6667       22767 :     Real64 ReturnInValue = 0;   // return air inlet node mass flow rate
    6668       22767 :     Real64 RefNodeSetPoint = 0; // setpoint at reference node
    6669       22767 :     Real64 MinSetPoint = 0;     // minimum allowed setpoint
    6670       22767 :     Real64 MaxSetPoint = 0;     // maximum allowed setpoint
    6671             :     bool HumiditySetPoint;      // logical to indicate if this is a humidity setpoint
    6672             : 
    6673       22767 :     RefNode = this->RefNode;
    6674       22767 :     MixedOutNode = this->MixedOutNode;
    6675       22767 :     OAInNode = this->OAInNode;
    6676       22767 :     ReturnInNode = this->ReturnInNode;
    6677       22767 :     HumiditySetPoint = false;
    6678             : 
    6679       22767 :     switch (this->CtrlTypeMode) {
    6680       11459 :     case CtrlVarType::Temp: { // 'Temperature'
    6681       11459 :         RefNodeSetPoint = state.dataLoopNodes->Node(RefNode).TempSetPoint;
    6682       11459 :         ReturnInValue = state.dataLoopNodes->Node(ReturnInNode).Temp;
    6683       11459 :         MinSetPoint = this->MinSetTemp;
    6684       11459 :         MaxSetPoint = this->MaxSetTemp;
    6685       11459 :     } break;
    6686       11308 :     case CtrlVarType::MaxHumRat: { // 'HUMRATMAX'
    6687       11308 :         RefNodeSetPoint = state.dataLoopNodes->Node(RefNode).HumRatMax;
    6688       11308 :         ReturnInValue = state.dataLoopNodes->Node(ReturnInNode).HumRat;
    6689       11308 :         MinSetPoint = this->MinSetHumRat;
    6690       11308 :         MaxSetPoint = this->MaxSetHumRat;
    6691       11308 :         HumiditySetPoint = true;
    6692       11308 :     } break;
    6693           0 :     case CtrlVarType::MinHumRat: { // 'HUMRATMIN'
    6694           0 :         RefNodeSetPoint = state.dataLoopNodes->Node(RefNode).HumRatMin;
    6695           0 :         ReturnInValue = state.dataLoopNodes->Node(ReturnInNode).HumRat;
    6696           0 :         MinSetPoint = this->MinSetHumRat;
    6697           0 :         MaxSetPoint = this->MaxSetHumRat;
    6698           0 :         HumiditySetPoint = true;
    6699           0 :     } break;
    6700           0 :     case CtrlVarType::HumRat: { // 'HumidityRatio'
    6701           0 :         RefNodeSetPoint = state.dataLoopNodes->Node(RefNode).HumRatSetPoint;
    6702           0 :         ReturnInValue = state.dataLoopNodes->Node(ReturnInNode).HumRat;
    6703           0 :         MinSetPoint = this->MinSetHumRat;
    6704           0 :         MaxSetPoint = this->MaxSetHumRat;
    6705           0 :         HumiditySetPoint = true;
    6706           0 :     } break;
    6707           0 :     default:
    6708           0 :         break;
    6709             :     }
    6710             : 
    6711       22767 :     if (!state.dataGlobal->SysSizingCalc && this->MySetPointCheckFlag) {
    6712           9 :         this->MySetPointCheckFlag = false;
    6713           9 :         if (RefNodeSetPoint == SensedNodeFlagValue) {
    6714           0 :             if (!state.dataGlobal->AnyEnergyManagementSystemInModel) {
    6715           0 :                 ShowSevereError(state, "CalcOAPretreatSetPoint: Missing reference setpoint for Outdoor Air Pretreat Setpoint Manager " + this->Name);
    6716           0 :                 ShowContinueError(state, "Node Referenced =" + state.dataLoopNodes->NodeID(RefNode));
    6717           0 :                 ShowContinueError(state, "use a Setpoint Manager to establish a setpoint at this node.");
    6718           0 :                 ShowFatalError(state, "Missing reference setpoint.");
    6719             :             } else {
    6720           0 :                 bool LocalSetPointCheckFailed = false;
    6721           0 :                 switch (this->CtrlTypeMode) {
    6722           0 :                 case CtrlVarType::Temp: { // 'Temperature'
    6723           0 :                     CheckIfNodeSetPointManagedByEMS(state, RefNode, EMSManager::SPControlType::TemperatureSetPoint, LocalSetPointCheckFailed);
    6724           0 :                 } break;
    6725           0 :                 case CtrlVarType::MaxHumRat: { // 'HUMRATMAX'
    6726           0 :                     CheckIfNodeSetPointManagedByEMS(state, RefNode, EMSManager::SPControlType::HumidityRatioMaxSetPoint, LocalSetPointCheckFailed);
    6727           0 :                 } break;
    6728           0 :                 case CtrlVarType::MinHumRat: { // 'HUMRATMIN'
    6729           0 :                     CheckIfNodeSetPointManagedByEMS(state, RefNode, EMSManager::SPControlType::HumidityRatioMinSetPoint, LocalSetPointCheckFailed);
    6730           0 :                 } break;
    6731           0 :                 case CtrlVarType::HumRat: { // 'HumidityRatio'
    6732           0 :                     CheckIfNodeSetPointManagedByEMS(state, RefNode, EMSManager::SPControlType::HumidityRatioSetPoint, LocalSetPointCheckFailed);
    6733           0 :                 } break;
    6734           0 :                 default:
    6735           0 :                     break;
    6736             :                 }
    6737           0 :                 if (LocalSetPointCheckFailed) {
    6738           0 :                     ShowSevereError(state,
    6739           0 :                                     "CalcOAPretreatSetPoint: Missing reference setpoint for Outdoor Air Pretreat Setpoint Manager " + this->Name);
    6740           0 :                     ShowContinueError(state, "Node Referenced =" + state.dataLoopNodes->NodeID(RefNode));
    6741           0 :                     ShowContinueError(state, "use a Setpoint Manager to establish a setpoint at this node.");
    6742           0 :                     ShowContinueError(state, "Or use an EMS actuator to control a setpoint at this node.");
    6743           0 :                     ShowFatalError(state, "Missing reference setpoint.");
    6744             :                 }
    6745             :             }
    6746             :         }
    6747             :     }
    6748       22767 :     if ((state.dataLoopNodes->Node(MixedOutNode).MassFlowRate <= 0.0) || (state.dataLoopNodes->Node(OAInNode).MassFlowRate <= 0.0)) {
    6749         109 :         this->SetPt = RefNodeSetPoint;
    6750       22658 :     } else if (HumiditySetPoint && (RefNodeSetPoint == 0.0)) {
    6751             :         // For humidity setpoints, zero is special meaning "off" or "no load"
    6752             :         // so pass through zero setpoints without enforcing the max/min setpoint limits
    6753           0 :         this->SetPt = 0.0;
    6754             :     } else {
    6755       22658 :         OAFraction = state.dataLoopNodes->Node(OAInNode).MassFlowRate / state.dataLoopNodes->Node(MixedOutNode).MassFlowRate;
    6756       22658 :         this->SetPt = ReturnInValue + (RefNodeSetPoint - ReturnInValue) / OAFraction;
    6757             :         // Apply maximum and minimum values
    6758       22658 :         this->SetPt = max(this->SetPt, MinSetPoint);
    6759       22658 :         this->SetPt = min(this->SetPt, MaxSetPoint);
    6760             :     }
    6761       22767 : }
    6762             : 
    6763       45630 : void DefineWarmestSetPointManager::calculate(EnergyPlusData &state)
    6764             : {
    6765             : 
    6766             :     // SUBROUTINE INFORMATION:
    6767             :     //       AUTHOR         Fred Buhl
    6768             :     //       DATE WRITTEN   May 2002
    6769             : 
    6770             :     // PURPOSE OF THIS SUBROUTINE:
    6771             :     // Calculate the "warmest" supply air setpoint temperature that will satisfy the cooling
    6772             :     // requirements of all the zones served by a central air system.
    6773             : 
    6774             :     // METHODOLOGY EMPLOYED:
    6775             :     // Zone sensible heat balance
    6776             : 
    6777             :     // Using/Aliasing
    6778             :     using DataHVACGlobals::SmallLoad;
    6779             :     using DataHVACGlobals::SmallMassFlow;
    6780             : 
    6781             :     // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    6782             :     Real64 ZoneLoad;         // required zone load [W]
    6783             :     Real64 ZoneMassFlowMax;  // zone inlet maximum mass flow rate [kg/s]
    6784             :     Real64 CpAir;            // inlet air specific heat [J/kg-C]
    6785             :     int AirLoopNum;          // the index of the air loop served by this setpoint manager
    6786             :     Real64 TotCoolLoad;      // sum of the zone cooling loads for this air loop [W]
    6787             :     int ZonesCooledIndex;    // DO loop index for zones cooled by the air loop
    6788             :     Real64 ZoneTemp;         // zone temperature [C]
    6789             :     Real64 ZoneSetPointTemp; // zone supply air temperature [C]
    6790             :     Real64 SetPointTemp;     // the system setpoint temperature [C]
    6791             : 
    6792       45630 :     AirLoopNum = this->AirLoopNum;
    6793       45630 :     TotCoolLoad = 0.0;
    6794       45630 :     SetPointTemp = this->MaxSetTemp;
    6795             : 
    6796      241680 :     for (ZonesCooledIndex = 1; ZonesCooledIndex <= state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).NumZonesCooled; ++ZonesCooledIndex) {
    6797      196050 :         int CtrlZoneNum = state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).CoolCtrlZoneNums(ZonesCooledIndex);
    6798      196050 :         int ZoneInletNode = state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).CoolZoneInletNodes(ZonesCooledIndex);
    6799      196050 :         int ZoneNode = state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum).ZoneNode;
    6800      196050 :         ZoneMassFlowMax = state.dataLoopNodes->Node(ZoneInletNode).MassFlowRateMax;
    6801      196050 :         ZoneLoad = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(CtrlZoneNum).TotalOutputRequired;
    6802      196050 :         ZoneTemp = state.dataLoopNodes->Node(ZoneNode).Temp;
    6803      196050 :         ZoneSetPointTemp = this->MaxSetTemp;
    6804      196050 :         if (ZoneLoad < 0.0) {
    6805       65033 :             TotCoolLoad += std::abs(ZoneLoad);
    6806       65033 :             CpAir = PsyCpAirFnW(state.dataLoopNodes->Node(ZoneInletNode).HumRat);
    6807       65033 :             if (ZoneMassFlowMax > SmallMassFlow) {
    6808       65033 :                 ZoneSetPointTemp = ZoneTemp + ZoneLoad / (CpAir * ZoneMassFlowMax);
    6809             :             }
    6810             :         }
    6811      196050 :         SetPointTemp = min(SetPointTemp, ZoneSetPointTemp);
    6812             :     }
    6813             : 
    6814       45630 :     SetPointTemp = max(this->MinSetTemp, min(SetPointTemp, this->MaxSetTemp));
    6815       45630 :     if (TotCoolLoad < SmallLoad) {
    6816       24000 :         SetPointTemp = this->MaxSetTemp;
    6817             :     }
    6818             : 
    6819       45630 :     this->SetPt = SetPointTemp;
    6820       45630 : }
    6821             : 
    6822        2715 : void DefineColdestSetPointManager::calculate(EnergyPlusData &state)
    6823             : {
    6824             : 
    6825             :     // SUBROUTINE INFORMATION:
    6826             :     //       AUTHOR         Fred Buhl
    6827             :     //       DATE WRITTEN   May 2002
    6828             :     //       MODIFIED       na
    6829             :     //       RE-ENGINEERED  na
    6830             : 
    6831             :     // PURPOSE OF THIS SUBROUTINE:
    6832             :     // Calculate the "coldest" supply air setpoint temperature that will satisfy the heating
    6833             :     // requirements of all the zones served by a central air system.
    6834             : 
    6835             :     // METHODOLOGY EMPLOYED:
    6836             :     // Zone sensible heat balance
    6837             : 
    6838             :     // Using/Aliasing
    6839             :     using DataHVACGlobals::SmallLoad;
    6840             :     using DataHVACGlobals::SmallMassFlow;
    6841             : 
    6842             :     // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    6843             :     Real64 ZoneLoad;         // required zone load [W]
    6844             :     Real64 ZoneMassFlowMax;  // zone inlet maximum mass flow rate [kg/s]
    6845             :     Real64 CpAir;            // inlet air specific heat [J/kg-C]
    6846             :     int AirLoopNum;          // the index of the air loop served by this setpoint manager
    6847             :     Real64 TotHeatLoad;      // sum of the zone heating loads for this air loop [W]
    6848             :     Real64 ZoneTemp;         // zone temperature [C]
    6849             :     Real64 ZoneSetPointTemp; // zone supply air temperature [C]
    6850             :     Real64 SetPointTemp;     // the system setpoint temperature [C]
    6851             : 
    6852        2715 :     AirLoopNum = this->AirLoopNum;
    6853        2715 :     TotHeatLoad = 0.0;
    6854        2715 :     SetPointTemp = this->MinSetTemp;
    6855             : 
    6856        2715 :     if (state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).NumZonesHeated > 0) {
    6857             :         // dual-duct heated only zones
    6858       10860 :         for (int ZonesHeatedIndex = 1; ZonesHeatedIndex <= state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).NumZonesHeated; ++ZonesHeatedIndex) {
    6859        8145 :             int CtrlZoneNum = state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).HeatCtrlZoneNums(ZonesHeatedIndex);
    6860        8145 :             int ZoneInletNode = state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).HeatZoneInletNodes(ZonesHeatedIndex);
    6861        8145 :             int ZoneNode = state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum).ZoneNode;
    6862        8145 :             ZoneMassFlowMax = state.dataLoopNodes->Node(ZoneInletNode).MassFlowRateMax;
    6863        8145 :             ZoneLoad = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(CtrlZoneNum).TotalOutputRequired;
    6864        8145 :             ZoneTemp = state.dataLoopNodes->Node(ZoneNode).Temp;
    6865        8145 :             ZoneSetPointTemp = this->MinSetTemp;
    6866        8145 :             if (ZoneLoad > 0.0) {
    6867        4064 :                 TotHeatLoad += ZoneLoad;
    6868        4064 :                 CpAir = PsyCpAirFnW(state.dataLoopNodes->Node(ZoneInletNode).HumRat);
    6869        4064 :                 if (ZoneMassFlowMax > SmallMassFlow) {
    6870        4064 :                     ZoneSetPointTemp = ZoneTemp + ZoneLoad / (CpAir * ZoneMassFlowMax);
    6871             :                 }
    6872             :             }
    6873        8145 :             SetPointTemp = max(SetPointTemp, ZoneSetPointTemp);
    6874             :         }
    6875             :     } else {
    6876             :         // single-duct or central heated and cooled zones
    6877           0 :         for (int ZonesHeatedIndex = 1; ZonesHeatedIndex <= state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).NumZonesCooled; ++ZonesHeatedIndex) {
    6878           0 :             int CtrlZoneNum = state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).CoolCtrlZoneNums(ZonesHeatedIndex);
    6879           0 :             int ZoneInletNode = state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).CoolZoneInletNodes(ZonesHeatedIndex);
    6880           0 :             int ZoneNode = state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum).ZoneNode;
    6881           0 :             ZoneMassFlowMax = state.dataLoopNodes->Node(ZoneInletNode).MassFlowRateMax;
    6882           0 :             ZoneLoad = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(CtrlZoneNum).TotalOutputRequired;
    6883           0 :             ZoneTemp = state.dataLoopNodes->Node(ZoneNode).Temp;
    6884           0 :             ZoneSetPointTemp = this->MinSetTemp;
    6885           0 :             if (ZoneLoad > 0.0) {
    6886           0 :                 TotHeatLoad += ZoneLoad;
    6887           0 :                 CpAir = PsyCpAirFnW(state.dataLoopNodes->Node(ZoneInletNode).HumRat);
    6888           0 :                 if (ZoneMassFlowMax > SmallMassFlow) {
    6889           0 :                     ZoneSetPointTemp = ZoneTemp + ZoneLoad / (CpAir * ZoneMassFlowMax);
    6890             :                 }
    6891             :             }
    6892           0 :             SetPointTemp = max(SetPointTemp, ZoneSetPointTemp);
    6893             :         }
    6894             :     }
    6895             : 
    6896        2715 :     SetPointTemp = min(this->MaxSetTemp, max(SetPointTemp, this->MinSetTemp));
    6897        2715 :     if (TotHeatLoad < SmallLoad) {
    6898        1309 :         SetPointTemp = this->MinSetTemp;
    6899             :     }
    6900             : 
    6901        2715 :     this->SetPt = SetPointTemp;
    6902        2715 : }
    6903             : 
    6904        6884 : void DefWarmestSetPtManagerTempFlow::calculate(EnergyPlusData &state)
    6905             : {
    6906             : 
    6907             :     // SUBROUTINE INFORMATION:
    6908             :     //       AUTHOR         Fred Buhl
    6909             :     //       DATE WRITTEN   May 2002
    6910             :     //       MODIFIED       Haves, Oct 2004
    6911             :     //       RE-ENGINEERED  na
    6912             : 
    6913             :     // PURPOSE OF THIS SUBROUTINE:
    6914             :     // Calculate the "warmest" supply air setpoint temperature that will satisfy the cooling
    6915             :     // requirements of all the zones served by a central air system.
    6916             : 
    6917             :     // METHODOLOGY EMPLOYED:
    6918             :     // Zone sensible heat balance
    6919             : 
    6920             :     // Using/Aliasing
    6921             :     using DataHVACGlobals::SmallLoad;
    6922             :     using DataHVACGlobals::SmallMassFlow;
    6923             : 
    6924             :     // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    6925             :     Real64 ZoneLoad;         // required zone load [W]
    6926             :     Real64 ZoneMassFlowMax;  // zone inlet maximum mass flow rate [kg/s]
    6927             :     Real64 CpAir;            // inlet air specific heat [J/kg-C]
    6928             :     int AirLoopNum;          // the index of the air loop served by this setpoint manager
    6929             :     Real64 TotCoolLoad;      // sum of the zone cooling loads for this air loop [W]
    6930             :     Real64 ZoneTemp;         // zone temperature [C]
    6931             :     Real64 ZoneSetPointTemp; // zone supply air temperature [C]
    6932             :     Real64 SetPointTemp;     // the system setpoint temperature [C]
    6933             :     Real64 MinFracFlow;
    6934             :     Real64 ZoneFracFlow;
    6935             :     Real64 FracFlow;
    6936             :     Real64 MaxSetPointTemp;
    6937             :     Real64 MinSetPointTemp;
    6938             :     int CritZoneNumTemp;
    6939             :     int CritZoneNumFlow;
    6940             : 
    6941        6884 :     if (!this->SimReady) return;
    6942        6884 :     AirLoopNum = this->AirLoopNum;
    6943        6884 :     TotCoolLoad = 0.0;
    6944        6884 :     MaxSetPointTemp = this->MaxSetTemp;
    6945        6884 :     SetPointTemp = MaxSetPointTemp;
    6946        6884 :     MinSetPointTemp = this->MinSetTemp;
    6947        6884 :     MinFracFlow = this->MinTurndown;
    6948        6884 :     FracFlow = MinFracFlow;
    6949        6884 :     CritZoneNumTemp = 0;
    6950        6884 :     CritZoneNumFlow = 0;
    6951             : 
    6952       34680 :     for (int ZonesCooledIndex = 1; ZonesCooledIndex <= state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).NumZonesCooled; ++ZonesCooledIndex) {
    6953       27796 :         int CtrlZoneNum = state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).CoolCtrlZoneNums(ZonesCooledIndex);
    6954       27796 :         int ZoneInletNode = state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).CoolZoneInletNodes(ZonesCooledIndex);
    6955       27796 :         int ZoneNode = state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum).ZoneNode;
    6956       27796 :         ZoneMassFlowMax = state.dataLoopNodes->Node(ZoneInletNode).MassFlowRateMax;
    6957       27796 :         ZoneLoad = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(CtrlZoneNum).TotalOutputRequired;
    6958       27796 :         ZoneTemp = state.dataLoopNodes->Node(ZoneNode).Temp;
    6959       27796 :         ZoneSetPointTemp = MaxSetPointTemp;
    6960       27796 :         ZoneFracFlow = MinFracFlow;
    6961       27796 :         if (ZoneLoad < 0.0) {
    6962        6385 :             TotCoolLoad += std::abs(ZoneLoad);
    6963        6385 :             CpAir = PsyCpAirFnW(state.dataLoopNodes->Node(ZoneInletNode).HumRat);
    6964        6385 :             if (ZoneMassFlowMax > SmallMassFlow) {
    6965        6385 :                 if (this->Strategy == ControlStrategy::TempFirst) {
    6966             :                     // First find supply air temperature required to meet the load at minimum flow. If this is
    6967             :                     // below the minimum supply air temperature, calculate the fractional flow rate required to meet the
    6968             :                     // load at the minimum supply air temperature.
    6969        6385 :                     ZoneSetPointTemp = ZoneTemp + ZoneLoad / (CpAir * ZoneMassFlowMax * MinFracFlow);
    6970        6385 :                     if (ZoneSetPointTemp < MinSetPointTemp) {
    6971        4731 :                         ZoneFracFlow = (ZoneLoad / (CpAir * (MinSetPointTemp - ZoneTemp))) / ZoneMassFlowMax;
    6972             :                     } else {
    6973        1654 :                         ZoneFracFlow = MinFracFlow;
    6974             :                     }
    6975             :                 } else { // ControlStrategy = FlowFirst
    6976             :                     // First find supply air flow rate required to meet the load at maximum supply air temperature. If this
    6977             :                     // is above the maximum supply air flow rate, calculate the supply air temperature required to meet the
    6978             :                     // load at the maximum flow.
    6979           0 :                     ZoneFracFlow = (ZoneLoad / (CpAir * (MaxSetPointTemp - ZoneTemp))) / ZoneMassFlowMax;
    6980           0 :                     if (ZoneFracFlow > 1.0 || ZoneFracFlow < 0.0) {
    6981           0 :                         ZoneSetPointTemp = ZoneTemp + ZoneLoad / (CpAir * ZoneMassFlowMax);
    6982             :                     } else {
    6983           0 :                         ZoneSetPointTemp = MaxSetPointTemp;
    6984             :                     }
    6985             :                 }
    6986             :             }
    6987             :         }
    6988       27796 :         if (ZoneSetPointTemp < SetPointTemp) {
    6989        2733 :             SetPointTemp = ZoneSetPointTemp;
    6990        2733 :             CritZoneNumTemp = CtrlZoneNum;
    6991             :         }
    6992       27796 :         if (ZoneFracFlow > FracFlow) {
    6993        2433 :             FracFlow = ZoneFracFlow;
    6994        2433 :             CritZoneNumFlow = CtrlZoneNum;
    6995             :         }
    6996             :     }
    6997             : 
    6998        6884 :     SetPointTemp = max(MinSetPointTemp, min(SetPointTemp, MaxSetPointTemp));
    6999        6884 :     FracFlow = max(MinFracFlow, min(FracFlow, 1.0));
    7000        6884 :     if (TotCoolLoad < SmallLoad) {
    7001        4561 :         SetPointTemp = MaxSetPointTemp;
    7002        4561 :         FracFlow = MinFracFlow;
    7003             :     }
    7004             : 
    7005        6884 :     this->SetPt = SetPointTemp;
    7006        6884 :     this->Turndown = FracFlow;
    7007        6884 :     if (this->Strategy == ControlStrategy::TempFirst) {
    7008        6884 :         if (CritZoneNumFlow != 0) {
    7009        1794 :             this->CritZoneNum = CritZoneNumFlow;
    7010             :         } else {
    7011        5090 :             this->CritZoneNum = CritZoneNumTemp;
    7012             :         }
    7013             :     } else { // ControlStrategy = FlowFirst
    7014           0 :         if (CritZoneNumTemp != 0) {
    7015           0 :             this->CritZoneNum = CritZoneNumTemp;
    7016             :         } else {
    7017           0 :             this->CritZoneNum = CritZoneNumFlow;
    7018             :         }
    7019             :     }
    7020             : }
    7021             : 
    7022        2005 : void DefRABFlowSetPointManager::calculate(EnergyPlusData &state)
    7023             : {
    7024             : 
    7025             :     // SUBROUTINE INFORMATION:
    7026             :     //       AUTHOR         Fred Buhl
    7027             :     //       DATE WRITTEN   July 2005
    7028             :     //       MODIFIED       na
    7029             :     //       RE-ENGINEERED  na
    7030             : 
    7031             :     // PURPOSE OF THIS SUBROUTINE:
    7032             :     // Given the desired setpoint temperature, calulate the flow rate through the
    7033             :     // return asir branch that will deliver the desired temperature at the loop outlet
    7034             :     // node.
    7035             : 
    7036             :     // METHODOLOGY EMPLOYED:
    7037             :     // na
    7038             : 
    7039             :     // REFERENCES:
    7040             :     // na
    7041             : 
    7042             :     // USE STATEMENTS:
    7043             : 
    7044             :     // Locals
    7045             :     // SUBROUTINE ARGUMENT DEFINITIONS:
    7046             : 
    7047             :     // SUBROUTINE PARAMETER DEFINITIONS:
    7048             : 
    7049             :     // INTERFACE BLOCK SPECIFICATIONS
    7050             : 
    7051             :     // DERIVED TYPE DEFINITIONS
    7052             :     // na
    7053             : 
    7054             :     // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    7055             :     int MixerRABInNode;  // Mixer RAB inlet node number
    7056             :     int MixerSupInNode;  // Mixer supply inlet node number
    7057             :     int MixerOutNode;    // Mixer outlet node number
    7058             :     int LoopOutNode;     // loop outlet node number
    7059             :     Real64 TempSetPt;    // the setpoint temperature (from schedule) [C]
    7060             :     Real64 TempSetPtMod; // the setpoint temperature modified for fan heat gain [C]
    7061             :     Real64 SupFlow;      // supply flow rate before mixing [kg/s]
    7062             :     Real64 RABFlow;      // Return Air Bypass flow rate [kg/s]
    7063             :     Real64 TotSupFlow;   // supply air flow after mixing [kg/s]
    7064             :     Real64 TempSup;      // temperature of supply air before mixing [kg/s]
    7065             :     Real64 TempRAB;      // temperature of return bypass air
    7066             : 
    7067        2005 :     MixerRABInNode = this->RABMixInNode;
    7068        2005 :     MixerSupInNode = this->SupMixInNode;
    7069        2005 :     MixerOutNode = this->MixOutNode;
    7070        2005 :     LoopOutNode = this->SysOutNode;
    7071        2005 :     TempSetPt = GetCurrentScheduleValue(state, this->SchedPtr);
    7072        2005 :     TempSetPtMod = TempSetPt - (state.dataLoopNodes->Node(LoopOutNode).Temp - state.dataLoopNodes->Node(MixerOutNode).Temp);
    7073        2005 :     SupFlow = state.dataLoopNodes->Node(MixerSupInNode).MassFlowRate;
    7074        2005 :     TempSup = state.dataLoopNodes->Node(MixerSupInNode).Temp;
    7075        2005 :     TotSupFlow = state.dataLoopNodes->Node(MixerOutNode).MassFlowRate;
    7076        2005 :     TempRAB = state.dataLoopNodes->Node(MixerRABInNode).Temp;
    7077        2005 :     RABFlow = (TotSupFlow * TempSetPtMod - SupFlow * TempSup) / max(TempRAB, 1.0);
    7078        2005 :     RABFlow = min(RABFlow, TotSupFlow);
    7079        2005 :     RABFlow = max(0.0, RABFlow);
    7080        2005 :     this->FlowSetPt = RABFlow;
    7081        2005 : }
    7082             : 
    7083        2700 : void DefMultiZoneAverageHeatingSetPointManager::calculate(EnergyPlusData &state)
    7084             : {
    7085             : 
    7086             :     // SUBROUTINE INFORMATION:
    7087             :     //       AUTHOR         Bereket Nigusse, FSEC
    7088             :     //       DATE WRITTEN   July 2010
    7089             :     //       MODIFIED       na
    7090             :     //       RE-ENGINEERED  na
    7091             : 
    7092             :     // PURPOSE OF THIS SUBROUTINE:
    7093             :     // Calculates the "Average" supply air setpoint temperature that will satisfy the heating
    7094             :     // requirements of multizones served by a central air system.
    7095             : 
    7096             :     // METHODOLOGY EMPLOYED:
    7097             :     // Zone sensible (heating load) heat balance around the zones served by a central air system
    7098             : 
    7099             :     // Using/Aliasing
    7100             :     using DataHVACGlobals::SmallLoad;
    7101             :     using DataHVACGlobals::SmallMassFlow;
    7102             : 
    7103             :     // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    7104             :     Real64 ZoneLoad;                 // zone load predicted to the setpoint [W]
    7105             :     Real64 ZoneMassFlowRate;         // zone inlet node actual mass flow rate lagged by system one time step[kg/s]
    7106             :     Real64 CpAir;                    // inlet air specific heat [J/kg-C]
    7107             :     int AirLoopNum;                  // the index of the air loop served by this setpoint manager
    7108             :     Real64 SumHeatLoad;              // sum of the zone's predicted heating loads for this air loop [W]
    7109             :     Real64 SumProductMdotCpTZoneTot; // sum of the product of zone inlet node actual mass flow rate,
    7110             :     // Cp of air at zone air node and zone air node temperature for
    7111             :     // all zones in the air loop [W]
    7112             :     Real64 SumProductMdotCp; // sum of the product of zone inlet node actual mass flow rate, and
    7113             :     // Cp of air at zone inlet node for all heated zones in the airloop [W/C]
    7114             :     Real64 SumProductMdotCpTot; // sum of the product of zone inlet node actual mass flow rate, and
    7115             :     // Cp of air at zone air node for all zones in the airloop [W/C]
    7116             :     Real64 ZoneAverageTemp; // multizone average zone air node temperature [C]
    7117             :     int ZonesHeatedIndex;   // DO loop index for zones cooled by the air loop
    7118             :     int CtrlZoneNum;        // the controlled zone index
    7119             :     int ZoneInletNode;      // the zone inlet node number
    7120             :     Real64 ZoneTemp;        // zone air node temperature [C]
    7121             :     Real64 SetPointTemp;    // the system setpoint temperature [C]
    7122             :     int ZoneNode;           // the zone node number of the current zone
    7123             : 
    7124        2700 :     SumHeatLoad = 0.0;
    7125        2700 :     ZoneAverageTemp = 0.0;
    7126        2700 :     SumProductMdotCp = 0.0;
    7127        2700 :     SumProductMdotCpTot = 0.0;
    7128        2700 :     SumProductMdotCpTZoneTot = 0.0;
    7129        2700 :     AirLoopNum = this->AirLoopNum;
    7130        2700 :     SetPointTemp = this->MinSetTemp;
    7131             : 
    7132       10800 :     for (ZonesHeatedIndex = 1; ZonesHeatedIndex <= state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).NumZonesCooled; ++ZonesHeatedIndex) {
    7133             :         // DO ZonesHeatedIndex=1,AirToZoneNodeInfo(AirLoopNum)%NumZonesHeated
    7134             :         // Using AirToZoneNodeInfo(AirLoopNum)%Cool* structure variables since they include heating and cooling.
    7135             : 
    7136             :         // The data for number of zones heated is included in the data structure of the variable
    7137             :         // "AirToZoneNodeInfo(AirLoopNum)%NumZonesCooled" for all systems.  The data structure
    7138             :         // "AirToZoneNodeInfo(AirLoopNum)%NumZonesHeated" applies to Dual Duct System only and
    7139             :         // if used will limit the application of this setpoint manager to other systems.  Thus,
    7140             :         // the "AirToZoneNodeInfo(AirLoopNum)%NumZonesCooled" data is used instead.
    7141             : 
    7142        8100 :         CtrlZoneNum = state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).CoolCtrlZoneNums(ZonesHeatedIndex);
    7143        8100 :         ZoneInletNode = state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).CoolZoneInletNodes(ZonesHeatedIndex);
    7144        8100 :         ZoneNode = state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum).ZoneNode;
    7145        8100 :         ZoneMassFlowRate = state.dataLoopNodes->Node(ZoneInletNode).MassFlowRate;
    7146        8100 :         ZoneLoad = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(CtrlZoneNum).TotalOutputRequired;
    7147        8100 :         ZoneTemp = state.dataLoopNodes->Node(ZoneNode).Temp;
    7148        8100 :         CpAir = PsyCpAirFnW(state.dataLoopNodes->Node(ZoneNode).HumRat);
    7149        8100 :         SumProductMdotCpTot += ZoneMassFlowRate * CpAir;
    7150        8100 :         SumProductMdotCpTZoneTot += ZoneMassFlowRate * CpAir * ZoneTemp;
    7151        8100 :         if (ZoneLoad > 0.0) {
    7152        3969 :             CpAir = PsyCpAirFnW(state.dataLoopNodes->Node(ZoneInletNode).HumRat);
    7153        3969 :             SumHeatLoad += ZoneLoad;
    7154        3969 :             SumProductMdotCp += ZoneMassFlowRate * CpAir;
    7155             :         }
    7156             :     }
    7157        2700 :     if (SumProductMdotCpTot > 0.0) ZoneAverageTemp = SumProductMdotCpTZoneTot / SumProductMdotCpTot;
    7158        2700 :     if (SumProductMdotCp > 0.0) SetPointTemp = ZoneAverageTemp + SumHeatLoad / SumProductMdotCp;
    7159             : 
    7160        2700 :     SetPointTemp = min(this->MaxSetTemp, max(SetPointTemp, this->MinSetTemp));
    7161        2700 :     if (SumHeatLoad < SmallLoad) {
    7162        1328 :         SetPointTemp = this->MinSetTemp;
    7163             :     }
    7164        2700 :     this->SetPt = SetPointTemp;
    7165        2700 : }
    7166             : 
    7167        2700 : void DefMultiZoneAverageCoolingSetPointManager::calculate(EnergyPlusData &state)
    7168             : {
    7169             : 
    7170             :     // SUBROUTINE INFORMATION:
    7171             :     //       AUTHOR         Bereket Nigusse, FSEC
    7172             :     //       DATE WRITTEN   July 2010
    7173             :     //       MODIFIED       na
    7174             :     //       RE-ENGINEERED  na
    7175             : 
    7176             :     // PURPOSE OF THIS SUBROUTINE:
    7177             :     // Calculate the "Average" supply air setpoint temperature that will satisfy the cooling
    7178             :     // requirements of all the zones served by a central air system.
    7179             : 
    7180             :     // METHODOLOGY EMPLOYED:
    7181             :     // Zone sensible (cooling load) heat balance around the zones served by a central air system
    7182             : 
    7183             :     // Using/Aliasing
    7184             :     using DataHVACGlobals::SmallLoad;
    7185             :     using DataHVACGlobals::SmallMassFlow;
    7186             : 
    7187             :     // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    7188             :     Real64 ZoneLoad;                 // zone load predicted to the setpoint [W]
    7189             :     Real64 ZoneMassFlowRate;         // zone inlet node actual mass flow rate lagged by system one time step[kg/s]
    7190             :     Real64 CpAir;                    // inlet air specific heat [J/kg-C]
    7191             :     int AirLoopNum;                  // the index of the air loop served by this setpoint manager
    7192             :     Real64 SumCoolLoad;              // sum of the zone cooling loads for this air loop [W]
    7193             :     Real64 SumProductMdotCpTZoneTot; // sum of the product of zone inlet node actual mass flow rate,
    7194             :     // Cp of air at zone air node and zone air node temperature for
    7195             :     // all zones in the air loop [W]
    7196             :     Real64 SumProductMdotCp; // sum of the product of zone inlet node actual mass flow rate, and
    7197             :     // Cp of air at zone inlet node for cooled zones in the airloop [W/C]
    7198             :     Real64 SumProductMdotCpTot; // sum of the product of zone inlet node actual mass flow rate, and
    7199             :     // Cp of air at zone air node for all zones in the airloop [W/C]
    7200             :     Real64 ZoneAverageTemp; // multizone average zone Air node temperature [C]
    7201             :     int ZonesCooledIndex;   // DO loop index for zones cooled by the air loop
    7202             :     int CtrlZoneNum;        // the controlled zone index
    7203             :     int ZoneInletNode;      // the zone inlet node number
    7204             :     Real64 ZoneTemp;        // zone air node temperature [C]
    7205             :     Real64 SetPointTemp;    // the system setpoint temperature [C]
    7206             :     int ZoneNode;           // the zone node number of the current zone
    7207             : 
    7208        2700 :     SumCoolLoad = 0.0;
    7209        2700 :     ZoneAverageTemp = 0.0;
    7210        2700 :     SumProductMdotCp = 0.0;
    7211        2700 :     SumProductMdotCpTot = 0.0;
    7212        2700 :     SumProductMdotCpTZoneTot = 0.0;
    7213        2700 :     AirLoopNum = this->AirLoopNum;
    7214        2700 :     SetPointTemp = this->MaxSetTemp;
    7215             : 
    7216       10800 :     for (ZonesCooledIndex = 1; ZonesCooledIndex <= state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).NumZonesCooled; ++ZonesCooledIndex) {
    7217        8100 :         CtrlZoneNum = state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).CoolCtrlZoneNums(ZonesCooledIndex);
    7218        8100 :         ZoneInletNode = state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).CoolZoneInletNodes(ZonesCooledIndex);
    7219        8100 :         ZoneNode = state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum).ZoneNode;
    7220        8100 :         ZoneMassFlowRate = state.dataLoopNodes->Node(ZoneInletNode).MassFlowRate;
    7221        8100 :         ZoneLoad = state.dataZoneEnergyDemand->ZoneSysEnergyDemand(CtrlZoneNum).TotalOutputRequired;
    7222        8100 :         ZoneTemp = state.dataLoopNodes->Node(ZoneNode).Temp;
    7223        8100 :         CpAir = PsyCpAirFnW(state.dataLoopNodes->Node(ZoneNode).HumRat);
    7224        8100 :         SumProductMdotCpTot += ZoneMassFlowRate * CpAir;
    7225        8100 :         SumProductMdotCpTZoneTot += ZoneMassFlowRate * CpAir * ZoneTemp;
    7226        8100 :         if (ZoneLoad < 0.0) {
    7227        4131 :             CpAir = PsyCpAirFnW(state.dataLoopNodes->Node(ZoneInletNode).HumRat);
    7228        4131 :             SumCoolLoad += ZoneLoad;
    7229        4131 :             SumProductMdotCp += ZoneMassFlowRate * CpAir;
    7230             :         }
    7231             :     }
    7232        2700 :     if (SumProductMdotCpTot > 0.0) ZoneAverageTemp = SumProductMdotCpTZoneTot / SumProductMdotCpTot;
    7233        2700 :     if (SumProductMdotCp > 0.0) SetPointTemp = ZoneAverageTemp + SumCoolLoad / SumProductMdotCp;
    7234             : 
    7235        2700 :     SetPointTemp = max(this->MinSetTemp, min(SetPointTemp, this->MaxSetTemp));
    7236             : 
    7237        2700 :     if (std::abs(SumCoolLoad) < SmallLoad) {
    7238        1258 :         SetPointTemp = this->MaxSetTemp;
    7239             :     }
    7240             : 
    7241        2700 :     this->SetPt = SetPointTemp;
    7242        2700 : }
    7243             : 
    7244        1510 : void DefMultiZoneAverageMinHumSetPointManager::calculate(EnergyPlusData &state)
    7245             : {
    7246             : 
    7247             :     // SUBROUTINE INFORMATION:
    7248             :     //       AUTHOR         Bereket Nigusse, FSEC
    7249             :     //       DATE WRITTEN   July 2010
    7250             :     //       MODIFIED       na
    7251             :     //       RE-ENGINEERED  na
    7252             : 
    7253             :     // PURPOSE OF THIS SUBROUTINE:
    7254             :     // Calculate the "Average" supply air minimum humidity setpoint that will satisfy the minimum
    7255             :     // humidity ratio requirements of multiple zones served by a central air system.
    7256             : 
    7257             :     // METHODOLOGY EMPLOYED:
    7258             :     // Zone latent load balance around the zones served by a central air system
    7259             : 
    7260             :     // Using/Aliasing
    7261             :     using DataHVACGlobals::SmallLoad;
    7262             :     using DataHVACGlobals::SmallMassFlow;
    7263             : 
    7264             :     // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    7265             :     Real64 MoistureLoad;         // zone's moisture load predicted to the setpoint [kgWater/s]
    7266             :     Real64 ZoneMassFlowRate;     // zone inlet node actual mass flow rate lagged by system one time step[kg/s]
    7267             :     int AirLoopNum;              // the index of the air loop served by this setpoint manager
    7268             :     Real64 SumMoistureLoad;      // sum of the zone moisture loads for this air loop [W]
    7269             :     Real64 SumMdot;              // sum of the actual mass flow rate for controlled zones in the air loop [kg/s]
    7270             :     Real64 SumMdotTot;           // sum of the actual mass flow rate for this air loop [kg/s]
    7271             :     Real64 SumProductMdotHumTot; // sum of product of actual mass flow rate at the zone inlet node,
    7272             :     // and humidity ratio at zones air node for all zones in the airloop [kgWater/s]
    7273             :     Real64 AverageZoneHum; // multizone average zone air node humidity ratio of all zones in the air loop [kg/kg]
    7274             :     int ZonesCooledIndex;  // DO loop index for zones cooled by the air loop
    7275             :     int CtrlZoneNum;       // the controlled zone index
    7276             :     int ZoneInletNode;     // the zone inlet node number
    7277             :     Real64 ZoneHum;        // zone air node humidity ratio [kg/kg]
    7278             :     Real64 SetPointHum;    // system setpoint humidity ratio [kg/kg]
    7279             :     int ZoneNode;          // the zone node number of the current zone
    7280             : 
    7281        1510 :     SumMdot = 0.0;
    7282        1510 :     SumMdotTot = 0.0;
    7283        1510 :     AverageZoneHum = 0.0;
    7284        1510 :     SumMoistureLoad = 0.0;
    7285        1510 :     SumProductMdotHumTot = 0.0;
    7286        1510 :     AirLoopNum = this->AirLoopNum;
    7287        1510 :     SetPointHum = this->MinSetHum;
    7288             : 
    7289        9060 :     for (ZonesCooledIndex = 1; ZonesCooledIndex <= state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).NumZonesCooled; ++ZonesCooledIndex) {
    7290        7550 :         CtrlZoneNum = state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).CoolCtrlZoneNums(ZonesCooledIndex);
    7291        7550 :         ZoneInletNode = state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).CoolZoneInletNodes(ZonesCooledIndex);
    7292        7550 :         ZoneNode = state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum).ZoneNode;
    7293        7550 :         ZoneMassFlowRate = state.dataLoopNodes->Node(ZoneInletNode).MassFlowRate;
    7294        7550 :         MoistureLoad = state.dataZoneEnergyDemand->ZoneSysMoistureDemand(CtrlZoneNum).OutputRequiredToHumidifyingSP;
    7295        7550 :         ZoneHum = state.dataLoopNodes->Node(ZoneNode).HumRat;
    7296        7550 :         SumMdotTot += ZoneMassFlowRate;
    7297        7550 :         SumProductMdotHumTot += ZoneMassFlowRate * ZoneHum;
    7298             :         // For humidification the moisture load is positive
    7299        7550 :         if (MoistureLoad > 0.0) {
    7300        2111 :             SumMdot += ZoneMassFlowRate;
    7301        2111 :             SumMoistureLoad += MoistureLoad;
    7302             :         }
    7303             :     }
    7304        1510 :     if (SumMdotTot > SmallMassFlow) AverageZoneHum = SumProductMdotHumTot / SumMdotTot;
    7305        1510 :     if (SumMdot > SmallMassFlow) SetPointHum = max(0.0, AverageZoneHum + SumMoistureLoad / SumMdot);
    7306             : 
    7307        1510 :     SetPointHum = min(this->MaxSetHum, max(SetPointHum, this->MinSetHum));
    7308             : 
    7309        1510 :     this->SetPt = SetPointHum;
    7310        1510 : }
    7311             : 
    7312        1510 : void DefMultiZoneAverageMaxHumSetPointManager::calculate(EnergyPlusData &state)
    7313             : {
    7314             : 
    7315             :     // SUBROUTINE INFORMATION:
    7316             :     //       AUTHOR         Bereket Nigusse, FSEC
    7317             :     //       DATE WRITTEN   July 2010
    7318             :     //       MODIFIED       na
    7319             :     //       RE-ENGINEERED  na
    7320             : 
    7321             :     // PURPOSE OF THIS SUBROUTINE:
    7322             :     // Calculate the "Average" supply air maximum humidity setpoint that will satisfy the maximum
    7323             :     // himudity ratio requirements of multiple zones served by a central air system.
    7324             : 
    7325             :     // METHODOLOGY EMPLOYED:
    7326             :     // Zone latent load balance around the zones served by a central air system
    7327             : 
    7328             :     // Using/Aliasing
    7329             :     using DataHVACGlobals::SmallLoad;
    7330             :     using DataHVACGlobals::SmallMassFlow;
    7331             : 
    7332             :     // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    7333             :     Real64 MoistureLoad;         // zone's moisture load predicted to the setpoint [kgWater/s]
    7334             :     Real64 ZoneMassFlowRate;     // zone inlet node actual mass flow rate lagged by system one time step[kg/s]
    7335             :     int AirLoopNum;              // the index of the air loop served by this setpoint manager
    7336             :     Real64 SumMoistureLoad;      // sum of the zone moisture loads for this air loop [W]
    7337             :     Real64 SumMdot;              // sum of the actual mass flow rate for controlled zones in the air loop [kg/s]
    7338             :     Real64 SumMdotTot;           // sum of the actual mass flow rate for this air loop [kg/s]
    7339             :     Real64 SumProductMdotHumTot; // sum of product of actual mass flow rate at the zone inlet node,
    7340             :     // and humidity ratio at zones air node for all zones in the airloop [kgWater/s]
    7341             :     Real64 AverageZoneHum; // multizone average zone air node humidity ratio of all zones in the air loop [kg/kg]
    7342             :     int ZonesCooledIndex;  // DO loop index for zones cooled by the air loop
    7343             :     int CtrlZoneNum;       // the controlled zone index
    7344             :     int ZoneInletNode;     // the zone inlet node number
    7345             :     Real64 ZoneHum;        // zone air node humidity ratio [kg/kg]
    7346             :     //  REAL(r64)      :: AverageSetPointHum   ! Supply air humidity ratio [kg/kg]
    7347             :     Real64 SetPointHum; // system setpoint humidity ratio [kg/kg]
    7348             :     int ZoneNode;       // the zone node number of the current zone
    7349             : 
    7350        1510 :     SumMdot = 0.0;
    7351        1510 :     SumMdotTot = 0.0;
    7352        1510 :     AverageZoneHum = 0.0;
    7353        1510 :     SumMoistureLoad = 0.0;
    7354        1510 :     SumProductMdotHumTot = 0.0;
    7355        1510 :     AirLoopNum = this->AirLoopNum;
    7356        1510 :     SetPointHum = this->MaxSetHum;
    7357             : 
    7358        9060 :     for (ZonesCooledIndex = 1; ZonesCooledIndex <= state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).NumZonesCooled; ++ZonesCooledIndex) {
    7359        7550 :         CtrlZoneNum = state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).CoolCtrlZoneNums(ZonesCooledIndex);
    7360        7550 :         ZoneInletNode = state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).CoolZoneInletNodes(ZonesCooledIndex);
    7361        7550 :         ZoneNode = state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum).ZoneNode;
    7362        7550 :         ZoneMassFlowRate = state.dataLoopNodes->Node(ZoneInletNode).MassFlowRate;
    7363        7550 :         MoistureLoad = state.dataZoneEnergyDemand->ZoneSysMoistureDemand(CtrlZoneNum).OutputRequiredToDehumidifyingSP;
    7364        7550 :         ZoneHum = state.dataLoopNodes->Node(ZoneNode).HumRat;
    7365        7550 :         SumMdotTot += ZoneMassFlowRate;
    7366        7550 :         SumProductMdotHumTot += ZoneMassFlowRate * ZoneHum;
    7367             :         // For dehumidification the moisture load is negative
    7368        7550 :         if (MoistureLoad < 0.0) {
    7369         500 :             SumMdot += ZoneMassFlowRate;
    7370         500 :             SumMoistureLoad += MoistureLoad;
    7371             :         }
    7372             :     }
    7373        1510 :     if (SumMdotTot > SmallMassFlow) AverageZoneHum = SumProductMdotHumTot / SumMdotTot;
    7374        1510 :     if (SumMdot > SmallMassFlow) SetPointHum = max(0.0, AverageZoneHum + SumMoistureLoad / SumMdot);
    7375             : 
    7376        1510 :     SetPointHum = max(this->MinSetHum, min(SetPointHum, this->MaxSetHum));
    7377        1510 :     this->SetPt = SetPointHum;
    7378        1510 : }
    7379             : 
    7380       15794 : void DefMultiZoneMinHumSetPointManager::calculate(EnergyPlusData &state)
    7381             : {
    7382             : 
    7383             :     // SUBROUTINE INFORMATION:
    7384             :     //       AUTHOR         Bereket Nigusse, FSEC/UCF
    7385             :     //       DATE WRITTEN   Aug 2010
    7386             :     //       MODIFIED       na
    7387             :     //       RE-ENGINEERED  na
    7388             : 
    7389             :     // PURPOSE OF THIS SUBROUTINE:
    7390             :     // Calculates the minimum supply air humidity ratio based on humidification requirements of
    7391             :     // a controlled zone with critical humidification need (i.e., a zone with the highest
    7392             :     // humidity ratio setpoint) in an air loop served by a central air-conditioner.
    7393             :     // METHODOLOGY EMPLOYED:
    7394             :     // Uses moisture mass balance to calculate the humidity ratio setpoint. The algorithm loops
    7395             :     // over all the zones that a central air system can humidify and calculates the setpoint based
    7396             :     // on a zone with the highest humidity ratio setpoint requirement:
    7397             : 
    7398             :     // Using/Aliasing
    7399             :     using DataHVACGlobals::SmallLoad;
    7400             :     using DataHVACGlobals::SmallMassFlow;
    7401             : 
    7402             :     // SUBROUTINE PARAMETER DEFINITIONS:
    7403       15794 :     Real64 constexpr SmallMoistureLoad(0.00001); // small moisture load [kgWater/s]
    7404             : 
    7405             :     // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    7406             :     int AirLoopNum;              // the index of the air loop served by this setpoint manager
    7407             :     int ZonesCooledIndex;        // DO loop index for zones cooled by the air loop
    7408             :     int CtrlZoneNum;             // the controlled zone index
    7409             :     int ZoneInletNode;           // the zone inlet node number
    7410             :     int ZoneNode;                // the zone node number of the current zone
    7411             :     Real64 ZoneHum;              // zone air node humidity ratio [kg/kg]
    7412             :     Real64 SetPointHum;          // system setpoint humidity ratio [kg/kg]
    7413             :     Real64 ZoneSetPointHum;      // Zone setpoint humidity ratio [kg/kg]
    7414             :     Real64 MoistureLoad;         // zone's moisture load predicted to the setpoint [kgWater/s]
    7415             :     Real64 ZoneMassFlowRate;     // zone inlet node actual supply air mass flow rate [kg/s]
    7416       15794 :     Real64 SumMoistureLoad(0.0); // sum of the zone moisture loads for this air loop [W]
    7417             : 
    7418       15794 :     AirLoopNum = this->AirLoopNum;
    7419       15794 :     SetPointHum = this->MinSetHum;
    7420             : 
    7421      190004 :     for (ZonesCooledIndex = 1; ZonesCooledIndex <= state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).NumZonesCooled; ++ZonesCooledIndex) {
    7422      174210 :         CtrlZoneNum = state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).CoolCtrlZoneNums(ZonesCooledIndex);
    7423      174210 :         ZoneInletNode = state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).CoolZoneInletNodes(ZonesCooledIndex);
    7424      174210 :         ZoneNode = state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum).ZoneNode;
    7425      174210 :         ZoneMassFlowRate = state.dataLoopNodes->Node(ZoneInletNode).MassFlowRate;
    7426      174210 :         MoistureLoad = state.dataZoneEnergyDemand->ZoneSysMoistureDemand(CtrlZoneNum).OutputRequiredToHumidifyingSP;
    7427      174210 :         ZoneHum = state.dataLoopNodes->Node(ZoneNode).HumRat;
    7428      174210 :         ZoneSetPointHum = this->MinSetHum;
    7429             :         // For humidification the moisture load is positive
    7430      174210 :         if (MoistureLoad > 0.0) {
    7431       11934 :             SumMoistureLoad += MoistureLoad;
    7432       11934 :             if (ZoneMassFlowRate > SmallMassFlow) {
    7433       11934 :                 ZoneSetPointHum = max(0.0, ZoneHum + MoistureLoad / ZoneMassFlowRate);
    7434             :             }
    7435             :         }
    7436      174210 :         SetPointHum = max(SetPointHum, ZoneSetPointHum);
    7437             :     }
    7438       15794 :     SetPointHum = min(this->MaxSetHum, max(SetPointHum, this->MinSetHum));
    7439       15794 :     if (SumMoistureLoad < SmallMoistureLoad) {
    7440        7284 :         SetPointHum = this->MinSetHum;
    7441             :     }
    7442       15794 :     this->SetPt = SetPointHum;
    7443       15794 : }
    7444             : 
    7445       28338 : void DefMultiZoneMaxHumSetPointManager::calculate(EnergyPlusData &state)
    7446             : {
    7447             : 
    7448             :     // SUBROUTINE INFORMATION:
    7449             :     //       AUTHOR         Bereket Nigusse, FSEC/UCF
    7450             :     //       DATE WRITTEN   August 2010
    7451             :     //       MODIFIED       na
    7452             :     //       RE-ENGINEERED  na
    7453             : 
    7454             :     // PURPOSE OF THIS SUBROUTINE:
    7455             :     // Calculates the maximum supply air humidity ratio based on dehumidification requirements of
    7456             :     // a controlled zone with critical dehumidification need (i.e., a zone with the lowest
    7457             :     // humidity ratio setpoint) in an air loop served by a central air-conditioner.
    7458             : 
    7459             :     // METHODOLOGY EMPLOYED:
    7460             :     // Uses moisture mass balance to calculate the humidity ratio setpoint. The algorithm loops
    7461             :     // over all the zones that a central air system can dehumidify and calculates the setpoint
    7462             :     // based on a zone with the lowest humidity ratio setpoint requirement:
    7463             : 
    7464             :     // Using/Aliasing
    7465             :     using DataHVACGlobals::SmallLoad;
    7466             :     using DataHVACGlobals::SmallMassFlow;
    7467             : 
    7468             :     // SUBROUTINE PARAMETER DEFINITIONS:
    7469       28338 :     Real64 constexpr SmallMoistureLoad(0.00001); // small moisture load [kgWater/s]
    7470             : 
    7471             :     // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    7472             :     int AirLoopNum;              // the index of the air loop served by this setpoint manager
    7473             :     int ZonesCooledIndex;        // DO loop index for zones cooled by the air loop
    7474             :     int CtrlZoneNum;             // the controlled zone index
    7475             :     int ZoneInletNode;           // the zone inlet node number
    7476             :     int ZoneNode;                // the zone node number of the current zone
    7477             :     Real64 ZoneHum;              // zone air node humidity ratio [kg/kg]
    7478             :     Real64 SetPointHum;          // system setpoint humidity ratio [kg/kg]
    7479             :     Real64 ZoneSetPointHum;      // Zone setpoint humidity ratio [kg/kg]
    7480             :     Real64 MoistureLoad;         // zone's moisture load predicted to the setpoint [kgWater/s]
    7481             :     Real64 ZoneMassFlowRate;     // zone inlet node actual supply air mass flow rate [kg/s]
    7482       28338 :     Real64 SumMoistureLoad(0.0); // sum of the zone moisture loads for this air loop [W]
    7483             : 
    7484       28338 :     AirLoopNum = this->AirLoopNum;
    7485       28338 :     SetPointHum = this->MaxSetHum;
    7486             : 
    7487      265268 :     for (ZonesCooledIndex = 1; ZonesCooledIndex <= state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).NumZonesCooled; ++ZonesCooledIndex) {
    7488      236930 :         CtrlZoneNum = state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).CoolCtrlZoneNums(ZonesCooledIndex);
    7489      236930 :         ZoneInletNode = state.dataAirLoop->AirToZoneNodeInfo(AirLoopNum).CoolZoneInletNodes(ZonesCooledIndex);
    7490      236930 :         ZoneNode = state.dataZoneEquip->ZoneEquipConfig(CtrlZoneNum).ZoneNode;
    7491      236930 :         ZoneMassFlowRate = state.dataLoopNodes->Node(ZoneInletNode).MassFlowRate;
    7492      236930 :         MoistureLoad = state.dataZoneEnergyDemand->ZoneSysMoistureDemand(CtrlZoneNum).OutputRequiredToDehumidifyingSP;
    7493      236930 :         ZoneHum = state.dataLoopNodes->Node(ZoneNode).HumRat;
    7494      236930 :         ZoneSetPointHum = this->MaxSetHum;
    7495             : 
    7496             :         // For dehumidification the moisture load is negative
    7497      236930 :         if (MoistureLoad < 0.0) {
    7498       29475 :             SumMoistureLoad += MoistureLoad;
    7499       29475 :             if (ZoneMassFlowRate > SmallMassFlow) {
    7500       24642 :                 ZoneSetPointHum = max(0.0, ZoneHum + MoistureLoad / ZoneMassFlowRate);
    7501             :             }
    7502             :         }
    7503      236930 :         SetPointHum = min(SetPointHum, ZoneSetPointHum);
    7504             :     }
    7505       28338 :     SetPointHum = max(this->MinSetHum, min(SetPointHum, this->MaxSetHum));
    7506             : 
    7507       28338 :     if (std::abs(SumMoistureLoad) < SmallMoistureLoad) {
    7508       21444 :         SetPointHum = this->MaxSetHum;
    7509             :     }
    7510             : 
    7511       28338 :     this->SetPt = SetPointHum;
    7512       28338 : }
    7513             : 
    7514      683731 : void DefineFollowOATempSetPointManager::calculate(EnergyPlusData &state)
    7515             : {
    7516             : 
    7517             :     // SUBROUTINE INFORMATION:
    7518             :     //       AUTHOR         Chandan Sharma, FSEC
    7519             :     //       DATE WRITTEN   July 2011
    7520             :     //       MODIFIED       na
    7521             :     //       RE-ENGINEERED  na
    7522             : 
    7523             :     // PURPOSE OF THIS SUBROUTINE:
    7524             :     // Set the setpoint based on outdoor air dry-bulb/wet-bulb temperature
    7525             : 
    7526             :     // METHODOLOGY EMPLOYED:
    7527             :     // Based on reference temperature type specifed in the setpoint manager,
    7528             :     // the setpoint is calculated as OutWetBulbTemp(Or OutDryBulbTemp) + Offset.
    7529             :     // The sign convention is that a positive Offset will increase the resulting setpoint.
    7530             :     // Final value of the setpoint is limited by the Max and Min limit specified in the setpoint manager.
    7531             : 
    7532             :     // REFERENCES:
    7533             :     // na
    7534             : 
    7535             :     // USE STATEMENTS:
    7536             : 
    7537             :     // Locals
    7538             :     // SUBROUTINE ARGUMENT DEFINITIONS:
    7539             : 
    7540             :     // SUBROUTINE PARAMETER DEFINITIONS:
    7541             : 
    7542             :     // INTERFACE BLOCK SPECIFICATIONS
    7543             : 
    7544             :     // DERIVED TYPE DEFINITIONS
    7545             :     // na
    7546             : 
    7547             :     // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    7548             :     //  INTEGER      :: CtrldNodeNum    ! index of the items in the controlled node list
    7549             :     Real64 MinSetPoint; // minimum allowed setpoint
    7550             :     Real64 MaxSetPoint; // maximum allowed setpoint
    7551             : 
    7552      683731 :     MaxSetPoint = this->MaxSetTemp;
    7553      683731 :     MinSetPoint = this->MinSetTemp;
    7554             : 
    7555      683731 :     switch (this->RefTypeMode) {
    7556      677855 :     case ReferenceTempType::WetBulb: {
    7557      677855 :         this->SetPt = state.dataEnvrn->OutWetBulbTemp + this->Offset;
    7558      677855 :     } break;
    7559        5876 :     case ReferenceTempType::DryBulb: {
    7560        5876 :         this->SetPt = state.dataEnvrn->OutDryBulbTemp + this->Offset;
    7561        5876 :     } break;
    7562           0 :     default:
    7563           0 :         break;
    7564             :     }
    7565             : 
    7566             :     // Apply maximum and minimum values
    7567      683731 :     this->SetPt = max(this->SetPt, MinSetPoint);
    7568      683731 :     this->SetPt = min(this->SetPt, MaxSetPoint);
    7569      683731 : }
    7570             : 
    7571        2933 : void DefineFollowSysNodeTempSetPointManager::calculate(EnergyPlusData &state)
    7572             : {
    7573             : 
    7574             :     // SUBROUTINE INFORMATION:
    7575             :     //       AUTHOR         Chandan Sharma, FSEC
    7576             :     //       DATE WRITTEN   July 2011
    7577             :     //       MODIFIED       na
    7578             :     //       RE-ENGINEERED  na
    7579             : 
    7580             :     // PURPOSE OF THIS SUBROUTINE:
    7581             :     // Set the setpoint based on current temperatures at a separate system node.
    7582             : 
    7583             :     // METHODOLOGY EMPLOYED:
    7584             :     // The current value of the temperature at a reference node are obtained and used
    7585             :     // to generate setpoint on a second system node.  If the reference node is also designated
    7586             :     // to be an outdoor air (intake) node, then this setpoint manager can be used to follow
    7587             :     // outdoor air conditions that are adjusted for altitude.
    7588             :     // Also, based on reference temperature type specifed in the setpoint manager, the out door air wet-bulb
    7589             :     // or dry-bulb temperature at the reference node could be used.
    7590             :     // A temperature offset will be applied to the value obtained from the reference system node.
    7591             :     // If this value is zero, and the limits are met, then the resulting setpoint will be exactly the same
    7592             :     // as the reference system node temperature.  The sign convention is that a positive offset will increase
    7593             :     // the resulting setpoint.
    7594             : 
    7595             :     // REFERENCES:
    7596             :     // na
    7597             : 
    7598             :     // USE STATEMENTS:
    7599             :     // na
    7600             : 
    7601             :     // Locals
    7602             :     // SUBROUTINE ARGUMENT DEFINITIONS:
    7603             : 
    7604             :     // SUBROUTINE PARAMETER DEFINITIONS:
    7605             : 
    7606             :     // INTERFACE BLOCK SPECIFICATIONS
    7607             : 
    7608             :     // DERIVED TYPE DEFINITIONS
    7609             :     // na
    7610             : 
    7611             :     // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    7612             :     int RefNode;        // setpoint reference node number
    7613             :     Real64 RefNodeTemp; // setpoint at reference node
    7614             :     Real64 MinSetPoint; // minimum allowed setpoint
    7615             :     Real64 MaxSetPoint; // maximum allowed setpoint
    7616             : 
    7617        2933 :     RefNodeTemp = 0.0;
    7618             : 
    7619        2933 :     MaxSetPoint = this->MaxSetTemp;
    7620        2933 :     MinSetPoint = this->MinSetTemp;
    7621             : 
    7622        2933 :     RefNode = this->RefNodeNum;
    7623             : 
    7624        2933 :     switch (this->RefTypeMode) {
    7625        2933 :     case ReferenceTempType::WetBulb: {
    7626        2933 :         if (allocated(state.dataLoopNodes->MoreNodeInfo)) {
    7627        2926 :             RefNodeTemp = state.dataLoopNodes->MoreNodeInfo(RefNode).WetBulbTemp;
    7628             :         }
    7629        2933 :     } break;
    7630           0 :     case ReferenceTempType::DryBulb: {
    7631           0 :         RefNodeTemp = state.dataLoopNodes->Node(RefNode).Temp;
    7632           0 :     } break;
    7633           0 :     default:
    7634           0 :         break;
    7635             :     }
    7636             : 
    7637        2933 :     this->SetPt = RefNodeTemp + this->Offset;
    7638             : 
    7639             :     // Apply maximum and minimum values
    7640        2933 :     this->SetPt = max(this->SetPt, MinSetPoint);
    7641        2933 :     this->SetPt = min(this->SetPt, MaxSetPoint);
    7642        2933 : }
    7643             : 
    7644       36250 : void DefineGroundTempSetPointManager::calculate(EnergyPlusData &state)
    7645             : {
    7646             : 
    7647             :     // SUBROUTINE INFORMATION:
    7648             :     //       AUTHOR         Chandan Sharma, FSEC
    7649             :     //       DATE WRITTEN   July 2011
    7650             :     //       MODIFIED       na
    7651             :     //       RE-ENGINEERED  na
    7652             : 
    7653             :     // PURPOSE OF THIS SUBROUTINE:
    7654             :     // Set the setpoint based on current ground temperature
    7655             : 
    7656             :     // METHODOLOGY EMPLOYED:
    7657             :     // Based on reference ground temperature object type specifed in the setpoint manager,
    7658             :     // the setpoint is calculated as GroundTemperature + Offset.
    7659             :     // The sign convention is that a positive Offset will increase the resulting setpoint.
    7660             :     // Final value of the setpoint is limited by the Max and Min limit specified in the setpoint manager.
    7661             : 
    7662             :     // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    7663             :     Real64 MinSetPoint; // minimum allowed setpoint
    7664             :     Real64 MaxSetPoint; // maximum allowed setpoint
    7665             : 
    7666       36250 :     MaxSetPoint = this->MaxSetTemp;
    7667       36250 :     MinSetPoint = this->MinSetTemp;
    7668             : 
    7669       36250 :     switch (this->RefTypeMode) {
    7670           0 :     case ReferenceGroundTempObjectType::BuildingSurface: {
    7671           0 :         this->SetPt = state.dataEnvrn->GroundTemp + this->Offset;
    7672           0 :     } break;
    7673           0 :     case ReferenceGroundTempObjectType::Shallow: {
    7674           0 :         this->SetPt = state.dataEnvrn->GroundTemp_Surface + this->Offset;
    7675           0 :     } break;
    7676       36250 :     case ReferenceGroundTempObjectType::Deep: {
    7677       36250 :         this->SetPt = state.dataEnvrn->GroundTemp_Deep + this->Offset;
    7678       36250 :     } break;
    7679           0 :     case ReferenceGroundTempObjectType::FCFactorMethod: {
    7680           0 :         this->SetPt = state.dataEnvrn->GroundTempFC + this->Offset;
    7681           0 :     } break;
    7682           0 :     default:
    7683           0 :         break;
    7684             :     }
    7685             : 
    7686             :     // Apply maximum and minimum values
    7687       36250 :     this->SetPt = max(this->SetPt, MinSetPoint);
    7688       36250 :     this->SetPt = min(this->SetPt, MaxSetPoint);
    7689       36250 : }
    7690             : 
    7691        5876 : void DefineCondEntSetPointManager::calculate(EnergyPlusData &state)
    7692             : {
    7693             : 
    7694             :     // SUBROUTINE INFORMATION:
    7695             :     //       AUTHOR         Atefe Makhmalbaf and Heejin Cho, PNNL
    7696             :     //       DATE WRITTEN   March 2012
    7697             :     //       MODIFIED       na
    7698             :     //       RE-ENGINEERED  na
    7699             : 
    7700             :     // PURPOSE OF THIS SUBROUTINE:
    7701             :     // Calculate the optimal condenser water temperature set point for a chiller plant
    7702             :     // with one or more chillers.  The condenser water leaving the tower should be at this temperature
    7703             :     // for optimal operation of the chiller plant.
    7704             : 
    7705             :     // METHODOLOGY EMPLOYED:
    7706             :     // using one curve to determine the optimum condenser entering water temperature for a given timestep
    7707             :     // and two other curves to place boundary conditions on the optimal setpoint value.
    7708             : 
    7709             :     // REFERENCES:
    7710             :     // na
    7711             : 
    7712             :     // Using/Aliasing
    7713             :     using Curve::CurveValue;
    7714             :     using ScheduleManager::GetCurrentScheduleValue;
    7715             :     using namespace DataPlant;
    7716             : 
    7717             :     // Locals
    7718             :     // SUBROUTINE ARGUMENT DEFINITIONS:
    7719             : 
    7720             :     // SUBROUTINE PARAMETER DEFINITIONS:
    7721             : 
    7722             :     // INTERFACE BLOCK SPECIFICATIONS
    7723             : 
    7724             :     // DERIVED TYPE DEFINITIONS
    7725             :     // na
    7726             :     // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    7727             :     //////////// hoisted into namespace ////////////////////////////////////////////////
    7728             :     // static Real64 Dsn_EntCondTemp( 0.0 ); // The chiller design entering condenser temp, C; e.g. 29.44C {85F} // DCESPMDsn_EntCondTemp
    7729             :     // static Real64 Dsn_MinCondSetpt( 0.0 ); // The design minimum condenser water temp, C; e.g. 18.33C {65 F} // DCESPMDsn_MinCondSetpt
    7730             :     // static Real64 Cur_MinLiftTD( 0.0 ); // Minimum lift (TCond entering - Tevap leaving) TD this timestep // DCESPMCur_MinLiftTD
    7731             :     // static Real64 Design_Load_Sum( 0.0 ); // the design load of the chillers, W // DCESPMDesign_Load_Sum
    7732             :     // static Real64 Actual_Load_Sum( 0.0 ); // the actual load of the chillers, W // DCESPMActual_Load_Sum
    7733             :     // static Real64 Weighted_Actual_Load_Sum( 0.0 ); // Intermediate weighted value of actual load on plant, W // DCESPMWeighted_Actual_Load_Sum
    7734             :     // static Real64 Weighted_Design_Load_Sum( 0.0 ); // Intermediate weighted value of design load on plant, W // DCESPMWeighted_Design_Load_Sum
    7735             :     // static Real64 Weighted_Ratio( 0.0 ); // Weighted part load ratio of chillers // DCESPMWeighted_Ratio
    7736             :     // static Real64 Min_DesignWB( 0.0 ); // Minimum design twr wet bulb allowed, C // DCESPMMin_DesignWB
    7737             :     // static Real64 Min_ActualWb( 0.0 ); // Minimum actual oa wet bulb allowed, C // DCESPMMin_ActualWb
    7738             :     // static Real64 Opt_CondEntTemp( 0.0 ); // Optimized Condenser entering water temperature setpoint this timestep, C // DCESPMOpt_CondEntTemp
    7739             :     // static Real64 DesignClgCapacity_Watts( 0.0 ); // DCESPMDesignClgCapacity_Watts
    7740             :     // static Real64 CurrentLoad_Watts( 0.0 ); // DCESPMCurrentLoad_Watts
    7741             :     // static Real64 CondInletTemp( 0.0 ); // Condenser water inlet temperature (C) // DCESPMCondInletTemp
    7742             :     // static Real64 EvapOutletTemp( 0.0 ); // Evaporator water outlet temperature (C) // DCESPMEvapOutletTemp
    7743             :     ////////////////////////////////////////////////////////////////////////////////////
    7744        5876 :     Real64 NormDsnCondFlow(0.0);        // Normalized design condenser flow for cooling towers, m3/s per watt
    7745        5876 :     Real64 Twr_DesignWB(0.0);           // The cooling tower design inlet air wet bulb temperature, C
    7746        5876 :     Real64 Dsn_CondMinThisChiller(0.0); // Design Minimum Condenser Entering for current chillers this timestep
    7747        5876 :     Real64 temp_MinLiftTD(0.0);         // Intermediate variable associated with lift (TCond entering - Tevap leaving) TD
    7748        5876 :     Real64 Des_Load(0.0);               // array of chiller design loads
    7749        5876 :     Real64 Act_Load(0.0);               // array of chiller actual loads
    7750        5876 :     Real64 ALW(0.0);                    // Actual load weighting of each chiller, W
    7751        5876 :     Real64 DLW(0.0);                    // Design capacity of each chiller, W
    7752        5876 :     Real64 SetPoint(0.0);               // Condenser entering water temperature setpoint this timestep, C
    7753        5876 :     Real64 CondWaterSetPoint(0.0);      // Condenser entering water temperature setpoint this timestep, C
    7754        5876 :     Real64 TempDesCondIn(0.0);          // Design condenser inlet temp. C , or 25.d0
    7755        5876 :     Real64 TempEvapOutDesign(0.0);      // design evaporator outlet temperature, water side
    7756        5876 :     Real64 CurLoad(0.0);
    7757        5876 :     int ChillerIndexPlantSide(0);
    7758        5876 :     int ChillerIndexDemandSide(0);
    7759        5876 :     int BranchIndexPlantSide(0);
    7760        5876 :     int BranchIndexDemandSide(0);
    7761        5876 :     int LoopIndexPlantSide(0);
    7762        5876 :     int LoopIndexDemandSide(0);
    7763        5876 :     DataPlant::PlantEquipmentType Type(DataPlant::PlantEquipmentType::Invalid);
    7764             : 
    7765             :     // Get from tower design values
    7766        5876 :     NormDsnCondFlow = 5.38e-8; // m3/s per watt (typically 3 gpm/ton)=(Volume of condenser fluid)/(ton of heat rejection)
    7767             : 
    7768             :     // Grab tower design inlet air wet bulb from setpoint manager
    7769        5876 :     Twr_DesignWB = this->TowerDsnInletAirWetBulb;
    7770             : 
    7771             :     // Current timestep's condenser water entering setpoint
    7772        5876 :     CondWaterSetPoint = GetCurrentScheduleValue(state, this->CondEntTempSchedPtr);
    7773        5876 :     LoopIndexPlantSide = this->LoopIndexPlantSide;
    7774        5876 :     ChillerIndexPlantSide = this->ChillerIndexPlantSide;
    7775        5876 :     BranchIndexPlantSide = this->BranchIndexPlantSide;
    7776        5876 :     Type = this->Type;
    7777        5876 :     LoopIndexDemandSide = this->LoopIndexDemandSide;
    7778        5876 :     ChillerIndexDemandSide = this->ChillerIndexDemandSide;
    7779        5876 :     BranchIndexDemandSide = this->BranchIndexDemandSide;
    7780             : 
    7781             :     // If chiller is on
    7782       11752 :     CurLoad = std::abs(state.dataPlnt->PlantLoop(LoopIndexPlantSide)
    7783        5876 :                            .LoopSide(LoopSideLocation::Supply)
    7784        5876 :                            .Branch(BranchIndexPlantSide)
    7785        5876 :                            .Comp(ChillerIndexPlantSide)
    7786             :                            .MyLoad);
    7787        5876 :     if (CurLoad > 0) {
    7788        2439 :         if (Type == PlantEquipmentType::Chiller_Absorption || Type == PlantEquipmentType::Chiller_CombTurbine ||
    7789           0 :             Type == PlantEquipmentType::Chiller_Electric || Type == PlantEquipmentType::Chiller_ElectricReformEIR ||
    7790             :             Type == PlantEquipmentType::Chiller_EngineDriven) {
    7791        4878 :             TempDesCondIn = state.dataPlnt->PlantLoop(LoopIndexPlantSide)
    7792        2439 :                                 .LoopSide(LoopSideLocation::Supply)
    7793        2439 :                                 .Branch(BranchIndexPlantSide)
    7794        2439 :                                 .Comp(ChillerIndexPlantSide)
    7795             :                                 .TempDesCondIn;
    7796        2439 :             state.dataSetPointManager->DCESPMCondInletTemp = state.dataLoopNodes
    7797        4878 :                                                                  ->Node(state.dataPlnt->PlantLoop(LoopIndexDemandSide)
    7798        2439 :                                                                             .LoopSide(LoopSideLocation::Demand)
    7799        2439 :                                                                             .Branch(BranchIndexDemandSide)
    7800        2439 :                                                                             .Comp(ChillerIndexDemandSide)
    7801        4878 :                                                                             .NodeNumIn)
    7802        2439 :                                                                  .Temp;
    7803        2439 :             state.dataSetPointManager->DCESPMEvapOutletTemp = state.dataLoopNodes
    7804        4878 :                                                                   ->Node(state.dataPlnt->PlantLoop(LoopIndexPlantSide)
    7805        2439 :                                                                              .LoopSide(LoopSideLocation::Supply)
    7806        2439 :                                                                              .Branch(BranchIndexPlantSide)
    7807        2439 :                                                                              .Comp(ChillerIndexPlantSide)
    7808        4878 :                                                                              .NodeNumOut)
    7809        2439 :                                                                   .Temp;
    7810        4878 :             TempEvapOutDesign = state.dataPlnt->PlantLoop(LoopIndexPlantSide)
    7811        2439 :                                     .LoopSide(LoopSideLocation::Supply)
    7812        2439 :                                     .Branch(BranchIndexPlantSide)
    7813        2439 :                                     .Comp(ChillerIndexPlantSide)
    7814             :                                     .TempDesEvapOut;
    7815        4878 :             state.dataSetPointManager->DCESPMDesignClgCapacity_Watts = state.dataPlnt->PlantLoop(LoopIndexPlantSide)
    7816        2439 :                                                                            .LoopSide(LoopSideLocation::Supply)
    7817        2439 :                                                                            .Branch(BranchIndexPlantSide)
    7818        2439 :                                                                            .Comp(ChillerIndexPlantSide)
    7819        2439 :                                                                            .MaxLoad;
    7820        2439 :             state.dataSetPointManager->DCESPMCurrentLoad_Watts = state.dataPlnt->PlantLoop(LoopIndexPlantSide).CoolingDemand;
    7821           0 :         } else if (Type == PlantEquipmentType::Chiller_Indirect_Absorption || Type == PlantEquipmentType::Chiller_DFAbsorption) {
    7822           0 :             TempDesCondIn = state.dataPlnt->PlantLoop(LoopIndexPlantSide)
    7823           0 :                                 .LoopSide(LoopSideLocation::Supply)
    7824           0 :                                 .Branch(BranchIndexPlantSide)
    7825           0 :                                 .Comp(ChillerIndexPlantSide)
    7826             :                                 .TempDesCondIn;
    7827           0 :             TempEvapOutDesign = 6.666;
    7828             :         } else {
    7829           0 :             TempDesCondIn = 25.0;
    7830           0 :             TempEvapOutDesign = 6.666;
    7831             :         }
    7832             : 
    7833             :         // for attached chillers (that are running this timestep) find their Dsn_MinCondSetpt and Dsn_EntCondTemp
    7834        2439 :         state.dataSetPointManager->DCESPMDsn_MinCondSetpt = 999.0;
    7835        2439 :         state.dataSetPointManager->DCESPMDsn_EntCondTemp = 0.0;
    7836             : 
    7837             :         // Design Minimum Condenser Entering as a function of the minimum lift and TEvapLvg
    7838             :         // for chillers operating on current cond loop this timestep
    7839        2439 :         Dsn_CondMinThisChiller = TempEvapOutDesign + (this->MinimumLiftTD);
    7840        2439 :         state.dataSetPointManager->DCESPMDsn_MinCondSetpt = min(state.dataSetPointManager->DCESPMDsn_MinCondSetpt, Dsn_CondMinThisChiller);
    7841             : 
    7842             :         // Design entering condenser water temperature for chillers operating
    7843             :         // on current cond loop this timestep
    7844        2439 :         state.dataSetPointManager->DCESPMDsn_EntCondTemp = max(state.dataSetPointManager->DCESPMDsn_EntCondTemp, TempDesCondIn);
    7845             : 
    7846             :         // Load this array with the design capacity and actual load of each chiller this timestep
    7847        2439 :         Des_Load = state.dataSetPointManager->DCESPMDesignClgCapacity_Watts;
    7848        2439 :         Act_Load = state.dataSetPointManager->DCESPMCurrentLoad_Watts;
    7849             : 
    7850             :         // ***** Load Calculations *****
    7851             :         // In this section the sum of the actual load (watts) and design load (watts)
    7852             :         // of the chillers that are on is calculated.
    7853        2439 :         state.dataSetPointManager->DCESPMActual_Load_Sum += Act_Load;
    7854        2439 :         state.dataSetPointManager->DCESPMDesign_Load_Sum += Des_Load;
    7855             : 
    7856             :         // Exit if the chillers are all off this hour
    7857        2439 :         if (state.dataSetPointManager->DCESPMActual_Load_Sum <= 0) {
    7858           0 :             CondWaterSetPoint = state.dataSetPointManager->DCESPMDsn_EntCondTemp;
    7859           0 :             return;
    7860             :         }
    7861             : 
    7862             :         // ***** Weighted Ratio Calculation *****
    7863             :         // This section first calculates the actual (ALW) and design (DLW) individual
    7864             :         // weights. Then the weighted actual and design loads are computed. Finally
    7865             :         // the Weighted Ratio is found.
    7866        2439 :         if (state.dataSetPointManager->DCESPMActual_Load_Sum != 0 && state.dataSetPointManager->DCESPMDesign_Load_Sum != 0) {
    7867        2439 :             ALW = ((Act_Load / state.dataSetPointManager->DCESPMActual_Load_Sum) * Act_Load);
    7868        2439 :             DLW = ((Des_Load / state.dataSetPointManager->DCESPMDesign_Load_Sum) * Des_Load);
    7869             :         } else {
    7870           0 :             ALW = 0.0;
    7871           0 :             DLW = 0.0;
    7872             :         }
    7873        2439 :         state.dataSetPointManager->DCESPMWeighted_Actual_Load_Sum += ALW;
    7874        2439 :         state.dataSetPointManager->DCESPMWeighted_Design_Load_Sum += DLW;
    7875        2439 :         state.dataSetPointManager->DCESPMWeighted_Ratio =
    7876        2439 :             state.dataSetPointManager->DCESPMWeighted_Actual_Load_Sum / state.dataSetPointManager->DCESPMWeighted_Design_Load_Sum;
    7877             : 
    7878             :         // ***** Optimal Temperature Calculation *****
    7879             :         // In this section the optimal temperature is computed along with the minimum
    7880             :         // design wet bulb temp and the minimum actual wet bulb temp.
    7881             :         // Min_DesignWB = ACoef1 + ACoef2*OaWb + ACoef3*WPLR + ACoef4*TwrDsnWB + ACoef5*NF
    7882        7317 :         state.dataSetPointManager->DCESPMMin_DesignWB = CurveValue(state,
    7883             :                                                                    this->MinTwrWbCurve,
    7884        2439 :                                                                    state.dataEnvrn->OutWetBulbTemp,
    7885        2439 :                                                                    state.dataSetPointManager->DCESPMWeighted_Ratio,
    7886             :                                                                    Twr_DesignWB,
    7887             :                                                                    NormDsnCondFlow);
    7888             : 
    7889             :         // Min_ActualWb = BCoef1 + BCoef2*MinDsnWB + BCoef3*WPLR + BCoef4*TwrDsnWB + BCoef5*NF
    7890        7317 :         state.dataSetPointManager->DCESPMMin_ActualWb = CurveValue(state,
    7891             :                                                                    this->MinOaWbCurve,
    7892        2439 :                                                                    state.dataSetPointManager->DCESPMMin_DesignWB,
    7893        2439 :                                                                    state.dataSetPointManager->DCESPMWeighted_Ratio,
    7894             :                                                                    Twr_DesignWB,
    7895             :                                                                    NormDsnCondFlow);
    7896             : 
    7897             :         // Opt_CondEntTemp = CCoef1 + CCoef2*OaWb + CCoef3*WPLR + CCoef4*TwrDsnWB + CCoef5*NF
    7898        7317 :         state.dataSetPointManager->DCESPMOpt_CondEntTemp = CurveValue(state,
    7899             :                                                                       this->OptCondEntCurve,
    7900        2439 :                                                                       state.dataEnvrn->OutWetBulbTemp,
    7901        2439 :                                                                       state.dataSetPointManager->DCESPMWeighted_Ratio,
    7902             :                                                                       Twr_DesignWB,
    7903             :                                                                       NormDsnCondFlow);
    7904             : 
    7905             :         // ***** Calculate (Cond ent - Evap lvg) Section *****
    7906             :         // In this section we find the worst case of (Cond ent - Evap lvg) for the
    7907             :         // chillers that are running.
    7908        2439 :         state.dataSetPointManager->DCESPMCur_MinLiftTD = 9999.0;
    7909             :         // temp_MinLiftTD = 20.0 / 1.8;
    7910        2439 :         temp_MinLiftTD = state.dataSetPointManager->DCESPMCondInletTemp - state.dataSetPointManager->DCESPMEvapOutletTemp;
    7911        2439 :         state.dataSetPointManager->DCESPMCur_MinLiftTD = min(state.dataSetPointManager->DCESPMCur_MinLiftTD, temp_MinLiftTD);
    7912             :     }
    7913             : 
    7914             :     // ***** Limit conditions Section *****
    7915             :     // Check for limit conditions and control to the proper value.
    7916        5876 :     if ((state.dataSetPointManager->DCESPMWeighted_Ratio >= 0.90) &&
    7917           0 :         (state.dataSetPointManager->DCESPMOpt_CondEntTemp >= (state.dataSetPointManager->DCESPMDsn_EntCondTemp + 1.0))) {
    7918             :         // Optimized value exceeds the design condenser entering condition or chillers
    7919             :         // near full load condition; reset condenser entering setpoint to its design value
    7920           0 :         SetPoint = state.dataSetPointManager->DCESPMDsn_EntCondTemp + 1.0;
    7921             :     } else {
    7922       15032 :         if ((state.dataEnvrn->OutWetBulbTemp >= state.dataSetPointManager->DCESPMMin_ActualWb) &&
    7923        9156 :             (Twr_DesignWB >= state.dataSetPointManager->DCESPMMin_DesignWB) &&
    7924        3280 :             (state.dataSetPointManager->DCESPMCur_MinLiftTD > this->MinimumLiftTD)) {
    7925             :             // Boundaries are satified; use optimized condenser entering water temp
    7926        3232 :             SetPoint = state.dataSetPointManager->DCESPMOpt_CondEntTemp;
    7927             :         } else {
    7928             :             // Boundaries violated; Reset to scheduled value of condenser water entering setpoint
    7929        2644 :             SetPoint = CondWaterSetPoint;
    7930             :         }
    7931             :     }
    7932             :     // Do not allow new setpoint to be less than the design condenser minimum entering condition,
    7933             :     // i.e., TCondWaterEnt not allowed to be less than DsnEvapWaterLvg + MinimumLiftTD
    7934        5876 :     CondWaterSetPoint = max(SetPoint, state.dataSetPointManager->DCESPMDsn_MinCondSetpt);
    7935        5876 :     this->SetPt = CondWaterSetPoint;
    7936             : }
    7937             : 
    7938        5382 : void DefineIdealCondEntSetPointManager::calculate(EnergyPlusData &state)
    7939             : {
    7940             : 
    7941             :     // SUBROUTINE INFORMATION:
    7942             :     //       AUTHOR         Heejin Cho, PNNL
    7943             :     //       DATE WRITTEN   March 2012
    7944             :     //       MODIFIED       na
    7945             :     //       RE-ENGINEERED  na
    7946             : 
    7947             :     // PURPOSE OF THIS SUBROUTINE:
    7948             :     // Calculate the optimal condenser water entering temperature set point for a chiller plant.
    7949             : 
    7950             :     // METHODOLOGY EMPLOYED:
    7951             :     // The "ideal" chiller-tower optimization scheme uses a search algorithm to find the ideal optimal setpoint
    7952             :     // at a given timestep. This requires resimulating HVAC systems at each timestep until finding
    7953             :     // an "optimal" condenser water entering setpoint (OptSetpoint) which gives the minimum total chiller,
    7954             :     // cooling tower, chilled water pump and condenser water pump power consumption.
    7955             :     // The OptSetpoint falls between realistic minimum and maximum boundaries, which are set by the user.
    7956             :     // The minimum boundary is determined based on the minimum lift (user input)
    7957             :     // and evaporator leaving water temperature. The maximum boundary is specified by the user.
    7958             :     // It is assumed that a single minimum point exists between these boundaries.
    7959             : 
    7960             :     // Using/Aliasing
    7961             :     using namespace DataPlant;
    7962             : 
    7963             :     // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    7964        5382 :     auto &CondWaterSetPoint = state.dataSetPointManager->CondWaterSetPoint;
    7965        5382 :     auto &EvapOutletTemp = state.dataSetPointManager->EvapOutletTemp;
    7966        5382 :     auto &CondTempLimit = state.dataSetPointManager->CondTempLimit;
    7967        5382 :     auto &CurLoad = state.dataSetPointManager->CurLoad;
    7968        5382 :     auto &TotEnergy = state.dataSetPointManager->TotEnergy;
    7969        5382 :     auto &TotEnergyPre = state.dataSetPointManager->TotEnergyPre;
    7970             : 
    7971        5382 :     if (state.dataGlobal->MetersHaveBeenInitialized) {
    7972             :         // Setup meter vars
    7973        5370 :         if (this->SetupIdealCondEntSetPtVars) {
    7974           2 :             this->SetupMeteredVarsForSetPt(state);
    7975           2 :             this->SetupIdealCondEntSetPtVars = false;
    7976             :         }
    7977             :     }
    7978             : 
    7979        5382 :     if (state.dataGlobal->MetersHaveBeenInitialized && state.dataGlobal->RunOptCondEntTemp) {
    7980             : 
    7981             :         // If chiller is on
    7982        4236 :         CurLoad = std::abs(state.dataPlnt->PlantLoop(this->LoopIndexPlantSide)
    7983        2118 :                                .LoopSide(LoopSideLocation::Supply)
    7984        2118 :                                .Branch(this->BranchIndexPlantSide)
    7985        2118 :                                .Comp(this->ChillerIndexPlantSide)
    7986             :                                .MyLoad);
    7987             : 
    7988        2118 :         if (CurLoad > 0) {
    7989             : 
    7990             :             // Calculate the minimum condenser inlet temperature boundary for set point
    7991        3852 :             if (this->Type == PlantEquipmentType::Chiller_Absorption || this->Type == PlantEquipmentType::Chiller_CombTurbine ||
    7992        1926 :                 this->Type == PlantEquipmentType::Chiller_Electric || this->Type == PlantEquipmentType::Chiller_ElectricReformEIR ||
    7993           0 :                 this->Type == PlantEquipmentType::Chiller_EngineDriven) {
    7994        1926 :                 EvapOutletTemp = state.dataLoopNodes
    7995        3852 :                                      ->Node(state.dataPlnt->PlantLoop(this->LoopIndexPlantSide)
    7996        1926 :                                                 .LoopSide(LoopSideLocation::Supply)
    7997        1926 :                                                 .Branch(this->BranchIndexPlantSide)
    7998        1926 :                                                 .Comp(this->ChillerIndexPlantSide)
    7999        3852 :                                                 .NodeNumOut)
    8000        1926 :                                      .Temp;
    8001             :             } else {
    8002           0 :                 EvapOutletTemp = 6.666;
    8003             :             }
    8004        1926 :             CondTempLimit = this->MinimumLiftTD + EvapOutletTemp;
    8005             : 
    8006        1926 :             TotEnergy = this->calculateCurrentEnergyUsage(state);
    8007             : 
    8008        5778 :             this->setupSetPointAndFlags(TotEnergy,
    8009             :                                         TotEnergyPre,
    8010             :                                         CondWaterSetPoint,
    8011             :                                         CondTempLimit,
    8012        1926 :                                         state.dataGlobal->RunOptCondEntTemp,
    8013        1926 :                                         state.dataSetPointManager->RunSubOptCondEntTemp,
    8014        1926 :                                         state.dataSetPointManager->RunFinalOptCondEntTemp);
    8015             : 
    8016             :         } else {
    8017         192 :             CondWaterSetPoint = this->MaxCondEntTemp;
    8018         192 :             TotEnergyPre = 0.0;
    8019         192 :             state.dataGlobal->RunOptCondEntTemp = false;
    8020         192 :             state.dataSetPointManager->RunSubOptCondEntTemp = false;
    8021             :         }
    8022             :     } else {
    8023        3264 :         CondWaterSetPoint = this->MaxCondEntTemp;
    8024        3264 :         state.dataGlobal->RunOptCondEntTemp = false;
    8025        3264 :         state.dataSetPointManager->RunSubOptCondEntTemp = false;
    8026             :     }
    8027             : 
    8028        5382 :     this->SetPt = CondWaterSetPoint;
    8029        5382 : }
    8030             : 
    8031        1926 : void DefineIdealCondEntSetPointManager::setupSetPointAndFlags(Real64 &TotEnergy,
    8032             :                                                               Real64 &TotEnergyPre,
    8033             :                                                               Real64 &CondWaterSetPoint,
    8034             :                                                               Real64 &CondTempLimit,
    8035             :                                                               bool &RunOptCondEntTemp,
    8036             :                                                               bool &RunSubOptCondEntTemp,
    8037             :                                                               bool &RunFinalOptCondEntTemp) const
    8038             : {
    8039             :     Real64 DeltaTotEnergy;
    8040        1926 :     if (TotEnergyPre != 0.0) {
    8041             :         // Calculate the total energy consumption difference
    8042        1658 :         DeltaTotEnergy = TotEnergyPre - TotEnergy;
    8043             :         // Search for the minimum total energy consumption
    8044        1658 :         if ((DeltaTotEnergy > 0) && (CondWaterSetPoint >= CondTempLimit) && (!RunFinalOptCondEntTemp)) {
    8045         856 :             if (!RunSubOptCondEntTemp) {
    8046         605 :                 --CondWaterSetPoint;
    8047         605 :                 RunOptCondEntTemp = true;
    8048             :             } else {
    8049         251 :                 CondWaterSetPoint -= 0.2;
    8050         251 :                 RunOptCondEntTemp = true;
    8051             :             }
    8052         856 :             TotEnergyPre = TotEnergy;
    8053             :             // Set smaller set point (0.2 degC) decrease
    8054         802 :         } else if ((DeltaTotEnergy < 0) && (!RunSubOptCondEntTemp) && (CondWaterSetPoint > CondTempLimit) && (!RunFinalOptCondEntTemp)) {
    8055         266 :             CondWaterSetPoint += 0.8;
    8056         266 :             RunOptCondEntTemp = true;
    8057         266 :             RunSubOptCondEntTemp = true;
    8058             :         } else {
    8059         536 :             if (!RunFinalOptCondEntTemp) {
    8060         268 :                 CondWaterSetPoint += 0.2;
    8061         268 :                 RunOptCondEntTemp = true;
    8062         268 :                 RunSubOptCondEntTemp = false;
    8063         268 :                 RunFinalOptCondEntTemp = true;
    8064             :             } else {
    8065             :                 // CondWaterSetPoint = CondWaterSetPoint; // Self-assignment commented out
    8066         268 :                 TotEnergyPre = 0.0;
    8067         268 :                 RunOptCondEntTemp = false;
    8068         268 :                 RunSubOptCondEntTemp = false;
    8069         268 :                 RunFinalOptCondEntTemp = false;
    8070             :             }
    8071             :         }
    8072             :     } else {
    8073         268 :         CondWaterSetPoint = this->MaxCondEntTemp - 1.0;
    8074         268 :         TotEnergyPre = TotEnergy;
    8075         268 :         RunOptCondEntTemp = true;
    8076         268 :         RunSubOptCondEntTemp = false;
    8077             :     }
    8078        1926 : }
    8079             : 
    8080        1926 : Real64 DefineIdealCondEntSetPointManager::calculateCurrentEnergyUsage(EnergyPlusData &state)
    8081             : {
    8082             : 
    8083        1926 :     Real64 ChillerEnergy(0.0);     // Chiller energy consumption
    8084        1926 :     Real64 ChilledPumpEnergy(0.0); // Chilled water pump energy consumption
    8085        1926 :     Real64 TowerFanEnergy(0.0);    // Cooling tower fan energy consumption
    8086        1926 :     Real64 CondPumpEnergy(0.0);    // Condenser water pump energy consumption
    8087             : 
    8088             :     // Energy consumption metered variable number = 1
    8089             : 
    8090             :     // Get the chiller energy consumption
    8091        1926 :     ChillerEnergy = GetInternalVariableValue(state, this->ChllrVarType, this->ChllrVarIndex);
    8092             : 
    8093             :     // Get the chilled water pump energy consumption
    8094        1926 :     ChilledPumpEnergy = GetInternalVariableValue(state, this->ChlPumpVarType, this->ChlPumpVarIndex);
    8095             : 
    8096             :     // Get the cooling tower fan energy consumption
    8097        1926 :     TowerFanEnergy = 0;
    8098        4774 :     for (int i = 1; i <= this->numTowers; i++) {
    8099        2848 :         TowerFanEnergy += GetInternalVariableValue(state, this->ClTowerVarType(i), this->ClTowerVarIndex(i));
    8100             :     }
    8101             : 
    8102             :     // Get the condenser pump energy consumption
    8103        1926 :     CondPumpEnergy = GetInternalVariableValue(state, this->CndPumpVarType, this->CndPumpVarIndex);
    8104             : 
    8105             :     // Calculate the total energy consumption
    8106        1926 :     return (ChillerEnergy + ChilledPumpEnergy + TowerFanEnergy + CondPumpEnergy);
    8107             : }
    8108             : 
    8109       16646 : void DefineReturnWaterChWSetPointManager::calculate(EnergyPlusData &state, DataLoopNode::NodeData &returnNode, DataLoopNode::NodeData &supplyNode)
    8110             : {
    8111             : 
    8112             :     // SUBROUTINE INFORMATION:
    8113             :     //       AUTHOR         Edwin Lee, NREL
    8114             :     //       DATE WRITTEN   May 2015
    8115             :     //       MODIFIED       na
    8116             :     //       RE-ENGINEERED  na
    8117             : 
    8118             :     // PURPOSE OF THIS SUBROUTINE:
    8119             :     // Calculate the plant supply temperature reset required to achieve a target plant return temperature
    8120             : 
    8121             :     // METHODOLOGY EMPLOYED:
    8122             :     // The setpoint manager follows this procedure:
    8123             :     //  1. Calculate the current demand
    8124             :     //    a. Sense the current return temperature
    8125             :     //    b. Sense the current supply temperature
    8126             :     //    c. Sense the current flow rate
    8127             :     //    d. Approximate the fluid properties (rho, Cp) from the temperatures
    8128             :     //    ---> Use these to calculate the demand with Q_demand = V_dot * rho * C_p * (T_return_sensed - T_supply_sensed)
    8129             :     //  2. Calculate a new value of supply setpoint that will reject this much Q_demand, while providing a target return temperature
    8130             :     //    * this assumes that the demand will be the same value on the next time around
    8131             :     //    * at any time step, the value of target return temperature may vary if it is scheduled (or actuated with EMS)
    8132             :     //    a. T_supply_setpoint = T_return_target - Q_demand / ( V_dot * rho * C_p )
    8133             :     //  3. Constrain this value to limits
    8134             :     //    a. T_supply_setpoint will be within: [ Design Chilled Water Supply Temperature, Maximum Supply Water Reset Temperature ]
    8135             : 
    8136             :     // NOTES:
    8137             :     // The assumptions related to lagging of setpoint are most suited for smaller timesteps and/or plants that don't vary wildly from one time
    8138             :     // step to another The assumptions also become affected by variable flow plants more-so than constant-flow plants
    8139             : 
    8140             :     // Using/Aliasing
    8141             :     using namespace DataPlant;
    8142             : 
    8143             :     // we need to know the plant to get the fluid ID in case it is glycol
    8144             :     // but we have to wait in case plant isn't initialized yet
    8145             :     // if plant isn't initialized, assume index=1 (water)
    8146       16646 :     int fluidIndex = 1;
    8147       16646 :     if (this->plantLoopIndex == 0) {
    8148           9 :         for (int plantIndex = 1; plantIndex <= state.dataPlnt->TotNumLoops; plantIndex++) {
    8149           6 :             if (this->supplyNodeIndex == state.dataPlnt->PlantLoop(plantIndex).LoopSide(DataPlant::LoopSideLocation::Supply).NodeNumOut) {
    8150           3 :                 this->plantLoopIndex = plantIndex;
    8151           3 :                 this->plantSetpointNodeIndex = state.dataPlnt->PlantLoop(plantIndex).TempSetPointNodeNum;
    8152           3 :                 fluidIndex = state.dataPlnt->PlantLoop(plantIndex).FluidIndex;
    8153             :                 // now that we've found the plant populated, let's verify that the nodes match
    8154           3 :                 if (!PlantUtilities::verifyTwoNodeNumsOnSamePlantLoop(state, this->supplyNodeIndex, this->returnNodeIndex)) {
    8155           0 :                     ShowSevereError(state, "Node problem for SetpointManager:ReturnTemperature:ChilledWater.");
    8156           0 :                     ShowContinueError(state, "Return and Supply nodes were not found on the same plant loop.  Verify node names.");
    8157           0 :                     ShowFatalError(state, "Simulation aborts due to setpoint node problem");
    8158             :                 }
    8159             :             }
    8160             :         }
    8161             :     }
    8162             : 
    8163             :     // we don't need fluid names since we have a real index, so just pass in the temperature and get properties
    8164       16646 :     Real64 avgTemp = (returnNode.Temp + supplyNode.Temp) / 2;
    8165       16646 :     Real64 cp = FluidProperties::GetSpecificHeatGlycol(state, "", avgTemp, fluidIndex, "ReturnWaterChWSetPointManager::calculate");
    8166             : 
    8167             :     // get the operating flow rate
    8168       16646 :     Real64 mdot = supplyNode.MassFlowRate;
    8169             : 
    8170             :     // calculate the current demand
    8171       16646 :     Real64 Qdemand = mdot * cp * (returnNode.Temp - supplyNode.Temp);
    8172             : 
    8173             :     // check for strange conditions
    8174       16646 :     if (Qdemand < 0) {
    8175           0 :         this->currentSupplySetPt = this->minimumChilledWaterSetpoint;
    8176           0 :         return;
    8177             :     }
    8178             : 
    8179             :     // Determine a return target, default is to use the constant value, but scheduled or externally
    8180             :     //  set on the return node TempSetPoint will overwrite it.  Note that the schedule index is only
    8181             :     //  greater than zero if the input type is scheduled, and the useReturnTempSetpoint flag is only
    8182             :     //  true if the input type is specified as such
    8183       16646 :     Real64 T_return_target = this->returnTemperatureConstantTarget;
    8184       16646 :     if (this->returnTemperatureScheduleIndex > 0) {
    8185           0 :         T_return_target = GetCurrentScheduleValue(state, this->returnTemperatureScheduleIndex);
    8186       16646 :     } else if (this->useReturnTempSetpoint) {
    8187         963 :         if (returnNode.TempSetPoint != SensedNodeFlagValue) {
    8188         963 :             T_return_target = returnNode.TempSetPoint;
    8189             :         } else {
    8190           0 :             ShowSevereError(state, "Return temperature reset setpoint manager encountered an error.");
    8191           0 :             ShowContinueError(state,
    8192             :                               "The manager is specified to look to the return node setpoint to find a target return temperature, but the node "
    8193             :                               "setpoint was invalid");
    8194           0 :             ShowContinueError(state,
    8195           0 :                               "Verify that a separate sepoint manager is specified to set the setpoint on the return node named \"" +
    8196           0 :                                   state.dataLoopNodes->NodeID(this->returnNodeIndex) + "\"");
    8197           0 :             ShowContinueError(state, "Or change the target return temperature input type to constant or scheduled");
    8198           0 :             ShowFatalError(state, "Missing reference setpoint");
    8199             :         }
    8200             :     }
    8201             : 
    8202             :     // calculate the supply setpoint to use, default to the design value if flow is zero
    8203       16646 :     Real64 T_supply_setpoint = this->minimumChilledWaterSetpoint;
    8204       16646 :     if (mdot > DataConvergParams::PlantFlowRateToler) {
    8205        7660 :         T_supply_setpoint = T_return_target - Qdemand / (mdot * cp);
    8206             :     }
    8207             : 
    8208             :     // now correct it to bring it into range
    8209       16646 :     T_supply_setpoint = min(max(T_supply_setpoint, this->minimumChilledWaterSetpoint), this->maximumChilledWaterSetpoint);
    8210             : 
    8211             :     // now save it for use in the update routine
    8212       16646 :     this->currentSupplySetPt = T_supply_setpoint;
    8213             : }
    8214             : 
    8215       14720 : void DefineReturnWaterHWSetPointManager::calculate(EnergyPlusData &state, DataLoopNode::NodeData &returnNode, DataLoopNode::NodeData &supplyNode)
    8216             : {
    8217             : 
    8218             :     // SUBROUTINE INFORMATION:
    8219             :     //       AUTHOR         Edwin Lee, NREL
    8220             :     //       DATE WRITTEN   May 2015
    8221             :     //       MODIFIED       na
    8222             :     //       RE-ENGINEERED  na
    8223             : 
    8224             :     // PURPOSE OF THIS SUBROUTINE:
    8225             :     // Calculate the plant supply temperature reset required to achieve a target plant return temperature
    8226             : 
    8227             :     // METHODOLOGY EMPLOYED:
    8228             :     // The setpoint manager follows this procedure:
    8229             :     //  1. Calculate the current demand
    8230             :     //    a. Sense the current return temperature
    8231             :     //    b. Sense the current supply temperature
    8232             :     //    c. Sense the current flow rate
    8233             :     //    d. Approximate the fluid properties (rho, Cp) from the temperatures
    8234             :     //    ---> Use these to calculate the demand with Q_demand = V_dot * rho * C_p * (T_supply_sensed - T_return_sensed)
    8235             :     //  2. Calculate a new value of supply setpoint that will reject this much Q_demand, while providing a target return temperature
    8236             :     //    * this assumes that the demand will be the same value on the next time around
    8237             :     //    * at any time step, the value of target return temperature may vary if it is scheduled (or actuated with EMS)
    8238             :     //    a. T_supply_setpoint = T_return_target + Q_demand / ( V_dot * rho * C_p )
    8239             :     //  3. Constrain this value to limits
    8240             :     //    a. T_supply_setpoint will be within: [ Minimum Chilled Water Reset Temperature, Design Hot Water Supply Temperature ]
    8241             : 
    8242             :     // NOTES:
    8243             :     // The assumptions related to lagging of setpoint are most suited for smaller timesteps and/or plants that don't vary wildly from one time
    8244             :     // step to another The assumptions also become affected by variable flow plants more-so than constant-flow plants
    8245             : 
    8246             :     // Using/Aliasing
    8247             :     using namespace DataPlant;
    8248             : 
    8249             :     // we need to know the plant to get the fluid ID in case it is glycol
    8250             :     // but we have to wait in case plant isn't initialized yet
    8251             :     // if plant isn't initialized, assume index=1 (water)
    8252       14720 :     int fluidIndex = 1;
    8253       14720 :     if (this->plantLoopIndex == 0) {
    8254           5 :         for (int plantIndex = 1; plantIndex <= state.dataPlnt->TotNumLoops; plantIndex++) {
    8255           4 :             if (this->supplyNodeIndex == state.dataPlnt->PlantLoop(plantIndex).LoopSide(DataPlant::LoopSideLocation::Supply).NodeNumOut) {
    8256           1 :                 this->plantLoopIndex = plantIndex;
    8257           1 :                 this->plantSetpointNodeIndex = state.dataPlnt->PlantLoop(plantIndex).TempSetPointNodeNum;
    8258           1 :                 fluidIndex = state.dataPlnt->PlantLoop(plantIndex).FluidIndex;
    8259             :                 // now that we've found the plant populated, let's verify that the nodes match
    8260           1 :                 if (!PlantUtilities::verifyTwoNodeNumsOnSamePlantLoop(state, this->supplyNodeIndex, this->returnNodeIndex)) {
    8261           0 :                     ShowSevereError(state, "Node problem for SetpointManager:ReturnTemperature:HotWater.");
    8262           0 :                     ShowContinueError(state, "Return and Supply nodes were not found on the same plant loop.  Verify node names.");
    8263           0 :                     ShowFatalError(state, "Simulation aborts due to setpoint node problem");
    8264             :                 }
    8265             :             }
    8266             :         }
    8267             :     }
    8268             : 
    8269             :     // we don't need fluid names since we have a real index, so just pass in the temperature and get properties
    8270       14720 :     Real64 avgTemp = (returnNode.Temp + supplyNode.Temp) / 2;
    8271       14720 :     Real64 cp = FluidProperties::GetSpecificHeatGlycol(state, "", avgTemp, fluidIndex, "ReturnWaterHWSetPointManager::calculate");
    8272             : 
    8273             :     // get the operating flow rate
    8274       14720 :     Real64 mdot = supplyNode.MassFlowRate;
    8275             : 
    8276             :     // calculate the current demand
    8277       14720 :     Real64 Qdemand = mdot * cp * (supplyNode.Temp - returnNode.Temp);
    8278             : 
    8279             :     // check for strange conditions
    8280       14720 :     if (Qdemand < 0) {
    8281           0 :         this->currentSupplySetPt = this->maximumHotWaterSetpoint;
    8282           0 :         return;
    8283             :     }
    8284             : 
    8285             :     // Determine a return target, default is to use the constant value, but scheduled overwrites it
    8286       14720 :     Real64 T_return_target = this->returnTemperatureConstantTarget;
    8287       14720 :     if (this->returnTemperatureScheduleIndex > 0) {
    8288           0 :         T_return_target = GetCurrentScheduleValue(state, this->returnTemperatureScheduleIndex);
    8289       14720 :     } else if (this->useReturnTempSetpoint) {
    8290           0 :         if (returnNode.TempSetPoint != SensedNodeFlagValue) {
    8291           0 :             T_return_target = returnNode.TempSetPoint;
    8292             :         } else {
    8293           0 :             ShowSevereError(state, "Return temperature reset setpoint manager encountered an error.");
    8294           0 :             ShowContinueError(state,
    8295             :                               "The manager is specified to look to the return node setpoint to find a target return temperature, but the node "
    8296             :                               "setpoint was invalid");
    8297           0 :             ShowContinueError(state,
    8298           0 :                               "Verify that a separate sepoint manager is specified to set the setpoint on the return node named \"" +
    8299           0 :                                   state.dataLoopNodes->NodeID(this->returnNodeIndex) + "\"");
    8300           0 :             ShowContinueError(state, "Or change the target return temperature input type to constant or scheduled");
    8301           0 :             ShowFatalError(state, "Missing reference setpoint");
    8302             :         }
    8303             :     }
    8304             : 
    8305             :     // calculate the supply setpoint to use, default to the design value if flow is zero
    8306       14720 :     Real64 T_supply_setpoint = this->maximumHotWaterSetpoint;
    8307       14720 :     if (mdot > DataConvergParams::PlantFlowRateToler) {
    8308        5706 :         T_supply_setpoint = T_return_target + Qdemand / (mdot * cp);
    8309             :     }
    8310             : 
    8311             :     // now correct it to bring it into range
    8312       14720 :     T_supply_setpoint = max(min(T_supply_setpoint, this->maximumHotWaterSetpoint), this->minimumHotWaterSetpoint);
    8313             : 
    8314             :     // now save it for use in the update routine
    8315       14720 :     this->currentSupplySetPt = T_supply_setpoint;
    8316             : }
    8317             : 
    8318           2 : void DefineIdealCondEntSetPointManager::SetupMeteredVarsForSetPt(EnergyPlusData &state)
    8319             : {
    8320             : 
    8321             :     // SUBROUTINE INFORMATION:
    8322             :     //       AUTHOR         Linda Lawrie
    8323             :     //       DATE WRITTEN   Sep 2013
    8324             :     //       MODIFIED       na
    8325             :     //       RE-ENGINEERED  na
    8326             : 
    8327             :     // PURPOSE OF THIS SUBROUTINE:
    8328             :     // For the Ideal Cond reset setpoint manager, this sets up the
    8329             :     // report variables used during the calculation.
    8330             : 
    8331             :     // Using/Aliasing
    8332             :     using namespace DataPlant;
    8333             : 
    8334             :     // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    8335           4 :     std::string TypeOfComp;
    8336           4 :     std::string NameOfComp;
    8337             : 
    8338           4 :     Array1D_int VarIndexes;                                         // Variable Numbers
    8339           4 :     Array1D<OutputProcessor::VariableType> VarTypes;                // Variable Types (1=integer, 2=real, 3=meter)
    8340           4 :     Array1D<OutputProcessor::TimeStepType> IndexTypes;              // Variable Index Types (1=Zone,2=HVAC)
    8341           4 :     Array1D<OutputProcessor::Unit> unitsForVar;                     // units from enum for each variable
    8342           4 :     std::map<int, DataGlobalConstants::ResourceType> ResourceTypes; // ResourceTypes for each variable
    8343           4 :     Array1D_string EndUses;                                         // EndUses for each variable
    8344           4 :     Array1D_string Groups;                                          // Groups for each variable
    8345           4 :     Array1D_string Names;                                           // Variable Names for each variable
    8346             :     int NumVariables;
    8347             :     int NumFound;
    8348             : 
    8349             :     // Chiller and ChW pump location, assumes supply side
    8350           2 :     int ChillerLoopNum(this->LoopIndexPlantSide);         // Chiller loop number
    8351           2 :     int ChillerBranchNum(this->BranchIndexPlantSide);     // Chiller branch number
    8352           2 :     int ChillerNum(this->ChillerIndexPlantSide);          // Chiller number
    8353           2 :     int ChilledPumpBranchNum(this->ChilledPumpBranchNum); // Chilled water pump branch number
    8354           2 :     int ChilledPumpNum(this->ChilledPumpNum);             // Chilled water pump number
    8355             : 
    8356             :     // Tower and CW pump location, assumes supply side, and tower branch/comp nums are used directly instead of local variable copies
    8357           2 :     int TowerLoopNum(this->CondLoopNum);            // Tower loop number
    8358           2 :     int CondPumpBranchNum(this->CondPumpBranchNum); // Condenser water pump branch number
    8359           2 :     int CondPumpNum(this->CondPumpNum);             // Condenser pump number
    8360             : 
    8361           2 :     TypeOfComp = state.dataPlnt->PlantLoop(ChillerLoopNum).LoopSide(LoopSideLocation::Supply).Branch(ChillerBranchNum).Comp(ChillerNum).TypeOf;
    8362           2 :     NameOfComp = state.dataPlnt->PlantLoop(ChillerLoopNum).LoopSide(LoopSideLocation::Supply).Branch(ChillerBranchNum).Comp(ChillerNum).Name;
    8363           2 :     NumVariables = GetNumMeteredVariables(state, TypeOfComp, NameOfComp);
    8364           2 :     VarIndexes.allocate(NumVariables);
    8365           2 :     VarTypes.allocate(NumVariables);
    8366           2 :     IndexTypes.allocate(NumVariables);
    8367           2 :     unitsForVar.allocate(NumVariables);
    8368             : 
    8369           8 :     for (int varN = 1; varN <= NumVariables; ++varN) {
    8370           6 :         ResourceTypes.insert(std::pair<int, DataGlobalConstants::ResourceType>(varN, DataGlobalConstants::ResourceType::None));
    8371             :     }
    8372             : 
    8373           2 :     EndUses.allocate(NumVariables);
    8374           2 :     Groups.allocate(NumVariables);
    8375           2 :     Names.allocate(NumVariables);
    8376             : 
    8377           2 :     GetMeteredVariables(
    8378             :         state, TypeOfComp, NameOfComp, VarIndexes, VarTypes, IndexTypes, unitsForVar, ResourceTypes, EndUses, Groups, Names, NumFound);
    8379           2 :     this->ChllrVarType = VarTypes(1);
    8380           2 :     this->ChllrVarIndex = VarIndexes(1);
    8381             : 
    8382           2 :     TypeOfComp =
    8383           2 :         state.dataPlnt->PlantLoop(ChillerLoopNum).LoopSide(LoopSideLocation::Supply).Branch(ChilledPumpBranchNum).Comp(ChilledPumpNum).TypeOf;
    8384           2 :     NameOfComp = state.dataPlnt->PlantLoop(ChillerLoopNum).LoopSide(LoopSideLocation::Supply).Branch(ChilledPumpBranchNum).Comp(ChilledPumpNum).Name;
    8385           2 :     NumVariables = GetNumMeteredVariables(state, TypeOfComp, NameOfComp);
    8386           2 :     VarIndexes.allocate(NumVariables);
    8387           2 :     VarTypes.allocate(NumVariables);
    8388           2 :     IndexTypes.allocate(NumVariables);
    8389           2 :     unitsForVar.allocate(NumVariables);
    8390             : 
    8391           2 :     ResourceTypes.clear();
    8392           4 :     for (int varN = 1; varN <= NumVariables; ++varN) {
    8393           2 :         ResourceTypes.insert(std::pair<int, DataGlobalConstants::ResourceType>(varN, DataGlobalConstants::ResourceType::None));
    8394             :     }
    8395             : 
    8396           2 :     EndUses.allocate(NumVariables);
    8397           2 :     Groups.allocate(NumVariables);
    8398           2 :     Names.allocate(NumVariables);
    8399             : 
    8400           2 :     GetMeteredVariables(
    8401             :         state, TypeOfComp, NameOfComp, VarIndexes, VarTypes, IndexTypes, unitsForVar, ResourceTypes, EndUses, Groups, Names, NumFound);
    8402           2 :     this->ChlPumpVarType = VarTypes(1);
    8403           2 :     this->ChlPumpVarIndex = VarIndexes(1);
    8404             : 
    8405           5 :     for (int i = 1; i <= this->numTowers; i++) {
    8406           6 :         TypeOfComp = state.dataPlnt->PlantLoop(TowerLoopNum)
    8407           3 :                          .LoopSide(LoopSideLocation::Supply)
    8408           3 :                          .Branch(this->CondTowerBranchNum(i))
    8409           3 :                          .Comp(this->TowerNum(i))
    8410           3 :                          .TypeOf;
    8411           6 :         NameOfComp = state.dataPlnt->PlantLoop(TowerLoopNum)
    8412           3 :                          .LoopSide(LoopSideLocation::Supply)
    8413           3 :                          .Branch(this->CondTowerBranchNum(i))
    8414           3 :                          .Comp(this->TowerNum(i))
    8415           3 :                          .Name;
    8416           3 :         NumVariables = GetNumMeteredVariables(state, TypeOfComp, NameOfComp);
    8417           3 :         VarIndexes.allocate(NumVariables);
    8418           3 :         VarTypes.allocate(NumVariables);
    8419           3 :         IndexTypes.allocate(NumVariables);
    8420           3 :         unitsForVar.allocate(NumVariables);
    8421             : 
    8422           3 :         ResourceTypes.clear();
    8423          15 :         for (int varN = 1; varN <= NumVariables; ++varN) {
    8424          12 :             ResourceTypes.insert(std::pair<int, DataGlobalConstants::ResourceType>(varN, DataGlobalConstants::ResourceType::None));
    8425             :         }
    8426             : 
    8427           3 :         EndUses.allocate(NumVariables);
    8428           3 :         Groups.allocate(NumVariables);
    8429           3 :         Names.allocate(NumVariables);
    8430             : 
    8431           3 :         GetMeteredVariables(
    8432             :             state, TypeOfComp, NameOfComp, VarIndexes, VarTypes, IndexTypes, unitsForVar, ResourceTypes, EndUses, Groups, Names, NumFound);
    8433           3 :         this->ClTowerVarType.push_back(VarTypes(1));
    8434           3 :         this->ClTowerVarIndex.push_back(VarIndexes(1));
    8435             :     }
    8436             : 
    8437           2 :     TypeOfComp = state.dataPlnt->PlantLoop(TowerLoopNum).LoopSide(LoopSideLocation::Supply).Branch(CondPumpBranchNum).Comp(CondPumpNum).TypeOf;
    8438           2 :     NameOfComp = state.dataPlnt->PlantLoop(TowerLoopNum).LoopSide(LoopSideLocation::Supply).Branch(CondPumpBranchNum).Comp(CondPumpNum).Name;
    8439           2 :     NumVariables = GetNumMeteredVariables(state, TypeOfComp, NameOfComp);
    8440           2 :     VarIndexes.allocate(NumVariables);
    8441           2 :     VarTypes.allocate(NumVariables);
    8442           2 :     IndexTypes.allocate(NumVariables);
    8443           2 :     unitsForVar.allocate(NumVariables);
    8444             : 
    8445           2 :     ResourceTypes.clear();
    8446           4 :     for (int varN = 1; varN <= NumVariables; ++varN) {
    8447           2 :         ResourceTypes.insert(std::pair<int, DataGlobalConstants::ResourceType>(varN, DataGlobalConstants::ResourceType::None));
    8448             :     }
    8449             : 
    8450           2 :     EndUses.allocate(NumVariables);
    8451           2 :     Groups.allocate(NumVariables);
    8452           2 :     Names.allocate(NumVariables);
    8453             : 
    8454           2 :     GetMeteredVariables(
    8455             :         state, TypeOfComp, NameOfComp, VarIndexes, VarTypes, IndexTypes, unitsForVar, ResourceTypes, EndUses, Groups, Names, NumFound);
    8456           2 :     this->CndPumpVarType = VarTypes(1);
    8457           2 :     this->CndPumpVarIndex = VarIndexes(1);
    8458           2 : }
    8459             : 
    8460        6948 : void DefineSysNodeResetSetPointManager::calculate(EnergyPlusData &state)
    8461             : {
    8462             :     // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    8463             :     Real64 SpAtLow;      // Setpoint at low reference value
    8464             :     Real64 SpAtHigh;     // Setpoint at high reference value
    8465             :     Real64 LowRefVal;    // Low reference value
    8466             :     Real64 HighRefVal;   // High reference value
    8467        6948 :     Real64 RefValue = 0; // Reference value from the Reference node
    8468             :     int RefNode;         // Reference node number
    8469             : 
    8470        6948 :     RefNode = this->RefNodeNum;
    8471             : 
    8472        6948 :     switch (this->CtrlTypeMode) {
    8473        5211 :     case CtrlVarType::Temp: {
    8474        5211 :         RefValue = state.dataLoopNodes->Node(RefNode).Temp;
    8475        5211 :     } break;
    8476           0 :     case CtrlVarType::MaxTemp: {
    8477           0 :         RefValue = state.dataLoopNodes->Node(RefNode).Temp;
    8478           0 :     } break;
    8479           0 :     case CtrlVarType::MinTemp: {
    8480           0 :         RefValue = state.dataLoopNodes->Node(RefNode).Temp;
    8481           0 :     } break;
    8482           0 :     case CtrlVarType::HumRat: {
    8483           0 :         RefValue = state.dataLoopNodes->Node(RefNode).HumRat;
    8484           0 :     } break;
    8485        1737 :     case CtrlVarType::MaxHumRat: {
    8486        1737 :         RefValue = state.dataLoopNodes->Node(RefNode).HumRat;
    8487        1737 :     } break;
    8488           0 :     case CtrlVarType::MinHumRat: {
    8489           0 :         RefValue = state.dataLoopNodes->Node(RefNode).HumRat;
    8490           0 :     } break;
    8491           0 :     default:
    8492           0 :         break;
    8493             :     }
    8494             : 
    8495        6948 :     SpAtLow = this->SpAtLowRef;
    8496        6948 :     SpAtHigh = this->SpAtHighRef;
    8497        6948 :     LowRefVal = this->LowRef;
    8498        6948 :     HighRefVal = this->HighRef;
    8499             : 
    8500        6948 :     this->SetPt = this->calcSetPointLinInt(LowRefVal, HighRefVal, RefValue, SpAtLow, SpAtHigh);
    8501        6948 : }
    8502             : 
    8503             : Real64
    8504      502708 : SPBase::calcSetPointLinInt(Real64 const LowVal, Real64 const HighVal, Real64 const RefVal, Real64 const SetptAtLowVal, Real64 const SetptAtHighVal)
    8505             : {
    8506             :     Real64 SetPt;
    8507      502708 :     if (LowVal < HighVal) {
    8508      502708 :         if (RefVal <= LowVal) {
    8509      128438 :             SetPt = SetptAtLowVal;
    8510      374270 :         } else if (RefVal >= HighVal) {
    8511       86140 :             SetPt = SetptAtHighVal;
    8512             :         } else {
    8513      288130 :             SetPt = SetptAtLowVal - ((RefVal - LowVal) / (HighVal - LowVal)) * (SetptAtLowVal - SetptAtHighVal);
    8514             :         }
    8515             : 
    8516             :     } else {
    8517           0 :         SetPt = 0.5 * (SetptAtLowVal + SetptAtHighVal);
    8518             :     }
    8519      502708 :     return SetPt;
    8520             : }
    8521             : 
    8522     2633608 : void UpdateSetPointManagers(EnergyPlusData &state)
    8523             : {
    8524             : 
    8525             :     // SUBROUTINE INFORMATION:
    8526             :     //       AUTHOR         Fred Buhl
    8527             :     //       DATE WRITTEN   July 1998
    8528             :     //       MODIFIED       Shirey/Raustad (FSEC), Jan 2004
    8529             :     //                      P. Haves Oct 2004
    8530             :     //                        Add new setpoint managers:
    8531             :     //                          SET POINT MANAGER:WARMEST TEMP FLOW and
    8532             :     //                          SET POINT MANAGER:COLDEST TEMP FLOW
    8533             :     //                      Nov 2004 M. J. Witte, GARD Analytics, Inc.
    8534             :     //                        Add new setpoint managers:
    8535             :     //                          SET POINT MANAGER:SINGLE ZONE HEATING and
    8536             :     //                          SET POINT MANAGER:SINGLE ZONE COOLING
    8537             :     //                        Work supported by ASHRAE research project 1254-RP
    8538             :     //                      B. Griffith Aug. 2006.  Allow HUMRAT for scheduled setpoint manager
    8539             :     //                      P. Haves Aug 2007
    8540             :     //                        SET POINT MANAGER:WARMEST TEMP FLOW:
    8541             :     //                          Set AirLoopControlInfo()%LoopFlowRateSet every call not just on
    8542             :     //                          initialization (flag now reset in SUBROUTINE ResetHVACControl)
    8543             :     //                        Removed SET POINT MANAGER:COLDEST TEMP FLOW
    8544             :     //                      July 2010 B.A. Nigusse, FSEC/UCF
    8545             :     //                        Added new setpoint managers
    8546             :     //                          SetpointManager:MultiZone:Heating:Average
    8547             :     //                          SetpointManager:MultiZone:Cooling:Average
    8548             :     //                          SetpointManager:MultiZone:MinimumHumidity:Average
    8549             :     //                          SetpointManager:MultiZone:MaximumHumidity:Average
    8550             :     //                      Aug 2010 B.A. Nigusse, FSEC/UCF
    8551             :     //                        Added new setpoint managers:
    8552             :     //                          SetpointManager:MultiZone:Humidity:Minimum
    8553             :     //                          SetpointManager:MultiZone:Humidity:Maximum
    8554             :     //                      Aug 2014 Rick Strand, UIUC
    8555             :     //                          SetpointManager:ScheduledTES (internally defined)
    8556             :     //                      Jan 2022 Wooyoung Jung, Jeremy Lerond and Jian Zhang, PNNL
    8557             :     //                        Added new setpoint managers:
    8558             :     //                          SetpointManager:SystemNodeReset:Temperature
    8559             :     //                          SetpointManager:SystemNodeReset:Humidity
    8560             : 
    8561             :     //       RE-ENGINEERED  na
    8562             : 
    8563             :     // PURPOSE OF THIS SUBROUTINE
    8564             :     // Loop over all the Setpoint Managers and use their output arrays
    8565             :     // to set the node setpoints.
    8566             : 
    8567             :     // METHODOLOGY EMPLOYED:
    8568             : 
    8569             :     // REFERENCES:
    8570             :     // na
    8571             : 
    8572             :     // Using/Aliasing
    8573             :     using EMSManager::CheckIfNodeSetPointManagedByEMS;
    8574             : 
    8575             :     // Locals
    8576             :     // SUBROUTINE PARAMETER DEFINITIONS:
    8577             :     // na
    8578             : 
    8579             :     // INTERFACE BLOCK SPECIFICATIONS
    8580             :     // na
    8581             : 
    8582             :     // DERIVED TYPE DEFINITIONS
    8583             :     // na
    8584             : 
    8585             :     // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    8586             :     int SetPtMgrNum;
    8587             :     int CtrlNodeIndex;
    8588             :     int NodeNum;
    8589             : 
    8590             :     // Loop over all the Scheduled Setpoint Managers
    8591             : 
    8592     9487280 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumSchSetPtMgrs; ++SetPtMgrNum) {
    8593             : 
    8594    13795165 :         for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).NumCtrlNodes;
    8595             :              ++CtrlNodeIndex) { // Loop over the list of nodes wanting
    8596             :             // setpoints from this setpoint manager
    8597     6941493 :             NodeNum = state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number
    8598             : 
    8599     6941493 :             switch (state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).CtrlTypeMode) {
    8600             :                 // set the setpoint depending on the type of variable being controlled
    8601     6921594 :             case CtrlVarType::Temp: {
    8602     6921594 :                 state.dataLoopNodes->Node(NodeNum).TempSetPoint = state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).SetPt;
    8603     6921594 :             } break;
    8604           0 :             case CtrlVarType::MaxTemp: {
    8605           0 :                 state.dataLoopNodes->Node(NodeNum).TempSetPointHi = state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).SetPt;
    8606           0 :             } break;
    8607           0 :             case CtrlVarType::MinTemp: {
    8608           0 :                 state.dataLoopNodes->Node(NodeNum).TempSetPointLo = state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).SetPt;
    8609           0 :             } break;
    8610           0 :             case CtrlVarType::HumRat: {
    8611           0 :                 state.dataLoopNodes->Node(NodeNum).HumRatSetPoint = state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).SetPt;
    8612           0 :             } break;
    8613       17872 :             case CtrlVarType::MaxHumRat: {
    8614       17872 :                 state.dataLoopNodes->Node(NodeNum).HumRatMax = state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).SetPt;
    8615       17872 :             } break;
    8616        2027 :             case CtrlVarType::MinHumRat: {
    8617        2027 :                 state.dataLoopNodes->Node(NodeNum).HumRatMin = state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).SetPt;
    8618        2027 :             } break;
    8619           0 :             case CtrlVarType::MassFlow: {
    8620           0 :                 state.dataLoopNodes->Node(NodeNum).MassFlowRateSetPoint = state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).SetPt;
    8621           0 :             } break;
    8622           0 :             case CtrlVarType::MaxMassFlow: {
    8623           0 :                 state.dataLoopNodes->Node(NodeNum).MassFlowRateMax = state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).SetPt;
    8624           0 :             } break;
    8625           0 :             case CtrlVarType::MinMassFlow: {
    8626           0 :                 state.dataLoopNodes->Node(NodeNum).MassFlowRateMin = state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).SetPt;
    8627           0 :             } break;
    8628           0 :             default:
    8629           0 :                 break;
    8630             :             }
    8631             : 
    8632             :         } // nodes in list
    8633             : 
    8634             :     } // setpoint manger:scheduled
    8635             : 
    8636             :     // Loop over all the Scheduled TES Setpoint Managers
    8637             : 
    8638     2637070 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumSchTESSetPtMgrs; ++SetPtMgrNum) {
    8639             : 
    8640             :         // only one setpoint for each scheduled TES setpoint manager and its a temperature setpoint
    8641        3462 :         NodeNum = state.dataSetPointManager->SchTESSetPtMgr(SetPtMgrNum).CtrlNodeNum; // Get the node number
    8642        3462 :         state.dataLoopNodes->Node(NodeNum).TempSetPoint = state.dataSetPointManager->SchTESSetPtMgr(SetPtMgrNum).SetPt;
    8643             : 
    8644             :     } // setpoint manger:scheduledTES
    8645             : 
    8646             :     // Loop over all the Scheduled Dual Setpoint Managers
    8647             : 
    8648     2667263 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumDualSchSetPtMgrs; ++SetPtMgrNum) {
    8649             : 
    8650       81172 :         for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->DualSchSetPtMgr(SetPtMgrNum).NumCtrlNodes;
    8651             :              ++CtrlNodeIndex) { // Loop over the list of nodes wanting
    8652             :             // setpoints from this setpoint manager
    8653       47517 :             NodeNum = state.dataSetPointManager->DualSchSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number
    8654             : 
    8655       47517 :             if (state.dataSetPointManager->DualSchSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::Temp) {
    8656       47517 :                 state.dataLoopNodes->Node(NodeNum).TempSetPointHi =
    8657       47517 :                     state.dataSetPointManager->DualSchSetPtMgr(SetPtMgrNum).SetPtHi; // Set the setpoint High
    8658       47517 :                 state.dataLoopNodes->Node(NodeNum).TempSetPointLo =
    8659       47517 :                     state.dataSetPointManager->DualSchSetPtMgr(SetPtMgrNum).SetPtLo; // Set the setpoint Low
    8660       47517 :                 state.dataLoopNodes->Node(NodeNum).TempSetPoint =
    8661       47517 :                     (state.dataLoopNodes->Node(NodeNum).TempSetPointHi + state.dataLoopNodes->Node(NodeNum).TempSetPointLo) /
    8662             :                     2.0; // average of the high and low
    8663             :             }
    8664             :         }
    8665             :     }
    8666             : 
    8667             :     // Loop over all the Outside Air Setpoint Managers
    8668             : 
    8669     3128197 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumOutAirSetPtMgrs; ++SetPtMgrNum) {
    8670             : 
    8671     1063233 :         for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->OutAirSetPtMgr(SetPtMgrNum).NumCtrlNodes;
    8672             :              ++CtrlNodeIndex) { // Loop over the list of nodes wanting
    8673             :             // setpoints from this setpoint manager
    8674      568644 :             NodeNum = state.dataSetPointManager->OutAirSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number
    8675      568644 :             if (state.dataSetPointManager->OutAirSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::Temp) {
    8676      568644 :                 state.dataLoopNodes->Node(NodeNum).TempSetPoint = state.dataSetPointManager->OutAirSetPtMgr(SetPtMgrNum).SetPt; // Set the setpoint
    8677           0 :             } else if (state.dataSetPointManager->OutAirSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::MaxTemp) {
    8678           0 :                 state.dataLoopNodes->Node(NodeNum).TempSetPointHi =
    8679           0 :                     state.dataSetPointManager->OutAirSetPtMgr(SetPtMgrNum).SetPt; // Set the high temperature setpoint
    8680           0 :             } else if (state.dataSetPointManager->OutAirSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::MinTemp) {
    8681           0 :                 state.dataLoopNodes->Node(NodeNum).TempSetPointLo =
    8682           0 :                     state.dataSetPointManager->OutAirSetPtMgr(SetPtMgrNum).SetPt; // Set the low temperature setpoint
    8683             :             }
    8684             :         }
    8685             :     }
    8686             : 
    8687             :     // Loop over all the Single Zone Reheat Setpoint Managers
    8688             : 
    8689     3778686 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumSZRhSetPtMgrs; ++SetPtMgrNum) {
    8690             : 
    8691     2377531 :         for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->SingZoneRhSetPtMgr(SetPtMgrNum).NumCtrlNodes;
    8692             :              ++CtrlNodeIndex) { // Loop over the list of nodes wanting
    8693             :             // setpoints from this setpoint manager
    8694     1232453 :             NodeNum = state.dataSetPointManager->SingZoneRhSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number
    8695             : 
    8696     1232453 :             if (state.dataSetPointManager->SingZoneRhSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::Temp) {
    8697     1232453 :                 state.dataLoopNodes->Node(NodeNum).TempSetPoint =
    8698     1232453 :                     state.dataSetPointManager->SingZoneRhSetPtMgr(SetPtMgrNum).SetPt; // Set the setpoint
    8699             :             }
    8700             :         }
    8701             :     }
    8702             : 
    8703             :     // Loop over all the Single Zone Heating Setpoint Managers
    8704             : 
    8705     2775689 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumSZHtSetPtMgrs; ++SetPtMgrNum) {
    8706             : 
    8707      287884 :         for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->SingZoneHtSetPtMgr(SetPtMgrNum).NumCtrlNodes;
    8708             :              ++CtrlNodeIndex) { // Loop over the list of nodes wanting
    8709             :             // setpoints from this setpoint manager
    8710      145803 :             NodeNum = state.dataSetPointManager->SingZoneHtSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number
    8711             : 
    8712      145803 :             if (state.dataSetPointManager->SingZoneHtSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::Temp) {
    8713      145803 :                 state.dataLoopNodes->Node(NodeNum).TempSetPoint =
    8714      145803 :                     state.dataSetPointManager->SingZoneHtSetPtMgr(SetPtMgrNum).SetPt; // Set the setpoint
    8715             :             }
    8716             :         }
    8717             :     }
    8718             : 
    8719             :     // Loop over all the Single Zone Cooling Setpoint Managers
    8720             : 
    8721     2987292 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumSZClSetPtMgrs; ++SetPtMgrNum) {
    8722             : 
    8723      732580 :         for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->SingZoneClSetPtMgr(SetPtMgrNum).NumCtrlNodes;
    8724             :              ++CtrlNodeIndex) { // Loop over the list of nodes wanting
    8725             :             // setpoints from this setpoint manager
    8726      378896 :             NodeNum = state.dataSetPointManager->SingZoneClSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number
    8727             : 
    8728      378896 :             if (state.dataSetPointManager->SingZoneClSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::Temp) {
    8729      378896 :                 state.dataLoopNodes->Node(NodeNum).TempSetPoint =
    8730      378896 :                     state.dataSetPointManager->SingZoneClSetPtMgr(SetPtMgrNum).SetPt; // Set the setpoint
    8731             :             }
    8732             :         }
    8733             :     }
    8734             : 
    8735             :     // Loop over all the Single Zone Minimum Humidity Setpoint Managers
    8736             : 
    8737     2705723 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumSZMinHumSetPtMgrs; ++SetPtMgrNum) {
    8738             : 
    8739      144230 :         for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->SZMinHumSetPtMgr(SetPtMgrNum).NumCtrlNodes;
    8740             :              ++CtrlNodeIndex) { // Loop over the list of nodes wanting
    8741             :             // setpoints from this setpoint manager
    8742       72115 :             NodeNum = state.dataSetPointManager->SZMinHumSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number
    8743             : 
    8744       72115 :             state.dataLoopNodes->Node(NodeNum).HumRatMin = state.dataSetPointManager->SZMinHumSetPtMgr(SetPtMgrNum).SetPt; // Set the setpoint
    8745             :         }
    8746             :     }
    8747             : 
    8748             :     // Loop over all the Single Zone Maximum Humidity Setpoint Managers
    8749             : 
    8750     2770819 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumSZMaxHumSetPtMgrs; ++SetPtMgrNum) {
    8751             : 
    8752      274422 :         for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->SZMaxHumSetPtMgr(SetPtMgrNum).NumCtrlNodes;
    8753             :              ++CtrlNodeIndex) { // Loop over the list of nodes wanting
    8754             :             // setpoints from this setpoint manager
    8755      137211 :             NodeNum = state.dataSetPointManager->SZMaxHumSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number
    8756             : 
    8757      137211 :             state.dataLoopNodes->Node(NodeNum).HumRatMax = state.dataSetPointManager->SZMaxHumSetPtMgr(SetPtMgrNum).SetPt; // Set the setpoint
    8758             :         }
    8759             :     }
    8760             : 
    8761             :     // Loop over all the Warmest Setpoint Managers
    8762             : 
    8763     2679238 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumWarmestSetPtMgrs; ++SetPtMgrNum) {
    8764             : 
    8765       91260 :         for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->WarmestSetPtMgr(SetPtMgrNum).NumCtrlNodes;
    8766             :              ++CtrlNodeIndex) { // Loop over the list of nodes wanting
    8767             :             // setpoints from this setpoint manager
    8768       45630 :             NodeNum = state.dataSetPointManager->WarmestSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number
    8769             : 
    8770       45630 :             if (state.dataSetPointManager->WarmestSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::Temp) {
    8771       45630 :                 state.dataLoopNodes->Node(NodeNum).TempSetPoint = state.dataSetPointManager->WarmestSetPtMgr(SetPtMgrNum).SetPt; // Set the setpoint
    8772             :             }
    8773             :         }
    8774             :     }
    8775             : 
    8776             :     // Loop over all the Coldest Setpoint Managers
    8777             : 
    8778     2636323 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumColdestSetPtMgrs; ++SetPtMgrNum) {
    8779             : 
    8780        5430 :         for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->ColdestSetPtMgr(SetPtMgrNum).NumCtrlNodes;
    8781             :              ++CtrlNodeIndex) { // Loop over the list of nodes wanting
    8782             :             // setpoints from this setpoint manager
    8783        2715 :             NodeNum = state.dataSetPointManager->ColdestSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number
    8784             : 
    8785        2715 :             if (state.dataSetPointManager->ColdestSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::Temp) {
    8786        2715 :                 state.dataLoopNodes->Node(NodeNum).TempSetPoint = state.dataSetPointManager->ColdestSetPtMgr(SetPtMgrNum).SetPt; // Set the setpoint
    8787             :             }
    8788             :         }
    8789             :     }
    8790             : 
    8791             :     // Loop over all the Warmest Temp Flow Setpoint Managers
    8792             : 
    8793     2640492 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumWarmestSetPtMgrsTempFlow; ++SetPtMgrNum) {
    8794             : 
    8795       13768 :         for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->WarmestSetPtMgrTempFlow(SetPtMgrNum).NumCtrlNodes;
    8796             :              ++CtrlNodeIndex) { // Loop over the list of nodes wanting
    8797             :             // setpoints from this setpoint manager
    8798        6884 :             NodeNum = state.dataSetPointManager->WarmestSetPtMgrTempFlow(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number
    8799             : 
    8800        6884 :             if (state.dataSetPointManager->WarmestSetPtMgrTempFlow(SetPtMgrNum).CtrlTypeMode == CtrlVarType::Temp) {
    8801        6884 :                 state.dataLoopNodes->Node(NodeNum).TempSetPoint =
    8802        6884 :                     state.dataSetPointManager->WarmestSetPtMgrTempFlow(SetPtMgrNum).SetPt; // Set the supply air temperature setpoint
    8803        6884 :                 state.dataAirLoop->AirLoopFlow(state.dataSetPointManager->WarmestSetPtMgrTempFlow(SetPtMgrNum).AirLoopNum).ReqSupplyFrac =
    8804        6884 :                     state.dataSetPointManager->WarmestSetPtMgrTempFlow(SetPtMgrNum).Turndown; // Set the supply air flow rate
    8805        6884 :                 state.dataAirLoop->AirLoopControlInfo(state.dataSetPointManager->WarmestSetPtMgrTempFlow(SetPtMgrNum).AirLoopNum).LoopFlowRateSet =
    8806             :                     true; // PH 8/17/07
    8807             :             }
    8808             :         }
    8809             :     }
    8810             : 
    8811     2635613 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumRABFlowSetPtMgrs; ++SetPtMgrNum) {
    8812             : 
    8813        2005 :         NodeNum = state.dataSetPointManager->RABFlowSetPtMgr(SetPtMgrNum).RABSplitOutNode; // Get the node number
    8814             : 
    8815        2005 :         if (state.dataSetPointManager->RABFlowSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::MassFlow) {
    8816        2005 :             state.dataLoopNodes->Node(NodeNum).MassFlowRateSetPoint =
    8817        2005 :                 state.dataSetPointManager->RABFlowSetPtMgr(SetPtMgrNum).FlowSetPt; // Set the flow setpoint
    8818             :         }
    8819             :     }
    8820             : 
    8821             :     // Loop over all the MultiZone Average Cooling Setpoint Managers
    8822     2636308 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumMZClgAverageSetPtMgrs; ++SetPtMgrNum) {
    8823        5400 :         for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->MZAverageCoolingSetPtMgr(SetPtMgrNum).NumCtrlNodes;
    8824             :              ++CtrlNodeIndex) { // Loop over the list of nodes wanting
    8825             :             //  setpoints from this setpoint manager
    8826        2700 :             NodeNum = state.dataSetPointManager->MZAverageCoolingSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number
    8827        2700 :             if (state.dataSetPointManager->MZAverageCoolingSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::Temp) {
    8828        2700 :                 state.dataLoopNodes->Node(NodeNum).TempSetPoint =
    8829        2700 :                     state.dataSetPointManager->MZAverageCoolingSetPtMgr(SetPtMgrNum).SetPt; // Set the temperature setpoint
    8830             :             }
    8831             :         }
    8832             :     }
    8833             : 
    8834             :     // Loop over all the MultiZone Average Heating Setpoint Managers
    8835     2636308 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumMZHtgAverageSetPtMgrs; ++SetPtMgrNum) {
    8836        5400 :         for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->MZAverageHeatingSetPtMgr(SetPtMgrNum).NumCtrlNodes;
    8837             :              ++CtrlNodeIndex) { // Loop over the list of nodes wanting
    8838             :             //  setpoints from this setpoint manager
    8839        2700 :             NodeNum = state.dataSetPointManager->MZAverageHeatingSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number
    8840        2700 :             if (state.dataSetPointManager->MZAverageHeatingSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::Temp) {
    8841        2700 :                 state.dataLoopNodes->Node(NodeNum).TempSetPoint =
    8842        2700 :                     state.dataSetPointManager->MZAverageHeatingSetPtMgr(SetPtMgrNum).SetPt; // Set the temperature setpoint
    8843             :             }
    8844             :         }
    8845             :     }
    8846             : 
    8847             :     // Loop over all the MultiZone Average Minimum Humidity Setpoint Managers
    8848     2635118 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumMZAverageMinHumSetPtMgrs; ++SetPtMgrNum) {
    8849        3020 :         for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->MZAverageMinHumSetPtMgr(SetPtMgrNum).NumCtrlNodes;
    8850             :              ++CtrlNodeIndex) { // Loop over the list of nodes wanting
    8851             :             //  setpoints from this setpoint manager
    8852        1510 :             NodeNum = state.dataSetPointManager->MZAverageMinHumSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number
    8853        1510 :             if (state.dataSetPointManager->MZAverageMinHumSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::MinHumRat) {
    8854        1510 :                 state.dataLoopNodes->Node(NodeNum).HumRatMin =
    8855        1510 :                     state.dataSetPointManager->MZAverageMinHumSetPtMgr(SetPtMgrNum).SetPt; // Set the humidity ratio setpoint
    8856             :             }
    8857             :         }
    8858             :     }
    8859             : 
    8860             :     // Loop over all the MultiZone Average Maxiumum Humidity Setpoint Managers
    8861     2635118 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumMZAverageMaxHumSetPtMgrs; ++SetPtMgrNum) {
    8862        3020 :         for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->MZAverageMaxHumSetPtMgr(SetPtMgrNum).NumCtrlNodes;
    8863             :              ++CtrlNodeIndex) { // Loop over the list of nodes wanting
    8864             :             //  setpoints from this setpoint manager
    8865        1510 :             NodeNum = state.dataSetPointManager->MZAverageMaxHumSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number
    8866        1510 :             if (state.dataSetPointManager->MZAverageMaxHumSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::MaxHumRat) {
    8867        1510 :                 state.dataLoopNodes->Node(NodeNum).HumRatMax =
    8868        1510 :                     state.dataSetPointManager->MZAverageMaxHumSetPtMgr(SetPtMgrNum).SetPt; // Set the humidity ratio setpoint
    8869             :             }
    8870             :         }
    8871             :     }
    8872             : 
    8873             :     // Loop over all the Multizone Minimum Humidity Ratio Setpoint Managers
    8874     2649402 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumMZMinHumSetPtMgrs; ++SetPtMgrNum) {
    8875       31588 :         for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->MZMinHumSetPtMgr(SetPtMgrNum).NumCtrlNodes;
    8876             :              ++CtrlNodeIndex) { // Loop over the list of nodes wanting
    8877             :             //  setpoints from this setpoint manager
    8878       15794 :             NodeNum = state.dataSetPointManager->MZMinHumSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number
    8879       15794 :             if (state.dataSetPointManager->MZMinHumSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::MinHumRat) {
    8880       15794 :                 state.dataLoopNodes->Node(NodeNum).HumRatMin =
    8881       15794 :                     state.dataSetPointManager->MZMinHumSetPtMgr(SetPtMgrNum).SetPt; // Set the humidity ratio setpoint
    8882             :             }
    8883             :         }
    8884             :     }
    8885             : 
    8886             :     // Loop over all the Multizone Maximum Humidity Ratio Setpoint Managers
    8887     2661946 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumMZMaxHumSetPtMgrs; ++SetPtMgrNum) {
    8888       65194 :         for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->MZMaxHumSetPtMgr(SetPtMgrNum).NumCtrlNodes;
    8889             :              ++CtrlNodeIndex) { // Loop over the list of nodes wanting
    8890             :             //  setpoints from this setpoint manager
    8891       36856 :             NodeNum = state.dataSetPointManager->MZMaxHumSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number
    8892       36856 :             if (state.dataSetPointManager->MZMaxHumSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::MaxHumRat) {
    8893       36856 :                 state.dataLoopNodes->Node(NodeNum).HumRatMax =
    8894       36856 :                     state.dataSetPointManager->MZMaxHumSetPtMgr(SetPtMgrNum).SetPt; // Set the humidity ratio setpoint
    8895             :             }
    8896             :         }
    8897             :     }
    8898             : 
    8899             :     // Loop over all the Follow Outdoor Air Setpoint Managers
    8900     3317339 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumFollowOATempSetPtMgrs; ++SetPtMgrNum) {
    8901     1367462 :         for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->FollowOATempSetPtMgr(SetPtMgrNum).NumCtrlNodes;
    8902             :              ++CtrlNodeIndex) { // Loop over the list of nodes wanting
    8903             :             //  setpoints from this setpoint manager
    8904      683731 :             NodeNum = state.dataSetPointManager->FollowOATempSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number
    8905      683731 :             if (state.dataSetPointManager->FollowOATempSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::Temp) {
    8906      683731 :                 state.dataLoopNodes->Node(NodeNum).TempSetPoint =
    8907      683731 :                     state.dataSetPointManager->FollowOATempSetPtMgr(SetPtMgrNum).SetPt; // Set the temperature setpoint
    8908           0 :             } else if (state.dataSetPointManager->FollowOATempSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::MaxTemp) {
    8909           0 :                 state.dataLoopNodes->Node(NodeNum).TempSetPointHi =
    8910           0 :                     state.dataSetPointManager->FollowOATempSetPtMgr(SetPtMgrNum).SetPt; // Set the temperature setpoint
    8911           0 :             } else if (state.dataSetPointManager->FollowOATempSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::MinTemp) {
    8912           0 :                 state.dataLoopNodes->Node(NodeNum).TempSetPointLo =
    8913           0 :                     state.dataSetPointManager->FollowOATempSetPtMgr(SetPtMgrNum).SetPt; // Set the temperature setpoint
    8914             :             }
    8915             :         }
    8916             :     }
    8917             : 
    8918             :     // Loop over all the Follow System Node Temperature Setpoint Managers
    8919     2636541 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumFollowSysNodeTempSetPtMgrs; ++SetPtMgrNum) {
    8920        5866 :         for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->FollowSysNodeTempSetPtMgr(SetPtMgrNum).NumCtrlNodes;
    8921             :              ++CtrlNodeIndex) { // Loop over the list of nodes wanting
    8922             :             //  setpoints from this setpoint manager
    8923        2933 :             NodeNum = state.dataSetPointManager->FollowSysNodeTempSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number
    8924        2933 :             if (state.dataSetPointManager->FollowSysNodeTempSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::Temp) {
    8925        2933 :                 state.dataLoopNodes->Node(NodeNum).TempSetPoint =
    8926        2933 :                     state.dataSetPointManager->FollowSysNodeTempSetPtMgr(SetPtMgrNum).SetPt; // Set the temperature setpoint
    8927           0 :             } else if (state.dataSetPointManager->FollowSysNodeTempSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::MaxTemp) {
    8928           0 :                 state.dataLoopNodes->Node(NodeNum).TempSetPointHi =
    8929           0 :                     state.dataSetPointManager->FollowSysNodeTempSetPtMgr(SetPtMgrNum).SetPt; // Set the temperature setpoint
    8930           0 :             } else if (state.dataSetPointManager->FollowSysNodeTempSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::MinTemp) {
    8931           0 :                 state.dataLoopNodes->Node(NodeNum).TempSetPointLo =
    8932           0 :                     state.dataSetPointManager->FollowSysNodeTempSetPtMgr(SetPtMgrNum).SetPt; // Set the temperature setpoint
    8933             :             }
    8934             :         }
    8935             :     }
    8936             : 
    8937             :     // Loop over all the Ground Tempearture Setpoint Managers
    8938     2669858 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumGroundTempSetPtMgrs; ++SetPtMgrNum) {
    8939       72500 :         for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->GroundTempSetPtMgr(SetPtMgrNum).NumCtrlNodes;
    8940             :              ++CtrlNodeIndex) { // Loop over the list of nodes wanting
    8941             :             //  setpoints from this setpoint manager
    8942       36250 :             NodeNum = state.dataSetPointManager->GroundTempSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number
    8943       36250 :             if (state.dataSetPointManager->GroundTempSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::Temp) {
    8944       36250 :                 state.dataLoopNodes->Node(NodeNum).TempSetPoint =
    8945       36250 :                     state.dataSetPointManager->GroundTempSetPtMgr(SetPtMgrNum).SetPt; // Set the temperature setpoint
    8946           0 :             } else if (state.dataSetPointManager->GroundTempSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::MaxTemp) {
    8947           0 :                 state.dataLoopNodes->Node(NodeNum).TempSetPointHi =
    8948           0 :                     state.dataSetPointManager->GroundTempSetPtMgr(SetPtMgrNum).SetPt; // Set the temperature setpoint
    8949           0 :             } else if (state.dataSetPointManager->GroundTempSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::MinTemp) {
    8950           0 :                 state.dataLoopNodes->Node(NodeNum).TempSetPointLo =
    8951           0 :                     state.dataSetPointManager->GroundTempSetPtMgr(SetPtMgrNum).SetPt; // Set the temperature setpoint
    8952             :             }
    8953             :         }
    8954             :     }
    8955             : 
    8956             :     // Loop over all Condenser Entering Set Point Managers
    8957             : 
    8958     2639484 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumCondEntSetPtMgrs; ++SetPtMgrNum) {
    8959       11752 :         for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->CondEntSetPtMgr(SetPtMgrNum).NumCtrlNodes;
    8960             :              ++CtrlNodeIndex) { // Loop over the list of nodes wanting
    8961             :             //  set points from this set point manager
    8962        5876 :             NodeNum = state.dataSetPointManager->CondEntSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number
    8963        5876 :             if (state.dataSetPointManager->CondEntSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::Temp) {
    8964        5876 :                 state.dataLoopNodes->Node(NodeNum).TempSetPoint =
    8965        5876 :                     state.dataSetPointManager->CondEntSetPtMgr(SetPtMgrNum).SetPt; // Set the temperature setpoint
    8966             :             }
    8967             :         }
    8968             :     }
    8969             : 
    8970             :     // Loop over all Ideal Condenser Entering Set Point Managers
    8971             : 
    8972     2638990 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumIdealCondEntSetPtMgrs; ++SetPtMgrNum) {
    8973       13413 :         for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->IdealCondEntSetPtMgr(SetPtMgrNum).NumCtrlNodes;
    8974             :              ++CtrlNodeIndex) { // Loop over the list of nodes wanting
    8975             :             // set points from this set point manager
    8976        8031 :             NodeNum = state.dataSetPointManager->IdealCondEntSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number
    8977        8031 :             if (state.dataSetPointManager->IdealCondEntSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::Temp) {
    8978        8031 :                 state.dataLoopNodes->Node(NodeNum).TempSetPoint =
    8979        8031 :                     state.dataSetPointManager->IdealCondEntSetPtMgr(SetPtMgrNum).SetPt; // Set the temperature setpoint
    8980             :             }
    8981             :         }
    8982             :     }
    8983             : 
    8984             :     // loop over all single zone on/off cooling setpoint managers
    8985     2720020 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumSZOneStageCoolingSetPtMgrs; ++SetPtMgrNum) {
    8986      172824 :         for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->SZOneStageCoolingSetPtMgr(SetPtMgrNum).NumCtrlNodes;
    8987             :              ++CtrlNodeIndex) { // Loop over the list of nodes wanting
    8988             :             // set points from this set point manager
    8989       86412 :             NodeNum = state.dataSetPointManager->SZOneStageCoolingSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number
    8990       86412 :             if (state.dataSetPointManager->SZOneStageCoolingSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::Temp) {
    8991       86412 :                 state.dataLoopNodes->Node(NodeNum).TempSetPoint =
    8992       86412 :                     state.dataSetPointManager->SZOneStageCoolingSetPtMgr(SetPtMgrNum).SetPt; // Set the temperature setpoint
    8993             :             }
    8994             :         }
    8995             :     }
    8996             : 
    8997             :     // loop over all single zone on/off heating setpoint managers
    8998     2720020 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumSZOneStageHeatingSetPtMgrs; ++SetPtMgrNum) {
    8999      172824 :         for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->SZOneStageHeatingSetPtMgr(SetPtMgrNum).NumCtrlNodes;
    9000             :              ++CtrlNodeIndex) { // Loop over the list of nodes wanting
    9001             :             // set points from this set point manager
    9002       86412 :             NodeNum = state.dataSetPointManager->SZOneStageHeatingSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number
    9003       86412 :             if (state.dataSetPointManager->SZOneStageHeatingSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::Temp) {
    9004       86412 :                 state.dataLoopNodes->Node(NodeNum).TempSetPoint =
    9005       86412 :                     state.dataSetPointManager->SZOneStageHeatingSetPtMgr(SetPtMgrNum).SetPt; // Set the temperature setpoint
    9006             :             }
    9007             :         }
    9008             :     }
    9009             : 
    9010             :     // return water temperature reset setpoint managers
    9011     2650254 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumReturnWaterResetChWSetPtMgrs; ++SetPtMgrNum) {
    9012       16646 :         auto &returnWaterSPM(state.dataSetPointManager->ReturnWaterResetChWSetPtMgr(SetPtMgrNum));
    9013       16646 :         if (returnWaterSPM.plantSetpointNodeIndex > 0) {
    9014       16646 :             state.dataLoopNodes->Node(returnWaterSPM.plantSetpointNodeIndex).TempSetPoint = returnWaterSPM.currentSupplySetPt;
    9015             :         } else {
    9016             :             // if plant isn't set up yet, no need to set anything, just wait
    9017             :         }
    9018             :     }
    9019             : 
    9020             :     // hot-water return water temperature reset setpoint managers
    9021     2648328 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumReturnWaterResetHWSetPtMgrs; ++SetPtMgrNum) {
    9022       14720 :         auto &returnWaterSPM(state.dataSetPointManager->ReturnWaterResetHWSetPtMgr(SetPtMgrNum));
    9023       14720 :         if (returnWaterSPM.plantSetpointNodeIndex > 0) {
    9024       14720 :             state.dataLoopNodes->Node(returnWaterSPM.plantSetpointNodeIndex).TempSetPoint = returnWaterSPM.currentSupplySetPt;
    9025             :         } else {
    9026             :             // if plant isn't set up yet, no need to set anything, just wait
    9027             :         }
    9028             :     }
    9029             : 
    9030             :     // Loop over all the System Node Reset Setpoint Managers
    9031     2640532 :     for (SetPtMgrNum = 1;
    9032     2640532 :          SetPtMgrNum <= (state.dataSetPointManager->NumSystemNodeResetTempSetPtMgrs + state.dataSetPointManager->NumSystemNodeResetHumSetPtMgrs);
    9033             :          ++SetPtMgrNum) {
    9034             : 
    9035       13848 :         for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->SystemNodeResetSetPtMgr(SetPtMgrNum).NumCtrlNodes;
    9036             :              ++CtrlNodeIndex) { // Loop over the list of nodes wanting
    9037             :             // setpoints from this setpoint manager
    9038        6924 :             NodeNum = state.dataSetPointManager->SystemNodeResetSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number
    9039        6924 :             switch (state.dataSetPointManager->SystemNodeResetSetPtMgr(SetPtMgrNum).CtrlTypeMode) {
    9040        5193 :             case CtrlVarType::Temp:
    9041        5193 :                 state.dataLoopNodes->Node(NodeNum).TempSetPoint =
    9042        5193 :                     state.dataSetPointManager->SystemNodeResetSetPtMgr(SetPtMgrNum).SetPt; // Set the temperature setpoint
    9043        5193 :                 break;
    9044           0 :             case CtrlVarType::MaxTemp:
    9045           0 :                 state.dataLoopNodes->Node(NodeNum).TempSetPointHi =
    9046           0 :                     state.dataSetPointManager->SystemNodeResetSetPtMgr(SetPtMgrNum).SetPt; // Set the maximum temperature setpoint
    9047           0 :                 break;
    9048           0 :             case CtrlVarType::MinTemp:
    9049           0 :                 state.dataLoopNodes->Node(NodeNum).TempSetPointLo =
    9050           0 :                     state.dataSetPointManager->SystemNodeResetSetPtMgr(SetPtMgrNum).SetPt; // Set the minimum temperature setpoint
    9051           0 :                 break;
    9052           0 :             case CtrlVarType::HumRat:
    9053           0 :                 state.dataLoopNodes->Node(NodeNum).HumRatSetPoint =
    9054           0 :                     state.dataSetPointManager->SystemNodeResetSetPtMgr(SetPtMgrNum).SetPt; // Set the humidity ratio setpoint
    9055           0 :                 break;
    9056        1731 :             case CtrlVarType::MaxHumRat:
    9057        1731 :                 state.dataLoopNodes->Node(NodeNum).HumRatMax =
    9058        1731 :                     state.dataSetPointManager->SystemNodeResetSetPtMgr(SetPtMgrNum).SetPt; // Set the maximum humidity ratio setpoint
    9059        1731 :                 break;
    9060           0 :             case CtrlVarType::MinHumRat:
    9061           0 :                 state.dataLoopNodes->Node(NodeNum).HumRatMin =
    9062           0 :                     state.dataSetPointManager->SystemNodeResetSetPtMgr(SetPtMgrNum).SetPt; // Set the minimum humidity ratio setpoint
    9063           0 :                 break;
    9064           0 :             default:
    9065           0 :                 break;
    9066             :             }
    9067             :         }
    9068             :     }
    9069     2633608 : }
    9070             : 
    9071     2633608 : void UpdateMixedAirSetPoints(EnergyPlusData &state)
    9072             : {
    9073             : 
    9074             :     // SUBROUTINE INFORMATION:
    9075             :     //       AUTHOR         Fred Buhl
    9076             :     //       DATE WRITTEN   May 2001
    9077             :     //       MODIFIED       na
    9078             :     //       RE-ENGINEERED  na
    9079             : 
    9080             :     // PURPOSE OF THIS SUBROUTINE
    9081             :     // Loop over all the Mixed Air Managers and use their output arrays
    9082             :     // to set the node setpoints.
    9083             : 
    9084             :     // METHODOLOGY EMPLOYED:
    9085             : 
    9086             :     // REFERENCES:
    9087             :     // na
    9088             : 
    9089             :     // USE STATEMENTS:
    9090             : 
    9091             :     // Locals
    9092             :     // SUBROUTINE PARAMETER DEFINITIONS:
    9093             :     // na
    9094             : 
    9095             :     // INTERFACE BLOCK SPECIFICATIONS
    9096             :     // na
    9097             : 
    9098             :     // DERIVED TYPE DEFINITIONS
    9099             :     // na
    9100             : 
    9101             :     // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    9102             :     int SetPtMgrNum;
    9103             :     int CtrlNodeIndex;
    9104             :     int NodeNum;
    9105             : 
    9106             :     // Loop over all the Mixed Air Setpoint Managers
    9107             : 
    9108     9175243 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumMixedAirSetPtMgrs; ++SetPtMgrNum) {
    9109             : 
    9110    13849284 :         for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->MixedAirSetPtMgr(SetPtMgrNum).NumCtrlNodes;
    9111             :              ++CtrlNodeIndex) { // Loop over the list of nodes wanting
    9112             :             // setpoints from this setpoint manager
    9113     7307649 :             NodeNum = state.dataSetPointManager->MixedAirSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number
    9114             : 
    9115     7307649 :             if (state.dataSetPointManager->MixedAirSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::Temp) {
    9116     7307649 :                 state.dataLoopNodes->Node(NodeNum).TempSetPoint = state.dataSetPointManager->MixedAirSetPtMgr(SetPtMgrNum).SetPt; // Set the setpoint
    9117             :             }
    9118             :         }
    9119             :     }
    9120     2633608 : }
    9121             : 
    9122     2633608 : void UpdateOAPretreatSetPoints(EnergyPlusData &state)
    9123             : {
    9124             : 
    9125             :     // SUBROUTINE INFORMATION:
    9126             :     //       AUTHOR         M. J. Witte based on UpdateMixedAirSetPoints by Fred Buhl,
    9127             :     //                        Work supported by ASHRAE research project 1254-RP
    9128             :     //       DATE WRITTEN   January 2005
    9129             :     //       MODIFIED       na
    9130             :     //       RE-ENGINEERED  na
    9131             : 
    9132             :     // PURPOSE OF THIS SUBROUTINE
    9133             :     // Loop over all the Outside Air Pretreat Managers and use their output arrays
    9134             :     // to set the node setpoints.
    9135             : 
    9136             :     // METHODOLOGY EMPLOYED:
    9137             : 
    9138             :     // REFERENCES:
    9139             :     // na
    9140             : 
    9141             :     // USE STATEMENTS:
    9142             : 
    9143             :     // Locals
    9144             :     // SUBROUTINE PARAMETER DEFINITIONS:
    9145             :     // na
    9146             : 
    9147             :     // INTERFACE BLOCK SPECIFICATIONS
    9148             :     // na
    9149             : 
    9150             :     // DERIVED TYPE DEFINITIONS
    9151             :     // na
    9152             : 
    9153             :     // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    9154             :     int SetPtMgrNum;
    9155             :     int CtrlNodeIndex;
    9156             :     int NodeNum;
    9157             : 
    9158             :     // Loop over all the Mixed Air Setpoint Managers
    9159             : 
    9160     2656375 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumOAPretreatSetPtMgrs; ++SetPtMgrNum) {
    9161             : 
    9162       45534 :         for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).NumCtrlNodes;
    9163             :              ++CtrlNodeIndex) { // Loop over the list of nodes wanting
    9164             :             // setpoints from this setpoint manager
    9165       22767 :             NodeNum = state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex); // Get the node number
    9166             : 
    9167       22767 :             switch (state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).CtrlTypeMode) {
    9168       11459 :             case CtrlVarType::Temp: { // 'Temperature'
    9169       11459 :                 state.dataLoopNodes->Node(NodeNum).TempSetPoint =
    9170       11459 :                     state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).SetPt; // Set the setpoint
    9171       11459 :             } break;
    9172       11308 :             case CtrlVarType::MaxHumRat: { // 'MaximumHumidityRatio'
    9173       11308 :                 state.dataLoopNodes->Node(NodeNum).HumRatMax = state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).SetPt; // Set the setpoint
    9174       11308 :             } break;
    9175           0 :             case CtrlVarType::MinHumRat: { // 'MinimumHumidityRatio'
    9176           0 :                 state.dataLoopNodes->Node(NodeNum).HumRatMin = state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).SetPt; // Set the setpoint
    9177           0 :             } break;
    9178           0 :             case CtrlVarType::HumRat: { // 'HumidityRatio'
    9179           0 :                 state.dataLoopNodes->Node(NodeNum).HumRatSetPoint =
    9180           0 :                     state.dataSetPointManager->OAPretreatSetPtMgr(SetPtMgrNum).SetPt; // Set the setpoint
    9181           0 :             } break;
    9182           0 :             default:
    9183           0 :                 break;
    9184             :             }
    9185             :         }
    9186             :     }
    9187     2633608 : }
    9188             : 
    9189           4 : int getSPMBasedOnNode(
    9190             :     EnergyPlusData &state, int const NodeNum, CtrlVarType const SetPtType, SetPointManagerType const SPMType, CtrlNodeType ctrlOrRefNode)
    9191             : {
    9192             : 
    9193           4 :     if (state.dataSetPointManager->GetInputFlag) {
    9194           0 :         GetSetPointManagerInputs(state);
    9195           0 :         state.dataSetPointManager->GetInputFlag = false;
    9196             :     }
    9197             : 
    9198           4 :     int getSPMBasedOnNode = 0;
    9199             : 
    9200           7 :     for (int SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumAllSetPtMgrs; ++SetPtMgrNum) {
    9201           3 :         if (SetPtType ==
    9202           3 :             state.dataSetPointManager->AllSetPtMgr(SetPtMgrNum).CtrlTypeMode) { // SetPtType is e.g., CtrlVarType::Temp, CtrlVarType::HumRat, etc.
    9203           3 :             switch (ctrlOrRefNode) { // ctrlOrRefNode is enum type of node to look for, either control node or reference node
    9204           0 :             case CtrlNodeType::Control: {
    9205           0 :                 for (int NumNode = 1; NumNode <= state.dataSetPointManager->AllSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++NumNode) {
    9206             :                     // SPMType is type of set point manager, e.g., SetPointManagerType::Scheduled, SetPointManagerType::MixedAir, etc.
    9207           0 :                     if (NodeNum == state.dataSetPointManager->AllSetPtMgr(SetPtMgrNum).CtrlNodes(NumNode) &&
    9208           0 :                         SPMType == state.dataSetPointManager->AllSetPtMgr(SetPtMgrNum).SPMType) {
    9209           0 :                         getSPMBasedOnNode = state.dataSetPointManager->AllSetPtMgr(SetPtMgrNum).SPMIndex; // SPMIndex is index to specific type of SPM
    9210           0 :                         break;
    9211             :                     }
    9212             :                 }
    9213           0 :                 break;
    9214             :             }
    9215           3 :             case CtrlNodeType::Reference: {
    9216             :                 // SPMType is type of set point manager, e.g., SetPointManagerType::Scheduled, SetPointManagerType::MixedAir, etc.
    9217           3 :                 if (NodeNum == state.dataSetPointManager->AllSetPtMgr(SetPtMgrNum).RefNode &&
    9218           0 :                     SPMType == state.dataSetPointManager->AllSetPtMgr(SetPtMgrNum).SPMType) {
    9219           0 :                     getSPMBasedOnNode = state.dataSetPointManager->AllSetPtMgr(SetPtMgrNum).SPMIndex; // SPMIndex is index to specific type of SPM
    9220             :                 }
    9221           3 :                 break;
    9222             :             }
    9223           0 :             default:
    9224           0 :                 assert(false);
    9225             :             }
    9226             :         }
    9227           3 :         if (getSPMBasedOnNode > 0) break;
    9228             :     }
    9229             : 
    9230           4 :     return getSPMBasedOnNode;
    9231             : }
    9232             : 
    9233        4436 : bool IsNodeOnSetPtManager(EnergyPlusData &state, int const NodeNum, CtrlVarType const SetPtType)
    9234             : {
    9235             : 
    9236             :     // FUNCTION INFORMATION:
    9237             :     //       AUTHOR         Sankaranarayanan K P
    9238             :     //       DATE WRITTEN   January 2007
    9239             :     //       MODIFIED       na
    9240             :     //       RE-ENGINEERED  na
    9241             : 
    9242             :     // PURPOSE OF THIS SUBROUTINE:
    9243             :     // Determines if a particular node is acted upon by a specific setpoint manager
    9244             : 
    9245             :     // METHODOLOGY EMPLOYED:
    9246             :     // Cycle through all setpoint managers and find if the node passed in has a setpoint manager of passed
    9247             :     // in type associated to it.
    9248             : 
    9249             :     // REFERENCES:
    9250             :     // na
    9251             : 
    9252             :     // USE STATEMENTS:
    9253             : 
    9254             :     // Return value
    9255             :     bool IsNodeOnSetPtManager;
    9256             : 
    9257             :     // Locals
    9258             :     int SetPtMgrNum;
    9259             :     int NumNode;
    9260             : 
    9261             :     // First time called, get the input for all the setpoint managers
    9262        4436 :     if (state.dataSetPointManager->GetInputFlag) {
    9263           0 :         GetSetPointManagerInputs(state);
    9264           0 :         state.dataSetPointManager->GetInputFlag = false;
    9265             :     }
    9266             : 
    9267        4436 :     IsNodeOnSetPtManager = false;
    9268             : 
    9269       48756 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumAllSetPtMgrs; ++SetPtMgrNum) {
    9270       44320 :         if (SetPtType == state.dataSetPointManager->AllSetPtMgr(SetPtMgrNum).CtrlTypeMode) {
    9271       87926 :             for (NumNode = 1; NumNode <= state.dataSetPointManager->AllSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++NumNode) {
    9272       46119 :                 if (NodeNum == state.dataSetPointManager->AllSetPtMgr(SetPtMgrNum).CtrlNodes(NumNode)) {
    9273        1101 :                     IsNodeOnSetPtManager = true;
    9274        1101 :                     break;
    9275             :                 }
    9276             :             }
    9277             :         }
    9278             :     }
    9279             : 
    9280        4436 :     return IsNodeOnSetPtManager;
    9281             : }
    9282             : 
    9283        4288 : bool NodeHasSPMCtrlVarType(EnergyPlusData &state, int const NodeNum, CtrlVarType const CtrlVarType)
    9284             : {
    9285             : 
    9286             :     // FUNCTION INFORMATION:
    9287             :     //       AUTHOR         Chandan Sharma
    9288             :     //       DATE WRITTEN   March 2013
    9289             :     //       MODIFIED       na
    9290             :     //       RE-ENGINEERED  na
    9291             : 
    9292             :     // PURPOSE OF THIS SUBROUTINE:
    9293             :     // Determines if a particular node is acted upon by a specific setpoint manager
    9294             : 
    9295             :     // METHODOLOGY EMPLOYED:
    9296             :     // Cycle through all setpoint managers and find if the node has a specific control type
    9297             : 
    9298             :     // REFERENCES:
    9299             :     // na
    9300             : 
    9301             :     // USE STATEMENTS:
    9302             :     // na
    9303             : 
    9304             :     // INTERFACE BLOCK SPECIFICATIONS
    9305             :     // na
    9306             : 
    9307             :     // SUBROUTINE PARAMETER DEFINITIONS:
    9308             :     // na
    9309             : 
    9310             :     // SUBROUTINE ARGUMENT DEFINITIONS:
    9311             : 
    9312             :     // Return value
    9313             :     bool NodeHasSPMCtrlVarType;
    9314             : 
    9315             :     // Locals
    9316             :     // DERIVED TYPE DEFINITIONS
    9317             :     // na
    9318             : 
    9319             :     // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    9320             :     int SetPtMgrNum; // loop counter for each set point manager
    9321             :     int NumNode;     // loop counter for each node and specific control type
    9322             : 
    9323             :     // First time called, get the input for all the setpoint managers
    9324        4288 :     if (state.dataSetPointManager->GetInputFlag) {
    9325           0 :         GetSetPointManagerInputs(state);
    9326           0 :         state.dataSetPointManager->GetInputFlag = false;
    9327             :     }
    9328             : 
    9329             :     // Initialize to false that node is not controlled by set point manager
    9330        4288 :     NodeHasSPMCtrlVarType = false;
    9331             : 
    9332       64227 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumAllSetPtMgrs; ++SetPtMgrNum) {
    9333      123701 :         for (NumNode = 1; NumNode <= state.dataSetPointManager->AllSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++NumNode) {
    9334       63762 :             if (NodeNum == state.dataSetPointManager->AllSetPtMgr(SetPtMgrNum).CtrlNodes(NumNode)) {
    9335        2250 :                 if (state.dataSetPointManager->AllSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType) {
    9336             :                     //       If specific control type is found, it doesn't matter if there are other of same type.
    9337        2175 :                     NodeHasSPMCtrlVarType = true;
    9338        2175 :                     goto SPMLoop_exit;
    9339             :                 }
    9340             :             }
    9341             :         }
    9342             :     }
    9343        2113 : SPMLoop_exit:;
    9344             : 
    9345        4288 :     return NodeHasSPMCtrlVarType;
    9346             : }
    9347             : 
    9348          43 : void ResetHumidityRatioCtrlVarType(EnergyPlusData &state, int const NodeNum)
    9349             : {
    9350             : 
    9351             :     // FUNCTION INFORMATION:
    9352             :     //       AUTHOR         Bereket Nigusse
    9353             :     //       DATE WRITTEN   August 2015
    9354             :     //       MODIFIED       na
    9355             :     //       RE-ENGINEERED  na
    9356             : 
    9357             :     // PURPOSE OF THIS SUBROUTINE:
    9358             :     // Resets setpoint control variable type to "Maximum Humidty Ratio" if control variable type
    9359             :     // is "Humidity Ratio".
    9360             : 
    9361             :     // METHODOLOGY EMPLOYED:
    9362             :     // Cycle through all setpoint managers and find if the node has a "Humidity Ratio" control
    9363             :     // variable type. This routine is called from "GetControllerInput" routine.  This reset is
    9364             :     // just to stop false warning message due to control variable type mismatch.
    9365             : 
    9366             :     // REFERENCES:
    9367             :     // na
    9368             : 
    9369             :     // USE STATEMENTS:
    9370             :     // na
    9371             : 
    9372             :     // INTERFACE BLOCK SPECIFICATIONS
    9373             :     // na
    9374             : 
    9375             :     // SUBROUTINE PARAMETER DEFINITIONS:
    9376          43 :     const char *RoutineName("ResetHumidityRatioCtrlVarType: ");
    9377             : 
    9378             :     // SUBROUTINE ARGUMENT DEFINITIONS:
    9379             :     // na
    9380             : 
    9381             :     // Locals
    9382             :     // DERIVED TYPE DEFINITIONS
    9383             :     // na
    9384             : 
    9385             :     // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    9386             :     int SetPtMgrNum;        // loop counter for each set point manager
    9387             :     int NumNode;            // loop counter for each node and specific control type
    9388             :     int SetPtMgrNumPtr;     // setpoint manager
    9389             :     bool ResetCntrlVarType; // if true reset Hum Rat control var type to maxhumidity ratio
    9390             : 
    9391             :     // First time called, get the input for all the setpoint managers
    9392          43 :     if (state.dataSetPointManager->GetInputFlag) {
    9393           0 :         GetSetPointManagerInputs(state);
    9394           0 :         state.dataSetPointManager->GetInputFlag = false;
    9395             :     }
    9396             : 
    9397          43 :     ResetCntrlVarType = false;
    9398             : 
    9399        1934 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumAllSetPtMgrs; ++SetPtMgrNum) {
    9400        3809 :         for (NumNode = 1; NumNode <= state.dataSetPointManager->AllSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++NumNode) {
    9401        1918 :             if (NodeNum == state.dataSetPointManager->AllSetPtMgr(SetPtMgrNum).CtrlNodes(NumNode)) {
    9402          86 :                 if (state.dataSetPointManager->AllSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::HumRat) {
    9403           0 :                     state.dataSetPointManager->AllSetPtMgr(SetPtMgrNum).CtrlTypeMode = CtrlVarType::MaxHumRat;
    9404           0 :                     SetPtMgrNumPtr = SetPtMgrNum;
    9405           0 :                     ResetCntrlVarType = true;
    9406           0 :                     goto SPMLoop_exit;
    9407             :                 }
    9408             :             }
    9409             :         }
    9410             :     }
    9411             : 
    9412          43 : SPMLoop_exit:;
    9413             : 
    9414          43 :     if (ResetCntrlVarType) {
    9415           0 :         ShowWarningError(state,
    9416           0 :                          format("{}{}=\"{}\". ",
    9417             :                                 RoutineName,
    9418           0 :                                 managerTypeName[static_cast<int>(state.dataSetPointManager->AllSetPtMgr(SetPtMgrNumPtr).SPMType)],
    9419           0 :                                 state.dataSetPointManager->AllSetPtMgr(SetPtMgrNumPtr).Name));
    9420           0 :         ShowContinueError(state, " ..Humidity ratio control variable type specified is = HumidityRatio");
    9421           0 :         ShowContinueError(state, " ..Humidity ratio control variable type allowed with water coils is = MaximumHumidityRatio");
    9422           0 :         ShowContinueError(state, " ..Setpointmanager control variable type is reset to = MaximumHumidityRatio");
    9423           0 :         ShowContinueError(state, " ..Simulation continues. ");
    9424             :     }
    9425          43 : }
    9426             : 
    9427         771 : void CheckIfAnyIdealCondEntSetPoint(EnergyPlusData &state)
    9428             : {
    9429             : 
    9430             :     // SUBROUTINE INFORMATION:
    9431             :     //       AUTHOR         Heejin Cho, PNNL
    9432             :     //       DATE WRITTEN   March 2012
    9433             :     //       MODIFIED       na
    9434             :     //       RE-ENGINEERED  na
    9435             : 
    9436             :     // PURPOSE OF THIS SUBROUTINE:
    9437             :     // Determine if ideal condenser entering set point manager is used in model and set flag
    9438             : 
    9439        1542 :     std::string cCurrentModuleObject;
    9440             : 
    9441         771 :     cCurrentModuleObject = "SetpointManager:CondenserEnteringReset:Ideal";
    9442         771 :     state.dataSetPointManager->NumIdealCondEntSetPtMgrs = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject);
    9443             : 
    9444         771 :     if (state.dataSetPointManager->NumIdealCondEntSetPtMgrs > 0) {
    9445           2 :         state.dataGlobal->AnyIdealCondEntSetPointInModel = true;
    9446             :     } else {
    9447         769 :         state.dataGlobal->AnyIdealCondEntSetPointInModel = false;
    9448             :     }
    9449         771 : }
    9450             : 
    9451           0 : CtrlVarType GetHumidityRatioVariableType(EnergyPlusData &state, int const CntrlNodeNum)
    9452             : {
    9453             : 
    9454             :     // SUBROUTINE INFORMATION:
    9455             :     //       AUTHOR         B. A. Nigusse
    9456             :     //       DATE WRITTEN   December 2013
    9457             :     //       MODIFIED       na
    9458             :     //       RE-ENGINEERED  na
    9459             : 
    9460             :     // PURPOSE OF THIS SUBROUTINE
    9461             :     // Loop over all the humidity setpoint Managers to determine the
    9462             :     // humidity ratio setpoint type
    9463             : 
    9464             :     // METHODOLOGY EMPLOYED:
    9465             : 
    9466             :     // REFERENCES:
    9467             :     // na
    9468             : 
    9469             :     // USE STATEMENTS:
    9470             : 
    9471             :     // Return value
    9472             :     CtrlVarType HumRatCntrlType;
    9473             : 
    9474             :     // Locals
    9475             :     // SUBROUTINE PARAMETER DEFINITIONS:
    9476             : 
    9477             :     // INTERFACE BLOCK SPECIFICATIONS
    9478             :     // na
    9479             : 
    9480             :     // DERIVED TYPE DEFINITIONS
    9481             :     // na
    9482             : 
    9483             :     // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    9484             :     int SetPtMgrNum;
    9485             :     int CtrlNodeIndex;
    9486             :     int NodeNum;
    9487             : 
    9488           0 :     if (state.dataSetPointManager->GetInputFlag) {
    9489           0 :         GetSetPointManagerInputs(state);
    9490           0 :         state.dataSetPointManager->GetInputFlag = false;
    9491             :     }
    9492             : 
    9493           0 :     HumRatCntrlType = CtrlVarType::HumRat;
    9494             : 
    9495             :     // Loop over the single zone maximum humidity setpoint Managers
    9496           0 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumSZMaxHumSetPtMgrs; ++SetPtMgrNum) {
    9497           0 :         for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->SZMaxHumSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) {
    9498           0 :             NodeNum = state.dataSetPointManager->SZMaxHumSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex);
    9499           0 :             if (CntrlNodeNum == NodeNum) {
    9500           0 :                 HumRatCntrlType = CtrlVarType::MaxHumRat;
    9501           0 :                 return HumRatCntrlType;
    9502             :             }
    9503             :         }
    9504             :     }
    9505             :     // Loop over the MultiZone maximum humidity setpoint Managers
    9506           0 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumMZMaxHumSetPtMgrs; ++SetPtMgrNum) {
    9507           0 :         for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->MZMaxHumSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) {
    9508           0 :             NodeNum = state.dataSetPointManager->MZMaxHumSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex);
    9509           0 :             if (CntrlNodeNum == NodeNum) {
    9510           0 :                 HumRatCntrlType = CtrlVarType::MaxHumRat;
    9511           0 :                 return HumRatCntrlType;
    9512             :             }
    9513             :         }
    9514             :     }
    9515             :     // Loop over the MultiZone Average Maxiumum Humidity Setpoint Managers
    9516           0 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumMZAverageMaxHumSetPtMgrs; ++SetPtMgrNum) {
    9517           0 :         for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->MZAverageMaxHumSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) {
    9518           0 :             NodeNum = state.dataSetPointManager->MZAverageMaxHumSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex);
    9519           0 :             if (CntrlNodeNum == NodeNum) {
    9520           0 :                 HumRatCntrlType = CtrlVarType::MaxHumRat;
    9521           0 :                 return HumRatCntrlType;
    9522             :             }
    9523             :         }
    9524             :     }
    9525             :     // Loop over the single zone minimum humidity setpoint Managers
    9526           0 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumSZMinHumSetPtMgrs; ++SetPtMgrNum) {
    9527           0 :         for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->SZMinHumSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) {
    9528           0 :             NodeNum = state.dataSetPointManager->SZMinHumSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex);
    9529           0 :             if (CntrlNodeNum == NodeNum) {
    9530           0 :                 HumRatCntrlType = CtrlVarType::MinHumRat;
    9531           0 :                 return HumRatCntrlType;
    9532             :             }
    9533             :         }
    9534             :     }
    9535             :     // Loop over the MultiZone minimum humidity setpoint Managers
    9536           0 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumMZMinHumSetPtMgrs; ++SetPtMgrNum) {
    9537           0 :         for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->MZMinHumSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) {
    9538           0 :             NodeNum = state.dataSetPointManager->MZMinHumSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex);
    9539           0 :             if (CntrlNodeNum == NodeNum) {
    9540           0 :                 HumRatCntrlType = CtrlVarType::MinHumRat;
    9541           0 :                 return HumRatCntrlType;
    9542             :             }
    9543             :         }
    9544             :     }
    9545             :     // Loop over the MultiZone Average Minimum Humidity Setpoint Managers
    9546           0 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumMZAverageMinHumSetPtMgrs; ++SetPtMgrNum) {
    9547           0 :         for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->MZAverageMinHumSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) {
    9548           0 :             NodeNum = state.dataSetPointManager->MZAverageMinHumSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex);
    9549           0 :             if (CntrlNodeNum == NodeNum) {
    9550           0 :                 HumRatCntrlType = CtrlVarType::MinHumRat;
    9551           0 :                 return HumRatCntrlType;
    9552             :             }
    9553             :         }
    9554             :     }
    9555             :     // Loop over the schedule setpoint managers
    9556           0 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumSchSetPtMgrs; ++SetPtMgrNum) {
    9557           0 :         for (CtrlNodeIndex = 1; CtrlNodeIndex <= state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrlNodeIndex) {
    9558           0 :             if (CntrlNodeNum == state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).CtrlNodes(CtrlNodeIndex)) {
    9559           0 :                 if (state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::HumRat) {
    9560           0 :                     return CtrlVarType::HumRat;
    9561           0 :                 } else if (state.dataSetPointManager->SchSetPtMgr(SetPtMgrNum).CtrlTypeMode == CtrlVarType::MaxHumRat) {
    9562           0 :                     return CtrlVarType::MaxHumRat;
    9563             :                 }
    9564             :             }
    9565             :         }
    9566             :     }
    9567             : 
    9568           0 :     return HumRatCntrlType;
    9569             : }
    9570             : 
    9571           2 : void SetUpNewScheduledTESSetPtMgr(EnergyPlusData &state,
    9572             :                                   int const SchedPtr,
    9573             :                                   int const SchedPtrCharge,
    9574             :                                   Real64 NonChargeCHWTemp,
    9575             :                                   Real64 ChargeCHWTemp,
    9576             :                                   DataPlant::CtrlType CompOpType,
    9577             :                                   int const ControlNodeNum)
    9578             : {
    9579             :     // SUBROUTINE INFORMATION:
    9580             :     //       AUTHOR         Rick Strand
    9581             :     //       DATE WRITTEN   August 2014
    9582             :     //       MODIFIED       na
    9583             :     //       RE-ENGINEERED  na
    9584             : 
    9585             :     // PURPOSE OF THIS SUBROUTINE
    9586             :     // Set up new scheduled TES setpoint managers based on plant control Simple TES
    9587             : 
    9588             :     // METHODOLOGY EMPLOYED:
    9589             :     // Set up internally created scheduled setpoint managers to control the setpoints
    9590             :     // of various ice storage equipment with the user having to do this manually.  The
    9591             :     // point is to provide a simpler input description and take care of logic internally.
    9592             : 
    9593             :     // REFERENCES:
    9594             :     // na
    9595             : 
    9596             :     // USE STATEMENTS:
    9597             : 
    9598             :     // Locals
    9599             :     // SUBROUTINE PARAMETER DEFINITIONS:
    9600             : 
    9601             :     // INTERFACE BLOCK SPECIFICATIONS
    9602             :     // na
    9603             : 
    9604             :     // DERIVED TYPE DEFINITIONS
    9605             :     // na
    9606             : 
    9607             :     // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    9608           2 :     bool ErrorsFoundinTESSchSetup(false);
    9609             :     int NodeNum;
    9610             : 
    9611           2 :     state.dataSetPointManager->NumSchTESSetPtMgrs += 1;
    9612           2 :     state.dataSetPointManager->NumAllSetPtMgrs += 1;
    9613             : 
    9614             :     // allocate/redimension structures for new item
    9615           2 :     if (state.dataSetPointManager->NumSchTESSetPtMgrs == 1) { // first time through--main structure not allocated yet
    9616           1 :         state.dataSetPointManager->SchTESSetPtMgr.allocate(1);
    9617           1 :     } else if (state.dataSetPointManager->NumSchTESSetPtMgrs > 1) { // no longer first time through--redimension to new size
    9618           1 :         state.dataSetPointManager->SchTESSetPtMgr.redimension(state.dataSetPointManager->NumSchTESSetPtMgrs);
    9619             :     }
    9620           2 :     state.dataSetPointManager->AllSetPtMgr.redimension(state.dataSetPointManager->NumAllSetPtMgrs);
    9621             : 
    9622             :     // Set up the scheduled TES setpoint manager information
    9623           2 :     state.dataSetPointManager->SchTESSetPtMgr(state.dataSetPointManager->NumSchTESSetPtMgrs).SchedPtr = SchedPtr;
    9624           2 :     state.dataSetPointManager->SchTESSetPtMgr(state.dataSetPointManager->NumSchTESSetPtMgrs).SchedPtrCharge = SchedPtrCharge;
    9625           2 :     state.dataSetPointManager->SchTESSetPtMgr(state.dataSetPointManager->NumSchTESSetPtMgrs).NonChargeCHWTemp = NonChargeCHWTemp;
    9626           2 :     state.dataSetPointManager->SchTESSetPtMgr(state.dataSetPointManager->NumSchTESSetPtMgrs).ChargeCHWTemp = ChargeCHWTemp;
    9627           2 :     state.dataSetPointManager->SchTESSetPtMgr(state.dataSetPointManager->NumSchTESSetPtMgrs).CompOpType = CompOpType;
    9628           2 :     state.dataSetPointManager->SchTESSetPtMgr(state.dataSetPointManager->NumSchTESSetPtMgrs).CtrlNodeNum = ControlNodeNum;
    9629             : 
    9630             :     // Set up the all setpoint manager information for "verification" that no other setpoint manager controls the node that this new ones does
    9631           2 :     state.dataSetPointManager->AllSetPtMgr(state.dataSetPointManager->NumAllSetPtMgrs).CtrlNodes.allocate(1);
    9632           2 :     state.dataSetPointManager->AllSetPtMgr(state.dataSetPointManager->NumAllSetPtMgrs).CtrlNodes(1) =
    9633           2 :         state.dataSetPointManager->SchTESSetPtMgr(state.dataSetPointManager->NumSchTESSetPtMgrs).CtrlNodeNum;
    9634             :     // Give it a Name just in case it's used for error reporting
    9635           4 :     state.dataSetPointManager->AllSetPtMgr(state.dataSetPointManager->NumAllSetPtMgrs).Name =
    9636           6 :         format("Auto generated TES SPM {}", state.dataSetPointManager->NumSchTESSetPtMgrs);
    9637           2 :     state.dataSetPointManager->AllSetPtMgr(state.dataSetPointManager->NumAllSetPtMgrs).SPMType = SetPointManagerType::TESScheduled;
    9638           2 :     state.dataSetPointManager->AllSetPtMgr(state.dataSetPointManager->NumAllSetPtMgrs).CtrlTypeMode = CtrlVarType::Temp;
    9639           2 :     state.dataSetPointManager->AllSetPtMgr(state.dataSetPointManager->NumAllSetPtMgrs).NumCtrlNodes = 1;
    9640             : 
    9641             :     // Now verify that there is no overlap (no other SPM uses the node of the new setpoint manager)
    9642           2 :     ErrorsFoundinTESSchSetup = false;
    9643           2 :     VerifySetPointManagers(state, ErrorsFoundinTESSchSetup);
    9644           2 :     if (ErrorsFoundinTESSchSetup) {
    9645           0 :         ShowFatalError(state, "Errors found in verification step of SetUpNewScheduledTESSetPtMgr.  Program terminates.");
    9646             :     }
    9647             :     // Since all of the other setpoint managers not only been read and verified but also initialized, simulated, and updated,
    9648             :     // we must now also initialize, simulate, and update the current SchTESStPtMgr that was just added.  But the init and simulate
    9649             :     // steps are the same so we can call the simulate first.
    9650             : 
    9651           2 :     state.dataSetPointManager->SchTESSetPtMgr(state.dataSetPointManager->NumSchTESSetPtMgrs).calculate(state);
    9652             : 
    9653             :     // Now update reusing code from Update routine specialized to only doing the current (new) setpoint manager and then we are done
    9654             : 
    9655           2 :     NodeNum = state.dataSetPointManager->SchTESSetPtMgr(state.dataSetPointManager->NumSchTESSetPtMgrs).CtrlNodeNum; // Get the node number
    9656           2 :     state.dataLoopNodes->Node(NodeNum).TempSetPoint = state.dataSetPointManager->SchTESSetPtMgr(state.dataSetPointManager->NumSchTESSetPtMgrs).SetPt;
    9657             : 
    9658           2 : } // end of SetUpNewScheduledTESSetPtMgr
    9659             : 
    9660       10154 : bool GetCoilFreezingCheckFlag(EnergyPlusData &state, int const MixedAirSPMNum)
    9661             : {
    9662             : 
    9663             :     // SUBROUTINE INFORMATION:
    9664             :     //       AUTHOR         L. Gu
    9665             :     //       DATE WRITTEN   Nov. 2015
    9666             :     //       MODIFIED       na
    9667             :     //       RE-ENGINEERED  na
    9668             : 
    9669             :     // PURPOSE OF THIS SUBROUTINE
    9670             :     // Get freezing check status
    9671             : 
    9672             :     // METHODOLOGY EMPLOYED:
    9673             : 
    9674             :     // REFERENCES:
    9675             :     // na
    9676             : 
    9677             :     // USE STATEMENTS:
    9678             : 
    9679             :     // Return value
    9680             :     bool FeezigCheckFlag;
    9681             : 
    9682             :     // Locals
    9683             :     // SUBROUTINE PARAMETER DEFINITIONS:
    9684             : 
    9685             :     // INTERFACE BLOCK SPECIFICATIONS
    9686             :     // na
    9687             : 
    9688             :     // DERIVED TYPE DEFINITIONS
    9689             :     // na
    9690             : 
    9691             :     // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    9692             :     int CtrldNodeNum;
    9693             : 
    9694       10154 :     if (state.dataSetPointManager->GetInputFlag) {
    9695           0 :         GetSetPointManagerInputs(state);
    9696           0 :         state.dataSetPointManager->GetInputFlag = false;
    9697             :     }
    9698             : 
    9699       10154 :     FeezigCheckFlag = false;
    9700             : 
    9701       20308 :     for (CtrldNodeNum = 1; CtrldNodeNum <= state.dataSetPointManager->MixedAirSetPtMgr(MixedAirSPMNum).NumCtrlNodes; ++CtrldNodeNum) {
    9702       10154 :         if (state.dataSetPointManager->MixedAirSetPtMgr(MixedAirSPMNum).FreezeCheckEnable) {
    9703           0 :             FeezigCheckFlag = true;
    9704           0 :             break;
    9705             :         }
    9706             :     }
    9707             : 
    9708       10154 :     return FeezigCheckFlag;
    9709             : } // End of GetCoilFreezingCheckFlag
    9710             : 
    9711        1021 : int GetMixedAirNumWithCoilFreezingCheck(EnergyPlusData &state, int const MixedAirNode)
    9712             : {
    9713             : 
    9714             :     // SUBROUTINE INFORMATION:
    9715             :     //       AUTHOR         L. Gu
    9716             :     //       DATE WRITTEN   Nov. 2015
    9717             :     //       MODIFIED       na
    9718             :     //       RE-ENGINEERED  na
    9719             : 
    9720             :     // PURPOSE OF THIS SUBROUTINE
    9721             :     // Loop over all the MixedAir setpoint Managers to find coil freezing check flag
    9722             : 
    9723             :     // METHODOLOGY EMPLOYED:
    9724             : 
    9725             :     // REFERENCES:
    9726             :     // na
    9727             : 
    9728             :     // USE STATEMENTS:
    9729             : 
    9730             :     // Return value
    9731             :     int MixedAirSPMNum;
    9732             : 
    9733             :     // Locals
    9734             :     // SUBROUTINE PARAMETER DEFINITIONS:
    9735             : 
    9736             :     // INTERFACE BLOCK SPECIFICATIONS
    9737             :     // na
    9738             : 
    9739             :     // DERIVED TYPE DEFINITIONS
    9740             :     // na
    9741             : 
    9742             :     // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
    9743             :     int SetPtMgrNum;
    9744             :     int CtrldNodeNum;
    9745             : 
    9746        1021 :     if (state.dataSetPointManager->GetInputFlag) {
    9747           0 :         GetSetPointManagerInputs(state);
    9748           0 :         state.dataSetPointManager->GetInputFlag = false;
    9749             :     }
    9750             : 
    9751        1021 :     MixedAirSPMNum = 0;
    9752             : 
    9753        9885 :     for (SetPtMgrNum = 1; SetPtMgrNum <= state.dataSetPointManager->NumMixedAirSetPtMgrs; ++SetPtMgrNum) {
    9754             : 
    9755       18075 :         for (CtrldNodeNum = 1; CtrldNodeNum <= state.dataSetPointManager->MixedAirSetPtMgr(SetPtMgrNum).NumCtrlNodes; ++CtrldNodeNum) {
    9756        9212 :             if (state.dataSetPointManager->MixedAirSetPtMgr(SetPtMgrNum).CtrlNodes(CtrldNodeNum) == MixedAirNode) {
    9757         789 :                 if (state.dataSetPointManager->MixedAirSetPtMgr(SetPtMgrNum).CoolCoilInNode > 0 &&
    9758           1 :                     state.dataSetPointManager->MixedAirSetPtMgr(SetPtMgrNum).CoolCoilOutNode > 0) {
    9759           1 :                     MixedAirSPMNum = CtrldNodeNum;
    9760           1 :                     break;
    9761             :                 }
    9762             :             }
    9763             :         }
    9764             :     }
    9765             : 
    9766        1021 :     return MixedAirSPMNum;
    9767             : } // End of GetMixedAirNumWithCoilFreezingCheck(
    9768             : 
    9769        2313 : } // namespace EnergyPlus::SetPointManager

Generated by: LCOV version 1.13