LCOV - code coverage report
Current view: top level - EnergyPlus - HVACDXHeatPumpSystem.hh (source / functions) Hit Total Coverage
Test: lcov.output.filtered Lines: 6 38 15.8 %
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 HVACDXHeatPumpSystem_hh_INCLUDED
      49             : #define HVACDXHeatPumpSystem_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 HVACDXHeatPumpSystem {
      66             : 
      67             :     // MODULE PARAMETER DEFINITIONS
      68             :     constexpr Real64 MinAirMassFlow(0.001);
      69             : 
      70             :     // Types
      71           9 :     struct DXHeatPumpSystemStruct
      72             :     {
      73             :         // Members
      74             :         std::string DXHeatPumpSystemType; // Type of DXHeatingSystem
      75             :         std::string Name;                 // Name of the DXHeatingSystem
      76             :         int SchedPtr;
      77             :         std::string HeatPumpCoilType;
      78             :         int HeatPumpCoilType_Num;
      79             :         std::string HeatPumpCoilName;
      80             :         int HeatPumpCoilIndex;
      81             :         int DXHeatPumpCoilInletNodeNum;
      82             :         int DXHeatPumpCoilOutletNodeNum;
      83             :         int DXSystemControlNodeNum; // the node number of the node with the set point
      84             :         Real64 DesiredOutletTemp;   // the temperature at the unit outlet node needed
      85             :         // to meet the supply air set point.
      86             :         Real64 PartLoadFrac; // part load fraction for current time step (single speed)
      87             :         Real64 SpeedRatio;   // current compressor speed ratio (variable speed)
      88             :         Real64 CycRatio;     // cycling part load ratio (variable speed)
      89             :         int FanOpMode;       // Fan operating mode (see parameter above)
      90             :         // Warning message variables
      91             :         int DXCoilSensPLRIter;      // used in DXCoil calculations
      92             :         int DXCoilSensPLRIterIndex; // used in DXCoil calculations
      93             :         int DXCoilSensPLRFail;      // used in DXCoil calculations
      94             :         int DXCoilSensPLRFailIndex; // used in DXCoil calculations
      95             :         // When the Dx system is a part of Outdoor Air Unit
      96             :         Real64 OAUnitSetTemp; // set
      97             :         // variable-speed coil
      98             :         int SpeedNum; // select speed number for variable-speed coil
      99             :         // Fault model of coil SAT sensor
     100             :         bool FaultyCoilSATFlag;     // True if the coil has SAT sensor fault
     101             :         int FaultyCoilSATIndex;     // Index of the fault object corresponding to the coil
     102             :         Real64 FaultyCoilSATOffset; // Coil SAT sensor offset
     103             : 
     104             :         // Default Constructor
     105           3 :         DXHeatPumpSystemStruct()
     106           3 :             : SchedPtr(0), HeatPumpCoilType_Num(0), HeatPumpCoilIndex(0), DXHeatPumpCoilInletNodeNum(0), DXHeatPumpCoilOutletNodeNum(0),
     107             :               DXSystemControlNodeNum(0), DesiredOutletTemp(0.0), PartLoadFrac(0.0), SpeedRatio(0.0), CycRatio(0.0), FanOpMode(0),
     108             :               DXCoilSensPLRIter(0), DXCoilSensPLRIterIndex(0), DXCoilSensPLRFail(0), DXCoilSensPLRFailIndex(0), OAUnitSetTemp(0.0), SpeedNum(0),
     109           3 :               FaultyCoilSATFlag(false), FaultyCoilSATIndex(0), FaultyCoilSATOffset(0.0)
     110             :         {
     111           3 :         }
     112             :     };
     113             : 
     114             :     void SimDXHeatPumpSystem(EnergyPlusData &state,
     115             :                              std::string_view DXHeatPumpSystemName,     // Name of DXSystem:Airloop object
     116             :                              bool const FirstHVACIteration,             // True when first HVAC iteration
     117             :                              int const AirLoopNum,                      // Primary air loop number
     118             :                              int &CompIndex,                            // Index to CoilSystem:Heating:DX object
     119             :                              Optional_int_const OAUnitNum = _,          // If the system is an equipment of OutdoorAirUnit
     120             :                              Optional<Real64 const> OAUCoilOutTemp = _, // the coil inlet temperature of OutdoorAirUnit
     121             :                              Optional<Real64> QTotOut = _               // the total cooling output of unit
     122             :     );
     123             : 
     124             :     // Get Input Section of the Module
     125             :     //******************************************************************************
     126             : 
     127             :     void GetDXHeatPumpSystemInput(EnergyPlusData &state);
     128             : 
     129             :     // End of Get Input subroutines for the Module
     130             :     //******************************************************************************
     131             : 
     132             :     // Beginning of Initialization subroutines for the Module
     133             :     // *****************************************************************************
     134             : 
     135             :     void InitDXHeatPumpSystem(EnergyPlusData &state,
     136             :                               int const DXSystemNum,                    // number of the current DX Sys being simulated
     137             :                               int const AirLoopNum,                     // number of the current air loop being simulated
     138             :                               Optional_int_const OAUnitNum = _,         // number of the current outdoor air unit being simulated
     139             :                               Optional<Real64 const> OAUCoilOutTemp = _ // the coil inlet temperature of OutdoorAirUnit
     140             :     );
     141             : 
     142             :     // End of Initialization subroutines for the Module
     143             :     // *****************************************************************************
     144             : 
     145             :     // Beginning of Calculation subroutines for the DXCoolingSystem Module
     146             :     // *****************************************************************************
     147             : 
     148             :     void ControlDXHeatingSystem(EnergyPlusData &state,
     149             :                                 int const DXSystemNum,        // index to DXSystem
     150             :                                 bool const FirstHVACIteration // First HVAC iteration flag
     151             :     );
     152             : 
     153             :     Real64 VSCoilCyclingResidual(EnergyPlusData &state,
     154             :                                  Real64 PartLoadRatio, // compressor cycling ratio (1.0 is continuous, 0.0 is off)
     155             :                                  int CoilIndex,
     156             :                                  Real64 desiredTemp,
     157             :                                  int FanOpMode);
     158             : 
     159             :     //******************************************************************************
     160             : 
     161             :     Real64 VSCoilSpeedResidual(EnergyPlusData &state,
     162             :                                Real64 SpeedRatio, // compressor cycling ratio (1.0 is continuous, 0.0 is off)
     163             :                                int CoilIndex,
     164             :                                Real64 desiredTemp,
     165             :                                int speedNumber,
     166             :                                int FanOpMode);
     167             : 
     168             :     int GetHeatingCoilInletNodeNum(EnergyPlusData &state, std::string const &DXCoilSysName, bool &InletNodeErrFlag);
     169             : 
     170             :     int GetHeatingCoilOutletNodeNum(EnergyPlusData &state, std::string const &DXCoilSysName, bool &OutletNodeErrFlag);
     171             : 
     172             : } // namespace HVACDXHeatPumpSystem
     173             : 
     174        1542 : struct HVACDXHeatPumpSystemData : BaseGlobalStruct
     175             : {
     176             : 
     177             :     int NumDXHeatPumpSystems = 0; // The Number of DXHeatPumpSystems found in the Input
     178             :     bool EconomizerFlag = false;  // holds air loop economizer status
     179             :     bool GetInputFlag = true;     // Flag to get input only once
     180             :     Array1D_bool CheckEquipName;
     181             :     Array1D<HVACDXHeatPumpSystem::DXHeatPumpSystemStruct> DXHeatPumpSystem;
     182             : 
     183             :     Real64 QZnReq = 0.001;              // Zone load (W), input to variable-speed DX coil
     184             :     Real64 QLatReq = 0.0;               // Zone latent load, input to variable-speed DX coil
     185             :     Real64 MaxONOFFCyclesperHour = 4.0; // Maximum cycling rate of heat pump [cycles/hr]
     186             :     Real64 HPTimeConstant = 0.0;        // Heat pump time constant [s]
     187             :     Real64 FanDelayTime = 0.0;          // Fan delay time, time delay for the HP's fan to
     188             :     Real64 OnOffAirFlowRatio = 1.0;     // ratio of compressor on flow to average flow over time step
     189             :     bool ErrorsFound = false;           // If errors detected in input
     190             :     int TotalArgs = 0;                  // Total number of alpha and numeric arguments (max) for a certain object in the input file
     191             :     bool MySetPointCheckFlag = true;
     192             :     int SpeedNum = 1;                       // speed number of variable speed DX cooling coil
     193             :     Real64 QZnReqr = 0.001;                 // Zone load (W), input to variable-speed DX coil
     194             :     Real64 QLatReqr = 0.0;                  // Zone latent load, input to variable-speed DX coil
     195             :     Real64 MaximumONOFFCyclesperHour = 4.0; // Maximum cycling rate of heat pump [cycles/hr]
     196             :     Real64 TimeConstant = 0.0;              // Heat pump time constant [s]
     197             :     Real64 HeatPumpFanDelayTime = 0.0;      // Fan delay time, time delay for the HP's fan to
     198             :     Real64 OnandOffAirFlowRatio = 1.0;      // ratio of compressor on flow to average flow over time step
     199             :     Real64 SpeedRatio = 0.0;                // SpeedRatio varies between 1.0 (higher speed) and 0.0 (lower speed)
     200             :     int SpeedNumber = 1;                    // speed number of variable speed DX cooling coil
     201             :     Real64 QZoneReq = 0.001;                // Zone load (W), input to variable-speed DX coil
     202             :     Real64 QLatentReq = 0.0;                // Zone latent load, input to variable-speed DX coil
     203             :     Real64 MaxONOFFCyclesperHr = 4.0;       // Maximum cycling rate of heat pump [cycles/hr]
     204             :     Real64 HPTimeConst = 0.0;               // Heat pump time constant [s]
     205             :     Real64 HPFanDelayTime = 0.0;            // Fan delay time, time delay for the HP's fan to
     206             :     Real64 AirFlowOnOffRatio = 1.0;         // ratio of compressor on flow to average flow over time step
     207             :     Real64 SpeedPartLoadRatio = 1.0;        // SpeedRatio varies between 1.0 (higher speed) and 0.0 (lower speed)
     208             : 
     209           0 :     void clear_state() override
     210             :     {
     211           0 :         this->GetInputFlag = true;
     212           0 :         this->NumDXHeatPumpSystems = 0;
     213           0 :         this->EconomizerFlag = false;
     214           0 :         this->CheckEquipName.deallocate();
     215           0 :         this->DXHeatPumpSystem.deallocate();
     216           0 :         this->QZnReq = 0.001;
     217           0 :         this->QLatReq = 0.0;
     218           0 :         this->MaxONOFFCyclesperHour = 4.0;
     219           0 :         this->HPTimeConstant = 0.0;
     220           0 :         this->FanDelayTime = 0.0;
     221           0 :         this->OnOffAirFlowRatio = 1.0;
     222           0 :         this->ErrorsFound = false;
     223           0 :         this->TotalArgs = 0;
     224           0 :         this->MySetPointCheckFlag = true;
     225           0 :         this->SpeedNum = 1;
     226           0 :         this->QZnReq = 0.001;
     227           0 :         this->QLatReq = 0.0;
     228           0 :         this->MaxONOFFCyclesperHour = 4.0;
     229           0 :         this->HPTimeConstant = 0.0;
     230           0 :         this->FanDelayTime = 0.0;
     231           0 :         this->OnOffAirFlowRatio = 1.0;
     232           0 :         this->SpeedRatio = 0.0;
     233           0 :         this->SpeedNumber = 1;
     234           0 :         this->QZoneReq = 0.001;
     235           0 :         this->QLatentReq = 0.0;
     236           0 :         this->MaxONOFFCyclesperHr = 4.0;
     237           0 :         this->HPTimeConst = 0.0;
     238           0 :         this->HPFanDelayTime = 0.0;
     239           0 :         this->AirFlowOnOffRatio = 1.0;
     240           0 :         this->SpeedPartLoadRatio = 1.0;
     241           0 :     }
     242             : };
     243             : 
     244             : } // namespace EnergyPlus
     245             : 
     246             : #endif

Generated by: LCOV version 1.13