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