LCOV - code coverage report
Current view: top level - EnergyPlus - Humidifiers.hh (source / functions) Hit Total Coverage
Test: lcov.output.filtered Lines: 6 15 40.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 Humidifiers_hh_INCLUDED
      49             : #define Humidifiers_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             : 
      59             : namespace EnergyPlus {
      60             : 
      61             : // Forward declarations
      62             : struct EnergyPlusData;
      63             : 
      64             : namespace Humidifiers {
      65             : 
      66             :     static constexpr std::array<std::string_view, 2> HumidifierType = {"Humidifier:Steam:Electric", "Humidifier:Steam:Gas"};
      67             :     constexpr std::string_view fluidNameSteam = "STEAM";
      68             :     constexpr std::string_view fluidNameWater = "WATER";
      69             : 
      70             :     enum class HumidType
      71             :     {
      72             :         Invalid = -1,
      73             :         Electric,
      74             :         Gas,
      75             :         Num
      76             :     };
      77             : 
      78             :     enum class InletWaterTemp
      79             :     {
      80             :         Invalid = -1,
      81             :         Fixed,
      82             :         Variable,
      83             :         Num
      84             :     };
      85             : 
      86          95 :     class HumidifierData
      87             :     {
      88             :     private:
      89             :     public:
      90             :         // Members
      91             :         std::string Name;                    // unique name of component
      92             :         HumidType HumType;                   // Pointer to Humidifier in list of humidifiers
      93             :         int EquipIndex;                      // Pointer to Humidifier in list of humidifiers
      94             :         std::string Sched;                   // name of availability schedule
      95             :         int SchedPtr;                        // index of availability schedule
      96             :         Real64 NomCapVol;                    // nominal capacity [m3/s of water]
      97             :         Real64 NomCap;                       // nominal capacity [kg/s of water]
      98             :         Real64 NomPower;                     // power consumption at full output [watts]
      99             :         Real64 ThermalEffRated;              // rated thermal efficiency of the gas fired humidifier [-]
     100             :         Real64 CurMakeupWaterTemp;           // makeup water temperature from main water [C]
     101             :         int EfficiencyCurvePtr;              // index to efficiency curve
     102             :         InletWaterTemp InletWaterTempOption; // type inlet water temperature fixed or variable
     103             :         Real64 FanPower;                     // nominal fan power [watts]
     104             :         Real64 StandbyPower;                 // standby power consumption [watts]
     105             :         int AirInNode;                       // air inlet node of humidifier
     106             :         int AirOutNode;                      // air outlet node of humidifier
     107             :         Real64 AirInTemp;                    // inlet air temperature [C]
     108             :         Real64 AirInHumRat;                  // inlet air humidity ratio [kg water / kg air]
     109             :         Real64 AirInEnthalpy;                // inlet air specific enthalpy [J/kg]
     110             :         Real64 AirInMassFlowRate;            // inlet air mass flow rate [kg/s]
     111             :         Real64 AirOutTemp;                   // outlet air temperature [C]
     112             :         Real64 AirOutHumRat;                 // outlet air humidity ratio [kg water / kg air]
     113             :         Real64 AirOutEnthalpy;               // outlet air specific enthalpy [J/kg]
     114             :         Real64 AirOutMassFlowRate;           // outlet air mass flow rate [kg/s]
     115             :         Real64 HumRatSet;                    // humidity ratio setpoint [kg water / kg air]
     116             :         Real64 WaterAdd;                     // water output (and consumption) [kg/s]
     117             :         Real64 ElecUseEnergy;                // electricity consumption [J]
     118             :         Real64 ElecUseRate;                  // electricity consumption [W]
     119             :         Real64 WaterCons;                    // water consumption in cubic meters
     120             :         Real64 WaterConsRate;                // water consumption rate in m3/s
     121             :         bool SuppliedByWaterSystem;          // true means there is storage tank, otherwise mains
     122             :         int WaterTankID;                     // index pointer to water storage tank
     123             :         int WaterTankDemandARRID;            // index pointer to WaterStorage Demand arrays.
     124             :         Real64 TankSupplyVdot;
     125             :         Real64 TankSupplyVol;
     126             :         Real64 StarvedSupplyVdot;
     127             :         Real64 StarvedSupplyVol;
     128             :         int TankSupplyID; // index pointer to WaterStorage supply arrays.
     129             :         bool MySizeFlag;
     130             :         bool MyEnvrnFlag;
     131             :         bool MySetPointCheckFlag;
     132             :         // report variables for gas humidifier
     133             :         Real64 ThermalEff;       // current actual thermal efficiency gas humidifier [-]
     134             :         Real64 GasUseRate;       // gas consumption rate [W]
     135             :         Real64 GasUseEnergy;     // gas energy consumption [J]
     136             :         Real64 AuxElecUseRate;   // auxiliary electric power input [W]
     137             :         Real64 AuxElecUseEnergy; //  auxiliary electric energy consumption [J]'
     138             : 
     139             :         // Default Constructor
     140          23 :         HumidifierData()
     141          23 :             : HumType(HumidType::Invalid), EquipIndex(0), SchedPtr(0), NomCapVol(0.0), NomCap(0.0), NomPower(0.0), ThermalEffRated(1.0),
     142             :               CurMakeupWaterTemp(0.0), EfficiencyCurvePtr(0), InletWaterTempOption(InletWaterTemp::Invalid), FanPower(0.0), StandbyPower(0.0),
     143             :               AirInNode(0), AirOutNode(0), AirInTemp(0.0), AirInHumRat(0.0), AirInEnthalpy(0.0), AirInMassFlowRate(0.0), AirOutTemp(0.0),
     144             :               AirOutHumRat(0.0), AirOutEnthalpy(0.0), AirOutMassFlowRate(0.0), HumRatSet(0.0), WaterAdd(0.0), ElecUseEnergy(0.0), ElecUseRate(0.0),
     145             :               WaterCons(0.0), WaterConsRate(0.0), SuppliedByWaterSystem(false), WaterTankID(0), WaterTankDemandARRID(0), TankSupplyVdot(0.0),
     146             :               TankSupplyVol(0.0), StarvedSupplyVdot(0.0), StarvedSupplyVol(0.0), TankSupplyID(0), MySizeFlag(true), MyEnvrnFlag(true),
     147          23 :               MySetPointCheckFlag(true), ThermalEff(0.0), GasUseRate(0.0), GasUseEnergy(0.0), AuxElecUseRate(0.0), AuxElecUseEnergy(0.0)
     148             :         {
     149          23 :         }
     150             : 
     151             :         void InitHumidifier(EnergyPlusData &state); // number of the current humidifier being simulated
     152             : 
     153             :         void SizeHumidifier(EnergyPlusData &state); // number of the current humidifier being sized
     154             : 
     155             :         void ControlHumidifier(EnergyPlusData &state,
     156             :                                Real64 &WaterAddNeeded // moisture addition rate needed to meet minimum humidity ratio setpoint [kg/s]
     157             :         );
     158             : 
     159             :         void CalcElecSteamHumidifier(EnergyPlusData &state, Real64 const WaterAddNeeded // moisture addition rate set by controller [kg/s]
     160             :         );
     161             : 
     162             :         void CalcGasSteamHumidifier(EnergyPlusData &state, Real64 const WaterAddNeeded // moisture addition rate set by controller [kg/s]
     163             :         );
     164             : 
     165             :         void UpdateReportWaterSystem(EnergyPlusData &state); // number of the current humidifier being simulated
     166             : 
     167             :         void UpdateHumidifier(EnergyPlusData &state); // number of the current humidifier being simulated
     168             : 
     169             :         void ReportHumidifier(EnergyPlusData &state); // number of the current humidifier being simulated
     170             :     };
     171             : 
     172             :     void SimHumidifier(EnergyPlusData &state,
     173             :                        std::string_view CompName,     // name of the humidifier unit
     174             :                        bool const FirstHVACIteration, // TRUE if 1st HVAC simulation of system timestep
     175             :                        int &CompIndex                 // Pointer to Humidifier Unit
     176             :     );
     177             : 
     178             :     void GetHumidifierInput(EnergyPlusData &state);
     179             : 
     180             :     int GetAirInletNodeNum(EnergyPlusData &state, std::string const &HumidifierName, bool &ErrorsFound);
     181             : 
     182             :     int GetAirOutletNodeNum(EnergyPlusData &state, std::string const &HumidifierName, bool &ErrorsFound);
     183             : 
     184             : } // namespace Humidifiers
     185             : 
     186        1542 : struct HumidifiersData : BaseGlobalStruct
     187             : {
     188             :     int NumHumidifiers = 0;   // number of humidifiers of all types
     189             :     int NumElecSteamHums = 0; // number of electric steam humidifiers
     190             :     int NumGasSteamHums = 0;  // number of electric steam humidifiers
     191             :     Array1D_bool CheckEquipName;
     192             :     bool GetInputFlag = true; // moved up from a static function variable
     193             : 
     194             :     // Object Data
     195             :     Array1D<Humidifiers::HumidifierData> Humidifier;
     196             :     std::unordered_map<std::string, std::string> HumidifierUniqueNames;
     197             : 
     198           0 :     void clear_state() override
     199             :     {
     200           0 :         this->NumHumidifiers = 0;
     201           0 :         this->NumElecSteamHums = 0;
     202           0 :         this->NumGasSteamHums = 0;
     203           0 :         this->CheckEquipName.clear();
     204           0 :         this->GetInputFlag = true;
     205           0 :         this->Humidifier.clear();
     206           0 :         this->HumidifierUniqueNames.clear();
     207           0 :     }
     208             : };
     209             : 
     210             : } // namespace EnergyPlus
     211             : 
     212             : #endif

Generated by: LCOV version 1.13