LCOV - code coverage report
Current view: top level - EnergyPlus - HVACStandAloneERV.hh (source / functions) Hit Total Coverage
Test: lcov.output.filtered Lines: 13 29 44.8 %
Date: 2024-08-24 18:31:18 Functions: 2 3 66.7 %

          Line data    Source code
       1             : // EnergyPlus, Copyright (c) 1996-2024, 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 HVACStandAloneERV_hh_INCLUDED
      49             : #define HVACStandAloneERV_hh_INCLUDED
      50             : 
      51             : // C++ Headers
      52             : #include <unordered_set>
      53             : 
      54             : // ObjexxFCL Headers
      55             : #include <ObjexxFCL/Array1D.hh>
      56             : 
      57             : // EnergyPlus Headers
      58             : #include <EnergyPlus/Data/BaseData.hh>
      59             : #include <EnergyPlus/DataGlobals.hh>
      60             : #include <EnergyPlus/EnergyPlus.hh>
      61             : 
      62             : namespace EnergyPlus {
      63             : 
      64             : // Forward declarations
      65             : struct EnergyPlusData;
      66             : 
      67             : namespace HVACStandAloneERV {
      68             : 
      69             :     struct StandAloneERVData
      70             :     {
      71             :         // Members
      72             :         // input data
      73             :         std::string Name;                            // name of the stand alone ERV unit
      74             :         std::string UnitType;                        // ZoneHVAC:EnergyRecoveryVentilator
      75             :         int SchedPtr;                                // pointer to availability schedule
      76             :         std::string HeatExchangerName;               // name of the heat exchanger within the ERV unit
      77             :         int HeatExchangerIndex;                      // Pointer to heat exchanger
      78             :         HVAC::HXType hxType = HVAC::HXType::Invalid; // Parameter equivalent of HX object type
      79             :         int SupplyAirInletNode;                      // supply air inlet node for the stand alone ERV
      80             :         int SupplyAirOutletNode;                     // supply air outlet node for the stand alone ERV
      81             :         std::string SupplyAirFanName;                // fan name in the supply air stream of the ERV
      82             :         int SupplyAirFanIndex;                       // index to supply air fan
      83             :         int SupplyAirFanSchPtr;                      // index to supply air fan schedule
      84             :         HVAC::FanType supplyAirFanType;              // parameter equivalent of fan type
      85             :         int ExhaustAirInletNode;                     // exhaust air inlet node for the stand alone ERV
      86             :         int ExhaustAirOutletNode;                    // exhaust air outlet node for the stand alone ERV
      87             :         std::string ExhaustAirFanName;               // fan name in exhaust air stream of the ERV
      88             :         int ExhaustAirFanIndex;                      // index to exhaust air fan
      89             :         int ExhaustAirFanSchPtr;                     // index to exhaust air fan schedule
      90             :         HVAC::FanType exhaustAirFanType;             // paramter equivalent of fan type
      91             :         Real64 SupplyAirVolFlow;                     // volumetric flow rate through the supply side of the ERV
      92             :         Real64 ExhaustAirVolFlow;                    // volumetric flow rate through the exhaust side of the ERV
      93             :         std::string ControllerName;                  // name of the controller for the stand alone ERV
      94             :         bool ControllerNameDefined;                  // controller for the stand alone ERV is defined
      95             :         int ControlledZoneNum;                       // index to controlled zone for stand alone ERV
      96             :         int ControllerIndex;                         // Pointer for updates by routines this module calls.
      97             :         Real64 MaxSupAirMassFlow;                    // air mass flow rate through the supply side of the ERV
      98             :         Real64 MaxExhAirMassFlow;                    // air mass flow rate through the exhaust side of the ERV
      99             :         Real64 HighRHOAFlowRatio;                    // ratio of outside air flow to max outside air flow
     100             :         Real64 DesignSAFanVolFlowRate;               // SA fan volumetric flow rate
     101             :         Real64 DesignEAFanVolFlowRate;               // EA fan volumetric flow rate
     102             :         Real64 DesignHXVolFlowRate;                  // HX (heat exchanger) volumetric flow rate
     103             :         Real64 DesignSAFanMassFlowRate;              // SA fan mass flow rate
     104             :         Real64 DesignEAFanMassFlowRate;              // EA fan mass flow rate
     105             :         Real64 AirVolFlowPerFloorArea;               // Air flow rate per unit floor area, used for autosizing
     106             :         Real64 AirVolFlowPerOccupant;                // Air flow rate per occupant, used for autosizing
     107             :         int EconomizerOASchedPtr;                    // schedule to modify outdoor air
     108             :         bool FlowError;                              // used for one-time warning message for flow imbalance (Init)
     109             :         Avail::Status availStatus = Avail::Status::NoAction;
     110             :         std::string AvailManagerListName; // Name of an availability manager list object
     111             :         // report variables
     112             :         Real64 ElecUseRate;       // total electric use rate (power) for supply/exhaust fans & generic HX parasitics [W]
     113             :         Real64 ElecUseEnergy;     // electric energy use for supply fan, exhaust fan, and generic HX parasitics [J]
     114             :         Real64 SensCoolingEnergy; // sensible cooling energy delivered by the ERV supply air to the zone [J]
     115             :         Real64 SensCoolingRate;   // rate of sensible cooling delivered to the zone [W]
     116             :         Real64 LatCoolingEnergy;  // latent cooling energy delivered by the ERV supply air to the zone [J]
     117             :         Real64 LatCoolingRate;    // rate of latent cooling delivered to the zone [W]
     118             :         Real64 TotCoolingEnergy;  // total cooling energy delivered by the ERV supply air to the zone [J]
     119             :         Real64 TotCoolingRate;    // rate of total cooling delivered to the zone [W]
     120             :         Real64 SensHeatingEnergy; // sensible heating energy delivered by the ERV supply air to the zone [J]
     121             :         Real64 SensHeatingRate;   // rate of sensible heating delivered to the zone [W]
     122             :         Real64 LatHeatingEnergy;  // latent heating energy delivered by the ERV supply air to the zone [J]
     123             :         Real64 LatHeatingRate;    // rate of latent heating delivered to the zone [W]
     124             :         Real64 TotHeatingEnergy;  // total heating energy delivered by the ERV supply air to the zone [J]
     125             :         Real64 TotHeatingRate;    // rate of total heating delivered to the zone [W]
     126             :         bool FirstPass;           // detects first time through for resetting sizing data
     127             : 
     128             :         // Default Constructor
     129         112 :         StandAloneERVData()
     130         448 :             : SchedPtr(0), HeatExchangerIndex(0), SupplyAirInletNode(0), SupplyAirOutletNode(0), SupplyAirFanIndex(0), SupplyAirFanSchPtr(0),
     131         224 :               supplyAirFanType(HVAC::FanType::Invalid), ExhaustAirInletNode(0), ExhaustAirOutletNode(0), ExhaustAirFanIndex(0),
     132         112 :               ExhaustAirFanSchPtr(0), exhaustAirFanType(HVAC::FanType::Invalid), SupplyAirVolFlow(0.0), ExhaustAirVolFlow(0.0),
     133         112 :               ControllerNameDefined(false), ControlledZoneNum(0), ControllerIndex(0), MaxSupAirMassFlow(0.0), MaxExhAirMassFlow(0.0),
     134         112 :               HighRHOAFlowRatio(1.0), DesignSAFanVolFlowRate(0.0), DesignEAFanVolFlowRate(0.0), DesignHXVolFlowRate(0.0),
     135         112 :               DesignSAFanMassFlowRate(0.0), DesignEAFanMassFlowRate(0.0), AirVolFlowPerFloorArea(0.0), AirVolFlowPerOccupant(0.0),
     136         224 :               EconomizerOASchedPtr(0), FlowError(true), ElecUseRate(0.0), ElecUseEnergy(0.0), SensCoolingEnergy(0.0), SensCoolingRate(0.0),
     137         112 :               LatCoolingEnergy(0.0), LatCoolingRate(0.0), TotCoolingEnergy(0.0), TotCoolingRate(0.0), SensHeatingEnergy(0.0), SensHeatingRate(0.0),
     138         112 :               LatHeatingEnergy(0.0), LatHeatingRate(0.0), TotHeatingEnergy(0.0), TotHeatingRate(0.0), FirstPass(true)
     139             :         {
     140         112 :         }
     141             :     };
     142             : 
     143             :     void SimStandAloneERV(EnergyPlusData &state,
     144             :                           std::string_view CompName, // name of the Stand Alone ERV unit
     145             :                           int ZoneNum,               // number of zone being served unused1208
     146             :                           bool FirstHVACIteration,   // TRUE if 1st HVAC simulation of system timestep
     147             :                           Real64 &SensLoadMet,       // net sensible load supplied by the ERV unit to the zone (W)
     148             :                           Real64 &LatLoadMet,        // net latent load supplied by ERV unit to the zone (kg/s),
     149             :                           int &CompIndex             // pointer to correct component
     150             :     );
     151             : 
     152             :     void GetStandAloneERV(EnergyPlusData &state);
     153             : 
     154             :     void InitStandAloneERV(EnergyPlusData &state,
     155             :                            int StandAloneERVNum,   // number of the current Stand Alone ERV unit being simulated
     156             :                            int ZoneNum,            // number of zone being served unused1208
     157             :                            bool FirstHVACIteration // TRUE if first HVAC iteration
     158             :     );
     159             : 
     160             :     void SizeStandAloneERV(EnergyPlusData &state, int StandAloneERVNum);
     161             : 
     162             :     void CalcStandAloneERV(EnergyPlusData &state,
     163             :                            int StandAloneERVNum,     // Unit index in ERV data structure
     164             :                            bool FirstHVACIteration,  // flag for 1st HVAC iteration in the time step
     165             :                            Real64 &SensLoadMet,      // sensible zone load met by unit (W)
     166             :                            Real64 &LatentMassLoadMet // latent zone load met by unit (kg/s), dehumid = negative
     167             :     );
     168             : 
     169             :     void ReportStandAloneERV(EnergyPlusData &state, int StandAloneERVNum); // number of the current Stand Alone ERV being simulated
     170             : 
     171             :     //        End of Reporting subroutines for the Module
     172             : 
     173             :     //        Utility subroutines/functions for the HeatingCoil Module
     174             : 
     175             :     Real64 GetSupplyAirFlowRate(EnergyPlusData &state,
     176             :                                 std::string const &ERVType,     // must be "ZoneHVAC:EnergyRecoveryVentilator"
     177             :                                 std::string const &ERVCtrlName, // must match a controller name in the ERV data structure
     178             :                                 bool &ErrorsFound               // set to true if problem
     179             :     );
     180             : 
     181             :     int GetStandAloneERVOutAirNode(EnergyPlusData &state, int StandAloneERVNum);
     182             : 
     183             :     int GetStandAloneERVZoneInletAirNode(EnergyPlusData &state, int StandAloneERVNum);
     184             : 
     185             :     int GetStandAloneERVReturnAirNode(EnergyPlusData &state, int StandAloneERVNum);
     186             : 
     187             :     bool GetStandAloneERVNodeNumber(EnergyPlusData &state, int NodeNumber);
     188             : 
     189             :     int getEqIndex(EnergyPlusData &state, std::string_view CompName);
     190             : 
     191             : } // namespace HVACStandAloneERV
     192             : 
     193             : struct HVACStandAloneERVData : BaseGlobalStruct
     194             : {
     195             : 
     196             :     int NumStandAloneERVs = 0;
     197             :     Array1D_bool MySizeFlag;
     198             :     Array1D_bool CheckEquipName;
     199             :     bool GetERVInputFlag = true;
     200             :     EPVector<HVACStandAloneERV::StandAloneERVData> StandAloneERV;
     201             :     std::unordered_set<std::string> HeatExchangerUniqueNames;
     202             :     std::unordered_set<std::string> SupplyAirFanUniqueNames;
     203             :     std::unordered_set<std::string> ExhaustAirFanUniqueNames;
     204             :     std::unordered_set<std::string> ControllerUniqueNames;
     205             :     Array1D_bool MySizeFlag_InitStandAloneERV;
     206             :     bool MyOneTimeFlag = true;
     207             :     Array1D_bool MyEnvrnFlag;
     208             :     Array1D_bool MyZoneEqFlag;             // used to set up zone equipment availability managers
     209             :     bool ZoneEquipmentListChecked = false; // True after the Zone Equipment List has been checked for items
     210             : 
     211         796 :     void init_state([[maybe_unused]] EnergyPlusData &state) override
     212             :     {
     213         796 :     }
     214             : 
     215           0 :     void clear_state() override
     216             :     {
     217           0 :         NumStandAloneERVs = 0;
     218           0 :         GetERVInputFlag = true;
     219           0 :         MySizeFlag.deallocate();
     220           0 :         CheckEquipName.deallocate();
     221           0 :         StandAloneERV.deallocate();
     222           0 :         HeatExchangerUniqueNames.clear();
     223           0 :         SupplyAirFanUniqueNames.clear();
     224           0 :         ExhaustAirFanUniqueNames.clear();
     225           0 :         ControllerUniqueNames.clear();
     226           0 :         MySizeFlag_InitStandAloneERV.deallocate();
     227           0 :         MyOneTimeFlag = true;
     228           0 :         MyEnvrnFlag.deallocate();
     229           0 :         MyZoneEqFlag.deallocate();
     230           0 :         ZoneEquipmentListChecked = false;
     231           0 :     }
     232             : };
     233             : 
     234             : } // namespace EnergyPlus
     235             : 
     236             : #endif

Generated by: LCOV version 1.14