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 DataZoneControls_hh_INCLUDED
49 : #define DataZoneControls_hh_INCLUDED
50 :
51 : // ObjexxFCL Headers
52 : #include <ObjexxFCL/Array1D.hh>
53 :
54 : // EnergyPlus Headers
55 : #include <EnergyPlus/Data/BaseData.hh>
56 : #include <EnergyPlus/DataGlobals.hh>
57 : #include <EnergyPlus/EnergyPlus.hh>
58 :
59 : namespace EnergyPlus {
60 :
61 : namespace DataZoneControls {
62 :
63 : // Average method parameter with multiple people objects in a zone
64 : enum class AverageMethod
65 : {
66 : Invalid = -1,
67 : NO, // No multiple people objects
68 : SPE, // Specific people object
69 : OBJ, // People object average
70 : PEO, // People number average
71 : Num
72 : };
73 :
74 : constexpr std::array<std::string_view, (int)AverageMethod::Num> averageMethodNames = {
75 : "NoMultiplePeopleObjects", "SpecificObject", "ObjectAverage", "PeopleAverage"};
76 : constexpr std::array<std::string_view, (int)AverageMethod::Num> averageMethodNamesUC = {
77 : "NOMULTIPLEPEOPLEOBJECTS", "SPECIFICOBJECT", "OBJECTAVERAGE", "PEOPLEAVERAGE"};
78 :
79 : enum class TempCtrl
80 : {
81 : Invalid = -1,
82 : None,
83 : Constant,
84 : Scheduled,
85 : Num
86 : };
87 :
88 : constexpr std::array<std::string_view, (int)TempCtrl::Num> tempCtrlNames = {"None", "Constant", "Scheduled"};
89 : constexpr std::array<std::string_view, (int)TempCtrl::Num> tempCtrlNamesUC = {"NONE", "CONSTANT", "SCHEDULED"};
90 :
91 : struct TempSetptType
92 : {
93 : std::string Name;
94 : bool isUsed = false;
95 : Sched::Schedule *heatSetptSched = nullptr;
96 : Sched::Schedule *coolSetptSched = nullptr;
97 : };
98 :
99 : struct ZoneTempControls
100 : {
101 : // Members
102 : std::string Name; // Name of the thermostat
103 : std::string ZoneName; // Name of the zone
104 : int ActualZoneNum;
105 :
106 : Sched::Schedule *setptTypeSched = nullptr; // Index for this schedule
107 :
108 : std::array<TempSetptType, (int)HVAC::SetptType::Num> setpts;
109 :
110 : bool ManageDemand; // Flag to indicate whether to use demand limiting
111 : Real64 HeatingResetLimit; // Lowest heating setpoint that can be set by demand manager [C]
112 : Real64 CoolingResetLimit; // Highest cooling setpoint that can be set by demand manager [C]
113 : bool EMSOverrideHeatingSetPointOn; // EMS is calling to override heating setpoint
114 : Real64 EMSOverrideHeatingSetPointValue; // value EMS is directing to use for heating setpoint [C]
115 : bool EMSOverrideCoolingSetPointOn; // EMS is calling to override cooling setpoint
116 : Real64 EMSOverrideCoolingSetPointValue; // value EMS is directing to use for cooling setpoint [C]
117 : TempCtrl OpTempCtrl = TempCtrl::Invalid; // flag to indicate if radiative fraction is scheduled,
118 : // else constant
119 : Real64 FixedRadiativeFraction; // weighting factor for mean radiant temp for Operative temperature
120 : Sched::Schedule *opTempRadiativeFractionSched = nullptr; // schedule for when fraction is scheduled
121 :
122 : bool AdaptiveComfortTempControl; // flag to indicate whether control based on Operative Temp
123 : int AdaptiveComfortModelTypeIndex; // index to adaptive comfort model type
124 :
125 : Real64 ZoneOvercoolRange; // Zone overcool temperature range (max), deg C
126 : TempCtrl OvercoolCtrl = TempCtrl::Invalid; // Flag to indicate if zone overcool range is scheduled
127 : // or constant
128 : Real64 ZoneOvercoolConstRange; // Overcool Range for Zone Air Setpoint Temperature [deltaC]
129 : Sched::Schedule *zoneOvercoolRangeSched = nullptr; // Overcool Range Schedule
130 : Real64 ZoneOvercoolControlRatio; // Zone relative humidity shift per dry-bulb temperature overcooling
131 : // below the original cooling setpoint, %RH/deltaC
132 : Sched::Schedule *dehumidifyingSched = nullptr; // dehumidifying schedule
133 : Real64 DeltaTCutSet; // Temperature difference between cutout and setpoint
134 : Real64 ZoneThermostatSetPointHi; // Cooling setpoint
135 : Real64 ZoneThermostatSetPointLo; // Heating setpoint
136 : bool CoolModeLast;
137 : bool HeatModeLast;
138 : bool CoolModeLastSave;
139 : bool HeatModeLastSave;
140 : bool CoolOffFlag; // Cooling off flag
141 : bool HeatOffFlag; // Heating off flag
142 :
143 : // Default Constructor
144 102 : ZoneTempControls()
145 306 : : ActualZoneNum(0), ManageDemand(false), HeatingResetLimit(0.0), CoolingResetLimit(0.0), EMSOverrideHeatingSetPointOn(false),
146 102 : EMSOverrideHeatingSetPointValue(0.0), EMSOverrideCoolingSetPointOn(false), EMSOverrideCoolingSetPointValue(0.0),
147 102 : FixedRadiativeFraction(0.0), AdaptiveComfortTempControl(false), AdaptiveComfortModelTypeIndex(0), ZoneOvercoolRange(0.0),
148 102 : ZoneOvercoolConstRange(0.0), ZoneOvercoolControlRatio(0.0), DeltaTCutSet(0), ZoneThermostatSetPointHi(0.0),
149 102 : ZoneThermostatSetPointLo(0.0), CoolModeLast(false), HeatModeLast(false), CoolModeLastSave(false), HeatModeLastSave(false),
150 102 : CoolOffFlag(false), HeatOffFlag(false)
151 :
152 : {
153 102 : }
154 : };
155 :
156 : struct ZoneHumidityControls
157 : {
158 : // Members
159 : std::string ControlName; // Name of this humidity controller
160 : std::string ZoneName; // Name of the zone
161 : int ActualZoneNum;
162 : Sched::Schedule *humidifyingSched = nullptr; // humidifying schedule
163 : Sched::Schedule *dehumidifyingSched = nullptr; // dehumidifying schedule
164 : int ErrorIndex; // Error index when LowRH setpoint > HighRH setpoint
165 : bool EMSOverrideHumidifySetPointOn; // EMS is calling to override humidifying setpoint
166 : Real64 EMSOverrideHumidifySetPointValue; // value EMS is directing to use for humidifying setpoint
167 : bool EMSOverrideDehumidifySetPointOn; // EMS is calling to override dehumidifying setpoint
168 : Real64 EMSOverrideDehumidifySetPointValue; // value EMS is directing to use for dehumidifying setpoint
169 :
170 : // Default Constructor
171 8 : ZoneHumidityControls()
172 16 : : ActualZoneNum(0), ErrorIndex(0), EMSOverrideHumidifySetPointOn(false), EMSOverrideHumidifySetPointValue(0.0),
173 8 : EMSOverrideDehumidifySetPointOn(false), EMSOverrideDehumidifySetPointValue(0.0)
174 : {
175 8 : }
176 : };
177 :
178 : struct ComfortSetptType
179 : {
180 : std::string Name;
181 : bool isUsed = false;
182 : Sched::Schedule *heatSetptSched = nullptr;
183 : Sched::Schedule *coolSetptSched = nullptr;
184 : };
185 :
186 : struct ZoneComfortControls
187 : {
188 : // Members
189 : std::string Name; // Name of the thermostat
190 : std::string ZoneName; // Name of the zone
191 : int ActualZoneNum; // Index number of zone
192 : Sched::Schedule *setptTypeSched = nullptr; // Schedule determines which thermostat type is active
193 :
194 : std::array<ComfortSetptType, (int)HVAC::SetptType::Num> setpts; // Type of control
195 :
196 : bool ManageDemand; // Flag to indicate whether to use demand limiting
197 : Real64 HeatingResetLimit; // Lowest heating setpoint that can be set by demand manager [C]
198 : Real64 CoolingResetLimit; // Highest cooling setpoint that can be set by demand manager [C]
199 : bool EMSOverrideHeatingSetPointOn; // EMS is calling to override heating setpoint
200 : Real64 EMSOverrideHeatingSetPointValue; // value EMS is directing to use for heating setpoint
201 : bool EMSOverrideCoolingSetPointOn; // EMS is calling to override cooling setpoint
202 : Real64 EMSOverrideCoolingSetPointValue; // value EMS is directing to use for cooling setpoint
203 : Real64 TdbMaxSetPoint; // Maximum dry-bulb temperature setpoint [C]
204 : Real64 TdbMinSetPoint; // Minimum dry-bulb temperature setpoint [C]
205 : std::string AverageObjectName; // Object Name for Specific Object Average
206 : AverageMethod averageMethod = AverageMethod::Invalid; // Averaging method
207 : int SpecificObjectNum; // People Object number used for Specific people object choice
208 : int PeopleAverageErrIndex; // People average error index
209 : int TdbMaxErrIndex; // Single cooling setpoint error index
210 : int TdbMinErrIndex; // Single heating setpoint error index
211 : int TdbHCErrIndex; // Single heating cooling setpoint error index
212 : int TdbDualMaxErrIndex; // Dual cooling setpoint error index
213 : int TdbDualMinErrIndex; // Dual heating setpoint error index
214 :
215 : // Default Constructor
216 1 : ZoneComfortControls()
217 3 : : ActualZoneNum(0), ManageDemand(false), HeatingResetLimit(0.0), CoolingResetLimit(0.0), EMSOverrideHeatingSetPointOn(false),
218 1 : EMSOverrideHeatingSetPointValue(0.0), EMSOverrideCoolingSetPointOn(false), EMSOverrideCoolingSetPointValue(0.0), TdbMaxSetPoint(50.0),
219 2 : TdbMinSetPoint(0.0), SpecificObjectNum(0), PeopleAverageErrIndex(0), TdbMaxErrIndex(0), TdbMinErrIndex(0), TdbHCErrIndex(0),
220 1 : TdbDualMaxErrIndex(0), TdbDualMinErrIndex(0)
221 : {
222 1 : }
223 : };
224 :
225 : struct ZoneStagedControls
226 : {
227 : // Members
228 : std::string Name; // Name of the thermostat
229 : std::string ZoneName; // Name of the zone
230 : int ActualZoneNum; // Index number of zone
231 : Sched::Schedule *heatSetptBaseSched = nullptr; // schedule which provides zone heating setpoint base
232 : Sched::Schedule *coolSetptBaseSched = nullptr; // schedule which provides zone cooling setpoint base
233 : int NumOfHeatStages; // Number of heating stages
234 : int NumOfCoolStages; // Number of cooling stages
235 : Real64 HeatThroRange; // Heating throttling tempeature range
236 : Real64 CoolThroRange; // Cooling throttling tempeature range
237 : Array1D<Real64> HeatTOffset; // Heating temperature offset
238 : Array1D<Real64> CoolTOffset; // Cooling temperature offset
239 : Real64 HeatSetPoint; // Heating throttling tempeature range
240 : Real64 CoolSetPoint; // Cooling throttling tempeature range
241 : int StageErrCount; // Staged setpoint erro count
242 : int StageErrIndex; // Staged setpoint erro index
243 :
244 : // Default Constructor
245 0 : ZoneStagedControls()
246 0 : : ActualZoneNum(0), NumOfHeatStages(0), NumOfCoolStages(0), HeatThroRange(0.0), CoolThroRange(0.0), HeatSetPoint(0.0), CoolSetPoint(0.0),
247 0 : StageErrCount(0), StageErrIndex(0)
248 : {
249 0 : }
250 : };
251 :
252 : struct TStatObject
253 : {
254 : // Members
255 : std::string Name;
256 : int ZoneOrZoneListPtr;
257 : int NumOfZones;
258 : int TempControlledZoneStartPtr;
259 : int ComfortControlledZoneStartPtr;
260 : int StageControlledZoneStartPtr;
261 : bool ZoneListActive;
262 :
263 : // Default Constructor
264 88 : TStatObject()
265 176 : : ZoneOrZoneListPtr(0), NumOfZones(0), TempControlledZoneStartPtr(0), ComfortControlledZoneStartPtr(0), StageControlledZoneStartPtr(0),
266 88 : ZoneListActive(false)
267 : {
268 88 : }
269 : };
270 :
271 : } // namespace DataZoneControls
272 :
273 : struct DataZoneControlsData : BaseGlobalStruct
274 : {
275 : int NumTempControlledZones = 0;
276 : int NumHumidityControlZones = 0;
277 : int NumComfortControlledZones = 0;
278 : int NumTStatStatements = 0;
279 : int NumComfortTStatStatements = 0;
280 : int NumOpTempControlledZones = 0; // number of zones with operative temp control
281 : int NumTempAndHumidityControlledZones = 0; // number of zones with over cool control
282 : bool AnyOpTempControl = false; // flag set true if any zones have op temp control
283 : bool AnyZoneTempAndHumidityControl = false; // flag set true if any zones have over cool control
284 : Array1D_bool StageZoneLogic; // Logical array, A zone with staged thermostat = .TRUE.
285 : Array1D<Real64> OccRoomTSetPointHeat; // occupied heating set point for optimum start period
286 : Array1D<Real64> OccRoomTSetPointCool; // occupied cooling set point for optimum start period
287 : bool GetZoneAirStatsInputFlag = true; // True when need to get input
288 : Array1D<DataZoneControls::ZoneHumidityControls> HumidityControlZone;
289 : Array1D<DataZoneControls::ZoneTempControls> TempControlledZone;
290 : Array1D<DataZoneControls::ZoneComfortControls> ComfortControlledZone;
291 : Array1D<DataZoneControls::TStatObject> TStatObjects;
292 : Array1D<DataZoneControls::TStatObject> ComfortTStatObjects;
293 : Array1D<DataZoneControls::TStatObject> StagedTStatObjects;
294 : Array1D<DataZoneControls::ZoneStagedControls> StageControlledZone;
295 :
296 2126 : void init_constant_state([[maybe_unused]] EnergyPlusData &state) override
297 : {
298 2126 : }
299 :
300 1152 : void init_state([[maybe_unused]] EnergyPlusData &state) override
301 : {
302 1152 : }
303 :
304 2100 : void clear_state() override
305 : {
306 2100 : this->NumTempControlledZones = 0;
307 2100 : this->NumHumidityControlZones = 0;
308 2100 : this->NumComfortControlledZones = 0;
309 2100 : this->NumTStatStatements = 0;
310 2100 : this->NumComfortTStatStatements = 0;
311 2100 : this->NumOpTempControlledZones = 0;
312 2100 : this->NumTempAndHumidityControlledZones = 0;
313 2100 : this->AnyOpTempControl = false;
314 2100 : this->AnyZoneTempAndHumidityControl = false;
315 2100 : this->StageZoneLogic.deallocate();
316 2100 : this->OccRoomTSetPointHeat.deallocate();
317 2100 : this->OccRoomTSetPointCool.deallocate();
318 2100 : this->GetZoneAirStatsInputFlag = true;
319 2100 : this->HumidityControlZone.deallocate();
320 2100 : this->TempControlledZone.deallocate();
321 2100 : this->ComfortControlledZone.deallocate();
322 2100 : this->TStatObjects.deallocate();
323 2100 : this->ComfortTStatObjects.deallocate();
324 2100 : this->StagedTStatObjects.deallocate();
325 2100 : this->StageControlledZone.deallocate();
326 2100 : }
327 : };
328 :
329 : } // namespace EnergyPlus
330 :
331 : #endif
|