LCOV - code coverage report
Current view: top level - EnergyPlus - TranspiredCollector.hh (source / functions) Hit Total Coverage
Test: lcov.output.filtered Lines: 13 21 61.9 %
Date: 2024-08-24 18:31:18 Functions: 3 4 75.0 %

          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 TranspiredCollector_hh_INCLUDED
      49             : #define TranspiredCollector_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/DataVectorTypes.hh>
      58             : #include <EnergyPlus/EnergyPlus.hh>
      59             : 
      60             : namespace EnergyPlus {
      61             : 
      62             : // Forward declarations
      63             : struct EnergyPlusData;
      64             : 
      65             : namespace TranspiredCollector {
      66             : 
      67             :     // Using/Aliasing
      68             :     using DataVectorTypes::Vector;
      69             : 
      70             :     struct UTSCDataStruct
      71             :     {
      72             :         // Members
      73             :         // from input data
      74             :         std::string Name;
      75             :         std::string OSCMName;                     // OtherSideConditionsModel
      76             :         int OSCMPtr;                              // OtherSideConditionsModel index
      77             :         int SchedPtr;                             // Availablity schedule
      78             :         Array1D_int InletNode;                    // Air system node "pointer", should be set to outdoor air
      79             :         Array1D_int OutletNode;                   // Air system node "pointer", outlet from UTSC
      80             :         Array1D_int ControlNode;                  // Air system node "pointer", should have mixed air setpoint
      81             :         Array1D_int ZoneNode;                     // Air system node "pointer", should have zone node
      82             :         int Layout;                               // 'Square' or 'Triangle'
      83             :         int Correlation;                          // which heat exchanger effectiveness model
      84             :         Real64 HoleDia;                           // Diameter of Perforations in Collector [m]
      85             :         Real64 Pitch;                             // Distance between Perforations in Collector [m]
      86             :         Real64 LWEmitt;                           // Thermal Emissivity of Collector Surface [dimensionless]
      87             :         Real64 SolAbsorp;                         // Solar Absorbtivity of Collector Surface [dimensionless]
      88             :         Material::SurfaceRoughness CollRoughness; // surface roughness for exterior convection calcs.
      89             :         Real64 PlenGapThick;                      // Depth of Plenum Behind Collector [m]
      90             :         Real64 PlenCrossArea;                     // cross section area of plenum behind collector [m2]
      91             :         int NumSurfs;                             // a single collector can have multiple surfaces underneath it
      92             :         Array1D_int SurfPtrs;                     // = 0  ! array of pointers for participating underlying surfaces
      93             :         Real64 Height;                            // Overall Height of Collector  [m]
      94             :         Real64 AreaRatio;                         // Ratio of actual surface are to projected surface area [dimensionless]
      95             :         Real64 CollectThick;                      // Thickness of collector absorber plate material.  [m]
      96             :         Real64 Cv;                                // volume-based effectiveness of openings for wind-driven vent when Passive
      97             :         Real64 Cd;                                // discharge coefficient of openings for buoyancy-driven vent when Passive
      98             :         int NumOASysAttached;                     // =1 if no splitter, other wise set by Splitter object
      99             :         int FreeHeatSetPointSchedPtr;             // used for controlling seperately from usual setpoint managers.
     100             :         int VsucErrIndex;
     101             :         // data from elswhere and calculated
     102             :         Real64 ActualArea; // Overall Area of Collect with surface corrugations.
     103             :         Real64 ProjArea;   // Overall Area of Collector projected, as if flat [m2]
     104             :         Vector Centroid;   // computed centroid
     105             :         Real64 Porosity;   // fraction of absorber plate [--]
     106             :         bool IsOn;         // .TRUE. means "on" or "ACTIVE" , .false means "off" or "PASSIVE
     107             :         Real64 Tplen;      // modeled drybulb temperature for air between collector and wall [C]
     108             :         Real64 Tcoll;      // modeled surface temperature for collector [C]
     109             :         Real64 TplenLast;  // Old Value for modeled drybulb temp if air between collector and wall [C]
     110             :         Real64 TcollLast;  // Old value for modeled surface temperature for collector [C]
     111             :         Real64 HrPlen;     // Modeled radiation coef for OSCM [W/m2-C]
     112             :         Real64 HcPlen;     // Modeled Convection coef for OSCM [W/m2-C]
     113             :         Real64 MdotVent;   // air mass flow exchanging with ambient when passive.
     114             :         Real64 HdeltaNPL;  // lenth scale for buoyancy-driven vent when Passive [m]
     115             :         Real64 TairHX;     // air drybulb of air leaving collector when Active [C]
     116             :         Real64 InletMDot;  // flow rate from outdoor mixer controller
     117             :         Real64 InletTempDB;
     118             :         Real64 Tilt;       // Tilt from area weighted average of underlying surfaces
     119             :         Real64 Azimuth;    // Azimuth from area weighted average of underlying surfaces
     120             :         Real64 QdotSource; // Source/sink term
     121             :         // reporting data
     122             :         Real64 Isc;               // total incident solar on collector [W]
     123             :         Real64 HXeff;             // heat exchanger effectiveness [--]
     124             :         Real64 Vsuction;          // Average suction face velocity [m/s]
     125             :         Real64 PassiveACH;        // air changes per hour when passive [1/hr]
     126             :         Real64 PassiveMdotVent;   // Total Nat Vent air change rate  [kg/s]
     127             :         Real64 PassiveMdotWind;   // Nat Vent air change rate from Wind-driven [kg/s]
     128             :         Real64 PassiveMdotTherm;  // Nat. Vent air change rate from buoyancy-driven flow [kg/s]
     129             :         Real64 PlenumVelocity;    // effective velocity inside plenum [m/s]
     130             :         Real64 SupOutTemp;        // supply air outlet temperature [C]
     131             :         Real64 SupOutHumRat;      // supply air outlet humidity ratio [kg water/kg dry air]
     132             :         Real64 SupOutEnth;        // supply air outlet enthalpy [J/kg]
     133             :         Real64 SupOutMassFlow;    // supply air outlet mass flow rate [kg/s]
     134             :         Real64 SensHeatingRate;   // rate of sensible heat being added to the supply (primary) air [W]
     135             :         Real64 SensHeatingEnergy; // sensible heat added to the supply (primary) air [J]
     136             :         Real64 SensCoolingRate;   // rate of sensible heat being removed from the supply (primary) air [W]
     137             :         Real64 SensCoolingEnergy; // sensible heat removed from the supply (primary) air [J]
     138             :         Real64 UTSCEfficiency;    // Total Efficiency (with wall) SensHeatingRate/IncidentRadiation[--]
     139             :         Real64 UTSCCollEff;       // Collector-only Efficiency [--]
     140             : 
     141             :         // Default Constructor
     142           6 :         UTSCDataStruct()
     143          18 :             : OSCMPtr(0), SchedPtr(0), Layout(0), Correlation(0), HoleDia(0.0), Pitch(0.0), LWEmitt(0.0), SolAbsorp(0.0),
     144          12 :               CollRoughness(Material::SurfaceRoughness::VeryRough), PlenGapThick(0.0), PlenCrossArea(0.0), NumSurfs(0), Height(0.0), AreaRatio(0.0),
     145           6 :               CollectThick(0.0), Cv(0.0), Cd(0.0), NumOASysAttached(0), FreeHeatSetPointSchedPtr(0), VsucErrIndex(0), ActualArea(0.0), ProjArea(0.0),
     146           6 :               Centroid(0.0, 0.0, 0.0), Porosity(0.0), IsOn(false), Tplen(0.0), Tcoll(0.0), TplenLast(22.5), TcollLast(22.0), HrPlen(0.0), HcPlen(0.0),
     147           6 :               MdotVent(0.0), HdeltaNPL(0.0), TairHX(0.0), InletMDot(0.0), InletTempDB(0.0), Tilt(0.0), Azimuth(0.0), QdotSource(0.0), Isc(0.0),
     148           6 :               HXeff(0.0), Vsuction(0.0), PassiveACH(0.0), PassiveMdotVent(0.0), PassiveMdotWind(0.0), PassiveMdotTherm(0.0), PlenumVelocity(0.0),
     149           6 :               SupOutTemp(0.0), SupOutHumRat(0.0), SupOutEnth(0.0), SupOutMassFlow(0.0), SensHeatingRate(0.0), SensHeatingEnergy(0.0),
     150           6 :               SensCoolingRate(0.0), SensCoolingEnergy(0.0), UTSCEfficiency(0.0), UTSCCollEff(0.0)
     151             :         {
     152           6 :         }
     153             :     };
     154             : 
     155             :     void SimTranspiredCollector(EnergyPlusData &state,
     156             :                                 std::string_view CompName, // component name
     157             :                                 int &CompIndex             // component index (to reduce string compares during simulation)
     158             :     );
     159             : 
     160             :     void GetTranspiredCollectorInput(EnergyPlusData &state);
     161             : 
     162             :     void InitTranspiredCollector(EnergyPlusData &state, int const UTSCNum); // compindex already checked in calling routine
     163             : 
     164             :     void CalcActiveTranspiredCollector(EnergyPlusData &state, int const UTSCNum);
     165             : 
     166             :     void CalcPassiveTranspiredCollector(EnergyPlusData &state, int const UTSCNum);
     167             : 
     168             :     void UpdateTranspiredCollector(EnergyPlusData &state, int const UTSCNum);
     169             : 
     170             :     void SetUTSCQdotSource(EnergyPlusData &state,
     171             :                            int const UTSCNum,
     172             :                            Real64 const QSource // source term in Watts
     173             :     );
     174             : 
     175             :     void GetTranspiredCollectorIndex(EnergyPlusData &state, int const SurfacePtr, int &UTSCIndex);
     176             : 
     177             :     void GetUTSCTsColl(EnergyPlusData &state, int const UTSCNum, Real64 &TsColl);
     178             : 
     179             :     int GetAirInletNodeNum(EnergyPlusData &state, std::string const &UTSCName, bool &ErrorsFound);
     180             : 
     181             :     int GetAirOutletNodeNum(EnergyPlusData &state, std::string const &UTSCName, bool &ErrorsFound);
     182             : 
     183             :     void CalcPassiveExteriorBaffleGap(EnergyPlusData &state,
     184             :                                       const Array1D_int &SurfPtrARR, // Array of indexes pointing to Surface structure in DataSurfaces
     185             :                                       Real64 const VentArea,         // Area available for venting the gap [m2]
     186             :                                       Real64 const Cv,               // Oriface coefficient for volume-based discharge, wind-driven [--]
     187             :                                       Real64 const Cd,               // oriface coefficient for discharge,  buoyancy-driven [--]
     188             :                                       Real64 const HdeltaNPL,        // Height difference from neutral pressure level [m]
     189             :                                       Real64 const SolAbs,           // solar absorptivity of baffle [--]
     190             :                                       Real64 const AbsExt,           // thermal absorptance/emittance of baffle material [--]
     191             :                                       Real64 const Tilt,             // Tilt of gap [Degrees]
     192             :                                       Real64 const AspRat,           // aspect ratio of gap  Height/gap [--]
     193             :                                       Real64 const GapThick,         // Thickness of air space between baffle and underlying heat transfer surface
     194             :                                       Material::SurfaceRoughness const Roughness, // Roughness index (1-6), see DataHeatBalance parameters
     195             :                                       Real64 const QdotSource,                    // Source/sink term, e.g. electricity exported from solar cell [W]
     196             :                                       Real64 &TsBaffle,                           // Temperature of baffle (both sides) use lagged value on input [C]
     197             :                                       Real64 &TaGap, // Temperature of air gap (assumed mixed) use lagged value on input [C]
     198             :                                       ObjexxFCL::Optional<Real64> HcGapRpt = _,
     199             :                                       ObjexxFCL::Optional<Real64> HrGapRpt = _,
     200             :                                       ObjexxFCL::Optional<Real64> IscRpt = _,
     201             :                                       ObjexxFCL::Optional<Real64> MdotVentRpt = _,
     202             :                                       ObjexxFCL::Optional<Real64> VdotWindRpt = _,
     203             :                                       ObjexxFCL::Optional<Real64> VdotBuoyRpt = _);
     204             : 
     205             :     //****************************************************************************
     206             : 
     207             :     Real64 PassiveGapNusseltNumber(Real64 const AspRat, // Aspect Ratio of Gap height to gap width
     208             :                                    Real64 const Tilt,   // Tilt of gap, degrees
     209             :                                    Real64 const Tso,    // Temperature of gap surface closest to outside (K)
     210             :                                    Real64 const Tsi,    // Temperature of gap surface closest to zone (K)
     211             :                                    Real64 const Gr);
     212             : 
     213             : } // namespace TranspiredCollector
     214             : 
     215             : struct TranspiredCollectorData : BaseGlobalStruct
     216             : {
     217             : 
     218             :     int NumUTSC = 0; // number of transpired collectors in model
     219             :     Array1D_bool CheckEquipName;
     220             :     bool GetInputFlag = true; // First time, input is gotten
     221             : 
     222             :     EPVector<TranspiredCollector::UTSCDataStruct> UTSC;
     223             :     bool MyOneTimeFlag = true;
     224             :     bool MySetPointCheckFlag = true;
     225             : 
     226             :     Array1D_bool MyEnvrnFlag;
     227             : 
     228         796 :     void init_state([[maybe_unused]] EnergyPlusData &state) override
     229             :     {
     230         796 :     }
     231             : 
     232           0 :     void clear_state() override
     233             :     {
     234           0 :         this->NumUTSC = 0;
     235           0 :         this->GetInputFlag = true;
     236           0 :         this->UTSC.deallocate();
     237           0 :         this->MyOneTimeFlag = true;
     238           0 :         this->MySetPointCheckFlag = true;
     239           0 :         this->MyEnvrnFlag.deallocate();
     240           0 :     }
     241             : 
     242             :     // Default Constructor
     243         796 :     TranspiredCollectorData() = default;
     244             : };
     245             : } // namespace EnergyPlus
     246             : 
     247             : #endif

Generated by: LCOV version 1.14