LCOV - code coverage report
Current view: top level - EnergyPlus - HeatBalanceManager.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 % 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 HeatBalanceManager_hh_INCLUDED
      49              : #define HeatBalanceManager_hh_INCLUDED
      50              : 
      51              : // ObjexxFCL Headers
      52              : #include <ObjexxFCL/Array1D.hh>
      53              : #include <ObjexxFCL/Array2D.hh>
      54              : 
      55              : // EnergyPlus Headers
      56              : #include <EnergyPlus/Data/BaseData.hh>
      57              : #include <EnergyPlus/EnergyPlus.hh>
      58              : #include <EnergyPlus/FileSystem.hh>
      59              : #include <EnergyPlus/SurfaceOctree.hh>
      60              : 
      61              : namespace EnergyPlus {
      62              : 
      63              : // Forward declarations
      64              : struct EnergyPlusData;
      65              : 
      66              : namespace HeatBalanceManager {
      67              : 
      68              :     struct WarmupConvergence
      69              :     {
      70              :         // Members
      71              :         Array1D_int PassFlag; // one flag (1=Fail), (2=Pass) for each of the 4 conditions of convergence from
      72              :         // warmup (PassFlag(1)=Max Temp, PassFlag(2)=Min Temp, PassFlag(3)=Max Heat Load
      73              :         // PassFlag(4)=Max Cool Load)
      74              :         // Following are stored test values for temperature and loads convergence
      75              :         Real64 TestMaxTempValue;     // Max Temperature convergence value=ABS(MaxTempPrevDay(ZoneNum)-MaxTempZone(ZoneNum))
      76              :         Real64 TestMinTempValue;     // Min Temperature convergence value=ABS(MinTempPrevDay(ZoneNum)-MinTempZone(ZoneNum))
      77              :         Real64 TestMaxHeatLoadValue; // Max Heat Load convergence value=
      78              :         //  ABS((MaxHeatLoadZone(ZoneNum)-MaxHeatLoadPrevDay(ZoneNum))/MaxHeatLoadZone(ZoneNum))
      79              :         Real64 TestMaxCoolLoadValue; // Max Cool Load convergence value=
      80              :         //  ABS((MaxCoolLoadZone(ZoneNum)-MaxCoolLoadPrevDay(ZoneNum))/MaxCoolLoadZone(ZoneNum))
      81              : 
      82              :         // Default Constructor
      83          209 :         WarmupConvergence() : PassFlag(4, 2), TestMaxTempValue(0.0), TestMinTempValue(0.0), TestMaxHeatLoadValue(0.0), TestMaxCoolLoadValue(0.0)
      84              :         {
      85          209 :         }
      86              :     };
      87              : 
      88              :     void ManageHeatBalance(EnergyPlusData &state);
      89              : 
      90              :     void GetHeatBalanceInput(EnergyPlusData &state);
      91              : 
      92              :     void CheckUsedConstructions(EnergyPlusData &state, [[maybe_unused]] bool &ErrorsFound);
      93              : 
      94              :     bool CheckValidSimulationObjects(EnergyPlusData &state);
      95              : 
      96              :     void SetPreConstructionInputParameters(EnergyPlusData &state);
      97              : 
      98              :     void GetProjectControlData(EnergyPlusData &state, bool &ErrorsFound); // Set to true if errors detected during getting data
      99              : 
     100              :     void GetSiteAtmosphereData(EnergyPlusData &state, bool &ErrorsFound);
     101              : 
     102              :     void GetConstructData(EnergyPlusData &state, bool &ErrorsFound); // If errors found in input
     103              : 
     104              :     void GetBuildingData(EnergyPlusData &state, bool &ErrorsFound); // If errors found in input
     105              : 
     106              :     void GetZoneData(EnergyPlusData &state, bool &ErrorsFound); // If errors found in input
     107              : 
     108              :     void GetSpaceData(EnergyPlusData &state, bool &ErrorsFound);
     109              : 
     110              :     int GetGeneralSpaceTypeNum(EnergyPlusData &state);
     111              : 
     112              :     void GetZoneLocalEnvData(EnergyPlusData &state, bool &ErrorsFound); // If errors found in input
     113              : 
     114              :     void ProcessZoneData(EnergyPlusData &state,
     115              :                          std::string const &cCurrentModuleObject,
     116              :                          int const ZoneLoop,
     117              :                          Array1D_string const &cAlphaArgs,
     118              :                          int const NumAlphas,
     119              :                          Array1D<Real64> const &rNumericArgs,
     120              :                          int const NumNumbers,
     121              :                          Array1D_bool const &lNumericFieldBlanks, // Unused
     122              :                          Array1D_bool const &lAlphaFieldBlanks,
     123              :                          Array1D_string const &cAlphaFieldNames,
     124              :                          Array1D_string const &cNumericFieldNames, // Unused
     125              :                          bool &ErrorsFound                         // If errors found in input
     126              :     );
     127              : 
     128              :     void InitHeatBalance(EnergyPlusData &state);
     129              : 
     130              :     void AllocateZoneHeatBalArrays(EnergyPlusData &state);
     131              : 
     132              :     void AllocateHeatBalArrays(EnergyPlusData &state);
     133              : 
     134              :     void RecKeepHeatBalance(EnergyPlusData &state);
     135              : 
     136              :     void CheckWarmupConvergence(EnergyPlusData &state);
     137              : 
     138              :     void ReportWarmupConvergence(EnergyPlusData &state);
     139              : 
     140              :     void UpdateWindowFaceTempsNonBSDFWin(EnergyPlusData &state);
     141              : 
     142              :     void ReportHeatBalance(EnergyPlusData &state);
     143              : 
     144              :     void OpenShadingFile(EnergyPlusData &state);
     145              : 
     146              :     void GetFrameAndDividerData(EnergyPlusData &state); // set to true if errors found in input
     147              : 
     148              :     void SearchWindow5DataFile(EnergyPlusData &state,
     149              :                                fs::path const &DesiredFilePath,            // File path (or just name) that contains the Window5 constructions.
     150              :                                std::string const &DesiredConstructionName, // Name that will be searched for in the Window5 data file
     151              :                                bool &ConstructionFound,                    // True if DesiredConstructionName is in the Window5 data file
     152              :                                bool &EOFonFile,                            // True if EOF during file read
     153              :                                bool &ErrorsFound                           // True if there is a problem with the entry requested from the data file
     154              :     );
     155              : 
     156              :     void SetStormWindowControl(EnergyPlusData &state);
     157              : 
     158              :     void CreateFCfactorConstructions(EnergyPlusData &state,
     159              :                                      int &ConstrNum,   // Counter for Constructions
     160              :                                      bool &ErrorsFound // If errors found in input
     161              :     );
     162              : 
     163              :     void CreateAirBoundaryConstructions(EnergyPlusData &state,
     164              :                                         int &ConstrNum,   // Counter for Constructions
     165              :                                         bool &ErrorsFound // If errors found in input
     166              :     );
     167              : 
     168              :     void GetIncidentSolarMultiplier(EnergyPlusData &state, bool &ErrorsFound);
     169              : 
     170              :     void GetScheduledSurfaceGains(EnergyPlusData &state, bool &ErrorsFound); // If errors found in input
     171              : 
     172              :     void CheckScheduledSurfaceGains(EnergyPlusData &state, int const ZoneNum); // Zone number for which error check will be performed
     173              : 
     174              :     void CreateTCConstructions(EnergyPlusData &state, bool &ErrorsFound); // If errors found in input
     175              : 
     176              :     void SetupComplexFenestrationStateInput(EnergyPlusData &state,
     177              :                                             int &ConstrNum, // num of construction items thus far
     178              :                                             bool &ErrorsFound);
     179              : 
     180              :     void InitConductionTransferFunctions(EnergyPlusData &state);
     181              : 
     182              : } // namespace HeatBalanceManager
     183              : 
     184              : struct HeatBalanceMgrData : BaseGlobalStruct
     185              : {
     186              : 
     187              :     bool ManageHeatBalanceGetInputFlag = true;
     188              :     bool DoReport = false;
     189              :     bool ChangeSet = true; // Toggle for checking storm windows
     190              :     bool FirstWarmupWrite = true;
     191              :     bool WarmupConvergenceWarning = false;
     192              :     bool SizingWarmupConvergenceWarning = false;
     193              :     bool ReportWarmupConvergenceFirstWarmupWrite = true;
     194              : 
     195              :     std::string CurrentModuleObject; // to assist in getting input
     196              :     std::unordered_map<std::string, std::string> UniqueConstructNames;
     197              : 
     198              :     // Real Variables for the Heat Balance Simulation
     199              :     // Variables used to determine warmup convergence
     200              :     Array1D<Real64> MaxCoolLoadPrevDay; // Max cooling load from the previous day
     201              :     Array1D<Real64> MaxCoolLoadZone;    // Maximum zone cooling load from the current day
     202              :     Array1D<Real64> MaxHeatLoadPrevDay; // Max heating load from the previous day
     203              :     Array1D<Real64> MaxHeatLoadZone;    // Maximum zone heating load from the current day
     204              :     Array1D<Real64> MaxTempPrevDay;     // Max temperature from the previous day
     205              :     Array1D<Real64> MaxTempZone;        // Maximum zone temperature from the current day
     206              :     Array1D<Real64> MinTempPrevDay;     // Min temperature from the previous day
     207              :     Array1D<Real64> MinTempZone;        // Minimum zone temperature from the current day
     208              : 
     209              :     // Variables used to report difference in temperature and load from the last two warmup days
     210              :     Array1D<Real64> WarmupTempDiff;     // Temperature difference between the last two warmup days
     211              :     Array1D<Real64> WarmupLoadDiff;     // Zone load differences between the last two warmup days
     212              :     Array1D<Real64> TempZoneSecPrevDay; // Zone air temperature from the second last warmup day
     213              :     Array1D<Real64> LoadZoneSecPrevDay; // Zone load from the second last warmup day
     214              :     Array1D<Real64> TempZonePrevDay;    // Zone air temperature from the previous day
     215              :     Array1D<Real64> LoadZonePrevDay;    // Zone load from the previuos day
     216              :     Array1D<Real64> TempZone;           // Zone air temperature from the current warmup day
     217              :     Array1D<Real64> LoadZone;           // Zone load from the current warmup day
     218              : 
     219              :     Array2D<Real64> TempZoneRpt;       // Zone air temperature to report (average over all warmup days)
     220              :     Array1D<Real64> TempZoneRptStdDev; // Zone air temperature to report (std dev over all warmup days)
     221              :     Array2D<Real64> LoadZoneRpt;       // Zone load to report (average over all warmup days)
     222              :     Array1D<Real64> LoadZoneRptStdDev; // Zone load to report (std dev over all warmup days)
     223              :     Array2D<Real64> MaxLoadZoneRpt;    // Maximum zone load for reporting calcs
     224              : 
     225              :     int CountWarmupDayPoints; // Count of warmup timesteps (to achieve warmup)
     226              : 
     227              :     Array1D<HeatBalanceManager::WarmupConvergence> WarmupConvergenceValues;
     228              :     SurfaceOctreeCube surfaceOctree;
     229              : 
     230         2126 :     void init_constant_state([[maybe_unused]] EnergyPlusData &state) override
     231              :     {
     232         2126 :     }
     233              : 
     234         1152 :     void init_state([[maybe_unused]] EnergyPlusData &state) override
     235              :     {
     236         1152 :     }
     237              : 
     238         2100 :     void clear_state() override
     239              :     {
     240              : 
     241         2100 :         ManageHeatBalanceGetInputFlag = true;
     242         2100 :         UniqueConstructNames.clear();
     243         2100 :         DoReport = false;
     244         2100 :         ChangeSet = true;
     245         2100 :         FirstWarmupWrite = true;
     246         2100 :         WarmupConvergenceWarning = false;
     247         2100 :         SizingWarmupConvergenceWarning = false;
     248         2100 :         ReportWarmupConvergenceFirstWarmupWrite = true;
     249              : 
     250         2100 :         CurrentModuleObject = std::string();
     251         2100 :         MaxCoolLoadPrevDay.clear();
     252         2100 :         MaxCoolLoadZone.clear();
     253         2100 :         MaxHeatLoadPrevDay.clear();
     254         2100 :         MaxHeatLoadZone.clear();
     255         2100 :         MaxTempPrevDay.clear();
     256         2100 :         MaxTempZone.clear();
     257         2100 :         MinTempPrevDay.clear();
     258         2100 :         MinTempZone.clear();
     259         2100 :         WarmupTempDiff.clear();
     260         2100 :         WarmupLoadDiff.clear();
     261         2100 :         TempZoneSecPrevDay.clear();
     262         2100 :         LoadZoneSecPrevDay.clear();
     263         2100 :         TempZonePrevDay.clear();
     264         2100 :         LoadZonePrevDay.clear();
     265         2100 :         TempZone.clear();
     266         2100 :         LoadZone.clear();
     267         2100 :         TempZoneRpt.clear();
     268         2100 :         TempZoneRptStdDev.clear();
     269         2100 :         LoadZoneRpt.clear();
     270         2100 :         LoadZoneRptStdDev.clear();
     271         2100 :         MaxLoadZoneRpt.clear();
     272              : 
     273         2100 :         CountWarmupDayPoints = int();
     274              : 
     275         2100 :         WarmupConvergenceValues.clear();
     276         2100 :         surfaceOctree = SurfaceOctreeCube();
     277         2100 :     }
     278              : };
     279              : 
     280              : } // namespace EnergyPlus
     281              : 
     282              : #endif
        

Generated by: LCOV version 2.0-1