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