Line data Source code
1 : // EnergyPlus, Copyright (c) 1996-2023, 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 ZoneEquipmentManager_hh_INCLUDED
49 : #define ZoneEquipmentManager_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/DataGlobalConstants.hh>
58 : #include <EnergyPlus/DataGlobals.hh>
59 : #include <EnergyPlus/DataHeatBalance.hh>
60 : #include <EnergyPlus/DataZoneEnergyDemands.hh>
61 : #include <EnergyPlus/EnergyPlus.hh>
62 :
63 : namespace EnergyPlus {
64 :
65 : // Forward declarations
66 : struct EnergyPlusData;
67 :
68 : namespace ZoneEquipmentManager {
69 :
70 3182 : struct SimulationOrder
71 : {
72 : std::string EquipType;
73 : int EquipTypeEnum = 0;
74 : std::string EquipName;
75 : int EquipPtr = 0;
76 : int CoolingPriority = 0;
77 : int HeatingPriority = 0;
78 : };
79 :
80 : void ManageZoneEquipment(EnergyPlusData &state,
81 : bool FirstHVACIteration,
82 : bool &SimZone, // Set to false at the end of the routine
83 : bool &SimAir // Eventually set to true via SimZoneEquipment if AirLoop must be resimulated
84 : );
85 :
86 : void GetZoneEquipment(EnergyPlusData &state);
87 :
88 : void InitZoneEquipment(EnergyPlusData &state, bool FirstHVACIteration); // unused 1208
89 :
90 : void SizeZoneEquipment(EnergyPlusData &state);
91 :
92 : void SetUpZoneSizingArrays(EnergyPlusData &state);
93 :
94 : void RezeroZoneSizingArrays(EnergyPlusData &state);
95 :
96 : void UpdateZoneSizing(EnergyPlusData &state, DataGlobalConstants::CallIndicator CallIndicator);
97 :
98 : void SimZoneEquipment(EnergyPlusData &state, bool FirstHVACIteration, bool &SimAir);
99 :
100 : void SetZoneEquipSimOrder(EnergyPlusData &state, int ControlledZoneNum);
101 :
102 : void InitSystemOutputRequired(EnergyPlusData &state, int ZoneNum, bool FirstHVACIteration, bool ResetSimOrder = false);
103 :
104 : void initOutputRequired(EnergyPlusData &state,
105 : int const ZoneNum,
106 : DataZoneEnergyDemands::ZoneSystemSensibleDemand &energy,
107 : DataZoneEnergyDemands::ZoneSystemMoistureDemand &moisture,
108 : bool const FirstHVACIteration,
109 : bool const ResetSimOrder,
110 : int spaceNum = 0);
111 :
112 : void DistributeSystemOutputRequired(EnergyPlusData &state, int ZoneNum, bool FirstHVACIteration);
113 :
114 : void distributeOutputRequired(EnergyPlusData &state,
115 : int const ZoneNum,
116 : DataZoneEnergyDemands::ZoneSystemSensibleDemand &energy,
117 : DataZoneEnergyDemands::ZoneSystemMoistureDemand &moisture);
118 :
119 : void UpdateSystemOutputRequired(EnergyPlusData &state,
120 : int ZoneNum,
121 : Real64 SysOutputProvided, // sensible output provided by zone equipment (W)
122 : Real64 LatOutputProvided, // latent output provided by zone equipment (kg/s)
123 : Optional_int_const EquipPriorityNum = _ // index in PrioritySimOrder for this update
124 : );
125 :
126 : void CalcZoneMassBalance(EnergyPlusData &state, bool FirstHVACIteration);
127 :
128 : void CalcZoneReturnFlows(EnergyPlusData &state,
129 : int ZoneNum,
130 : Real64 &ExpTotalReturnMassFlow, // Expected total return air mass flow rate
131 : Real64 &FinalTotalReturnMassFlow // Final total return air mass flow rate
132 : );
133 :
134 : void CalcZoneInfiltrationFlows(EnergyPlusData &state,
135 : int ZoneNum, // current zone index
136 : Real64 &ZoneReturnAirMassFlowRate // zone total zone return air mass flow rate
137 : );
138 :
139 : void CalcAirFlowSimple(EnergyPlusData &state,
140 : int SysTimestepLoop = 0, // System time step index
141 : bool AdjustZoneMixingFlowFlag = false, // flags to adjust zone mxing mass flow rate
142 : bool AdjustZoneInfiltrationFlowFlag = false // flags to djust zone infiltration air flow rate
143 : );
144 :
145 : void GetStandAloneERVNodes(EnergyPlusData &state, DataHeatBalance::ZoneAirBalanceData &thisZoneAirBalance);
146 :
147 : void CalcZoneMixingFlowRateOfReceivingZone(EnergyPlusData &state, int ZoneNum, Real64 &ZoneMixingAirMassFlowRate);
148 :
149 : void CalcZoneMixingFlowRateOfSourceZone(EnergyPlusData &state, int ZoneNum);
150 :
151 : void CalcZoneLeavingConditions(EnergyPlusData &state, bool FirstHVACIteration);
152 :
153 : void UpdateZoneEquipment(EnergyPlusData &state, bool &SimAir);
154 :
155 : void CalcDOASSupCondsForSizing(EnergyPlusData &state,
156 : Real64 OutDB, // outside air temperature [C]
157 : Real64 OutHR, // outside humidity ratio [kg Water / kg Dry Air]
158 : int DOASControl, // dedicated outside air control strategy
159 : Real64 DOASLowTemp, // DOAS low setpoint [C]
160 : Real64 DOASHighTemp, // DOAS high setpoint [C]
161 : Real64 W90H, // humidity ratio at DOAS high setpoint temperature and 90% relative humidity [kg Water / kg Dry Air]
162 : Real64 W90L, // humidity ratio at DOAS low setpoint temperature and 90% relative humidity [kg Water / kg Dry Air]
163 : Real64 &DOASSupTemp, // DOAS supply temperature [C]
164 : Real64 &DOASSupHR // DOAS Supply Humidity ratio [kg Water / kg Dry Air]
165 : );
166 :
167 : void AutoCalcDOASControlStrategy(EnergyPlusData &state);
168 :
169 : void ReportInfiltrations(EnergyPlusData &state);
170 :
171 : void ReportZoneSizingDOASInputs(EnergyPlusData &state,
172 : std::string const &ZoneName, // the name of the zone
173 : std::string const &DOASCtrlStrategy, // DOAS control strategy
174 : Real64 DOASLowTemp, // DOAS design low setpoint temperature [C]
175 : Real64 DOASHighTemp, // DOAS design high setpoint temperature [C]
176 : bool &headerAlreadyPrinted);
177 :
178 : } // namespace ZoneEquipmentManager
179 :
180 1542 : struct ZoneEquipmentManagerData : BaseGlobalStruct
181 : {
182 :
183 : Array1D<Real64> AvgData; // scratch array for storing averaged data -- keep on state to avoid it being recreated
184 : int NumOfTimeStepInDay = 0; // number of zone time steps in a day
185 : bool GetZoneEquipmentInputFlag = true;
186 : bool SizeZoneEquipmentOneTimeFlag = true;
187 :
188 : Array1D<ZoneEquipmentManager::SimulationOrder> PrioritySimOrder;
189 :
190 : bool InitZoneEquipmentOneTimeFlag = true;
191 : bool InitZoneEquipmentEnvrnFlag = true;
192 : bool FirstPassZoneEquipFlag = true; // indicates first pass through zone equipment, used to reset selected ZoneEqSizing variables
193 :
194 0 : void clear_state() override
195 : {
196 0 : *this = ZoneEquipmentManagerData();
197 0 : }
198 : };
199 :
200 : } // namespace EnergyPlus
201 :
202 : #endif
|