LCOV - code coverage report
Current view: top level - EnergyPlus - HVACStandAloneERV.hh (source / functions) Hit Total Coverage
Test: lcov.output.filtered Lines: 6 22 27.3 %
Date: 2023-01-17 19:17:23 Functions: 6 8 75.0 %

          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 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         251 :     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             :         int HeatExchangerTypeNum;       // 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             :         int SupplyAirFanType_Num;       // 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             :         int ExhaustAirFanType_Num;      // 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             :         int AvailStatus;
     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         112 :             : SchedPtr(0), HeatExchangerIndex(0), HeatExchangerTypeNum(0), SupplyAirInletNode(0), SupplyAirOutletNode(0), SupplyAirFanIndex(0),
     131             :               SupplyAirFanSchPtr(0), SupplyAirFanType_Num(0), ExhaustAirInletNode(0), ExhaustAirOutletNode(0), ExhaustAirFanIndex(0),
     132             :               ExhaustAirFanSchPtr(0), ExhaustAirFanType_Num(0), SupplyAirVolFlow(0.0), ExhaustAirVolFlow(0.0), ControllerNameDefined(false),
     133             :               ControlledZoneNum(0), ControllerIndex(0), MaxSupAirMassFlow(0.0), MaxExhAirMassFlow(0.0), HighRHOAFlowRatio(1.0),
     134             :               DesignSAFanVolFlowRate(0.0), DesignEAFanVolFlowRate(0.0), DesignHXVolFlowRate(0.0), DesignSAFanMassFlowRate(0.0),
     135             :               DesignEAFanMassFlowRate(0.0), AirVolFlowPerFloorArea(0.0), AirVolFlowPerOccupant(0.0), EconomizerOASchedPtr(0), FlowError(true),
     136             :               AvailStatus(0), ElecUseRate(0.0), ElecUseEnergy(0.0), SensCoolingEnergy(0.0), SensCoolingRate(0.0), LatCoolingEnergy(0.0),
     137             :               LatCoolingRate(0.0), TotCoolingEnergy(0.0), TotCoolingRate(0.0), SensHeatingEnergy(0.0), SensHeatingRate(0.0), LatHeatingEnergy(0.0),
     138         112 :               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 GetSupplyAirInletNode(EnergyPlusData &state,
     182             :                               std::string const &ERVType,     // must be "ZoneHVAC:EnergyRecoveryVentilator"
     183             :                               std::string const &ERVCtrlName, // must match a controller name in the ERV data structure
     184             :                               bool &ErrorsFound               // set to true if problem
     185             :     );
     186             : 
     187             :     int GetExhaustAirInletNode(EnergyPlusData &state,
     188             :                                std::string const &ERVType,     // must be "ZoneHVAC:EnergyRecoveryVentilator"
     189             :                                std::string const &ERVCtrlName, // must match a controller name in the ERV data structure
     190             :                                bool &ErrorsFound               // set to true if problem
     191             :     );
     192             : 
     193             :     int GetStandAloneERVOutAirNode(EnergyPlusData &state, int StandAloneERVNum);
     194             : 
     195             :     int GetStandAloneERVZoneInletAirNode(EnergyPlusData &state, int StandAloneERVNum);
     196             : 
     197             :     int GetStandAloneERVReturnAirNode(EnergyPlusData &state, int StandAloneERVNum);
     198             : 
     199             :     bool GetStandAloneERVNodeNumber(EnergyPlusData &state, int NodeNumber);
     200             : 
     201             : } // namespace HVACStandAloneERV
     202             : 
     203        1542 : struct HVACStandAloneERVData : BaseGlobalStruct
     204             : {
     205             : 
     206             :     int NumStandAloneERVs = 0;
     207             :     Array1D_bool MySizeFlag;
     208             :     Array1D_bool CheckEquipName;
     209             :     bool GetERVInputFlag = true;
     210             :     EPVector<HVACStandAloneERV::StandAloneERVData> StandAloneERV;
     211             :     std::unordered_set<std::string> HeatExchangerUniqueNames;
     212             :     std::unordered_set<std::string> SupplyAirFanUniqueNames;
     213             :     std::unordered_set<std::string> ExhaustAirFanUniqueNames;
     214             :     std::unordered_set<std::string> ControllerUniqueNames;
     215             :     Array1D_bool MySizeFlag_InitStandAloneERV;
     216             :     bool MyOneTimeFlag = true;
     217             :     Array1D_bool MyEnvrnFlag;
     218             :     Array1D_bool MyZoneEqFlag;             // used to set up zone equipment availability managers
     219             :     bool ZoneEquipmentListChecked = false; // True after the Zone Equipment List has been checked for items
     220             : 
     221           0 :     void clear_state() override
     222             :     {
     223           0 :         NumStandAloneERVs = 0;
     224           0 :         GetERVInputFlag = true;
     225           0 :         MySizeFlag.deallocate();
     226           0 :         CheckEquipName.deallocate();
     227           0 :         StandAloneERV.deallocate();
     228           0 :         HeatExchangerUniqueNames.clear();
     229           0 :         SupplyAirFanUniqueNames.clear();
     230           0 :         ExhaustAirFanUniqueNames.clear();
     231           0 :         ControllerUniqueNames.clear();
     232           0 :         MySizeFlag_InitStandAloneERV.deallocate();
     233           0 :         MyOneTimeFlag = true;
     234           0 :         MyEnvrnFlag.deallocate();
     235           0 :         MyZoneEqFlag.deallocate();
     236           0 :         ZoneEquipmentListChecked = false;
     237           0 :     }
     238             : };
     239             : 
     240             : } // namespace EnergyPlus
     241             : 
     242             : #endif

Generated by: LCOV version 1.13