LCOV - code coverage report
Current view: top level - EnergyPlus - Furnaces.hh (source / functions) Hit Total Coverage
Test: lcov.output.filtered Lines: 6 48 12.5 %
Date: 2023-01-17 19:17:23 Functions: 5 7 71.4 %

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

Generated by: LCOV version 1.13