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 DataGlobals_hh_INCLUDED 49 : #define DataGlobals_hh_INCLUDED 50 : 51 : // C++ Headers 52 : #include <functional> 53 : #include <iosfwd> 54 : #include <string> 55 : 56 : // EnergyPlus Headers 57 : #include <EnergyPlus/Data/BaseData.hh> 58 : #include <EnergyPlus/DataGlobalConstants.hh> 59 : #include <EnergyPlus/EnergyPlus.hh> 60 : #include <EnergyPlus/IOFiles.hh> 61 : 62 : namespace EnergyPlus { 63 : 64 : // Forward declarations 65 : struct EnergyPlusData; 66 : 67 : enum class BooleanSwitch 68 : { 69 : Invalid = -1, 70 : No, 71 : Yes, 72 : Num 73 : }; 74 : 75 : struct DataGlobal : BaseGlobalStruct 76 : { 77 : bool BeginDayFlag = false; // True at the start of each day, False after first time step in day 78 : bool BeginEnvrnFlag = false; // True at the start of each environment, False after first time step in environ 79 : bool BeginHourFlag = false; // True at the start of each hour, False after first time step in hour 80 : bool BeginSimFlag = false; // True until any actual simulation (full or sizing) has begun, False after first time step 81 : bool BeginTimeStepFlag = false; // True at the start of each time step, False after first subtime step of time step 82 : int DayOfSim = 0; // Counter for days (during the simulation) 83 : int CalendarYear = 0; // Calendar year of the current day of simulation 84 : std::string CalendarYearChr; // Calendar year of the current day of simulation (character -- for reporting) 85 : bool EndEnvrnFlag = false; // True at the end of each environment (last time step of last hour of last day of environ) 86 : bool EndDesignDayEnvrnsFlag = false; // True at the end of the last design day environment 87 : bool AnnualSimulation = false; 88 : std::string DayOfSimChr = "0"; // Counter for days (during the simulation) (character -- for reporting) 89 : bool runReadVars = false; 90 : bool DDOnlySimulation = false; 91 : bool outputEpJSONConversion = false; 92 : bool outputEpJSONConversionOnly = false; 93 : bool isEpJSON = false; 94 : bool preserveIDFOrder = true; 95 : bool stopSimulation = false; 96 : std::function<void(void *)> externalHVACManager; 97 : bool externalHVACManagerInitialized = false; 98 : Constant::KindOfSim KindOfSim = Constant::KindOfSim::Invalid; 99 : bool sizingAnalysisEioHeaderDoneOnce = false; 100 : bool EndDayFlag = false; // True at the end of each day (last time step of last hour of day) 101 : bool EndHourFlag = false; // True at the end of each hour (last time step of hour) 102 : int PreviousHour = 0; // Previous Hour Index 103 : int HourOfDay = 0; // Counter for hours in a simulation day 104 : Real64 WeightPreviousHour = 0.0; // Weighting of value for previous hour 105 : Real64 WeightNow = 0.0; // Weighting of value for current hour 106 : int NumOfDayInEnvrn = 0; // Number of days in the simulation for a particular environment 107 : bool OverrideTimestep = false; // True if PerformancePrecision object overrides the number of time steps in each hour 108 : int NumOfTimeStepInHour = 0; // Number of time steps in each hour of the simulation 109 : int NumOfZones = 0; // Total number of Zones for simulation 110 : int numSpaces = 0; // Total number of Spaces for simulation 111 : int numSpaceTypes = 0; // Number of unique space types 112 : int TimeStep = 0; // Counter for time steps (fractional hours) 113 : Real64 TimeStepZone = 0.0; // Zone time step in fractional hours 114 : bool WarmupFlag = false; // True during the warmup portion of a simulation 115 : Int64 StdOutputRecordCount = 0; // Count of Standard output records 116 : Int64 StdMeterRecordCount = 0; // Count of Meter output records 117 : bool ZoneSizingCalc = false; // TRUE if zone sizing calculation 118 : bool SysSizingCalc = false; // TRUE if system sizing calculation 119 : bool DoZoneSizing = false; // User input in SimulationControl object 120 : bool DoSystemSizing = false; // User input in SimulationControl object 121 : bool DoPlantSizing = false; // User input in SimulationControl object 122 : bool DoDesDaySim = false; // User input in SimulationControl object 123 : bool DoWeathSim = false; // User input in SimulationControl object 124 : bool DoPureLoadCalc = false; // if true, just run sizing and no full simulation of design days, or weather days, or HVAC Sizing Simulations 125 : bool DoHVACSizingSimulation = false; // User input in SimulationControl object 126 : int HVACSizingSimMaxIterations = 0; // User input in SimulationControl object 127 : bool WeathSimReq = false; // Input has a RunPeriod request 128 : bool DoOutputReporting = false; // TRUE if variables to be written out 129 : bool DoingSizing = false; // TRUE when "sizing" is being performed (some error messages won't be displayed) 130 : bool DoingHVACSizingSimulations = false; // true when HVAC Sizing Simulations are being performed. 131 : bool DoingInputProcessing = false; // TRUE when "IP" is being performed (some error messages are cached) 132 : bool DisplayAllWarnings = false; // True when selection for "DisplayAllWarnings" is entered (turns on other warning flags) 133 : bool DisplayExtraWarnings = false; // True when selection for "DisplayExtraWarnings" is entered 134 : bool DisplayUnusedObjects = false; // True when selection for "DisplayUnusedObjects" is entered 135 : bool DisplayUnusedSchedules = false; // True when selection for "DisplayUnusedSchedules" is entered 136 : bool DisplayAdvancedReportVariables = false; // True when selection for "DisplayAdvancedReportVariables" is entered 137 : bool DisplayZoneAirHeatBalanceOffBalance = false; // True when selection for "DisplayZoneAirHeatBalanceOffBalance" is entered 138 : bool DisplayInputInAudit = false; // True when environmental variable "DisplayInputInAudit" is used 139 : bool CreateMinimalSurfaceVariables = false; // True when selection for "CreateMinimalSurfaceVariables" is entered 140 : Real64 CurrentTime = 0.0; // CurrentTime, in fractional hours, from start of day. Uses Loads time step. 141 : int SimTimeSteps = 0; // Number of (Loads) timesteps since beginning of run period (environment). 142 : int MinutesPerTimeStep = 0; // Minutes per time step calculated from NumTimeStepInHour (number of minutes per load time step) 143 : Real64 TimeStepZoneSec = 0.0; // Seconds per time step 144 : bool MetersHaveBeenInitialized = false; 145 : bool KickOffSimulation = false; // Kick off simulation -- meaning run each environment for 1 or 2 time steps. 146 : bool KickOffSizing = false; // Kick off sizing -- meaning run each environment for 1 or 2 time steps. 147 : bool RedoSizesHVACSimulation = false; // doing kick off simulation for redoing sizes as part of sizing 148 : // bool FinalSizingHVACSizingSimIteration = false; // when doing HVAC sizing Simulation 149 : bool AnyEnergyManagementSystemInModel = false; // true if there is any EMS or Erl in model. otherwise false 150 : bool AnySurfPropOverridesInModel = false; // true if there is any EMS or Erl overriding the surface properties for any surface. 151 : bool AnyConstrOverridesInModel = false; // true if there is any EMS or Erl overriding the constructions for any surface. 152 : bool AndShadingControlInModel = false; // true if there is any window shading control for any fenestration surface 153 : bool AnyLocalEnvironmentsInModel = false; // true if there is any local environmental data objected defined in model, otherwise false 154 : bool AnyPlantInModel = false; // true if there are any plant or condenser loops in model, otherwise false 155 : bool AnyIdealCondEntSetPointInModel = false; // true if there is any ideal condenser entering set point manager in model. 156 : bool RunOptCondEntTemp = false; // true if the ideal condenser entering set point optimization is running 157 : bool CompLoadReportIsReq = false; // true if the extra sizing calcs are performed to create a "pulse" for the load component report 158 : bool isPulseZoneSizing = false; // true during the set of zone sizing calcs that include the "pulse" for the load component report 159 : bool doLoadComponentPulseNow = false; // true for the time step that is the "pulse" for the load component report 160 : bool ShowDecayCurvesInEIO = false; // true if the Radiant to Convective Decay Curves should appear in the EIO file 161 : bool AnySlabsInModel = false; // true if there are any zone-coupled ground domains in the input file 162 : bool AnyBasementsInModel = false; // true if there are any basements in the input file 163 : bool DoCoilDirectSolutions = false; // true if use coil direction solutions 164 : bool createPerfLog = false; // true if the _perflog.csv file should be created and a PerformancePrecisionTradeoffs object is used 165 : void (*fProgressPtr)(int const) = nullptr; 166 : void (*fMessagePtr)(std::string const &) = nullptr; 167 : std::function<void(int const)> progressCallback = nullptr; 168 : std::function<void(const std::string &)> messageCallback = nullptr; 169 : std::function<void(EnergyPlus::Error e, const std::string &)> errorCallback = nullptr; 170 : bool eplusRunningViaAPI = false; 171 : int NumOfWaterHeater = 0; 172 : bool CountNonZoneEquip = true; 173 : int FDsimDay = 0; 174 : int FDnumIterYears = 0; 175 : bool printConsoleOutput = true; 176 : bool installRootOverride = false; 177 : int numThread = 1; 178 : bool AirLoopHVACDOASUsedInSim = false; 179 : 180 796 : void init_state([[maybe_unused]] EnergyPlusData &state) override 181 : { 182 796 : } 183 : 184 0 : void clear_state() override 185 : { 186 0 : new (this) DataGlobal(); 187 0 : } 188 : }; 189 : 190 : } // namespace EnergyPlus 191 : 192 : #endif