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