Line data Source code
1 : // EnergyPlus, Copyright (c) 1996-2024, 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 : // ObjexxFCL Headers
49 : #include <ObjexxFCL/Array.functions.hh>
50 : #include <ObjexxFCL/Fmath.hh>
51 :
52 : // EnergyPlus Headers
53 : #include <AirflowNetwork/Solver.hpp>
54 : #include <EnergyPlus/Data/EnergyPlusData.hh>
55 : #include <EnergyPlus/DataHVACGlobals.hh>
56 : #include <EnergyPlus/DataIPShortCuts.hh>
57 : #include <EnergyPlus/DataLoopNode.hh>
58 : #include <EnergyPlus/DataZoneEquipment.hh>
59 : #include <EnergyPlus/GeneralRoutines.hh>
60 : #include <EnergyPlus/InputProcessing/InputProcessor.hh>
61 : #include <EnergyPlus/MixerComponent.hh>
62 : #include <EnergyPlus/NodeInputManager.hh>
63 : #include <EnergyPlus/ReturnAirPathManager.hh>
64 : #include <EnergyPlus/UtilityRoutines.hh>
65 : #include <EnergyPlus/ZonePlenum.hh>
66 :
67 : namespace EnergyPlus {
68 :
69 : namespace ReturnAirPathManager {
70 : // Module containing the routines dealing with the AirLoopHVAC:ReturnPath (formerly Return Air Path)
71 :
72 : // MODULE INFORMATION:
73 : // AUTHOR Russ Taylor
74 : // DATE WRITTEN January 1998
75 : // MODIFIED Lawrie, September 1999 -- consolidate ReturnAirPath data structure
76 : // RE-ENGINEERED na
77 :
78 : // PURPOSE OF THIS MODULE:
79 : // To manage the return air path.
80 :
81 6509971 : void SimReturnAirPath(EnergyPlusData &state)
82 : {
83 :
84 : // SUBROUTINE INFORMATION:
85 : // AUTHOR: Russ Taylor
86 : // DATE WRITTEN: Nov 1997
87 :
88 : // Locals
89 : int ReturnAirPathNum;
90 :
91 : // Obtains and Allocates Mixer related parameters from input file
92 6509971 : if (state.dataRetAirPathMrg->GetInputFlag) { // First time subroutine has been entered
93 796 : GetReturnAirPathInput(state);
94 796 : state.dataRetAirPathMrg->GetInputFlag = false;
95 : }
96 :
97 18077916 : for (ReturnAirPathNum = 1; ReturnAirPathNum <= state.dataZoneEquip->NumReturnAirPaths; ++ReturnAirPathNum) {
98 11567945 : CalcReturnAirPath(state, ReturnAirPathNum);
99 : }
100 6509971 : }
101 :
102 796 : void GetReturnAirPathInput(EnergyPlusData &state)
103 : {
104 : // SUBROUTINE INFORMATION:
105 : // AUTHOR: Russ Taylor
106 : // DATE WRITTEN: Nov 1997
107 :
108 : // PURPOSE OF THIS SUBROUTINE: This subroutine
109 :
110 : // Using/Aliasing
111 : using NodeInputManager::GetOnlySingleNode;
112 : using namespace DataLoopNode;
113 :
114 : // Locals
115 : int PathNum;
116 : int CompNum;
117 : int NumAlphas;
118 : int NumNums;
119 : int IOStat;
120 : int Counter;
121 : //////////// hoisted into namespace ////////////////////////////////////////////////
122 : // static bool ErrorsFound( false );
123 : ////////////////////////////////////////////////////////////////////////////////////
124 : bool IsNotOK; // Flag to verify name
125 :
126 796 : bool ErrorsFound = false;
127 :
128 796 : if (allocated(state.dataZoneEquip->ReturnAirPath)) {
129 796 : return;
130 : }
131 0 : auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject;
132 0 : cCurrentModuleObject = "AirLoopHVAC:ReturnPath";
133 0 : state.dataZoneEquip->NumReturnAirPaths = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject);
134 :
135 0 : if (state.dataZoneEquip->NumReturnAirPaths > 0) {
136 :
137 0 : state.dataZoneEquip->ReturnAirPath.allocate(state.dataZoneEquip->NumReturnAirPaths);
138 :
139 0 : for (PathNum = 1; PathNum <= state.dataZoneEquip->NumReturnAirPaths; ++PathNum) {
140 :
141 0 : state.dataInputProcessing->inputProcessor->getObjectItem(state,
142 : cCurrentModuleObject,
143 : PathNum,
144 0 : state.dataIPShortCut->cAlphaArgs,
145 : NumAlphas,
146 0 : state.dataIPShortCut->rNumericArgs,
147 : NumNums,
148 : IOStat);
149 0 : Util::IsNameEmpty(state, state.dataIPShortCut->cAlphaArgs(1), cCurrentModuleObject, ErrorsFound);
150 :
151 0 : state.dataZoneEquip->ReturnAirPath(PathNum).Name = state.dataIPShortCut->cAlphaArgs(1);
152 0 : state.dataZoneEquip->ReturnAirPath(PathNum).NumOfComponents = nint((NumAlphas - 2.0) / 2.0);
153 :
154 0 : state.dataZoneEquip->ReturnAirPath(PathNum).OutletNodeNum =
155 0 : GetOnlySingleNode(state,
156 0 : state.dataIPShortCut->cAlphaArgs(2),
157 : ErrorsFound,
158 : DataLoopNode::ConnectionObjectType::AirLoopHVACReturnPath,
159 0 : state.dataIPShortCut->cAlphaArgs(1),
160 : DataLoopNode::NodeFluidType::Air,
161 : DataLoopNode::ConnectionType::Outlet,
162 : NodeInputManager::CompFluidStream::Primary,
163 : ObjectIsParent);
164 :
165 0 : state.dataZoneEquip->ReturnAirPath(PathNum).ComponentType.allocate(state.dataZoneEquip->ReturnAirPath(PathNum).NumOfComponents);
166 0 : state.dataZoneEquip->ReturnAirPath(PathNum).ComponentType = "";
167 0 : state.dataZoneEquip->ReturnAirPath(PathNum).ComponentTypeEnum.allocate(state.dataZoneEquip->ReturnAirPath(PathNum).NumOfComponents);
168 0 : state.dataZoneEquip->ReturnAirPath(PathNum).ComponentTypeEnum = DataZoneEquipment::AirLoopHVACZone::Invalid;
169 0 : state.dataZoneEquip->ReturnAirPath(PathNum).ComponentName.allocate(state.dataZoneEquip->ReturnAirPath(PathNum).NumOfComponents);
170 0 : state.dataZoneEquip->ReturnAirPath(PathNum).ComponentName = "";
171 0 : state.dataZoneEquip->ReturnAirPath(PathNum).ComponentIndex.allocate(state.dataZoneEquip->ReturnAirPath(PathNum).NumOfComponents);
172 0 : state.dataZoneEquip->ReturnAirPath(PathNum).ComponentIndex = 0;
173 0 : Counter = 3;
174 :
175 0 : for (CompNum = 1; CompNum <= state.dataZoneEquip->ReturnAirPath(PathNum).NumOfComponents; ++CompNum) {
176 :
177 0 : if ((Util::SameString(state.dataIPShortCut->cAlphaArgs(Counter), "AirLoopHVAC:ZoneMixer")) ||
178 0 : (Util::SameString(state.dataIPShortCut->cAlphaArgs(Counter), "AirLoopHVAC:ReturnPlenum"))) {
179 :
180 0 : state.dataZoneEquip->ReturnAirPath(PathNum).ComponentType(CompNum) = state.dataIPShortCut->cAlphaArgs(Counter);
181 0 : state.dataZoneEquip->ReturnAirPath(PathNum).ComponentName(CompNum) = state.dataIPShortCut->cAlphaArgs(Counter + 1);
182 0 : ValidateComponent(state,
183 0 : state.dataZoneEquip->ReturnAirPath(PathNum).ComponentType(CompNum),
184 0 : state.dataZoneEquip->ReturnAirPath(PathNum).ComponentName(CompNum),
185 : IsNotOK,
186 : "AirLoopHVAC:ReturnPath");
187 0 : if (IsNotOK) {
188 0 : ShowContinueError(state, format("In AirLoopHVAC:ReturnPath ={}", state.dataZoneEquip->ReturnAirPath(PathNum).Name));
189 0 : ErrorsFound = true;
190 : }
191 0 : state.dataZoneEquip->ReturnAirPath(PathNum).ComponentTypeEnum(CompNum) = static_cast<DataZoneEquipment::AirLoopHVACZone>(
192 0 : getEnumValue(DataZoneEquipment::AirLoopHVACTypeNamesCC, state.dataIPShortCut->cAlphaArgs(Counter)));
193 :
194 : } else {
195 0 : ShowSevereError(
196 0 : state, format("Unhandled component type in AirLoopHVAC:ReturnPath of {}", state.dataIPShortCut->cAlphaArgs(Counter)));
197 0 : ShowContinueError(state, format("Occurs in AirLoopHVAC:ReturnPath = {}", state.dataZoneEquip->ReturnAirPath(PathNum).Name));
198 0 : ShowContinueError(state, "Must be \"AirLoopHVAC:ZoneMixer\" or \"AirLoopHVAC:ReturnPlenum\"");
199 0 : ErrorsFound = true;
200 : }
201 :
202 0 : Counter += 2;
203 : }
204 : }
205 : }
206 :
207 0 : if (ErrorsFound) {
208 0 : ShowFatalError(state, "Errors found getting AirLoopHVAC:ReturnPath. Preceding condition(s) causes termination.");
209 : }
210 : }
211 :
212 11567945 : void CalcReturnAirPath(EnergyPlusData &state, int &ReturnAirPathNum)
213 : {
214 : // SUBROUTINE INFORMATION:
215 : // AUTHOR: Russ Taylor
216 : // DATE WRITTEN: Nov 1997
217 :
218 : // PURPOSE OF THIS SUBROUTINE: This subroutine
219 :
220 : // METHODOLOGY EMPLOYED:
221 :
222 : // REFERENCES:
223 :
224 : // USE STATEMENTS:
225 :
226 : // Using/Aliasing
227 : using MixerComponent::SimAirMixer;
228 : using ZonePlenum::SimAirZonePlenum;
229 :
230 : // Locals
231 : int ComponentNum;
232 :
233 24757540 : for (ComponentNum = 1; ComponentNum <= state.dataZoneEquip->ReturnAirPath(ReturnAirPathNum).NumOfComponents; ++ComponentNum) {
234 13189595 : switch (state.dataZoneEquip->ReturnAirPath(ReturnAirPathNum).ComponentTypeEnum(ComponentNum)) {
235 10583554 : case DataZoneEquipment::AirLoopHVACZone::Mixer: // 'AirLoopHVAC:ZoneMixer'
236 :
237 10583554 : if (!(state.afn->AirflowNetworkFanActivated && state.afn->distribution_simulated)) {
238 10384462 : SimAirMixer(state,
239 10384462 : state.dataZoneEquip->ReturnAirPath(ReturnAirPathNum).ComponentName(ComponentNum),
240 10384462 : state.dataZoneEquip->ReturnAirPath(ReturnAirPathNum).ComponentIndex(ComponentNum));
241 : }
242 :
243 10583554 : break;
244 :
245 2606041 : case DataZoneEquipment::AirLoopHVACZone::ReturnPlenum: // 'AirLoopHVAC:ReturnPlenum'
246 :
247 5212082 : SimAirZonePlenum(state,
248 2606041 : state.dataZoneEquip->ReturnAirPath(ReturnAirPathNum).ComponentName(ComponentNum),
249 : DataZoneEquipment::AirLoopHVACZone::ReturnPlenum,
250 2606041 : state.dataZoneEquip->ReturnAirPath(ReturnAirPathNum).ComponentIndex(ComponentNum));
251 2606041 : break;
252 :
253 0 : default:
254 0 : ShowSevereError(state,
255 0 : format("Invalid AirLoopHVAC:ReturnPath Component={}",
256 0 : state.dataZoneEquip->ReturnAirPath(ReturnAirPathNum).ComponentType(ComponentNum)));
257 0 : ShowContinueError(state, format("Occurs in AirLoopHVAC:ReturnPath ={}", state.dataZoneEquip->ReturnAirPath(ReturnAirPathNum).Name));
258 0 : ShowFatalError(state, "Preceding condition causes termination.");
259 0 : break;
260 : }
261 : }
262 11567945 : }
263 :
264 0 : void ReportReturnAirPath([[maybe_unused]] int &ReturnAirPathNum) // unused1208
265 : {
266 : // SUBROUTINE INFORMATION:
267 : // AUTHOR: Russ Taylor
268 : // DATE WRITTEN: Nov 1997
269 :
270 : // PURPOSE OF THIS SUBROUTINE: This subroutine
271 :
272 : // METHODOLOGY EMPLOYED:
273 :
274 : // REFERENCES:
275 :
276 : // USE STATEMENTS:
277 0 : }
278 :
279 : } // namespace ReturnAirPathManager
280 :
281 : } // namespace EnergyPlus
|