LCOV - code coverage report
Current view: top level - EnergyPlus - SteamCoils.hh (source / functions) Coverage Total Hit
Test: lcov.output.filtered Lines: 100.0 % 19 19
Test Date: 2025-05-22 16:09:37 Functions: 100.0 % 4 4

            Line data    Source code
       1              : // EnergyPlus, Copyright (c) 1996-2025, 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              : #include <EnergyPlus/FluidProperties.hh>
      60              : 
      61              : namespace EnergyPlus {
      62              : 
      63              : // Forward declarations
      64              : struct EnergyPlusData;
      65              : 
      66              : namespace SteamCoils {
      67              : 
      68              :     enum class CoilControlType
      69              :     {
      70              :         Invalid = -1,
      71              :         TemperatureSetPoint,
      72              :         ZoneLoadControl,
      73              :         Num
      74              :     };
      75              :     extern const std::array<std::string_view, static_cast<int>(CoilControlType::Num)> coilControlTypeNames;
      76              : 
      77              :     struct SteamCoilEquipConditions
      78              :     {
      79              :         // Members
      80              :         std::string Name;                      // Name of the SteamCoil
      81              :         std::string SteamCoilTypeA;            // Type of SteamCoil ie. Heating or Cooling
      82              :         int SteamCoilType;                     // Type of SteamCoil ie. Heating or Cooling
      83              :         int SteamCoilModel;                    // Type of SteamCoil ie. Simple, Detailed, etc.
      84              :         Sched::Schedule *availSched = nullptr; // operating 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              :         Fluid::RefrigProps *steam = nullptr;                   // 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            3 :         SteamCoilEquipConditions()
     139            6 :             : SteamCoilType(0), SteamCoilModel(0), InletAirMassFlowRate(0.0), OutletAirMassFlowRate(0.0), InletAirTemp(0.0), OutletAirTemp(0.0),
     140            3 :               InletAirHumRat(0.0), OutletAirHumRat(0.0), InletAirEnthalpy(0.0), OutletAirEnthalpy(0.0), TotSteamCoilLoad(0.0), SenSteamCoilLoad(0.0),
     141            3 :               TotSteamHeatingCoilEnergy(0.0), TotSteamCoolingCoilEnergy(0.0), SenSteamCoolingCoilEnergy(0.0), TotSteamHeatingCoilRate(0.0),
     142            3 :               LoopLoss(0.0), TotSteamCoolingCoilRate(0.0), SenSteamCoolingCoilRate(0.0), LeavingRelHum(0.0), DesiredOutletTemp(0.0),
     143            3 :               DesiredOutletHumRat(0.0), InletSteamTemp(0.0), OutletSteamTemp(0.0), InletSteamMassFlowRate(0.0), OutletSteamMassFlowRate(0.0),
     144            3 :               MaxSteamVolFlowRate(0.0), MaxSteamMassFlowRate(0.0), InletSteamEnthalpy(0.0), OutletWaterEnthalpy(0.0), InletSteamPress(0.0),
     145            3 :               InletSteamQuality(0.0), OutletSteamQuality(0.0), DegOfSubcooling(0.0), LoopSubcoolReturn(0.0), AirInletNodeNum(0), AirOutletNodeNum(0),
     146            6 :               SteamInletNodeNum(0), SteamOutletNodeNum(0), TempSetPointNodeNum(0), plantLoc{}, CoilType(DataPlant::PlantEquipmentType::Invalid),
     147            3 :               OperatingCapacity(0.0), DesiccantRegenerationCoil(false), DesiccantDehumNum(0), FaultyCoilSATFlag(false), FaultyCoilSATIndex(0),
     148            3 :               FaultyCoilSATOffset(0.0), reportCoilFinalSizes(true), DesCoilCapacity(0.0), DesAirVolFlow(0.0)
     149              :         {
     150            3 :         }
     151              :     };
     152              : 
     153              :     void SimulateSteamCoilComponents(EnergyPlusData &state,
     154              :                                      std::string_view CompName,
     155              :                                      bool FirstHVACIteration,
     156              :                                      int &CompIndex,
     157              :                                      ObjexxFCL::Optional<Real64 const> QCoilReq = _, // coil load to be met
     158              :                                      ObjexxFCL::Optional<Real64> QCoilActual = _,    // coil load actually delivered returned to calling component
     159              :                                      ObjexxFCL::Optional<HVAC::FanOp const> fanOp = _,
     160              :                                      ObjexxFCL::Optional<Real64 const> PartLoadRatio = _);
     161              : 
     162              :     void GetSteamCoilInput(EnergyPlusData &state);
     163              : 
     164              :     void InitSteamCoil(EnergyPlusData &state, int CoilNum, bool FirstHVACIteration);
     165              : 
     166              :     void SizeSteamCoil(EnergyPlusData &state, int CoilNum);
     167              : 
     168              :     void CalcSteamAirCoil(EnergyPlusData &state,
     169              :                           int CoilNum,
     170              :                           Real64 QCoilRequested,   // requested coil load
     171              :                           Real64 &QCoilActual,     // coil load actually delivered
     172              :                           HVAC::FanOp const fanOp, // fan operating mode
     173              :                           Real64 PartLoadRatio     // part-load ratio of heating coil
     174              :     );
     175              : 
     176              :     void UpdateSteamCoil(EnergyPlusData &state, int CoilNum);
     177              : 
     178              :     void ReportSteamCoil(EnergyPlusData &state, int CoilNum);
     179              : 
     180              :     int GetSteamCoilIndex(EnergyPlusData &state,
     181              :                           std::string_view CoilType,   // must match coil types in this module
     182              :                           std::string const &CoilName, // must match coil names for the coil type
     183              :                           bool &ErrorsFound            // set to true if problem
     184              :     );
     185              :     int GetCompIndex(EnergyPlusData &state, std::string_view coilName);
     186              : 
     187              :     void CheckSteamCoilSchedule(EnergyPlusData &state, std::string const &CompType, std::string_view CompName, Real64 &Value, int &CompIndex);
     188              : 
     189              :     Real64 GetCoilMaxWaterFlowRate(EnergyPlusData &state,
     190              :                                    std::string const &CoilType, // must match coil types in this module
     191              :                                    std::string const &CoilName, // must match coil names for the coil type
     192              :                                    bool &ErrorsFound            // set to true if problem
     193              :     );
     194              : 
     195              :     Real64 GetCoilMaxSteamFlowRate(EnergyPlusData &state,
     196              :                                    int CoilIndex,    // must match coil types in this module
     197              :                                    bool &ErrorsFound // set to true if problem
     198              :     );
     199              : 
     200              :     int GetCoilAirInletNode(EnergyPlusData &state,
     201              :                             int CoilIndex,               // must match coil types in this module
     202              :                             std::string const &CoilName, // must match coil names for the coil type
     203              :                             bool &ErrorsFound            // set to true if problem
     204              :     );
     205              : 
     206              :     int GetCoilAirOutletNode(EnergyPlusData &state,
     207              :                              int CoilIndex,               // must match coil types in this module
     208              :                              std::string const &CoilName, // must match coil names for the coil type
     209              :                              bool &ErrorsFound            // set to true if problem
     210              :     );
     211              : 
     212              :     int GetCoilAirOutletNode(EnergyPlusData &state,
     213              :                              std::string const &CoilType, // must match coil types in this module
     214              :                              std::string const &CoilName, // must match coil names for the coil type
     215              :                              bool &ErrorsFound            // set to true if problem
     216              :     );
     217              : 
     218              :     int GetCoilSteamInletNode(EnergyPlusData &state,
     219              :                               int CoilIndex,               // must match coil types in this module
     220              :                               std::string const &CoilName, // must match coil names for the coil type
     221              :                               bool &ErrorsFound            // set to true if problem
     222              :     );
     223              : 
     224              :     int GetCoilSteamInletNode(EnergyPlusData &state,
     225              :                               std::string const &CoilType, // must match coil types in this module
     226              :                               std::string const &CoilName, // must match coil names for the coil type
     227              :                               bool &ErrorsFound            // set to true if problem
     228              :     );
     229              : 
     230              :     int GetCoilSteamOutletNode(EnergyPlusData &state,
     231              :                                int CoilIndex,               // must match coil types in this module
     232              :                                std::string const &CoilName, // must match coil names for the coil type
     233              :                                bool &ErrorsFound            // set to true if problem
     234              :     );
     235              : 
     236              :     int GetCoilSteamOutletNode(EnergyPlusData &state,
     237              :                                std::string_view CoilType,   // must match coil types in this module
     238              :                                std::string const &CoilName, // must match coil names for the coil type
     239              :                                bool &ErrorsFound            // set to true if problem
     240              :     );
     241              : 
     242              :     Real64 GetCoilCapacity([[maybe_unused]] EnergyPlusData &state,
     243              :                            std::string const &CoilType, // must match coil types in this module
     244              :                            std::string const &CoilName, // must match coil names for the coil type
     245              :                            bool &ErrorsFound            // set to true if problem
     246              :     );
     247              : 
     248              :     CoilControlType GetTypeOfCoil(EnergyPlusData &state,
     249              :                                   int CoilIndex,               // must match coil types in this module
     250              :                                   std::string const &CoilName, // must match coil names for the coil type
     251              :                                   bool &ErrorsFound            // set to true if problem
     252              :     );
     253              : 
     254              :     int GetSteamCoilControlNodeNum(EnergyPlusData &state,
     255              :                                    std::string const &CoilType, // must match coil types in this module
     256              :                                    std::string const &CoilName, // must match coil names for the coil type
     257              :                                    bool &ErrorFlag              // set to true if problem
     258              :     );
     259              : 
     260              :     Sched::Schedule *GetSteamCoilAvailSchedule(EnergyPlusData &state,
     261              :                                                std::string const &CoilType, // must match coil types in this module
     262              :                                                std::string const &CoilName, // must match coil names for the coil type
     263              :                                                bool &ErrorsFound            // set to true if problem
     264              :     );
     265              : 
     266              :     // sets data to a coil that is used as a regeneration air heating coil in
     267              :     // desiccant dehumidification system
     268              :     void SetSteamCoilData(EnergyPlusData &state,
     269              :                           int CoilNum,                                            // index of hot steam heating Coil
     270              :                           bool &ErrorsFound,                                      // Set to true if certain errors found
     271              :                           ObjexxFCL::Optional_bool DesiccantRegenerationCoil = _, // Flag that this coil is used as regeneration air heating coil
     272              :                           ObjexxFCL::Optional_int DesiccantDehumIndex = _         // Index for the desiccant dehum system where this coil is used
     273              :     );
     274              : 
     275              : } // namespace SteamCoils
     276              : 
     277              : struct SteamCoilsData : BaseGlobalStruct
     278              : {
     279              :     int NumSteamCoils = 0; // The Number of SteamCoils found in the Input
     280              :     Array1D_bool MySizeFlag;
     281              :     Array1D_bool CoilWarningOnceFlag;
     282              :     Array1D_bool CheckEquipName;
     283              :     bool GetSteamCoilsInputFlag = true; // Flag set to make sure you get input once
     284              :     bool MyOneTimeFlag = true;          // one time initialization flag
     285              :     Array1D_bool MyEnvrnFlag;
     286              :     Array1D_bool MyPlantScanFlag;
     287              :     int ErrCount = 0;
     288              :     Array1D<SteamCoils::SteamCoilEquipConditions> SteamCoil;
     289              : 
     290         2126 :     void init_constant_state([[maybe_unused]] EnergyPlusData &state) override
     291              :     {
     292         2126 :     }
     293              : 
     294         1152 :     void init_state([[maybe_unused]] EnergyPlusData &state) override
     295              :     {
     296         1152 :     }
     297              : 
     298         2100 :     void clear_state() override
     299              :     {
     300         2100 :         new (this) SteamCoilsData();
     301         2100 :     }
     302              : };
     303              : } // namespace EnergyPlus
     304              : 
     305              : #endif
        

Generated by: LCOV version 2.0-1