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

          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 SteamCoils_hh_INCLUDED
      49             : #define SteamCoils_hh_INCLUDED
      50             : 
      51             : // ObjexxFCL Headers
      52             : #include <ObjexxFCL/Array1D.hh>
      53             : #include <ObjexxFCL/Optional.hh>
      54             : 
      55             : // EnergyPlus Headers
      56             : #include <EnergyPlus/Data/BaseData.hh>
      57             : #include <EnergyPlus/DataGlobals.hh>
      58             : #include <EnergyPlus/EnergyPlus.hh>
      59             : 
      60             : namespace EnergyPlus {
      61             : 
      62             : // Forward declarations
      63             : struct EnergyPlusData;
      64             : 
      65             : namespace SteamCoils {
      66             : 
      67             :     enum class CoilControlType
      68             :     {
      69             :         Invalid = -1,
      70             :         TemperatureSetPoint,
      71             :         ZoneLoadControl,
      72             :         Num
      73             :     };
      74             :     extern const std::array<std::string_view, static_cast<int>(CoilControlType::Num)> coilControlTypeNames;
      75             : 
      76          34 :     struct SteamCoilEquipConditions
      77             :     {
      78             :         // Members
      79             :         std::string Name;                 // Name of the SteamCoil
      80             :         std::string SteamCoilTypeA;       // Type of SteamCoil ie. Heating or Cooling
      81             :         int SteamCoilType;                // Type of SteamCoil ie. Heating or Cooling
      82             :         int SteamCoilModel;               // Type of SteamCoil ie. Simple, Detailed, etc.
      83             :         std::string Schedule;             // SteamCoil Operation Schedule
      84             :         int SchedPtr;                     // Pointer to the correct schedule
      85             :         Real64 InletAirMassFlowRate;      // MassFlow through the SteamCoil being Simulated [kg/s]
      86             :         Real64 OutletAirMassFlowRate;     // MassFlow throught the SteamCoil being Simulated[kg/s]
      87             :         Real64 InletAirTemp;              // Inlet Air Temperature Operating Condition [C]
      88             :         Real64 OutletAirTemp;             // Outlet Air Temperature Operating Condition [C]
      89             :         Real64 InletAirHumRat;            // Inlet Air Humidity Ratio Operating Condition
      90             :         Real64 OutletAirHumRat;           // Outlet Air Humidity Ratio Calculated Condition
      91             :         Real64 InletAirEnthalpy;          // Inlet Air enthalpy [J/kg]
      92             :         Real64 OutletAirEnthalpy;         // Outlet Air enthalpy [J/kg]
      93             :         Real64 TotSteamCoilLoad;          // Total Load on the Coil [W]
      94             :         Real64 SenSteamCoilLoad;          // Sensible Load on the Coil [W]
      95             :         Real64 TotSteamHeatingCoilEnergy; // Total Heating Coil energy of the Coil [J]
      96             :         Real64 TotSteamCoolingCoilEnergy; // Total Cooling Coil energy of the Coil [J]
      97             :         Real64 SenSteamCoolingCoilEnergy; // Sensible Cooling Coil energy of the Coil [J]
      98             :         Real64 TotSteamHeatingCoilRate;   // Total Heating Coil Rate on the Coil [W]
      99             :         Real64 LoopLoss;                  // Loss in loop due to cond return to atm pressure
     100             :         Real64 TotSteamCoolingCoilRate;   // Total Cooling Coil Rate on the Coil [W]
     101             :         Real64 SenSteamCoolingCoilRate;   // Sensible Cooling Coil Rate on the Coil [W]
     102             :         Real64 LeavingRelHum;             // Simple Coil Latent Model requires User input for leaving RH
     103             :         Real64 DesiredOutletTemp;         // Temp desired at the outlet (C)
     104             :         Real64 DesiredOutletHumRat;       // Humudity Ratio desired at outlet (C)
     105             :         Real64 InletSteamTemp;            // Inlet Steam Temperature [C]
     106             :         Real64 OutletSteamTemp;           // Outlet Steam Temperature [C]
     107             :         Real64 InletSteamMassFlowRate;    // Inlet Steam Mass Flow Rate [Kg/s]
     108             :         Real64 OutletSteamMassFlowRate;   // Outlet Steam Mass Flow Rate [Kg/s]
     109             :         Real64 MaxSteamVolFlowRate;       // Maximum water Volume flow rate [m3/s]
     110             :         Real64 MaxSteamMassFlowRate;      // Maximum water mass flow rate [Kg/s]
     111             :         Real64 InletSteamEnthalpy;        // Inlet Water Enthalpy (J/Kg)
     112             :         Real64 OutletWaterEnthalpy;       // Outlet Water Enthalpy (J/kg)
     113             :         Real64 InletSteamPress;           // Pressure at steam inlet (Pa)
     114             :         Real64 InletSteamQuality;         // Quality of steam at inlet
     115             :         Real64 OutletSteamQuality;        // Quality of steam at outlet
     116             :         Real64 DegOfSubcooling;
     117             :         Real64 LoopSubcoolReturn;
     118             :         int AirInletNodeNum;                                   // Inlet node number at air side
     119             :         int AirOutletNodeNum;                                  // Outlet node number at air side
     120             :         int SteamInletNodeNum;                                 // SteamInletNodeNum
     121             :         int SteamOutletNodeNum;                                // SteamOutletNodeNum
     122             :         int TempSetPointNodeNum;                               // If applicable : node number that the temp setpoint exists.
     123             :         CoilControlType TypeOfCoil = CoilControlType::Invalid; // Control of Coil , temperature or Zone load
     124             :         int FluidIndex;                                        // Fluid index for FluidProperties (Steam)
     125             :         PlantLocation plantLoc;                                // Location object for plant component for steam coil
     126             :         DataPlant::PlantEquipmentType CoilType;                // plant level index for coil type
     127             :         Real64 OperatingCapacity;                              // capacity of steam coil at operating conditions (W)
     128             :         bool DesiccantRegenerationCoil; // true if it is a regeneration air heating coil defined in Desiccant Dehumidifier system
     129             :         int DesiccantDehumNum;          // index to desiccant dehumidifier object
     130             :         bool FaultyCoilSATFlag;         // True if the coil has SAT sensor fault
     131             :         int FaultyCoilSATIndex;         // Index of the fault object corresponding to the coil
     132             :         Real64 FaultyCoilSATOffset;     // Coil SAT sensor offset
     133             :         bool reportCoilFinalSizes;      // one time report of sizes to coil selection report
     134             :         Real64 DesCoilCapacity;         // store design load
     135             :         Real64 DesAirVolFlow;           // store design air flow
     136             : 
     137             :         // Default Constructor
     138           6 :         SteamCoilEquipConditions()
     139           6 :             : SteamCoilType(0), SteamCoilModel(0), SchedPtr(0), InletAirMassFlowRate(0.0), OutletAirMassFlowRate(0.0), InletAirTemp(0.0),
     140             :               OutletAirTemp(0.0), InletAirHumRat(0.0), OutletAirHumRat(0.0), InletAirEnthalpy(0.0), OutletAirEnthalpy(0.0), TotSteamCoilLoad(0.0),
     141             :               SenSteamCoilLoad(0.0), TotSteamHeatingCoilEnergy(0.0), TotSteamCoolingCoilEnergy(0.0), SenSteamCoolingCoilEnergy(0.0),
     142             :               TotSteamHeatingCoilRate(0.0), LoopLoss(0.0), TotSteamCoolingCoilRate(0.0), SenSteamCoolingCoilRate(0.0), LeavingRelHum(0.0),
     143             :               DesiredOutletTemp(0.0), DesiredOutletHumRat(0.0), InletSteamTemp(0.0), OutletSteamTemp(0.0), InletSteamMassFlowRate(0.0),
     144             :               OutletSteamMassFlowRate(0.0), MaxSteamVolFlowRate(0.0), MaxSteamMassFlowRate(0.0), InletSteamEnthalpy(0.0), OutletWaterEnthalpy(0.0),
     145             :               InletSteamPress(0.0), InletSteamQuality(0.0), OutletSteamQuality(0.0), DegOfSubcooling(0.0), LoopSubcoolReturn(0.0), AirInletNodeNum(0),
     146             :               AirOutletNodeNum(0), SteamInletNodeNum(0), SteamOutletNodeNum(0), TempSetPointNodeNum(0), FluidIndex(0), plantLoc{},
     147             :               CoilType(DataPlant::PlantEquipmentType::Invalid), OperatingCapacity(0.0), DesiccantRegenerationCoil(false), DesiccantDehumNum(0),
     148             :               FaultyCoilSATFlag(false), FaultyCoilSATIndex(0), FaultyCoilSATOffset(0.0), reportCoilFinalSizes(true), DesCoilCapacity(0.0),
     149           6 :               DesAirVolFlow(0.0)
     150             :         {
     151           6 :         }
     152             :     };
     153             : 
     154             :     void SimulateSteamCoilComponents(EnergyPlusData &state,
     155             :                                      std::string_view CompName,
     156             :                                      bool FirstHVACIteration,
     157             :                                      int &CompIndex,
     158             :                                      Optional<Real64 const> QCoilReq = _, // coil load to be met
     159             :                                      Optional<Real64> QCoilActual = _,    // coil load actually delivered returned to calling component
     160             :                                      Optional_int_const FanOpMode = _,
     161             :                                      Optional<Real64 const> PartLoadRatio = _);
     162             : 
     163             :     void GetSteamCoilInput(EnergyPlusData &state);
     164             : 
     165             :     void InitSteamCoil(EnergyPlusData &state, int CoilNum, bool FirstHVACIteration);
     166             : 
     167             :     void SizeSteamCoil(EnergyPlusData &state, int CoilNum);
     168             : 
     169             :     void CalcSteamAirCoil(EnergyPlusData &state,
     170             :                           int CoilNum,
     171             :                           Real64 QCoilRequested, // requested coil load
     172             :                           Real64 &QCoilActual,   // coil load actually delivered
     173             :                           int FanOpMode,         // fan operating mode
     174             :                           Real64 PartLoadRatio   // part-load ratio of heating coil
     175             :     );
     176             : 
     177             :     void UpdateSteamCoil(EnergyPlusData &state, int CoilNum);
     178             : 
     179             :     void ReportSteamCoil(EnergyPlusData &state, int CoilNum);
     180             : 
     181             :     int GetSteamCoilIndex(EnergyPlusData &state,
     182             :                           std::string_view CoilType,   // must match coil types in this module
     183             :                           std::string const &CoilName, // must match coil names for the coil type
     184             :                           bool &ErrorsFound            // set to true if problem
     185             :     );
     186             :     int GetCompIndex(EnergyPlusData &state, std::string_view coilName);
     187             : 
     188             :     void CheckSteamCoilSchedule(EnergyPlusData &state, std::string const &CompType, std::string_view CompName, Real64 &Value, int &CompIndex);
     189             : 
     190             :     Real64 GetCoilMaxWaterFlowRate(EnergyPlusData &state,
     191             :                                    std::string const &CoilType, // must match coil types in this module
     192             :                                    std::string const &CoilName, // must match coil names for the coil type
     193             :                                    bool &ErrorsFound            // set to true if problem
     194             :     );
     195             : 
     196             :     Real64 GetCoilMaxSteamFlowRate(EnergyPlusData &state,
     197             :                                    int CoilIndex,    // must match coil types in this module
     198             :                                    bool &ErrorsFound // set to true if problem
     199             :     );
     200             : 
     201             :     int GetCoilAirInletNode(EnergyPlusData &state,
     202             :                             int CoilIndex,               // must match coil types in this module
     203             :                             std::string const &CoilName, // must match coil names for the coil type
     204             :                             bool &ErrorsFound            // set to true if problem
     205             :     );
     206             : 
     207             :     int GetCoilAirOutletNode(EnergyPlusData &state,
     208             :                              int CoilIndex,               // must match coil types in this module
     209             :                              std::string const &CoilName, // must match coil names for the coil type
     210             :                              bool &ErrorsFound            // set to true if problem
     211             :     );
     212             : 
     213             :     int GetCoilAirOutletNode(EnergyPlusData &state,
     214             :                              std::string const &CoilType, // must match coil types in this module
     215             :                              std::string const &CoilName, // must match coil names for the coil type
     216             :                              bool &ErrorsFound            // set to true if problem
     217             :     );
     218             : 
     219             :     int GetCoilSteamInletNode(EnergyPlusData &state,
     220             :                               int CoilIndex,               // must match coil types in this module
     221             :                               std::string const &CoilName, // must match coil names for the coil type
     222             :                               bool &ErrorsFound            // set to true if problem
     223             :     );
     224             : 
     225             :     int GetCoilSteamInletNode(EnergyPlusData &state,
     226             :                               std::string const &CoilType, // must match coil types in this module
     227             :                               std::string const &CoilName, // must match coil names for the coil type
     228             :                               bool &ErrorsFound            // set to true if problem
     229             :     );
     230             : 
     231             :     int GetCoilSteamOutletNode(EnergyPlusData &state,
     232             :                                int CoilIndex,               // must match coil types in this module
     233             :                                std::string const &CoilName, // must match coil names for the coil type
     234             :                                bool &ErrorsFound            // set to true if problem
     235             :     );
     236             : 
     237             :     int GetCoilSteamOutletNode(EnergyPlusData &state,
     238             :                                std::string_view CoilType,   // must match coil types in this module
     239             :                                std::string const &CoilName, // must match coil names for the coil type
     240             :                                bool &ErrorsFound            // set to true if problem
     241             :     );
     242             : 
     243             :     Real64 GetCoilCapacity([[maybe_unused]] EnergyPlusData &state,
     244             :                            std::string const &CoilType, // must match coil types in this module
     245             :                            std::string const &CoilName, // must match coil names for the coil type
     246             :                            bool &ErrorsFound            // set to true if problem
     247             :     );
     248             : 
     249             :     CoilControlType GetTypeOfCoil(EnergyPlusData &state,
     250             :                                   int CoilIndex,               // must match coil types in this module
     251             :                                   std::string const &CoilName, // must match coil names for the coil type
     252             :                                   bool &ErrorsFound            // set to true if problem
     253             :     );
     254             : 
     255             :     int GetSteamCoilControlNodeNum(EnergyPlusData &state,
     256             :                                    std::string const &CoilType, // must match coil types in this module
     257             :                                    std::string const &CoilName, // must match coil names for the coil type
     258             :                                    bool &ErrorFlag              // set to true if problem
     259             :     );
     260             : 
     261             :     int GetSteamCoilAvailScheduleIndex(EnergyPlusData &state,
     262             :                                        std::string const &CoilType, // must match coil types in this module
     263             :                                        std::string const &CoilName, // must match coil names for the coil type
     264             :                                        bool &ErrorsFound            // set to true if problem
     265             :     );
     266             : 
     267             :     // sets data to a coil that is used as a regeneration air heating coil in
     268             :     // desiccant dehumidification system
     269             :     void SetSteamCoilData(EnergyPlusData &state,
     270             :                           int CoilNum,                                 // index of hot steam heating Coil
     271             :                           bool &ErrorsFound,                           // Set to true if certain errors found
     272             :                           Optional_bool DesiccantRegenerationCoil = _, // Flag that this coil is used as regeneration air heating coil
     273             :                           Optional_int DesiccantDehumIndex = _         // Index for the desiccant dehum system where this coil is used
     274             :     );
     275             : 
     276             : } // namespace SteamCoils
     277             : 
     278        1542 : struct SteamCoilsData : BaseGlobalStruct
     279             : {
     280             :     int SteamIndex = 0;
     281             :     int NumSteamCoils = 0; // The Number of SteamCoils found in the Input
     282             :     Array1D_bool MySizeFlag;
     283             :     Array1D_bool CoilWarningOnceFlag;
     284             :     Array1D_bool CheckEquipName;
     285             :     bool GetSteamCoilsInputFlag = true; // Flag set to make sure you get input once
     286             :     bool MyOneTimeFlag = true;          // one time initialization flag
     287             :     Array1D_bool MyEnvrnFlag;
     288             :     Array1D_bool MyPlantScanFlag;
     289             :     int ErrCount = 0;
     290             :     Array1D<SteamCoils::SteamCoilEquipConditions> SteamCoil;
     291             : 
     292           0 :     void clear_state() override
     293             :     {
     294           0 :         *this = SteamCoilsData();
     295           0 :     }
     296             : };
     297             : } // namespace EnergyPlus
     298             : 
     299             : #endif

Generated by: LCOV version 1.13