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 SystemAvailabilityManager_hh_INCLUDED
49 : #define SystemAvailabilityManager_hh_INCLUDED
50 :
51 : // ObjexxFCL Headers
52 : #include <ObjexxFCL/Array1D.hh>
53 : #include <ObjexxFCL/Optional.hh>
54 :
55 : // EnergyPlus Headers
56 : #include <EnergyPlus/Data/BaseData.hh>
57 : #include <EnergyPlus/DataGlobals.hh>
58 : #include <EnergyPlus/EnergyPlus.hh>
59 : #include <EnergyPlus/ScheduleManager.hh>
60 :
61 : namespace EnergyPlus {
62 :
63 : // Forward declarations
64 : struct EnergyPlusData;
65 :
66 : namespace Avail {
67 :
68 : // The following parameters are used for system availability
69 : // status. Putting this in SystemAvailabilityManager (where it
70 : // belongs) creates a circular dependecy between
71 : // SystemAvailabilityManager and PlantAvailablityManager which
72 : // needs to be resolved by unifying those two.
73 : enum class Status
74 : {
75 : Invalid = -1,
76 : NoAction,
77 : ForceOff,
78 : CycleOn,
79 : CycleOnZoneFansOnly,
80 : Num
81 : };
82 :
83 : enum class ControlAlgorithm
84 : {
85 : Invalid = -1,
86 : ConstantTemperatureGradient,
87 : AdaptiveTemperatureGradient,
88 : AdaptiveASHRAE,
89 : ConstantStartTime,
90 : Num
91 : };
92 :
93 : // Cycling Run Time Control Type
94 : enum class CyclingRunTimeControl
95 : {
96 : Invalid = -1,
97 : FixedRunTime,
98 : Thermostat,
99 : ThermostatWithMinimumRunTime,
100 : Num
101 : };
102 :
103 : enum class NightCycleControlType
104 : {
105 : Invalid = -1,
106 : Off,
107 : OnAny,
108 : OnControlZone,
109 : OnZoneFansOnly,
110 : OnAnyCoolingOrHeatingZone,
111 : OnAnyCoolingZone,
112 : OnAnyHeatingZone,
113 : OnAnyHeatingZoneFansOnly,
114 : Num
115 : };
116 :
117 : // Optimum start parameter definitions
118 : enum class OptimumStartControlType
119 : {
120 : Invalid = -1,
121 : Off,
122 : ControlZone,
123 : MaximumOfZoneList,
124 : Num
125 : };
126 :
127 : enum class ManagerType
128 : {
129 : Invalid = -1,
130 : Scheduled,
131 : ScheduledOn,
132 : ScheduledOff,
133 : NightCycle,
134 : DiffThermo,
135 : HiTempTOff,
136 : HiTempTOn,
137 : LoTempTOff,
138 : LoTempTOn,
139 : NightVent,
140 : HybridVent,
141 : OptimumStart,
142 : Num
143 : };
144 :
145 : struct SysAvailManager
146 : {
147 : // Members
148 : std::string Name; // Name of the manager object
149 : ManagerType type = ManagerType::Invalid; // Integer equivalent of availability manager type
150 : Sched::Schedule *availSched = nullptr; // Schedule pointer
151 : Status availStatus = Status::NoAction; // reports status of availability manager
152 : };
153 :
154 : struct SysAvailManagerScheduled : SysAvailManager // Derived type for Scheduled Sys Avail Managers
155 : {
156 : };
157 :
158 : struct SysAvailManagerScheduledOn : SysAvailManager // Derived type for Scheduled On Sys Avail Managers
159 : {
160 : };
161 :
162 : struct SysAvailManagerScheduledOff : SysAvailManager // Derived type for Scheduled Off Sys Avail Managers
163 : {
164 : };
165 :
166 : struct SysAvailManagerNightCycle : SysAvailManager // Derived type for Night Cycle Sys Avail Managers
167 : {
168 : // Members
169 : Sched::Schedule *fanSched = nullptr; // Fan schedule
170 : // Cycle On Control Zone, or Cycle On Any - Zone Fans Only
171 : Real64 TempTolRange; // range in degrees C of thermostat tolerance
172 : int CyclingTimeSteps; // period (in Loads time steps) system will cycle on.
173 : Status priorAvailStatus = Status::NoAction; // prior status of availability manager
174 : std::string CtrlZoneListName; // controlled zone or zonelist name
175 : int NumOfCtrlZones; // number of controlled zones
176 : Array1D_int CtrlZonePtrs; // pointers to controlled zone(s)
177 : std::string CoolingZoneListName; // coolin zone or zonelist name
178 : int NumOfCoolingZones; // number of cooling zones
179 : Array1D_int CoolingZonePtrs; // pointers to cooling zone(s)
180 : std::string HeatingZoneListName; // heatig zone or zonelist name
181 : int NumOfHeatingZones; // number of heatig zones
182 : Array1D_int HeatingZonePtrs; // pointers to heating zone(s)
183 : std::string HeatZnFanZoneListName; // heating zone fans only zone or zonelist name
184 : int NumOfHeatZnFanZones; // number of heating zone fans only zones
185 : Array1D_int HeatZnFanZonePtrs; // pointers to heating zone fans only zone(s)
186 : CyclingRunTimeControl cyclingRunTimeControl = CyclingRunTimeControl::Invalid; // Cycling Run Time Control Type
187 : NightCycleControlType nightCycleControlType = NightCycleControlType::Invalid; // type of control: Stay Off, Cycle On Any,
188 :
189 : // Default Constructor
190 31 : SysAvailManagerNightCycle()
191 31 : : TempTolRange(1.0), CyclingTimeSteps(1), NumOfCtrlZones(0), NumOfCoolingZones(0), NumOfHeatingZones(0), NumOfHeatZnFanZones(0)
192 : {
193 31 : }
194 : };
195 :
196 : struct SysAvailManagerOptimumStart : SysAvailManager // Derived type for Optimal Start Sys Avail Managers
197 : {
198 : // Members
199 : bool isSimulated; // true after availability manager is simulated
200 :
201 : Sched::Schedule *fanSched = nullptr; // Fan schedule
202 : std::string CtrlZoneName; // Name of the control zone
203 : int ZoneNum; // zone number of control zone
204 : std::string ZoneListName; // Zone List name
205 : int NumOfZones; // Number of zones in the list
206 : Array1D_int ZonePtrs; // Pointers to zones in the list
207 : Real64 MaxOptStartTime; // Maximum value of start time in hours
208 : ControlAlgorithm controlAlgorithm; // Control algorithm: ConstantTemperatureGradient,
209 : // AdaptiveTemperatureGradient, AdaptiveASHRAE, ConstantStartTime
210 : Real64 ConstTGradCool; // Constant temperature gradient in cooling mode, unit: degC per hour
211 : Real64 ConstTGradHeat; // Constant temperature gradient in heating mode, unit: degC per hour
212 : Real64 InitTGradCool; // Initial value for temperature gradient in cooling mode, unit: degC per hour
213 : Real64 InitTGradHeat; // Initial value for temperature gradient in heating mode, unit: degC per hour
214 : Real64 AdaptiveTGradCool; // Calculated adaptive temperature gradient in cooling mode, unit: degC per hour
215 : Real64 AdaptiveTGradHeat; // Calculated adaptive temperature gradient in heating mode, unit: degC per hour
216 : Real64 ConstStartTime; // Constant start time in hours
217 : int NumPreDays; // Number of previous days for adaptive control
218 : Real64 NumHoursBeforeOccupancy;
219 : Real64 TempDiffHi; // temperature difference for cooling mode
220 : Real64 TempDiffLo; // temperature difference for heating mode
221 : int ATGWCZoneNumLo; // zone index for worst case heating zone
222 : int ATGWCZoneNumHi; // zone index for worst case cooling zone
223 : bool CycleOnFlag; // Tracks when air loop has cycled on
224 : bool ATGUpdateFlag1; // updates
225 : bool ATGUpdateFlag2;
226 : bool FirstTimeATGFlag;
227 : bool OverNightStartFlag; // Flag to indicate the optimum start starts before mid night.
228 : bool OSReportVarFlag;
229 : Array1D<Real64> AdaTempGradTrdHeat; // Heating temp gradient for previous days
230 : Array1D<Real64> AdaTempGradTrdCool; // Cooling temp gradient for previous days
231 : Real64 AdaTempGradHeat;
232 : Real64 AdaTempGradCool;
233 : Real64 ATGUpdateTime1;
234 : Real64 ATGUpdateTime2;
235 : Real64 ATGUpdateTemp1;
236 : Real64 ATGUpdateTemp2;
237 : OptimumStartControlType optimumStartControlType =
238 : OptimumStartControlType::Invalid; // Type of control: Stay Off, ControlZone, MaximumofZoneList
239 :
240 : // Default Constructor
241 4 : SysAvailManagerOptimumStart()
242 20 : : isSimulated(false), ZoneNum(0), NumOfZones(0), MaxOptStartTime(6.0), controlAlgorithm(ControlAlgorithm::Invalid), ConstTGradCool(1.0),
243 4 : ConstTGradHeat(1.0), InitTGradCool(1.0), InitTGradHeat(1.0), AdaptiveTGradCool(1.0), AdaptiveTGradHeat(1.0), ConstStartTime(2.0),
244 4 : NumPreDays(1), NumHoursBeforeOccupancy(0.0), TempDiffHi(0.0), TempDiffLo(0.0), ATGWCZoneNumLo(0), ATGWCZoneNumHi(0), CycleOnFlag(false),
245 4 : ATGUpdateFlag1(false), ATGUpdateFlag2(false), FirstTimeATGFlag(true), OverNightStartFlag(false), OSReportVarFlag(false),
246 4 : AdaTempGradHeat(0.0), AdaTempGradCool(0.0), ATGUpdateTime1(0.0), ATGUpdateTime2(0.0), ATGUpdateTemp1(0.0), ATGUpdateTemp2(0.0)
247 : {
248 4 : }
249 :
250 : void SetOptStartFlag(EnergyPlusData &state, int const AirLoopNum);
251 : };
252 :
253 : struct DefineASHRAEAdaptiveOptimumStartCoeffs // Derived type for Differential Thermostat Sys Avail Managers
254 : {
255 : // Members
256 : std::string Name; // Name of the object
257 : Real64 Coeff1; // 1st Coefficient of the equation
258 : Real64 Coeff2; // 2nd Coefficient of the equation
259 : Real64 Coeff3; // 3rd Coefficient of the equation
260 : Real64 Coeff4; // 4th Coefficient of the equation
261 :
262 : // Default Constructor
263 : DefineASHRAEAdaptiveOptimumStartCoeffs() : Coeff1(0.0), Coeff2(0.0), Coeff3(0.0), Coeff4(0.0)
264 : {
265 : }
266 : };
267 :
268 : struct SysAvailManagerDiffThermo : SysAvailManager // Derived type for Differential Thermostat Sys Avail Managers
269 : {
270 : // Members
271 : int HotNode; // "Hot" sensor node
272 : int ColdNode; // "Cold" sensor node
273 : Real64 TempDiffOn; // Temperature difference for turn on (delta C)
274 : Real64 TempDiffOff; // Temperature difference for turn off (delta C)
275 :
276 : // Default Constructor
277 0 : SysAvailManagerDiffThermo() : HotNode(0), ColdNode(0), TempDiffOn(0.0), TempDiffOff(0.0)
278 : {
279 0 : }
280 : };
281 :
282 : struct SysAvailManagerHiLoTemp : SysAvailManager // Derived type for High/Low Temperature On/Off Sys Avail Managers
283 : {
284 : // Members
285 : int Node; // Sensor node
286 : Real64 Temp; // Temperature for on/off (C)
287 :
288 : // Default Constructor
289 2 : SysAvailManagerHiLoTemp() : Node(0), Temp(0.0)
290 : {
291 2 : }
292 : };
293 :
294 : struct SysAvailManagerNightVent : SysAvailManager
295 : {
296 : // Members
297 : Sched::Schedule *fanSched = nullptr; // Fan schedule
298 : Sched::Schedule *ventTempSched = nullptr; // Ventilation temperature schedule
299 : Real64 VentDelT; // Ventilation delta T [deltaC]
300 : Real64 VentTempLowLim; // ventilation temperature low limit
301 : std::string CtrlZoneName; // Name of the control zone
302 : int ZoneNum; // zome number of control zone
303 : Real64 VentFlowFrac; // the night venting flow fraction
304 :
305 : // Default Constructor
306 0 : SysAvailManagerNightVent() : VentDelT(0.0), VentTempLowLim(0.0), ZoneNum(0), VentFlowFrac(0.0)
307 : {
308 0 : }
309 : };
310 :
311 : // Hybrid Ventilation parameters
312 : enum class VentCtrlType
313 : {
314 : Invalid = -1,
315 : No, // No hybrid ventilation control
316 : Temp, // Temperature control
317 : Enth, // Enthalpy control
318 : DewPoint, // Dew point control
319 : OA, // Outdoor air control
320 : OperT80, // Operative temperature control with 80% acceptability limits
321 : OperT90, // Operative temperature control with 90% acceptability limits
322 : CO2, // CO2 control
323 : Num
324 : };
325 :
326 : enum class VentCtrlStatus
327 : {
328 : Invalid = -1,
329 : NoAction, // No hybrid ventilation control
330 : Open, // Open windows or doors
331 : Close, // Close windows or doors
332 : Num
333 : };
334 :
335 : struct SysAvailManagerHybridVent : SysAvailManager
336 : {
337 : // Members
338 : std::string AirLoopName; // Name of HVAC Air Loop
339 : int AirLoopNum; // HVAC Air Loop number
340 : std::string ControlZoneName; // Controlled zone name
341 : int NodeNumOfControlledZone; // Controlled zone node number
342 : int ControlledZoneNum; // Controlled zone number
343 : Sched::Schedule *controlModeSched = nullptr; // Ventilation control mode schedule
344 : VentCtrlType ctrlType = VentCtrlType::No; // hybrid ventilation control mode
345 : VentCtrlStatus ctrlStatus = VentCtrlStatus::NoAction; // Ventilation control type: Noaction, Close, Open
346 : Real64 MinOutdoorTemp; // Minimum Outdoor Temperature [C]
347 : Real64 MaxOutdoorTemp; // Maximum Outdoor Temperature [C]
348 : Real64 MinOutdoorEnth; // Minimum Outdoor Enthalpy [J/kg]
349 : Real64 MaxOutdoorEnth; // Maximum Outdoor Enthalpy [J/kg]
350 : Real64 MinOutdoorDewPoint; // Minimum Outdoor Dew point temperature [C]
351 : Real64 MaxOutdoorDewPoint; // Maximum Outdoor Dew Point Temperature [C]
352 : Real64 MaxWindSpeed; // Maximum Wind speed [m/s]
353 : bool UseRainIndicator; // Use WeatherFile Rain Indicators
354 : Sched::Schedule *minOASched = nullptr; // Minimum Outdoor Ventilation Air Schedule
355 : int DewPointNoRHErrCount; // Dewpoint control mode error count without a humidistat
356 : int DewPointNoRHErrIndex; // Dewpoint control mode error index without a humidistat
357 : int DewPointErrCount; // Dewpoint control mode error count without a valid humidistat
358 : int DewPointErrIndex; // Dewpoint control mode error index without a valid humidistat
359 : int SingleHCErrCount; // Temperature and enthalpy control mode error count
360 : // with a singleHeatingCooling setpoint
361 : int SingleHCErrIndex; // Temperature and enthalpy control mode error index
362 : // with a singleHeatingCooling setpoint
363 : int OpeningFactorFWS; // Opening factor modifier as a function of wind speed
364 :
365 : Sched::Schedule *afnControlTypeSched = nullptr; // AirflowNetwork control type schedule pointer
366 : Sched::Schedule *simpleControlTypeSched = nullptr; // Simple airflow object control type schedule pointer
367 : int VentilationPtr; // Ventilation object name pointer
368 : std::string VentilationName; // Ventilation object name
369 : bool HybridVentMgrConnectedToAirLoop; // Flag to check whether hybrid ventilation
370 : // manager is connected to air loop
371 : bool SimHybridVentSysAvailMgr; // Set to false when a zone has two hybrid ventilation
372 : // managers, one with air loop and one without
373 : Real64 OperativeTemp; // Zone air operative temperature [C]
374 : Real64 CO2; // Zone air CO2 [ppm]
375 : Real64 MinOperTime; // Minimum HVAC Operation Time [minutes]
376 : Real64 MinVentTime; // Minimum Ventilation Time [minutes]
377 : Real64 TimeOperDuration; // Time duration with continuous HVAC operation [minutes]
378 : Real64 TimeVentDuration; // Time duration with continuous ventilation [minutes]
379 : Real64 minAdaTem; // minimum adaptive temperature for adaptive temperature control [C]
380 : Real64 maxAdaTem; // maximum adaptive temperature for adaptive temperature control [C]
381 :
382 : int afnControlStatus = 0;
383 : int Master = 0;
384 : Real64 WindModifier = 0.0;
385 :
386 : // Default Constructor
387 2 : SysAvailManagerHybridVent()
388 6 : : AirLoopNum(0), NodeNumOfControlledZone(0), ControlledZoneNum(0), MinOutdoorTemp(-100.0), MaxOutdoorTemp(100.0), MinOutdoorEnth(0.1),
389 2 : MaxOutdoorEnth(300000.0), MinOutdoorDewPoint(-100.0), MaxOutdoorDewPoint(100.0), MaxWindSpeed(0.0), UseRainIndicator(true),
390 2 : DewPointNoRHErrCount(0), DewPointNoRHErrIndex(0), DewPointErrCount(0), DewPointErrIndex(0), SingleHCErrCount(0), SingleHCErrIndex(0),
391 4 : OpeningFactorFWS(0), VentilationPtr(0), HybridVentMgrConnectedToAirLoop(true), SimHybridVentSysAvailMgr(false), OperativeTemp(0.0),
392 2 : CO2(0.0), MinOperTime(0.0), MinVentTime(0.0), TimeOperDuration(0.0), TimeVentDuration(0.0), minAdaTem(0.0), maxAdaTem(0.0)
393 : {
394 2 : }
395 : };
396 :
397 : struct AvailManagerNTN
398 : {
399 : std::string Name;
400 : ManagerType type;
401 : int Num;
402 : };
403 :
404 : struct List // LOL
405 : {
406 : // Members
407 : std::string Name; // Availability Manager List Name
408 : int NumItems = 0;
409 : Array1D<AvailManagerNTN> availManagers;
410 : };
411 :
412 : struct DefineZoneCompAvailMgrs
413 : {
414 : // Members
415 : int NumAvailManagers = 0; // number of availability managers for this system
416 : Status availStatus = Status::NoAction; // system availability status
417 : int StartTime = 0; // cycle on time (in SimTimeSteps)
418 : int StopTime = 0; // cycle off time (in SimTimeSteps)
419 : std::string AvailManagerListName; // name of each availability manager
420 : Array1D<AvailManagerNTN> availManagers; // type of availability manager
421 : int ZoneNum = 0; // cycle off time (in SimTimeSteps)
422 : bool Input = true; // starts off as true to initialize zone equipment availability manager data
423 : int Count = 0; // initialize twice to ensure zone equipment availability manager list name has been read in
424 : };
425 :
426 : struct ZoneCompTypeData
427 : {
428 : // Members
429 : Array1D<DefineZoneCompAvailMgrs> ZoneCompAvailMgrs;
430 : int TotalNumComp = 0; // total number of components of a zone equip type
431 : };
432 :
433 : void ManageSystemAvailability(EnergyPlusData &state);
434 :
435 : void GetSysAvailManagerInputs(EnergyPlusData &state);
436 :
437 : void GetSysAvailManagerListInputs(EnergyPlusData &state);
438 :
439 : void GetPlantAvailabilityManager(EnergyPlusData &state,
440 : std::string const &AvailabilityListName, // name that should be an Availability Manager List Name
441 : int const Loop, // which loop this is
442 : int const NumPlantLoops, // Total number of plant loops
443 : bool &ErrorsFound // true if certain errors are detected here
444 : );
445 :
446 : void GetAirLoopAvailabilityManager(EnergyPlusData &state,
447 : std::string const &AvailabilityListName, // name that should be an Availability Manager List Name
448 : int const Loop, // which loop this is
449 : int const NumAirLoops, // Total number of air loops
450 : bool &ErrorsFound // true if certain errors are detected here
451 : );
452 :
453 : void GetZoneEqAvailabilityManager(EnergyPlusData &state,
454 : int const ZoneEquipType, // Type of ZoneHVAC:* component
455 : int const CompNum, // Index of a particular ZoneHVAC:* component
456 : bool &ErrorsFound // true if certain errors are detected here
457 : );
458 :
459 : void InitSysAvailManagers(EnergyPlusData &state);
460 :
461 : Status SimSysAvailManager(EnergyPlusData &state,
462 : ManagerType const type,
463 : std::string const &SysAvailName,
464 : int &SysAvailNum,
465 : int const PriAirSysNum, // Primary Air System index. If being called for a ZoneHVAC:* component
466 : Status const previousStatus,
467 : ObjexxFCL::Optional_int_const ZoneEquipType = _, // Type of ZoneHVAC:* equipment component
468 : ObjexxFCL::Optional_int_const CompNum = _ // Index of ZoneHVAC:* equipment component
469 : );
470 :
471 : Status CalcSchedSysAvailMgr(EnergyPlusData &state,
472 : int const SysAvailNum // number of the current scheduled system availability manager
473 : );
474 :
475 : Status CalcSchedOnSysAvailMgr(EnergyPlusData &state,
476 : int const SysAvailNum // number of the current scheduled on system availability manager
477 : );
478 :
479 : Status CalcSchedOffSysAvailMgr(EnergyPlusData &state,
480 : int const SysAvailNum // number of the current scheduled off system availability manager
481 : );
482 :
483 : Status CalcNCycSysAvailMgr(EnergyPlusData &state,
484 : int const SysAvailNum, // number of the current scheduled system availability manager
485 : int const PriAirSysNum, // number of the primary air system affected by this Avail. Manager
486 : ObjexxFCL::Optional_int_const ZoneEquipType = _, // Type of ZoneHVAC equipment component
487 : ObjexxFCL::Optional_int_const CompNum = _ // Index of ZoneHVAC equipment component
488 : );
489 :
490 : bool CoolingZoneOutOfTolerance(EnergyPlusData &state,
491 : Array1D_int const ZonePtrList, // list of controlled zone pointers
492 : int const NumZones, // number of zones in list
493 : Real64 const TempTolerance // temperature tolerance
494 : );
495 :
496 : bool HeatingZoneOutOfTolerance(EnergyPlusData &state,
497 : Array1D_int const ZonePtrList, // list of controlled zone pointers
498 : int const NumZones, // number of zones in list
499 : Real64 const TempTolerance // temperature tolerance
500 : );
501 :
502 : Status CalcOptStartSysAvailMgr(EnergyPlusData &state,
503 : int const SysAvailNum, // number of the current scheduled system availability manager
504 : int const PriAirSysNum, // number of the primary air system affected by this Avail. Manager
505 : ObjexxFCL::Optional_int_const ZoneEquipType = _, // Type of ZoneHVAC equipment component
506 : ObjexxFCL::Optional_int_const CompNum = _ // Index of ZoneHVAC equipment component
507 : );
508 :
509 : Status CalcNVentSysAvailMgr(EnergyPlusData &state,
510 : int const SysAvailNum, // number of the current scheduled system availability manager
511 : int const PriAirSysNum, // number of the primary air system affected by this Avail. Manager
512 : bool const isZoneEquipType = false // Type of zone equipment component
513 : );
514 :
515 : Status CalcDiffTSysAvailMgr(EnergyPlusData &state,
516 : int const SysAvailNum, // Number of the current scheduled system availability manager
517 : Status const PreviousStatus // System status for the previous timestep
518 : );
519 :
520 : Status CalcHiTurnOffSysAvailMgr(EnergyPlusData &state,
521 : int const SysAvailNum // Number of the current scheduled system availability manager
522 : );
523 :
524 : Status CalcHiTurnOnSysAvailMgr(EnergyPlusData &state,
525 : int const SysAvailNum // Number of the current scheduled system availability manager
526 : );
527 :
528 : Status CalcLoTurnOffSysAvailMgr(EnergyPlusData &state,
529 : int const SysAvailNum // Number of the current scheduled system availability manager
530 : );
531 :
532 : Status CalcLoTurnOnSysAvailMgr(EnergyPlusData &state,
533 : int const SysAvailNum // Number of the current scheduled system availability manager
534 : );
535 :
536 : void ManageHybridVentilation(EnergyPlusData &state);
537 :
538 : void GetHybridVentilationInputs(EnergyPlusData &state);
539 :
540 : void InitHybridVentSysAvailMgr(EnergyPlusData &state);
541 :
542 : void CalcHybridVentSysAvailMgr(EnergyPlusData &state,
543 : int const SysAvailNum, // number of the current scheduled system availability manager
544 : ObjexxFCL::Optional_int_const PriAirSysNum = _ // number of the primary air system affected by this Avail. Manager
545 : );
546 :
547 : bool GetHybridVentilationControlStatus(EnergyPlusData &state, int const ZoneNum); // Index of zone
548 :
549 : struct PlantAvailMgrData
550 : {
551 : // Members
552 : int NumAvailManagers = 0; // number of availability managers for this plant loop
553 : Status availStatus = Status::NoAction; // system availability status
554 : int StartTime = 0; // cycle on time (in SimTimeSteps)
555 : int StopTime = 0; // cycle off time (in SimTimeSteps)
556 : Array1D<AvailManagerNTN> availManagers; // type of availability manager
557 : };
558 :
559 : struct OptStartData
560 : {
561 : int ActualZoneNum = 0;
562 : Real64 OccStartTime = 0.0;
563 : bool OptStartFlag = false;
564 : };
565 :
566 : } // namespace Avail
567 :
568 : struct SystemAvailabilityManagerData : BaseGlobalStruct
569 : {
570 : int NumSchedSysAvailMgrs = 0;
571 : int NumSchedOnSysAvailMgrs = 0;
572 : int NumSchedOffSysAvailMgrs = 0;
573 : int NumNCycSysAvailMgrs = 0;
574 : int NumDiffTSysAvailMgrs = 0;
575 : int NumHiTurnOffSysAvailMgrs = 0;
576 : int NumHiTurnOnSysAvailMgrs = 0;
577 : int NumLoTurnOffSysAvailMgrs = 0;
578 : int NumLoTurnOnSysAvailMgrs = 0;
579 : int NumNVentSysAvailMgrs = 0;
580 : int NumAvailManagerLists = 0;
581 : int NumOptStartSysAvailMgrs = 0;
582 : int NumHybridVentSysAvailMgrs = 0; // Number of hybrid ventilation control
583 :
584 : bool GetAvailListsInput = true;
585 : bool GetAvailMgrInputFlag = true; // First time, input is "gotten"
586 : bool GetHybridInputFlag = true; // Flag set to make sure you get input once
587 :
588 : bool InitSysAvailManagers_MyOneTimeFlag = true;
589 : bool CalcNCycSysAvailMgr_OneTimeFlag = true;
590 : Array1D<Real64> OptStart_AdaTempGradTrdHeat; // Heating temp gradient for previous days - used in CalcOptStartSysAvailMgr
591 : Array1D<Real64> OptStart_AdaTempGradTrdCool; // Cooling temp gradient for previous days - used in CalcOptStartSysAvailMgr
592 :
593 : EPVector<Avail::SysAvailManagerScheduled> SchedData;
594 : EPVector<Avail::SysAvailManagerScheduledOn> SchedOnData;
595 : EPVector<Avail::SysAvailManagerScheduledOff> SchedOffData;
596 : EPVector<Avail::SysAvailManagerNightCycle> NightCycleData;
597 : EPVector<Avail::SysAvailManagerDiffThermo> DiffThermoData;
598 : EPVector<Avail::SysAvailManagerHiLoTemp> HiTurnOffData;
599 : EPVector<Avail::SysAvailManagerHiLoTemp> HiTurnOnData;
600 : EPVector<Avail::SysAvailManagerHiLoTemp> LoTurnOffData;
601 : EPVector<Avail::SysAvailManagerHiLoTemp> LoTurnOnData;
602 : EPVector<Avail::SysAvailManagerNightVent> NightVentData;
603 : EPVector<Avail::SysAvailManagerHybridVent> HybridVentData;
604 : EPVector<Avail::List> ListData;
605 : EPVector<Avail::SysAvailManagerOptimumStart> OptimumStartData;
606 : EPVector<Avail::DefineASHRAEAdaptiveOptimumStartCoeffs> ASHRAEOptSCoeffCooling;
607 : EPVector<Avail::DefineASHRAEAdaptiveOptimumStartCoeffs> ASHRAEOptSCoeffHeating;
608 :
609 : Array1D<Avail::ZoneCompTypeData> ZoneComp;
610 : Array1D<Avail::PlantAvailMgrData> PlantAvailMgr;
611 : Array1D<Avail::OptStartData> OptStart; // For optimum start
612 :
613 : bool BeginOfDayResetFlag = true;
614 :
615 : Array1D_bool ZoneCompNCControlType;
616 : bool MyOneTimeFlag = true; // One time flag
617 : bool MyEnvrnFlag = true;
618 :
619 : Real64 CurrentEndTime = 0.0; // Current end time
620 : Real64 CurrentEndTimeLast = 0.0; // last end time
621 : Real64 TimeStepSysLast = 0.0; // last system time step
622 :
623 : // Hybrid ventilation control part
624 2126 : void init_constant_state([[maybe_unused]] EnergyPlusData &state) override
625 : {
626 2126 : }
627 :
628 1152 : void init_state([[maybe_unused]] EnergyPlusData &state) override
629 : {
630 1152 : }
631 :
632 2100 : void clear_state() override
633 : {
634 2100 : NumSchedSysAvailMgrs = 0;
635 2100 : NumSchedOnSysAvailMgrs = 0;
636 2100 : NumSchedOffSysAvailMgrs = 0;
637 2100 : NumNCycSysAvailMgrs = 0;
638 2100 : NumDiffTSysAvailMgrs = 0;
639 2100 : NumHiTurnOffSysAvailMgrs = 0;
640 2100 : NumHiTurnOnSysAvailMgrs = 0;
641 2100 : NumLoTurnOffSysAvailMgrs = 0;
642 2100 : NumLoTurnOnSysAvailMgrs = 0;
643 2100 : NumNVentSysAvailMgrs = 0;
644 2100 : NumAvailManagerLists = 0;
645 2100 : GetAvailListsInput = true;
646 2100 : GetAvailMgrInputFlag = true;
647 2100 : GetHybridInputFlag = true;
648 2100 : InitSysAvailManagers_MyOneTimeFlag = true;
649 2100 : CalcNCycSysAvailMgr_OneTimeFlag = true;
650 2100 : NumOptStartSysAvailMgrs = 0;
651 2100 : SchedData.deallocate();
652 2100 : SchedOnData.deallocate();
653 2100 : SchedOffData.deallocate();
654 2100 : NightCycleData.deallocate();
655 2100 : DiffThermoData.deallocate();
656 2100 : HiTurnOffData.deallocate();
657 2100 : HiTurnOnData.deallocate();
658 2100 : LoTurnOffData.deallocate();
659 2100 : LoTurnOnData.deallocate();
660 2100 : NightVentData.deallocate();
661 2100 : HybridVentData.deallocate();
662 2100 : ListData.deallocate();
663 2100 : OptimumStartData.deallocate();
664 2100 : ASHRAEOptSCoeffCooling.deallocate();
665 2100 : ASHRAEOptSCoeffHeating.deallocate();
666 2100 : BeginOfDayResetFlag = true;
667 2100 : OptStart_AdaTempGradTrdHeat.deallocate();
668 2100 : OptStart_AdaTempGradTrdCool.deallocate();
669 2100 : PlantAvailMgr.deallocate();
670 2100 : MyOneTimeFlag = true;
671 2100 : MyEnvrnFlag = true;
672 2100 : CurrentEndTime = 0.0;
673 2100 : CurrentEndTimeLast = 0.0;
674 2100 : TimeStepSysLast = 0.0;
675 2100 : }
676 : };
677 : } // namespace EnergyPlus
678 :
679 : #endif
|