LCOV - code coverage report
Current view: top level - EnergyPlus - HVACHXAssistedCoolingCoil.hh (source / functions) Hit Total Coverage
Test: lcov.output.filtered Lines: 6 17 35.3 %
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 HVACHXAssistedCoolingCoil_hh_INCLUDED
      49             : #define HVACHXAssistedCoolingCoil_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/DataGlobals.hh>
      58             : #include <EnergyPlus/EnergyPlus.hh>
      59             : 
      60             : namespace EnergyPlus {
      61             : 
      62             : // Forward declarations
      63             : struct EnergyPlusData;
      64             : 
      65             : namespace HVACHXAssistedCoolingCoil {
      66             : 
      67          30 :     struct HXAssistedCoilParameters
      68             :     {
      69             :         // Members
      70             :         std::string HXAssistedCoilType; // Type of HXAssistedCoolingCoil
      71             :         int HXAssistedCoilType_Num;     // Numeric equivalent for hx assisted coil
      72             :         std::string Name;               // Name of the HXAssistedCoolingCoil
      73             :         std::string CoolingCoilType;    // Cooling coil type must be DetailedFlatCooling
      74             :         //  or Coil:DX:CoolingBypassFactorEmpirical
      75             :         int CoolingCoilType_Num;     // Numeric Equivalent for cooling coil
      76             :         std::string CoolingCoilName; // Cooling coil name
      77             :         int CoolingCoilIndex;
      78             :         int DXCoilNumOfSpeeds;         // number of speed levels for variable speed DX coil
      79             :         std::string HeatExchangerType; // Heat Exchanger type must be HeatExchanger:AirToAir:FlatPlate,
      80             :         // HeatExchanger:AirToAir:SensibleAndLatent or
      81             :         // HeatExchanger:Desiccant:BalancedFlow
      82             :         int HeatExchangerType_Num;       // Numeric Equivalent for heat exchanger
      83             :         std::string HeatExchangerName;   // Heat Exchanger name
      84             :         int HeatExchangerIndex;          // Heat Exchanger index
      85             :         int HXAssistedCoilInletNodeNum;  // Inlet node to HXAssistedCoolingCoil compound object
      86             :         int HXAssistedCoilOutletNodeNum; // Outlet node to HXAssistedCoolingCoil compound object
      87             :         int HXExhaustAirInletNodeNum;    // Inlet node number for air-to-air heat exchanger
      88             :         Real64 MassFlowRate;             // Mass flow rate through HXAssistedCoolingCoil compound object
      89             :         int MaxIterCounter;              // used in warning messages
      90             :         int MaxIterIndex;                // used in warning messages
      91             :         int ControllerIndex;             // index to water coil controller
      92             :         std::string ControllerName;      // name of water coil controller
      93             : 
      94             :         // Default Constructor
      95          10 :         HXAssistedCoilParameters()
      96          10 :             : HXAssistedCoilType_Num(0), CoolingCoilType_Num(0), CoolingCoilIndex(0), DXCoilNumOfSpeeds(0), HeatExchangerType_Num(0),
      97             :               HeatExchangerIndex(0), HXAssistedCoilInletNodeNum(0), HXAssistedCoilOutletNodeNum(0), HXExhaustAirInletNodeNum(0), MassFlowRate(0.0),
      98          10 :               MaxIterCounter(0), MaxIterIndex(0), ControllerIndex(0)
      99             :         {
     100          10 :         }
     101             :     };
     102             : 
     103             :     void SimHXAssistedCoolingCoil(EnergyPlusData &state,
     104             :                                   std::string_view HXAssistedCoilName,               // Name of HXAssistedCoolingCoil
     105             :                                   bool const FirstHVACIteration,                     // FirstHVACIteration flag
     106             :                                   DataHVACGlobals::CompressorOperation CompressorOp, // compressor operation; 1=on, 0=off
     107             :                                   Real64 const PartLoadRatio,                        // Part load ratio of Coil:DX:CoolingBypassFactorEmpirical
     108             :                                   int &CompIndex,
     109             :                                   int const FanOpMode,                         // Allows the parent object to control fan operation
     110             :                                   Optional_bool_const HXUnitEnable = _,        // flag to enable heat exchanger heat recovery
     111             :                                   Optional<Real64 const> OnOffAFR = _,         // Ratio of compressor ON air mass flow rate to AVERAGE over time step
     112             :                                   Optional_bool_const EconomizerFlag = _,      // OA sys or air loop economizer status
     113             :                                   Optional<Real64> QTotOut = _,                // the total cooling output of unit
     114             :                                   Optional_int_const DehumidificationMode = _, // Optional dehumbidication mode
     115             :                                   Optional<Real64 const> LoadSHR = _           // Optional coil SHR pass over
     116             :     );
     117             : 
     118             :     void GetHXAssistedCoolingCoilInput(EnergyPlusData &state);
     119             : 
     120             :     void InitHXAssistedCoolingCoil(EnergyPlusData &state, int const HXAssistedCoilNum); // index for HXAssistedCoolingCoil
     121             : 
     122             :     void CalcHXAssistedCoolingCoil(EnergyPlusData &state,
     123             :                                    int const HXAssistedCoilNum,                       // Index number for HXAssistedCoolingCoil
     124             :                                    bool const FirstHVACIteration,                     // FirstHVACIteration flag
     125             :                                    DataHVACGlobals::CompressorOperation CompressorOp, // compressor operation; 1=on, 0=off
     126             :                                    Real64 const PartLoadRatio,                        // Cooling coil part load ratio
     127             :                                    bool const HXUnitOn,                               // Flag to enable heat exchanger
     128             :                                    int const FanOpMode,                               // Allows parent object to control fan operation
     129             :                                    Optional<Real64 const> OnOffAirFlow = _,     // Ratio of compressor ON air mass flow to AVERAGE over time step
     130             :                                    Optional_bool_const EconomizerFlag = _,      // OA (or airloop) econommizer status
     131             :                                    Optional_int_const DehumidificationMode = _, // Optional dehumbidication mode
     132             :                                    [[maybe_unused]] Optional<Real64 const> LoadSHR = _ // Optional coil SHR pass over
     133             :     );
     134             : 
     135             :     void GetHXDXCoilIndex(EnergyPlusData &state,
     136             :                           std::string const &HXDXCoilName,
     137             :                           int &HXDXCoilIndex,
     138             :                           bool &ErrorsFound,
     139             :                           std::string_view const CurrentModuleObject = {});
     140             : 
     141             :     void CheckHXAssistedCoolingCoilSchedule(EnergyPlusData &state,
     142             :                                             std::string const &CompType, // unused1208
     143             :                                             std::string_view CompName,
     144             :                                             Real64 &Value,
     145             :                                             int &CompIndex);
     146             : 
     147             :     Real64 GetCoilCapacity(EnergyPlusData &state,
     148             :                            std::string const &CoilType, // must match coil types in this module
     149             :                            std::string const &CoilName, // must match coil names for the coil type
     150             :                            bool &ErrorsFound            // set to true if problem
     151             :     );
     152             : 
     153             :     int GetCoilGroupTypeNum(EnergyPlusData &state,
     154             :                             std::string const &CoilType,         // must match coil types in this module
     155             :                             std::string const &CoilName,         // must match coil names for the coil type
     156             :                             bool &ErrorsFound,                   // set to true if problem
     157             :                             Optional_bool_const PrintWarning = _ // prints warning message if true
     158             :     );
     159             : 
     160             :     int GetCoilObjectTypeNum(EnergyPlusData &state,
     161             :                              std::string const &CoilType,         // must match coil types in this module
     162             :                              std::string const &CoilName,         // must match coil names for the coil type
     163             :                              bool &ErrorsFound,                   // set to true if problem
     164             :                              Optional_bool_const PrintWarning = _ // prints warning message if true
     165             :     );
     166             : 
     167             :     int GetCoilInletNode(EnergyPlusData &state,
     168             :                          std::string_view CoilType,   // must match coil types in this module
     169             :                          std::string const &CoilName, // must match coil names for the coil type
     170             :                          bool &ErrorsFound            // set to true if problem
     171             :     );
     172             : 
     173             :     int GetCoilWaterInletNode(EnergyPlusData &state,
     174             :                               std::string const &CoilType, // must match coil types in this module
     175             :                               std::string const &CoilName, // must match coil names for the coil type
     176             :                               bool &ErrorsFound            // set to true if problem
     177             :     );
     178             : 
     179             :     int GetCoilOutletNode(EnergyPlusData &state,
     180             :                           std::string_view CoilType,   // must match coil types in this module
     181             :                           std::string const &CoilName, // must match coil names for the coil type
     182             :                           bool &ErrorsFound            // set to true if problem
     183             :     );
     184             : 
     185             :     std::string GetHXDXCoilType(EnergyPlusData &state,
     186             :                                 std::string const &CoilType, // must match coil types in this module
     187             :                                 std::string const &CoilName, // must match coil names for the coil type
     188             :                                 bool &ErrorsFound            // set to true if problem
     189             :     );
     190             : 
     191             :     std::string GetHXDXCoilName(EnergyPlusData &state,
     192             :                                 std::string_view CoilType,   // must match coil types in this module
     193             :                                 std::string const &CoilName, // must match coil names for the coil type
     194             :                                 bool &ErrorsFound            // set to true if problem
     195             :     );
     196             : 
     197             :     int GetActualDXCoilIndex(EnergyPlusData &state,
     198             :                              std::string const &CoilType, // must match coil types in this module
     199             :                              std::string const &CoilName, // must match coil names for the coil type
     200             :                              bool &ErrorsFound            // set to true if problem
     201             :     );
     202             : 
     203             :     std::string GetHXCoilType(EnergyPlusData &state,
     204             :                               std::string const &CoilType, // must match coil types in this module
     205             :                               std::string const &CoilName, // must match coil names for the coil type
     206             :                               bool &ErrorsFound            // set to true if problem
     207             :     );
     208             : 
     209             :     void GetHXCoilTypeAndName(EnergyPlusData &state,
     210             :                               std::string const &CoilType,  // must match coil types in this module
     211             :                               std::string const &CoilName,  // must match coil names for the coil type
     212             :                               bool &ErrorsFound,            // set to true if problem
     213             :                               std::string &CoolingCoilType, // returned type of cooling coil
     214             :                               std::string &CoolingCoilName  // returned name of cooling coil
     215             :     );
     216             : 
     217             :     Real64 GetCoilMaxWaterFlowRate(EnergyPlusData &state,
     218             :                                    std::string_view CoilType,   // must match coil types in this module
     219             :                                    std::string const &CoilName, // must match coil names for the coil type
     220             :                                    bool &ErrorsFound            // set to true if problem
     221             :     );
     222             : 
     223             :     Real64 GetHXCoilAirFlowRate(EnergyPlusData &state,
     224             :                                 std::string const &CoilType, // must match coil types in this module
     225             :                                 std::string const &CoilName, // must match coil names for the coil type
     226             :                                 bool &ErrorsFound            // set to true if problem
     227             :     );
     228             : 
     229             :     bool VerifyHeatExchangerParent(EnergyPlusData &state,
     230             :                                    std::string const &HXType, // must match coil types in this module
     231             :                                    std::string const &HXName  // must match coil names for the coil type
     232             :     );
     233             : 
     234             : } // namespace HVACHXAssistedCoolingCoil
     235             : 
     236        1542 : struct HVACHXAssistedCoolingCoilData : BaseGlobalStruct
     237             : {
     238             :     int TotalNumHXAssistedCoils = 0;            // The total number of HXAssistedCoolingCoil compound objects
     239             :     Array1D<Real64> HXAssistedCoilOutletTemp;   // Outlet temperature from this compound object
     240             :     Array1D<Real64> HXAssistedCoilOutletHumRat; // Outlet humidity ratio from this compound object
     241             :     bool GetCoilsInputFlag = true;              // Flag to allow input data to be retrieved from idf on first call to this subroutine
     242             :     Array1D_bool CheckEquipName;
     243             :     Array1D<HVACHXAssistedCoolingCoil::HXAssistedCoilParameters> HXAssistedCoil;
     244             :     std::unordered_map<std::string, std::string> UniqueHXAssistedCoilNames;
     245             :     Real64 CoilOutputTempLast; // Exiting cooling coil temperature from last iteration
     246             :     int ErrCount = 0;
     247             :     int ErrCount2 = 0;
     248             : 
     249           0 :     void clear_state() override
     250             :     {
     251           0 :         this->TotalNumHXAssistedCoils = 0;
     252           0 :         this->HXAssistedCoilOutletTemp.clear();
     253           0 :         this->HXAssistedCoilOutletHumRat.clear();
     254           0 :         this->GetCoilsInputFlag = true;
     255           0 :         this->CheckEquipName.clear();
     256           0 :         this->HXAssistedCoil.clear();
     257           0 :         this->UniqueHXAssistedCoilNames.clear();
     258           0 :         this->ErrCount = 0;
     259           0 :         this->ErrCount2 = 0;
     260           0 :     }
     261             : };
     262             : 
     263             : } // namespace EnergyPlus
     264             : 
     265             : #endif

Generated by: LCOV version 1.13