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 DataEnvironment_hh_INCLUDED
49 : #define DataEnvironment_hh_INCLUDED
50 :
51 : // ObjexxFCL Headers
52 : #include <ObjexxFCL/Array1D.hh>
53 :
54 : // EnergyPlus Headers
55 : #include <EnergyPlus/Data/BaseData.hh>
56 : #include <EnergyPlus/EnergyPlus.hh>
57 :
58 : namespace EnergyPlus {
59 :
60 : // Forward declarations
61 : struct EnergyPlusData;
62 :
63 : namespace DataEnvironment {
64 :
65 : enum class GroundTempType
66 : {
67 : Invalid = -1,
68 : BuildingSurface,
69 : Shallow,
70 : Deep,
71 : FCFactorMethod,
72 : Num
73 : };
74 :
75 : Real64 constexpr EarthRadius(6356000.0); // Radius of the Earth (m)
76 : Real64 constexpr AtmosphericTempGradient(0.0065); // Standard atmospheric air temperature gradient (K/m)
77 : Real64 constexpr SunIsUpValue(0.00001); // if Cos Zenith Angle of the sun is >= this value, the sun is "up"
78 : Real64 constexpr StdPressureSeaLevel(101325.0); // Standard barometric pressure at sea level (Pa)
79 :
80 : Real64 OutDryBulbTempAt(EnergyPlusData &state, Real64 Z); // Height above ground (m)
81 :
82 : Real64 OutWetBulbTempAt(EnergyPlusData &state, Real64 Z); // Height above ground (m)
83 :
84 : Real64 WindSpeedAt(const EnergyPlusData &state, Real64 Z); // Height above ground (m)
85 :
86 : Real64 OutBaroPressAt(EnergyPlusData &state, Real64 Z); // Height above ground (m)
87 :
88 : void SetOutBulbTempAt_error(EnergyPlusData &state, std::string const &Settings, Real64 max_height, std::string const &SettingsName);
89 :
90 : } // namespace DataEnvironment
91 :
92 : struct EnvironmentData : BaseGlobalStruct
93 : {
94 : Real64 BeamSolarRad = 0.0; // Current beam normal solar irradiance
95 : bool EMSBeamSolarRadOverrideOn = false; // EMS flag for beam normal solar irradiance
96 : Real64 EMSBeamSolarRadOverrideValue = 0.0; // EMS override value for beam normal solar irradiance
97 : int DayOfMonth = 0; // Current day of the month
98 : int DayOfMonthTomorrow = 0; // Tomorrow's day of the month
99 : int DayOfWeek = 0; // Current day of the week (Sunday=1, Monday=2, ...)
100 : int DayOfWeekTomorrow = 0; // Tomorrow's day of the week (Sunday=1, Monday=2, ...)
101 : int DayOfYear = 0; // Current day of the year (01JAN=1, 02JAN=2, ...)
102 : int DayOfYear_Schedule = 0; // Schedule manager always assumes leap years...
103 : Real64 DifSolarRad = 0.0; // Current sky diffuse solar horizontal irradiance
104 : bool EMSDifSolarRadOverrideOn = false; // EMS flag for sky diffuse solar horizontal irradiance
105 : Real64 EMSDifSolarRadOverrideValue = 0.0; // EMS override value for sky diffuse solar horizontal irradiance
106 : int DSTIndicator = 0; // Daylight Saving Time Indicator (1=yes, 0=no) for Today
107 : Real64 Elevation = 0.0; // Elevation of this building site
108 : bool EndMonthFlag = false; // Set to true on last day of month
109 : bool EndYearFlag = false; // Set to true on the last day of year
110 : Real64 GndReflectanceForDayltg = 0.0; // Ground visible reflectance for use in daylighting calc
111 : Real64 GndReflectance = 0.0; // Ground visible reflectance from input
112 : Real64 GndSolarRad = 0.0; // Current ground reflected radiation
113 : Real64 GroundTempKelvin = 0.0; // Current ground temperature {K}
114 : std::array<Real64, (int)DataEnvironment::GroundTempType::Num> GroundTemp = {0.0, 0.0, 0.0, 0.0};
115 :
116 : int HolidayIndex = 0; // Indicates whether current day is a holiday and if so what type - HolidayIndex=(0-no holiday, 1-holiday type 1, ...)
117 : int HolidayIndexTomorrow = 0; // Tomorrow's Holiday Index
118 : bool IsRain = false; // Surfaces are wet for this time interval
119 : bool IsSnow = false; // Snow on the ground for this time interval
120 : Real64 Latitude = 0.0; // Latitude of building location
121 : Real64 Longitude = 0.0; // Longitude of building location
122 : int Month = 0; // Current calendar month
123 : int MonthTomorrow = 0; // Tomorrow's calendar month
124 : Real64 OutBaroPress = 0.0; // Current outdoor air barometric pressure
125 : Real64 OutDryBulbTemp = 0.0; // Current outdoor air dry bulb temperature
126 : bool EMSOutDryBulbOverrideOn = false; // EMS flag for outdoor air dry bulb temperature
127 : Real64 EMSOutDryBulbOverrideValue = 0.0; // EMS override value for outdoor air dry bulb temperature
128 : Real64 OutHumRat = 0.0; // Current outdoor air humidity ratio
129 : Real64 OutRelHum = 0.0; // Current outdoor relative humidity [%]
130 : Real64 OutRelHumValue = 0.0; // Current outdoor relative humidity value [0.0-1.0]
131 : bool EMSOutRelHumOverrideOn = false; // EMS flag for outdoor relative humidity value
132 : Real64 EMSOutRelHumOverrideValue = 0.0; // EMS override value for outdoor relative humidity value
133 : Real64 OutEnthalpy = 0.0; // Current outdoor enthalpy
134 : Real64 OutAirDensity = 0.0; // Current outdoor air density
135 : Real64 OutWetBulbTemp = 0.0; // Current outdoor air wet bulb temperature
136 : Real64 OutDewPointTemp = 0.0; // Current outdoor dewpoint temperature
137 : bool EMSOutDewPointTempOverrideOn = false; // EMS flag for outdoor dewpoint temperature
138 : Real64 EMSOutDewPointTempOverrideValue = 0.0; // EMS override value for outdoor dewpoint temperature
139 : Real64 SkyTemp = 0.0; // Current sky temperature {C}
140 : Real64 SkyTempKelvin = 0.0; // Current sky temperature {K}
141 : Real64 LiquidPrecipitation = 0.0; // Current liquid precipitation amount (rain) {m}
142 : bool SunIsUp = false; // True when Sun is over horizon, False when not
143 : bool SunIsUpPrevTS = false; // True when Sun is over horizon in the previous timestep, False when not in the previous timestep
144 : bool PreviousSolRadPositive = false; // True when Sun is over horizon at the previous timestep, and BeamSolarRad + GndSolarRad + DifSolarRad > 0.0
145 : Real64 WindDir = 0.0; // Current outdoor air wind direction
146 : bool EMSWindDirOverrideOn = false; // EMS flag for outdoor air wind direction
147 : Real64 EMSWindDirOverrideValue = 0.0; // EMS override value for outdoor air wind direction
148 : Real64 WindSpeed = 0.0; // Current outdoor air wind speed
149 : bool EMSWindSpeedOverrideOn = false; // EMS flag for outdoor air wind speed
150 : Real64 EMSWindSpeedOverrideValue = false; // EMS override value for outdoor air wind speed
151 : Real64 WaterMainsTemp = 0.0; // Current water mains temperature
152 : int Year = 0; // Current calendar year of the simulation from the weather file
153 : int YearTomorrow = 0; // Tomorrow's calendar year of the simulation
154 : Vector3<Real64> SOLCOS = {0.0, 0.0, 0.0}; // Solar direction cosines at current time step
155 : Real64 CloudFraction = 0.0; // Fraction of sky covered by clouds
156 : Real64 HISKF = 0.0; // Exterior horizontal illuminance from sky (lux).
157 : Real64 HISUNF = 0.0; // Exterior horizontal beam illuminance (lux)
158 : Real64 HISUNFnorm = 0.0; // Exterior beam normal illuminance (lux)
159 : Real64 PDIRLW = 0.0; // Luminous efficacy (lum/W) of beam solar radiation
160 : Real64 PDIFLW = 0.0; // Luminous efficacy (lum/W) of sky diffuse solar radiation
161 : Real64 SkyClearness = 0.0; // Sky clearness (see subr. DayltgLuminousEfficacy)
162 : Real64 SkyBrightness = 0.0; // Sky brightness (see subr. DayltgLuminousEfficacy)
163 : Real64 TotalCloudCover = 5.0; // Total Sky Cover (tenth of sky)
164 : Real64 OpaqueCloudCover = 5.0; // Opaque Sky Cover (tenth of sky)
165 : Real64 StdBaroPress = DataEnvironment::StdPressureSeaLevel; // Standard "atmospheric pressure" based on elevation (ASHRAE HOF p6.1)
166 : Real64 StdRhoAir = 0.0; // Standard "rho air" set in WeatherManager - based on StdBaroPress
167 : Real64 rhoAirSTP = 0.0; // Standard density of dry air at 101325 Pa, 20.0C temperature
168 : Real64 TimeZoneNumber = 0.0; // Time Zone Number of building location
169 : Real64 TimeZoneMeridian = 0.0; // Standard Meridian of TimeZone
170 : std::string EnvironmentName; // Current environment name (longer for weather file names)
171 : std::string WeatherFileLocationTitle; // Location Title from Weather File
172 : std::string CurMnDyHr; // Current Month/Day/Hour timestamp info
173 : std::string CurMnDy; // Current Month/Day timestamp info
174 : std::string CurMnDyYr; // Current Month/Day/Year timestamp info
175 : int CurEnvirNum = 0; // current environment number
176 : int TotDesDays = 0; // Total number of Design days to Setup
177 : int TotRunDesPersDays = 0; // Total number of Run Design Periods [Days] (Weather data) to Setup
178 : int CurrentOverallSimDay = 0; // Count of current simulation day in total of all sim days
179 : int TotalOverallSimDays = 0; // Count of all possible simulation days in all environments
180 : int MaxNumberSimYears = 0; // Maximum number of simulation years requested in all RunPeriod statements
181 : int RunPeriodStartDayOfWeek = 0; // Day of week of the first day of the run period. (or design day - day of week)
182 : Real64 CosSolarDeclinAngle = 0.0; // Cosine of the solar declination angle
183 : Real64 EquationOfTime = 0.0; // Value of the equation of time formula
184 : Real64 SinLatitude = 0.0; // Sine of Latitude
185 : Real64 CosLatitude = 0.0; // Cosine of Latitude
186 : Real64 SinSolarDeclinAngle = 0.0; // Sine of the solar declination angle
187 : Real64 TS1TimeOffset = -0.5; // offset when TS=1 for solar calculations
188 : Real64 WeatherFileWindModCoeff = 1.5863; // =(WindBLHeight/WindSensorHeight)**WindExp for conditions at the weather station
189 : Real64 WeatherFileTempModCoeff = 0.0; // =AtmosphericTempGradient*EarthRadius*SensorHeight/(EarthRadius+SensorHeight)
190 : Real64 SiteWindExp = 0.22; // Exponent for the wind velocity profile at the site
191 : Real64 SiteWindBLHeight = 370.0; // Boundary layer height for the wind velocity profile at the site (m)
192 : Real64 SiteTempGradient = 0.0065; // Air temperature gradient coefficient (K/m)
193 :
194 : std::array<bool, (int)DataEnvironment::GroundTempType::Num> GroundTempInputs = {false, false, false, false}; // Ground temperature object input
195 :
196 : bool DisplayWeatherMissingDataWarnings = false; // Display missing/out of range weather warnings
197 : bool IgnoreSolarRadiation = false; // TRUE if all solar radiation is to be ignored
198 : bool IgnoreBeamRadiation = false; // TRUE if beam (aka direct normal) radiation is to be ignored
199 : bool IgnoreDiffuseRadiation = false; // TRUE if diffuse horizontal radiation is to be ignored
200 : bool PrintEnvrnStampWarmup = false;
201 : bool PrintEnvrnStampWarmupPrinted = false;
202 : bool RunPeriodEnvironment = false; // True if Run Period, False if DesignDay
203 : int StartYear = 0; // Start year for Environment
204 : int EndYear = 0; // End year for Environment
205 : std::string EnvironmentStartEnd; // Start/End dates for Environment
206 : bool CurrentYearIsLeapYear =
207 : false; // true when current year is leap year (convoluted logic dealing with whether weather file allows leap years, runperiod inputs.
208 : int varyingLocationSchedIndexLat = 0;
209 : int varyingLocationSchedIndexLong = 0;
210 : int varyingOrientationSchedIndex = 0;
211 : bool forceBeginEnvResetSuppress = false; // for PerformancePrecisionTradeoffs
212 : bool oneTimeCompRptHeaderFlag = true;
213 :
214 796 : void init_state([[maybe_unused]] EnergyPlusData &state) override
215 : {
216 796 : }
217 :
218 0 : void clear_state() override
219 : {
220 0 : new (this) EnvironmentData();
221 0 : }
222 : };
223 :
224 : } // namespace EnergyPlus
225 :
226 : #endif
|