LCOV - code coverage report
Current view: top level - EnergyPlus - Furnaces.hh (source / functions) Hit Total Coverage
Test: lcov.output.filtered Lines: 33 73 45.2 %
Date: 2024-08-24 22:35:29 Functions: 2 3 66.7 %

          Line data    Source code
       1             : // EnergyPlus, Copyright (c) 1996-2024, 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             : #ifndef Furnaces_hh_INCLUDED
      49             : #define Furnaces_hh_INCLUDED
      50             : 
      51             : // ObjexxFCL Headers
      52             : #include <ObjexxFCL/Array1D.hh>
      53             : #include <ObjexxFCL/Optional.hh>
      54             : 
      55             : // EnergyPlus Headers
      56             : #include <EnergyPlus/Data/BaseData.hh>
      57             : #include <EnergyPlus/DataGlobalConstants.hh>
      58             : #include <EnergyPlus/DataGlobals.hh>
      59             : #include <EnergyPlus/EnergyPlus.hh>
      60             : #include <EnergyPlus/Plant/Enums.hh>
      61             : #include <EnergyPlus/VariableSpeedCoils.hh>
      62             : 
      63             : namespace EnergyPlus {
      64             : 
      65             : // Forward declarations
      66             : struct EnergyPlusData;
      67             : 
      68             : namespace Furnaces {
      69             : 
      70             :     enum class ModeOfOperation
      71             :     {
      72             :         Invalid = -1,
      73             :         CoolingMode, // last compressor operating mode was in cooling
      74             :         HeatingMode, // last compressor operating mode was in heating
      75             :         NoCoolHeat,  // last operating mode was coil off
      76             :         Num
      77             :     };
      78             : 
      79             :     // Airflow control for contant fan mode
      80             :     enum class AirFlowControlConstFan
      81             :     {
      82             :         Invalid = -1,         // default
      83             :         UseCompressorOnFlow,  // set compressor OFF air flow rate equal to compressor ON air flow rate
      84             :         UseCompressorOffFlow, // set compressor OFF air flow rate equal to user defined value,
      85             :         Num
      86             :     };
      87             : 
      88             :     // Dehumidification control modes (DehumidControlMode)
      89             :     enum class DehumidificationControlMode
      90             :     {
      91             :         Invalid = -1,
      92             :         None,
      93             :         Multimode,
      94             :         CoolReheat,
      95             :         Num
      96             :     };
      97             : 
      98             :     enum class WAHPCoilType
      99             :     {
     100             :         Invalid = -1,
     101             :         Simple,
     102             :         ParEst,
     103             :         VarSpeedEquationFit,
     104             :         VarSpeedLookupTable,
     105             :         Num
     106             :     };
     107             : 
     108             :     struct FurnaceEquipConditions
     109             :     {
     110             :         // Members
     111             :         std::string Name;                                          // Name of the Furnace
     112             :         HVAC::UnitarySysType type = HVAC::UnitarySysType::Invalid; // Numeric Equivalent for Furnace Type
     113             :         int FurnaceIndex;                                          // Index to furnace
     114             :         int SchedPtr;                                              // Index to furnace operating schedule
     115             :         int FanSchedPtr;                                           // Index to fan operating mode schedule
     116             :         int FanAvailSchedPtr;                                      // Index to fan availability schedule
     117             :         int ControlZoneNum;                                        // Index to controlled zone
     118             :         int ZoneSequenceCoolingNum;                                // Index to cooling sequence/priority for this zone
     119             :         int ZoneSequenceHeatingNum;                                // Index to heating sequence/priority for this zone
     120             :         int CoolingCoilType_Num;                                   // Numeric Equivalent for Cooling Coil Type
     121             :         int CoolingCoilIndex;                                      // Index to cooling coil
     122             :         int ActualDXCoilIndexForHXAssisted;                        // Index to DX cooling coil when HX assisted
     123             :         bool CoolingCoilUpstream;                                  // Indicates if cooling coil is upstream of heating coil
     124             :         int HeatingCoilType_Num;                                   // Numeric Equivalent for Heating Coil Type
     125             :         int HeatingCoilIndex;                                      // Index to heating coil
     126             :         int ReheatingCoilType_Num;                                 // Numeric Equivalent for Reheat Coil Type
     127             :         int ReheatingCoilIndex;                                    // Index to reheat coil
     128             :         std::string HeatingCoilName;                               // name of heating coil
     129             :         std::string HeatingCoilType;                               // type of heating coil
     130             :         int CoilControlNode;                                       // control node for hot water and steam heating coils
     131             :         int HWCoilAirInletNode;                                    // air inlet node number of HW coil for PTAC, PTHP, HeatCool, HeatOnly
     132             :         int HWCoilAirOutletNode;                                   // air outlet node number of HW coil for PTAC, PTHP, HeatCool, HeatOnly
     133             :         int SuppCoilAirInletNode;                                  // air inlet node number of HW coil for HeatCool Reheat Coil
     134             :         int SuppCoilAirOutletNode;                                 // air outlet node number of HW coil for HeatCool Reheat Coil
     135             :         int SuppHeatCoilType_Num;                                  // Numeric Equivalent for Supplemental Heat Coil Type
     136             :         int SuppHeatCoilIndex;                                     // Index to supplemental heater
     137             :         int SuppCoilControlNode;                                   // control node for steam and hot water heating coil
     138             :         std::string SuppHeatCoilName;                              // name of supplemental heating coil
     139             :         std::string SuppHeatCoilType;                              // type of supplemental heating coil
     140             :         HVAC::FanType fanType;                                     // Integer equivalent of fan type (1=OnOff, 2 = ConstVolume)
     141             :         int FanIndex;                                              // Index to fan object
     142             :         int FurnaceInletNodeNum;                                   // Furnace inlet node number
     143             :         int FurnaceOutletNodeNum;                                  // Furnace inlet node number
     144             :         HVAC::FanOp fanOp = HVAC::FanOp::Invalid;                  // operation mode: 1 = cycling fan, cycling coils
     145             :         //                 2 = continuous fan, cycling coils
     146             :         Furnaces::ModeOfOperation LastMode;                    // last mode of operation, coolingmode or heatingmode
     147             :         AirFlowControlConstFan AirFlowControl;                 // fan control mode, UseCompressorOnFlow or UseCompressorOffFlow
     148             :         HVAC::FanPlace fanPlace;                               // fan placement; 1=blow through, 2=draw through
     149             :         int NodeNumOfControlledZone;                           // Node number of controlled zone air node
     150             :         WAHPCoilType WatertoAirHPType = WAHPCoilType::Invalid; // Type of water to air heat pump model used
     151             :         Real64 CoolingConvergenceTolerance;                    // Convergence tolerance for cooling,
     152             :         //   ratio (CoolingCoilLoad - FurnaceCoolingOutput)/CoolingCoilLoad
     153             :         Real64 HeatingConvergenceTolerance; // Convergence tolerance for heating,
     154             :         //   ratio (HeatingCoilLoad - HeatPumpheatingOutput)/HeatingCoilLoad
     155             :         Real64 DesignHeatingCapacity;                       // Nominal Capacity of Heating Coil [W]
     156             :         Real64 DesignCoolingCapacity;                       // Nominal Capacity of Cooling Coil [W]
     157             :         Real64 CoolingCoilSensDemand;                       // Sensible demand on Cooling Coil [W]
     158             :         Real64 HeatingCoilSensDemand;                       // Sensible demand on Heating Coil [W]
     159             :         Real64 CoolingCoilLatentDemand;                     // Latent demand on Cooling Coil [W]
     160             :         Real64 DesignSuppHeatingCapacity;                   // Nominal Capacity of Supplemental Heating Coil [W]
     161             :         Real64 DesignFanVolFlowRate;                        // Vol Flow through the Furnace being Simulated [m**3/Sec]
     162             :         bool DesignFanVolFlowRateEMSOverrideOn;             // if true, then EMS is calling to override autosize fan flow
     163             :         Real64 DesignFanVolFlowRateEMSOverrideValue;        // EMS value for override of fan flow rate autosize [m3/s]
     164             :         Real64 DesignMassFlowRate;                          // Design mass flow rate through furnace [kg/s]
     165             :         Real64 MaxCoolAirVolFlow;                           // supply air volumetric flow rate during cooling operation [m3/s]
     166             :         bool MaxCoolAirVolFlowEMSOverrideOn;                // if true, EMS is calling to override autosize flow during cooling
     167             :         Real64 MaxCoolAirVolFlowEMSOverrideValue;           // EMS value for override of flow during cooling [m3/s]
     168             :         Real64 MaxHeatAirVolFlow;                           // supply air volumetric flow rate during cooling operation [m3/s]
     169             :         bool MaxHeatAirVolFlowEMSOverrideOn;                // if true, EMS is calling to override autosize flow during heating
     170             :         Real64 MaxHeatAirVolFlowEMSOverrideValue;           // EMS value for override of flow during heating operation [m3/s]
     171             :         Real64 MaxNoCoolHeatAirVolFlow;                     // supply air volumetric flow rate when no cooling or heating [m3/s]
     172             :         bool MaxNoCoolHeatAirVolFlowEMSOverrideOn;          // if true, EMS is calling to override autosize no heatcool rate
     173             :         Real64 MaxNoCoolHeatAirVolFlowEMSOverrideValue;     // EMS value for override of flow during no heat cool [m3/s]
     174             :         Real64 MaxCoolAirMassFlow;                          // supply air mass flow rate during cooling operation [kg/s]
     175             :         Real64 MaxHeatAirMassFlow;                          // supply air mass flow rate during heating operation [kg/s]
     176             :         Real64 MaxNoCoolHeatAirMassFlow;                    // supply air mass flow rate when no cooling or heating [kg/s]
     177             :         Real64 MaxHeatCoilFluidFlow;                        // water or steam mass flow rate for heating coil [kg/s]
     178             :         Real64 MaxSuppCoilFluidFlow;                        // water or steam mass flow rate for supplemental heating coil [kg/s]
     179             :         Real64 ControlZoneMassFlowFrac;                     // Fraction of furnace flow to control zone
     180             :         Real64 DesignMaxOutletTemp;                         // Maximum supply air temperature from furnace heater [C]
     181             :         Real64 MdotFurnace;                                 // Mass flow rate through furnace [kg/s]
     182             :         Real64 FanPartLoadRatio;                            // Part load ratio of furnace fan (mdot actual/mdot design)
     183             :         Real64 CompPartLoadRatio;                           // Part load ratio of furnace compressor (load / steady-state output)
     184             :         Real64 CoolPartLoadRatio;                           // Cooling part load ratio
     185             :         Real64 HeatPartLoadRatio;                           // Heating part load ratio
     186             :         Real64 MinOATCompressorCooling;                     // Minimum outdoor operating temperature for heat pump compressor
     187             :         Real64 MinOATCompressorHeating;                     // Minimum outdoor operating temperature for heat pump compressor
     188             :         Real64 MaxOATSuppHeat;                              // Maximum outdoor dry-bulb temperature for
     189             :         int CondenserNodeNum;                               // Node number of outdoor condenser/compressor
     190             :         bool Humidistat;                                    // Humidistat control (heatcool units only and not heatpump)
     191             :         bool InitHeatPump;                                  // Heat pump initialization flag (for error reporting)
     192             :         DehumidificationControlMode DehumidControlType_Num; // 0 = None, 1=MultiMode, 2=CoolReheat
     193             :         int LatentMaxIterIndex;                             // Index to recurring warning message
     194             :         int LatentRegulaFalsiFailedIndex;                   // Index to recurring warning message
     195             :         int LatentRegulaFalsiFailedIndex2;                  // Index to recurring warning message
     196             :         int SensibleMaxIterIndex;                           // Index to recurring warning message
     197             :         int SensibleRegulaFalsiFailedIndex;                 // Index to recurring warning message
     198             :         int WSHPHeatMaxIterIndex;                           // Index to recurring warning message
     199             :         int WSHPHeatRegulaFalsiFailedIndex;                 // Index to recurring warning message
     200             :         int DXHeatingMaxIterIndex;                          // Index to recurring warning message
     201             :         int DXHeatingRegulaFalsiFailedIndex;                // Index to recurring warning messages
     202             :         int HeatingMaxIterIndex;                            // Index to recurring warning message
     203             :         int HeatingMaxIterIndex2;                           // Index to recurring warning message
     204             :         int HeatingRegulaFalsiFailedIndex;                  // Index to recurring warning messages
     205             :         Real64 ActualFanVolFlowRate;                        // Volumetric flow rate from fan object
     206             :         Real64 HeatingSpeedRatio;                           // Fan speed ratio in heating mode
     207             :         Real64 CoolingSpeedRatio;                           // Fan speed ratio in cooling mode
     208             :         Real64 NoHeatCoolSpeedRatio;                        // Fan speed ratio when no cooling or heating
     209             :         int ZoneInletNode;                                  // Zone inlet node number in the controlled zone
     210             :         Real64 SenLoadLoss;                                 // Air distribution system sensible loss
     211             :         Real64 LatLoadLoss;                                 // Air distribution system latent loss
     212             :         Real64 SensibleLoadMet;                             // System sensible load
     213             :         Real64 LatentLoadMet;                               // System latent load
     214             :         Real64 DehumidInducedHeatingDemandRate;             // Additional heating demand on supplemental heater
     215             :         // when heat pumps operate on dehumidification mode
     216             :         int CoilOutletNode;                   // outlet node for hot water and steam heating coil
     217             :         PlantLocation plantLoc;               // plant loop component location for water and steam heating coil
     218             :         int SuppCoilOutletNode;               // outlet node for hot water and steam supplemental heating coil
     219             :         PlantLocation SuppPlantLoc;           // plant loop component location for water and steam supplemental heating coil
     220             :         int HotWaterCoilMaxIterIndex;         // Index to recurring warning message
     221             :         int HotWaterCoilMaxIterIndex2;        // Index to recurring warning message
     222             :         bool EMSOverrideSensZoneLoadRequest;  // if true, then EMS is calling to override zone load
     223             :         Real64 EMSSensibleZoneLoadValue;      // Value EMS is directing to use
     224             :         bool EMSOverrideMoistZoneLoadRequest; // if true, then EMS is calling to override zone load
     225             :         Real64 EMSMoistureZoneLoadValue;      // Value EMS is directing to use
     226             :         // starting added varibles for variable speed water source heat pump, Bo Shen, ORNL, March 2012
     227             :         Furnaces::ModeOfOperation HeatCoolMode; // System operating mode (0 = floating, 1 = cooling, 2 = heating)
     228             :         int NumOfSpeedCooling;                  // The number of speeds for cooling
     229             :         int NumOfSpeedHeating;                  // The number of speeds for heating
     230             :         Real64 IdleSpeedRatio;                  // idle air fan ratio
     231             :         Real64 IdleVolumeAirRate;               // idle air flow rate
     232             :         Real64 IdleMassFlowRate;                // idle air flow rate
     233             :         Real64 FanVolFlow;                      // fan volumetric flow rate
     234             :         bool CheckFanFlow;                      // Supply airflow check
     235             :         Array1D<Real64> HeatVolumeFlowRate;     // Supply air volume flow rate during heating operation
     236             :         Array1D<Real64> HeatMassFlowRate;       // Supply air mass flow rate during heating operation
     237             :         Array1D<Real64> CoolVolumeFlowRate;     // Supply air volume flow rate during cooling operation
     238             :         Array1D<Real64> CoolMassFlowRate;       // Supply air mass flow rate during cooling operation
     239             :         Array1D<Real64> MSHeatingSpeedRatio;    // Fan speed ratio in heating mode
     240             :         Array1D<Real64> MSCoolingSpeedRatio;    // Fan speed ratio in cooling mode
     241             :         bool bIsIHP;
     242             :         int CompSpeedNum;
     243             :         Real64 CompSpeedRatio;
     244             :         int ErrIndexCyc;
     245             :         int ErrIndexVar;
     246             :         // end of the additional variables for variable speed water source heat pump
     247             :         HVAC::WaterFlow WaterCyclingMode = HVAC::WaterFlow::Invalid; // Heat Pump Coil water flow mode; See definitions in DataHVACGlobals,
     248             :         // 1=water cycling, 2=water constant, 3=water constant on demand (old mode)
     249             :         int iterationCounter;                             // track time step iterations
     250             :         Array1D<Furnaces::ModeOfOperation> iterationMode; // keep track of previous iteration mode (i.e., cooling or heating)
     251             :         bool FirstPass;                                   // used to determine when first call is made
     252             : 
     253             :         int ErrCountCyc = 0;  // Counter used to minimize the occurrence of output warnings
     254             :         int ErrCountVar = 0;  // Counter used to minimize the occurrence of output warnings
     255             :         int ErrCountVar2 = 0; // Counter used to minimize the occurrence of output warnings
     256             : 
     257          97 :         FurnaceEquipConditions()
     258         194 :             : FurnaceIndex(0), SchedPtr(0), FanSchedPtr(0), FanAvailSchedPtr(0), ControlZoneNum(0), ZoneSequenceCoolingNum(0),
     259          97 :               ZoneSequenceHeatingNum(0), CoolingCoilType_Num(0), CoolingCoilIndex(0), ActualDXCoilIndexForHXAssisted(0), CoolingCoilUpstream(true),
     260         194 :               HeatingCoilType_Num(0), HeatingCoilIndex(0), ReheatingCoilType_Num(0), ReheatingCoilIndex(0), CoilControlNode(0), HWCoilAirInletNode(0),
     261          97 :               HWCoilAirOutletNode(0), SuppCoilAirInletNode(0), SuppCoilAirOutletNode(0), SuppHeatCoilType_Num(0), SuppHeatCoilIndex(0),
     262         194 :               SuppCoilControlNode(0), fanType(HVAC::FanType::Invalid), FanIndex(0), FurnaceInletNodeNum(0), FurnaceOutletNodeNum(0),
     263          97 :               LastMode(Furnaces::ModeOfOperation::Invalid), AirFlowControl(AirFlowControlConstFan::Invalid), fanPlace(HVAC::FanPlace::Invalid),
     264          97 :               NodeNumOfControlledZone(0), CoolingConvergenceTolerance(0.0), HeatingConvergenceTolerance(0.0), DesignHeatingCapacity(0.0),
     265          97 :               DesignCoolingCapacity(0.0), CoolingCoilSensDemand(0.0), HeatingCoilSensDemand(0.0), CoolingCoilLatentDemand(0.0),
     266          97 :               DesignSuppHeatingCapacity(0.0), DesignFanVolFlowRate(0.0), DesignFanVolFlowRateEMSOverrideOn(false),
     267          97 :               DesignFanVolFlowRateEMSOverrideValue(0.0), DesignMassFlowRate(0.0), MaxCoolAirVolFlow(0.0), MaxCoolAirVolFlowEMSOverrideOn(false),
     268          97 :               MaxCoolAirVolFlowEMSOverrideValue(0.0), MaxHeatAirVolFlow(0.0), MaxHeatAirVolFlowEMSOverrideOn(false),
     269          97 :               MaxHeatAirVolFlowEMSOverrideValue(0.0), MaxNoCoolHeatAirVolFlow(0.0), MaxNoCoolHeatAirVolFlowEMSOverrideOn(false),
     270          97 :               MaxNoCoolHeatAirVolFlowEMSOverrideValue(0.0), MaxCoolAirMassFlow(0.0), MaxHeatAirMassFlow(0.0), MaxNoCoolHeatAirMassFlow(0.0),
     271          97 :               MaxHeatCoilFluidFlow(0.0), MaxSuppCoilFluidFlow(0.0), ControlZoneMassFlowFrac(0.0), DesignMaxOutletTemp(9999.0), MdotFurnace(0.0),
     272          97 :               FanPartLoadRatio(0.0), CompPartLoadRatio(0.0), CoolPartLoadRatio(0.0), HeatPartLoadRatio(0.0), MinOATCompressorCooling(0.0),
     273          97 :               MinOATCompressorHeating(0.0), MaxOATSuppHeat(0.0), CondenserNodeNum(0), Humidistat(false), InitHeatPump(false),
     274          97 :               DehumidControlType_Num(DehumidificationControlMode::None), LatentMaxIterIndex(0), LatentRegulaFalsiFailedIndex(0),
     275          97 :               LatentRegulaFalsiFailedIndex2(0), SensibleMaxIterIndex(0), SensibleRegulaFalsiFailedIndex(0), WSHPHeatMaxIterIndex(0),
     276          97 :               WSHPHeatRegulaFalsiFailedIndex(0), DXHeatingMaxIterIndex(0), DXHeatingRegulaFalsiFailedIndex(0), HeatingMaxIterIndex(0),
     277          97 :               HeatingMaxIterIndex2(0), HeatingRegulaFalsiFailedIndex(0), ActualFanVolFlowRate(0.0), HeatingSpeedRatio(1.0), CoolingSpeedRatio(1.0),
     278          97 :               NoHeatCoolSpeedRatio(1.0), ZoneInletNode(0), SenLoadLoss(0.0), LatLoadLoss(0.0), SensibleLoadMet(0.0), LatentLoadMet(0.0),
     279          97 :               DehumidInducedHeatingDemandRate(0.0), CoilOutletNode(0), plantLoc{}, SuppPlantLoc{}, HotWaterCoilMaxIterIndex(0),
     280          97 :               HotWaterCoilMaxIterIndex2(0), EMSOverrideSensZoneLoadRequest(false), EMSSensibleZoneLoadValue(0.0),
     281          97 :               EMSOverrideMoistZoneLoadRequest(false), EMSMoistureZoneLoadValue(0.0), HeatCoolMode(Furnaces::ModeOfOperation::Invalid),
     282          97 :               NumOfSpeedCooling(0), NumOfSpeedHeating(0), IdleSpeedRatio(0.0), IdleVolumeAirRate(0.0), IdleMassFlowRate(0.0), FanVolFlow(0.0),
     283          97 :               CheckFanFlow(true), HeatVolumeFlowRate(HVAC::MaxSpeedLevels, 0.0), HeatMassFlowRate(HVAC::MaxSpeedLevels, 0.0),
     284          97 :               CoolVolumeFlowRate(HVAC::MaxSpeedLevels, 0.0), CoolMassFlowRate(HVAC::MaxSpeedLevels, 0.0),
     285          97 :               MSHeatingSpeedRatio(HVAC::MaxSpeedLevels, 0.0), MSCoolingSpeedRatio(HVAC::MaxSpeedLevels, 0.0), bIsIHP(false), CompSpeedNum(0),
     286         194 :               CompSpeedRatio(0.0), ErrIndexCyc(0), ErrIndexVar(0), iterationCounter(0), iterationMode(0), FirstPass(true)
     287             :         {
     288          97 :         }
     289             :     };
     290             : 
     291             :     // Functions
     292             : 
     293             :     void SimFurnace(EnergyPlusData &state,
     294             :                     std::string_view FurnaceName,
     295             :                     bool const FirstHVACIteration,
     296             :                     int const AirLoopNum, // Primary air loop number
     297             :                     int &CompIndex        // Pointer to which furnace
     298             :     );
     299             : 
     300             :     // Get Input Section of the Module
     301             :     //******************************************************************************
     302             : 
     303             :     void GetFurnaceInput(EnergyPlusData &state);
     304             : 
     305             :     // End of Get Input subroutines for this Module
     306             :     //******************************************************************************
     307             : 
     308             :     // Beginning Initialization Section of the Module
     309             :     //******************************************************************************
     310             : 
     311             :     void InitFurnace(EnergyPlusData &state,
     312             :                      int const FurnaceNum,         // index to Furnace
     313             :                      int const AirLoopNum,         // index to air loop
     314             :                      Real64 &OnOffAirFlowRatio,    // ratio of on to off air mass flow rate
     315             :                      HVAC::FanOp &fanOp,           // fan operating mode
     316             :                      Real64 &ZoneLoad,             // zone sensible load to be met (modified here as needed) (W)
     317             :                      Real64 &MoistureLoad,         // zone moisture load (W)
     318             :                      bool const FirstHVACIteration // TRUE if first HVAC iteration
     319             :     );
     320             : 
     321             :     void SetOnOffMassFlowRate(EnergyPlusData &state,
     322             :                               int const FurnaceNum,      // index to furnace
     323             :                               int const AirLoopNum,      // index to air loop !unused1208
     324             :                               Real64 &OnOffAirFlowRatio, // ratio of coil on to coil off air flow rate
     325             :                               HVAC::FanOp const fanOp,   // fan operating mode
     326             :                               Real64 const ZoneLoad,     // sensible load to be met (W) !unused1208
     327             :                               Real64 const MoistureLoad, // moisture load to be met (W)
     328             :                               Real64 const PartLoadRatio // coil part-load ratio
     329             :     );
     330             : 
     331             :     void SizeFurnace(EnergyPlusData &state, int const FurnaceNum, bool const FirstHVACIteration);
     332             : 
     333             :     // End Initialization Section of the Module
     334             :     //******************************************************************************
     335             : 
     336             :     // Beginning of Update subroutines for the Furnace Module
     337             :     // *****************************************************************************
     338             : 
     339             :     void CalcNewZoneHeatOnlyFlowRates(EnergyPlusData &state,
     340             :                                       int const FurnaceNum,          // Index to furnace
     341             :                                       bool const FirstHVACIteration, // Iteration flag
     342             :                                       Real64 const ZoneLoad,         // load to be met by furnace (W)
     343             :                                       Real64 &HeatCoilLoad,          // actual load passed to heating coil (W)
     344             :                                       Real64 &OnOffAirFlowRatio      // ratio of coil on to coil off air flow rate
     345             :     );
     346             : 
     347             :     void CalcNewZoneHeatCoolFlowRates(EnergyPlusData &state,
     348             :                                       int const FurnaceNum,
     349             :                                       bool const FirstHVACIteration,
     350             :                                       HVAC::CompressorOp compressorOp, // compressor operation flag (1=On, 0=Off)
     351             :                                       Real64 const ZoneLoad,           // the control zone load (watts)
     352             :                                       Real64 const MoistureLoad,       // the control zone latent load (watts)
     353             :                                       Real64 &HeatCoilLoad,            // Heating load to be met by heating coil ( excluding heat pump DX coil)
     354             :                                       Real64 &ReheatCoilLoad,          // Heating load to be met by reheat coil using hstat (excluding HP DX coil)
     355             :                                       Real64 &OnOffAirFlowRatio,       // Ratio of compressor ON air flow to AVERAGE air flow over time step
     356             :                                       bool &HXUnitOn                   // flag to control HX based on zone moisture load
     357             :     );
     358             : 
     359             :     void CalcWaterToAirHeatPump(EnergyPlusData &state,
     360             :                                 int const FurnaceNum,            // index to Furnace
     361             :                                 bool const FirstHVACIteration,   // TRUE on first HVAC iteration
     362             :                                 HVAC::CompressorOp compressorOp, // compressor operation flag (1=On, 0=Off)
     363             :                                 Real64 const ZoneLoad,           // the control zone load (watts)
     364             :                                 Real64 const MoistureLoad        // the control zone latent load (watts)
     365             :     );
     366             : 
     367             :     void CalcFurnaceOutput(EnergyPlusData &state,
     368             :                            int const FurnaceNum,
     369             :                            bool const FirstHVACIteration,
     370             :                            HVAC::FanOp const fanOp,         // Cycling fan or constant fan
     371             :                            HVAC::CompressorOp compressorOp, // Compressor on/off; 1=on, 0=off
     372             :                            Real64 const CoolPartLoadRatio,  // DX cooling coil part load ratio
     373             :                            Real64 const HeatPartLoadRatio,  // DX heating coil part load ratio (0 for other heating coil types)
     374             :                            Real64 const HeatCoilLoad,       // Heating coil load for gas heater
     375             :                            Real64 const ReheatCoilLoad,     // Reheating coil load for gas heater
     376             :                            Real64 &SensibleLoadMet,         // Sensible cooling load met (furnace outlet with respect to control zone temp)
     377             :                            Real64 &LatentLoadMet,           // Latent cooling load met (furnace outlet with respect to control zone humidity ratio)
     378             :                            Real64 &OnOffAirFlowRatio,       // Ratio of compressor ON mass flow rate to AVERAGE
     379             :                            bool const HXUnitOn,             // flag to enable HX based on zone moisture load
     380             :                            Real64 const CoolingHeatingPLRRatio = 1.0 // cooling PLR to heating PLR ratio, used for cycling fan RH control
     381             :     );
     382             : 
     383             :     //        End of Update subroutines for the Furnace Module
     384             :     // *****************************************************************************
     385             : 
     386             :     Real64 CalcFurnaceResidual(EnergyPlusData &state,
     387             :                                Real64 PartLoadRatio, // DX cooling coil part load ratio
     388             :                                int FurnaceNum,
     389             :                                bool FirstHVACIteration,
     390             :                                HVAC::FanOp const fanOp,
     391             :                                HVAC::CompressorOp compressorOp,
     392             :                                Real64 LoadToBeMet,
     393             :                                Real64 par6_loadFlag,
     394             :                                Real64 par7_sensLatentFlag,
     395             :                                Real64 par9_HXOnFlag,
     396             :                                Real64 par10_HeatingCoilPLR);
     397             : 
     398             :     Real64 CalcWaterToAirResidual(EnergyPlusData &state,
     399             :                                   Real64 PartLoadRatio, // DX cooling coil part load ratio
     400             :                                   int FurnaceNum,
     401             :                                   bool FirstHVACIteration,
     402             :                                   HVAC::FanOp const fanOp,
     403             :                                   HVAC::CompressorOp compressorOp,
     404             :                                   Real64 LoadToBeMet,
     405             :                                   Real64 par6_loadTypeFlag,
     406             :                                   Real64 par7_latentOrSensible,
     407             :                                   Real64 ZoneSensLoadMetFanONCompOFF,
     408             :                                   Real64 par9_HXUnitOne);
     409             : 
     410             :     void SetAverageAirFlow(EnergyPlusData &state,
     411             :                            int const FurnaceNum,       // Unit index
     412             :                            Real64 const PartLoadRatio, // unit part load ratio
     413             :                            Real64 &OnOffAirFlowRatio   // ratio of compressor ON airflow to AVERAGE airflow over timestep
     414             :     );
     415             : 
     416             :     // Beginning of Reporting subroutines for the Furnace Module
     417             :     // *****************************************************************************
     418             : 
     419             :     void ReportFurnace(EnergyPlusData &state,
     420             :                        int const FurnaceNum, // Furnace Index Number
     421             :                        int const AirLoopNum  // index to air loop
     422             :     );
     423             : 
     424             :     void CalcNonDXHeatingCoils(EnergyPlusData &state,
     425             :                                int const FurnaceNum,           // Furnace Index
     426             :                                bool const SuppHeatingCoilFlag, // .TRUE. if supplemental heating coil
     427             :                                bool const FirstHVACIteration,  // flag for first HVAC iteration in the time step
     428             :                                Real64 const QCoilLoad,         // load met by unit (watts)
     429             :                                HVAC::FanOp const fanOp,        // fan operation mode
     430             :                                Real64 &HeatCoilLoadmet         // Heating Load Met
     431             :     );
     432             : 
     433             :     //        End of Reporting subroutines for the Furnace Module
     434             : 
     435             :     //******************************************************************************
     436             : 
     437             :     void SimVariableSpeedHP(EnergyPlusData &state,
     438             :                             int const FurnaceNum,          // number of the current engine driven Heat Pump being simulated
     439             :                             bool const FirstHVACIteration, // TRUE if 1st HVAC simulation of system timestep
     440             :                             int const AirLoopNum,          // index to air loop
     441             :                             Real64 const QZnReq,           // required zone load
     442             :                             Real64 const QLatReq,          // required latent load
     443             :                             Real64 &OnOffAirFlowRatio      // ratio of compressor ON airflow to AVERAGE airflow over timestep
     444             :     );
     445             : 
     446             :     //******************************************************************************
     447             : 
     448             :     void ControlVSHPOutput(EnergyPlusData &state,
     449             :                            int const FurnaceNum,            // Unit index of engine driven heat pump
     450             :                            bool const FirstHVACIteration,   // flag for 1st HVAC iteration in the time step
     451             :                            HVAC::CompressorOp compressorOp, // compressor operation; 1=on, 0=off
     452             :                            HVAC::FanOp const fanOp,         // operating mode: FanOp::Cycling | FanOp::Continuous
     453             :                            Real64 &QZnReq,                  // cooling or heating output needed by zone [W]
     454             :                            Real64 QLatReq,                  // latent cooling output needed by zone [W]
     455             :                            int &SpeedNum,                   // Speed number
     456             :                            Real64 &SpeedRatio,              // unit speed ratio for DX coils
     457             :                            Real64 &PartLoadFrac,            // unit part load fraction
     458             :                            Real64 &OnOffAirFlowRatio,       // ratio of compressor ON airflow to AVERAGE airflow over timestep
     459             :                            Real64 &SupHeaterLoad            // Supplemental heater load [W]
     460             :     );
     461             : 
     462             :     //******************************************************************************
     463             : 
     464             :     void CalcVarSpeedHeatPump(EnergyPlusData &state,
     465             :                               int const FurnaceNum,            // Variable speed heat pump number
     466             :                               bool const FirstHVACIteration,   // Flag for 1st HVAC iteration
     467             :                               HVAC::CompressorOp compressorOp, // Compressor on/off; 1=on, 0=off
     468             :                               int const SpeedNum,              // Speed number
     469             :                               Real64 const SpeedRatio,         // Compressor speed ratio
     470             :                               Real64 const PartLoadFrac,       // Compressor part load fraction
     471             :                               Real64 &SensibleLoadMet,         // Sensible cooling load met (furnace outlet with respect to control zone temp)
     472             :                               Real64 &LatentLoadMet,           // Latent cooling load met (furnace outlet with respect to control zone humidity ratio)
     473             :                               Real64 const QZnReq,             // Zone load (W)
     474             :                               Real64 const QLatReq,            // Zone latent load []
     475             :                               Real64 &OnOffAirFlowRatio,       // Ratio of compressor ON airflow to AVERAGE airflow over timestep
     476             :                               Real64 const SupHeaterLoad       // supplemental heater load (W)
     477             :     );
     478             : 
     479             :     //******************************************************************************
     480             : 
     481             :     Real64 VSHPCyclingResidual(EnergyPlusData &state,
     482             :                                Real64 PartLoadFrac, // compressor cycling ratio (1.0 is continuous, 0.0 is off)
     483             :                                int FurnaceNum,
     484             :                                // int ZoneNum,
     485             :                                bool FirstHVACIteration,
     486             :                                // int OpMode,
     487             :                                Real64 LoadToBeMet,
     488             :                                Real64 OnOffAirFlowRatio,
     489             :                                Real64 SupHeaterLoad,
     490             :                                HVAC::CompressorOp compressorOp,
     491             :                                Real64 par9_SensLatFlag);
     492             : 
     493             :     //******************************************************************************
     494             : 
     495             :     Real64 VSHPSpeedResidual(EnergyPlusData &state,
     496             :                              Real64 SpeedRatio, // compressor cycling ratio (1.0 is continuous, 0.0 is off)
     497             :                              int FurnaceNum,
     498             :                              bool FirstHVACIteration,
     499             :                              Real64 LoadToBeMet,
     500             :                              Real64 OnOffAirFlowRatio,
     501             :                              Real64 SupHeaterLoad,
     502             :                              int SpeedNum,
     503             :                              HVAC::CompressorOp compressorOp,
     504             :                              Real64 par9_SensLatFlag);
     505             : 
     506             :     void SetVSHPAirFlow(EnergyPlusData &state,
     507             :                         int const FurnaceNum,                            // Unit index
     508             :                         Real64 const PartLoadRatio,                      // unit part load ratio
     509             :                         Real64 &OnOffAirFlowRatio,                       // ratio of compressor ON airflow to average airflow over timestep
     510             :                         ObjexxFCL::Optional_int_const SpeedNum = _,      // Speed number
     511             :                         ObjexxFCL::Optional<Real64 const> SpeedRatio = _ // Speed ratio
     512             :     );
     513             : 
     514             :     void SetMinOATCompressor(EnergyPlusData &state,
     515             :                              int const FurnaceNum,                    // index to furnace
     516             :                              std::string const &cCurrentModuleObject, // type of furnace
     517             :                              bool &ErrorsFound                        // GetInput logical that errors were found
     518             :     );
     519             : 
     520             : } // namespace Furnaces
     521             : 
     522             : struct FurnacesData : BaseGlobalStruct
     523             : {
     524             : 
     525             :     // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
     526             :     bool GetFurnaceInputFlag = true; // Logical to allow "GetInput" only once per simulation
     527             :     std::unordered_map<std::string, std::string> UniqueFurnaceNames;
     528             :     bool InitFurnaceMyOneTimeFlag = true; // one time allocation flag
     529             :     bool FlowFracFlagReady = true;        // one time flag for calculating flow fraction through controlled zone
     530             :     bool MyAirLoopPass = true;            // one time allocation flag
     531             : 
     532             :     int NumFurnaces = 0; // The number of furnaces found in the input data file
     533             :     Array1D_bool MySizeFlag;
     534             :     Array1D_bool CheckEquipName;
     535             :     Real64 ModifiedHeatCoilLoad; // used to adjust heating coil capacity if outlet temp > DesignMaxOutletTemp,
     536             :     // used for Coil:Gas:Heating and Coil:Electric:Heating coils only.
     537             :     Real64 OnOffAirFlowRatioSave = 0.0;        // Saves the OnOffAirFlowRatio calculated in RegulaFalsi CALLs.
     538             :     Real64 OnOffFanPartLoadFractionSave = 0.0; // Global part-load fraction passed to fan object
     539             :     Real64 CompOnMassFlow = 0.0;               // Supply air mass flow rate w/ compressor ON [kg/s]
     540             :     Real64 CompOffMassFlow = 0.0;              // Supply air mass flow rate w/ compressor OFF [kg/s]
     541             :     Real64 CompOnFlowRatio = 0.0;              // fan flow ratio when coil on
     542             :     Real64 CompOffFlowRatio = 0.0;             // fan flow ratio when coil off
     543             :     Real64 FanSpeedRatio = 0.0;                // ratio of air flow ratio passed to fan object
     544             :     Real64 CoolHeatPLRRat = 1.0;               // ratio of cooling to heating PLR, used for cycling fan RH control
     545             :     bool HeatingLoad = false;
     546             :     bool CoolingLoad = false;
     547             :     bool EconomizerFlag = false;             // holds air loop economizer status
     548             :     int AirLoopPass = 0;                     // Number of air loop pass
     549             :     bool HPDehumidificationLoadFlag = false; // true if there is dehumidification load (heat pumps only)
     550             :     Real64 TempSteamIn = 100.0;              // steam coil steam inlet temperature
     551             :     // starting add variables for variable speed water source heat pump
     552             :     Real64 SaveCompressorPLR = 0.0;  // holds compressor PLR from active DX coil
     553             :     std::string CurrentModuleObject; // Object type for getting and error messages
     554             :     int Iter = 0;                    // Iteration counter for CalcNewZoneHeatOnlyFlowRates
     555             : 
     556             :     std::string HeatingCoilName; // name of heating coil
     557             :     std::string HeatingCoilType; // type of heating coil
     558             : 
     559             :     // Object Data
     560             :     Array1D<Furnaces::FurnaceEquipConditions> Furnace;
     561             : 
     562             :     Array1D_bool MyEnvrnFlag;             // environment flag
     563             :     Array1D_bool MySecondOneTimeFlag;     // additional one time flag
     564             :     Array1D_bool MyFanFlag;               // used for sizing fan inputs one time
     565             :     Array1D_bool MyCheckFlag;             // Used to obtain the zone inlet node number in the controlled zone
     566             :     Array1D_bool MyFlowFracFlag;          // Used for calculatig flow fraction once
     567             :     Array1D_bool MyPlantScanFlag;         // used to initializa plant comp for water and steam heating coils
     568             :     Array1D_bool MySuppCoilPlantScanFlag; // used to initialize plant comp for water and steam heating coils
     569             : 
     570             :     // used to be statics
     571             :     Real64 CoolCoilLoad;        // Negative value means cooling required
     572             :     Real64 SystemSensibleLoad;  // Positive value means heating required
     573             :     Real64 TotalZoneLatentLoad; // Total ZONE latent load (not including outside air) to be removed by furnace/unitary system
     574             :     Real64 TotalZoneSensLoad;   // Total ZONE heating load (not including outside air) to be removed by furnace/unitary system
     575             :     Real64 CoolPartLoadRatio;   // Part load ratio (greater of sensible or latent part load ratio for cooling)
     576             :     Real64 HeatPartLoadRatio;   // Part load ratio (greater of sensible or latent part load ratio for cooling)
     577             :     int SpeedNum = 1;           // Speed number
     578             :     Real64 SupHeaterLoad = 0.0; // supplement heater load
     579             : 
     580         796 :     void init_state([[maybe_unused]] EnergyPlusData &state) override
     581             :     {
     582         796 :     }
     583             : 
     584           0 :     void clear_state() override
     585             :     {
     586           0 :         GetFurnaceInputFlag = true;
     587           0 :         UniqueFurnaceNames.clear();
     588           0 :         InitFurnaceMyOneTimeFlag = true;
     589           0 :         FlowFracFlagReady = true; // one time flag for calculating flow fraction through controlled zone
     590           0 :         MyAirLoopPass = true;
     591             : 
     592           0 :         NumFurnaces = 0;
     593           0 :         MySizeFlag.clear();
     594           0 :         CheckEquipName.clear();
     595           0 :         ModifiedHeatCoilLoad = 0.0;
     596           0 :         OnOffAirFlowRatioSave = 0.0;
     597           0 :         OnOffFanPartLoadFractionSave = 0.0;
     598           0 :         CompOnMassFlow = 0.0;
     599           0 :         CompOffMassFlow = 0.0;
     600           0 :         CompOnFlowRatio = 0.0;
     601           0 :         CompOffFlowRatio = 0.0;
     602           0 :         FanSpeedRatio = 0.0;
     603           0 :         CoolHeatPLRRat = 1.0;
     604           0 :         HeatingLoad = false;
     605           0 :         CoolingLoad = false;
     606           0 :         EconomizerFlag = false;
     607           0 :         AirLoopPass = 0;
     608           0 :         HPDehumidificationLoadFlag = false;
     609           0 :         TempSteamIn = 100.0;
     610           0 :         SaveCompressorPLR = 0.0;
     611           0 :         CurrentModuleObject = "";
     612           0 :         Iter = 0;
     613           0 :         HeatingCoilName.clear();
     614           0 :         HeatingCoilType.clear();
     615           0 :         Furnace.clear();
     616             : 
     617           0 :         MyEnvrnFlag.clear();
     618           0 :         MySecondOneTimeFlag.clear();
     619           0 :         MyFanFlag.clear();
     620           0 :         MyCheckFlag.clear();
     621           0 :         MyFlowFracFlag.clear();
     622           0 :         MyPlantScanFlag.clear();
     623           0 :         MySuppCoilPlantScanFlag.clear();
     624             : 
     625           0 :         SpeedNum = 1;
     626           0 :         SupHeaterLoad = 0.0;
     627           0 :     }
     628             : };
     629             : 
     630             : } // namespace EnergyPlus
     631             : 
     632             : #endif

Generated by: LCOV version 1.14