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 DataSystemVariables_hh_INCLUDED
49 : #define DataSystemVariables_hh_INCLUDED
50 :
51 : // C++ Headers
52 : #include <string>
53 :
54 : // EnergyPlus Headers
55 : #include <EnergyPlus/Data/EnergyPlusData.hh>
56 : #include <EnergyPlus/EnergyPlus.hh>
57 : #include <EnergyPlus/FileSystem.hh>
58 : #include <EnergyPlus/IOFiles.hh>
59 : #include <EnergyPlus/Timer.hh>
60 :
61 : namespace EnergyPlus {
62 :
63 : // Forward declarations
64 : struct EnergyPlusData;
65 :
66 : namespace DataSystemVariables {
67 :
68 : int constexpr iUnicode_end = 0; // endline value when Unicode file
69 :
70 : // Shading methods
71 : enum class ShadingMethod
72 : {
73 : Invalid = -1,
74 : PolygonClipping,
75 : PixelCounting,
76 : Scheduled,
77 : Imported,
78 : Num
79 : };
80 :
81 : // Functions
82 :
83 : // Helper to try and locate a file in common folders if it's not found directly (such as when passed as a filename only). Looks in current
84 : // working folder, programs folder, etc.
85 : // Returns an empty path if not found.
86 : [[nodiscard]] fs::path CheckForActualFilePath(EnergyPlusData &state,
87 : fs::path const &originalInputFilePath, // path (or filename only) as input for object
88 : const std::string &contextString = std::string());
89 :
90 : void processEnvironmentVariables(EnergyPlusData &state);
91 :
92 : } // namespace DataSystemVariables
93 :
94 : struct SystemVarsData : BaseGlobalStruct
95 : {
96 : bool firstTime = true;
97 :
98 : DataSystemVariables::ShadingMethod shadingMethod = DataSystemVariables::ShadingMethod::PolygonClipping; // defines the shading method used
99 :
100 : bool DDOnly = false; // TRUE if design days (sizingperiod:*) only are to be run.
101 : bool ReverseDD = false; // TRUE if reverse design days (reordering sizingperiod:*) are to be run.
102 : bool DisableGLHECaching = false; // TRUE if caching is to be disabled, for example, during unit tests.
103 : bool FullAnnualRun = false; // TRUE if full annual simulation is to be run.
104 : bool DeveloperFlag = false; // TRUE if developer flag is turned on. (turns on more displays to console)
105 : bool TimingFlag = false; // TRUE if timing flag is turned on. (turns on more timing displays to console)
106 :
107 : bool SutherlandHodgman = true; // TRUE if SutherlandHodgman algorithm for polygon clipping is to be used.
108 : bool SlaterBarsky = false; // TRUE if SlaterBarsky algorithm for polygon clipping is to be used for vertical polygons.
109 : bool DetailedSkyDiffuseAlgorithm = false; // use detailed diffuse shading algorithm for sky (shading transmittance varies)
110 : bool DetailedSolarTimestepIntegration = false; // when true, use detailed timestep integration for all solar,shading, etc.
111 :
112 : bool ReportExtShadingSunlitFrac = false; // when true, the sunlit fraction for all surfaces are exported as a csv format output
113 : bool DisableGroupSelfShading = false; // when true, defined shadowing surfaces group is ignored when calculating sunlit fraction
114 : bool DisableAllSelfShading = false; // when true, all external shadowing surfaces is ignored when calculating sunlit fraction
115 : bool DisableSelfShadingWithinGroup = false;
116 : bool DisableSelfShadingBetweenGroup = false;
117 :
118 : int shadingGroupsNum = 0; // number of shading groups
119 : Array1D_string shadingGroupZoneListNames; // array of zone names in user input
120 :
121 : bool TrackAirLoopEnvFlag = false; // If TRUE generates a file with runtime statistics for each HVAC
122 : // controller on each air loop
123 : bool TraceAirLoopEnvFlag = false; // If TRUE generates a trace file with the converged solutions of all
124 : // HVAC controllers on each air loop at each call to SimAirLoop()
125 : bool TraceHVACControllerEnvFlag = false; // If TRUE generates a trace file for each individual HVAC
126 : // controller with all controller iterations
127 :
128 : bool ReportDuringWarmup = false; // True when the report outputs even during warmup
129 : bool ReportDuringHVACSizingSimulation = false; // true when reporting outputs during HVAC sizing Simulation
130 : bool ReportDetailedWarmupConvergence = false; // True when the detailed warmup convergence is requested
131 : bool UpdateDataDuringWarmupExternalInterface = false; // variable sets in the external interface.
132 :
133 : // This update the value during the warmup added for FMI
134 : Timer runtimeTimer;
135 : std::string MinReportFrequency; // String for minimum reporting frequency
136 : bool SortedIDD = true; // after processing, use sorted IDD to obtain Defs, etc.
137 : bool lMinimalShadowing = false; // TRUE if Minimal is to override Solar Distribution flag
138 : fs::path envinputpath1;
139 : fs::path envinputpath2;
140 : bool TestAllPaths = false;
141 : int iEnvSetThreads = 0;
142 : bool lEnvSetThreadsInput = false;
143 : int iepEnvSetThreads = 0;
144 : bool lepSetThreadsInput = false;
145 : int iIDFSetThreads = 0;
146 : bool lIDFSetThreadsInput = false;
147 : int inumActiveSims = 1;
148 : bool lnumActiveSims = false;
149 : int MaxNumberOfThreads = 1;
150 : int NumberIntRadThreads = 1;
151 : int iNominalTotSurfaces = 0;
152 : bool Threading = false;
153 : bool ciForceTimeStep = false;
154 :
155 2126 : void init_constant_state([[maybe_unused]] EnergyPlusData &state) override
156 : {
157 2126 : }
158 :
159 1152 : void init_state([[maybe_unused]] EnergyPlusData &state) override
160 : {
161 1152 : }
162 :
163 2100 : void clear_state() override
164 : {
165 2100 : shadingMethod = DataSystemVariables::ShadingMethod::PolygonClipping;
166 2100 : DDOnly = false;
167 2100 : ReverseDD = false;
168 2100 : DisableGLHECaching = false;
169 2100 : FullAnnualRun = false;
170 2100 : DeveloperFlag = false;
171 2100 : TimingFlag = false;
172 :
173 2100 : firstTime = true;
174 :
175 2100 : SutherlandHodgman = true;
176 2100 : SlaterBarsky = false;
177 2100 : DetailedSkyDiffuseAlgorithm = false;
178 2100 : DetailedSolarTimestepIntegration = false;
179 :
180 2100 : ReportExtShadingSunlitFrac = false;
181 2100 : DisableGroupSelfShading = false;
182 2100 : DisableAllSelfShading = false;
183 :
184 2100 : TrackAirLoopEnvFlag = false;
185 2100 : TraceAirLoopEnvFlag = false;
186 2100 : TraceHVACControllerEnvFlag = false;
187 :
188 2100 : ReportDuringWarmup = false;
189 2100 : ReportDuringHVACSizingSimulation = false;
190 2100 : ReportDetailedWarmupConvergence = false;
191 2100 : UpdateDataDuringWarmupExternalInterface = false;
192 :
193 2100 : runtimeTimer = Timer{};
194 2100 : SortedIDD = true;
195 2100 : lMinimalShadowing = false;
196 2100 : TestAllPaths = false;
197 2100 : iEnvSetThreads = 0;
198 2100 : lEnvSetThreadsInput = false;
199 2100 : iepEnvSetThreads = 0;
200 2100 : lepSetThreadsInput = false;
201 2100 : iIDFSetThreads = 0;
202 2100 : lIDFSetThreadsInput = false;
203 2100 : inumActiveSims = 1;
204 2100 : lnumActiveSims = false;
205 2100 : MaxNumberOfThreads = 1;
206 2100 : NumberIntRadThreads = 1;
207 2100 : iNominalTotSurfaces = 0;
208 2100 : Threading = false;
209 2100 : }
210 : };
211 :
212 : } // namespace EnergyPlus
213 :
214 : #endif
|