LCOV - code coverage report
Current view: top level - EnergyPlus - HVACSingleDuctInduc.hh (source / functions) Hit Total Coverage
Test: lcov.output.filtered Lines: 6 19 31.6 %
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 HVACSingleDuctInduc_hh_INCLUDED
      49             : #define HVACSingleDuctInduc_hh_INCLUDED
      50             : 
      51             : // ObjexxFCL Headers
      52             : #include <ObjexxFCL/Array1D.hh>
      53             : 
      54             : // EnergyPlus Headers
      55             : #include <EnergyPlus/Data/BaseData.hh>
      56             : #include <EnergyPlus/DataGlobals.hh>
      57             : #include <EnergyPlus/EnergyPlus.hh>
      58             : #include <EnergyPlus/Plant/Enums.hh>
      59             : 
      60             : namespace EnergyPlus {
      61             : 
      62             : // Forward declarations
      63             : struct EnergyPlusData;
      64             : 
      65             : namespace HVACSingleDuctInduc {
      66             : 
      67             :     enum class SingleDuct_CV
      68             :     {
      69             :         Invalid = -1,
      70             :         TwoPipeInduc,
      71             :         FourPipeInduc,
      72             :         Num
      73             :     };
      74             : 
      75          10 :     struct IndUnitData
      76             :     {
      77             :         // Members
      78             :         // input data
      79             :         std::string Name;           // name of unit
      80             :         std::string UnitType;       // type of unit
      81             :         SingleDuct_CV UnitType_Num; // index to type of unit
      82             :         std::string Sched;          // availability schedule
      83             :         int SchedPtr;               // index to schedule
      84             :         Real64 MaxTotAirVolFlow;    // m3/s (autosizable)
      85             :         Real64 MaxTotAirMassFlow;   // kg/s
      86             :         Real64 InducRatio;          // ratio of induced air flow to primary air flow
      87             :         int PriAirInNode;           // unit primary air inlet node number
      88             :         int SecAirInNode;           // unit induced air inlet node number
      89             :         int OutAirNode;             // unit air outlet node number
      90             :         int HWControlNode;          // hot water control node
      91             :         int CWControlNode;          // cold water control node
      92             :         std::string HCoilType;      // type of heating coil component
      93             :         std::string HCoil;          // name of heating coil component
      94             :         int HCoil_Num;              // index to this coil
      95             :         DataPlant::PlantEquipmentType HeatingCoilType;
      96             :         Real64 MaxVolHotWaterFlow; // m3/s (autosizable)
      97             :         Real64 MaxHotWaterFlow;    // kg/s
      98             :         Real64 MinVolHotWaterFlow; // m3/s
      99             :         Real64 MinHotWaterFlow;    // kg/s
     100             :         Real64 HotControlOffset;   // control tolerance
     101             :         PlantLocation HWPlantLoc;  // index for plant location for hot water coil
     102             :         int HWCoilFailNum1;        // index for errors
     103             :         int HWCoilFailNum2;        // index for errors
     104             :         std::string CCoilType;     // type of cooling coil component
     105             :         std::string CCoil;         // name of cooling coil component
     106             :         int CCoil_Num;             // index to this coil
     107             :         DataPlant::PlantEquipmentType CoolingCoilType;
     108             :         Real64 MaxVolColdWaterFlow; // m3/s (autosizable)
     109             :         Real64 MaxColdWaterFlow;    // kg/s
     110             :         Real64 MinVolColdWaterFlow; // m3/s
     111             :         Real64 MinColdWaterFlow;    // kg/s
     112             :         Real64 ColdControlOffset;   // control tolerance
     113             :         PlantLocation CWPlantLoc;   // index for plant component for chilled water coil
     114             :         int CWCoilFailNum1;         // index for errors
     115             :         int CWCoilFailNum2;         // index for errors
     116             :         std::string MixerName;      // name of air mixer component
     117             :         int Mixer_Num;              // index to this mixer
     118             :         Real64 MaxPriAirMassFlow;   // kg/s
     119             :         Real64 MaxSecAirMassFlow;   // kg/s
     120             :         int ADUNum;                 // index of corresponding air distribution unit
     121             :         Real64 DesCoolingLoad;      // used for reporting during coil sizing
     122             :         Real64 DesHeatingLoad;      // used for reporting during coil sizing
     123             :         int CtrlZoneNum;            // Pointer to CtrlZone data structure
     124             :         int CtrlZoneInNodeIndex;    // which controlled zone inlet node number corresponds with this unit
     125             :         int AirLoopNum;             // index to airloop that this terminal unit is connected to
     126             :         Real64 OutdoorAirFlowRate;  // zone outdoor air volume flow rate
     127             : 
     128             :         // Default Constructor
     129           2 :         IndUnitData()
     130           2 :             : UnitType_Num(SingleDuct_CV::Invalid), SchedPtr(0), MaxTotAirVolFlow(0.0), MaxTotAirMassFlow(0.0), InducRatio(2.5), PriAirInNode(0),
     131             :               SecAirInNode(0), OutAirNode(0), HWControlNode(0), CWControlNode(0), HCoil_Num(0),
     132             :               HeatingCoilType(DataPlant::PlantEquipmentType::Invalid), MaxVolHotWaterFlow(0.0), MaxHotWaterFlow(0.0), MinVolHotWaterFlow(0.0),
     133             :               MinHotWaterFlow(0.0), HotControlOffset(0.0), HWPlantLoc{}, HWCoilFailNum1(0), HWCoilFailNum2(0), CCoil_Num(0),
     134             :               CoolingCoilType(DataPlant::PlantEquipmentType::Invalid), MaxVolColdWaterFlow(0.0), MaxColdWaterFlow(0.0), MinVolColdWaterFlow(0.0),
     135             :               MinColdWaterFlow(0.0), ColdControlOffset(0.0), CWPlantLoc{}, CWCoilFailNum1(0), CWCoilFailNum2(0), Mixer_Num(0), MaxPriAirMassFlow(0.0),
     136             :               MaxSecAirMassFlow(0.0), ADUNum(0), DesCoolingLoad(0.0), DesHeatingLoad(0.0), CtrlZoneNum(0), CtrlZoneInNodeIndex(0), AirLoopNum(0),
     137           2 :               OutdoorAirFlowRate(0.0)
     138             :         {
     139           2 :         }
     140             :         void ReportIndUnit(EnergyPlusData &state);
     141             :         void CalcOutdoorAirVolumeFlowRate(EnergyPlusData &state);
     142             :     };
     143             : 
     144             :     void SimIndUnit(EnergyPlusData &state,
     145             :                     std::string_view CompName,     // name of the terminal unit
     146             :                     bool const FirstHVACIteration, // TRUE if first HVAC iteration in time step
     147             :                     int const ZoneNum,             // index of zone served by the terminal unit
     148             :                     int const ZoneNodeNum,         // zone node number of zone served by the terminal unit
     149             :                     int &CompIndex                 // which terminal unit in data structure
     150             :     );
     151             : 
     152             :     void GetIndUnits(EnergyPlusData &state);
     153             : 
     154             :     void InitIndUnit(EnergyPlusData &state,
     155             :                      int const IUNum,              // number of the current induction unit being simulated
     156             :                      bool const FirstHVACIteration // TRUE if first air loop solution this HVAC step
     157             :     );
     158             : 
     159             :     void SizeIndUnit(EnergyPlusData &state, int const IUNum);
     160             : 
     161             :     void SimFourPipeIndUnit(EnergyPlusData &state,
     162             :                             int const IUNum,              // number of the current unit being simulated
     163             :                             int const ZoneNum,            // number of zone being served
     164             :                             int const ZoneNodeNum,        // zone node number
     165             :                             bool const FirstHVACIteration // TRUE if 1st HVAC simulation of system timestep
     166             :     );
     167             : 
     168             :     void CalcFourPipeIndUnit(EnergyPlusData &state,
     169             :                              int const IUNum,               // Unit index
     170             :                              bool const FirstHVACIteration, // flag for 1st HVAV iteration in the time step
     171             :                              int const ZoneNode,            // zone node number
     172             :                              Real64 const HWFlow,           // hot water flow (kg/s)
     173             :                              Real64 const CWFlow,           // cold water flow (kg/s)
     174             :                              Real64 &LoadMet                // load met by unit (watts)
     175             :     );
     176             : 
     177             :     bool FourPipeInductionUnitHasMixer(EnergyPlusData &state, std::string_view CompName); // component (mixer) name
     178             : 
     179             : } // namespace HVACSingleDuctInduc
     180             : 
     181        1542 : struct HVACSingleDuctInducData : BaseGlobalStruct
     182             : {
     183             :     int NumIndUnits = 0;
     184             :     int NumFourPipes = 0;
     185             :     Array1D_bool CheckEquipName;
     186             :     bool GetIUInputFlag = true; // First time, input is "gotten"
     187             :     bool MyOneTimeFlag = true;
     188             :     Array1D_bool MyEnvrnFlag;
     189             :     Array1D_bool MySizeFlag;
     190             :     Array1D_bool MyPlantScanFlag;
     191             :     Array1D_bool MyAirDistInitFlag;
     192             :     Array1D<HVACSingleDuctInduc::IndUnitData> IndUnit;
     193             :     bool ZoneEquipmentListChecked = false;
     194             : 
     195           0 :     void clear_state() override
     196             :     {
     197           0 :         this->NumIndUnits = 0;
     198           0 :         this->IndUnit.deallocate();
     199           0 :         this->GetIUInputFlag = true;
     200           0 :         this->NumFourPipes = 0;
     201           0 :         this->MyOneTimeFlag = true;
     202           0 :         this->MyEnvrnFlag.deallocate();
     203           0 :         this->MySizeFlag.deallocate();
     204           0 :         this->MyPlantScanFlag.deallocate();
     205           0 :         this->MyAirDistInitFlag.deallocate();
     206           0 :         this->CheckEquipName.deallocate();
     207           0 :         this->ZoneEquipmentListChecked = false;
     208           0 :     }
     209             : };
     210             : 
     211             : } // namespace EnergyPlus
     212             : 
     213             : #endif

Generated by: LCOV version 1.13