LCOV - code coverage report
Current view: top level - EnergyPlus - Furnaces.hh (source / functions) Coverage Total Hit
Test: lcov.output.filtered Lines: 100.0 % 74 74
Test Date: 2025-06-02 12:03:30 Functions: 100.0 % 4 4

            Line data    Source code
       1              : // EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois,
       2              : // The Regents of the University of California, through Lawrence Berkeley National Laboratory
       3              : // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge
       4              : // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other
       5              : // contributors. All rights reserved.
       6              : //
       7              : // NOTICE: This Software was developed under funding from the U.S. Department of Energy and the
       8              : // U.S. Government consequently retains certain rights. As such, the U.S. Government has been
       9              : // granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable,
      10              : // worldwide license in the Software to reproduce, distribute copies to the public, prepare
      11              : // derivative works, and perform publicly and display publicly, and to permit others to do so.
      12              : //
      13              : // Redistribution and use in source and binary forms, with or without modification, are permitted
      14              : // provided that the following conditions are met:
      15              : //
      16              : // (1) Redistributions of source code must retain the above copyright notice, this list of
      17              : //     conditions and the following disclaimer.
      18              : //
      19              : // (2) Redistributions in binary form must reproduce the above copyright notice, this list of
      20              : //     conditions and the following disclaimer in the documentation and/or other materials
      21              : //     provided with the distribution.
      22              : //
      23              : // (3) Neither the name of the University of California, Lawrence Berkeley National Laboratory,
      24              : //     the University of Illinois, U.S. Dept. of Energy nor the names of its contributors may be
      25              : //     used to endorse or promote products derived from this software without specific prior
      26              : //     written permission.
      27              : //
      28              : // (4) Use of EnergyPlus(TM) Name. If Licensee (i) distributes the software in stand-alone form
      29              : //     without changes from the version obtained under this License, or (ii) Licensee makes a
      30              : //     reference solely to the software portion of its product, Licensee must refer to the
      31              : //     software as "EnergyPlus version X" software, where "X" is the version number Licensee
      32              : //     obtained under this License and may not use a different name for the software. Except as
      33              : //     specifically required in this Section (4), Licensee shall not use in a company name, a
      34              : //     product name, in advertising, publicity, or other promotional activities any name, trade
      35              : //     name, trademark, logo, or other designation of "EnergyPlus", "E+", "e+" or confusingly
      36              : //     similar designation, without the U.S. Department of Energy's prior written consent.
      37              : //
      38              : // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
      39              : // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
      40              : // AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
      41              : // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
      42              : // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
      43              : // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
      44              : // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
      45              : // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
      46              : // POSSIBILITY OF SUCH DAMAGE.
      47              : 
      48              : #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              :         Sched::Schedule *availSched = nullptr;                     // furnace operating schedule
     115              :         Sched::Schedule *fanOpModeSched = nullptr;                 // fan operating mode schedule
     116              :         Sched::Schedule *fanAvailSched = nullptr;                  // 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            5 :         FurnaceEquipConditions()
     258           10 :             : FurnaceIndex(0), ControlZoneNum(0), ZoneSequenceCoolingNum(0), ZoneSequenceHeatingNum(0), CoolingCoilType_Num(0), CoolingCoilIndex(0),
     259            5 :               ActualDXCoilIndexForHXAssisted(0), CoolingCoilUpstream(true), HeatingCoilType_Num(0), HeatingCoilIndex(0), ReheatingCoilType_Num(0),
     260           10 :               ReheatingCoilIndex(0), CoilControlNode(0), HWCoilAirInletNode(0), HWCoilAirOutletNode(0), SuppCoilAirInletNode(0),
     261           10 :               SuppCoilAirOutletNode(0), SuppHeatCoilType_Num(0), SuppHeatCoilIndex(0), SuppCoilControlNode(0), fanType(HVAC::FanType::Invalid),
     262            5 :               FanIndex(0), FurnaceInletNodeNum(0), FurnaceOutletNodeNum(0), LastMode(Furnaces::ModeOfOperation::Invalid),
     263            5 :               AirFlowControl(AirFlowControlConstFan::Invalid), fanPlace(HVAC::FanPlace::Invalid), NodeNumOfControlledZone(0),
     264            5 :               CoolingConvergenceTolerance(0.0), HeatingConvergenceTolerance(0.0), DesignHeatingCapacity(0.0), DesignCoolingCapacity(0.0),
     265            5 :               CoolingCoilSensDemand(0.0), HeatingCoilSensDemand(0.0), CoolingCoilLatentDemand(0.0), DesignSuppHeatingCapacity(0.0),
     266            5 :               DesignFanVolFlowRate(0.0), DesignFanVolFlowRateEMSOverrideOn(false), DesignFanVolFlowRateEMSOverrideValue(0.0), DesignMassFlowRate(0.0),
     267            5 :               MaxCoolAirVolFlow(0.0), MaxCoolAirVolFlowEMSOverrideOn(false), MaxCoolAirVolFlowEMSOverrideValue(0.0), MaxHeatAirVolFlow(0.0),
     268            5 :               MaxHeatAirVolFlowEMSOverrideOn(false), MaxHeatAirVolFlowEMSOverrideValue(0.0), MaxNoCoolHeatAirVolFlow(0.0),
     269            5 :               MaxNoCoolHeatAirVolFlowEMSOverrideOn(false), MaxNoCoolHeatAirVolFlowEMSOverrideValue(0.0), MaxCoolAirMassFlow(0.0),
     270            5 :               MaxHeatAirMassFlow(0.0), MaxNoCoolHeatAirMassFlow(0.0), MaxHeatCoilFluidFlow(0.0), MaxSuppCoilFluidFlow(0.0),
     271            5 :               ControlZoneMassFlowFrac(0.0), DesignMaxOutletTemp(9999.0), MdotFurnace(0.0), FanPartLoadRatio(0.0), CompPartLoadRatio(0.0),
     272            5 :               CoolPartLoadRatio(0.0), HeatPartLoadRatio(0.0), MinOATCompressorCooling(0.0), MinOATCompressorHeating(0.0), MaxOATSuppHeat(0.0),
     273            5 :               CondenserNodeNum(0), Humidistat(false), InitHeatPump(false), DehumidControlType_Num(DehumidificationControlMode::None),
     274            5 :               LatentMaxIterIndex(0), LatentRegulaFalsiFailedIndex(0), LatentRegulaFalsiFailedIndex2(0), SensibleMaxIterIndex(0),
     275            5 :               SensibleRegulaFalsiFailedIndex(0), WSHPHeatMaxIterIndex(0), WSHPHeatRegulaFalsiFailedIndex(0), DXHeatingMaxIterIndex(0),
     276            5 :               DXHeatingRegulaFalsiFailedIndex(0), HeatingMaxIterIndex(0), HeatingMaxIterIndex2(0), HeatingRegulaFalsiFailedIndex(0),
     277            5 :               ActualFanVolFlowRate(0.0), HeatingSpeedRatio(1.0), CoolingSpeedRatio(1.0), NoHeatCoolSpeedRatio(1.0), ZoneInletNode(0),
     278            5 :               SenLoadLoss(0.0), LatLoadLoss(0.0), SensibleLoadMet(0.0), LatentLoadMet(0.0), DehumidInducedHeatingDemandRate(0.0), CoilOutletNode(0),
     279            5 :               plantLoc{}, SuppPlantLoc{}, HotWaterCoilMaxIterIndex(0), HotWaterCoilMaxIterIndex2(0), EMSOverrideSensZoneLoadRequest(false),
     280            5 :               EMSSensibleZoneLoadValue(0.0), EMSOverrideMoistZoneLoadRequest(false), EMSMoistureZoneLoadValue(0.0),
     281            5 :               HeatCoolMode(Furnaces::ModeOfOperation::Invalid), NumOfSpeedCooling(0), NumOfSpeedHeating(0), IdleSpeedRatio(0.0),
     282            5 :               IdleVolumeAirRate(0.0), IdleMassFlowRate(0.0), FanVolFlow(0.0), CheckFanFlow(true), HeatVolumeFlowRate(HVAC::MaxSpeedLevels, 0.0),
     283            5 :               HeatMassFlowRate(HVAC::MaxSpeedLevels, 0.0), CoolVolumeFlowRate(HVAC::MaxSpeedLevels, 0.0), CoolMassFlowRate(HVAC::MaxSpeedLevels, 0.0),
     284            5 :               MSHeatingSpeedRatio(HVAC::MaxSpeedLevels, 0.0), MSCoolingSpeedRatio(HVAC::MaxSpeedLevels, 0.0), bIsIHP(false), CompSpeedNum(0),
     285           10 :               CompSpeedRatio(0.0), ErrIndexCyc(0), ErrIndexVar(0), iterationCounter(0), iterationMode(0), FirstPass(true)
     286              :         {
     287            5 :         }
     288              :     };
     289              : 
     290              :     // Functions
     291              : 
     292              :     void SimFurnace(EnergyPlusData &state,
     293              :                     std::string_view FurnaceName,
     294              :                     bool const FirstHVACIteration,
     295              :                     int const AirLoopNum, // Primary air loop number
     296              :                     int &CompIndex        // Pointer to which furnace
     297              :     );
     298              : 
     299              :     // Get Input Section of the Module
     300              :     //******************************************************************************
     301              : 
     302              :     void GetFurnaceInput(EnergyPlusData &state);
     303              : 
     304              :     // End of Get Input subroutines for this Module
     305              :     //******************************************************************************
     306              : 
     307              :     // Beginning Initialization Section of the Module
     308              :     //******************************************************************************
     309              : 
     310              :     void InitFurnace(EnergyPlusData &state,
     311              :                      int const FurnaceNum,         // index to Furnace
     312              :                      int const AirLoopNum,         // index to air loop
     313              :                      Real64 &OnOffAirFlowRatio,    // ratio of on to off air mass flow rate
     314              :                      HVAC::FanOp &fanOp,           // fan operating mode
     315              :                      Real64 &ZoneLoad,             // zone sensible load to be met (modified here as needed) (W)
     316              :                      Real64 &MoistureLoad,         // zone moisture load (W)
     317              :                      bool const FirstHVACIteration // TRUE if first HVAC iteration
     318              :     );
     319              : 
     320              :     void SetOnOffMassFlowRate(EnergyPlusData &state,
     321              :                               int const FurnaceNum,      // index to furnace
     322              :                               int const AirLoopNum,      // index to air loop !unused1208
     323              :                               Real64 &OnOffAirFlowRatio, // ratio of coil on to coil off air flow rate
     324              :                               HVAC::FanOp const fanOp,   // fan operating mode
     325              :                               Real64 const ZoneLoad,     // sensible load to be met (W) !unused1208
     326              :                               Real64 const MoistureLoad, // moisture load to be met (W)
     327              :                               Real64 const PartLoadRatio // coil part-load ratio
     328              :     );
     329              : 
     330              :     void SizeFurnace(EnergyPlusData &state, int const FurnaceNum, bool const FirstHVACIteration);
     331              : 
     332              :     // End Initialization Section of the Module
     333              :     //******************************************************************************
     334              : 
     335              :     // Beginning of Update subroutines for the Furnace Module
     336              :     // *****************************************************************************
     337              : 
     338              :     void CalcNewZoneHeatOnlyFlowRates(EnergyPlusData &state,
     339              :                                       int const FurnaceNum,          // Index to furnace
     340              :                                       bool const FirstHVACIteration, // Iteration flag
     341              :                                       Real64 const ZoneLoad,         // load to be met by furnace (W)
     342              :                                       Real64 &HeatCoilLoad,          // actual load passed to heating coil (W)
     343              :                                       Real64 &OnOffAirFlowRatio      // ratio of coil on to coil off air flow rate
     344              :     );
     345              : 
     346              :     void CalcNewZoneHeatCoolFlowRates(EnergyPlusData &state,
     347              :                                       int const FurnaceNum,
     348              :                                       bool const FirstHVACIteration,
     349              :                                       HVAC::CompressorOp compressorOp, // compressor operation flag (1=On, 0=Off)
     350              :                                       Real64 const ZoneLoad,           // the control zone load (watts)
     351              :                                       Real64 const MoistureLoad,       // the control zone latent load (watts)
     352              :                                       Real64 &HeatCoilLoad,            // Heating load to be met by heating coil ( excluding heat pump DX coil)
     353              :                                       Real64 &ReheatCoilLoad,          // Heating load to be met by reheat coil using hstat (excluding HP DX coil)
     354              :                                       Real64 &OnOffAirFlowRatio,       // Ratio of compressor ON air flow to AVERAGE air flow over time step
     355              :                                       bool &HXUnitOn                   // flag to control HX based on zone moisture load
     356              :     );
     357              : 
     358              :     void CalcWaterToAirHeatPump(EnergyPlusData &state,
     359              :                                 int const FurnaceNum,            // index to Furnace
     360              :                                 bool const FirstHVACIteration,   // TRUE on first HVAC iteration
     361              :                                 HVAC::CompressorOp compressorOp, // compressor operation flag (1=On, 0=Off)
     362              :                                 Real64 const ZoneLoad,           // the control zone load (watts)
     363              :                                 Real64 const MoistureLoad        // the control zone latent load (watts)
     364              :     );
     365              : 
     366              :     void CalcFurnaceOutput(EnergyPlusData &state,
     367              :                            int const FurnaceNum,
     368              :                            bool const FirstHVACIteration,
     369              :                            HVAC::FanOp const fanOp,         // Cycling fan or constant fan
     370              :                            HVAC::CompressorOp compressorOp, // Compressor on/off; 1=on, 0=off
     371              :                            Real64 const CoolPartLoadRatio,  // DX cooling coil part load ratio
     372              :                            Real64 const HeatPartLoadRatio,  // DX heating coil part load ratio (0 for other heating coil types)
     373              :                            Real64 const HeatCoilLoad,       // Heating coil load for gas heater
     374              :                            Real64 const ReheatCoilLoad,     // Reheating coil load for gas heater
     375              :                            Real64 &SensibleLoadMet,         // Sensible cooling load met (furnace outlet with respect to control zone temp)
     376              :                            Real64 &LatentLoadMet,           // Latent cooling load met (furnace outlet with respect to control zone humidity ratio)
     377              :                            Real64 &OnOffAirFlowRatio,       // Ratio of compressor ON mass flow rate to AVERAGE
     378              :                            bool const HXUnitOn,             // flag to enable HX based on zone moisture load
     379              :                            Real64 const CoolingHeatingPLRRatio = 1.0 // cooling PLR to heating PLR ratio, used for cycling fan RH control
     380              :     );
     381              : 
     382              :     //        End of Update subroutines for the Furnace Module
     383              :     // *****************************************************************************
     384              : 
     385              :     Real64 CalcFurnaceResidual(EnergyPlusData &state,
     386              :                                Real64 PartLoadRatio, // DX cooling coil part load ratio
     387              :                                int FurnaceNum,
     388              :                                bool FirstHVACIteration,
     389              :                                HVAC::FanOp const fanOp,
     390              :                                HVAC::CompressorOp compressorOp,
     391              :                                Real64 LoadToBeMet,
     392              :                                Real64 par6_loadFlag,
     393              :                                Real64 par7_sensLatentFlag,
     394              :                                Real64 par9_HXOnFlag,
     395              :                                Real64 par10_HeatingCoilPLR);
     396              : 
     397              :     Real64 CalcWaterToAirResidual(EnergyPlusData &state,
     398              :                                   Real64 PartLoadRatio, // DX cooling coil part load ratio
     399              :                                   int FurnaceNum,
     400              :                                   bool FirstHVACIteration,
     401              :                                   HVAC::FanOp const fanOp,
     402              :                                   HVAC::CompressorOp compressorOp,
     403              :                                   Real64 LoadToBeMet,
     404              :                                   Real64 par6_loadTypeFlag,
     405              :                                   Real64 par7_latentOrSensible,
     406              :                                   Real64 ZoneSensLoadMetFanONCompOFF,
     407              :                                   Real64 par9_HXUnitOne);
     408              : 
     409              :     void SetAverageAirFlow(EnergyPlusData &state,
     410              :                            int const FurnaceNum,       // Unit index
     411              :                            Real64 const PartLoadRatio, // unit part load ratio
     412              :                            Real64 &OnOffAirFlowRatio   // ratio of compressor ON airflow to AVERAGE airflow over timestep
     413              :     );
     414              : 
     415              :     // Beginning of Reporting subroutines for the Furnace Module
     416              :     // *****************************************************************************
     417              : 
     418              :     void ReportFurnace(EnergyPlusData &state,
     419              :                        int const FurnaceNum, // Furnace Index Number
     420              :                        int const AirLoopNum  // index to air loop
     421              :     );
     422              : 
     423              :     void CalcNonDXHeatingCoils(EnergyPlusData &state,
     424              :                                int const FurnaceNum,           // Furnace Index
     425              :                                bool const SuppHeatingCoilFlag, // .TRUE. if supplemental heating coil
     426              :                                bool const FirstHVACIteration,  // flag for first HVAC iteration in the time step
     427              :                                Real64 const QCoilLoad,         // load met by unit (watts)
     428              :                                HVAC::FanOp const fanOp,        // fan operation mode
     429              :                                Real64 &HeatCoilLoadmet         // Heating Load Met
     430              :     );
     431              : 
     432              :     //        End of Reporting subroutines for the Furnace Module
     433              : 
     434              :     //******************************************************************************
     435              : 
     436              :     void SimVariableSpeedHP(EnergyPlusData &state,
     437              :                             int const FurnaceNum,          // number of the current engine driven Heat Pump being simulated
     438              :                             bool const FirstHVACIteration, // TRUE if 1st HVAC simulation of system timestep
     439              :                             int const AirLoopNum,          // index to air loop
     440              :                             Real64 const QZnReq,           // required zone load
     441              :                             Real64 const QLatReq,          // required latent load
     442              :                             Real64 &OnOffAirFlowRatio      // ratio of compressor ON airflow to AVERAGE airflow over timestep
     443              :     );
     444              : 
     445              :     //******************************************************************************
     446              : 
     447              :     void ControlVSHPOutput(EnergyPlusData &state,
     448              :                            int const FurnaceNum,            // Unit index of engine driven heat pump
     449              :                            bool const FirstHVACIteration,   // flag for 1st HVAC iteration in the time step
     450              :                            HVAC::CompressorOp compressorOp, // compressor operation; 1=on, 0=off
     451              :                            HVAC::FanOp const fanOp,         // operating mode: FanOp::Cycling | FanOp::Continuous
     452              :                            Real64 &QZnReq,                  // cooling or heating output needed by zone [W]
     453              :                            Real64 QLatReq,                  // latent cooling output needed by zone [W]
     454              :                            int &SpeedNum,                   // Speed number
     455              :                            Real64 &SpeedRatio,              // unit speed ratio for DX coils
     456              :                            Real64 &PartLoadFrac,            // unit part load fraction
     457              :                            Real64 &OnOffAirFlowRatio,       // ratio of compressor ON airflow to AVERAGE airflow over timestep
     458              :                            Real64 &SupHeaterLoad            // Supplemental heater load [W]
     459              :     );
     460              : 
     461              :     //******************************************************************************
     462              : 
     463              :     void CalcVarSpeedHeatPump(EnergyPlusData &state,
     464              :                               int const FurnaceNum,            // Variable speed heat pump number
     465              :                               bool const FirstHVACIteration,   // Flag for 1st HVAC iteration
     466              :                               HVAC::CompressorOp compressorOp, // Compressor on/off; 1=on, 0=off
     467              :                               int const SpeedNum,              // Speed number
     468              :                               Real64 const SpeedRatio,         // Compressor speed ratio
     469              :                               Real64 const PartLoadFrac,       // Compressor part load fraction
     470              :                               Real64 &SensibleLoadMet,         // Sensible cooling load met (furnace outlet with respect to control zone temp)
     471              :                               Real64 &LatentLoadMet,           // Latent cooling load met (furnace outlet with respect to control zone humidity ratio)
     472              :                               Real64 const QZnReq,             // Zone load (W)
     473              :                               Real64 const QLatReq,            // Zone latent load []
     474              :                               Real64 &OnOffAirFlowRatio,       // Ratio of compressor ON airflow to AVERAGE airflow over timestep
     475              :                               Real64 const SupHeaterLoad       // supplemental heater load (W)
     476              :     );
     477              : 
     478              :     //******************************************************************************
     479              : 
     480              :     Real64 VSHPCyclingResidual(EnergyPlusData &state,
     481              :                                Real64 PartLoadFrac, // compressor cycling ratio (1.0 is continuous, 0.0 is off)
     482              :                                int FurnaceNum,
     483              :                                // int ZoneNum,
     484              :                                bool FirstHVACIteration,
     485              :                                // int OpMode,
     486              :                                Real64 LoadToBeMet,
     487              :                                Real64 OnOffAirFlowRatio,
     488              :                                Real64 SupHeaterLoad,
     489              :                                HVAC::CompressorOp compressorOp,
     490              :                                Real64 par9_SensLatFlag);
     491              : 
     492              :     //******************************************************************************
     493              : 
     494              :     Real64 VSHPSpeedResidual(EnergyPlusData &state,
     495              :                              Real64 SpeedRatio, // compressor cycling ratio (1.0 is continuous, 0.0 is off)
     496              :                              int FurnaceNum,
     497              :                              bool FirstHVACIteration,
     498              :                              Real64 LoadToBeMet,
     499              :                              Real64 OnOffAirFlowRatio,
     500              :                              Real64 SupHeaterLoad,
     501              :                              int SpeedNum,
     502              :                              HVAC::CompressorOp compressorOp,
     503              :                              Real64 par9_SensLatFlag);
     504              : 
     505              :     void SetVSHPAirFlow(EnergyPlusData &state,
     506              :                         int const FurnaceNum,                            // Unit index
     507              :                         Real64 const PartLoadRatio,                      // unit part load ratio
     508              :                         Real64 &OnOffAirFlowRatio,                       // ratio of compressor ON airflow to average airflow over timestep
     509              :                         ObjexxFCL::Optional_int_const SpeedNum = _,      // Speed number
     510              :                         ObjexxFCL::Optional<Real64 const> SpeedRatio = _ // Speed ratio
     511              :     );
     512              : 
     513              :     void SetMinOATCompressor(EnergyPlusData &state,
     514              :                              int const FurnaceNum,                    // index to furnace
     515              :                              std::string const &cCurrentModuleObject, // type of furnace
     516              :                              bool &ErrorsFound                        // GetInput logical that errors were found
     517              :     );
     518              : 
     519              : } // namespace Furnaces
     520              : 
     521              : struct FurnacesData : BaseGlobalStruct
     522              : {
     523              : 
     524              :     // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
     525              :     bool GetFurnaceInputFlag = true; // Logical to allow "GetInput" only once per simulation
     526              :     std::unordered_map<std::string, std::string> UniqueFurnaceNames;
     527              :     bool InitFurnaceMyOneTimeFlag = true; // one time allocation flag
     528              :     bool FlowFracFlagReady = true;        // one time flag for calculating flow fraction through controlled zone
     529              :     bool MyAirLoopPass = true;            // one time allocation flag
     530              : 
     531              :     int NumFurnaces = 0; // The number of furnaces found in the input data file
     532              :     Array1D_bool MySizeFlag;
     533              :     Array1D_bool CheckEquipName;
     534              :     Real64 ModifiedHeatCoilLoad; // used to adjust heating coil capacity if outlet temp > DesignMaxOutletTemp,
     535              :     // used for Coil:Gas:Heating and Coil:Electric:Heating coils only.
     536              :     Real64 OnOffAirFlowRatioSave = 0.0;        // Saves the OnOffAirFlowRatio calculated in RegulaFalsi CALLs.
     537              :     Real64 OnOffFanPartLoadFractionSave = 0.0; // Global part-load fraction passed to fan object
     538              :     Real64 CompOnMassFlow = 0.0;               // Supply air mass flow rate w/ compressor ON [kg/s]
     539              :     Real64 CompOffMassFlow = 0.0;              // Supply air mass flow rate w/ compressor OFF [kg/s]
     540              :     Real64 CompOnFlowRatio = 0.0;              // fan flow ratio when coil on
     541              :     Real64 CompOffFlowRatio = 0.0;             // fan flow ratio when coil off
     542              :     Real64 FanSpeedRatio = 0.0;                // ratio of air flow ratio passed to fan object
     543              :     Real64 CoolHeatPLRRat = 1.0;               // ratio of cooling to heating PLR, used for cycling fan RH control
     544              :     bool HeatingLoad = false;
     545              :     bool CoolingLoad = false;
     546              :     bool EconomizerFlag = false;             // holds air loop economizer status
     547              :     int AirLoopPass = 0;                     // Number of air loop pass
     548              :     bool HPDehumidificationLoadFlag = false; // true if there is dehumidification load (heat pumps only)
     549              :     Real64 TempSteamIn = 100.0;              // steam coil steam inlet temperature
     550              :     // starting add variables for variable speed water source heat pump
     551              :     Real64 SaveCompressorPLR = 0.0;  // holds compressor PLR from active DX coil
     552              :     std::string CurrentModuleObject; // Object type for getting and error messages
     553              :     int Iter = 0;                    // Iteration counter for CalcNewZoneHeatOnlyFlowRates
     554              : 
     555              :     std::string HeatingCoilName; // name of heating coil
     556              :     std::string HeatingCoilType; // type of heating coil
     557              : 
     558              :     // Object Data
     559              :     Array1D<Furnaces::FurnaceEquipConditions> Furnace;
     560              : 
     561              :     Array1D_bool MyEnvrnFlag;             // environment flag
     562              :     Array1D_bool MySecondOneTimeFlag;     // additional one time flag
     563              :     Array1D_bool MyFanFlag;               // used for sizing fan inputs one time
     564              :     Array1D_bool MyCheckFlag;             // Used to obtain the zone inlet node number in the controlled zone
     565              :     Array1D_bool MyFlowFracFlag;          // Used for calculatig flow fraction once
     566              :     Array1D_bool MyPlantScanFlag;         // used to initializa plant comp for water and steam heating coils
     567              :     Array1D_bool MySuppCoilPlantScanFlag; // used to initialize plant comp for water and steam heating coils
     568              : 
     569              :     // used to be statics
     570              :     Real64 CoolCoilLoad;        // Negative value means cooling required
     571              :     Real64 SystemSensibleLoad;  // Positive value means heating required
     572              :     Real64 TotalZoneLatentLoad; // Total ZONE latent load (not including outside air) to be removed by furnace/unitary system
     573              :     Real64 TotalZoneSensLoad;   // Total ZONE heating load (not including outside air) to be removed by furnace/unitary system
     574              :     Real64 CoolPartLoadRatio;   // Part load ratio (greater of sensible or latent part load ratio for cooling)
     575              :     Real64 HeatPartLoadRatio;   // Part load ratio (greater of sensible or latent part load ratio for cooling)
     576              :     int SpeedNum = 1;           // Speed number
     577              :     Real64 SupHeaterLoad = 0.0; // supplement heater load
     578              : 
     579         2128 :     void init_constant_state([[maybe_unused]] EnergyPlusData &state) override
     580              :     {
     581         2128 :     }
     582              : 
     583         1153 :     void init_state([[maybe_unused]] EnergyPlusData &state) override
     584              :     {
     585         1153 :     }
     586              : 
     587         2102 :     void clear_state() override
     588              :     {
     589         2102 :         GetFurnaceInputFlag = true;
     590         2102 :         UniqueFurnaceNames.clear();
     591         2102 :         InitFurnaceMyOneTimeFlag = true;
     592         2102 :         FlowFracFlagReady = true; // one time flag for calculating flow fraction through controlled zone
     593         2102 :         MyAirLoopPass = true;
     594              : 
     595         2102 :         NumFurnaces = 0;
     596         2102 :         MySizeFlag.clear();
     597         2102 :         CheckEquipName.clear();
     598         2102 :         ModifiedHeatCoilLoad = 0.0;
     599         2102 :         OnOffAirFlowRatioSave = 0.0;
     600         2102 :         OnOffFanPartLoadFractionSave = 0.0;
     601         2102 :         CompOnMassFlow = 0.0;
     602         2102 :         CompOffMassFlow = 0.0;
     603         2102 :         CompOnFlowRatio = 0.0;
     604         2102 :         CompOffFlowRatio = 0.0;
     605         2102 :         FanSpeedRatio = 0.0;
     606         2102 :         CoolHeatPLRRat = 1.0;
     607         2102 :         HeatingLoad = false;
     608         2102 :         CoolingLoad = false;
     609         2102 :         EconomizerFlag = false;
     610         2102 :         AirLoopPass = 0;
     611         2102 :         HPDehumidificationLoadFlag = false;
     612         2102 :         TempSteamIn = 100.0;
     613         2102 :         SaveCompressorPLR = 0.0;
     614         2102 :         CurrentModuleObject = "";
     615         2102 :         Iter = 0;
     616         2102 :         HeatingCoilName.clear();
     617         2102 :         HeatingCoilType.clear();
     618         2102 :         Furnace.clear();
     619              : 
     620         2102 :         MyEnvrnFlag.clear();
     621         2102 :         MySecondOneTimeFlag.clear();
     622         2102 :         MyFanFlag.clear();
     623         2102 :         MyCheckFlag.clear();
     624         2102 :         MyFlowFracFlag.clear();
     625         2102 :         MyPlantScanFlag.clear();
     626         2102 :         MySuppCoilPlantScanFlag.clear();
     627              : 
     628         2102 :         SpeedNum = 1;
     629         2102 :         SupHeaterLoad = 0.0;
     630         2102 :     }
     631              : };
     632              : 
     633              : } // namespace EnergyPlus
     634              : 
     635              : #endif
        

Generated by: LCOV version 2.0-1