LCOV - code coverage report
Current view: top level - EnergyPlus - PoweredInductionUnits.hh (source / functions) Hit Total Coverage
Test: lcov.output.filtered Lines: 6 20 30.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 PoweredInductionUnits_hh_INCLUDED
      49             : #define PoweredInductionUnits_hh_INCLUDED
      50             : 
      51             : // ObjexxFCL Headers
      52             : #include <ObjexxFCL/Array1D.hh>
      53             : 
      54             : // EnergyPlus Headers
      55             : #include <EnergyPlus/Data/BaseData.hh>
      56             : #include <EnergyPlus/DataDefineEquip.hh>
      57             : #include <EnergyPlus/DataGlobals.hh>
      58             : #include <EnergyPlus/EnergyPlus.hh>
      59             : #include <EnergyPlus/Plant/Enums.hh>
      60             : #include <EnergyPlus/Plant/PlantLocation.hh>
      61             : 
      62             : namespace EnergyPlus {
      63             : 
      64             : // Forward declarations
      65             : struct EnergyPlusData;
      66             : 
      67             : namespace PoweredInductionUnits {
      68             : 
      69             :     // Using/Aliasing
      70             : 
      71             :     // Data
      72             :     // MODULE PARAMETER DEFINITIONS
      73             :     // coil types in this module
      74             :     enum class HtgCoilType
      75             :     {
      76             :         Invalid = -1,
      77             :         Gas,
      78             :         Electric,
      79             :         SimpleHeating,
      80             :         SteamAirHeating,
      81             :         Num
      82             :     };
      83             : 
      84             :     static constexpr std::array<std::string_view, static_cast<int>(HtgCoilType::Num)> HCoilNamesUC{
      85             :         "COIL:HEATING:FUEL", "COIL:HEATING:ELECTRIC", "COIL:HEATING:WATER", "COIL:HEATING:STEAM"};
      86             : 
      87             :     static constexpr std::array<std::string_view, static_cast<int>(HtgCoilType::Num)> HCoilNames{
      88             :         "Coil:Heating:Fuel", "Coil:Heating:Electric", "Coil:Heating:Water", "Coil:Heating:Steam"};
      89             : 
      90          83 :     struct PowIndUnitData
      91             :     {
      92             :         // Members
      93             :         // input data
      94             :         std::string Name;                                 // name of unit
      95             :         std::string UnitType;                             // type of unit
      96             :         DataDefineEquip::ZnAirLoopEquipType UnitType_Num; // index for type of unit
      97             :         std::string Sched;                                // availability schedule
      98             :         int SchedPtr;                                     // index to schedule
      99             :         Real64 MaxTotAirVolFlow;                          // m3/s  (series)
     100             :         Real64 MaxTotAirMassFlow;                         // kg/s  (series)
     101             :         Real64 MaxPriAirVolFlow;                          // m3/s
     102             :         Real64 MaxPriAirMassFlow;                         // kg/s
     103             :         Real64 MinPriAirFlowFrac;                         // minimum primary air flow fraction
     104             :         Real64 MinPriAirMassFlow;                         // kg/s
     105             :         Real64 PriDamperPosition;                         // primary air damper position
     106             :         Real64 MaxSecAirVolFlow;                          // m3/s (parallel)
     107             :         Real64 MaxSecAirMassFlow;                         // kg/s (parallel)
     108             :         Real64 FanOnFlowFrac;                             // frac of primary air flow at which fan turns on (parallel)
     109             :         Real64 FanOnAirMassFlow;                          // primary air mass flow rate at which fan turns on (parallel)
     110             :         int PriAirInNode;                                 // unit primary air inlet node number
     111             :         int SecAirInNode;                                 // unit secondary air inlet node number
     112             :         int OutAirNode;                                   // unit air outlet node number
     113             :         int HCoilInAirNode;                               // unit mixed air node number
     114             :         int ControlCompTypeNum;
     115             :         int CompErrIndex;
     116             :         std::string MixerName; // name of air mixer component
     117             :         int Mixer_Num;         // index for type of mixer
     118             :         std::string FanName;   // name of fan component
     119             :         int Fan_Num;           // index for fan type
     120             :         int Fan_Index;         // store index for this fan
     121             :         int FanAvailSchedPtr;  // index to fan availability schedule
     122             :         HtgCoilType HCoilType; // index for heating coil type
     123             :         DataPlant::PlantEquipmentType HCoil_PlantType;
     124             :         std::string HCoil; // name of heating coil component
     125             :         int HCoil_Index;   // index to this heating coil
     126             :         int HCoil_FluidIndex;
     127             :         Real64 MaxVolHotWaterFlow; // m3/s
     128             :         Real64 MaxVolHotSteamFlow; // m3/s
     129             :         Real64 MaxHotWaterFlow;    // kg/s
     130             :         Real64 MaxHotSteamFlow;    // kg/s
     131             :         Real64 MinVolHotWaterFlow; // m3/s
     132             :         Real64 MinHotSteamFlow;    // kg/s
     133             :         Real64 MinVolHotSteamFlow; // m3/s
     134             :         Real64 MinHotWaterFlow;    // kg/s
     135             :         int HotControlNode;        // hot water control node
     136             :         int HotCoilOutNodeNum;     // outlet of coil
     137             :         Real64 HotControlOffset;   // control tolerance
     138             :         PlantLocation HWplantLoc;  // index for plant component for hot plant coil
     139             :         int ADUNum;                // index of corresponding air distribution unit
     140             :         bool InducesPlenumAir;     // True if secondary air comes from the plenum
     141             :         // Report data
     142             :         Real64 HeatingRate;        // unit heat addition rate to zone [W]
     143             :         Real64 HeatingEnergy;      // unit heat addition to zone [J]
     144             :         Real64 SensCoolRate;       // unit sensible heat removal rate from zone [W]
     145             :         Real64 SensCoolEnergy;     // unit sensible heat removal from zone [J]
     146             :         int CtrlZoneNum;           // index to control zone
     147             :         int ctrlZoneInNodeIndex;   // index to the control zone inlet node
     148             :         int AirLoopNum;            // index for the air loop that this terminal is connected to.
     149             :         Real64 OutdoorAirFlowRate; // zone outdoor air volume flow rate
     150             : 
     151             :         // Default Constructor
     152          15 :         PowIndUnitData()
     153          15 :             : UnitType_Num(DataDefineEquip::ZnAirLoopEquipType::Invalid), SchedPtr(0), MaxTotAirVolFlow(0.0), MaxTotAirMassFlow(0.0),
     154             :               MaxPriAirVolFlow(0.0), MaxPriAirMassFlow(0.0), MinPriAirFlowFrac(0.0), MinPriAirMassFlow(0.0), PriDamperPosition(0.0),
     155             :               MaxSecAirVolFlow(0.0), MaxSecAirMassFlow(0.0), FanOnFlowFrac(0.0), FanOnAirMassFlow(0.0), PriAirInNode(0), SecAirInNode(0),
     156             :               OutAirNode(0), HCoilInAirNode(0), ControlCompTypeNum(0), CompErrIndex(0), Mixer_Num(0), Fan_Num(0), Fan_Index(0), FanAvailSchedPtr(0),
     157             :               HCoilType(HtgCoilType::Invalid), HCoil_PlantType(DataPlant::PlantEquipmentType::Invalid), HCoil_Index(0), HCoil_FluidIndex(0),
     158             :               MaxVolHotWaterFlow(0.0), MaxVolHotSteamFlow(0.0), MaxHotWaterFlow(0.0), MaxHotSteamFlow(0.0), MinVolHotWaterFlow(0.0),
     159             :               MinHotSteamFlow(0.0), MinVolHotSteamFlow(0.0), MinHotWaterFlow(0.0), HotControlNode(0), HotCoilOutNodeNum(0),
     160             :               HotControlOffset(0.0), HWplantLoc{}, ADUNum(0), InducesPlenumAir(false), HeatingRate(0.0), HeatingEnergy(0.0), SensCoolRate(0.0),
     161          15 :               SensCoolEnergy(0.0), CtrlZoneNum(0), ctrlZoneInNodeIndex(0), AirLoopNum(0), OutdoorAirFlowRate(0.0)
     162             :         {
     163          15 :         }
     164             : 
     165             :         void CalcOutdoorAirVolumeFlowRate(EnergyPlusData &state);
     166             :     };
     167             : 
     168             :     void SimPIU(EnergyPlusData &state,
     169             :                 std::string_view CompName, // name of the PIU
     170             :                 bool FirstHVACIteration,   // TRUE if first HVAC iteration in time step
     171             :                 int ZoneNum,               // index of zone served by PIU
     172             :                 int ZoneNodeNum,           // zone node number of zone served by PIU
     173             :                 int &CompIndex             // PIU Index in PIU names
     174             :     );
     175             : 
     176             :     void GetPIUs(EnergyPlusData &state);
     177             : 
     178             :     void InitPIU(EnergyPlusData &state,
     179             :                  int PIUNum,             // number of the current fan coil unit being simulated
     180             :                  bool FirstHVACIteration // TRUE if first zone equip this HVAC step
     181             :     );
     182             : 
     183             :     void SizePIU(EnergyPlusData &state, int PIUNum);
     184             : 
     185             :     void CalcSeriesPIU(EnergyPlusData &state,
     186             :                        int PIUNum,             // number of the current PIU being simulated
     187             :                        int ZoneNum,            // number of zone being served
     188             :                        int ZoneNode,           // zone node number
     189             :                        bool FirstHVACIteration // TRUE if 1st HVAC simulation of system timestep
     190             :     );
     191             : 
     192             :     void CalcParallelPIU(EnergyPlusData &state,
     193             :                          int PIUNum,             // number of the current PIU being simulated
     194             :                          int ZoneNum,            // number of zone being served
     195             :                          int ZoneNode,           // zone node number
     196             :                          bool FirstHVACIteration // TRUE if 1st HVAC simulation of system timestep
     197             :     );
     198             : 
     199             :     void ReportPIU(EnergyPlusData &state, int PIUNum); // number of the current fan coil unit being simulated
     200             : 
     201             :     // ===================== Utilities =====================================
     202             : 
     203             :     bool PIUnitHasMixer(EnergyPlusData &state, std::string_view CompName); // component (mixer) name
     204             : 
     205             :     void PIUInducesPlenumAir(EnergyPlusData &state, int NodeNum); // induced air node number
     206             : 
     207             : } // namespace PoweredInductionUnits
     208             : 
     209        1542 : struct PoweredInductionUnitsData : BaseGlobalStruct
     210             : {
     211             : 
     212             :     Array1D_bool CheckEquipName;
     213             :     bool GetPIUInputFlag = true;
     214             :     bool MyOneTimeFlag = true;
     215             :     bool ZoneEquipmentListChecked = false;
     216             :     int NumPIUs = 0;
     217             :     int NumSeriesPIUs = 0;
     218             :     int NumParallelPIUs = 0;
     219             :     Array1D<PoweredInductionUnits::PowIndUnitData> PIU;
     220             :     std::unordered_map<std::string, std::string> PiuUniqueNames;
     221             :     Array1D_bool MyEnvrnFlag;
     222             :     Array1D_bool MySizeFlag;
     223             :     Array1D_bool MyPlantScanFlag;
     224             : 
     225           0 :     void clear_state() override
     226             :     {
     227           0 :         this->CheckEquipName.deallocate();
     228           0 :         this->GetPIUInputFlag = true;
     229           0 :         this->MyOneTimeFlag = true;
     230           0 :         this->ZoneEquipmentListChecked = false;
     231           0 :         this->NumPIUs = 0;
     232           0 :         this->NumSeriesPIUs = 0;
     233           0 :         this->NumParallelPIUs = 0;
     234           0 :         this->PIU.deallocate();
     235           0 :         this->PiuUniqueNames.clear();
     236           0 :         this->MyEnvrnFlag.clear();
     237           0 :         this->MySizeFlag.clear();
     238           0 :         this->MyPlantScanFlag.clear();
     239           0 :     }
     240             : };
     241             : 
     242             : } // namespace EnergyPlus
     243             : 
     244             : #endif

Generated by: LCOV version 1.13