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/All_Simple_Sizing.hh>
49 : #include <EnergyPlus/Data/EnergyPlusData.hh>
50 : #include <EnergyPlus/DataEnvironment.hh>
51 : #include <EnergyPlus/DesiccantDehumidifiers.hh>
52 : #include <EnergyPlus/General.hh>
53 : #include <EnergyPlus/Psychrometrics.hh>
54 :
55 : namespace EnergyPlus {
56 :
57 83 : Real64 AutoCalculateSizer::size(EnergyPlusData &state, Real64 _originalValue, bool &errorsFound)
58 : {
59 83 : if (!this->checkInitialized(state, errorsFound)) {
60 1 : return 0.0;
61 : }
62 82 : this->preSize(state, _originalValue);
63 82 : if (this->dataEMSOverrideON) {
64 2 : this->autoSizedValue = this->dataEMSOverride;
65 : } else {
66 80 : this->autoSizedValue = this->dataConstantUsedForSizing * this->dataFractionUsedForSizing;
67 : }
68 82 : this->selectSizerOutput(state, errorsFound);
69 82 : return this->autoSizedValue;
70 : }
71 :
72 61 : Real64 MaxHeaterOutletTempSizer::size(EnergyPlusData &state, Real64 _originalValue, bool &errorsFound)
73 : {
74 61 : if (!this->checkInitialized(state, errorsFound)) {
75 1 : return 0.0;
76 : }
77 60 : this->preSize(state, _originalValue);
78 60 : if (this->curZoneEqNum > 0) {
79 54 : if (!this->wasAutoSized && !this->sizingDesRunThisZone) {
80 47 : this->autoSizedValue = _originalValue;
81 : } else {
82 7 : this->autoSizedValue = this->finalZoneSizing(this->curZoneEqNum).HeatDesTemp;
83 : }
84 6 : } else if (this->curSysNum > 0) {
85 6 : if (!this->wasAutoSized && !this->sizingDesRunThisAirSys) {
86 4 : this->autoSizedValue = _originalValue;
87 : } else {
88 2 : this->autoSizedValue = this->finalSysSizing(this->curSysNum).HeatSupTemp;
89 : }
90 : }
91 60 : this->selectSizerOutput(state, errorsFound);
92 60 : return this->autoSizedValue;
93 : }
94 :
95 7 : Real64 ZoneCoolingLoadSizer::size(EnergyPlusData &state, Real64 _originalValue, bool &errorsFound)
96 : {
97 7 : if (!this->checkInitialized(state, errorsFound)) {
98 1 : return 0.0;
99 : }
100 6 : this->preSize(state, _originalValue);
101 6 : if (this->curZoneEqNum > 0) {
102 3 : if (!this->wasAutoSized && !this->sizingDesRunThisZone) {
103 2 : this->autoSizedValue = _originalValue;
104 : } else {
105 1 : this->autoSizedValue = this->finalZoneSizing(this->curZoneEqNum).DesCoolLoad;
106 : }
107 3 : } else if (this->curSysNum > 0) {
108 3 : if (!this->wasAutoSized && !this->sizingDesRunThisAirSys) {
109 1 : this->autoSizedValue = _originalValue;
110 : } else {
111 : // not implemented
112 2 : this->errorType = AutoSizingResultType::ErrorType1;
113 2 : this->autoSizedValue = 0.0;
114 2 : std::string msg = "Developer Error: For autosizing of " + this->compType + ' ' + this->compName + ", Airloop equipment not implemented.";
115 2 : this->addErrorMessage(msg);
116 2 : }
117 : }
118 6 : this->selectSizerOutput(state, errorsFound);
119 6 : return this->autoSizedValue;
120 : }
121 :
122 7 : Real64 ZoneHeatingLoadSizer::size(EnergyPlusData &state, Real64 _originalValue, bool &errorsFound)
123 : {
124 7 : if (!this->checkInitialized(state, errorsFound)) {
125 1 : return 0.0;
126 : }
127 6 : this->preSize(state, _originalValue);
128 6 : if (this->curZoneEqNum > 0) {
129 3 : if (!this->wasAutoSized && !this->sizingDesRunThisZone) {
130 2 : this->autoSizedValue = _originalValue;
131 : } else {
132 1 : this->autoSizedValue = this->finalZoneSizing(this->curZoneEqNum).DesHeatLoad;
133 : }
134 3 : } else if (this->curSysNum > 0) {
135 3 : if (!this->wasAutoSized && !this->sizingDesRunThisAirSys) {
136 1 : this->autoSizedValue = _originalValue;
137 : } else {
138 : // not implemented
139 2 : this->errorType = AutoSizingResultType::ErrorType1;
140 2 : this->autoSizedValue = 0.0;
141 2 : std::string msg = "Developer Error: For autosizing of " + this->compType + ' ' + this->compName + ", Airloop equipment not implemented.";
142 2 : this->addErrorMessage(msg);
143 2 : }
144 : }
145 6 : this->selectSizerOutput(state, errorsFound);
146 6 : return this->autoSizedValue;
147 : }
148 :
149 12 : Real64 ASHRAEMinSATCoolingSizer::size(EnergyPlusData &state, Real64 _originalValue, bool &errorsFound)
150 : {
151 12 : if (!this->checkInitialized(state, errorsFound)) {
152 1 : return 0.0;
153 : }
154 11 : this->preSize(state, _originalValue);
155 11 : if (this->curZoneEqNum > 0) {
156 7 : if (!this->wasAutoSized && !this->sizingDesRunThisZone) {
157 5 : this->autoSizedValue = _originalValue;
158 : } else {
159 2 : if (this->dataCapacityUsedForSizing > 0.0 && this->dataFlowUsedForSizing > 0.0) {
160 1 : this->autoSizedValue =
161 1 : this->finalZoneSizing(this->curZoneEqNum).ZoneTempAtCoolPeak -
162 2 : (this->dataCapacityUsedForSizing / (this->dataFlowUsedForSizing * state.dataEnvrn->StdRhoAir *
163 1 : Psychrometrics::PsyCpAirFnW(this->finalZoneSizing(this->curZoneEqNum).ZoneHumRatAtCoolPeak)));
164 : } else {
165 1 : this->errorType = AutoSizingResultType::ErrorType1;
166 : std::string msg =
167 1 : this->callingRoutine + ' ' + this->compType + ' ' + this->compName + ", Developer Error: Component sizing incomplete.";
168 1 : this->addErrorMessage(msg);
169 1 : ShowSevereError(state, msg);
170 1 : msg = format("SizingString = {}, DataCapacityUsedForSizing = {:.1T}", this->sizingString, this->dataCapacityUsedForSizing);
171 1 : this->addErrorMessage(msg);
172 1 : ShowContinueError(state, msg);
173 1 : msg = format("SizingString = {}, DataFlowUsedForSizing = {:.1T}", this->sizingString, this->dataFlowUsedForSizing);
174 1 : this->addErrorMessage(msg);
175 1 : ShowContinueError(state, msg);
176 1 : }
177 : }
178 4 : } else if (this->curSysNum > 0) {
179 4 : if (!this->wasAutoSized && !this->sizingDesRunThisAirSys) {
180 1 : this->autoSizedValue = _originalValue;
181 : } else {
182 3 : if (this->dataCapacityUsedForSizing > 0.0 && this->dataFlowUsedForSizing > 0.0 && this->dataZoneUsedForSizing > 0) {
183 2 : this->autoSizedValue = this->finalZoneSizing(this->dataZoneUsedForSizing).ZoneTempAtCoolPeak -
184 4 : (this->dataCapacityUsedForSizing /
185 4 : (this->dataFlowUsedForSizing * state.dataEnvrn->StdRhoAir *
186 2 : Psychrometrics::PsyCpAirFnW(this->finalZoneSizing(this->dataZoneUsedForSizing).ZoneHumRatAtCoolPeak)));
187 : } else {
188 1 : this->errorType = AutoSizingResultType::ErrorType1;
189 : std::string msg =
190 1 : this->callingRoutine + ' ' + this->compType + ' ' + this->compName + ", Developer Error: Component sizing incomplete.";
191 1 : this->addErrorMessage(msg);
192 1 : ShowSevereError(state, msg);
193 1 : msg = format("SizingString = {}, DataCapacityUsedForSizing = {:.1T}", this->sizingString, this->dataCapacityUsedForSizing);
194 1 : this->addErrorMessage(msg);
195 1 : ShowContinueError(state, msg);
196 1 : msg = format("SizingString = {}, DataFlowUsedForSizing = {:.1T}", this->sizingString, this->dataFlowUsedForSizing);
197 1 : this->addErrorMessage(msg);
198 1 : ShowContinueError(state, msg);
199 1 : msg = format("SizingString = {}, DataZoneUsedForSizing = {:.0T}", this->sizingString, Real64(this->dataZoneUsedForSizing));
200 1 : ShowContinueError(state, msg);
201 1 : }
202 : }
203 : }
204 11 : this->selectSizerOutput(state, errorsFound);
205 11 : return this->autoSizedValue;
206 : }
207 :
208 12 : Real64 ASHRAEMaxSATHeatingSizer::size(EnergyPlusData &state, Real64 _originalValue, bool &errorsFound)
209 : {
210 12 : if (!this->checkInitialized(state, errorsFound)) {
211 1 : return 0.0;
212 : }
213 11 : this->preSize(state, _originalValue);
214 11 : if (this->curZoneEqNum > 0) {
215 7 : if (!this->wasAutoSized && !this->sizingDesRunThisZone) {
216 5 : this->autoSizedValue = _originalValue;
217 : } else {
218 2 : if (this->dataCapacityUsedForSizing > 0.0 && this->dataFlowUsedForSizing > 0.0) {
219 1 : this->autoSizedValue =
220 1 : this->finalZoneSizing(this->curZoneEqNum).ZoneTempAtHeatPeak +
221 2 : (this->dataCapacityUsedForSizing / (this->dataFlowUsedForSizing * state.dataEnvrn->StdRhoAir *
222 1 : Psychrometrics::PsyCpAirFnW(this->finalZoneSizing(this->curZoneEqNum).ZoneHumRatAtHeatPeak)));
223 : } else {
224 1 : this->errorType = AutoSizingResultType::ErrorType1;
225 : std::string msg =
226 1 : this->callingRoutine + ' ' + this->compType + ' ' + this->compName + ", Developer Error: Component sizing incomplete.";
227 1 : this->addErrorMessage(msg);
228 1 : ShowSevereError(state, msg);
229 1 : msg = format("SizingString = {}, DataCapacityUsedForSizing = {:.1T}", this->sizingString, this->dataCapacityUsedForSizing);
230 1 : this->addErrorMessage(msg);
231 1 : ShowContinueError(state, msg);
232 1 : msg = format("SizingString = {}, DataFlowUsedForSizing = {:.1T}", this->sizingString, this->dataFlowUsedForSizing);
233 1 : this->addErrorMessage(msg);
234 1 : ShowContinueError(state, msg);
235 1 : }
236 : }
237 4 : } else if (this->curSysNum > 0) {
238 4 : if (!this->wasAutoSized && !this->sizingDesRunThisAirSys) {
239 1 : this->autoSizedValue = _originalValue;
240 : } else {
241 3 : if (this->dataCapacityUsedForSizing > 0.0 && this->dataFlowUsedForSizing > 0.0 && this->dataZoneUsedForSizing > 0) {
242 2 : this->autoSizedValue = this->finalZoneSizing(this->dataZoneUsedForSizing).ZoneTempAtHeatPeak +
243 4 : (this->dataCapacityUsedForSizing /
244 4 : (this->dataFlowUsedForSizing * state.dataEnvrn->StdRhoAir *
245 2 : Psychrometrics::PsyCpAirFnW(this->finalZoneSizing(this->dataZoneUsedForSizing).ZoneHumRatAtHeatPeak)));
246 : } else {
247 1 : this->errorType = AutoSizingResultType::ErrorType1;
248 : std::string msg =
249 1 : this->callingRoutine + ' ' + this->compType + ' ' + this->compName + ", Developer Error: Component sizing incomplete.";
250 1 : this->addErrorMessage(msg);
251 1 : ShowSevereError(state, msg);
252 1 : msg = format("SizingString = {}, DataCapacityUsedForSizing = {:.1T}", this->sizingString, this->dataCapacityUsedForSizing);
253 1 : this->addErrorMessage(msg);
254 1 : ShowContinueError(state, msg);
255 1 : msg = format("SizingString = {}, DataFlowUsedForSizing = {:.1T}", this->sizingString, this->dataFlowUsedForSizing);
256 1 : this->addErrorMessage(msg);
257 1 : ShowContinueError(state, msg);
258 1 : msg = format("SizingString = {}, DataZoneUsedForSizing = {:.0T}", this->sizingString, Real64(this->dataZoneUsedForSizing));
259 1 : ShowContinueError(state, msg);
260 1 : }
261 : }
262 : }
263 11 : this->selectSizerOutput(state, errorsFound);
264 11 : return this->autoSizedValue;
265 : }
266 :
267 13 : Real64 DesiccantDehumidifierBFPerfDataFaceVelocitySizer::size(EnergyPlusData &state, Real64 _originalValue, bool &errorsFound)
268 : {
269 13 : if (!this->checkInitialized(state, errorsFound)) {
270 1 : return 0.0;
271 : }
272 12 : this->preSize(state, _originalValue);
273 12 : if (this->dataEMSOverrideON) {
274 1 : this->autoSizedValue = this->dataEMSOverride;
275 : } else {
276 11 : this->autoSizedValue = 4.30551 + 0.01969 * this->dataAirFlowUsedForSizing;
277 11 : this->autoSizedValue = min(6.0, this->autoSizedValue);
278 : }
279 12 : if (this->isEpJSON) {
280 0 : this->sizingString = "nominal_air_face_velocity [m/s]";
281 : }
282 12 : this->selectSizerOutput(state, errorsFound);
283 12 : return this->autoSizedValue;
284 : }
285 :
286 11 : Real64 HeatingCoilDesAirInletTempSizer::size(EnergyPlusData &state, Real64 _originalValue, bool &errorsFound)
287 : {
288 11 : if (!this->checkInitialized(state, errorsFound)) {
289 1 : return 0.0;
290 : }
291 10 : this->preSize(state, _originalValue);
292 10 : if (this->curZoneEqNum > 0) {
293 1 : if (!this->wasAutoSized && !this->sizingDesRunThisZone) {
294 1 : this->autoSizedValue = _originalValue;
295 : } else {
296 : // not implemented
297 0 : this->errorType = AutoSizingResultType::ErrorType1;
298 0 : this->autoSizedValue = 0.0;
299 0 : std::string msg = "Developer Error: For autosizing of " + this->compType + ' ' + this->compName + ", Zone equipment not implemented.";
300 0 : this->addErrorMessage(msg);
301 0 : }
302 9 : } else if (this->curSysNum > 0) {
303 9 : if (!this->wasAutoSized && !this->sizingDesRunThisAirSys) {
304 1 : this->autoSizedValue = _originalValue;
305 : } else {
306 8 : if (this->dataDesicRegCoil && this->dataDesicDehumNum > 0) {
307 : // change to Data* global
308 7 : if (state.dataDesiccantDehumidifiers->DesicDehum(this->dataDesicDehumNum).RegenInletIsOutsideAirNode) {
309 5 : this->autoSizedValue = this->finalSysSizing(this->curSysNum).HeatOutTemp;
310 : } else {
311 2 : this->autoSizedValue = this->finalSysSizing(this->curSysNum).HeatRetTemp;
312 : }
313 : }
314 : }
315 : }
316 10 : this->selectSizerOutput(state, errorsFound);
317 10 : if (this->isCoilReportObject) {
318 10 : state.dataRptCoilSelection->coilSelectionReportObj->setCoilEntAirTemp(
319 10 : state, this->compName, this->compType, this->autoSizedValue, this->curSysNum, this->curZoneEqNum);
320 : }
321 10 : return this->autoSizedValue;
322 : }
323 :
324 10 : Real64 HeatingCoilDesAirOutletTempSizer::size(EnergyPlusData &state, Real64 _originalValue, bool &errorsFound)
325 : {
326 10 : if (!this->checkInitialized(state, errorsFound)) {
327 1 : return 0.0;
328 : }
329 9 : this->preSize(state, _originalValue);
330 9 : if (this->curZoneEqNum > 0) {
331 1 : if (!this->wasAutoSized && !this->sizingDesRunThisZone) {
332 1 : this->autoSizedValue = _originalValue;
333 : } else {
334 : // not implemented
335 0 : this->errorType = AutoSizingResultType::ErrorType1;
336 0 : this->autoSizedValue = 0.0;
337 0 : std::string msg = "Developer Error: For autosizing of " + this->compType + ' ' + this->compName + ", Zone equipment not implemented.";
338 0 : this->addErrorMessage(msg);
339 0 : }
340 8 : } else if (this->curSysNum > 0) {
341 8 : if (!this->wasAutoSized && !this->sizingDesRunThisAirSys) {
342 1 : this->autoSizedValue = _originalValue;
343 : } else {
344 7 : if (this->dataDesicRegCoil && this->dataDesicDehumNum > 0) {
345 : // change to Data* global
346 6 : this->autoSizedValue = state.dataDesiccantDehumidifiers->DesicDehum(this->dataDesicDehumNum).RegenSetPointTemp;
347 : }
348 : }
349 : }
350 9 : this->selectSizerOutput(state, errorsFound);
351 9 : if (this->isCoilReportObject) {
352 9 : state.dataRptCoilSelection->coilSelectionReportObj->setCoilLvgAirTemp(state, this->compName, this->compType, this->autoSizedValue);
353 : }
354 9 : return this->autoSizedValue;
355 : }
356 :
357 8 : Real64 HeatingCoilDesAirInletHumRatSizer::size(EnergyPlusData &state, Real64 _originalValue, bool &errorsFound)
358 : {
359 8 : if (!this->checkInitialized(state, errorsFound)) {
360 1 : return 0.0;
361 : }
362 7 : this->preSize(state, _originalValue);
363 7 : if (this->curZoneEqNum > 0) {
364 1 : if (!this->wasAutoSized && !this->sizingDesRunThisZone) {
365 1 : this->autoSizedValue = _originalValue;
366 : } else {
367 : // not implemented
368 0 : this->errorType = AutoSizingResultType::ErrorType1;
369 0 : this->autoSizedValue = 0.0;
370 0 : std::string msg = "Developer Error: For autosizing of " + this->compType + ' ' + this->compName + ", Zone equipment not implemented.";
371 0 : this->addErrorMessage(msg);
372 0 : }
373 6 : } else if (this->curSysNum > 0) {
374 6 : if (!this->wasAutoSized && !this->sizingDesRunThisAirSys) {
375 1 : this->autoSizedValue = _originalValue;
376 : } else {
377 5 : if (this->dataDesicRegCoil) {
378 : // change to Data* global
379 4 : if (state.dataDesiccantDehumidifiers->DesicDehum(this->dataDesicDehumNum).RegenInletIsOutsideAirNode) {
380 3 : this->autoSizedValue = this->finalSysSizing(this->curSysNum).HeatOutHumRat;
381 : } else {
382 1 : this->autoSizedValue = this->finalSysSizing(this->curSysNum).HeatRetHumRat;
383 : }
384 : }
385 : }
386 : }
387 7 : this->selectSizerOutput(state, errorsFound);
388 7 : if (this->isCoilReportObject) {
389 7 : state.dataRptCoilSelection->coilSelectionReportObj->setCoilEntAirHumRat(state, this->compName, this->compType, this->autoSizedValue);
390 : }
391 7 : return this->autoSizedValue;
392 : }
393 :
394 : } // namespace EnergyPlus
|