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

            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 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              :     bool ManageSurfaceHeatBalancefirstTime = true;
     240              :     bool InitSurfaceHeatBalancefirstTime = true;
     241              :     bool UpdateThermalHistoriesFirstTimeFlag = true;
     242              :     bool CalculateZoneMRTfirstTime = true; // Flag for first time calculations
     243              :     bool reportThermalResilienceFirstTime = true;
     244              :     bool reportVarHeatIndex = false;
     245              :     bool reportVarHumidex = false;
     246              :     bool hasPierceSET = true;
     247              :     bool reportCO2ResilienceFirstTime = true;
     248              :     bool reportVisualResilienceFirstTime = true;
     249              :     std::vector<Real64> lowSETLongestHours;
     250              :     std::vector<Real64> highSETLongestHours;
     251              :     std::vector<int> lowSETLongestStart;
     252              :     std::vector<int> highSETLongestStart;
     253              :     bool calcHeatBalInsideSurfFirstTime = true;
     254              :     bool calcHeatBalInsideSurfCTFOnlyFirstTime = true;
     255              :     int calcHeatBalInsideSurfErrCount = 0;
     256              :     int calcHeatBalInsideSurfErrPointer = 0;
     257              :     int calcHeatBalInsideSurfWarmupErrCount = 0;
     258              :     bool calcHeatBalInsideSurEnvrnFlag = true;
     259              :     Array1D<Real64> RefAirTemp; // inside surface convection reference air temperatures
     260              :     Array1D<Real64> AbsDiffWin =
     261              :         Array1D<Real64>(DataWindowEquivalentLayer::CFSMAXNL); // Diffuse solar absorptance of glass layers //Tuned Made static
     262              :     Array1D<Real64> AbsDiffWinGnd =
     263              :         Array1D<Real64>(DataWindowEquivalentLayer::CFSMAXNL); // Ground diffuse solar absorptance of glass layers //Tuned Made static
     264              :     Array1D<Real64> AbsDiffWinSky =
     265              :         Array1D<Real64>(DataWindowEquivalentLayer::CFSMAXNL); // Sky diffuse solar absorptance of glass layers //Tuned Made static
     266              : 
     267         2126 :     void init_constant_state([[maybe_unused]] EnergyPlusData &state) override
     268              :     {
     269         2126 :     }
     270              : 
     271         1152 :     void init_state([[maybe_unused]] EnergyPlusData &state) override
     272              :     {
     273         1152 :     }
     274              : 
     275         2100 :     void clear_state() override
     276              :     {
     277         2100 :         QExt1.clear();
     278         2100 :         QInt1.clear();
     279         2100 :         TempInt1.clear();
     280         2100 :         TempExt1.clear();
     281         2100 :         Qsrc1.clear();
     282         2100 :         Tsrc1.clear();
     283         2100 :         Tuser1.clear();
     284         2100 :         SumTime.clear();
     285              : 
     286         2100 :         SurfaceAE.clear();
     287         2100 :         ZoneAESum.clear();
     288              : 
     289         2100 :         DiffuseArray.clear();
     290              : 
     291         2100 :         ManageSurfaceHeatBalancefirstTime = true;
     292         2100 :         InitSurfaceHeatBalancefirstTime = true;
     293         2100 :         UpdateThermalHistoriesFirstTimeFlag = true;
     294         2100 :         CalculateZoneMRTfirstTime = true;
     295         2100 :         reportThermalResilienceFirstTime = true;
     296         2100 :         reportVarHeatIndex = false;
     297         2100 :         reportVarHumidex = false;
     298         2100 :         hasPierceSET = true;
     299         2100 :         reportCO2ResilienceFirstTime = true;
     300         2100 :         reportVisualResilienceFirstTime = true;
     301         2100 :         lowSETLongestHours.clear();
     302         2100 :         highSETLongestHours.clear();
     303         2100 :         lowSETLongestStart.clear();
     304         2100 :         highSETLongestStart.clear();
     305         2100 :         calcHeatBalInsideSurfFirstTime = true;
     306         2100 :         calcHeatBalInsideSurfCTFOnlyFirstTime = true;
     307         2100 :         calcHeatBalInsideSurfErrCount = 0;
     308         2100 :         calcHeatBalInsideSurfErrPointer = 0;
     309         2100 :         calcHeatBalInsideSurfWarmupErrCount = 0;
     310         2100 :         calcHeatBalInsideSurEnvrnFlag = true;
     311         2100 :         RefAirTemp.clear();
     312         2100 :         AbsDiffWin = Array1D<Real64>(DataWindowEquivalentLayer::CFSMAXNL);
     313         2100 :         AbsDiffWinGnd = Array1D<Real64>(DataWindowEquivalentLayer::CFSMAXNL);
     314         2100 :         AbsDiffWinSky = Array1D<Real64>(DataWindowEquivalentLayer::CFSMAXNL);
     315         2100 :     }
     316              : };
     317              : 
     318              : } // namespace EnergyPlus
     319              : 
     320              : #endif
        

Generated by: LCOV version 2.0-1