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/HeatingAirflowUASizing.hh>
49 : #include <EnergyPlus/DataHVACGlobals.hh>
50 :
51 : namespace EnergyPlus {
52 :
53 0 : void HeatingAirflowUASizer::initializeForSingleDuctZoneTerminal(EnergyPlusData &state, Real64 const elevation, Real64 mainFlowRate)
54 : {
55 0 : this->initializeFromAPI(state, elevation);
56 0 : this->zoneSizingRunDone = true;
57 0 : this->curZoneEqNum = 1;
58 0 : this->termUnitSingDuct = true;
59 0 : this->curTermUnitSizingNum = 1;
60 0 : this->termUnitSizing.allocate(1);
61 0 : this->termUnitSizing(1).AirVolFlow = mainFlowRate;
62 0 : }
63 :
64 0 : void HeatingAirflowUASizer::initializeForZoneInductionUnit(EnergyPlusData &state,
65 : Real64 const elevation,
66 : Real64 mainFlowRate,
67 : Real64 reheatMultiplier)
68 : {
69 0 : this->initializeFromAPI(state, elevation);
70 0 : this->zoneSizingRunDone = true;
71 0 : this->curZoneEqNum = 1;
72 0 : this->termUnitIU = true;
73 0 : this->termUnitPIU = true; // probably don't need to set both, but whatever
74 0 : this->curTermUnitSizingNum = 1;
75 0 : this->termUnitSizing.allocate(1);
76 0 : this->termUnitSizing(1).AirVolFlow = mainFlowRate;
77 0 : this->termUnitSizing(1).ReheatAirFlowMult = reheatMultiplier;
78 0 : }
79 :
80 0 : void HeatingAirflowUASizer::initializeForZoneFanCoil(EnergyPlusData &state, Real64 const elevation, Real64 designHeatVolumeFlowRate)
81 : {
82 0 : this->initializeFromAPI(state, elevation);
83 0 : this->zoneSizingRunDone = true;
84 0 : this->zoneEqFanCoil = true;
85 0 : this->curZoneEqNum = 1;
86 0 : this->finalZoneSizing.allocate(1);
87 0 : this->finalZoneSizing(1).DesHeatVolFlow = designHeatVolumeFlowRate;
88 0 : }
89 :
90 : // TODO: What would the zone otherTypeEq include?
91 :
92 0 : void HeatingAirflowUASizer::initializeForSystemOutdoorAir(EnergyPlusData &state, Real64 const elevation, Real64 overallSystemMassFlowRate, bool DOAS)
93 : {
94 0 : this->initializeFromAPI(state, elevation);
95 0 : this->curSysNum = 1;
96 0 : this->curOASysNum = 1;
97 0 : if (DOAS) {
98 0 : this->outsideAirSys(1).AirLoopDOASNum = 0; // the DOAS structure is a zero-based vector, w00t!
99 0 : this->airloopDOAS.emplace_back();
100 0 : this->airloopDOAS[0].SizingMassFlow = overallSystemMassFlowRate;
101 : } else {
102 0 : this->finalSysSizing.allocate(1);
103 0 : this->finalSysSizing(1).DesOutAirVolFlow = 0.0; // TODO: what do I do here?
104 0 : this->autoSizedValue = this->finalSysSizing(this->curSysNum).DesOutAirVolFlow;
105 : }
106 0 : }
107 :
108 0 : void HeatingAirflowUASizer::initializeForSystemMainDuct(EnergyPlusData &state,
109 : Real64 const elevation,
110 : Real64 overallSystemVolFlow,
111 : Real64 minFlowRateRatio)
112 : {
113 0 : this->initializeFromAPI(state, elevation);
114 0 : this->curSysNum = 1;
115 0 : this->curDuctType = DataHVACGlobals::AirDuctType::Main;
116 0 : this->finalSysSizing.allocate(1);
117 0 : this->finalSysSizing(1).SysAirMinFlowRat = minFlowRateRatio;
118 0 : this->finalSysSizing(1).DesMainVolFlow = overallSystemVolFlow;
119 0 : }
120 :
121 0 : void HeatingAirflowUASizer::initializeForSystemCoolingDuct(EnergyPlusData &state, Real64 const elevation)
122 : {
123 0 : this->initializeFromAPI(state, elevation);
124 0 : this->curSysNum = 1;
125 0 : }
126 :
127 0 : void HeatingAirflowUASizer::initializeForSystemHeatingDuct(EnergyPlusData &state, Real64 const elevation)
128 : {
129 0 : this->initializeFromAPI(state, elevation);
130 0 : this->curSysNum = 1;
131 0 : }
132 :
133 0 : void HeatingAirflowUASizer::initializeForSystemOtherDuct(EnergyPlusData &state, Real64 const elevation)
134 : {
135 0 : this->initializeFromAPI(state, elevation);
136 0 : this->curSysNum = 1;
137 0 : }
138 :
139 2213 : Real64 HeatingAirflowUASizer::size(EnergyPlusData &state, Real64 _originalValue, bool &errorsFound)
140 : {
141 2213 : if (!this->checkInitialized(state, errorsFound)) {
142 0 : return 0.0;
143 : }
144 2213 : this->preSize(state, _originalValue);
145 2213 : if (this->curZoneEqNum > 0) {
146 1842 : if (!this->wasAutoSized && !this->sizingDesRunThisZone) {
147 0 : this->autoSizedValue = _originalValue;
148 : } else {
149 1842 : if (this->termUnitSingDuct && (this->curTermUnitSizingNum > 0)) {
150 1700 : this->autoSizedValue = this->stdRhoAir * this->termUnitSizing(this->curTermUnitSizingNum).AirVolFlow;
151 142 : } else if ((this->termUnitPIU || this->termUnitIU) && (this->curTermUnitSizingNum > 0)) {
152 76 : this->autoSizedValue = this->stdRhoAir * this->termUnitSizing(this->curTermUnitSizingNum).AirVolFlow *
153 38 : this->termUnitSizing(this->curTermUnitSizingNum).ReheatAirFlowMult;
154 104 : } else if (this->zoneEqFanCoil) {
155 80 : this->autoSizedValue = this->stdRhoAir * this->finalZoneSizing(this->curZoneEqNum).DesHeatVolFlow;
156 24 : } else if (this->otherEqType) {
157 24 : if (this->zoneEqSizing(this->curZoneEqNum).SystemAirFlow) {
158 0 : this->autoSizedValue = this->zoneEqSizing(this->curZoneEqNum).AirVolFlow * this->stdRhoAir;
159 24 : } else if (this->zoneEqSizing(this->curZoneEqNum).HeatingAirFlow) {
160 12 : this->autoSizedValue = this->zoneEqSizing(this->curZoneEqNum).HeatingAirVolFlow * this->stdRhoAir;
161 : } else {
162 12 : this->autoSizedValue = this->finalZoneSizing(this->curZoneEqNum).DesHeatMassFlow;
163 : }
164 : } else {
165 0 : this->errorType = AutoSizingResultType::ErrorType1;
166 0 : errorsFound = true;
167 : }
168 : }
169 371 : } else if (this->curSysNum > 0) {
170 371 : if (!this->wasAutoSized && !this->sizingDesRunThisAirSys) {
171 0 : this->autoSizedValue = _originalValue;
172 : } else {
173 371 : if (this->curOASysNum > 0) {
174 28 : if (this->outsideAirSys(this->curOASysNum).AirLoopDOASNum > -1) {
175 1 : this->autoSizedValue = this->airloopDOAS[this->outsideAirSys(this->curOASysNum).AirLoopDOASNum].SizingMassFlow / this->stdRhoAir;
176 : } else {
177 27 : this->autoSizedValue = this->finalSysSizing(this->curSysNum).DesOutAirVolFlow;
178 : }
179 : } else {
180 343 : if (this->curDuctType == DataHVACGlobals::AirDuctType::Main) {
181 340 : if (this->finalSysSizing(this->curSysNum).SysAirMinFlowRat > 0.0) {
182 339 : this->autoSizedValue =
183 339 : this->finalSysSizing(this->curSysNum).SysAirMinFlowRat * this->finalSysSizing(this->curSysNum).DesMainVolFlow;
184 : } else {
185 1 : this->autoSizedValue = this->finalSysSizing(this->curSysNum).DesMainVolFlow;
186 : }
187 3 : } else if (this->curDuctType == DataHVACGlobals::AirDuctType::Cooling) {
188 0 : if (this->finalSysSizing(this->curSysNum).SysAirMinFlowRat > 0.0) {
189 0 : this->autoSizedValue =
190 0 : this->finalSysSizing(this->curSysNum).SysAirMinFlowRat * this->finalSysSizing(this->curSysNum).DesCoolVolFlow;
191 : } else {
192 0 : this->autoSizedValue = this->finalSysSizing(this->curSysNum).DesCoolVolFlow;
193 : }
194 3 : } else if (this->curDuctType == DataHVACGlobals::AirDuctType::Heating) {
195 3 : this->autoSizedValue = this->finalSysSizing(this->curSysNum).DesHeatVolFlow;
196 : } else {
197 0 : this->autoSizedValue = this->finalSysSizing(this->curSysNum).DesMainVolFlow;
198 : }
199 : }
200 371 : this->autoSizedValue *= this->stdRhoAir;
201 : }
202 : }
203 2213 : if (this->autoSizedValue < DataHVACGlobals::SmallAirVolFlow) {
204 0 : this->addErrorMessage("Autosized value was zero or less than zero");
205 0 : this->autoSizedValue = 0.0;
206 : }
207 2213 : if (this->overrideSizeString) {
208 2213 : if (this->isEpJSON) this->sizingString = "heating_coil_airflow_for_ua";
209 : }
210 2213 : this->selectSizerOutput(state, errorsFound);
211 2213 : return this->autoSizedValue;
212 : }
213 :
214 2313 : } // namespace EnergyPlus
|