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

Generated by: LCOV version 1.14