LCOV - code coverage report
Current view: top level - EnergyPlus - IntegratedHeatPump.hh (source / functions) Hit Total Coverage
Test: lcov.output.filtered Lines: 6 10 60.0 %
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 IntegratedHeatPump_hh_INCLUDED
      49             : #define IntegratedHeatPump_hh_INCLUDED
      50             : 
      51             : // ObjexxFCL Headers
      52             : #include <ObjexxFCL/Array1D.fwd.hh>
      53             : #include <ObjexxFCL/Optional.fwd.hh>
      54             : 
      55             : // EnergyPlus Headers
      56             : #include <EnergyPlus/Data/BaseData.hh>
      57             : #include <EnergyPlus/DataHVACGlobals.hh>
      58             : #include <EnergyPlus/DataLoopNode.hh>
      59             : #include <EnergyPlus/EPVector.hh>
      60             : #include <EnergyPlus/EnergyPlus.hh>
      61             : #include <EnergyPlus/Plant/Enums.hh>
      62             : 
      63             : namespace EnergyPlus {
      64             : 
      65             : // Forward declarations
      66             : struct EnergyPlusData;
      67             : 
      68             : namespace IntegratedHeatPump {
      69             : 
      70             :     // operation mode
      71             :     enum class IHPOperationMode : int
      72             :     {
      73             :         Invalid = -1,
      74             :         Idle,
      75             :         SpaceClg,          // Space Cooling
      76             :         SpaceHtg,          // Space Heating
      77             :         DedicatedWaterHtg, // Dedicated Water Heating
      78             :         SCWHMatchSC,       // Space Cooling Water Heating
      79             :         SCWHMatchWH,
      80             :         SpaceClgDedicatedWaterHtg,
      81             :         SHDWHElecHeatOff,
      82             :         SHDWHElecHeatOn,
      83             :         Num
      84             :     };
      85             : 
      86           3 :     struct IntegratedHeatPumpData // variable speed coil
      87             :     {
      88             :         // Members
      89             :         std::string Name;    // Name of the  Coil
      90             :         std::string IHPtype; // type of coil
      91             : 
      92             :         std::string SCCoilType; // Numeric Equivalent for SC Coil Type
      93             :         std::string SCCoilName;
      94             :         int SCCoilIndex; // Index to SC coil
      95             :         DataLoopNode::ConnectionObjectType SCCoilTypeNum = DataLoopNode::ConnectionObjectType::Invalid;
      96             : 
      97             :         std::string SHCoilType; // Numeric Equivalent for SH Coil Type
      98             :         std::string SHCoilName;
      99             :         int SHCoilIndex; // Index to SH coil
     100             :         DataLoopNode::ConnectionObjectType SHCoilTypeNum = DataLoopNode::ConnectionObjectType::Invalid;
     101             : 
     102             :         std::string SCWHCoilType; // Numeric Equivalent for SCWH Coil Type
     103             :         std::string SCWHCoilName;
     104             :         int SCWHCoilIndex; // Index to SCWH coil
     105             :         DataLoopNode::ConnectionObjectType SCWHCoilTypeNum = DataLoopNode::ConnectionObjectType::Invalid;
     106             : 
     107             :         std::string DWHCoilType; // Numeric Equivalent for DWH Coil Type
     108             :         std::string DWHCoilName;
     109             :         int DWHCoilIndex; // Index to DWH coil
     110             :         DataLoopNode::ConnectionObjectType DWHCoilTypeNum = DataLoopNode::ConnectionObjectType::Invalid;
     111             : 
     112             :         std::string SCDWHCoolCoilType; // Numeric Equivalent for SCDWH Coil Type, cooling part
     113             :         std::string SCDWHCoolCoilName;
     114             :         int SCDWHCoolCoilIndex; // Index to SCDWH coil, cooling part
     115             :         DataLoopNode::ConnectionObjectType SCDWHCoolCoilTypeNum = DataLoopNode::ConnectionObjectType::Invalid;
     116             : 
     117             :         std::string SCDWHWHCoilType; // Numeric Equivalent for SCDWH Coil Type, water heating part
     118             :         std::string SCDWHWHCoilName;
     119             :         int SCDWHWHCoilIndex; // Index to SCDWH coil, water heating part
     120             :         DataLoopNode::ConnectionObjectType SCDWHWHCoilTypeNum = DataLoopNode::ConnectionObjectType::Invalid;
     121             : 
     122             :         std::string SHDWHHeatCoilType; // Numeric Equivalent for SHDWH Coil Type, heating part
     123             :         std::string SHDWHHeatCoilName;
     124             :         int SHDWHHeatCoilIndex; // Index to SHDWH coil, heating part
     125             :         DataLoopNode::ConnectionObjectType SHDWHHeatCoilTypeNum = DataLoopNode::ConnectionObjectType::Invalid;
     126             : 
     127             :         std::string SHDWHWHCoilType; // Numeric Equivalent for SHDWH Coil Type, water heating part
     128             :         std::string SHDWHWHCoilName;
     129             :         int SHDWHWHCoilIndex; // Index to SHDWH coil, water heating part
     130             :         DataLoopNode::ConnectionObjectType SHDWHWHCoilTypeNum = DataLoopNode::ConnectionObjectType::Invalid;
     131             : 
     132             :         int AirCoolInletNodeNum; // Node Number of the Air cooling coil Inlet
     133             :         int AirHeatInletNodeNum; // Node Number of the Air cooling coil Inlet
     134             :         int AirOutletNodeNum;    // Node Number of the Air Outlet
     135             :         int WaterInletNodeNum;   // Node Number of the Water Onlet
     136             :         int WaterOutletNodeNum;  // Node Number of the Water Outlet
     137             :         int WaterTankoutNod;     // water node to monitor the supply water flow amount
     138             : 
     139             :         int ModeMatchSCWH;
     140             :         //- 0: match cooling load, 1 : match water heating load in SCWH mode
     141             :         int MinSpedSCWH;  //-minimum speed level for SCWH mode
     142             :         int MinSpedSCDWH; //- minimum speed level for SCDWH mode
     143             :         int MinSpedSHDWH;
     144             :         //- minimum speed level for SHDWH mode
     145             :         Real64 TindoorOverCoolAllow;   //- [C], indoor temperature above which indoor overcooling is allowed
     146             :         Real64 TambientOverCoolAllow;  //- [C], ambient temperature above which indoor overcooling is allowed
     147             :         Real64 TindoorWHHighPriority;  //- [C], indoor temperature above which water heating has the higher priority
     148             :         Real64 TambientWHHighPriority; // ambient temperature above which water heating has the higher priority
     149             : 
     150             :         Real64 WaterVolSCDWH;
     151             :         // limit of water volume before switching from SCDWH to SCWH
     152             :         Real64 TimeLimitSHDWH; // time limit before turning from SHDWH to electric heating
     153             : 
     154             :         DataPlant::PlantEquipmentType WHtankType;
     155             :         std::string WHtankName;
     156             :         int WHtankID;
     157             :         int LoopNum;
     158             :         int LoopSideNum;
     159             :         bool IsWHCallAvail;
     160             :         // whether water heating call available
     161             :         bool CheckWHCall;
     162             :         IHPOperationMode CurMode; // current working mode
     163             :         Real64 ControlledZoneTemp;
     164             :         Real64 WaterFlowAccumVol;
     165             :         // water flow accumulated volume
     166             :         Real64 SHDWHRunTime;
     167             :         Real64 CoolVolFlowScale;
     168             :         // max fan cooling volumetric flow rate
     169             :         Real64 HeatVolFlowScale;
     170             :         // max fan heating volumetric flow rate
     171             :         Real64 MaxHeatAirMassFlow;
     172             :         // maximum air mass flow rate for heating mode
     173             :         Real64 MaxHeatAirVolFlow;
     174             :         // maximum air volume flow rate for heating mode
     175             :         Real64 MaxCoolAirMassFlow;
     176             :         // maximum air mass flow rate for heating mode
     177             :         Real64 MaxCoolAirVolFlow;
     178             :         // maximum air volume flow rate for heating mode
     179             :         bool IHPCoilsSized; // whether IHP coils have been sized
     180             : 
     181             :         std::string IDFanName;
     182             :         // IHP indoor fan name
     183             :         int IDFanID;
     184             :         // IHP indoor fan index
     185             :         int IDFanPlace; // indoor fan placement
     186             : 
     187             :         int ODAirInletNodeNum;  // oudoor coil inlet Nod
     188             :         int ODAirOutletNodeNum; // oudoor coil outlet Nod
     189             :         Real64 TankSourceWaterMassFlowRate;
     190             :         // tank source water flow rate
     191             :         Real64 AirFlowSavInWaterLoop; // air flow saving for SCWH mode
     192             :         Real64 AirFlowSavInAirLoop;   // air flow saving for SCWH mode
     193             : 
     194             :         // new output variables
     195             :         Real64 AirLoopFlowRate;
     196             :         // air loop mass flow rate [kg/s]
     197             :         Real64 TotalCoolingRate;
     198             :         // total cooling rate [w]
     199             :         Real64 TotalWaterHeatingRate;
     200             :         // total water heating rate [w]
     201             :         Real64 TotalSpaceHeatingRate;
     202             :         // total space heating rate [w]
     203             :         Real64 TotalPower;
     204             :         // total power consumption  [w]
     205             :         Real64 TotalLatentLoad;
     206             :         // total latent cooling rate [w]
     207             :         Real64 Qsource;
     208             :         // source energy rate, [w]
     209             :         Real64 Energy;
     210             :         // total electric energy consumption [J]
     211             :         Real64 EnergyLoadTotalCooling;
     212             :         // total cooling energy [J]
     213             :         Real64 EnergyLoadTotalHeating;
     214             :         // total heating energy [J]
     215             :         Real64 EnergyLoadTotalWaterHeating;
     216             :         // total heating energy [J]
     217             :         Real64 EnergyLatent; // total latent energy [J]
     218             :         Real64 EnergySource;
     219             :         // total source energy
     220             :         Real64 TotalCOP; // total COP
     221             : 
     222             :         // Default Constructor
     223           2 :         IntegratedHeatPumpData()
     224           2 :             : SCCoilIndex(0), SHCoilIndex(0), SCWHCoilIndex(0), DWHCoilIndex(0), SCDWHCoolCoilIndex(0), SCDWHWHCoilIndex(0), SHDWHHeatCoilIndex(0),
     225             :               SHDWHWHCoilIndex(0), AirCoolInletNodeNum(0), AirHeatInletNodeNum(0), AirOutletNodeNum(0), WaterInletNodeNum(0), WaterOutletNodeNum(0),
     226             :               WaterTankoutNod(0), ModeMatchSCWH(0), MinSpedSCWH(1), MinSpedSCDWH(1), MinSpedSHDWH(1), TindoorOverCoolAllow(0.0),
     227             :               TambientOverCoolAllow(0.0), TindoorWHHighPriority(0.0), TambientWHHighPriority(0.0), WaterVolSCDWH(0.0), TimeLimitSHDWH(0.0),
     228             :               WHtankType(DataPlant::PlantEquipmentType::Invalid), WHtankID(0), LoopNum(0), LoopSideNum(0), IsWHCallAvail(false), CheckWHCall(false),
     229             :               CurMode(IHPOperationMode::Idle), ControlledZoneTemp(0), WaterFlowAccumVol(0), SHDWHRunTime(0), CoolVolFlowScale(0), HeatVolFlowScale(0),
     230             :               MaxHeatAirMassFlow(0), MaxHeatAirVolFlow(0), MaxCoolAirMassFlow(0), MaxCoolAirVolFlow(0), IHPCoilsSized(false), IDFanID(0),
     231             :               IDFanPlace(0), ODAirInletNodeNum(0),                                                                    // oudoor coil inlet Nod
     232             :               ODAirOutletNodeNum(0),                                                                                  // oudoor coil outlet Nod
     233             :               TankSourceWaterMassFlowRate(0), AirFlowSavInWaterLoop(0), AirFlowSavInAirLoop(0), AirLoopFlowRate(0.0), // air loop mass flow rate
     234             :               TotalCoolingRate(0.0),                                                                                  // total cooling rate [w]
     235             :               TotalWaterHeatingRate(0.0),                                                                             // total water heating rate [w]
     236             :               TotalSpaceHeatingRate(0.0),                                                                             // total space heating rate [w]
     237             :               TotalPower(0.0),                                                                                        // total power consumption  [w]
     238             :               TotalLatentLoad(0),                                                                                     // total latent cooling rate [w]
     239             :               Qsource(0.0),                                                                                           // source energy rate, [w]
     240             :               Energy(0.0),                      // total electric energy consumption [J]
     241             :               EnergyLoadTotalCooling(0.0),      // total cooling energy [J]
     242             :               EnergyLoadTotalHeating(0.0),      // total heating energy [J]
     243             :               EnergyLoadTotalWaterHeating(0.0), // total heating energy [J]
     244             :               EnergyLatent(0.0),                // total latent energy [J]
     245             :               EnergySource(0.0),                // total source energy
     246           2 :               TotalCOP(0.0)                     // total COP
     247             :         {
     248           2 :         }
     249             :     };
     250             : 
     251             :     void SimIHP(EnergyPlusData &state,
     252             :                 std::string_view CompName,                         // Coil Name
     253             :                 int &CompIndex,                                    // Index for Component name
     254             :                 int const CyclingScheme,                           // Continuous fan OR cycling compressor
     255             :                 Real64 &MaxONOFFCyclesperHour,                     // Maximum cycling rate of heat pump [cycles/hr]
     256             :                 Real64 &HPTimeConstant,                            // Heat pump time constant [s]
     257             :                 Real64 &FanDelayTime,                              // Fan delay time, time delay for the HP's fan to
     258             :                 DataHVACGlobals::CompressorOperation CompressorOp, // compressor on/off. 0 = off; 1= on
     259             :                 Real64 const PartLoadFrac,
     260             :                 int const SpeedNum,                        // compressor speed number
     261             :                 Real64 const SpeedRatio,                   // compressor speed ratio
     262             :                 Real64 const SensLoad,                     // Sensible demand load [W]
     263             :                 Real64 const LatentLoad,                   // Latent demand load [W]
     264             :                 bool const IsCallbyWH,                     // whether the call from the water heating loop or air loop, true = from water heating loop
     265             :                 bool const FirstHVACIteration,             // TRUE if First iteration of simulation
     266             :                 Optional<Real64 const> OnOffAirFlowRat = _ // ratio of comp on to comp off air flow rate
     267             :     );
     268             : 
     269             :     void GetIHPInput(EnergyPlusData &state);
     270             : 
     271             :     void SizeIHP(EnergyPlusData &state, int const CoilNum);
     272             : 
     273             :     void InitializeIHP(EnergyPlusData &state, int const DXCoilNum);
     274             : 
     275             :     void UpdateIHP(EnergyPlusData &state, int const DXCoilNum);
     276             : 
     277             :     void DecideWorkMode(EnergyPlusData &state,
     278             :                         int const DXCoilNum,
     279             :                         Real64 const SensLoad,  // Sensible demand load [W]
     280             :                         Real64 const LatentLoad // Latent demand load [W]
     281             :     );
     282             : 
     283             :     IHPOperationMode GetCurWorkMode(EnergyPlusData &state, int const DXCoilNum);
     284             : 
     285             :     int GetLowSpeedNumIHP(EnergyPlusData &state, int const DXCoilNum);
     286             : 
     287             :     int GetMaxSpeedNumIHP(EnergyPlusData &state, int const DXCoilNum);
     288             : 
     289             :     Real64 GetAirVolFlowRateIHP(EnergyPlusData &state,
     290             :                                 int const DXCoilNum,
     291             :                                 int const SpeedNum,
     292             :                                 Real64 const SpeedRatio,
     293             :                                 bool const IsCallbyWH // whether the call from the water heating loop or air loop, true = from water heating loop
     294             :     );
     295             : 
     296             :     Real64 GetWaterVolFlowRateIHP(EnergyPlusData &state, int const DXCoilNum, int const SpeedNum, Real64 const SpeedRatio);
     297             : 
     298             :     Real64 GetAirMassFlowRateIHP(EnergyPlusData &state,
     299             :                                  int const DXCoilNum,
     300             :                                  int const SpeedNum,
     301             :                                  Real64 const SpeedRatio,
     302             :                                  bool const IsCallbyWH // whether the call from the water heating loop or air loop, true = from water heating loop
     303             :     );
     304             : 
     305             :     bool IHPInModel(EnergyPlusData &state);
     306             : 
     307             :     int GetCoilIndexIHP(EnergyPlusData &state,
     308             :                         std::string const &CoilType, // must match coil types in this module
     309             :                         std::string const &CoilName, // must match coil names for the coil type
     310             :                         bool &ErrorsFound            // set to true if problem
     311             :     );
     312             : 
     313             :     int GetCoilInletNodeIHP(EnergyPlusData &state,
     314             :                             std::string const &CoilType, // must match coil types in this module
     315             :                             std::string const &CoilName, // must match coil names for the coil type
     316             :                             bool &ErrorsFound            // set to true if problem
     317             :     );
     318             : 
     319             :     int GetDWHCoilInletNodeIHP(EnergyPlusData &state,
     320             :                                std::string const &CoilType, // must match coil types in this module
     321             :                                std::string const &CoilName, // must match coil names for the coil type
     322             :                                bool &ErrorsFound            // set to true if problem
     323             :     );
     324             : 
     325             :     int GetDWHCoilOutletNodeIHP(EnergyPlusData &state,
     326             :                                 std::string const &CoilType, // must match coil types in this module
     327             :                                 std::string const &CoilName, // must match coil names for the coil type
     328             :                                 bool &ErrorsFound            // set to true if problem
     329             :     );
     330             : 
     331             :     Real64 GetDWHCoilCapacityIHP(EnergyPlusData &state,
     332             :                                  std::string const &CoilType, // must match coil types in this module
     333             :                                  std::string const &CoilName, // must match coil names for the coil type
     334             :                                  IHPOperationMode const Mode, // mode coil type
     335             :                                  bool &ErrorsFound            // set to true if problem
     336             :     );
     337             : 
     338             :     int GetIHPDWHCoilPLFFPLR(EnergyPlusData &state,
     339             :                              std::string const &CoilType, // must match coil types in this module
     340             :                              std::string const &CoilName, // must match coil names for the coil type
     341             :                              IHPOperationMode const Mode, // mode coil type
     342             :                              bool &ErrorsFound            // set to true if problem
     343             :     );
     344             : 
     345             :     void ClearCoils(EnergyPlusData &state, int const DXCoilNum // coil ID
     346             :     );
     347             : 
     348             : } // namespace IntegratedHeatPump
     349             : 
     350        1542 : struct IntegratedHeatPumpGlobalData : BaseGlobalStruct
     351             : {
     352             : 
     353             :     bool GetCoilsInputFlag = true;
     354             :     EPVector<IntegratedHeatPump::IntegratedHeatPumpData> IntegratedHeatPumps;
     355             : 
     356           0 :     void clear_state() override
     357             :     {
     358           0 :         this->GetCoilsInputFlag = true;
     359           0 :         this->IntegratedHeatPumps.deallocate();
     360           0 :     }
     361             : };
     362             : 
     363             : } // namespace EnergyPlus
     364             : 
     365             : #endif

Generated by: LCOV version 1.13