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 : #include <EnergyPlus/Autosizing/HeatingAirFlowSizing.hh>
49 : #include <EnergyPlus/Data/EnergyPlusData.hh>
50 : #include <EnergyPlus/DataEnvironment.hh>
51 : #include <EnergyPlus/DataHVACGlobals.hh>
52 : #include <EnergyPlus/OutputReportPredefined.hh>
53 : #include <EnergyPlus/UtilityRoutines.hh>
54 :
55 : namespace EnergyPlus {
56 :
57 270 : Real64 HeatingAirFlowSizer::size(EnergyPlusData &state, Real64 _originalValue, bool &errorsFound)
58 : {
59 270 : if (!this->checkInitialized(state, errorsFound)) {
60 1 : return 0.0;
61 : }
62 269 : this->preSize(state, _originalValue);
63 :
64 269 : if (this->dataEMSOverrideON) {
65 3 : this->autoSizedValue = this->dataEMSOverride;
66 266 : } else if (this->dataConstantUsedForSizing > 0 && this->dataFractionUsedForSizing > 0) {
67 8 : this->autoSizedValue = this->dataConstantUsedForSizing * this->dataFractionUsedForSizing;
68 : } else {
69 258 : if (this->curZoneEqNum > 0) {
70 199 : if (!this->wasAutoSized && !this->sizingDesRunThisZone) {
71 31 : this->autoSizedValue = _originalValue;
72 168 : } else if (this->zoneEqSizing(this->curZoneEqNum).DesignSizeFromParent) {
73 9 : this->autoSizedValue = this->zoneEqSizing(this->curZoneEqNum).AirVolFlow;
74 : } else {
75 159 : switch (this->zoneEqSizing(this->curZoneEqNum).SizingMethod(HVAC::HeatingAirflowSizing)) {
76 6 : case DataSizing::SupplyAirFlowRate:
77 : case DataSizing::None:
78 : case DataSizing::FlowPerFloorArea: {
79 6 : if (this->zoneEqSizing(this->curZoneEqNum).SystemAirFlow) {
80 1 : this->autoSizedValue = max(this->zoneEqSizing(this->curZoneEqNum).AirVolFlow,
81 1 : this->zoneEqSizing(this->curZoneEqNum).CoolingAirVolFlow,
82 1 : this->zoneEqSizing(this->curZoneEqNum).HeatingAirVolFlow);
83 : } else {
84 5 : if (state.dataSize->ZoneCoolingOnlyFan) {
85 1 : this->autoSizedValue = this->finalZoneSizing(this->curZoneEqNum).DesCoolVolFlow;
86 4 : } else if (state.dataSize->ZoneHeatingOnlyFan) {
87 1 : this->autoSizedValue = this->finalZoneSizing(this->curZoneEqNum).DesHeatVolFlow;
88 3 : } else if (this->zoneEqSizing(this->curZoneEqNum).CoolingAirFlow && !this->zoneEqSizing(this->curZoneEqNum).HeatingAirFlow) {
89 1 : this->autoSizedValue = this->zoneEqSizing(this->curZoneEqNum).CoolingAirVolFlow;
90 2 : } else if (this->zoneEqSizing(this->curZoneEqNum).HeatingAirFlow && !this->zoneEqSizing(this->curZoneEqNum).CoolingAirFlow) {
91 1 : this->autoSizedValue = this->zoneEqSizing(this->curZoneEqNum).HeatingAirVolFlow;
92 1 : } else if (this->zoneEqSizing(this->curZoneEqNum).HeatingAirFlow && this->zoneEqSizing(this->curZoneEqNum).CoolingAirFlow) {
93 1 : this->autoSizedValue = max(this->zoneEqSizing(this->curZoneEqNum).CoolingAirVolFlow,
94 1 : this->zoneEqSizing(this->curZoneEqNum).HeatingAirVolFlow);
95 : } else {
96 0 : this->autoSizedValue = max(this->finalZoneSizing(this->curZoneEqNum).DesCoolVolFlow,
97 0 : this->finalZoneSizing(this->curZoneEqNum).DesHeatVolFlow);
98 : }
99 : }
100 6 : } break;
101 6 : case DataSizing::FractionOfAutosizedCoolingAirflow: {
102 6 : if (state.dataSize->ZoneCoolingOnlyFan) {
103 1 : this->autoSizedValue = this->dataFracOfAutosizedCoolingAirflow * this->finalZoneSizing(this->curZoneEqNum).DesCoolVolFlow;
104 5 : } else if (state.dataSize->ZoneHeatingOnlyFan) {
105 1 : this->autoSizedValue = this->dataFracOfAutosizedHeatingAirflow * this->finalZoneSizing(this->curZoneEqNum).DesHeatVolFlow;
106 4 : } else if (this->zoneEqSizing(this->curZoneEqNum).CoolingAirFlow && !this->zoneEqSizing(this->curZoneEqNum).HeatingAirFlow) {
107 1 : this->autoSizedValue = this->dataFracOfAutosizedCoolingAirflow * this->zoneEqSizing(this->curZoneEqNum).CoolingAirVolFlow;
108 3 : } else if (this->zoneEqSizing(this->curZoneEqNum).HeatingAirFlow && !this->zoneEqSizing(this->curZoneEqNum).CoolingAirFlow) {
109 1 : this->autoSizedValue = this->dataFracOfAutosizedHeatingAirflow * this->zoneEqSizing(this->curZoneEqNum).HeatingAirVolFlow;
110 2 : } else if (this->zoneEqSizing(this->curZoneEqNum).HeatingAirFlow && this->zoneEqSizing(this->curZoneEqNum).CoolingAirFlow) {
111 1 : this->autoSizedValue =
112 1 : max(this->dataFracOfAutosizedCoolingAirflow * this->zoneEqSizing(this->curZoneEqNum).CoolingAirVolFlow,
113 1 : this->dataFracOfAutosizedHeatingAirflow * this->zoneEqSizing(this->curZoneEqNum).HeatingAirVolFlow);
114 : } else {
115 1 : this->autoSizedValue =
116 1 : max(this->dataFracOfAutosizedCoolingAirflow * this->finalZoneSizing(this->curZoneEqNum).DesCoolVolFlow,
117 1 : this->dataFracOfAutosizedHeatingAirflow * this->finalZoneSizing(this->curZoneEqNum).DesHeatVolFlow);
118 : }
119 6 : } break;
120 6 : case DataSizing::FractionOfAutosizedHeatingAirflow: {
121 6 : if (state.dataSize->ZoneCoolingOnlyFan) {
122 1 : this->autoSizedValue = this->dataFracOfAutosizedCoolingAirflow * this->finalZoneSizing(this->curZoneEqNum).DesCoolVolFlow;
123 5 : } else if (state.dataSize->ZoneHeatingOnlyFan) {
124 1 : this->autoSizedValue = this->dataFracOfAutosizedHeatingAirflow * this->finalZoneSizing(this->curZoneEqNum).DesHeatVolFlow;
125 4 : } else if (this->zoneEqSizing(this->curZoneEqNum).CoolingAirFlow && !this->zoneEqSizing(this->curZoneEqNum).HeatingAirFlow) {
126 1 : this->autoSizedValue = this->dataFracOfAutosizedCoolingAirflow * this->zoneEqSizing(this->curZoneEqNum).CoolingAirVolFlow;
127 3 : } else if (this->zoneEqSizing(this->curZoneEqNum).HeatingAirFlow && !this->zoneEqSizing(this->curZoneEqNum).CoolingAirFlow) {
128 1 : this->autoSizedValue = this->dataFracOfAutosizedHeatingAirflow * this->zoneEqSizing(this->curZoneEqNum).HeatingAirVolFlow;
129 2 : } else if (this->zoneEqSizing(this->curZoneEqNum).HeatingAirFlow && this->zoneEqSizing(this->curZoneEqNum).CoolingAirFlow) {
130 1 : this->autoSizedValue =
131 1 : max(this->dataFracOfAutosizedCoolingAirflow * this->zoneEqSizing(this->curZoneEqNum).CoolingAirVolFlow,
132 1 : this->dataFracOfAutosizedHeatingAirflow * this->zoneEqSizing(this->curZoneEqNum).HeatingAirVolFlow);
133 : } else {
134 1 : this->autoSizedValue =
135 1 : max(this->dataFracOfAutosizedCoolingAirflow * this->finalZoneSizing(this->curZoneEqNum).DesCoolVolFlow,
136 1 : this->dataFracOfAutosizedHeatingAirflow * this->finalZoneSizing(this->curZoneEqNum).DesHeatVolFlow);
137 : }
138 6 : } break;
139 6 : case DataSizing::FlowPerCoolingCapacity: {
140 6 : if (state.dataSize->ZoneCoolingOnlyFan) {
141 1 : this->autoSizedValue = this->dataFlowPerCoolingCapacity * this->dataAutosizedCoolingCapacity;
142 5 : } else if (state.dataSize->ZoneHeatingOnlyFan) {
143 1 : this->autoSizedValue = this->dataFlowPerHeatingCapacity * this->dataAutosizedHeatingCapacity;
144 4 : } else if (this->zoneEqSizing(this->curZoneEqNum).CoolingAirFlow && !this->zoneEqSizing(this->curZoneEqNum).HeatingAirFlow) {
145 1 : this->autoSizedValue = this->dataFlowPerCoolingCapacity * this->dataAutosizedCoolingCapacity;
146 3 : } else if (this->zoneEqSizing(this->curZoneEqNum).HeatingAirFlow && !this->zoneEqSizing(this->curZoneEqNum).CoolingAirFlow) {
147 1 : this->autoSizedValue = this->dataFlowPerHeatingCapacity * this->dataAutosizedHeatingCapacity;
148 2 : } else if (this->zoneEqSizing(this->curZoneEqNum).HeatingAirFlow && this->zoneEqSizing(this->curZoneEqNum).CoolingAirFlow) {
149 1 : this->autoSizedValue = max(this->dataFlowPerCoolingCapacity * this->dataAutosizedCoolingCapacity,
150 1 : this->dataFlowPerHeatingCapacity * this->dataAutosizedHeatingCapacity);
151 : } else {
152 1 : this->autoSizedValue = max(this->dataFlowPerCoolingCapacity * this->dataAutosizedCoolingCapacity,
153 1 : this->dataFlowPerHeatingCapacity * this->dataAutosizedHeatingCapacity);
154 : }
155 6 : } break;
156 7 : case DataSizing::FlowPerHeatingCapacity: {
157 7 : if (state.dataSize->ZoneCoolingOnlyFan) {
158 1 : this->autoSizedValue = this->dataFlowPerCoolingCapacity * this->dataAutosizedCoolingCapacity;
159 6 : } else if (state.dataSize->ZoneHeatingOnlyFan) {
160 1 : this->autoSizedValue = this->dataFlowPerHeatingCapacity * this->dataAutosizedHeatingCapacity;
161 5 : } else if (this->zoneEqSizing(this->curZoneEqNum).CoolingAirFlow && !this->zoneEqSizing(this->curZoneEqNum).HeatingAirFlow) {
162 1 : this->autoSizedValue = this->dataFlowPerCoolingCapacity * this->dataAutosizedCoolingCapacity;
163 4 : } else if (this->zoneEqSizing(this->curZoneEqNum).HeatingAirFlow && !this->zoneEqSizing(this->curZoneEqNum).CoolingAirFlow) {
164 1 : this->autoSizedValue = this->dataFlowPerHeatingCapacity * this->dataAutosizedHeatingCapacity;
165 3 : } else if (this->zoneEqSizing(this->curZoneEqNum).HeatingAirFlow && this->zoneEqSizing(this->curZoneEqNum).CoolingAirFlow) {
166 1 : this->autoSizedValue = max(this->dataFlowPerCoolingCapacity * this->dataAutosizedCoolingCapacity,
167 1 : this->dataFlowPerHeatingCapacity * this->dataAutosizedHeatingCapacity);
168 : } else {
169 2 : this->autoSizedValue = max(this->dataFlowPerCoolingCapacity * this->dataAutosizedCoolingCapacity,
170 2 : this->dataFlowPerHeatingCapacity * this->dataAutosizedHeatingCapacity);
171 : }
172 7 : } break;
173 128 : default: {
174 128 : if (this->zoneEqSizing(this->curZoneEqNum).HeatingAirFlow) {
175 65 : this->autoSizedValue = this->zoneEqSizing(this->curZoneEqNum).HeatingAirVolFlow;
176 63 : } else if (state.dataSize->ZoneCoolingOnlyFan) { // probably shouldn't be here
177 2 : this->autoSizedValue = this->finalZoneSizing(this->curZoneEqNum).DesCoolVolFlow;
178 61 : } else if (this->termUnitIU && (this->curTermUnitSizingNum > 0)) {
179 0 : this->autoSizedValue = this->termUnitSizing(this->curTermUnitSizingNum).AirVolFlow;
180 61 : } else if (this->zoneEqFanCoil) {
181 0 : this->autoSizedValue = this->zoneEqSizing(this->curZoneEqNum).AirVolFlow;
182 61 : } else if (this->zoneHeatingOnlyFan) {
183 30 : this->autoSizedValue = this->finalZoneSizing(this->curZoneEqNum).DesHeatVolFlow;
184 : } else {
185 31 : this->autoSizedValue =
186 31 : max(this->finalZoneSizing(this->curZoneEqNum).DesCoolVolFlow, this->finalZoneSizing(this->curZoneEqNum).DesHeatVolFlow);
187 : }
188 128 : } break;
189 : }
190 : }
191 59 : } else if (this->curSysNum > 0) {
192 51 : if (!this->wasAutoSized && !this->sizingDesRunThisAirSys) {
193 4 : this->autoSizedValue = _originalValue;
194 : } else {
195 47 : if (this->curOASysNum > 0) {
196 6 : if (this->oaSysEqSizing(this->curOASysNum).AirFlow) {
197 : // Parent object sets system flow rate
198 1 : this->autoSizedValue = this->oaSysEqSizing(this->curOASysNum).AirVolFlow;
199 5 : } else if (this->oaSysEqSizing(this->curOASysNum).HeatingAirFlow) {
200 : // Parent object sets heating flow rate
201 0 : this->autoSizedValue = this->oaSysEqSizing(this->curOASysNum).HeatingAirVolFlow;
202 5 : } else if (outsideAirSys(this->curOASysNum).AirLoopDOASNum > -1) {
203 1 : this->autoSizedValue =
204 1 : this->airloopDOAS[outsideAirSys(this->curOASysNum).AirLoopDOASNum].SizingMassFlow / state.dataEnvrn->StdRhoAir;
205 : } else {
206 4 : this->autoSizedValue = this->finalSysSizing(this->curSysNum).DesOutAirVolFlow;
207 : }
208 : } else {
209 41 : if (this->unitarySysEqSizing(this->curSysNum).AirFlow) {
210 0 : this->autoSizedValue = this->unitarySysEqSizing(this->curSysNum).AirVolFlow;
211 41 : } else if (this->unitarySysEqSizing(this->curSysNum).HeatingAirFlow) {
212 6 : this->autoSizedValue = this->unitarySysEqSizing(this->curSysNum).HeatingAirVolFlow;
213 : } else {
214 35 : if (this->curDuctType == HVAC::AirDuctType::Main) {
215 9 : if (Util::SameString(this->compType, "COIL:HEATING:WATER")) {
216 7 : if (this->finalSysSizing(this->curSysNum).SysAirMinFlowRat > 0.0 && !this->dataDesicRegCoil) {
217 5 : this->autoSizedValue =
218 5 : this->finalSysSizing(this->curSysNum).SysAirMinFlowRat * this->finalSysSizing(this->curSysNum).DesMainVolFlow;
219 : } else {
220 2 : this->autoSizedValue = this->finalSysSizing(this->curSysNum).DesMainVolFlow;
221 : }
222 : } else {
223 2 : this->autoSizedValue = this->finalSysSizing(this->curSysNum).DesMainVolFlow;
224 : }
225 26 : } else if (this->curDuctType == HVAC::AirDuctType::Cooling) {
226 1 : if (Util::SameString(this->compType, "COIL:HEATING:WATER")) {
227 1 : if (this->finalSysSizing(this->curSysNum).SysAirMinFlowRat > 0.0 && !this->dataDesicRegCoil) {
228 0 : this->autoSizedValue =
229 0 : this->finalSysSizing(this->curSysNum).SysAirMinFlowRat * this->finalSysSizing(this->curSysNum).DesCoolVolFlow;
230 : } else {
231 1 : this->autoSizedValue = this->finalSysSizing(this->curSysNum).DesCoolVolFlow;
232 : }
233 : } else {
234 0 : this->autoSizedValue = this->finalSysSizing(this->curSysNum).DesCoolVolFlow;
235 : }
236 25 : } else if (this->curDuctType == HVAC::AirDuctType::Heating) {
237 4 : this->autoSizedValue = this->finalSysSizing(this->curSysNum).DesHeatVolFlow;
238 21 : } else if (this->curDuctType == HVAC::AirDuctType::Other) {
239 1 : this->autoSizedValue = this->finalSysSizing(this->curSysNum).DesMainVolFlow;
240 : } else {
241 20 : this->autoSizedValue = this->finalSysSizing(this->curSysNum).DesMainVolFlow;
242 : }
243 : }
244 : }
245 : }
246 8 : } else if (this->dataNonZoneNonAirloopValue > 0) {
247 0 : this->autoSizedValue = this->dataNonZoneNonAirloopValue;
248 8 : } else if (!this->wasAutoSized) {
249 8 : this->autoSizedValue = this->originalValue;
250 : } else {
251 0 : std::string msg = this->callingRoutine + ' ' + this->compType + ' ' + this->compName + ", Developer Error: Component sizing incomplete.";
252 0 : ShowSevereError(state, msg);
253 0 : this->addErrorMessage(msg);
254 0 : msg = format("SizingString = {}, SizingResult = {:.1T}", this->sizingString, this->autoSizedValue);
255 0 : ShowContinueError(state, msg);
256 0 : this->addErrorMessage(msg);
257 0 : errorsFound = true;
258 0 : }
259 : // override sizing string
260 258 : if (this->overrideSizeString) {
261 54 : if (this->isEpJSON) this->sizingString = "heating_supply_air_flow_rate [m3/s]";
262 : }
263 258 : if (this->dataScalableSizingON) {
264 0 : if (this->zoneAirFlowSizMethod == DataSizing::SupplyAirFlowRate || this->zoneAirFlowSizMethod == DataSizing::None) {
265 0 : this->sizingStringScalable = "(scaled by flow / zone) ";
266 0 : } else if (this->zoneAirFlowSizMethod == DataSizing::FlowPerFloorArea) {
267 0 : this->sizingStringScalable = "(scaled by flow / area) ";
268 0 : } else if (this->zoneAirFlowSizMethod == DataSizing::FractionOfAutosizedCoolingAirflow ||
269 0 : this->zoneAirFlowSizMethod == DataSizing::FractionOfAutosizedHeatingAirflow) {
270 0 : this->sizingStringScalable = "(scaled by fractional multiplier) ";
271 0 : } else if (this->zoneAirFlowSizMethod == DataSizing::FlowPerCoolingCapacity ||
272 0 : this->zoneAirFlowSizMethod == DataSizing::FlowPerHeatingCapacity) {
273 0 : this->sizingStringScalable = "(scaled by flow / capacity) ";
274 : }
275 : }
276 : }
277 269 : this->selectSizerOutput(state, errorsFound);
278 :
279 269 : if (this->isCoilReportObject) {
280 : // SizingResult is airflow in m3/s
281 135 : state.dataRptCoilSelection->coilSelectionReportObj->setCoilAirFlow(
282 135 : state, this->compName, this->compType, this->autoSizedValue, this->wasAutoSized);
283 : }
284 269 : if (this->isFanReportObject) {
285 : // fill fan peak day and time here
286 0 : std::string DDNameFanPeak;
287 0 : std::string dateTimeFanPeak;
288 0 : if (this->dataScalableSizingON) {
289 0 : DDNameFanPeak = "Scaled size, not from any peak";
290 0 : dateTimeFanPeak = "Scaled size, not from any peak";
291 : }
292 0 : OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchFanDesDay, this->compName, DDNameFanPeak);
293 0 : OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchFanPkTime, this->compName, dateTimeFanPeak);
294 0 : }
295 269 : return this->autoSizedValue;
296 : }
297 :
298 0 : void HeatingAirFlowSizer::clearState()
299 : {
300 0 : BaseSizerWithScalableInputs::clearState();
301 0 : }
302 :
303 : } // namespace EnergyPlus
|