LCOV - code coverage report
Current view: top level - EnergyPlus - HeatBalanceSurfaceManager.hh (source / functions) Hit Total Coverage
Test: lcov.output.filtered Lines: 2 41 4.9 %
Date: 2024-08-23 23:50:59 Functions: 1 2 50.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 HeatBalanceSurfaceManager_hh_INCLUDED
      49             : #define HeatBalanceSurfaceManager_hh_INCLUDED
      50             : 
      51             : // ObjexxFCL Headers
      52             : #include <ObjexxFCL/Optional.hh>
      53             : 
      54             : // EnergyPlus Headers
      55             : #include <EnergyPlus/Data/BaseData.hh>
      56             : #include <EnergyPlus/DataWindowEquivalentLayer.hh>
      57             : #include <EnergyPlus/EnergyPlus.hh>
      58             : #include <EnergyPlus/Material.hh>
      59             : #include <EnergyPlus/WeatherManager.hh>
      60             : 
      61             : #include "WCETarcog.hpp"
      62             : 
      63             : namespace EnergyPlus {
      64             : 
      65             : // Forward declarations
      66             : struct EnergyPlusData;
      67             : 
      68             : namespace DataSurfaces {
      69             :     struct SurfaceData;
      70             : }
      71             : namespace DataHeatBalance {
      72             :     struct ZoneData;
      73             : }
      74             : 
      75             : namespace HeatBalanceSurfaceManager {
      76             : 
      77             :     // Initialization routines for module
      78             : 
      79             :     // Algorithms for the module
      80             :     // These old external subroutines have been moved into the namespace and are no longer externals
      81             :     // CalcHeatBalanceOutsideSurf  ! The heat balance routines are now public because the
      82             :     //  CalcHeatBalanceInsideSurf   ! radiant systems need access to them in order to simulate
      83             : 
      84             :     // Record Keeping/Utility Routines for Module
      85             : 
      86             :     // Reporting routines for module
      87             : 
      88             :     // Functions
      89             : 
      90             :     void ManageSurfaceHeatBalance(EnergyPlusData &state);
      91             : 
      92             :     // Beginning Initialization Section of the Module
      93             :     //******************************************************************************
      94             : 
      95             :     void UpdateVariableAbsorptances(EnergyPlusData &state);
      96             : 
      97             :     void InitSurfaceHeatBalance(EnergyPlusData &state);
      98             : 
      99             :     void GatherForPredefinedReport(EnergyPlusData &state);
     100             : 
     101             :     void AllocateSurfaceHeatBalArrays(EnergyPlusData &state);
     102             : 
     103             :     void InitThermalAndFluxHistories(EnergyPlusData &state);
     104             : 
     105             :     void EvalOutsideMovableInsulation(EnergyPlusData &state);
     106             : 
     107             :     void EvalInsideMovableInsulation(EnergyPlusData &state);
     108             : 
     109             :     void InitSolarHeatGains(EnergyPlusData &state);
     110             : 
     111             :     void InitIntSolarDistribution(EnergyPlusData &state);
     112             : 
     113             :     void ComputeIntThermalAbsorpFactors(EnergyPlusData &state);
     114             : 
     115             :     void ComputeIntSWAbsorpFactors(EnergyPlusData &state);
     116             : 
     117             :     void ComputeDifSolExcZonesWIZWindows(EnergyPlusData &state);
     118             : 
     119             :     void InitEMSControlledSurfaceProperties(EnergyPlusData &state);
     120             : 
     121             :     void InitEMSControlledConstructions(EnergyPlusData &state);
     122             : 
     123             :     // End Initialization Section of the Module
     124             :     //******************************************************************************
     125             : 
     126             :     // Begin Algorithm Section of the Module
     127             :     //******************************************************************************
     128             : 
     129             :     // Beginning of Record Keeping subroutines for the HB Module
     130             :     // *****************************************************************************
     131             : 
     132             :     void UpdateIntermediateSurfaceHeatBalanceResults(EnergyPlusData &state, ObjexxFCL::Optional_int_const ZoneToResimulate = _);
     133             : 
     134             :     void UpdateNonRepresentativeSurfaceResults(EnergyPlusData &state, ObjexxFCL::Optional_int_const ZoneToResimulate = _);
     135             : 
     136             :     void UpdateFinalSurfaceHeatBalance(EnergyPlusData &state);
     137             : 
     138             :     void UpdateThermalHistories(EnergyPlusData &state);
     139             : 
     140             :     void CalculateZoneMRT(EnergyPlusData &state,
     141             :                           ObjexxFCL::Optional_int_const ZoneToResimulate = _); // if passed in, then only calculate surfaces that have this zone
     142             : 
     143             :     // End of Record Keeping subroutines for the HB Module
     144             :     // *****************************************************************************
     145             : 
     146             :     // Beginning of Reporting subroutines for the HB Module
     147             :     // *****************************************************************************
     148             : 
     149             :     void ReportSurfaceHeatBalance(EnergyPlusData &state);
     150             : 
     151             :     void ReportNonRepresentativeSurfaceResults(EnergyPlusData &state);
     152             : 
     153             :     void ReportIntMovInsInsideSurfTemp(EnergyPlusData &state);
     154             : 
     155             :     void CalcThermalResilience(EnergyPlusData &state);
     156             : 
     157             :     void ReportThermalResilience(EnergyPlusData &state);
     158             : 
     159             :     void ReportCO2Resilience(EnergyPlusData &state);
     160             : 
     161             :     void ReportVisualResilience(EnergyPlusData &state);
     162             : 
     163             :     // End of Reporting subroutines for the HB Module
     164             : 
     165             :     // Formerly EXTERNAL SUBROUTINES (heavily related to HeatBalanceSurfaceManager) but now moved into namespace HeatBalanceSurfaceManager
     166             : 
     167             :     void
     168             :     CalcHeatBalanceOutsideSurf(EnergyPlusData &state,
     169             :                                ObjexxFCL::Optional_int_const ZoneToResimulate = _); // if passed in, then only calculate surfaces that have this zone
     170             : 
     171             :     void sumSurfQdotRadHVAC(EnergyPlusData &state);
     172             : 
     173             :     Real64 GetQdotConvOutPerArea(EnergyPlusData &state, const int SurfNum);
     174             : 
     175             :     void
     176             :     CalcHeatBalanceInsideSurf(EnergyPlusData &state,
     177             :                               ObjexxFCL::Optional_int_const ZoneToResimulate = _); // if passed in, then only calculate surfaces that have this zone
     178             : 
     179             :     void CalcHeatBalanceInsideSurf2(EnergyPlusData &state,
     180             :                                     const std::vector<int> &HTSurfs,          // Heat transfer surfaces to simulate (opaque and windows)
     181             :                                     const std::vector<int> &IZSurfs,          // Interzone heat transfer surfaces to simulate
     182             :                                     const std::vector<int> &HTNonWindowSurfs, // Non-window heat transfer surfaces to simulate
     183             :                                     const std::vector<int> &HTWindowSurfs,    // Window heat transfer surfaces to simulate
     184             :                                     ObjexxFCL::Optional_int_const ZoneToResimulate = _);
     185             : 
     186             :     void CalcHeatBalanceInsideSurf2CTFOnly(EnergyPlusData &state,
     187             :                                            const int FirstZone,             // First zone to simulate
     188             :                                            const int LastZone,              // Last zone to simulate
     189             :                                            const std::vector<int> &IZSurfs, // Last zone to simulate
     190             :                                            ObjexxFCL::Optional_int_const ZoneToResimulate = _);
     191             : 
     192             :     void
     193             :     TestSurfTempCalcHeatBalanceInsideSurf(EnergyPlusData &state, Real64 TH12, int const SurfNum, DataHeatBalance::ZoneData &zone, int WarmupSurfTemp);
     194             : 
     195             :     void CalcOutsideSurfTemp(EnergyPlusData &state,
     196             :                              int SurfNum,      // Surface number DO loop counter
     197             :                              int spaceNum,     // Space number the current surface is attached to
     198             :                              int ConstrNum,    // Construction index for the current surface
     199             :                              Real64 HMovInsul, // "Convection" coefficient of movable insulation
     200             :                              Real64 TempExt,   // Exterior temperature boundary condition
     201             :                              bool &ErrorFlag   // Error flag for movable insulation problem
     202             :     );
     203             : 
     204             :     void CalcExteriorVentedCavity(EnergyPlusData &state, int SurfNum); // index of surface
     205             : 
     206             :     void GatherComponentLoadsSurfAbsFact(EnergyPlusData &state);
     207             : 
     208             :     Real64 GetSurfIncidentSolarMultiplier(EnergyPlusData &state, int SurfNum);
     209             : 
     210             :     void InitSurfacePropertyViewFactors(EnergyPlusData &state);
     211             : 
     212             :     void GetGroundSurfacesTemperatureAverage(EnergyPlusData &state);
     213             : 
     214             :     void GetGroundSurfacesReflectanceAverage(EnergyPlusData &state);
     215             : 
     216             :     void ReSetGroundSurfacesViewFactor(EnergyPlusData &state, int const SurfNum);
     217             : 
     218             :     void GetSurroundingSurfacesTemperatureAverage(EnergyPlusData &state);
     219             : 
     220             : } // namespace HeatBalanceSurfaceManager
     221             : 
     222             : struct HeatBalSurfMgr : BaseGlobalStruct
     223             : {
     224             : 
     225             :     Array1D<Real64> QExt1;    // Heat flux at the exterior surface during first time step/series
     226             :     Array1D<Real64> QInt1;    // Heat flux at the interior surface during first time step/series
     227             :     Array1D<Real64> TempInt1; // Temperature of interior surface during first time step/series
     228             :     Array1D<Real64> TempExt1; // Temperature of exterior surface during first time step/series
     229             :     Array1D<Real64> Qsrc1;    // Heat source/sink (during first time step/series)
     230             :     Array1D<Real64> Tsrc1;    // Temperature at source/sink (during first time step/series)
     231             :     Array1D<Real64> Tuser1;   // Temperature at the user specified location (during first time step/series)
     232             :     Array1D<Real64> SumTime;  // Amount of time that has elapsed from start of master history to
     233             : 
     234             :     Array1D<Real64> SurfaceAE; // Product of area and emissivity for each surface
     235             :     Array1D<Real64> ZoneAESum; // Sum of area times emissivity for all zone surfaces
     236             : 
     237             :     Array2D<Real64> DiffuseArray;
     238             : 
     239             :     Real64 curQL = 0.0; // radiant value prior to adjustment for pulse for load component report
     240             :     Real64 adjQL = 0.0; // radiant value including adjustment for pulse for load component report
     241             : 
     242             :     bool ManageSurfaceHeatBalancefirstTime = true;
     243             :     bool InitSurfaceHeatBalancefirstTime = true;
     244             :     bool UpdateThermalHistoriesFirstTimeFlag = true;
     245             :     bool CalculateZoneMRTfirstTime = true; // Flag for first time calculations
     246             :     bool reportThermalResilienceFirstTime = true;
     247             :     bool reportVarHeatIndex = false;
     248             :     bool reportVarHumidex = false;
     249             :     bool hasPierceSET = true;
     250             :     bool reportCO2ResilienceFirstTime = true;
     251             :     bool reportVisualResilienceFirstTime = true;
     252             :     std::vector<Real64> lowSETLongestHours;
     253             :     std::vector<Real64> highSETLongestHours;
     254             :     std::vector<int> lowSETLongestStart;
     255             :     std::vector<int> highSETLongestStart;
     256             :     bool calcHeatBalInsideSurfFirstTime = true;
     257             :     bool calcHeatBalInsideSurfCTFOnlyFirstTime = true;
     258             :     int calcHeatBalInsideSurfErrCount = 0;
     259             :     int calcHeatBalInsideSurfErrPointer = 0;
     260             :     int calcHeatBalInsideSurfWarmupErrCount = 0;
     261             :     bool calcHeatBalInsideSurEnvrnFlag = true;
     262             :     Array1D<Real64> RefAirTemp; // inside surface convection reference air temperatures
     263             :     Array1D<Real64> AbsDiffWin =
     264             :         Array1D<Real64>(DataWindowEquivalentLayer::CFSMAXNL); // Diffuse solar absorptance of glass layers //Tuned Made static
     265             :     Array1D<Real64> AbsDiffWinGnd =
     266             :         Array1D<Real64>(DataWindowEquivalentLayer::CFSMAXNL); // Ground diffuse solar absorptance of glass layers //Tuned Made static
     267             :     Array1D<Real64> AbsDiffWinSky =
     268             :         Array1D<Real64>(DataWindowEquivalentLayer::CFSMAXNL); // Sky diffuse solar absorptance of glass layers //Tuned Made static
     269             : 
     270         796 :     void init_state([[maybe_unused]] EnergyPlusData &state) override
     271             :     {
     272         796 :     }
     273             : 
     274           0 :     void clear_state() override
     275             :     {
     276           0 :         QExt1.clear();
     277           0 :         QInt1.clear();
     278           0 :         TempInt1.clear();
     279           0 :         TempExt1.clear();
     280           0 :         Qsrc1.clear();
     281           0 :         Tsrc1.clear();
     282           0 :         Tuser1.clear();
     283           0 :         SumTime.clear();
     284             : 
     285           0 :         SurfaceAE.clear();
     286           0 :         ZoneAESum.clear();
     287             : 
     288           0 :         DiffuseArray.clear();
     289           0 :         curQL = 0.0;
     290           0 :         adjQL = 0.0;
     291             : 
     292           0 :         ManageSurfaceHeatBalancefirstTime = true;
     293           0 :         InitSurfaceHeatBalancefirstTime = true;
     294           0 :         UpdateThermalHistoriesFirstTimeFlag = true;
     295           0 :         CalculateZoneMRTfirstTime = true;
     296           0 :         reportThermalResilienceFirstTime = true;
     297           0 :         reportVarHeatIndex = false;
     298           0 :         reportVarHumidex = false;
     299           0 :         hasPierceSET = true;
     300           0 :         reportCO2ResilienceFirstTime = true;
     301           0 :         reportVisualResilienceFirstTime = true;
     302           0 :         lowSETLongestHours.clear();
     303           0 :         highSETLongestHours.clear();
     304           0 :         lowSETLongestStart.clear();
     305           0 :         highSETLongestStart.clear();
     306           0 :         calcHeatBalInsideSurfFirstTime = true;
     307           0 :         calcHeatBalInsideSurfCTFOnlyFirstTime = true;
     308           0 :         calcHeatBalInsideSurfErrCount = 0;
     309           0 :         calcHeatBalInsideSurfErrPointer = 0;
     310           0 :         calcHeatBalInsideSurfWarmupErrCount = 0;
     311           0 :         calcHeatBalInsideSurEnvrnFlag = true;
     312           0 :         RefAirTemp.clear();
     313           0 :         AbsDiffWin = Array1D<Real64>(DataWindowEquivalentLayer::CFSMAXNL);
     314           0 :         AbsDiffWinGnd = Array1D<Real64>(DataWindowEquivalentLayer::CFSMAXNL);
     315           0 :         AbsDiffWinSky = Array1D<Real64>(DataWindowEquivalentLayer::CFSMAXNL);
     316           0 :     }
     317             : };
     318             : 
     319             : } // namespace EnergyPlus
     320             : 
     321             : #endif

Generated by: LCOV version 1.14