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 : // C++ Headers
49 : #include <algorithm>
50 : #include <cassert>
51 :
52 : // ObjexxFCL Headers
53 : #include <ObjexxFCL/Array.functions.hh>
54 : #include <ObjexxFCL/string.functions.hh>
55 :
56 : // EnergyPlus Headers
57 : #include <EnergyPlus/Autosizing/Base.hh>
58 : #include <EnergyPlus/BoilerSteam.hh>
59 : #include <EnergyPlus/Boilers.hh>
60 : #include <EnergyPlus/BranchInputManager.hh>
61 : #include <EnergyPlus/CTElectricGenerator.hh>
62 : #include <EnergyPlus/ChillerAbsorption.hh>
63 : #include <EnergyPlus/ChillerElectricASHRAE205.hh>
64 : #include <EnergyPlus/ChillerElectricEIR.hh>
65 : #include <EnergyPlus/ChillerExhaustAbsorption.hh>
66 : #include <EnergyPlus/ChillerGasAbsorption.hh>
67 : #include <EnergyPlus/ChillerIndirectAbsorption.hh>
68 : #include <EnergyPlus/ChillerReformulatedEIR.hh>
69 : #include <EnergyPlus/CondenserLoopTowers.hh>
70 : #include <EnergyPlus/Data/EnergyPlusData.hh>
71 : #include <EnergyPlus/DataBranchAirLoopPlant.hh>
72 : #include <EnergyPlus/DataEnvironment.hh>
73 : #include <EnergyPlus/DataErrorTracking.hh>
74 : #include <EnergyPlus/DataHVACGlobals.hh>
75 : #include <EnergyPlus/DataIPShortCuts.hh>
76 : #include <EnergyPlus/DataLoopNode.hh>
77 : #include <EnergyPlus/DataSizing.hh>
78 : #include <EnergyPlus/EMSManager.hh>
79 : #include <EnergyPlus/EvaporativeFluidCoolers.hh>
80 : #include <EnergyPlus/FluidCoolers.hh>
81 : #include <EnergyPlus/FluidProperties.hh>
82 : #include <EnergyPlus/FuelCellElectricGenerator.hh>
83 : #include <EnergyPlus/GroundHeatExchangers.hh>
84 : #include <EnergyPlus/HVACInterfaceManager.hh>
85 : #include <EnergyPlus/HVACVariableRefrigerantFlow.hh>
86 : #include <EnergyPlus/HeatPumpWaterToWaterCOOLING.hh>
87 : #include <EnergyPlus/HeatPumpWaterToWaterHEATING.hh>
88 : #include <EnergyPlus/HeatPumpWaterToWaterSimple.hh>
89 : #include <EnergyPlus/ICEngineElectricGenerator.hh>
90 : #include <EnergyPlus/IceThermalStorage.hh>
91 : #include <EnergyPlus/InputProcessing/InputProcessor.hh>
92 : #include <EnergyPlus/MicroCHPElectricGenerator.hh>
93 : #include <EnergyPlus/MicroturbineElectricGenerator.hh>
94 : #include <EnergyPlus/NodeInputManager.hh>
95 : #include <EnergyPlus/OutputProcessor.hh>
96 : #include <EnergyPlus/OutputReportPredefined.hh>
97 : #include <EnergyPlus/OutsideEnergySources.hh>
98 : #include <EnergyPlus/PhotovoltaicThermalCollectors.hh>
99 : #include <EnergyPlus/PipeHeatTransfer.hh>
100 : #include <EnergyPlus/Pipes.hh>
101 : #include <EnergyPlus/Plant/PlantManager.hh>
102 : #include <EnergyPlus/PlantCentralGSHP.hh>
103 : #include <EnergyPlus/PlantChillers.hh>
104 : #include <EnergyPlus/PlantComponentTemperatureSources.hh>
105 : #include <EnergyPlus/PlantHeatExchangerFluidToFluid.hh>
106 : #include <EnergyPlus/PlantLoadProfile.hh>
107 : #include <EnergyPlus/PlantLoopHeatPumpEIR.hh>
108 : #include <EnergyPlus/PlantPipingSystemsManager.hh>
109 : #include <EnergyPlus/PlantUtilities.hh>
110 : #include <EnergyPlus/PlantValves.hh>
111 : #include <EnergyPlus/PondGroundHeatExchanger.hh>
112 : #include <EnergyPlus/RefrigeratedCase.hh>
113 : #include <EnergyPlus/ScheduleManager.hh>
114 : #include <EnergyPlus/SetPointManager.hh>
115 : #include <EnergyPlus/SolarCollectors.hh>
116 : #include <EnergyPlus/SurfaceGroundHeatExchanger.hh>
117 : #include <EnergyPlus/SwimmingPool.hh>
118 : #include <EnergyPlus/SystemAvailabilityManager.hh>
119 : #include <EnergyPlus/UserDefinedComponents.hh>
120 : #include <EnergyPlus/UtilityRoutines.hh>
121 : #include <EnergyPlus/WaterThermalTanks.hh>
122 : #include <EnergyPlus/WaterUse.hh>
123 :
124 : namespace EnergyPlus::PlantManager {
125 :
126 : // MODULE INFORMATION:
127 : // AUTHOR Sankaranarayanan K P, Rich Liesen
128 : // DATE WRITTEN May 2005
129 : // MODIFIED
130 : // RE-ENGINEERED Sept. 2010 D. Fisher, Edwin Lee, Brent Griffith
131 : // major plant upgrades:
132 : // Single half loop solver
133 : // Automated branch control types
134 : // new loop sequencing structure
135 : // Temperature out range checks
136 :
137 : // PURPOSE OF THIS MODULE:
138 : // This module serves as the driver for the plant simulation. All necessary iterations and update related to plant
139 : // connections are performed in this module.
140 :
141 : // Using/Aliasing
142 : using namespace DataPlant;
143 : using namespace DataBranchAirLoopPlant;
144 : using namespace DataLoopNode;
145 :
146 5781593 : void ManagePlantLoops(EnergyPlusData &state,
147 : bool const FirstHVACIteration,
148 : bool &SimAirLoops, // True when the air loops need to be (re)simulated
149 : bool &SimZoneEquipment, // True when zone equipment components need to be (re)simulated
150 : [[maybe_unused]] bool &SimNonZoneEquipment, // True when non-zone equipment components need to be (re)simulated
151 : bool &SimPlantLoops, // True when some part of Plant needs to be (re)simulated
152 : bool &SimElecCircuits // True when electric circuits need to be (re)simulated
153 : )
154 : {
155 :
156 : // SUBROUTINE INFORMATION:
157 : // AUTHOR Sankaranarayanan K P
158 : // DATE WRITTEN Apr 2005
159 : // MODIFIED
160 : // RE-ENGINEERED B. Griffith, Feb. 2010
161 :
162 : // PURPOSE OF THIS SUBROUTINE:
163 : // This subroutine manages the plant loop simulation
164 :
165 : // METHODOLOGY EMPLOYED:
166 : // Set up the while iteration block for the plant loop simulation.
167 : // Calls half loop sides to be simulated in predetermined order.
168 : // Reset the flags as necessary
169 :
170 : // Using/Aliasing
171 : using PlantUtilities::LogPlantConvergencePoints;
172 :
173 : // SUBROUTINE VARIABLE DEFINITIONS
174 : int IterPlant;
175 : int LoopNum;
176 : DataPlant::LoopSideLocation LoopSide;
177 : DataPlant::LoopSideLocation OtherSide;
178 : bool SimHalfLoopFlag;
179 : int HalfLoopNum;
180 : int CurntMinPlantSubIterations;
181 :
182 5781593 : if (std::any_of(state.dataPlnt->PlantLoop.begin(), state.dataPlnt->PlantLoop.end(), [](DataPlant::PlantLoopData const &e) {
183 7745616 : return (e.CommonPipeType == DataPlant::CommonPipeType::Single) || (e.CommonPipeType == DataPlant::CommonPipeType::TwoWay);
184 : })) {
185 49088 : CurntMinPlantSubIterations = max(7, state.dataConvergeParams->MinPlantSubIterations);
186 : } else {
187 5732505 : CurntMinPlantSubIterations = state.dataConvergeParams->MinPlantSubIterations;
188 : }
189 :
190 5781593 : if (state.dataPlnt->TotNumLoops <= 0) { // quick return if no plant in model
191 2800616 : SimPlantLoops = false;
192 2800616 : return;
193 : }
194 :
195 2980977 : IterPlant = 0;
196 2980977 : InitializeLoops(state, FirstHVACIteration);
197 :
198 9824554 : while ((SimPlantLoops) && (IterPlant <= state.dataConvergeParams->MaxPlantSubIterations)) {
199 : // go through half loops in predetermined calling order
200 43585883 : for (HalfLoopNum = 1; HalfLoopNum <= state.dataPlnt->TotNumHalfLoops; ++HalfLoopNum) {
201 :
202 36742306 : LoopNum = state.dataPlnt->PlantCallingOrderInfo(HalfLoopNum).LoopIndex;
203 36742306 : LoopSide = state.dataPlnt->PlantCallingOrderInfo(HalfLoopNum).LoopSide;
204 36742306 : OtherSide = LoopSideOther[static_cast<int>(LoopSide)]; // will give us 1 if LoopSide is 2, or 2 if LoopSide is 1
205 :
206 36742306 : auto &this_loop(state.dataPlnt->PlantLoop(LoopNum));
207 36742306 : auto &this_loop_side(this_loop.LoopSide(LoopSide));
208 36742306 : auto &other_loop_side(this_loop.LoopSide(OtherSide));
209 :
210 36742306 : SimHalfLoopFlag = this_loop_side.SimLoopSideNeeded; // set half loop sim flag
211 :
212 36742306 : if (SimHalfLoopFlag || IterPlant <= CurntMinPlantSubIterations) {
213 :
214 36489570 : this_loop_side.solve(state, FirstHVACIteration, other_loop_side.SimLoopSideNeeded);
215 :
216 : // Always set this side to false, so that it won't keep being turned on just because of first hvac
217 36489570 : this_loop_side.SimLoopSideNeeded = false;
218 :
219 : // If we did the demand side, turn on the supply side (only if we need to do it last)
220 36489570 : if (LoopSide == LoopSideLocation::Demand) {
221 18249734 : if (this_loop.HasPressureComponents) {
222 10530 : other_loop_side.SimLoopSideNeeded = false;
223 : }
224 : }
225 :
226 : // Update the report variable
227 36489570 : this_loop.LastLoopSideSimulated = static_cast<int>(LoopSide);
228 :
229 36489570 : ++state.dataPlnt->PlantManageHalfLoopCalls;
230 : }
231 :
232 : } // half loop based calling order...
233 :
234 : // decide new status for SimPlantLoops flag
235 6843577 : SimPlantLoops = false;
236 24077733 : for (LoopNum = 1; LoopNum <= state.dataPlnt->TotNumLoops; ++LoopNum) {
237 52307061 : for (DataPlant::LoopSideLocation LoopSideNum : DataPlant::LoopSideKeys) {
238 35072905 : if (state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).SimLoopSideNeeded) {
239 598109 : SimPlantLoops = true;
240 598109 : goto LoopLevel_exit;
241 : }
242 : }
243 : }
244 6245468 : LoopLevel_exit:;
245 :
246 6843577 : ++IterPlant; // Increment the iteration counter
247 6843577 : if (IterPlant < CurntMinPlantSubIterations) {
248 3782443 : SimPlantLoops = true;
249 : }
250 6843577 : ++state.dataPlnt->PlantManageSubIterations; // these are summed across all half loops for reporting
251 : } // while
252 :
253 : // add check for non-plant system sim flag updates
254 : // could set SimAirLoops, SimElecCircuits, SimZoneEquipment flags for now
255 10769677 : for (LoopNum = 1; LoopNum <= state.dataPlnt->TotNumLoops; ++LoopNum) {
256 23366100 : for (DataPlant::LoopSideLocation LoopSideChk : DataPlant::LoopSideKeys) {
257 15577400 : auto const &this_loop_side(state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideChk));
258 15577400 : if (this_loop_side.SimAirLoopsNeeded) {
259 60040 : SimAirLoops = true;
260 : }
261 15577400 : if (this_loop_side.SimZoneEquipNeeded) {
262 3058 : SimZoneEquipment = true;
263 : }
264 : // IF (this_loop_side.SimNonZoneEquipNeeded) SimNonZoneEquipment = .TRUE.
265 15577400 : if (this_loop_side.SimElectLoadCentrNeeded) {
266 4173 : SimElecCircuits = true;
267 : }
268 : }
269 : }
270 :
271 : // Also log the convergence history of all loopsides once complete
272 2980977 : LogPlantConvergencePoints(state, FirstHVACIteration);
273 : }
274 :
275 801 : void GetPlantLoopData(EnergyPlusData &state)
276 : {
277 :
278 : // SUBROUTINE INFORMATION:
279 : // AUTHOR Sankaranarayanan K P
280 : // DATE WRITTEN April 2005
281 : // MODIFIED na
282 : // RE-ENGINEERED na
283 :
284 : // PURPOSE OF THIS SUBROUTINE:
285 : // This subroutine reads the primary plant loop
286 : // attributes from the input file
287 :
288 : // METHODOLOGY EMPLOYED:
289 : // calls the Input Processor to retrieve data from input file.
290 :
291 : // Using/Aliasing
292 : using SetPointManager::IsNodeOnSetPtManager;
293 801 : HVAC::CtrlVarType localTempSetPt = HVAC::CtrlVarType::Temp;
294 : using NodeInputManager::GetOnlySingleNode;
295 : using namespace BranchInputManager;
296 : using DataSizing::AutoSize;
297 :
298 : // SUBROUTINE PARAMETER DEFINITIONS:
299 : static constexpr std::string_view RoutineName("GetPlant/CondenserLoopData: ");
300 : static constexpr std::string_view routineName = "GetPlant/CondenserLoopData";
301 :
302 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
303 : int LoopNum; // DO loop counter for loops
304 : int NumAlphas; // Number of elements in the alpha array
305 : int NumNums; // Number of elements in the numeric array
306 : int IOStat; // IO Status when calling get input subroutine
307 : int NumFluids; // number of fluids in sim
308 : int PlantLoopNum;
309 : int CondLoopNum;
310 801 : Array1D_string Alpha(18); // dimension to num of alpha fields in input
311 801 : Array1D<Real64> Num(30); // dimension to num of numeric data fields in input
312 801 : bool ErrorsFound(false);
313 801 : std::string CurrentModuleObject; // for ease in renaming.
314 : bool MatchedPressureString;
315 : int PressSimAlphaIndex;
316 :
317 801 : CurrentModuleObject = "PlantLoop";
318 1602 : state.dataHVACGlobal->NumPlantLoops =
319 801 : state.dataInputProcessing->inputProcessor->getNumObjectsFound(state,
320 : CurrentModuleObject); // Get the number of primary plant loops
321 801 : CurrentModuleObject = "CondenserLoop";
322 1602 : state.dataHVACGlobal->NumCondLoops =
323 801 : state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, CurrentModuleObject); // Get the number of Condenser loops
324 801 : state.dataPlnt->TotNumLoops = state.dataHVACGlobal->NumPlantLoops + state.dataHVACGlobal->NumCondLoops;
325 :
326 801 : if (state.dataPlnt->TotNumLoops > 0) {
327 463 : state.dataPlnt->PlantLoop.allocate(state.dataPlnt->TotNumLoops);
328 463 : state.dataConvergeParams->PlantConvergence.allocate(state.dataPlnt->TotNumLoops);
329 463 : if (!allocated(state.dataAvail->PlantAvailMgr)) {
330 463 : state.dataAvail->PlantAvailMgr.allocate(state.dataPlnt->TotNumLoops);
331 : }
332 : } else {
333 338 : return;
334 : }
335 :
336 1621 : for (LoopNum = 1; LoopNum <= state.dataPlnt->TotNumLoops; ++LoopNum) {
337 1158 : Alpha = "";
338 1158 : Num = 0.0;
339 :
340 : // set up some references
341 1158 : auto &this_loop(state.dataPlnt->PlantLoop(LoopNum));
342 1158 : auto &this_demand_side(this_loop.LoopSide(DataPlant::LoopSideLocation::Demand));
343 1158 : auto &this_supply_side(this_loop.LoopSide(DataPlant::LoopSideLocation::Supply));
344 :
345 1158 : ErrorObjectHeader eoh;
346 1158 : eoh.routineName = routineName;
347 :
348 : DataLoopNode::ConnectionObjectType objType;
349 1158 : if (LoopNum <= state.dataHVACGlobal->NumPlantLoops) {
350 898 : PlantLoopNum = LoopNum;
351 898 : this_loop.TypeOfLoop = LoopType::Plant;
352 898 : CurrentModuleObject = "PlantLoop";
353 898 : objType = DataLoopNode::ConnectionObjectType::PlantLoop;
354 1796 : state.dataInputProcessing->inputProcessor->getObjectItem(state,
355 : CurrentModuleObject,
356 : PlantLoopNum,
357 : Alpha,
358 : NumAlphas,
359 : Num,
360 : NumNums,
361 : IOStat,
362 898 : state.dataIPShortCut->lNumericFieldBlanks,
363 898 : state.dataIPShortCut->lAlphaFieldBlanks,
364 898 : state.dataIPShortCut->cAlphaFieldNames,
365 898 : state.dataIPShortCut->cNumericFieldNames);
366 :
367 898 : eoh.objectType = CurrentModuleObject;
368 898 : eoh.objectName = Alpha(1);
369 : } else {
370 260 : CondLoopNum = LoopNum - state.dataHVACGlobal->NumPlantLoops;
371 260 : this_loop.TypeOfLoop = LoopType::Condenser;
372 260 : CurrentModuleObject = "CondenserLoop";
373 260 : objType = DataLoopNode::ConnectionObjectType::CondenserLoop;
374 780 : state.dataInputProcessing->inputProcessor->getObjectItem(state,
375 : CurrentModuleObject,
376 : CondLoopNum,
377 : Alpha,
378 : NumAlphas,
379 : Num,
380 : NumNums,
381 : IOStat,
382 260 : state.dataIPShortCut->lNumericFieldBlanks,
383 : _,
384 260 : state.dataIPShortCut->cAlphaFieldNames,
385 260 : state.dataIPShortCut->cNumericFieldNames);
386 260 : eoh.objectType = CurrentModuleObject;
387 260 : eoh.objectName = Alpha(1);
388 : }
389 :
390 1158 : Util::IsNameEmpty(state, Alpha(1), CurrentModuleObject, ErrorsFound);
391 1158 : this_loop.Name = Alpha(1); // Load the Plant Loop Name
392 :
393 1158 : if (Util::SameString(Alpha(2), "STEAM")) {
394 : // A steam loop needs both the refrigerant (i.e.,
395 : // liquid-vapor mixture) properties and the glycol (liquid
396 : // properties) for the condensate. The way this was done
397 : // is that both Water (glycol) and Steam (refrig) were at
398 : // index 1 in their respective arrays and so they could
399 : // use a single index, and because the index was pre-set
400 : // the FluidName was never consulted. That's not a very
401 : // robust way of doing things.
402 9 : this_loop.FluidType = DataLoopNode::NodeFluidType::Steam;
403 9 : this_loop.FluidName = Alpha(2);
404 9 : this_loop.FluidIndex = 1;
405 9 : this_loop.glycol = Fluid::GetWater(state);
406 9 : this_loop.steam = Fluid::GetSteam(state);
407 :
408 1149 : } else if (Util::SameString(Alpha(2), "WATER")) {
409 1123 : this_loop.FluidType = DataLoopNode::NodeFluidType::Water;
410 1123 : this_loop.FluidName = Alpha(2);
411 1123 : this_loop.FluidIndex = 1;
412 1123 : this_loop.glycol = Fluid::GetWater(state);
413 :
414 26 : } else if (Util::SameString(Alpha(2), "USERDEFINEDFLUIDTYPE")) {
415 26 : this_loop.FluidType = DataLoopNode::NodeFluidType::Water;
416 26 : this_loop.FluidName = Alpha(3);
417 : // check for valid fluid name
418 26 : this_loop.glycol = Fluid::GetGlycol(state, Alpha(3));
419 26 : if (this_loop.glycol == nullptr) {
420 0 : ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(3), Alpha(3));
421 0 : ErrorsFound = true;
422 : } else {
423 26 : this_loop.FluidIndex = this_loop.glycol->Num;
424 : }
425 :
426 : } else {
427 0 : ShowWarningInvalidKey(state, eoh, state.dataIPShortCut->cAlphaFieldNames(2), Alpha(2), "Water");
428 :
429 0 : this_loop.FluidType = DataLoopNode::NodeFluidType::Water;
430 0 : this_loop.FluidName = "WATER";
431 0 : this_loop.FluidIndex = 1;
432 0 : this_loop.glycol = Fluid::GetWater(state);
433 : }
434 :
435 1158 : this_loop.OperationScheme = Alpha(4); // Load the Plant Control Scheme Priority List
436 :
437 : // Load the temperature and flow rate maximum and minimum limits
438 1158 : this_loop.MaxTemp = Num(1);
439 1158 : this_loop.MinTemp = Num(2);
440 1158 : this_loop.MaxVolFlowRate = Num(3);
441 1158 : if (this_loop.MaxVolFlowRate == AutoSize) {
442 726 : this_loop.MaxVolFlowRateWasAutoSized = true;
443 : }
444 1158 : this_loop.MinVolFlowRate = Num(4);
445 :
446 : // The Plant loop volume for both halves of the loop is read in and used in this module for the
447 : // correct loop temperature step. Loop data is read in supply side, but the volume is not used in
448 : // a calculation there.
449 1158 : this_loop.Volume = Num(5);
450 1158 : if (state.dataIPShortCut->lNumericFieldBlanks(5)) {
451 69 : this_loop.Volume = Constant::AutoCalculate;
452 : }
453 1158 : if (this_loop.Volume == Constant::AutoCalculate) {
454 1118 : this_loop.VolumeWasAutoSized = true;
455 : }
456 : // circulation time used to autocalculate loop volume
457 1158 : if (state.dataIPShortCut->lNumericFieldBlanks(6)) {
458 1144 : this_loop.CirculationTime = 2.0; // default
459 : } else {
460 14 : this_loop.CirculationTime = Num(6);
461 : }
462 :
463 : // Load the Loop Inlet and Outlet Nodes and Connection Info (Alpha(7-10) are related to the supply side)
464 1158 : this_supply_side.NodeNameIn = Alpha(6);
465 1158 : this_supply_side.NodeNameOut = Alpha(7);
466 1158 : this_supply_side.BranchList = Alpha(8);
467 1158 : this_supply_side.ConnectList = Alpha(9);
468 1158 : this_demand_side.NodeNameIn = Alpha(10);
469 1158 : this_demand_side.NodeNameOut = Alpha(11);
470 1158 : this_demand_side.BranchList = Alpha(12);
471 1158 : this_demand_side.ConnectList = Alpha(13);
472 :
473 1158 : this_supply_side.NodeNumIn = GetOnlySingleNode(state,
474 1158 : Alpha(6),
475 : ErrorsFound,
476 : objType,
477 1158 : Alpha(1),
478 : this_loop.FluidType,
479 : DataLoopNode::ConnectionType::Inlet,
480 : NodeInputManager::CompFluidStream::Primary,
481 : ObjectIsParent);
482 1158 : this_supply_side.NodeNumOut = GetOnlySingleNode(state,
483 1158 : Alpha(7),
484 : ErrorsFound,
485 : objType,
486 1158 : Alpha(1),
487 : this_loop.FluidType,
488 : DataLoopNode::ConnectionType::Outlet,
489 : NodeInputManager::CompFluidStream::Primary,
490 : ObjectIsParent);
491 1158 : this_demand_side.NodeNumIn = GetOnlySingleNode(state,
492 1158 : Alpha(10),
493 : ErrorsFound,
494 : objType,
495 1158 : Alpha(1),
496 : this_loop.FluidType,
497 : DataLoopNode::ConnectionType::Inlet,
498 : NodeInputManager::CompFluidStream::Primary,
499 : ObjectIsParent);
500 1158 : this_demand_side.NodeNumOut = GetOnlySingleNode(state,
501 1158 : Alpha(11),
502 : ErrorsFound,
503 : objType,
504 1158 : Alpha(1),
505 : this_loop.FluidType,
506 : DataLoopNode::ConnectionType::Outlet,
507 : NodeInputManager::CompFluidStream::Primary,
508 : ObjectIsParent);
509 :
510 1158 : this_demand_side.InletNodeSetPt = IsNodeOnSetPtManager(state, this_demand_side.NodeNumIn, localTempSetPt);
511 1158 : this_demand_side.OutletNodeSetPt = IsNodeOnSetPtManager(state, this_demand_side.NodeNumOut, localTempSetPt);
512 1158 : this_supply_side.InletNodeSetPt = IsNodeOnSetPtManager(state, this_supply_side.NodeNumIn, localTempSetPt);
513 1158 : this_supply_side.OutletNodeSetPt = IsNodeOnSetPtManager(state, this_supply_side.NodeNumOut, localTempSetPt);
514 1158 : this_loop.TempSetPointNodeNum = GetOnlySingleNode(state,
515 1158 : Alpha(5),
516 : ErrorsFound,
517 : objType,
518 1158 : Alpha(1),
519 : this_loop.FluidType,
520 : DataLoopNode::ConnectionType::Sensor,
521 : NodeInputManager::CompFluidStream::Primary,
522 : ObjectIsParent);
523 :
524 : // Load the load distribution scheme.
525 1158 : std::string LoadingScheme = Alpha(14);
526 1158 : if (Util::SameString(LoadingScheme, "Optimal")) {
527 568 : this_loop.LoadDistribution = DataPlant::LoadingScheme::Optimal;
528 590 : } else if (Util::SameString(LoadingScheme, "SequentialLoad")) {
529 560 : this_loop.LoadDistribution = DataPlant::LoadingScheme::Sequential;
530 30 : } else if (Util::SameString(LoadingScheme, "UniformLoad")) {
531 30 : this_loop.LoadDistribution = DataPlant::LoadingScheme::Uniform;
532 0 : } else if (Util::SameString(LoadingScheme, "UniformPLR")) {
533 0 : this_loop.LoadDistribution = DataPlant::LoadingScheme::UniformPLR;
534 0 : } else if (Util::SameString(LoadingScheme, "SequentialUniformPLR")) {
535 0 : this_loop.LoadDistribution = DataPlant::LoadingScheme::SequentialUniformPLR;
536 : } else {
537 0 : ShowWarningError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + Alpha(1) + "\", Invalid choice.");
538 0 : ShowContinueError(state, "..." + state.dataIPShortCut->cAlphaFieldNames(14) + "=\"" + Alpha(14) + "\".");
539 0 : ShowContinueError(state, "Will default to SequentialLoad."); // TODO rename point
540 0 : this_loop.LoadDistribution = DataPlant::LoadingScheme::Sequential;
541 : }
542 :
543 : // When dual setpoint is allowed in condenser loop modify this code.
544 1158 : if (this_loop.TypeOfLoop == LoopType::Plant) {
545 : // Get the Loop Demand Calculation Scheme
546 898 : if (Util::SameString(Alpha(16), "SingleSetpoint")) {
547 883 : this_loop.LoopDemandCalcScheme = DataPlant::LoopDemandCalcScheme::SingleSetPoint;
548 15 : } else if (Util::SameString(Alpha(16), "DualSetpointDeadband")) {
549 15 : if (this_loop.FluidType == DataLoopNode::NodeFluidType::Steam) {
550 0 : ShowWarningError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + Alpha(1) + "\", Invalid choice.");
551 0 : ShowContinueError(state,
552 0 : state.dataIPShortCut->cAlphaFieldNames(16) + "=\"" + Alpha(16) + "\" not valid for " +
553 0 : state.dataIPShortCut->cAlphaFieldNames(2) + "= Steam");
554 0 : ShowContinueError(state,
555 0 : "Will reset " + state.dataIPShortCut->cAlphaFieldNames(16) + " = SingleSetPoint and simulation will continue.");
556 0 : this_loop.LoopDemandCalcScheme = DataPlant::LoopDemandCalcScheme::SingleSetPoint;
557 : } else {
558 15 : this_loop.LoopDemandCalcScheme = DataPlant::LoopDemandCalcScheme::DualSetPointDeadBand;
559 : }
560 0 : } else if (Util::SameString(Alpha(16), "")) {
561 0 : this_loop.LoopDemandCalcScheme = DataPlant::LoopDemandCalcScheme::SingleSetPoint;
562 : } else {
563 0 : ShowWarningError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + Alpha(1) + "\", Invalid choice.");
564 0 : ShowContinueError(state, "..." + state.dataIPShortCut->cAlphaFieldNames(16) + "=\"" + Alpha(16) + "\".");
565 0 : ShowContinueError(state, "Will default to SingleSetPoint."); // TODO rename point
566 0 : this_loop.LoopDemandCalcScheme = DataPlant::LoopDemandCalcScheme::SingleSetPoint;
567 : }
568 260 : } else if (this_loop.TypeOfLoop == LoopType::Condenser) {
569 260 : this_loop.LoopDemandCalcScheme = DataPlant::LoopDemandCalcScheme::SingleSetPoint;
570 : }
571 :
572 : // When Commonpipe is allowed in condenser loop modify this code. Sankar 06/29/2009
573 1158 : if (this_loop.TypeOfLoop == LoopType::Plant) {
574 898 : if (Util::SameString(Alpha(17), "CommonPipe")) {
575 4 : this_loop.CommonPipeType = DataPlant::CommonPipeType::Single;
576 894 : } else if (Util::SameString(Alpha(17), "TwoWayCommonPipe")) {
577 10 : this_loop.CommonPipeType = DataPlant::CommonPipeType::TwoWay;
578 884 : } else if (Util::SameString(Alpha(17), "None") || state.dataIPShortCut->lAlphaFieldBlanks(17)) {
579 884 : this_loop.CommonPipeType = DataPlant::CommonPipeType::No;
580 : } else {
581 0 : ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + Alpha(1) + "\", Invalid choice.");
582 0 : ShowContinueError(state, "Invalid " + state.dataIPShortCut->cAlphaFieldNames(17) + "=\"" + Alpha(17) + "\".");
583 0 : ShowContinueError(state, "Refer to I/O reference document for more details.");
584 0 : ErrorsFound = true;
585 : }
586 260 : } else if (this_loop.TypeOfLoop == LoopType::Condenser) {
587 260 : this_loop.CommonPipeType = DataPlant::CommonPipeType::No;
588 : }
589 :
590 1158 : if (this_loop.CommonPipeType == DataPlant::CommonPipeType::TwoWay) {
591 10 : if (this_demand_side.InletNodeSetPt && this_supply_side.InletNodeSetPt) {
592 0 : ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + Alpha(1) + "\", Invalid condition.");
593 0 : ShowContinueError(state,
594 : "While using a two way common pipe there can be setpoint on only one node other than Plant Supply Outlet node.");
595 0 : ShowContinueError(state, "Currently both Plant Demand inlet and plant supply inlet have setpoints.");
596 0 : ShowContinueError(state, "Select one of the two nodes and rerun the simulation.");
597 0 : ErrorsFound = true;
598 : }
599 10 : if (!this_demand_side.InletNodeSetPt && !this_supply_side.InletNodeSetPt) {
600 0 : ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + Alpha(1) + "\", Invalid condition.");
601 0 : ShowContinueError(state, "While using a two way common pipe there must be a setpoint in addition to the Plant Supply Outlet node.");
602 0 : ShowContinueError(state, "Currently neither plant demand inlet nor plant supply inlet have setpoints.");
603 0 : ShowContinueError(state, "Select one of the two nodes and rerun the simulation.");
604 0 : ErrorsFound = true;
605 : }
606 : }
607 :
608 : // Pressure Simulation Type Input
609 : // First set the alpha index in the object as it is different for plant/condenser
610 : // When CommonPipe, etc., is allowed in condenser loop, modify this code. Edwin/Sankar 08/12/2009
611 1158 : if (this_loop.TypeOfLoop == LoopType::Plant) {
612 898 : PressSimAlphaIndex = 18;
613 : } else {
614 260 : PressSimAlphaIndex = 15;
615 : }
616 :
617 1158 : if (NumAlphas >= PressSimAlphaIndex) {
618 17 : MatchedPressureString = false;
619 :
620 17 : this_loop.PressureSimType =
621 17 : static_cast<DataPlant::PressSimType>(getEnumValue(PressureSimTypeNamesUC, Util::makeUPPER(Alpha(PressSimAlphaIndex))));
622 :
623 17 : switch (this_loop.PressureSimType) {
624 : // Check all types
625 17 : case DataPlant::PressSimType::NoPressure:
626 : case DataPlant::PressSimType::FlowCorrection:
627 : case DataPlant::PressSimType::PumpPowerCorrection:
628 : case DataPlant::PressSimType::FlowSimulation: {
629 17 : MatchedPressureString = true;
630 17 : break;
631 : }
632 0 : default:
633 0 : break;
634 : }
635 :
636 : // If we found a match, check to make sure it is one of the valid
637 : // ones for this phase of pressure implementation
638 17 : if (MatchedPressureString) {
639 17 : if ((this_loop.PressureSimType == DataPlant::PressSimType::NoPressure) ||
640 3 : (this_loop.PressureSimType == DataPlant::PressSimType::PumpPowerCorrection) ||
641 2 : (this_loop.PressureSimType == DataPlant::PressSimType::FlowCorrection)) {
642 : // We are OK here, move on
643 : } else {
644 : // We have an erroneous input, alert user
645 0 : ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + Alpha(1) + "\", Invalid choice.");
646 0 : ShowContinueError(
647 0 : state, "Invalid " + state.dataIPShortCut->cAlphaFieldNames(PressSimAlphaIndex) + "=\"" + Alpha(PressSimAlphaIndex) + "\".");
648 0 : ShowContinueError(state, "Currently only options are: ");
649 0 : ShowContinueError(state, " - " + format("{}", PressureSimTypeNamesUC[static_cast<int>(DataPlant::PressSimType::NoPressure)]));
650 0 : ShowContinueError(state,
651 0 : " - " + format("{}", PressureSimTypeNamesUC[static_cast<int>(DataPlant::PressSimType::PumpPowerCorrection)]));
652 0 : ShowContinueError(state,
653 0 : " - " + format("{}", PressureSimTypeNamesUC[static_cast<int>(DataPlant::PressSimType::FlowCorrection)]));
654 0 : ErrorsFound = true;
655 : }
656 : }
657 :
658 : // if we made it this far and didn't get a match, check for blank
659 17 : if (!MatchedPressureString) {
660 0 : if (Alpha(PressSimAlphaIndex).empty()) {
661 0 : this_loop.PressureSimType = DataPlant::PressSimType::NoPressure;
662 0 : break;
663 : }
664 0 : ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + Alpha(1) + "\", Invalid condition.");
665 0 : ShowContinueError(
666 0 : state, "Invalid " + state.dataIPShortCut->cAlphaFieldNames(PressSimAlphaIndex) + "=\"" + Alpha(PressSimAlphaIndex) + "\".");
667 0 : ErrorsFound = true;
668 : }
669 : }
670 :
671 1158 : bool ErrFound = false;
672 :
673 1158 : if (this_loop.TypeOfLoop == LoopType::Plant) {
674 898 : Avail::GetPlantAvailabilityManager(state, Alpha(15), LoopNum, state.dataPlnt->TotNumLoops, ErrFound);
675 : }
676 :
677 1158 : if (ErrFound) {
678 0 : ShowContinueError(state, "Input errors in " + CurrentModuleObject + '=' + Alpha(1));
679 0 : ErrorsFound = true;
680 : }
681 :
682 1158 : if (GetFirstBranchInletNodeName(state, this_demand_side.BranchList) != this_demand_side.NodeNameIn) {
683 0 : ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + Alpha(1) + "\", Invalid condition.");
684 0 : ShowContinueError(state,
685 0 : "The inlet node of the first branch in the " + state.dataIPShortCut->cAlphaFieldNames(12) + '=' +
686 0 : Alpha(12)); //"Plant Demand Side Branch List"
687 0 : ShowContinueError(state,
688 0 : "is not the same as the " + state.dataIPShortCut->cAlphaFieldNames(10) + '=' +
689 0 : Alpha(10)); // "Plant Demand Side Inlet Node Name"
690 0 : ShowContinueError(state,
691 0 : "Branch List Inlet Node Name=" + GetFirstBranchInletNodeName(state, this_demand_side.BranchList)); // TODO rename point
692 0 : ShowContinueError(
693 : state,
694 : "Branches in a BRANCH LIST must be listed in flow order: inlet branch, then parallel branches, then outlet branch."); // TODO
695 : // rename
696 : // point
697 0 : ErrorsFound = true;
698 : }
699 :
700 1158 : if (GetLastBranchOutletNodeName(state, this_demand_side.BranchList) != this_demand_side.NodeNameOut) {
701 : //"Plant Demand Side Branch List"
702 0 : ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + Alpha(1) + "\", Invalid condition.");
703 0 : ShowContinueError(state, "The outlet node of the last branch in the " + state.dataIPShortCut->cAlphaFieldNames(12) + '=' + Alpha(12));
704 : //"Plant Demand Side Outlet Node Name"
705 0 : ShowContinueError(state, "is not the same as the " + state.dataIPShortCut->cAlphaFieldNames(11) + '=' + Alpha(11));
706 0 : ShowContinueError(state,
707 0 : "Branch List Outlet Node Name=" + GetLastBranchOutletNodeName(state, this_demand_side.BranchList)); // TODO rename point
708 : // TODO rename point
709 0 : ShowContinueError(state,
710 : "Branches in a BRANCH LIST must be listed in flow order: inlet branch, then parallel branches, then outlet branch.");
711 0 : ErrorsFound = true;
712 : }
713 :
714 1158 : if (GetFirstBranchInletNodeName(state, this_supply_side.BranchList) != this_supply_side.NodeNameIn) {
715 : //"Plant Supply Side Branch List"
716 0 : ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + Alpha(1) + "\", Invalid condition.");
717 0 : ShowContinueError(state, "The inlet node of the first branch in the " + state.dataIPShortCut->cAlphaFieldNames(8) + '=' + Alpha(8));
718 : //"Plant Supply Side Inlet Node Name
719 0 : ShowContinueError(state, "is not the same as the " + state.dataIPShortCut->cAlphaFieldNames(6) + '=' + Alpha(6));
720 0 : ShowContinueError(state,
721 0 : "Branch List Inlet Node Name=" + GetFirstBranchInletNodeName(state, this_supply_side.BranchList)); // TODO rename point
722 : // TODO rename point
723 0 : ShowContinueError(state,
724 : "Branches in a BRANCH LIST must be listed in flow order: inlet branch, then parallel branches, then outlet branch.");
725 0 : ErrorsFound = true;
726 : }
727 :
728 1158 : if (GetLastBranchOutletNodeName(state, this_supply_side.BranchList) != this_supply_side.NodeNameOut) {
729 : //"Plant Supply Side Branch List"
730 0 : ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + Alpha(1) + "\", Invalid condition.");
731 0 : ShowContinueError(state, "The outlet node of the last branch in the " + state.dataIPShortCut->cAlphaFieldNames(8) + '=' + Alpha(8));
732 : //"Plant Supply Side Outlet Node Name"
733 0 : ShowContinueError(state, "is not the same as the " + state.dataIPShortCut->cAlphaFieldNames(7) + '=' + Alpha(7));
734 0 : ShowContinueError(state,
735 0 : "Branch List Outlet Node Name=" + GetLastBranchOutletNodeName(state, this_supply_side.BranchList)); // TODO rename point
736 : // TODO rename point
737 0 : ShowContinueError(state,
738 : "Branches in a BRANCH LIST must be listed in flow order: inlet branch, then parallel branches, then outlet branch.");
739 0 : ErrorsFound = true;
740 : }
741 1158 : }
742 :
743 463 : if (ErrorsFound) {
744 0 : ShowFatalError(state, std::string{RoutineName} + "Errors found in processing input. Preceding conditions cause termination.");
745 : }
746 :
747 : // set up loop status (set by system availability managers) report variables
748 : // Condenser loop does not have availability manager yet. Once implemented, move the setup output variable to
749 : // outside the IF statement.
750 1621 : for (LoopNum = 1; LoopNum <= state.dataPlnt->TotNumLoops; ++LoopNum) {
751 :
752 1158 : SetupOutputVariable(state,
753 : "Plant System Cycle On Off Status",
754 : Constant::Units::None,
755 1158 : (int &)state.dataAvail->PlantAvailMgr(LoopNum).availStatus,
756 : OutputProcessor::TimeStepType::System,
757 : OutputProcessor::StoreType::Average,
758 1158 : state.dataPlnt->PlantLoop(LoopNum).Name);
759 : }
760 1477 : }
761 :
762 801 : void GetPlantInput(EnergyPlusData &state)
763 : {
764 :
765 : // SUBROUTINE INFORMATION:
766 : // AUTHOR Sankaranarayanan K P
767 : // DATE WRITTEN April 2005
768 : // MODIFIED
769 : // RE-ENGINEERED na
770 :
771 : // PURPOSE OF THIS SUBROUTINE:
772 : // This subroutine gets input either through the Plant Loop derived type
773 : // or by calls out to the branch manager to obtain data. By the end of
774 : // the routine the module level derived type Loop should be fully allocated
775 : // and fully populated.
776 :
777 : // Using/Aliasing
778 : using namespace NodeInputManager;
779 : using namespace BranchInputManager;
780 :
781 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
782 : int LoopNum; // DO loop counter for loops
783 : int HalfLoopNum;
784 : int BranchNum; // DO loop counter for branches
785 : int CompNum; // DO loop counter for components
786 : int NodeNum; // DO loop counter for nodes
787 : int Outlet;
788 : int Inlet;
789 : int NumParams;
790 : int NumAlphas;
791 : int NumNumbers;
792 : int SplitNum;
793 : int MixNum;
794 : int NumConnectorsInLoop;
795 : int ConnNum;
796 : int TotCompsOnBranch;
797 : int MaxNumAlphas;
798 :
799 : bool SplitInBranch;
800 : bool MixerOutBranch;
801 801 : bool ErrorsFound(false);
802 : bool ASeriesBranchHasPump;
803 : bool AParallelBranchHasPump;
804 :
805 801 : std::string LoopIdentifier;
806 :
807 801 : Array1D_string BranchNames; // Branch names from GetBranchList call
808 801 : Array1D_string CompTypes; // Branch names from GetBranchList call
809 801 : Array1D_string CompNames; // Branch names from GetBranchList call
810 801 : Array1D_int CompCtrls; // Branch names from GetBranchList call
811 801 : Array1D_string InletNodeNames; // Node names from GetBranchData call
812 801 : Array1D_string OutletNodeNames; // Node names from GetBranchData call
813 801 : Array1D_int InletNodeNumbers; // Node numbers from GetBranchData call
814 801 : Array1D_int OutletNodeNumbers; // Node numbers from GetBranchData call
815 801 : Array1D_bool SplitOutBranch;
816 801 : Array1D_bool MixerInBranch;
817 : bool errFlag;
818 :
819 801 : state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, "Connector:Splitter", NumParams, NumAlphas, NumNumbers);
820 801 : MaxNumAlphas = NumAlphas;
821 801 : state.dataInputProcessing->inputProcessor->getObjectDefMaxArgs(state, "Connector:Mixer", NumParams, NumAlphas, NumNumbers);
822 801 : MaxNumAlphas = max(MaxNumAlphas, NumAlphas);
823 801 : HalfLoopNum = 0;
824 :
825 1959 : for (LoopNum = 1; LoopNum <= state.dataPlnt->TotNumLoops; ++LoopNum) {
826 1158 : auto &plantLoop = state.dataPlnt->PlantLoop(LoopNum);
827 1158 : plantLoop.LoopHasConnectionComp = false;
828 :
829 3474 : for (DataPlant::LoopSideLocation LoopSideNum : DataPlant::LoopSideKeys) {
830 2316 : auto &loopSide = plantLoop.LoopSide(LoopSideNum);
831 2316 : ASeriesBranchHasPump = false;
832 2316 : AParallelBranchHasPump = false;
833 2316 : ++HalfLoopNum;
834 2316 : loopSide.BypassExists = false;
835 2316 : if (plantLoop.TypeOfLoop == LoopType::Plant && LoopSideNum == LoopSideLocation::Demand) {
836 898 : LoopIdentifier = "Plant Demand";
837 1418 : } else if (plantLoop.TypeOfLoop == LoopType::Plant && LoopSideNum == LoopSideLocation::Supply) {
838 898 : LoopIdentifier = "Plant Supply";
839 520 : } else if (plantLoop.TypeOfLoop == LoopType::Condenser && LoopSideNum == LoopSideLocation::Demand) {
840 260 : LoopIdentifier = "Condenser Demand";
841 260 : } else if (plantLoop.TypeOfLoop == LoopType::Condenser && LoopSideNum == LoopSideLocation::Supply) {
842 260 : LoopIdentifier = "Condenser Supply";
843 : }
844 :
845 : // Get the branch list and size the Branch portion of the Loop derived type
846 2316 : loopSide.TotalBranches = NumBranchesInBranchList(state, loopSide.BranchList);
847 2316 : BranchNames.allocate(loopSide.TotalBranches);
848 2316 : BranchNames = "";
849 2316 : GetBranchList(state, plantLoop.Name, loopSide.BranchList, loopSide.TotalBranches, BranchNames, LoopIdentifier);
850 2316 : loopSide.Branch.allocate(loopSide.TotalBranches);
851 :
852 : // Cycle through all of the branches and set up the node data
853 16272 : for (BranchNum = 1; BranchNum <= loopSide.TotalBranches; ++BranchNum) {
854 13956 : auto &branch = loopSide.Branch(BranchNum);
855 13956 : branch.Name = BranchNames(BranchNum);
856 13956 : branch.TotalComponents = NumCompsInBranch(state, BranchNames(BranchNum));
857 13956 : branch.IsBypass = false;
858 :
859 13956 : CompTypes.allocate(branch.TotalComponents);
860 13956 : CompNames.allocate(branch.TotalComponents);
861 13956 : CompCtrls.dimension(branch.TotalComponents, 0);
862 13956 : InletNodeNames.allocate(branch.TotalComponents);
863 13956 : InletNodeNumbers.dimension(branch.TotalComponents, 0);
864 13956 : OutletNodeNames.allocate(branch.TotalComponents);
865 13956 : OutletNodeNumbers.dimension(branch.TotalComponents, 0);
866 :
867 13956 : GetBranchData(state,
868 13956 : plantLoop.Name,
869 13956 : BranchNames(BranchNum),
870 13956 : branch.PressureCurveType,
871 13956 : branch.PressureCurveIndex,
872 13956 : branch.TotalComponents,
873 : CompTypes,
874 : CompNames,
875 : InletNodeNames,
876 : InletNodeNumbers,
877 : OutletNodeNames,
878 : OutletNodeNumbers,
879 : ErrorsFound);
880 :
881 13956 : branch.Comp.allocate(branch.TotalComponents);
882 :
883 27998 : for (CompNum = 1; CompNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).TotalComponents; ++CompNum) {
884 : // set up some references
885 14042 : auto &this_comp_type(CompTypes(CompNum));
886 14042 : auto &this_comp(state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp(CompNum));
887 :
888 14042 : this_comp.CurOpSchemeType = OpScheme::Invalid;
889 14042 : this_comp.TypeOf = this_comp_type;
890 14042 : this_comp.location = EnergyPlus::PlantLocation(LoopNum, LoopSideNum, BranchNum, CompNum);
891 14042 : PlantUtilities::SetPlantLocationLinks(state, this_comp.location);
892 :
893 14042 : this_comp.Type = static_cast<PlantEquipmentType>(getEnumValue(PlantEquipTypeNamesUC, Util::makeUPPER(this_comp_type)));
894 :
895 14042 : switch (this_comp.Type) {
896 5548 : case PlantEquipmentType::Pipe: {
897 5548 : this_comp.CurOpSchemeType = OpScheme::NoControl;
898 5548 : this_comp.compPtr = Pipes::LocalPipeData::factory(state, PlantEquipmentType::Pipe, CompNames(CompNum));
899 5548 : break;
900 : }
901 39 : case PlantEquipmentType::PipeSteam: {
902 39 : this_comp.CurOpSchemeType = OpScheme::NoControl;
903 39 : this_comp.compPtr = Pipes::LocalPipeData::factory(state, PlantEquipmentType::PipeSteam, CompNames(CompNum));
904 39 : break;
905 : }
906 1 : case PlantEquipmentType::PipeExterior: {
907 1 : this_comp.CurOpSchemeType = OpScheme::NoControl;
908 1 : this_comp.compPtr = PipeHeatTransfer::PipeHTData::factory(state, PlantEquipmentType::PipeExterior, CompNames(CompNum));
909 1 : break;
910 : }
911 2 : case PlantEquipmentType::PipeInterior: {
912 2 : this_comp.CurOpSchemeType = OpScheme::NoControl;
913 2 : this_comp.compPtr = PipeHeatTransfer::PipeHTData::factory(state, PlantEquipmentType::PipeInterior, CompNames(CompNum));
914 2 : break;
915 : }
916 1 : case PlantEquipmentType::PipeUnderground: {
917 1 : this_comp.CurOpSchemeType = OpScheme::NoControl;
918 1 : this_comp.compPtr = PipeHeatTransfer::PipeHTData::factory(state, PlantEquipmentType::PipeUnderground, CompNames(CompNum));
919 1 : break;
920 : }
921 4 : case PlantEquipmentType::PipingSystemPipeCircuit: {
922 4 : this_comp.CurOpSchemeType = OpScheme::NoControl;
923 4 : this_comp.compPtr =
924 4 : PlantPipingSystemsManager::Circuit::factory(state, PlantEquipmentType::PipingSystemPipeCircuit, CompNames(CompNum));
925 4 : break;
926 : }
927 1180 : case PlantEquipmentType::PumpCondensate:
928 : case PlantEquipmentType::PumpConstantSpeed:
929 : case PlantEquipmentType::PumpVariableSpeed:
930 : case PlantEquipmentType::PumpBankConstantSpeed:
931 : case PlantEquipmentType::PumpBankVariableSpeed: {
932 1180 : this_comp.compPtr = &state.dataPlantMgr->dummyPlantComponent;
933 1180 : this_comp.CurOpSchemeType = OpScheme::Pump;
934 1180 : if (BranchNum == 1 || BranchNum == state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).TotalBranches) {
935 1164 : ASeriesBranchHasPump = true;
936 : } else {
937 16 : AParallelBranchHasPump = true;
938 : }
939 1180 : LoopSidePumpInformation p;
940 1180 : p.PumpName = CompNames(CompNum);
941 1180 : p.BranchNum = BranchNum;
942 1180 : p.CompNum = CompNum;
943 1180 : p.PumpOutletNode = OutletNodeNumbers(CompNum);
944 1180 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).BranchPumpsExist = AParallelBranchHasPump;
945 1180 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Pumps.push_back(p);
946 1180 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).TotalPumps++;
947 1180 : break;
948 1180 : }
949 136 : case PlantEquipmentType::WtrHeaterMixed:
950 : case PlantEquipmentType::WtrHeaterStratified: {
951 136 : if (LoopSideNum == LoopSideLocation::Demand) {
952 3 : this_comp.CurOpSchemeType = OpScheme::Demand;
953 133 : } else if (LoopSideNum == LoopSideLocation::Supply) {
954 133 : this_comp.CurOpSchemeType = OpScheme::Invalid;
955 : }
956 136 : this_comp.compPtr = WaterThermalTanks::WaterThermalTankData::factory(state, CompNames(CompNum));
957 136 : break;
958 : }
959 3 : case PlantEquipmentType::Chiller_DFAbsorption: {
960 3 : this_comp.compPtr = ChillerGasAbsorption::GasAbsorberSpecs::factory(state, CompNames(CompNum));
961 3 : break;
962 : }
963 3 : case PlantEquipmentType::Chiller_ExhFiredAbsorption: {
964 3 : this_comp.compPtr = ChillerExhaustAbsorption::ExhaustAbsorberSpecs::factory(state, CompNames(CompNum));
965 3 : break;
966 : }
967 10 : case PlantEquipmentType::ChilledWaterTankMixed:
968 : case PlantEquipmentType::ChilledWaterTankStratified: {
969 10 : if (LoopSideNum == LoopSideLocation::Demand) {
970 4 : this_comp.CurOpSchemeType = OpScheme::Demand;
971 6 : } else if (LoopSideNum == LoopSideLocation::Supply) {
972 6 : this_comp.CurOpSchemeType = OpScheme::Invalid;
973 : }
974 10 : this_comp.compPtr = WaterThermalTanks::WaterThermalTankData::factory(state, CompNames(CompNum));
975 10 : break;
976 : }
977 1050 : case PlantEquipmentType::WaterUseConnection: {
978 1050 : this_comp.CurOpSchemeType = OpScheme::Demand;
979 1050 : this_comp.compPtr = WaterUse::WaterConnectionsType::factory(state, CompNames(CompNum));
980 1050 : break;
981 : }
982 10 : case PlantEquipmentType::SolarCollectorFlatPlate:
983 : case PlantEquipmentType::SolarCollectorICS: {
984 10 : if (LoopSideNum == LoopSideLocation::Demand) {
985 10 : this_comp.CurOpSchemeType = OpScheme::Demand;
986 0 : } else if (LoopSideNum == LoopSideLocation::Supply) {
987 0 : this_comp.CurOpSchemeType = OpScheme::Uncontrolled;
988 : }
989 10 : this_comp.compPtr = SolarCollectors::CollectorData::factory(state, CompNames(CompNum));
990 10 : break;
991 : }
992 28 : case PlantEquipmentType::PlantLoadProfile: {
993 28 : this_comp.CurOpSchemeType = OpScheme::Demand;
994 28 : this_comp.compPtr = PlantLoadProfile::PlantProfileData::factory(state, CompNames(CompNum));
995 28 : break;
996 : }
997 23 : case PlantEquipmentType::GrndHtExchgSystem: {
998 23 : this_comp.CurOpSchemeType = OpScheme::Uncontrolled;
999 23 : this_comp.compPtr = GroundHeatExchangers::GLHEBase::factory(state, PlantEquipmentType::GrndHtExchgSystem, CompNames(CompNum));
1000 23 : break;
1001 : }
1002 1 : case PlantEquipmentType::GrndHtExchgSurface: {
1003 1 : this_comp.CurOpSchemeType = OpScheme::Uncontrolled;
1004 1 : this_comp.compPtr = SurfaceGroundHeatExchanger::SurfaceGroundHeatExchangerData::factory(
1005 1 : state, PlantEquipmentType::GrndHtExchgSurface, CompNames(CompNum));
1006 1 : break;
1007 : }
1008 3 : case PlantEquipmentType::GrndHtExchgPond: {
1009 3 : this_comp.CurOpSchemeType = OpScheme::Uncontrolled;
1010 3 : this_comp.compPtr = PondGroundHeatExchanger::PondGroundHeatExchangerData::factory(state, CompNames(CompNum));
1011 3 : break;
1012 : }
1013 1 : case PlantEquipmentType::GrndHtExchgSlinky: {
1014 1 : this_comp.CurOpSchemeType = OpScheme::Uncontrolled;
1015 1 : this_comp.compPtr = GroundHeatExchangers::GLHEBase::factory(state, PlantEquipmentType::GrndHtExchgSlinky, CompNames(CompNum));
1016 1 : break;
1017 : }
1018 97 : case PlantEquipmentType::Chiller_ElectricEIR: {
1019 97 : if (LoopSideNum == LoopSideLocation::Demand) {
1020 45 : this_comp.CurOpSchemeType = OpScheme::Demand;
1021 52 : } else if (LoopSideNum == LoopSideLocation::Supply) {
1022 52 : this_comp.CurOpSchemeType = OpScheme::Invalid;
1023 : }
1024 97 : this_comp.compPtr = ChillerElectricEIR::ElectricEIRChillerSpecs::factory(state, CompNames(CompNum));
1025 97 : break;
1026 : }
1027 86 : case PlantEquipmentType::Chiller_ElectricReformEIR: {
1028 86 : if (LoopSideNum == LoopSideLocation::Demand) {
1029 43 : this_comp.CurOpSchemeType = OpScheme::Demand;
1030 43 : } else if (LoopSideNum == LoopSideLocation::Supply) {
1031 43 : this_comp.CurOpSchemeType = OpScheme::Invalid;
1032 : }
1033 86 : this_comp.compPtr = ChillerReformulatedEIR::ReformulatedEIRChillerSpecs::factory(state, CompNames(CompNum));
1034 86 : break;
1035 : }
1036 378 : case PlantEquipmentType::Chiller_Electric: {
1037 378 : if (LoopSideNum == LoopSideLocation::Demand) {
1038 163 : this_comp.CurOpSchemeType = OpScheme::Demand;
1039 215 : } else if (LoopSideNum == LoopSideLocation::Supply) {
1040 215 : this_comp.CurOpSchemeType = OpScheme::Invalid;
1041 : }
1042 378 : this_comp.compPtr = PlantChillers::ElectricChillerSpecs::factory(state, CompNames(CompNum));
1043 378 : break;
1044 : }
1045 14 : case PlantEquipmentType::Chiller_ElectricASHRAE205: {
1046 14 : if (LoopSideNum == LoopSideLocation::Demand) {
1047 9 : this_comp.CurOpSchemeType = OpScheme::Demand;
1048 5 : } else if (LoopSideNum == LoopSideLocation::Supply) {
1049 5 : this_comp.CurOpSchemeType = OpScheme::Invalid;
1050 : }
1051 14 : this_comp.compPtr = ChillerElectricASHRAE205::ASHRAE205ChillerSpecs::factory(state, CompNames(CompNum));
1052 14 : break;
1053 : }
1054 27 : case PlantEquipmentType::Chiller_EngineDriven: {
1055 27 : if (LoopSideNum == LoopSideLocation::Demand) {
1056 15 : this_comp.CurOpSchemeType = OpScheme::Demand;
1057 12 : } else if (LoopSideNum == LoopSideLocation::Supply) {
1058 12 : this_comp.CurOpSchemeType = OpScheme::Invalid;
1059 : }
1060 27 : this_comp.compPtr = PlantChillers::EngineDrivenChillerSpecs::factory(state, CompNames(CompNum));
1061 27 : break;
1062 : }
1063 5 : case PlantEquipmentType::Chiller_CombTurbine: {
1064 5 : if (LoopSideNum == LoopSideLocation::Demand) {
1065 3 : this_comp.CurOpSchemeType = OpScheme::Demand;
1066 2 : } else if (LoopSideNum == LoopSideLocation::Supply) {
1067 2 : this_comp.CurOpSchemeType = OpScheme::Invalid;
1068 : }
1069 5 : this_comp.compPtr = PlantChillers::GTChillerSpecs::factory(state, CompNames(CompNum));
1070 5 : break;
1071 : }
1072 185 : case PlantEquipmentType::Chiller_ConstCOP: {
1073 185 : if (LoopSideNum == LoopSideLocation::Demand) {
1074 91 : this_comp.CurOpSchemeType = OpScheme::Demand;
1075 94 : } else if (LoopSideNum == LoopSideLocation::Supply) {
1076 94 : this_comp.CurOpSchemeType = OpScheme::Invalid;
1077 : }
1078 185 : this_comp.compPtr = PlantChillers::ConstCOPChillerSpecs::factory(state, CompNames(CompNum));
1079 185 : break;
1080 : }
1081 211 : case PlantEquipmentType::Boiler_Simple: {
1082 211 : this_comp.CurOpSchemeType = OpScheme::Invalid;
1083 211 : this_comp.compPtr = Boilers::BoilerSpecs::factory(state, CompNames(CompNum));
1084 211 : break;
1085 : }
1086 8 : case PlantEquipmentType::Boiler_Steam: {
1087 8 : this_comp.CurOpSchemeType = OpScheme::Invalid;
1088 8 : this_comp.compPtr = BoilerSteam::BoilerSpecs::factory(state, CompNames(CompNum));
1089 8 : break;
1090 : }
1091 5 : case PlantEquipmentType::Chiller_Indirect_Absorption: {
1092 5 : if (LoopSideNum == LoopSideLocation::Demand) {
1093 3 : this_comp.CurOpSchemeType = OpScheme::Demand;
1094 2 : } else if (LoopSideNum == LoopSideLocation::Supply) {
1095 2 : this_comp.CurOpSchemeType = OpScheme::Invalid;
1096 : }
1097 5 : this_comp.compPtr = ChillerIndirectAbsorption::IndirectAbsorberSpecs::factory(state, CompNames(CompNum));
1098 5 : break;
1099 : }
1100 4 : case PlantEquipmentType::Chiller_Absorption: {
1101 4 : if (LoopSideNum == LoopSideLocation::Demand) {
1102 2 : this_comp.CurOpSchemeType = OpScheme::Demand;
1103 2 : } else if (LoopSideNum == LoopSideLocation::Supply) {
1104 2 : this_comp.CurOpSchemeType = OpScheme::Invalid;
1105 : }
1106 4 : this_comp.compPtr = ChillerAbsorption::BLASTAbsorberSpecs::factory(state, CompNames(CompNum));
1107 4 : break;
1108 : }
1109 244 : case PlantEquipmentType::CoolingTower_SingleSpd:
1110 : case PlantEquipmentType::CoolingTower_TwoSpd: {
1111 244 : this_comp.CurOpSchemeType = OpScheme::Invalid;
1112 244 : this_comp.compPtr = CondenserLoopTowers::CoolingTower::factory(state, CompNames(CompNum));
1113 244 : break;
1114 : }
1115 28 : case PlantEquipmentType::CoolingTower_VarSpd:
1116 : case PlantEquipmentType::CoolingTower_VarSpdMerkel: {
1117 28 : this_comp.compPtr = CondenserLoopTowers::CoolingTower::factory(state, CompNames(CompNum));
1118 28 : break;
1119 : }
1120 2 : case PlantEquipmentType::Generator_FCExhaust: {
1121 2 : this_comp.compPtr = FuelCellElectricGenerator::FCDataStruct::factory_exhaust(state, CompNames(CompNum));
1122 2 : if (LoopSideNum == LoopSideLocation::Demand) {
1123 0 : this_comp.CurOpSchemeType = OpScheme::Demand;
1124 2 : } else if (LoopSideNum == LoopSideLocation::Supply) {
1125 2 : this_comp.CurOpSchemeType = OpScheme::Invalid;
1126 : }
1127 2 : break;
1128 : }
1129 10 : case PlantEquipmentType::HeatPumpWtrHeaterPumped:
1130 : case PlantEquipmentType::HeatPumpWtrHeaterWrapped: {
1131 10 : this_comp.CurOpSchemeType = OpScheme::Demand;
1132 10 : this_comp.compPtr = WaterThermalTanks::HeatPumpWaterHeaterData::factory(state, CompNames(CompNum));
1133 10 : break;
1134 : }
1135 4 : case PlantEquipmentType::HPWaterEFCooling: {
1136 4 : this_comp.compPtr =
1137 4 : HeatPumpWaterToWaterSimple::GshpSpecs::factory(state, PlantEquipmentType::HPWaterEFCooling, CompNames(CompNum));
1138 4 : if (LoopSideNum == LoopSideLocation::Demand) {
1139 2 : this_comp.CurOpSchemeType = OpScheme::Demand;
1140 2 : } else if (LoopSideNum == LoopSideLocation::Supply) {
1141 2 : this_comp.CurOpSchemeType = OpScheme::Invalid;
1142 : }
1143 4 : break;
1144 : }
1145 4 : case PlantEquipmentType::HPWaterEFHeating: {
1146 4 : this_comp.compPtr =
1147 4 : HeatPumpWaterToWaterSimple::GshpSpecs::factory(state, PlantEquipmentType::HPWaterEFHeating, CompNames(CompNum));
1148 4 : if (LoopSideNum == LoopSideLocation::Demand) {
1149 2 : this_comp.CurOpSchemeType = OpScheme::Demand;
1150 2 : } else if (LoopSideNum == LoopSideLocation::Supply) {
1151 2 : this_comp.CurOpSchemeType = OpScheme::Invalid;
1152 : }
1153 4 : break;
1154 : }
1155 6 : case PlantEquipmentType::HPWaterPEHeating: {
1156 6 : this_comp.compPtr = HeatPumpWaterToWaterHEATING::GshpPeHeatingSpecs::factory(state, CompNames(CompNum));
1157 6 : if (LoopSideNum == LoopSideLocation::Demand) {
1158 3 : this_comp.CurOpSchemeType = OpScheme::Demand;
1159 3 : } else if (LoopSideNum == LoopSideLocation::Supply) {
1160 3 : this_comp.CurOpSchemeType = OpScheme::Invalid;
1161 : }
1162 6 : break;
1163 : }
1164 6 : case PlantEquipmentType::HPWaterPECooling: {
1165 6 : this_comp.compPtr = HeatPumpWaterToWaterCOOLING::GshpPeCoolingSpecs::factory(state, CompNames(CompNum));
1166 6 : if (LoopSideNum == LoopSideLocation::Demand) {
1167 3 : this_comp.CurOpSchemeType = OpScheme::Demand;
1168 3 : } else if (LoopSideNum == LoopSideLocation::Supply) {
1169 3 : this_comp.CurOpSchemeType = OpScheme::Invalid;
1170 : }
1171 6 : break;
1172 : }
1173 11 : case PlantEquipmentType::HeatPumpEIRHeating: {
1174 11 : this_comp.compPtr =
1175 11 : EIRPlantLoopHeatPumps::EIRPlantLoopHeatPump::factory(state, PlantEquipmentType::HeatPumpEIRHeating, CompNames(CompNum));
1176 11 : if (LoopSideNum == LoopSideLocation::Demand) {
1177 2 : this_comp.CurOpSchemeType = OpScheme::Demand;
1178 9 : } else if (LoopSideNum == LoopSideLocation::Supply) {
1179 9 : this_comp.CurOpSchemeType = OpScheme::Invalid;
1180 : }
1181 11 : break;
1182 : }
1183 12 : case PlantEquipmentType::HeatPumpEIRCooling: {
1184 12 : this_comp.compPtr =
1185 12 : EIRPlantLoopHeatPumps::EIRPlantLoopHeatPump::factory(state, PlantEquipmentType::HeatPumpEIRCooling, CompNames(CompNum));
1186 12 : if (LoopSideNum == LoopSideLocation::Demand) {
1187 3 : this_comp.CurOpSchemeType = OpScheme::Demand;
1188 9 : } else if (LoopSideNum == LoopSideLocation::Supply) {
1189 9 : this_comp.CurOpSchemeType = OpScheme::Invalid;
1190 : }
1191 12 : break;
1192 : }
1193 1 : case PlantEquipmentType::HeatPumpFuelFiredHeating: {
1194 2 : this_comp.compPtr = EIRPlantLoopHeatPumps::EIRFuelFiredHeatPump::factory(
1195 1 : state, PlantEquipmentType::HeatPumpFuelFiredHeating, CompNames(CompNum));
1196 1 : this_comp.CurOpSchemeType = OpScheme::Invalid;
1197 1 : break;
1198 : }
1199 1 : case PlantEquipmentType::HeatPumpFuelFiredCooling: {
1200 2 : this_comp.compPtr = EIRPlantLoopHeatPumps::EIRFuelFiredHeatPump::factory(
1201 1 : state, PlantEquipmentType::HeatPumpFuelFiredCooling, CompNames(CompNum));
1202 1 : this_comp.CurOpSchemeType = OpScheme::Invalid;
1203 1 : break;
1204 : }
1205 1 : case PlantEquipmentType::HeatPumpVRF: {
1206 1 : if (LoopSideNum == LoopSideLocation::Demand) {
1207 1 : this_comp.CurOpSchemeType = OpScheme::Demand;
1208 0 : } else if (LoopSideNum == LoopSideLocation::Supply) {
1209 0 : this_comp.CurOpSchemeType = OpScheme::Invalid;
1210 : }
1211 1 : this_comp.compPtr = HVACVariableRefrigerantFlow::VRFCondenserEquipment::factory(state, CompNames(CompNum));
1212 1 : break;
1213 : }
1214 133 : case PlantEquipmentType::PurchChilledWater: {
1215 133 : this_comp.compPtr =
1216 133 : OutsideEnergySources::OutsideEnergySourceSpecs::factory(state, PlantEquipmentType::PurchChilledWater, CompNames(CompNum));
1217 133 : break;
1218 : }
1219 144 : case PlantEquipmentType::PurchHotWater: {
1220 144 : this_comp.compPtr =
1221 144 : OutsideEnergySources::OutsideEnergySourceSpecs::factory(state, PlantEquipmentType::PurchHotWater, CompNames(CompNum));
1222 144 : break;
1223 : }
1224 1 : case PlantEquipmentType::PurchSteam: {
1225 1 : this_comp.compPtr =
1226 1 : OutsideEnergySources::OutsideEnergySourceSpecs::factory(state, PlantEquipmentType::PurchSteam, CompNames(CompNum));
1227 1 : break;
1228 : }
1229 2 : case PlantEquipmentType::TS_IceSimple: {
1230 2 : this_comp.compPtr = IceThermalStorage::SimpleIceStorageData::factory(state, CompNames(CompNum));
1231 2 : break;
1232 : }
1233 7 : case PlantEquipmentType::TS_IceDetailed: {
1234 7 : this_comp.compPtr = IceThermalStorage::DetailedIceStorageData::factory(state, CompNames(CompNum));
1235 7 : break;
1236 : }
1237 2 : case PlantEquipmentType::ValveTempering: {
1238 2 : this_comp.compPtr = PlantValves::TemperValveData::factory(state, CompNames(CompNum));
1239 2 : break;
1240 : }
1241 66 : case PlantEquipmentType::FluidToFluidPlantHtExchg: {
1242 66 : if (LoopSideNum == LoopSideLocation::Demand) {
1243 33 : this_comp.CurOpSchemeType = OpScheme::Demand;
1244 33 : } else if (LoopSideNum == LoopSideLocation::Supply) {
1245 33 : this_comp.CurOpSchemeType = OpScheme::FreeRejection;
1246 : }
1247 66 : this_comp.compPtr = PlantHeatExchangerFluidToFluid::HeatExchangerStruct::factory(state, CompNames(CompNum));
1248 66 : break;
1249 : }
1250 2 : case PlantEquipmentType::Generator_MicroTurbine: {
1251 2 : if (LoopSideNum == LoopSideLocation::Demand) {
1252 2 : this_comp.CurOpSchemeType = OpScheme::Demand;
1253 0 : } else if (LoopSideNum == LoopSideLocation::Supply) {
1254 0 : this_comp.CurOpSchemeType = OpScheme::Invalid;
1255 : }
1256 2 : this_comp.compPtr = MicroturbineElectricGenerator::MTGeneratorSpecs::factory(state, CompNames(CompNum));
1257 2 : break;
1258 : }
1259 3 : case PlantEquipmentType::Generator_ICEngine: {
1260 3 : if (LoopSideNum == LoopSideLocation::Demand) {
1261 3 : this_comp.CurOpSchemeType = OpScheme::Demand;
1262 0 : } else if (LoopSideNum == LoopSideLocation::Supply) {
1263 0 : this_comp.CurOpSchemeType = OpScheme::Invalid;
1264 : }
1265 3 : this_comp.compPtr = ICEngineElectricGenerator::ICEngineGeneratorSpecs::factory(state, CompNames(CompNum));
1266 :
1267 3 : break;
1268 : }
1269 3 : case PlantEquipmentType::Generator_CTurbine: {
1270 3 : if (LoopSideNum == LoopSideLocation::Demand) {
1271 3 : this_comp.CurOpSchemeType = OpScheme::Demand;
1272 0 : } else if (LoopSideNum == LoopSideLocation::Supply) {
1273 0 : this_comp.CurOpSchemeType = OpScheme::Invalid;
1274 : }
1275 3 : this_comp.compPtr = CTElectricGenerator::CTGeneratorData::factory(state, CompNames(CompNum));
1276 3 : break;
1277 : }
1278 2 : case PlantEquipmentType::Generator_MicroCHP: {
1279 2 : if (LoopSideNum == LoopSideLocation::Demand) {
1280 0 : this_comp.CurOpSchemeType = OpScheme::Demand;
1281 2 : } else if (LoopSideNum == LoopSideLocation::Supply) {
1282 2 : this_comp.CurOpSchemeType = OpScheme::Invalid;
1283 : }
1284 2 : this_comp.compPtr = MicroCHPElectricGenerator::MicroCHPDataStruct::factory(state, CompNames(CompNum));
1285 2 : break;
1286 : }
1287 0 : case PlantEquipmentType::Generator_FCStackCooler: {
1288 0 : this_comp.compPtr = FuelCellElectricGenerator::FCDataStruct::factory(state, CompNames(CompNum));
1289 0 : if (LoopSideNum == LoopSideLocation::Demand) {
1290 0 : this_comp.CurOpSchemeType = OpScheme::Demand;
1291 0 : } else if (LoopSideNum == LoopSideLocation::Supply) {
1292 0 : this_comp.CurOpSchemeType = OpScheme::Invalid;
1293 : }
1294 0 : break;
1295 : }
1296 1 : case PlantEquipmentType::FluidCooler_SingleSpd: {
1297 1 : this_comp.compPtr =
1298 1 : FluidCoolers::FluidCoolerspecs::factory(state, PlantEquipmentType::FluidCooler_SingleSpd, CompNames(CompNum));
1299 1 : break;
1300 : }
1301 5 : case PlantEquipmentType::FluidCooler_TwoSpd: {
1302 5 : this_comp.compPtr =
1303 5 : FluidCoolers::FluidCoolerspecs::factory(state, PlantEquipmentType::FluidCooler_TwoSpd, CompNames(CompNum));
1304 5 : break;
1305 : }
1306 1 : case PlantEquipmentType::EvapFluidCooler_SingleSpd: {
1307 2 : this_comp.compPtr = EvaporativeFluidCoolers::EvapFluidCoolerSpecs::factory(
1308 1 : state, PlantEquipmentType::EvapFluidCooler_SingleSpd, CompNames(CompNum));
1309 1 : break;
1310 : }
1311 2 : case PlantEquipmentType::EvapFluidCooler_TwoSpd: {
1312 4 : this_comp.compPtr = EvaporativeFluidCoolers::EvapFluidCoolerSpecs::factory(
1313 2 : state, PlantEquipmentType::EvapFluidCooler_TwoSpd, CompNames(CompNum));
1314 2 : break;
1315 : }
1316 10 : case PlantEquipmentType::PVTSolarCollectorFlatPlate: {
1317 10 : if (LoopSideNum == LoopSideLocation::Demand) {
1318 10 : this_comp.CurOpSchemeType = OpScheme::Demand;
1319 0 : } else if (LoopSideNum == LoopSideLocation::Supply) {
1320 0 : this_comp.CurOpSchemeType = OpScheme::Invalid;
1321 : }
1322 10 : this_comp.compPtr = PhotovoltaicThermalCollectors::PVTCollectorStruct::factory(state, CompNames(CompNum));
1323 10 : break;
1324 : }
1325 6 : case PlantEquipmentType::CentralGroundSourceHeatPump: {
1326 6 : this_comp.compPtr = PlantCentralGSHP::WrapperSpecs::factory(state, CompNames(CompNum));
1327 : // now deal with demand components of the ZoneHVAC type served by ControlCompOutput
1328 6 : break;
1329 : }
1330 2 : case PlantEquipmentType::SwimmingPool_Indoor: {
1331 2 : this_comp.CurOpSchemeType = OpScheme::Demand;
1332 2 : this_comp.compPtr = SwimmingPool::SwimmingPoolData::factory(state, CompNames(CompNum));
1333 2 : break;
1334 : }
1335 4235 : case PlantEquipmentType::PackagedTESCoolingCoil:
1336 : case PlantEquipmentType::CoilWaterCooling:
1337 : case PlantEquipmentType::CoilWaterDetailedFlatCooling:
1338 : case PlantEquipmentType::CoilWaterSimpleHeating:
1339 : case PlantEquipmentType::CoilSteamAirHeating:
1340 : case PlantEquipmentType::Baseboard_Rad_Conv_Water:
1341 : case PlantEquipmentType::Baseboard_Conv_Water:
1342 : case PlantEquipmentType::Baseboard_Rad_Conv_Steam:
1343 : case PlantEquipmentType::CoolingPanel_Simple:
1344 : case PlantEquipmentType::LowTempRadiant_VarFlow:
1345 : case PlantEquipmentType::LowTempRadiant_ConstFlow:
1346 : case PlantEquipmentType::CooledBeamAirTerminal:
1347 : case PlantEquipmentType::FourPipeBeamAirTerminal:
1348 : case PlantEquipmentType::MultiSpeedHeatPumpRecovery:
1349 : case PlantEquipmentType::UnitarySysRecovery:
1350 : case PlantEquipmentType::CoilWAHPHeatingEquationFit:
1351 : case PlantEquipmentType::CoilWAHPCoolingEquationFit:
1352 : case PlantEquipmentType::CoilVSWAHPHeatingEquationFit:
1353 : case PlantEquipmentType::CoilVSWAHPCoolingEquationFit:
1354 : case PlantEquipmentType::CoilWAHPHeatingParamEst:
1355 : case PlantEquipmentType::CoilWAHPCoolingParamEst: {
1356 4235 : this_comp.CurOpSchemeType = OpScheme::Demand;
1357 4235 : this_comp.compPtr = &state.dataPlantMgr->dummyPlantComponent;
1358 4235 : break;
1359 : }
1360 1 : case PlantEquipmentType::RefrigSystemWaterCondenser: {
1361 1 : this_comp.CurOpSchemeType = OpScheme::Demand;
1362 1 : this_comp.compPtr = RefrigeratedCase::RefrigCondenserData::factory(state, CompNames(CompNum));
1363 1 : break;
1364 : }
1365 1 : case PlantEquipmentType::RefrigerationWaterCoolRack: {
1366 1 : this_comp.CurOpSchemeType = OpScheme::Demand;
1367 1 : this_comp.compPtr = RefrigeratedCase::RefrigRackData::factory(state, CompNames(CompNum));
1368 1 : break;
1369 : }
1370 2 : case PlantEquipmentType::PlantComponentUserDefined: {
1371 2 : this_comp.CurOpSchemeType = OpScheme::Invalid;
1372 2 : this_comp.compPtr = UserDefinedComponents::UserPlantComponentStruct::factory(state, CompNames(CompNum));
1373 2 : break;
1374 : }
1375 16 : case PlantEquipmentType::CoilUserDefined:
1376 : case PlantEquipmentType::ZoneHVACAirUserDefined:
1377 : case PlantEquipmentType::AirTerminalUserDefined: {
1378 16 : this_comp.CurOpSchemeType = OpScheme::Invalid;
1379 16 : this_comp.compPtr = &state.dataPlantMgr->dummyPlantComponent;
1380 16 : break;
1381 : }
1382 1 : case PlantEquipmentType::WaterSource: {
1383 1 : this_comp.CurOpSchemeType = OpScheme::Uncontrolled;
1384 1 : this_comp.compPtr = PlantComponentTemperatureSources::WaterSourceSpecs::factory(state, CompNames(CompNum));
1385 1 : break;
1386 : }
1387 1 : case PlantEquipmentType::GrndHtExchgHorizTrench: {
1388 1 : this_comp.CurOpSchemeType = OpScheme::Uncontrolled;
1389 1 : this_comp.compPtr =
1390 1 : PlantPipingSystemsManager::Circuit::factory(state, PlantEquipmentType::GrndHtExchgHorizTrench, CompNames(CompNum));
1391 1 : break;
1392 : }
1393 0 : default: {
1394 0 : if (has_prefixi(this_comp_type, "Pump") || has_prefixi(this_comp_type, "HeaderedPumps")) {
1395 : // discover unsupported equipment on branches.
1396 0 : ShowSevereError(state, "GetPlantInput: trying to process a pump type that is not supported, dev note");
1397 0 : ShowContinueError(state, "Component Type =" + this_comp_type);
1398 : } else {
1399 : // discover unsupported equipment on branches.
1400 0 : ShowSevereError(state, "GetPlantInput: Branch=\"" + BranchNames(BranchNum) + "\", invalid component on branch.");
1401 0 : ShowContinueError(state, "...invalid component type=\"" + this_comp_type + "\", name=\"" + CompNames(CompNum) + "\".");
1402 : // ErrorsFound=.TRUE.
1403 : }
1404 : }
1405 : }
1406 :
1407 14042 : if (!this_comp.compPtr) {
1408 0 : ShowFatalError(state, format(" Plant component \"{}\" was not assigned a pointer.", this_comp_type));
1409 : }
1410 :
1411 14042 : this_comp.Name = CompNames(CompNum);
1412 14042 : this_comp.NodeNameIn = InletNodeNames(CompNum);
1413 14042 : this_comp.NodeNumIn = InletNodeNumbers(CompNum);
1414 14042 : this_comp.NodeNameOut = OutletNodeNames(CompNum);
1415 14042 : this_comp.NodeNumOut = OutletNodeNumbers(CompNum);
1416 : }
1417 :
1418 : // set branch inlet/outlet nodes
1419 13956 : branch.NodeNumIn = branch.Comp(1).NodeNumIn;
1420 13956 : branch.NodeNumOut = branch.Comp(branch.TotalComponents).NodeNumOut;
1421 :
1422 13956 : CompTypes.deallocate();
1423 13956 : CompNames.deallocate();
1424 13956 : CompCtrls.deallocate();
1425 13956 : InletNodeNames.deallocate();
1426 13956 : InletNodeNumbers.deallocate();
1427 13956 : OutletNodeNames.deallocate();
1428 13956 : OutletNodeNumbers.deallocate();
1429 : }
1430 :
1431 2316 : BranchNames.deallocate();
1432 :
1433 2316 : if (ASeriesBranchHasPump && AParallelBranchHasPump) {
1434 0 : ShowSevereError(state, "Current version does not support Loop pumps and branch pumps together");
1435 0 : ShowContinueError(state, "Occurs in loop " + state.dataPlnt->PlantLoop(LoopNum).Name);
1436 0 : ErrorsFound = true;
1437 : }
1438 :
1439 : // Obtain the Splitter and Mixer information
1440 2316 : if (loopSide.ConnectList.empty()) {
1441 33 : state.dataLoopNodes->NumofSplitters = 0;
1442 33 : state.dataLoopNodes->NumofMixers = 0;
1443 : } else {
1444 2283 : errFlag = false;
1445 2283 : GetNumSplitterMixerInConntrList(
1446 2283 : state, plantLoop.Name, loopSide.ConnectList, state.dataLoopNodes->NumofSplitters, state.dataLoopNodes->NumofMixers, errFlag);
1447 2283 : if (errFlag) {
1448 0 : ErrorsFound = true;
1449 : }
1450 2283 : if (state.dataLoopNodes->NumofSplitters != state.dataLoopNodes->NumofMixers) {
1451 0 : ShowSevereError(state,
1452 0 : "GetPlantInput: Loop Name=" + plantLoop.Name + ", ConnectorList=" + loopSide.ConnectList +
1453 : ", unequal number of splitters and mixers");
1454 0 : ErrorsFound = true;
1455 : }
1456 : }
1457 :
1458 2316 : loopSide.Splitter.Exists = state.dataLoopNodes->NumofSplitters > 0;
1459 2316 : loopSide.Mixer.Exists = state.dataLoopNodes->NumofMixers > 0;
1460 :
1461 2316 : if (ErrorsFound) {
1462 0 : ShowFatalError(state, "GetPlantInput: Previous Severe errors cause termination.");
1463 : }
1464 :
1465 2316 : NumConnectorsInLoop = state.dataLoopNodes->NumofSplitters + state.dataLoopNodes->NumofMixers;
1466 2316 : SplitNum = 1;
1467 4599 : for (ConnNum = 1; ConnNum <= NumConnectorsInLoop; ++ConnNum) {
1468 :
1469 4566 : if (SplitNum > state.dataLoopNodes->NumofSplitters) {
1470 2283 : break;
1471 : }
1472 2283 : OutletNodeNames.allocate(MaxNumAlphas);
1473 2283 : OutletNodeNumbers.allocate(MaxNumAlphas);
1474 4566 : GetLoopSplitter(state,
1475 2283 : plantLoop.Name,
1476 2283 : loopSide.ConnectList,
1477 2283 : loopSide.Splitter.Name,
1478 2283 : loopSide.Splitter.Exists,
1479 2283 : loopSide.Splitter.NodeNameIn,
1480 2283 : loopSide.Splitter.NodeNumIn,
1481 2283 : loopSide.Splitter.TotalOutletNodes,
1482 : OutletNodeNames,
1483 : OutletNodeNumbers,
1484 : ErrorsFound,
1485 : ConnNum,
1486 : SplitNum);
1487 :
1488 2283 : if (SplitNum == 1) {
1489 0 : OutletNodeNames.deallocate();
1490 0 : OutletNodeNumbers.deallocate();
1491 0 : continue;
1492 : }
1493 :
1494 : // Map the inlet node to the splitter to a branch number
1495 2283 : if (loopSide.Splitter.Exists) {
1496 : // Map the inlet node to the splitter to a branch number
1497 2283 : SplitInBranch = false;
1498 2283 : for (BranchNum = 1; BranchNum <= loopSide.TotalBranches; ++BranchNum) {
1499 2283 : auto &branch = loopSide.Branch(BranchNum);
1500 2283 : CompNum = branch.TotalComponents;
1501 2283 : if (loopSide.Splitter.NodeNumIn == branch.Comp(CompNum).NodeNumOut) {
1502 2283 : loopSide.Splitter.BranchNumIn = BranchNum;
1503 2283 : SplitInBranch = true;
1504 2283 : break; // BranchNum DO loop
1505 : }
1506 : }
1507 2283 : if (!SplitInBranch) {
1508 0 : ShowSevereError(state, "Splitter Inlet Branch not found, Splitter=" + loopSide.Splitter.Name);
1509 0 : ShowContinueError(state, "Splitter Branch Inlet name=" + loopSide.Splitter.NodeNameIn);
1510 0 : ShowContinueError(state, "In Loop=" + plantLoop.Name);
1511 0 : ErrorsFound = true;
1512 : }
1513 :
1514 2283 : loopSide.Splitter.NodeNameOut.allocate(loopSide.Splitter.TotalOutletNodes);
1515 2283 : loopSide.Splitter.NodeNumOut.dimension(loopSide.Splitter.TotalOutletNodes, 0);
1516 2283 : loopSide.Splitter.BranchNumOut.dimension(loopSide.Splitter.TotalOutletNodes, 0);
1517 :
1518 2283 : SplitOutBranch.allocate(loopSide.Splitter.TotalOutletNodes);
1519 2283 : SplitOutBranch = false;
1520 11640 : for (NodeNum = 1; NodeNum <= loopSide.Splitter.TotalOutletNodes; ++NodeNum) {
1521 9357 : loopSide.Splitter.NodeNameOut(NodeNum) = OutletNodeNames(NodeNum);
1522 9357 : loopSide.Splitter.NodeNumOut(NodeNum) = OutletNodeNumbers(NodeNum);
1523 : // The following DO loop series is intended to store the branch number for each outlet
1524 : // branch of the splitter
1525 155235 : for (BranchNum = 1; BranchNum <= loopSide.TotalBranches; ++BranchNum) {
1526 155235 : if (loopSide.Splitter.NodeNumOut(NodeNum) == loopSide.Branch(BranchNum).Comp(1).NodeNumIn) {
1527 9357 : loopSide.Splitter.BranchNumOut(NodeNum) = BranchNum;
1528 9357 : SplitOutBranch(NodeNum) = true;
1529 9357 : break; // BranchNum DO loop
1530 : }
1531 : }
1532 : }
1533 :
1534 11640 : for (Outlet = 1; Outlet <= loopSide.Splitter.TotalOutletNodes; ++Outlet) {
1535 9357 : if (SplitOutBranch(Outlet)) {
1536 9357 : continue;
1537 : }
1538 0 : ShowSevereError(state, "Splitter Outlet Branch not found, Splitter=" + loopSide.Splitter.Name);
1539 0 : ShowContinueError(state, "Splitter Branch Outlet node name=" + loopSide.Splitter.NodeNameOut(Outlet));
1540 0 : ShowContinueError(state, "In Loop=" + plantLoop.Name);
1541 0 : ShowContinueError(state, "Loop BranchList=" + loopSide.BranchList);
1542 0 : ShowContinueError(state, "Loop ConnectorList=" + loopSide.ConnectList);
1543 0 : ErrorsFound = true;
1544 : }
1545 :
1546 2283 : SplitOutBranch.deallocate();
1547 :
1548 : } // Splitter exists
1549 2283 : OutletNodeNames.deallocate();
1550 2283 : OutletNodeNumbers.deallocate();
1551 : }
1552 :
1553 2316 : MixNum = 1;
1554 6882 : for (ConnNum = 1; ConnNum <= NumConnectorsInLoop; ++ConnNum) {
1555 :
1556 4566 : if (MixNum > state.dataLoopNodes->NumofMixers) {
1557 0 : break;
1558 : }
1559 4566 : InletNodeNames.allocate(MaxNumAlphas);
1560 4566 : InletNodeNumbers.allocate(MaxNumAlphas);
1561 9132 : GetLoopMixer(state,
1562 4566 : plantLoop.Name,
1563 4566 : loopSide.ConnectList,
1564 4566 : loopSide.Mixer.Name,
1565 4566 : loopSide.Mixer.Exists,
1566 4566 : loopSide.Mixer.NodeNameOut,
1567 4566 : loopSide.Mixer.NodeNumOut,
1568 4566 : loopSide.Mixer.TotalInletNodes,
1569 : InletNodeNames,
1570 : InletNodeNumbers,
1571 : ErrorsFound,
1572 : ConnNum,
1573 : MixNum);
1574 :
1575 4566 : if (MixNum == 1) {
1576 2283 : InletNodeNames.deallocate();
1577 2283 : InletNodeNumbers.deallocate();
1578 2283 : continue;
1579 : }
1580 : // Map the outlet node of the mixer to a branch number
1581 2283 : if (loopSide.Mixer.Exists) {
1582 : // Map the outlet node of the mixer to a branch number
1583 2283 : MixerOutBranch = false;
1584 13923 : for (BranchNum = 1; BranchNum <= loopSide.TotalBranches; ++BranchNum) {
1585 13923 : if (loopSide.Mixer.NodeNumOut == loopSide.Branch(BranchNum).Comp(1).NodeNumIn) {
1586 2283 : loopSide.Mixer.BranchNumOut = BranchNum;
1587 2283 : MixerOutBranch = true;
1588 2283 : break; // BranchNum DO loop
1589 : }
1590 : }
1591 2283 : if (!MixerOutBranch) {
1592 0 : ShowSevereError(state, "Mixer Outlet Branch not found, Mixer=" + loopSide.Mixer.Name);
1593 0 : ErrorsFound = true;
1594 : }
1595 :
1596 2283 : loopSide.Mixer.NodeNameIn.allocate(loopSide.Mixer.TotalInletNodes);
1597 2283 : loopSide.Mixer.NodeNumIn.dimension(loopSide.Mixer.TotalInletNodes, 0);
1598 2283 : loopSide.Mixer.BranchNumIn.dimension(loopSide.Mixer.TotalInletNodes, 0);
1599 :
1600 2283 : MixerInBranch.allocate(loopSide.Mixer.TotalInletNodes);
1601 2283 : MixerInBranch = false;
1602 11640 : for (NodeNum = 1; NodeNum <= loopSide.Mixer.TotalInletNodes; ++NodeNum) {
1603 9357 : loopSide.Mixer.NodeNameIn(NodeNum) = InletNodeNames(NodeNum);
1604 9357 : loopSide.Mixer.NodeNumIn(NodeNum) = InletNodeNumbers(NodeNum);
1605 : // The following DO loop series is intended to store the branch number for each inlet branch of the mixer
1606 155235 : for (BranchNum = 1; BranchNum <= loopSide.TotalBranches; ++BranchNum) {
1607 155235 : auto &branch = loopSide.Branch(BranchNum);
1608 155235 : CompNum = branch.TotalComponents;
1609 155235 : if (loopSide.Mixer.NodeNumIn(NodeNum) == branch.Comp(CompNum).NodeNumOut) {
1610 9357 : loopSide.Mixer.BranchNumIn(NodeNum) = BranchNum;
1611 9357 : MixerInBranch(NodeNum) = true;
1612 9357 : break; // BranchNum DO loop
1613 : }
1614 : }
1615 : }
1616 :
1617 11640 : for (Inlet = 1; Inlet <= loopSide.Mixer.TotalInletNodes; ++Inlet) {
1618 9357 : if (MixerInBranch(Inlet)) {
1619 9357 : continue;
1620 : }
1621 0 : ShowSevereError(state, "Mixer Inlet Branch not found, Mixer=" + loopSide.Mixer.Name);
1622 0 : ShowContinueError(state, "Mixer Branch Inlet name=" + loopSide.Mixer.NodeNameIn(Inlet));
1623 0 : ShowContinueError(state, "In Loop=" + plantLoop.Name);
1624 0 : ShowContinueError(state, "Loop BranchList=" + loopSide.BranchList);
1625 0 : ShowContinueError(state, "Loop ConnectorList=" + loopSide.ConnectList);
1626 0 : ErrorsFound = true;
1627 : }
1628 :
1629 2283 : MixerInBranch.deallocate();
1630 : } // Mixer exists
1631 2283 : InletNodeNames.deallocate();
1632 2283 : InletNodeNumbers.deallocate();
1633 : }
1634 :
1635 2316 : loopSide.noLoadConstantSpeedBranchFlowRateSteps.allocate(loopSide.TotalBranches - 2);
1636 :
1637 : // TODO: this is just intended to be temporary
1638 2316 : loopSide.plantLoc.loopNum = LoopNum;
1639 2316 : loopSide.plantLoc.loopSideNum = LoopSideNum;
1640 :
1641 : } // ... end LoopSideNum=LoopSideLocation::Demand,LoopSideLocation::Supply
1642 :
1643 1158 : plantLoop.LoopSide(DataPlant::LoopSideLocation::Demand).loopSideDescription = plantLoop.Name + " - Demand Side";
1644 1158 : plantLoop.LoopSide(DataPlant::LoopSideLocation::Supply).loopSideDescription = plantLoop.Name + " - Supply Side";
1645 :
1646 : // a nice little spot to report out bad pump/common-pipe configurations
1647 1158 : bool const ThisSideHasPumps = (plantLoop.LoopSide(DataPlant::LoopSideLocation::Demand).TotalPumps > 0);
1648 1158 : bool const OtherSideHasPumps = (plantLoop.LoopSide(DataPlant::LoopSideLocation::Supply).TotalPumps > 0);
1649 1158 : if ((plantLoop.CommonPipeType != DataPlant::CommonPipeType::No) && (!ThisSideHasPumps || !OtherSideHasPumps)) {
1650 0 : ShowSevereError(state, "Input Error: Common Pipe configurations must have pumps on both sides of loop");
1651 0 : ShowContinueError(state, "Occurs on plant loop name =\"" + plantLoop.Name + "\"");
1652 0 : ShowContinueError(state, "Make sure both demand and supply sides have a pump");
1653 0 : ErrorsFound = true;
1654 1158 : } else if ((plantLoop.CommonPipeType == DataPlant::CommonPipeType::No) && ThisSideHasPumps && OtherSideHasPumps) {
1655 0 : ShowSevereError(state, "Input Error: Pumps on both loop sides must utilize a common pipe");
1656 0 : ShowContinueError(state, "Occurs on plant loop name =\"" + plantLoop.Name + "\"");
1657 0 : ShowContinueError(state, "Add common pipe or remove one loop side pump");
1658 0 : ErrorsFound = true;
1659 1158 : } else if (!ThisSideHasPumps && !OtherSideHasPumps) {
1660 0 : ShowSevereError(state, "SetupLoopFlowRequest: Problem in plant topology, no pumps specified on the loop");
1661 0 : ShowContinueError(state, "Occurs on plant loop name =\"" + plantLoop.Name + "\"");
1662 0 : ShowContinueError(state, "All plant loops require at least one pump");
1663 0 : ErrorsFound = true;
1664 : }
1665 :
1666 : // set up some pump indexing for convenience later
1667 3474 : for (DataPlant::LoopSideLocation LoopSideCounter : DataPlant::LoopSideKeys) {
1668 3496 : for (int PumpCounter = 1; PumpCounter <= plantLoop.LoopSide(LoopSideCounter).TotalPumps; ++PumpCounter) {
1669 1180 : int const PumpBranchNum = plantLoop.LoopSide(LoopSideCounter).Pumps(PumpCounter).BranchNum;
1670 1180 : int const PumpCompNum = plantLoop.LoopSide(LoopSideCounter).Pumps(PumpCounter).CompNum;
1671 1180 : plantLoop.LoopSide(LoopSideCounter).Branch(PumpBranchNum).Comp(PumpCompNum).IndexInLoopSidePumps = PumpCounter;
1672 : }
1673 : }
1674 : }
1675 :
1676 801 : if (ErrorsFound) {
1677 0 : ShowFatalError(state, "GetPlantInput: Errors in getting PlantLoop Input");
1678 : }
1679 :
1680 801 : if (state.dataHVACGlobal->NumPlantLoops > 0) {
1681 446 : state.dataPlnt->VentRepPlant[static_cast<int>(LoopSideLocation::Supply)].allocate(state.dataHVACGlobal->NumPlantLoops);
1682 : }
1683 801 : if (state.dataHVACGlobal->NumPlantLoops > 0) {
1684 446 : state.dataPlnt->VentRepPlant[static_cast<int>(LoopSideLocation::Demand)].allocate(state.dataHVACGlobal->NumPlantLoops);
1685 : }
1686 :
1687 1699 : for (LoopNum = 1; LoopNum <= state.dataHVACGlobal->NumPlantLoops; ++LoopNum) {
1688 :
1689 : // set up references for this loop
1690 898 : auto &this_plant_loop = state.dataPlnt->PlantLoop(LoopNum);
1691 898 : auto const &this_plant_supply = this_plant_loop.LoopSide(LoopSideLocation::Supply);
1692 898 : auto &this_vent_plant_supply = state.dataPlnt->VentRepPlant[static_cast<int>(LoopSideLocation::Supply)](LoopNum);
1693 898 : auto const &this_plant_demand = this_plant_loop.LoopSide(LoopSideLocation::Demand);
1694 898 : auto &this_vent_plant_demand = state.dataPlnt->VentRepPlant[static_cast<int>(LoopSideLocation::Demand)](LoopNum);
1695 :
1696 898 : this_vent_plant_supply.Name = this_plant_loop.Name;
1697 898 : this_vent_plant_supply.NodeNumIn = this_plant_supply.NodeNumIn;
1698 898 : this_vent_plant_supply.NodeNameIn = this_plant_supply.NodeNameIn;
1699 898 : this_vent_plant_supply.NodeNumOut = this_plant_supply.NodeNumOut;
1700 898 : this_vent_plant_supply.NodeNameOut = this_plant_supply.NodeNameOut;
1701 898 : this_vent_plant_supply.TotalBranches = this_plant_supply.TotalBranches;
1702 :
1703 898 : if (this_vent_plant_supply.TotalBranches > 0) {
1704 898 : this_vent_plant_supply.Branch.allocate(this_vent_plant_supply.TotalBranches);
1705 : }
1706 :
1707 4632 : for (BranchNum = 1; BranchNum <= this_vent_plant_supply.TotalBranches; ++BranchNum) {
1708 :
1709 3734 : auto const &this_plant_supply_branch = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).Branch(BranchNum);
1710 3734 : auto &this_vent_plant_supply_branch = state.dataPlnt->VentRepPlant[static_cast<int>(LoopSideLocation::Supply)](LoopNum).Branch(BranchNum);
1711 :
1712 3734 : this_vent_plant_supply_branch.Name = this_plant_supply_branch.Name;
1713 3734 : this_vent_plant_supply_branch.NodeNumIn = this_plant_supply_branch.NodeNumIn;
1714 3734 : this_vent_plant_supply_branch.NodeNumOut = this_plant_supply_branch.NodeNumOut;
1715 3734 : this_vent_plant_supply_branch.TotalComponents = this_plant_supply_branch.TotalComponents;
1716 3734 : if (this_vent_plant_supply_branch.TotalComponents > 0) {
1717 3734 : TotCompsOnBranch = this_vent_plant_supply_branch.TotalComponents;
1718 3734 : this_vent_plant_supply_branch.Comp.allocate(TotCompsOnBranch);
1719 : }
1720 :
1721 3734 : for (CompNum = 1;
1722 7528 : CompNum <= state.dataPlnt->VentRepPlant[static_cast<int>(LoopSideLocation::Supply)](LoopNum).Branch(BranchNum).TotalComponents;
1723 : ++CompNum) {
1724 :
1725 : auto const &this_plant_supply_comp =
1726 3794 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).Branch(BranchNum).Comp(CompNum);
1727 : auto &this_vent_plant_supply_comp =
1728 3794 : state.dataPlnt->VentRepPlant[static_cast<int>(LoopSideLocation::Supply)](LoopNum).Branch(BranchNum).Comp(CompNum);
1729 :
1730 3794 : this_vent_plant_supply_comp.Name = this_plant_supply_comp.Name;
1731 3794 : this_vent_plant_supply_comp.TypeOf = this_plant_supply_comp.TypeOf;
1732 3794 : this_vent_plant_supply_comp.NodeNameIn = this_plant_supply_comp.NodeNameIn;
1733 3794 : this_vent_plant_supply_comp.NodeNameOut = this_plant_supply_comp.NodeNameOut;
1734 3794 : this_vent_plant_supply_comp.NodeNumIn = this_plant_supply_comp.NodeNumIn;
1735 3794 : this_vent_plant_supply_comp.NodeNumOut = this_plant_supply_comp.NodeNumOut;
1736 :
1737 : } // loop over components in branches on the loop (ventilation report data)
1738 :
1739 : } // loop over branches on the loop (ventilation report data)
1740 :
1741 898 : this_vent_plant_demand.Name = this_plant_loop.Name;
1742 898 : this_vent_plant_demand.NodeNumIn = this_plant_demand.NodeNumIn;
1743 898 : this_vent_plant_demand.NodeNameIn = this_plant_demand.NodeNameIn;
1744 898 : this_vent_plant_demand.NodeNumOut = this_plant_demand.NodeNumOut;
1745 898 : this_vent_plant_demand.NodeNameOut = this_plant_demand.NodeNameOut;
1746 898 : this_vent_plant_demand.TotalBranches = this_plant_demand.TotalBranches;
1747 :
1748 898 : if (this_vent_plant_demand.TotalBranches > 0) {
1749 898 : this_vent_plant_demand.Branch.allocate(this_vent_plant_demand.TotalBranches);
1750 : }
1751 :
1752 8796 : for (BranchNum = 1; BranchNum <= this_vent_plant_demand.TotalBranches; ++BranchNum) {
1753 :
1754 7898 : auto const &this_plant_demand_branch = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).Branch(BranchNum);
1755 7898 : auto &this_vent_plant_demand_branch = state.dataPlnt->VentRepPlant[static_cast<int>(LoopSideLocation::Demand)](LoopNum).Branch(BranchNum);
1756 :
1757 7898 : this_vent_plant_demand_branch.Name = this_plant_demand_branch.Name;
1758 7898 : this_vent_plant_demand_branch.NodeNumIn = this_plant_demand_branch.NodeNumIn;
1759 7898 : this_vent_plant_demand_branch.NodeNumOut = this_plant_demand_branch.NodeNumOut;
1760 7898 : this_vent_plant_demand_branch.TotalComponents = this_plant_demand_branch.TotalComponents;
1761 7898 : if (this_vent_plant_demand_branch.TotalComponents > 0) {
1762 7898 : TotCompsOnBranch = this_vent_plant_demand_branch.TotalComponents;
1763 7898 : this_vent_plant_demand_branch.Comp.allocate(TotCompsOnBranch);
1764 : }
1765 :
1766 15806 : for (CompNum = 1; CompNum <= this_vent_plant_demand_branch.TotalComponents; ++CompNum) {
1767 :
1768 : auto const &this_plant_demand_comp =
1769 7908 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).Branch(BranchNum).Comp(CompNum);
1770 : auto &this_vent_plant_demand_comp =
1771 7908 : state.dataPlnt->VentRepPlant[static_cast<int>(LoopSideLocation::Demand)](LoopNum).Branch(BranchNum).Comp(CompNum);
1772 :
1773 7908 : this_vent_plant_demand_comp.Name = this_plant_demand_comp.Name;
1774 7908 : this_vent_plant_demand_comp.TypeOf = this_plant_demand_comp.TypeOf;
1775 7908 : this_vent_plant_demand_comp.NodeNameIn = this_plant_demand_comp.NodeNameIn;
1776 7908 : this_vent_plant_demand_comp.NodeNameOut = this_plant_demand_comp.NodeNameOut;
1777 7908 : this_vent_plant_demand_comp.NodeNumIn = this_plant_demand_comp.NodeNumIn;
1778 7908 : this_vent_plant_demand_comp.NodeNumOut = this_plant_demand_comp.NodeNumOut;
1779 :
1780 : } // loop over components in branches on the loop (ventilation report data)
1781 :
1782 : } // loop over branches on the loop (ventilation report data)
1783 :
1784 : } // loop over plant supply loops (ventilation report data)
1785 :
1786 801 : if (state.dataHVACGlobal->NumCondLoops > 0) {
1787 258 : state.dataPlnt->VentRepCond[static_cast<int>(LoopSideLocation::Supply)].allocate(state.dataHVACGlobal->NumCondLoops);
1788 : }
1789 801 : if (state.dataHVACGlobal->NumCondLoops > 0) {
1790 258 : state.dataPlnt->VentRepCond[static_cast<int>(LoopSideLocation::Demand)].allocate(state.dataHVACGlobal->NumCondLoops);
1791 : }
1792 :
1793 1061 : for (LoopNum = 1; LoopNum <= state.dataHVACGlobal->NumCondLoops; ++LoopNum) {
1794 :
1795 260 : int LoopNumInArray = LoopNum + state.dataHVACGlobal->NumPlantLoops;
1796 :
1797 : // set up references for this loop
1798 260 : auto &this_cond_loop(state.dataPlnt->PlantLoop(LoopNumInArray));
1799 260 : auto &this_cond_supply(this_cond_loop.LoopSide(LoopSideLocation::Supply));
1800 260 : auto &this_vent_cond_supply(state.dataPlnt->VentRepCond[static_cast<int>(LoopSideLocation::Supply)](LoopNum));
1801 260 : auto &this_cond_demand(this_cond_loop.LoopSide(LoopSideLocation::Demand));
1802 260 : auto &this_vent_cond_demand(state.dataPlnt->VentRepCond[static_cast<int>(LoopSideLocation::Demand)](LoopNum));
1803 :
1804 260 : this_vent_cond_supply.Name = this_cond_loop.Name;
1805 260 : this_vent_cond_supply.NodeNumIn = this_cond_supply.NodeNumIn;
1806 260 : this_vent_cond_supply.NodeNameIn = this_cond_supply.NodeNameIn;
1807 260 : this_vent_cond_supply.NodeNumOut = this_cond_supply.NodeNumOut;
1808 260 : this_vent_cond_supply.NodeNameOut = this_cond_supply.NodeNameOut;
1809 260 : this_vent_cond_supply.TotalBranches = this_cond_supply.TotalBranches;
1810 260 : if (this_vent_cond_supply.TotalBranches > 0) {
1811 260 : this_vent_cond_supply.Branch.allocate(this_vent_cond_supply.TotalBranches);
1812 : }
1813 :
1814 1315 : for (BranchNum = 1; BranchNum <= this_vent_cond_supply.TotalBranches; ++BranchNum) {
1815 :
1816 1055 : auto const &this_cond_supply_branch(this_cond_supply.Branch(BranchNum));
1817 1055 : auto &this_vent_cond_supply_branch(this_vent_cond_supply.Branch(BranchNum));
1818 :
1819 1055 : this_vent_cond_supply_branch.Name = this_cond_supply_branch.Name;
1820 1055 : this_vent_cond_supply_branch.NodeNumIn = this_cond_supply_branch.NodeNumIn;
1821 1055 : this_vent_cond_supply_branch.NodeNumOut = this_cond_supply_branch.NodeNumOut;
1822 1055 : this_vent_cond_supply_branch.TotalComponents = this_cond_supply_branch.TotalComponents;
1823 1055 : if (this_vent_cond_supply_branch.TotalComponents > 0) {
1824 1055 : TotCompsOnBranch = this_vent_cond_supply_branch.TotalComponents;
1825 1055 : this_vent_cond_supply_branch.Comp.allocate(TotCompsOnBranch);
1826 : }
1827 :
1828 2126 : for (CompNum = 1; CompNum <= this_vent_cond_supply_branch.TotalComponents; ++CompNum) {
1829 :
1830 1071 : auto const &this_cond_supply_comp(this_cond_loop.LoopSide(LoopSideLocation::Supply).Branch(BranchNum).Comp(CompNum));
1831 1071 : auto &this_vent_cond_supply_comp(this_vent_cond_supply.Branch(BranchNum).Comp(CompNum));
1832 :
1833 1071 : this_vent_cond_supply_comp.Name = this_cond_supply_comp.Name;
1834 1071 : this_vent_cond_supply_comp.TypeOf = this_cond_supply_comp.TypeOf;
1835 1071 : this_vent_cond_supply_comp.NodeNameIn = this_cond_supply_comp.NodeNameIn;
1836 1071 : this_vent_cond_supply_comp.NodeNameOut = this_cond_supply_comp.NodeNameOut;
1837 1071 : this_vent_cond_supply_comp.NodeNumIn = this_cond_supply_comp.NodeNumIn;
1838 1071 : this_vent_cond_supply_comp.NodeNumOut = this_cond_supply_comp.NodeNumOut;
1839 :
1840 : } // loop over components in branches on the loop (ventilation report data)
1841 :
1842 : } // loop over branches on the loop (ventilation report data)
1843 :
1844 260 : this_vent_cond_demand.Name = this_cond_loop.Name;
1845 260 : this_vent_cond_demand.NodeNumIn = this_cond_demand.NodeNumIn;
1846 260 : this_vent_cond_demand.NodeNameIn = this_cond_demand.NodeNameIn;
1847 260 : this_vent_cond_demand.NodeNumOut = this_cond_demand.NodeNumOut;
1848 260 : this_vent_cond_demand.NodeNameOut = this_cond_demand.NodeNameOut;
1849 260 : this_vent_cond_demand.TotalBranches = this_cond_demand.TotalBranches;
1850 260 : if (this_vent_cond_demand.TotalBranches > 0) {
1851 260 : this_vent_cond_demand.Branch.allocate(this_vent_cond_demand.TotalBranches);
1852 : }
1853 :
1854 1529 : for (BranchNum = 1; BranchNum <= this_vent_cond_demand.TotalBranches; ++BranchNum) {
1855 :
1856 1269 : auto &this_cond_demand_branch(this_cond_demand.Branch(BranchNum));
1857 1269 : auto &this_vent_cond_demand_branch(this_vent_cond_demand.Branch(BranchNum));
1858 :
1859 1269 : this_vent_cond_demand_branch.Name = this_cond_demand_branch.Name;
1860 1269 : this_vent_cond_demand_branch.NodeNumIn = this_cond_demand_branch.NodeNumIn;
1861 1269 : this_vent_cond_demand_branch.NodeNumOut = this_cond_demand_branch.NodeNumOut;
1862 1269 : this_vent_cond_demand_branch.TotalComponents = this_cond_demand_branch.TotalComponents;
1863 1269 : if (this_vent_cond_demand_branch.TotalComponents > 0) {
1864 1269 : TotCompsOnBranch = this_vent_cond_demand_branch.TotalComponents;
1865 1269 : this_vent_cond_demand_branch.Comp.allocate(TotCompsOnBranch);
1866 : }
1867 :
1868 2538 : for (CompNum = 1; CompNum <= this_vent_cond_demand_branch.TotalComponents; ++CompNum) {
1869 :
1870 1269 : auto const &this_cond_demand_comp(this_cond_demand_branch.Comp(CompNum));
1871 1269 : auto &this_vent_cond_demand_comp(this_vent_cond_demand_branch.Comp(CompNum));
1872 :
1873 1269 : this_vent_cond_demand_comp.Name = this_cond_demand_comp.Name;
1874 1269 : this_vent_cond_demand_comp.TypeOf = this_cond_demand_comp.TypeOf;
1875 1269 : this_vent_cond_demand_comp.NodeNameIn = this_cond_demand_comp.NodeNameIn;
1876 1269 : this_vent_cond_demand_comp.NodeNameOut = this_cond_demand_comp.NodeNameOut;
1877 1269 : this_vent_cond_demand_comp.NodeNumIn = this_cond_demand_comp.NodeNumIn;
1878 1269 : this_vent_cond_demand_comp.NodeNumOut = this_cond_demand_comp.NodeNumOut;
1879 :
1880 : } // loop over components in branches on the loop (ventilation report data)
1881 :
1882 : } // loop over branches on the loop (ventilation report data)
1883 :
1884 : } // loop over plant supply loops (ventilation report data)
1885 :
1886 : // OneTimeInit Here
1887 1959 : for (LoopNum = 1; LoopNum <= state.dataPlnt->TotNumLoops; ++LoopNum) {
1888 1158 : auto &plantLoop = state.dataPlnt->PlantLoop(LoopNum);
1889 1158 : plantLoop.LoopHasConnectionComp = false;
1890 :
1891 3474 : for (DataPlant::LoopSideLocation LoopSideNum : DataPlant::LoopSideKeys) {
1892 2316 : auto const &loopSide = plantLoop.LoopSide(LoopSideNum);
1893 :
1894 16272 : for (BranchNum = 1; BranchNum <= loopSide.TotalBranches; ++BranchNum) {
1895 :
1896 27998 : for (CompNum = 1; CompNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).TotalComponents; ++CompNum) {
1897 : // auto &this_comp_type(CompTypes(CompNum));
1898 14042 : auto &this_comp(state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp(CompNum));
1899 : // auto type = this_comp.TypeOf;
1900 14042 : this_comp.oneTimeInit(state);
1901 : }
1902 : }
1903 : }
1904 : }
1905 801 : }
1906 :
1907 801 : void SetupReports(EnergyPlusData &state)
1908 : {
1909 :
1910 : // SUBROUTINE INFORMATION:
1911 : // AUTHOR Rick Strand
1912 : // DATE WRITTEN July 2001
1913 :
1914 : // PURPOSE OF THIS SUBROUTINE:
1915 : // This subroutine initializes the plant supply side reports.
1916 : // It was created during the splitting of supply and demand side functions.
1917 :
1918 801 : int MaxBranches = 0; // Maximum number of branches on any plant loop (used for allocating arrays)
1919 :
1920 1959 : for (auto &loop : state.dataPlnt->PlantLoop) {
1921 1158 : MaxBranches = max(MaxBranches, loop.LoopSide(LoopSideLocation::Demand).TotalBranches);
1922 1158 : MaxBranches = max(MaxBranches, loop.LoopSide(LoopSideLocation::Supply).TotalBranches);
1923 1158 : loop.MaxBranch = MaxBranches;
1924 1158 : loop.CoolingDemand = 0.0;
1925 1158 : loop.HeatingDemand = 0.0;
1926 1158 : loop.DemandNotDispatched = 0.0;
1927 1158 : loop.UnmetDemand = 0.0;
1928 1158 : loop.InletNodeTemperature = 0.0;
1929 1158 : loop.OutletNodeTemperature = 0.0;
1930 1158 : loop.InletNodeFlowrate = 0.0;
1931 1158 : loop.BypassFrac = 0.0;
1932 1158 : loop.OutletNodeFlowrate = 0.0;
1933 : }
1934 :
1935 1959 : for (int LoopNum = 1; LoopNum <= state.dataPlnt->TotNumLoops; ++LoopNum) {
1936 1158 : auto &loop = state.dataPlnt->PlantLoop(LoopNum);
1937 2316 : SetupOutputVariable(state,
1938 : "Plant Supply Side Cooling Demand Rate",
1939 : Constant::Units::W,
1940 1158 : loop.CoolingDemand,
1941 : OutputProcessor::TimeStepType::System,
1942 : OutputProcessor::StoreType::Average,
1943 1158 : state.dataPlnt->PlantLoop(LoopNum).Name);
1944 2316 : SetupOutputVariable(state,
1945 : "Plant Supply Side Heating Demand Rate",
1946 : Constant::Units::W,
1947 1158 : loop.HeatingDemand,
1948 : OutputProcessor::TimeStepType::System,
1949 : OutputProcessor::StoreType::Average,
1950 1158 : state.dataPlnt->PlantLoop(LoopNum).Name);
1951 2316 : SetupOutputVariable(state,
1952 : "Plant Supply Side Inlet Mass Flow Rate",
1953 : Constant::Units::kg_s,
1954 1158 : loop.InletNodeFlowrate,
1955 : OutputProcessor::TimeStepType::System,
1956 : OutputProcessor::StoreType::Average,
1957 1158 : state.dataPlnt->PlantLoop(LoopNum).Name);
1958 :
1959 2316 : SetupOutputVariable(state,
1960 : "Plant Supply Side Inlet Temperature",
1961 : Constant::Units::C,
1962 1158 : loop.InletNodeTemperature,
1963 : OutputProcessor::TimeStepType::System,
1964 : OutputProcessor::StoreType::Average,
1965 1158 : state.dataPlnt->PlantLoop(LoopNum).Name);
1966 2316 : SetupOutputVariable(state,
1967 : "Plant Supply Side Outlet Temperature",
1968 : Constant::Units::C,
1969 1158 : loop.OutletNodeTemperature,
1970 : OutputProcessor::TimeStepType::System,
1971 : OutputProcessor::StoreType::Average,
1972 1158 : state.dataPlnt->PlantLoop(LoopNum).Name);
1973 :
1974 2316 : SetupOutputVariable(state,
1975 : "Plant Supply Side Not Distributed Demand Rate",
1976 : Constant::Units::W,
1977 1158 : loop.DemandNotDispatched,
1978 : OutputProcessor::TimeStepType::System,
1979 : OutputProcessor::StoreType::Average,
1980 1158 : state.dataPlnt->PlantLoop(LoopNum).Name);
1981 2316 : SetupOutputVariable(state,
1982 : "Plant Supply Side Unmet Demand Rate",
1983 : Constant::Units::W,
1984 1158 : loop.UnmetDemand,
1985 : OutputProcessor::TimeStepType::System,
1986 : OutputProcessor::StoreType::Average,
1987 1158 : state.dataPlnt->PlantLoop(LoopNum).Name);
1988 2316 : SetupOutputVariable(state,
1989 : "Debug Plant Loop Bypass Fraction",
1990 : Constant::Units::None,
1991 1158 : loop.BypassFrac,
1992 : OutputProcessor::TimeStepType::System,
1993 : OutputProcessor::StoreType::Average,
1994 1158 : state.dataPlnt->PlantLoop(LoopNum).Name);
1995 1158 : SetupOutputVariable(state,
1996 : "Debug Plant Last Simulated Loop Side",
1997 : Constant::Units::None,
1998 1158 : loop.LastLoopSideSimulated,
1999 : OutputProcessor::TimeStepType::System,
2000 : OutputProcessor::StoreType::Average,
2001 1158 : state.dataPlnt->PlantLoop(LoopNum).Name);
2002 : }
2003 :
2004 : // setup more variables inside plant data structure
2005 801 : if (state.dataGlobal->DisplayAdvancedReportVariables) {
2006 28 : for (int LoopNum = 1; LoopNum <= state.dataPlnt->TotNumLoops; ++LoopNum) {
2007 12 : SetupOutputVariable(state,
2008 : "Plant Demand Side Lumped Capacitance Temperature",
2009 : Constant::Units::C,
2010 6 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).LoopSideInlet_TankTemp,
2011 : OutputProcessor::TimeStepType::System,
2012 : OutputProcessor::StoreType::Average,
2013 6 : state.dataPlnt->PlantLoop(LoopNum).Name);
2014 12 : SetupOutputVariable(state,
2015 : "Plant Supply Side Lumped Capacitance Temperature",
2016 : Constant::Units::C,
2017 6 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).LoopSideInlet_TankTemp,
2018 : OutputProcessor::TimeStepType::System,
2019 : OutputProcessor::StoreType::Average,
2020 6 : state.dataPlnt->PlantLoop(LoopNum).Name);
2021 12 : SetupOutputVariable(state,
2022 : "Plant Demand Side Lumped Capacitance Heat Transport Rate",
2023 : Constant::Units::W,
2024 6 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).LoopSideInlet_MdotCpDeltaT,
2025 : OutputProcessor::TimeStepType::System,
2026 : OutputProcessor::StoreType::Average,
2027 6 : state.dataPlnt->PlantLoop(LoopNum).Name);
2028 12 : SetupOutputVariable(state,
2029 : "Plant Supply Side Lumped Capacitance Heat Transport Rate",
2030 : Constant::Units::W,
2031 6 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).LoopSideInlet_MdotCpDeltaT,
2032 : OutputProcessor::TimeStepType::System,
2033 : OutputProcessor::StoreType::Average,
2034 6 : state.dataPlnt->PlantLoop(LoopNum).Name);
2035 12 : SetupOutputVariable(state,
2036 : "Plant Demand Side Lumped Capacitance Heat Storage Rate",
2037 : Constant::Units::W,
2038 6 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).LoopSideInlet_McpDTdt,
2039 : OutputProcessor::TimeStepType::System,
2040 : OutputProcessor::StoreType::Average,
2041 6 : state.dataPlnt->PlantLoop(LoopNum).Name);
2042 12 : SetupOutputVariable(state,
2043 : "Plant Supply Side Lumped Capacitance Heat Storage Rate",
2044 : Constant::Units::W,
2045 6 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).LoopSideInlet_McpDTdt,
2046 : OutputProcessor::TimeStepType::System,
2047 : OutputProcessor::StoreType::Average,
2048 6 : state.dataPlnt->PlantLoop(LoopNum).Name);
2049 12 : SetupOutputVariable(state,
2050 : "Plant Demand Side Lumped Capacitance Excessive Storage Time",
2051 : Constant::Units::hr,
2052 6 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).LoopSideInlet_CapExcessStorageTimeReport,
2053 : OutputProcessor::TimeStepType::System,
2054 : OutputProcessor::StoreType::Sum,
2055 6 : state.dataPlnt->PlantLoop(LoopNum).Name);
2056 12 : SetupOutputVariable(state,
2057 : "Plant Supply Side Lumped Capacitance Excessive Storage Time",
2058 : Constant::Units::hr,
2059 6 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).LoopSideInlet_CapExcessStorageTimeReport,
2060 : OutputProcessor::TimeStepType::System,
2061 : OutputProcessor::StoreType::Sum,
2062 6 : state.dataPlnt->PlantLoop(LoopNum).Name);
2063 18 : for (DataPlant::LoopSideLocation LoopSideNum : DataPlant::LoopSideKeys) {
2064 53 : for (int BranchNum = 1; BranchNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).TotalBranches; ++BranchNum) {
2065 85 : for (int CompNum = 1; CompNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).TotalComponents;
2066 : ++CompNum) {
2067 44 : if (state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp(CompNum).CurOpSchemeType !=
2068 : OpScheme::Demand) {
2069 68 : SetupOutputVariable(state,
2070 : "Plant Component Distributed Demand Rate",
2071 : Constant::Units::W,
2072 34 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp(CompNum).MyLoad,
2073 : OutputProcessor::TimeStepType::System,
2074 : OutputProcessor::StoreType::Average,
2075 34 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp(CompNum).Name);
2076 : }
2077 : }
2078 : }
2079 : }
2080 : }
2081 : }
2082 :
2083 : // now traverse plant loops and set fluid type index in all nodes on the loop
2084 1959 : for (int LoopNum = 1; LoopNum <= state.dataPlnt->TotNumLoops; ++LoopNum) {
2085 1158 : int FluidIndex = state.dataPlnt->PlantLoop(LoopNum).FluidIndex;
2086 3474 : for (DataPlant::LoopSideLocation LoopSideNum : DataPlant::LoopSideKeys) {
2087 2316 : state.dataLoopNodes->Node(state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).NodeNumIn).FluidIndex = FluidIndex;
2088 2316 : state.dataLoopNodes->Node(state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).NodeNumOut).FluidIndex = FluidIndex;
2089 16272 : for (int BranchNum = 1; BranchNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).TotalBranches; ++BranchNum) {
2090 27998 : for (int CompNum = 1; CompNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).TotalComponents;
2091 : ++CompNum) {
2092 14042 : state.dataLoopNodes->Node(state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp(CompNum).NodeNumIn)
2093 14042 : .FluidIndex = FluidIndex;
2094 14042 : state.dataLoopNodes->Node(state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp(CompNum).NodeNumOut)
2095 28084 : .FluidIndex = FluidIndex;
2096 : }
2097 : }
2098 : }
2099 : } // plant loops
2100 :
2101 : // Plant topology report
2102 : // auto &orp = state.dataOutRptPredefined;
2103 : // MJW ToDo: Tabular report inputs haven't been read yet - move that or just skip checking if the report is requested?
2104 : // if (orp->reportName(orp->pdrTopology).show) {
2105 :
2106 : // constexpr std::string_view plantLoop = "PlantLoop";
2107 801 : int rowCounter = 1;
2108 1959 : for (int loopNum = 1; loopNum <= state.dataPlnt->TotNumLoops; ++loopNum) {
2109 1158 : fillPlantCondenserTopology(state, state.dataPlnt->PlantLoop(loopNum), rowCounter);
2110 : }
2111 :
2112 : // constexpr std::string_view condenserLoop = "CondenserLoop";
2113 : // for (int loopNum = state.dataHVACGlobal->NumPlantLoops + 1; loopNum <= (state.dataHVACGlobal->NumPlantLoops +
2114 : // state.dataHVACGlobal->NumCondLoops);
2115 : // ++loopNum) {
2116 : // fillPlantCondenserTopology(state, condenserLoop, state.dataPlnt->PlantLoop(loopNum));
2117 : // }
2118 : // }
2119 801 : }
2120 :
2121 1158 : void fillPlantCondenserTopology(EnergyPlusData &state, DataPlant::PlantLoopData &thisLoop, int &rowCounter)
2122 : {
2123 1158 : auto &orp = state.dataOutRptPredefined;
2124 : // int repOffset = 0;
2125 : // if (thisLoop.TypeOfLoop == DataPlant::LoopType::Condenser) {
2126 : // // Shift column pointers for condenser loop subtable
2127 : // repOffset = orp->pdchTopCondCompType - orp->pdchTopPlantCompType;
2128 : // }
2129 1158 : std::string_view const loopType = DataPlant::loopTypeNames[static_cast<int>(thisLoop.TypeOfLoop)];
2130 3474 : for (DataPlant::LoopSideLocation LoopSideNum : {DataPlant::LoopSideLocation::Supply, DataPlant::LoopSideLocation::Demand}) {
2131 2316 : auto &thisLoopSide = thisLoop.LoopSide(LoopSideNum);
2132 2316 : std::string_view const loopSide = DataPlant::DemandSupplyNames[static_cast<int>(LoopSideNum)];
2133 :
2134 : // s->pdstTopPlantLoop2 = newPreDefSubTable(state, s->pdrTopology, "Plant Loop Component Arrangement");
2135 : // s->pdchTopPlantLoopType2 = newPreDefColumn(state, s->pdstTopPlantLoop2, "Loop Type");
2136 : // s->pdchTopPlantLoopName2 = newPreDefColumn(state, s->pdstTopPlantLoop2, "Loop Name");
2137 : // s->pdchTopPlantSide2 = newPreDefColumn(state, s->pdstTopPlantLoop2, "Side");
2138 : // s->pdchTopPlantSplitName2 = newPreDefColumn(state, s->pdstTopPlantLoop2, "Splitter Name");
2139 : // s->pdchTopPlantBranchName2 = newPreDefColumn(state, s->pdstTopPlantLoop2, "Branch Name");
2140 : // s->pdchTopPlantCompType2 = newPreDefColumn(state, s->pdstTopPlantLoop2, "Component Type");
2141 : // s->pdchTopPlantCompName2 = newPreDefColumn(state, s->pdstTopPlantLoop2, "Component Name");
2142 : // s->pdchTopPlantMixName2 = newPreDefColumn(state, s->pdstTopPlantLoop2, "Mixer Name");
2143 :
2144 2316 : OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopPlantLoopType2, format("{}", rowCounter), loopType);
2145 2316 : OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopPlantLoopName2, format("{}", rowCounter), thisLoop.Name);
2146 2316 : OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopPlantSide2, format("{}", rowCounter), loopSide);
2147 2316 : ++rowCounter;
2148 :
2149 : // Report for first branch
2150 2316 : auto &thisBranch = thisLoopSide.Branch(1);
2151 :
2152 4665 : for (int compNum = 1; compNum <= thisBranch.TotalComponents; ++compNum) {
2153 2349 : auto const &thisComp = thisBranch.Comp(compNum);
2154 2349 : fillPlantToplogyComponentRow2(state, loopType, thisLoop.Name, loopSide, thisBranch.Name, thisComp.TypeOf, thisComp.Name, rowCounter);
2155 : }
2156 :
2157 2316 : if (thisLoopSide.TotalBranches >= 3) {
2158 : // parallel branches
2159 11640 : for (int branchNum = 2; branchNum <= thisLoopSide.TotalBranches - 1; ++branchNum) {
2160 9357 : auto &thisBranchNext = thisLoopSide.Branch(branchNum);
2161 : // splitter
2162 9357 : if (thisLoopSide.Splitter.Exists) {
2163 9357 : fillPlantToplogySplitterRow2(state, loopType, thisLoop.Name, loopSide, thisLoopSide.Splitter.Name, rowCounter);
2164 : }
2165 :
2166 18762 : for (int compNum = 1; compNum <= thisBranchNext.TotalComponents; ++compNum) {
2167 9405 : auto const &thisComp = thisBranchNext.Comp(compNum);
2168 : // fillPlantToplogyRow(state, thisComp.Name, thisComp.TypeOf, loopSide, branch, thisBranchNext.Name, thisLoop.FluidName,
2169 : // repOffset);
2170 9405 : fillPlantToplogyComponentRow2(
2171 : state, loopType, thisLoop.Name, loopSide, thisBranchNext.Name, thisComp.TypeOf, thisComp.Name, rowCounter);
2172 : }
2173 : // mixer
2174 9357 : if (thisLoopSide.Mixer.Exists) {
2175 9357 : rowCounter -= 1;
2176 9357 : fillPlantToplogyMixerRow2(state, loopType, thisLoop.Name, loopSide, thisLoopSide.Mixer.Name, rowCounter);
2177 9357 : rowCounter += 1;
2178 : }
2179 : }
2180 :
2181 : // Outlet Branch
2182 2283 : auto &thisBranchLast = thisLoopSide.Branch(thisLoopSide.TotalBranches);
2183 4571 : for (int compNum = 1; compNum <= thisBranchLast.TotalComponents; ++compNum) {
2184 2288 : auto const &thisComp = thisBranchLast.Comp(compNum);
2185 2288 : fillPlantToplogyComponentRow2(
2186 : state, loopType, thisLoop.Name, loopSide, thisBranchLast.Name, thisComp.TypeOf, thisComp.Name, rowCounter);
2187 : }
2188 : }
2189 : }
2190 1158 : }
2191 :
2192 9357 : void fillPlantToplogySplitterRow2(EnergyPlusData &state,
2193 : const std::string_view &loopType,
2194 : const std::string_view &loopName,
2195 : const std::string_view &side,
2196 : const std::string_view &splitterName,
2197 : int &rowCounter)
2198 : {
2199 9357 : auto &orp = state.dataOutRptPredefined;
2200 : // s->pdchTopPlantSplitName2 = newPreDefColumn(state, s->pdstTopPlantLoop2, "Splitter Name");
2201 9357 : OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopPlantLoopType2, format("{}", rowCounter), loopType);
2202 9357 : OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopPlantLoopName2, format("{}", rowCounter), loopName);
2203 9357 : OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopPlantSide2, format("{}", rowCounter), side);
2204 9357 : OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopPlantSplitName2, format("{}", rowCounter), splitterName);
2205 9357 : }
2206 9357 : void fillPlantToplogyMixerRow2(EnergyPlusData &state,
2207 : const std::string_view &loopType,
2208 : const std::string_view &loopName,
2209 : const std::string_view &side,
2210 : const std::string_view &mixerName,
2211 : int &rowCounter)
2212 : {
2213 9357 : auto &orp = state.dataOutRptPredefined;
2214 : // s->pdchTopPlantMixName2 = newPreDefColumn(state, s->pdstTopPlantLoop2, "Mixer Name");
2215 9357 : OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopPlantLoopType2, format("{}", rowCounter), loopType);
2216 9357 : OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopPlantLoopName2, format("{}", rowCounter), loopName);
2217 9357 : OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopPlantSide2, format("{}", rowCounter), side);
2218 9357 : OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopPlantMixName2, format("{}", rowCounter), mixerName);
2219 9357 : }
2220 14042 : void fillPlantToplogyComponentRow2(EnergyPlusData &state,
2221 : const std::string_view &loopType,
2222 : const std::string_view &loopName,
2223 : const std::string_view &side,
2224 : const std::string_view &branchName,
2225 : const std::string_view &compType,
2226 : const std::string_view &compName,
2227 : int &rowCounter)
2228 : {
2229 14042 : auto &orp = state.dataOutRptPredefined;
2230 : // s->pdchTopPlantBranchName2 = newPreDefColumn(state, s->pdstTopPlantLoop2, "Branch Name");
2231 : // s->pdchTopPlantCompType2 = newPreDefColumn(state, s->pdstTopPlantLoop2, "Component Type");
2232 : // s->pdchTopPlantCompName2 = newPreDefColumn(state, s->pdstTopPlantLoop2, "Component Name");
2233 14042 : OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopPlantLoopType2, format("{}", rowCounter), loopType);
2234 14042 : OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopPlantLoopName2, format("{}", rowCounter), loopName);
2235 14042 : OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopPlantSide2, format("{}", rowCounter), side);
2236 14042 : OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopPlantBranchName2, format("{}", rowCounter), branchName);
2237 14042 : OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopPlantCompType2, format("{}", rowCounter), compType);
2238 14042 : OutputReportPredefined::PreDefTableEntry(state, orp->pdchTopPlantCompName2, format("{}", rowCounter), compName);
2239 14042 : ++rowCounter;
2240 14042 : }
2241 :
2242 2980977 : void InitializeLoops(EnergyPlusData &state, bool const FirstHVACIteration) // true if first iteration of the simulation
2243 : {
2244 :
2245 : // SUBROUTINE INFORMATION:
2246 : // AUTHOR Sankaranarayanan K P
2247 : // DATE WRITTEN May 2005
2248 : // MODIFIED Dan Fisher Aug. 2008
2249 : // Brent Griffith May 2009 EMS setpoint check
2250 : // RE-ENGINEERED na
2251 :
2252 : // PURPOSE OF THIS SUBROUTINE:
2253 : // This subroutine initializes the
2254 : // Plant loop nodes one time at the beginning of the simulation.
2255 : // It also reinitializes loop temperatures if loop setpoint
2256 : // temperature changes. Branch levels for all branches are also set.
2257 :
2258 : // Using/Aliasing
2259 : using namespace DataSizing;
2260 : using EMSManager::CheckIfNodeSetPointManagedByEMS;
2261 :
2262 : using PlantUtilities::SetAllFlowLocks;
2263 :
2264 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
2265 : DataPlant::LoopSideLocation LoopSideNum;
2266 : int BranchNum; // branch loop counter
2267 : int CompNum; // plant side component counter
2268 :
2269 2980977 : bool ErrorsFound(false);
2270 :
2271 2980977 : if (!allocated(state.dataPlantMgr->PlantLoopSetPointInitFlag)) {
2272 462 : state.dataPlantMgr->PlantLoopSetPointInitFlag.allocate(state.dataPlnt->TotNumLoops);
2273 : }
2274 :
2275 : // Initialize the setpoints for Load range based schemes only as determined by the init flag
2276 : // The input already requires a loop setpoint. The plantloop object requires
2277 : // specification of a loop node and corresponding setpoint manager. Using a 'component setpoint'
2278 : // control scheme does NOT eliminate the requirement for a plant loop setpoint. So there is
2279 : // already the possibility that a component setpoint controlled object on the loop outlet
2280 : // branch would have the same setpoint node as the loop. I don't think setpoint manager traps
2281 : // for this user input error, but it might. Since both loop and component setpoints already
2282 : // peacefully coexist on the loop, we can allow the user to intentionally specify and use both.
2283 : // The only change required is to NOT smear the loop setpoint over all the loop nodes. Just
2284 : // read it from the setpoint node and use it. In the short term it will remain up to the user
2285 : // to specify the location of the loop setpoint control node and avoid conflicts with component
2286 : // setpoint nodes. Operationally, we will ignore the user specified placement of the loop setpoint
2287 : // node and assume that it is physically located at each half loop outlet for purposes of calculating loop
2288 : // demand. Long term, I recommend that we:
2289 : // 1. specify the setpointmanager:plant object name (not the node name) in the plantloop/condloop objects
2290 : // 2. write a new setpoint manager (setpointmanager:plant) that is more suitable for plant use and
2291 : // accommodates AIR and GROUND setpoints...with offsets.
2292 :
2293 : //*****************************************************************
2294 : // ONE TIME LOOP NODE SETPOINT CHECK
2295 : //*****************************************************************
2296 2980977 : if (state.dataPlantMgr->MySetPointCheckFlag && state.dataHVACGlobal->DoSetPointTest) {
2297 :
2298 : // check for missing setpoints
2299 1619 : for (int LoopNum = 1; LoopNum <= state.dataPlnt->TotNumLoops; ++LoopNum) {
2300 :
2301 1157 : int SensedNode = state.dataPlnt->PlantLoop(LoopNum).TempSetPointNodeNum;
2302 1157 : if (SensedNode > 0) {
2303 1157 : if (state.dataLoopNodes->Node(SensedNode).TempSetPoint == SensedNodeFlagValue) {
2304 8 : if (!state.dataGlobal->AnyEnergyManagementSystemInModel) {
2305 0 : ShowSevereError(state,
2306 0 : "PlantManager: No Setpoint Manager Defined for Node=" + state.dataLoopNodes->NodeID(SensedNode) +
2307 0 : " in PlantLoop=" + state.dataPlnt->PlantLoop(LoopNum).Name);
2308 0 : ShowContinueError(state, "Add Temperature Setpoint Manager with Control Variable = \"Temperature\" for this PlantLoop.");
2309 0 : state.dataHVACGlobal->SetPointErrorFlag = true;
2310 : } else {
2311 : // need call to EMS to check node
2312 8 : CheckIfNodeSetPointManagedByEMS(state, SensedNode, HVAC::CtrlVarType::Temp, state.dataHVACGlobal->SetPointErrorFlag);
2313 8 : if (state.dataHVACGlobal->SetPointErrorFlag) {
2314 0 : ShowSevereError(state,
2315 0 : "PlantManager: No Setpoint Manager Defined for Node=" + state.dataLoopNodes->NodeID(SensedNode) +
2316 0 : " in PlantLoop=" + state.dataPlnt->PlantLoop(LoopNum).Name);
2317 0 : ShowContinueError(state, "Add Temperature Setpoint Manager with Control Variable = \"Temperature\" for this PlantLoop.");
2318 0 : ShowContinueError(state, "Or add EMS Actuator to provide temperature setpoint at this node");
2319 : }
2320 : }
2321 : }
2322 : }
2323 : }
2324 462 : state.dataPlantMgr->MySetPointCheckFlag = false;
2325 : }
2326 : //*****************************************************************
2327 : // END ONE TIME LOOP NODE SETPOINT CHECK
2328 :
2329 : //*****************************************************************
2330 : // First Pass PUMP AND SIZING INIT
2331 : //*****************************************************************
2332 2980977 : if (!state.dataPlnt->PlantFirstSizeCompleted) {
2333 :
2334 462 : SetAllFlowLocks(state, DataPlant::FlowLock::Unlocked);
2335 462 : bool FinishSizingFlag = false;
2336 462 : state.dataPlnt->PlantFirstSizesOkayToFinalize = false; // set global flag for when it ready to store final sizes
2337 462 : state.dataPlnt->PlantFirstSizesOkayToReport = false;
2338 462 : state.dataPlnt->PlantFinalSizesOkayToReport = false;
2339 462 : state.dataPlantMgr->GetCompSizFac = true;
2340 2310 : for (int passNum = 1; passNum <= 4; ++passNum) { // begin while loop to iterate over the next calls sequentially
2341 :
2342 : // Step 2, call component models it using PlantCallingOrderInfo for sizing
2343 11104 : for (int HalfLoopNum = 1; HalfLoopNum <= state.dataPlnt->TotNumHalfLoops; ++HalfLoopNum) {
2344 9256 : int LoopNum = state.dataPlnt->PlantCallingOrderInfo(HalfLoopNum).LoopIndex;
2345 9256 : LoopSideNum = state.dataPlnt->PlantCallingOrderInfo(HalfLoopNum).LoopSide;
2346 9256 : state.dataSize->CurLoopNum = LoopNum;
2347 :
2348 65048 : for (BranchNum = 1; BranchNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).TotalBranches; ++BranchNum) {
2349 111928 : for (CompNum = 1; CompNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).TotalComponents;
2350 : ++CompNum) {
2351 56136 : state.dataPlnt->PlantLoop(LoopNum)
2352 56136 : .LoopSide(LoopSideNum)
2353 56136 : .Branch(BranchNum)
2354 56136 : .Comp(CompNum)
2355 56136 : .initLoopEquip(state, state.dataPlantMgr->GetCompSizFac);
2356 56136 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp(CompNum).simulate(state, FirstHVACIteration);
2357 : } //-CompNum
2358 : } //-BranchNum
2359 : }
2360 :
2361 : // step 3, revise calling order
2362 : // have now called each plant component model at least once with InitLoopEquip = .TRUE.
2363 : // this means the calls to InterConnectTwoPlantLoopSides have now been made, so rework calling order
2364 1848 : RevisePlantCallingOrder(state);
2365 :
2366 : // Step 4: Simulate plant loop components so their design flows are included
2367 :
2368 11104 : for (int HalfLoopNum = 1; HalfLoopNum <= state.dataPlnt->TotNumHalfLoops; ++HalfLoopNum) {
2369 :
2370 9256 : int LoopNum = state.dataPlnt->PlantCallingOrderInfo(HalfLoopNum).LoopIndex;
2371 9256 : LoopSideNum = state.dataPlnt->PlantCallingOrderInfo(HalfLoopNum).LoopSide;
2372 9256 : state.dataSize->CurLoopNum = LoopNum;
2373 9256 : if (LoopSideNum == LoopSideLocation::Supply) {
2374 4628 : SizePlantLoop(state, LoopNum, FinishSizingFlag);
2375 : }
2376 : }
2377 1848 : state.dataPlantMgr->GetCompSizFac = false;
2378 : } // iterative passes thru sizing related routines. end while?
2379 :
2380 : // Step 5 now one more time for the final
2381 2776 : for (int HalfLoopNum = 1; HalfLoopNum <= state.dataPlnt->TotNumHalfLoops; ++HalfLoopNum) {
2382 2314 : if (state.dataGlobal->DoHVACSizingSimulation) {
2383 88 : state.dataPlnt->PlantFirstSizesOkayToFinalize = true;
2384 88 : FinishSizingFlag = true;
2385 88 : state.dataPlnt->PlantFirstSizesOkayToReport = true;
2386 88 : state.dataPlnt->PlantFinalSizesOkayToReport = false;
2387 : } else {
2388 2226 : state.dataPlnt->PlantFirstSizesOkayToFinalize = true;
2389 2226 : FinishSizingFlag = true;
2390 2226 : state.dataPlnt->PlantFirstSizesOkayToReport = false;
2391 2226 : state.dataPlnt->PlantFinalSizesOkayToReport = true;
2392 : }
2393 2314 : int LoopNum = state.dataPlnt->PlantCallingOrderInfo(HalfLoopNum).LoopIndex;
2394 2314 : LoopSideNum = state.dataPlnt->PlantCallingOrderInfo(HalfLoopNum).LoopSide;
2395 2314 : state.dataSize->CurLoopNum = LoopNum;
2396 2314 : if (LoopSideNum == LoopSideLocation::Supply) {
2397 1157 : SizePlantLoop(state, LoopNum, FinishSizingFlag);
2398 : }
2399 : // pumps are special so call them directly
2400 2314 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).SimulateAllLoopSidePumps(state);
2401 16262 : for (BranchNum = 1; BranchNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).TotalBranches; ++BranchNum) {
2402 27982 : for (CompNum = 1; CompNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).TotalComponents; ++CompNum) {
2403 14034 : state.dataPlnt->PlantLoop(LoopNum)
2404 14034 : .LoopSide(LoopSideNum)
2405 14034 : .Branch(BranchNum)
2406 14034 : .Comp(CompNum)
2407 14034 : .initLoopEquip(state, state.dataPlantMgr->GetCompSizFac);
2408 14034 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp(CompNum).simulate(state, FirstHVACIteration);
2409 : } //-CompNum
2410 : } //-BranchNum
2411 : // if ( PlantLoop( LoopNum ).PlantSizNum > 0 ) PlantSizData( PlantLoop( LoopNum ).PlantSizNum
2412 : //).VolFlowSizingDone = true;
2413 : }
2414 :
2415 462 : state.dataPlnt->PlantFirstSizeCompleted = true;
2416 462 : state.dataPlnt->PlantFirstSizesOkayToReport = false;
2417 : }
2418 : //*****************************************************************
2419 : // END First Pass SIZING INIT
2420 : //*****************************************************************
2421 : //*****************************************************************
2422 : // BEGIN Resizing Pass for HVAC Sizing Simulation Adjustments
2423 : //*****************************************************************
2424 2980977 : if (state.dataGlobal->RedoSizesHVACSimulation && !state.dataPlnt->PlantReSizingCompleted) {
2425 :
2426 : // cycle through plant equipment calling with InitLoopEquip true
2427 12 : state.dataPlantMgr->GetCompSizFac = false;
2428 100 : for (int HalfLoopNum = 1; HalfLoopNum <= state.dataPlnt->TotNumHalfLoops; ++HalfLoopNum) {
2429 88 : int LoopNum = state.dataPlnt->PlantCallingOrderInfo(HalfLoopNum).LoopIndex;
2430 88 : LoopSideNum = state.dataPlnt->PlantCallingOrderInfo(HalfLoopNum).LoopSide;
2431 88 : state.dataSize->CurLoopNum = LoopNum;
2432 :
2433 710 : for (BranchNum = 1; BranchNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).TotalBranches; ++BranchNum) {
2434 1247 : for (CompNum = 1; CompNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).TotalComponents; ++CompNum) {
2435 625 : state.dataPlnt->PlantLoop(LoopNum)
2436 625 : .LoopSide(LoopSideNum)
2437 625 : .Branch(BranchNum)
2438 625 : .Comp(CompNum)
2439 625 : .initLoopEquip(state, state.dataPlantMgr->GetCompSizFac);
2440 :
2441 625 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp(CompNum).simulate(state, FirstHVACIteration);
2442 : } //-CompNum
2443 : } //-BranchNum
2444 : }
2445 :
2446 : // reset loop level
2447 12 : state.dataPlnt->PlantFinalSizesOkayToReport = true;
2448 56 : for (int LoopNum = 1; LoopNum <= state.dataPlnt->TotNumLoops; ++LoopNum) {
2449 44 : ResizePlantLoopLevelSizes(state, LoopNum);
2450 : }
2451 :
2452 : // now call everything again to reporting turned on
2453 100 : for (int HalfLoopNum = 1; HalfLoopNum <= state.dataPlnt->TotNumHalfLoops; ++HalfLoopNum) {
2454 88 : int LoopNum = state.dataPlnt->PlantCallingOrderInfo(HalfLoopNum).LoopIndex;
2455 88 : LoopSideNum = state.dataPlnt->PlantCallingOrderInfo(HalfLoopNum).LoopSide;
2456 88 : state.dataSize->CurLoopNum = LoopNum;
2457 :
2458 710 : for (BranchNum = 1; BranchNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).TotalBranches; ++BranchNum) {
2459 1247 : for (CompNum = 1; CompNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).TotalComponents; ++CompNum) {
2460 625 : state.dataPlnt->PlantLoop(LoopNum)
2461 625 : .LoopSide(LoopSideNum)
2462 625 : .Branch(BranchNum)
2463 625 : .Comp(CompNum)
2464 625 : .initLoopEquip(state, state.dataPlantMgr->GetCompSizFac);
2465 625 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp(CompNum).simulate(state, FirstHVACIteration);
2466 : } //-CompNum
2467 : } //-BranchNum
2468 : // pumps are special so call them directly
2469 88 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).SimulateAllLoopSidePumps(state);
2470 : }
2471 :
2472 12 : state.dataPlnt->PlantReSizingCompleted = true;
2473 12 : state.dataPlnt->PlantFinalSizesOkayToReport = false;
2474 : }
2475 : //*****************************************************************
2476 : // END Resizing Pass for HVAC Sizing Simulation Adjustments
2477 : //*****************************************************************
2478 : //*****************************************************************
2479 : // BEGIN ONE TIME ENVIRONMENT INITS
2480 : //*****************************************************************
2481 2980977 : if (state.dataPlantMgr->SupplyEnvrnFlag && state.dataGlobal->BeginEnvrnFlag) {
2482 :
2483 9859 : for (int LoopNum = 1; LoopNum <= state.dataPlnt->TotNumLoops; ++LoopNum) {
2484 : // check if setpoints being placed on node properly
2485 7110 : if (state.dataPlnt->PlantLoop(LoopNum).LoopDemandCalcScheme == DataPlant::LoopDemandCalcScheme::DualSetPointDeadBand) {
2486 91 : if (state.dataLoopNodes->Node(state.dataPlnt->PlantLoop(LoopNum).TempSetPointNodeNum).TempSetPointHi == SensedNodeFlagValue) {
2487 0 : if (!state.dataGlobal->AnyEnergyManagementSystemInModel) {
2488 0 : ShowSevereError(state, "Plant Loop: missing high temperature setpoint for dual setpoint deadband demand scheme");
2489 0 : ShowContinueError(state,
2490 0 : "Node Referenced =" + state.dataLoopNodes->NodeID(state.dataPlnt->PlantLoop(LoopNum).TempSetPointNodeNum));
2491 0 : ShowContinueError(state, "Use a SetpointManager:Scheduled:DualSetpoint to establish appropriate setpoints");
2492 0 : state.dataHVACGlobal->SetPointErrorFlag = true;
2493 : } else {
2494 0 : CheckIfNodeSetPointManagedByEMS(state,
2495 0 : state.dataPlnt->PlantLoop(LoopNum).TempSetPointNodeNum,
2496 : HVAC::CtrlVarType::Temp,
2497 0 : state.dataHVACGlobal->SetPointErrorFlag);
2498 0 : if (state.dataHVACGlobal->SetPointErrorFlag) {
2499 0 : ShowSevereError(state, "Plant Loop: missing high temperature setpoint for dual setpoint deadband demand scheme");
2500 0 : ShowContinueError(
2501 0 : state, "Node Referenced =" + state.dataLoopNodes->NodeID(state.dataPlnt->PlantLoop(LoopNum).TempSetPointNodeNum));
2502 0 : ShowContinueError(state, "Use a SetpointManager:Scheduled:DualSetpoint to establish appropriate setpoints");
2503 0 : ShowContinueError(state, "Or add EMS Actuator for Temperature Maximum Setpoint");
2504 :
2505 : } // SetPointErrorFlag
2506 : } // Not EMS
2507 : } // Node TSPhi = Sensed
2508 91 : if (state.dataLoopNodes->Node(state.dataPlnt->PlantLoop(LoopNum).TempSetPointNodeNum).TempSetPointLo == SensedNodeFlagValue) {
2509 0 : if (!state.dataGlobal->AnyEnergyManagementSystemInModel) {
2510 0 : ShowSevereError(state, "Plant Loop: missing low temperature setpoint for dual setpoint deadband demand scheme");
2511 0 : ShowContinueError(state,
2512 0 : "Node Referenced =" + state.dataLoopNodes->NodeID(state.dataPlnt->PlantLoop(LoopNum).TempSetPointNodeNum));
2513 0 : ShowContinueError(state, "Use a SetpointManager:Scheduled:DualSetpoint to establish appropriate setpoints");
2514 0 : state.dataHVACGlobal->SetPointErrorFlag = true;
2515 : } else {
2516 0 : CheckIfNodeSetPointManagedByEMS(state,
2517 0 : state.dataPlnt->PlantLoop(LoopNum).TempSetPointNodeNum,
2518 : HVAC::CtrlVarType::Temp,
2519 0 : state.dataHVACGlobal->SetPointErrorFlag);
2520 0 : if (state.dataHVACGlobal->SetPointErrorFlag) {
2521 0 : ShowSevereError(state, "Plant Loop: missing low temperature setpoint for dual setpoint deadband demand scheme");
2522 0 : ShowContinueError(
2523 0 : state, "Node Referenced =" + state.dataLoopNodes->NodeID(state.dataPlnt->PlantLoop(LoopNum).TempSetPointNodeNum));
2524 0 : ShowContinueError(state, "Use a SetpointManager:Scheduled:DualSetpoint to establish appropriate setpoints");
2525 0 : ShowContinueError(state, "Or add EMS Actuator for Temperature Minimum Setpoint");
2526 :
2527 : } // SetPointErrorFlag
2528 : } // NOT EMS
2529 : } // Node TSPtLo = Sensed...
2530 : } // LoopDemandScheme = DualSPDB
2531 : } // PLANT LOOP
2532 :
2533 : // Any per-environment load distribution init should be OK here
2534 : // Just clear away any trailing MyLoad for now...
2535 : // This could likely be moved into InitLoadDistribution also...
2536 9859 : for (int LoopNum = 1; LoopNum <= state.dataPlnt->TotNumLoops; ++LoopNum) {
2537 21330 : for (DataPlant::LoopSideLocation ResetLoopNum : DataPlant::LoopSideKeys) {
2538 102644 : for (BranchNum = 1; BranchNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(ResetLoopNum).TotalBranches; ++BranchNum) {
2539 177389 : for (CompNum = 1; CompNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(ResetLoopNum).Branch(BranchNum).TotalComponents;
2540 : ++CompNum) {
2541 88965 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(ResetLoopNum).Branch(BranchNum).Comp(CompNum).MyLoad = 0.0;
2542 88965 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(ResetLoopNum).Branch(BranchNum).Comp(CompNum).FreeCoolCntrlShutDown = false;
2543 88965 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(ResetLoopNum).Branch(BranchNum).Comp(CompNum).Available = false;
2544 : }
2545 : }
2546 : }
2547 : }
2548 :
2549 2749 : state.dataPlantMgr->SupplyEnvrnFlag = false;
2550 : //!*****************************************************************
2551 : // !END OF ONE TIME ENVIRONMENT INITS
2552 : //!*****************************************************************
2553 : } //
2554 2980977 : if (!state.dataGlobal->BeginEnvrnFlag) {
2555 2965089 : state.dataPlantMgr->SupplyEnvrnFlag = true;
2556 : }
2557 :
2558 2980977 : if (ErrorsFound) {
2559 0 : ShowFatalError(state, "Preceding errors caused termination");
2560 : }
2561 2980977 : }
2562 :
2563 2854666 : void ReInitPlantLoopsAtFirstHVACIteration(EnergyPlusData &state)
2564 : {
2565 :
2566 : // SUBROUTINE INFORMATION:
2567 : // AUTHOR Brent Griffith
2568 : // DATE WRITTEN Sept 2010
2569 : // MODIFIED na
2570 : // RE-ENGINEERED na
2571 :
2572 : // PURPOSE OF THIS SUBROUTINE:
2573 : // initialize node mass flow requests
2574 :
2575 : // METHODOLOGY EMPLOYED:
2576 : // called from SimHVAC to reset mass flow rate requests
2577 : // this contains all the initializations
2578 :
2579 : // SUBROUTINE PARAMETER DEFINITIONS:
2580 2854666 : Real64 constexpr StartQuality(1.0);
2581 2854666 : Real64 constexpr StartHumRat(0.0);
2582 : static constexpr std::string_view RoutineNameAlt("InitializeLoops");
2583 : static constexpr std::string_view RoutineName("PlantManager:InitializeLoop");
2584 :
2585 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
2586 : int LoopNum; // plant loop counter
2587 : Real64 LoopMaxMassFlowRate; // maximum allowable loop mass flow rate
2588 : Real64 LoopSetPointTemp; // the loop control or setpoint temperature
2589 : Real64 LoopMaxTemp; // maximum allowable loop temperature
2590 : Real64 LoopMinTemp; // minimum allowable loop temperature
2591 : Real64 LoopSetPointTempLo; // the loop control or setpoint temperature
2592 : Real64 LoopSetPointTempHi; // the loop control or setpoint temperature
2593 : Real64 SecondaryLoopSetPointTemp; // loop setpoint temperature for common pipes with different secondary setpt
2594 : int BranchNum; // branch loop counter
2595 : int OpNum; // operation scheme counter
2596 : int CompNum; // plant side component counter
2597 : int ComponentInlet; // component inlet node number
2598 : int ComponentOutlet; // component outlet node number
2599 :
2600 : Real64 LoopMinMassFlowRate; // minimum allowable loop mass flow rate
2601 : Real64 SteamDensity;
2602 : Real64 SteamTemp;
2603 : Real64 StartEnthalpy;
2604 : Real64 Cp;
2605 : Real64 rho;
2606 : Real64 LoopSetPointTemperatureHi;
2607 : Real64 LoopSetPointTemperatureLo;
2608 :
2609 : //*****************************************************************
2610 : // BEGIN ENVIRONMENT INITS
2611 : //*****************************************************************
2612 :
2613 2854666 : if (state.dataPlantMgr->MyEnvrnFlag && state.dataGlobal->BeginEnvrnFlag) {
2614 :
2615 11780 : for (LoopNum = 1; LoopNum <= state.dataPlnt->TotNumLoops; ++LoopNum) {
2616 21330 : for (DataPlant::LoopSideLocation LoopSideNum : DataPlant::LoopSideKeys) {
2617 14220 : switch (state.dataPlnt->PlantLoop(LoopNum).LoopDemandCalcScheme) {
2618 14038 : case DataPlant::LoopDemandCalcScheme::SingleSetPoint: {
2619 14038 : LoopSetPointTemp = state.dataLoopNodes->Node(state.dataPlnt->PlantLoop(LoopNum).TempSetPointNodeNum).TempSetPoint;
2620 14038 : } break;
2621 182 : case DataPlant::LoopDemandCalcScheme::DualSetPointDeadBand: {
2622 : // Get the range of setpoints
2623 182 : LoopSetPointTemperatureHi = state.dataLoopNodes->Node(state.dataPlnt->PlantLoop(LoopNum).TempSetPointNodeNum).TempSetPointHi;
2624 182 : LoopSetPointTemperatureLo = state.dataLoopNodes->Node(state.dataPlnt->PlantLoop(LoopNum).TempSetPointNodeNum).TempSetPointLo;
2625 182 : LoopSetPointTemp = (LoopSetPointTemperatureLo + LoopSetPointTemperatureHi) / 2.0;
2626 182 : } break;
2627 0 : default:
2628 0 : break;
2629 : }
2630 :
2631 14340 : if ((state.dataPlnt->PlantLoop(LoopNum).CommonPipeType == DataPlant::CommonPipeType::TwoWay) &&
2632 14340 : (LoopSideNum == LoopSideLocation::Demand) &&
2633 60 : (state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).InletNodeSetPt)) { // get a second setpoint for
2634 : // secondaryLoop
2635 : // if the plant loop is two common pipe configured for temperature control on secondary side inlet, then
2636 : // we want to initialize the demand side of the loop using that setpoint
2637 49 : LoopSetPointTemp =
2638 49 : state.dataLoopNodes->Node(state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).NodeNumIn).TempSetPoint;
2639 : }
2640 :
2641 : // Check the Loop Setpoint and make sure it is bounded by the Loop Max and Min
2642 14220 : LoopMaxTemp = state.dataPlnt->PlantLoop(LoopNum).MaxTemp;
2643 14220 : LoopMinTemp = state.dataPlnt->PlantLoop(LoopNum).MinTemp;
2644 :
2645 : // trap for -999 and set to average of limits if so
2646 14220 : if (LoopSetPointTemp == SensedNodeFlagValue) {
2647 64 : LoopSetPointTemp = (LoopMinTemp + LoopMaxTemp) / 2.0;
2648 : }
2649 : // Check it against the loop temperature limits
2650 14220 : LoopSetPointTemp = min(LoopMaxTemp, LoopSetPointTemp);
2651 14220 : LoopSetPointTemp = max(LoopMinTemp, LoopSetPointTemp);
2652 :
2653 : // Initialize the capacitance model at the tank interface, and other loop side values
2654 14220 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).TempInterfaceTankOutlet = LoopSetPointTemp;
2655 14220 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).LastTempInterfaceTankOutlet = LoopSetPointTemp;
2656 14220 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).LoopSideInlet_TankTemp = LoopSetPointTemp;
2657 14220 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).TotalPumpHeat = 0.0;
2658 14220 : if (allocated(state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Pumps)) {
2659 14425 : for (auto &e : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Pumps) {
2660 7237 : e.PumpHeatToFluid = 0.0;
2661 : }
2662 : }
2663 14220 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).FlowRequest = 0.0;
2664 14220 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).TimeElapsed = 0.0;
2665 14220 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).FlowLock = DataPlant::FlowLock::Unlocked;
2666 14220 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).InletNode.TemperatureHistory = 0.0;
2667 14220 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).InletNode.MassFlowRateHistory = 0.0;
2668 14220 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).OutletNode.TemperatureHistory = 0.0;
2669 14220 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).OutletNode.MassFlowRateHistory = 0.0;
2670 :
2671 14220 : if (state.dataPlnt->PlantLoop(LoopNum).FluidType != DataLoopNode::NodeFluidType::Steam) {
2672 14114 : Cp = state.dataPlnt->PlantLoop(LoopNum).glycol->getSpecificHeat(state, LoopSetPointTemp, RoutineNameAlt);
2673 14114 : StartEnthalpy = Cp * LoopSetPointTemp;
2674 : }
2675 : // Use Min/Max flow rates to initialize loop
2676 14220 : if (state.dataPlnt->PlantLoop(LoopNum).FluidType == DataLoopNode::NodeFluidType::Water) {
2677 14114 : rho = state.dataPlnt->PlantLoop(LoopNum).glycol->getDensity(state, LoopSetPointTemp, RoutineNameAlt);
2678 :
2679 14114 : LoopMaxMassFlowRate = state.dataPlnt->PlantLoop(LoopNum).MaxVolFlowRate * rho;
2680 14114 : LoopMinMassFlowRate = state.dataPlnt->PlantLoop(LoopNum).MinVolFlowRate * rho;
2681 : }
2682 : // use saturated liquid of steam at the loop setpoint temp as the starting enthalpy for a water loop
2683 14220 : if (state.dataPlnt->PlantLoop(LoopNum).FluidType == DataLoopNode::NodeFluidType::Steam) {
2684 106 : SteamTemp = 100.0;
2685 106 : auto *steam = Fluid::GetSteam(state);
2686 106 : state.dataPlnt->PlantLoop(LoopNum).FluidIndex = steam->Num;
2687 :
2688 106 : SteamDensity = steam->getSatDensity(state, SteamTemp, 1.0, RoutineName);
2689 106 : LoopMaxMassFlowRate = state.dataPlnt->PlantLoop(LoopNum).MaxVolFlowRate * SteamDensity;
2690 106 : StartEnthalpy = steam->getSatEnthalpy(state, LoopSetPointTemp, 0.0, RoutineName);
2691 106 : LoopMinMassFlowRate = state.dataPlnt->PlantLoop(LoopNum).MinVolFlowRate * SteamDensity;
2692 : }
2693 :
2694 14220 : LoopMaxMassFlowRate = max(0.0, LoopMaxMassFlowRate);
2695 14220 : LoopMinMassFlowRate = max(0.0, LoopMinMassFlowRate);
2696 :
2697 : // Initial all loop nodes by initializing all component inlet and outlet nodes
2698 102644 : for (BranchNum = 1; BranchNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).TotalBranches; ++BranchNum) {
2699 177389 : for (CompNum = 1; CompNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).TotalComponents;
2700 : ++CompNum) {
2701 88965 : ComponentInlet = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp(CompNum).NodeNumIn;
2702 88965 : ComponentOutlet = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp(CompNum).NodeNumOut;
2703 88965 : int BranchInlet = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).NodeNumIn;
2704 :
2705 88965 : state.dataLoopNodes->Node(ComponentInlet).Temp = LoopSetPointTemp;
2706 88965 : state.dataLoopNodes->Node(ComponentInlet).TempMin = LoopMinTemp;
2707 88965 : state.dataLoopNodes->Node(ComponentInlet).TempMax = LoopMaxTemp;
2708 88965 : state.dataLoopNodes->Node(ComponentInlet).TempLastTimestep = LoopSetPointTemp;
2709 :
2710 88965 : state.dataLoopNodes->Node(ComponentInlet).MassFlowRate = 0.0;
2711 88965 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp(CompNum).MyLoad = 0.0;
2712 88965 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp(CompNum).Available = false;
2713 88965 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp(CompNum).FreeCoolCntrlShutDown = false;
2714 88965 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).RequestedMassFlow = 0.0;
2715 :
2716 88965 : if (state.dataLoopNodes->Node(ComponentInlet).MassFlowRateMin > 0.0) {
2717 0 : state.dataLoopNodes->Node(ComponentInlet).MassFlowRateMinAvail =
2718 0 : state.dataLoopNodes->Node(ComponentInlet).MassFlowRateMin;
2719 : } else {
2720 88965 : state.dataLoopNodes->Node(ComponentInlet).MassFlowRateMin = LoopMinMassFlowRate;
2721 88965 : state.dataLoopNodes->Node(ComponentInlet).MassFlowRateMinAvail = LoopMinMassFlowRate;
2722 : }
2723 :
2724 88965 : if (state.dataLoopNodes->Node(ComponentInlet).MassFlowRateMax > 0.0) {
2725 40785 : state.dataLoopNodes->Node(ComponentInlet).MassFlowRateMaxAvail =
2726 40785 : state.dataLoopNodes->Node(ComponentInlet).MassFlowRateMax;
2727 : } else {
2728 48180 : state.dataLoopNodes->Node(ComponentInlet).MassFlowRateMax = LoopMaxMassFlowRate;
2729 48180 : state.dataLoopNodes->Node(ComponentInlet).MassFlowRateMaxAvail = LoopMaxMassFlowRate;
2730 : }
2731 :
2732 88965 : state.dataLoopNodes->Node(ComponentInlet).MassFlowRateRequest = 0.0;
2733 88965 : state.dataLoopNodes->Node(ComponentInlet).Quality = StartQuality;
2734 88965 : state.dataLoopNodes->Node(ComponentInlet).Press = state.dataEnvrn->StdBaroPress;
2735 88965 : state.dataLoopNodes->Node(ComponentInlet).Enthalpy = StartEnthalpy;
2736 88965 : state.dataLoopNodes->Node(ComponentInlet).HumRat = StartHumRat;
2737 :
2738 88965 : state.dataLoopNodes->Node(ComponentOutlet).FluidType = state.dataLoopNodes->Node(BranchInlet).FluidType;
2739 88965 : state.dataLoopNodes->Node(ComponentOutlet).Temp = state.dataLoopNodes->Node(BranchInlet).Temp;
2740 88965 : state.dataLoopNodes->Node(ComponentOutlet).TempMin = state.dataLoopNodes->Node(BranchInlet).TempMin;
2741 88965 : state.dataLoopNodes->Node(ComponentOutlet).TempMax = state.dataLoopNodes->Node(BranchInlet).TempMax;
2742 88965 : state.dataLoopNodes->Node(ComponentOutlet).TempLastTimestep = state.dataLoopNodes->Node(BranchInlet).TempLastTimestep;
2743 88965 : state.dataLoopNodes->Node(ComponentOutlet).MassFlowRate = state.dataLoopNodes->Node(BranchInlet).MassFlowRate;
2744 88965 : state.dataLoopNodes->Node(ComponentOutlet).MassFlowRateMin = state.dataLoopNodes->Node(BranchInlet).MassFlowRateMin;
2745 88965 : state.dataLoopNodes->Node(ComponentOutlet).MassFlowRateMax = state.dataLoopNodes->Node(BranchInlet).MassFlowRateMax;
2746 88965 : state.dataLoopNodes->Node(ComponentOutlet).MassFlowRateMinAvail = state.dataLoopNodes->Node(BranchInlet).MassFlowRateMinAvail;
2747 88965 : state.dataLoopNodes->Node(ComponentOutlet).MassFlowRateMaxAvail = state.dataLoopNodes->Node(BranchInlet).MassFlowRateMaxAvail;
2748 88965 : state.dataLoopNodes->Node(ComponentOutlet).MassFlowRateRequest = 0.0;
2749 88965 : state.dataLoopNodes->Node(ComponentOutlet).Quality = StartQuality;
2750 88965 : state.dataLoopNodes->Node(ComponentOutlet).Press = state.dataEnvrn->StdBaroPress;
2751 88965 : state.dataLoopNodes->Node(ComponentOutlet).Enthalpy = StartEnthalpy;
2752 88965 : state.dataLoopNodes->Node(ComponentOutlet).HumRat = StartHumRat;
2753 : } // COMPONENT LOOP
2754 : } // BRANCH LOOP
2755 : } // LOOPSIDE
2756 : } // PLANT LOOP
2757 11780 : for (auto &loop : state.dataPlnt->PlantLoop) {
2758 7110 : loop.CoolingDemand = 0.0;
2759 7110 : loop.HeatingDemand = 0.0;
2760 7110 : loop.DemandNotDispatched = 0.0;
2761 7110 : loop.UnmetDemand = 0.0;
2762 7110 : loop.LastLoopSideSimulated = static_cast<int>(DataPlant::LoopSideLocation::Invalid);
2763 7110 : loop.InletNodeFlowrate = 0.0;
2764 7110 : loop.InletNodeTemperature = 0.0;
2765 7110 : loop.OutletNodeFlowrate = 0.0;
2766 7110 : loop.OutletNodeTemperature = 0.0;
2767 : }
2768 :
2769 4670 : state.dataPlantMgr->MyEnvrnFlag = false;
2770 : //*****************************************************************
2771 : // END OF ENVIRONMENT INITS
2772 : //*****************************************************************
2773 : }
2774 :
2775 2854666 : if (!state.dataGlobal->BeginEnvrnFlag) {
2776 2843779 : state.dataPlantMgr->MyEnvrnFlag = true;
2777 : }
2778 :
2779 : // FirstHVACiteration inits
2780 6623321 : for (LoopNum = 1; LoopNum <= state.dataPlnt->TotNumLoops; ++LoopNum) {
2781 3768655 : LoopSetPointTemp = state.dataLoopNodes->Node(state.dataPlnt->PlantLoop(LoopNum).TempSetPointNodeNum).TempSetPoint;
2782 :
2783 : // Check the Loop Setpoint and make sure it is bounded by the Loop Max and Min
2784 3768655 : LoopMaxTemp = state.dataPlnt->PlantLoop(LoopNum).MaxTemp;
2785 3768655 : LoopMinTemp = state.dataPlnt->PlantLoop(LoopNum).MinTemp;
2786 : // Check it against the loop temperature limits
2787 3768655 : LoopSetPointTemp = min(LoopMaxTemp, LoopSetPointTemp);
2788 3768655 : LoopSetPointTemp = max(LoopMinTemp, LoopSetPointTemp);
2789 :
2790 : // Update supply side loop setpoint in plant data structure
2791 3768655 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).TempSetPoint = LoopSetPointTemp;
2792 3768655 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).TempSetPoint = LoopSetPointTemp;
2793 :
2794 : // Update supply side hi-lo setpoints for dual SP control
2795 3768655 : if (state.dataPlnt->PlantLoop(LoopNum).LoopDemandCalcScheme == DataPlant::LoopDemandCalcScheme::DualSetPointDeadBand) {
2796 22165 : LoopSetPointTempHi = state.dataLoopNodes->Node(state.dataPlnt->PlantLoop(LoopNum).TempSetPointNodeNum).TempSetPointHi;
2797 22165 : LoopSetPointTempLo = state.dataLoopNodes->Node(state.dataPlnt->PlantLoop(LoopNum).TempSetPointNodeNum).TempSetPointLo;
2798 22165 : LoopSetPointTempHi = min(LoopMaxTemp, LoopSetPointTempHi);
2799 22165 : LoopSetPointTempHi = max(LoopMinTemp, LoopSetPointTempHi);
2800 22165 : LoopSetPointTempLo = min(LoopMaxTemp, LoopSetPointTempLo);
2801 22165 : LoopSetPointTempLo = max(LoopMinTemp, LoopSetPointTempLo);
2802 22165 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).TempSetPointHi = LoopSetPointTempHi;
2803 22165 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).TempSetPointLo = LoopSetPointTempLo;
2804 : }
2805 :
2806 : // update demand side loop setpoint in plant data structure
2807 3768655 : if (state.dataPlnt->PlantLoop(LoopNum).CommonPipeType == DataPlant::CommonPipeType::TwoWay) { // get a second setpoint for secondaryLoop
2808 : // if the plant loop is two common pipe configured for temperature control on secondary side inlet, then
2809 : // we want to initialize the demand side of the loop using that setpoint
2810 14399 : if (state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).InletNodeSetPt) {
2811 12120 : SecondaryLoopSetPointTemp =
2812 12120 : state.dataLoopNodes->Node(state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).NodeNumIn).TempSetPoint;
2813 12120 : SecondaryLoopSetPointTemp = min(LoopMaxTemp, SecondaryLoopSetPointTemp);
2814 12120 : SecondaryLoopSetPointTemp = max(LoopMinTemp, SecondaryLoopSetPointTemp);
2815 12120 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).TempSetPoint = SecondaryLoopSetPointTemp;
2816 : // Since Dual setpoint not explicitly available for demand side, we can't do the
2817 : // bounding check on hi/lo setpoint. IF we did we would over-write
2818 : // the SensedNodeFlagValue of -999 for no dual setpoint case.
2819 12120 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).TempSetPointHi =
2820 12120 : state.dataLoopNodes->Node(state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).NodeNumIn).TempSetPointHi;
2821 12120 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).TempSetPointLo =
2822 12120 : state.dataLoopNodes->Node(state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).NodeNumIn).TempSetPointLo;
2823 : }
2824 :
2825 : // initialize common pipe flows to zero.
2826 14399 : if (allocated(state.dataHVACInterfaceMgr->PlantCommonPipe)) {
2827 14389 : state.dataHVACInterfaceMgr->PlantCommonPipe(LoopNum).PriToSecFlow = 0.0;
2828 14389 : state.dataHVACInterfaceMgr->PlantCommonPipe(LoopNum).SecToPriFlow = 0.0;
2829 14389 : state.dataHVACInterfaceMgr->PlantCommonPipe(LoopNum).PriCPLegFlow = 0.0;
2830 14389 : state.dataHVACInterfaceMgr->PlantCommonPipe(LoopNum).SecCPLegFlow = 0.0;
2831 : }
2832 : } else { // no secondary loop, so use supply side loop SP on demand side too.
2833 3754256 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).TempSetPoint = LoopSetPointTemp;
2834 3754256 : if (state.dataPlnt->PlantLoop(LoopNum).LoopDemandCalcScheme == DataPlant::LoopDemandCalcScheme::DualSetPointDeadBand) {
2835 22165 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).TempSetPointHi = LoopSetPointTempHi;
2836 22165 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).TempSetPointLo = LoopSetPointTempLo;
2837 : }
2838 : }
2839 :
2840 11305965 : for (DataPlant::LoopSideLocation LoopSideNum : DataPlant::LoopSideKeys) {
2841 57026754 : for (BranchNum = 1; BranchNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).TotalBranches; ++BranchNum) {
2842 99188255 : for (CompNum = 1; CompNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).TotalComponents; ++CompNum) {
2843 49698811 : ComponentInlet = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp(CompNum).NodeNumIn;
2844 49698811 : ComponentOutlet = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp(CompNum).NodeNumOut;
2845 :
2846 : // reinit to node hardware limits
2847 49698811 : state.dataLoopNodes->Node(ComponentInlet).MassFlowRateMinAvail = state.dataLoopNodes->Node(ComponentInlet).MassFlowRateMin;
2848 49698811 : state.dataLoopNodes->Node(ComponentOutlet).MassFlowRateMinAvail = state.dataLoopNodes->Node(ComponentInlet).MassFlowRateMin;
2849 49698811 : state.dataLoopNodes->Node(ComponentInlet).MassFlowRateMaxAvail = state.dataLoopNodes->Node(ComponentInlet).MassFlowRateMax;
2850 49698811 : state.dataLoopNodes->Node(ComponentOutlet).MassFlowRateMaxAvail = state.dataLoopNodes->Node(ComponentInlet).MassFlowRateMax;
2851 :
2852 49698811 : state.dataLoopNodes->Node(ComponentInlet).MassFlowRateRequest = 0.0;
2853 49698811 : state.dataLoopNodes->Node(ComponentOutlet).MassFlowRateRequest = 0.0;
2854 : }
2855 : }
2856 : }
2857 :
2858 7911558 : for (OpNum = 1; OpNum <= state.dataPlnt->PlantLoop(LoopNum).NumOpSchemes; ++OpNum) {
2859 : // If the operating scheme is scheduled "OFF", go to next scheme
2860 4142903 : state.dataPlnt->PlantLoop(LoopNum).OpScheme(OpNum).Available =
2861 4142903 : state.dataPlnt->PlantLoop(LoopNum).OpScheme(OpNum).sched->getCurrentVal() > 0.0;
2862 : }
2863 : }
2864 2854666 : }
2865 :
2866 3588830 : void UpdateNodeThermalHistory(EnergyPlusData const &state)
2867 : {
2868 :
2869 : // SUBROUTINE INFORMATION:
2870 : // AUTHOR Brent Griffith
2871 : // DATE WRITTEN Sept 2010
2872 :
2873 : // PURPOSE OF THIS SUBROUTINE:
2874 : // update temperature history for plant capacitance model and other
2875 :
2876 : // METHODOLOGY EMPLOYED:
2877 : // copy current values into "LastTimestep" values
2878 :
2879 : // array assignment
2880 3588830 : if (state.dataLoopNodes->NumOfNodes > 0) {
2881 319333434 : for (auto &e : state.dataLoopNodes->Node) { // MA
2882 316061429 : e.TempLastTimestep = e.Temp;
2883 316061429 : e.EnthalpyLastTimestep = e.Enthalpy;
2884 : }
2885 : }
2886 3588830 : if (state.dataPlnt->TotNumLoops > 0 && !state.dataGlobal->WarmupFlag) {
2887 1294071 : for (auto &loop : state.dataPlnt->PlantLoop) {
2888 2737851 : for (auto &side : loop.LoopSide) {
2889 1825234 : if (loop.OutletNodeFlowrate > HVAC::SmallMassFlow) {
2890 : // Accumulate total time loop is active
2891 617464 : side.LoopSideInlet_TotalTime += state.dataHVACGlobal->TimeStepSys;
2892 : // Determine excessive storage - if both are moving in the same direction and McpDTdt is larger than MdotCpDeltaT
2893 1005582 : if ((std::abs(side.LoopSideInlet_MdotCpDeltaT) > HVAC::SmallLoad) &&
2894 388118 : ((side.LoopSideInlet_McpDTdt / side.LoopSideInlet_MdotCpDeltaT) > 1.1)) {
2895 21078 : side.LoopSideInlet_CapExcessStorageTimeReport = state.dataHVACGlobal->TimeStepSys;
2896 21078 : side.LoopSideInlet_CapExcessStorageTime += state.dataHVACGlobal->TimeStepSys;
2897 : } else {
2898 596386 : side.LoopSideInlet_CapExcessStorageTimeReport = 0;
2899 : }
2900 : } else {
2901 1207770 : side.LoopSideInlet_CapExcessStorageTimeReport = 0;
2902 : }
2903 : }
2904 : }
2905 : }
2906 3588830 : }
2907 :
2908 2 : void CheckPlantOnAbort(EnergyPlusData &state)
2909 : {
2910 :
2911 : // SUBROUTINE INFORMATION:
2912 : // AUTHOR Brent Griffith
2913 : // DATE WRITTEN September 2006
2914 : // MODIFIED na
2915 : // RE-ENGINEERED na
2916 :
2917 : // PURPOSE OF THIS SUBROUTINE:
2918 : // Called once E+ is in the process of aborting because of fatal error
2919 : // check for plant input problems to help users find problems in input files
2920 :
2921 : // METHODOLOGY EMPLOYED:
2922 : // search plant data structures for issues that may help solve problems in input files
2923 : // 1. if loop side has a splitter/mixer and one branch in there is control type bypass,
2924 : // then another branch in the s/m needs to be active
2925 : // other checks could/should be added!
2926 :
2927 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
2928 : int LoopNum; // DO loop counter for loops
2929 : bool ActiveCntrlfound; // used to search for active control branches in parallel with bypass branches
2930 : int ParalBranchNum; // used to search for active control branches in parallel with bypass branches
2931 : int ParalBranchNum2; // used to search for active control branches in parallel with bypass branches
2932 : int BranchNum2; // used to search for active control branches in parallel with bypass branches
2933 : int BranchNum; // DO loop counter for branches
2934 : int CompNum; // do loop for multiple components on a branch
2935 : bool ShouldBeACTIVE;
2936 :
2937 2 : if (!(state.dataErrTracking->AskForPlantCheckOnAbort)) {
2938 1 : return;
2939 : }
2940 :
2941 1 : if (state.dataPlnt->TotNumLoops <= 0) {
2942 0 : return;
2943 : }
2944 1 : if (!(allocated(state.dataPlnt->PlantLoop))) {
2945 0 : return;
2946 : }
2947 :
2948 2 : for (LoopNum = 1; LoopNum <= state.dataPlnt->TotNumLoops; ++LoopNum) {
2949 3 : for (DataPlant::LoopSideLocation SideNum : DataPlant::LoopSideKeys) {
2950 2 : if (!(state.dataPlnt->PlantLoop(LoopNum).LoopSide(SideNum).Splitter.Exists)) {
2951 0 : continue;
2952 : }
2953 :
2954 6 : for (ParalBranchNum = 1; ParalBranchNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(SideNum).Splitter.TotalOutletNodes;
2955 : ++ParalBranchNum) {
2956 4 : BranchNum = state.dataPlnt->PlantLoop(LoopNum).LoopSide(SideNum).Splitter.BranchNumOut(ParalBranchNum);
2957 4 : if (state.dataPlnt->PlantLoop(LoopNum).LoopSide(SideNum).Branch(BranchNum).IsBypass) { // we know there is a bypass
2958 : // check that there is at least one 'Active' control type in parallel with bypass branch
2959 2 : ActiveCntrlfound = false;
2960 6 : for (ParalBranchNum2 = 1; ParalBranchNum2 <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(SideNum).Splitter.TotalOutletNodes;
2961 : ++ParalBranchNum2) {
2962 4 : BranchNum2 = state.dataPlnt->PlantLoop(LoopNum).LoopSide(SideNum).Splitter.BranchNumOut(ParalBranchNum2);
2963 4 : if (state.dataPlnt->PlantLoop(LoopNum).LoopSide(SideNum).Branch(BranchNum2).controlType ==
2964 : DataBranchAirLoopPlant::ControlType::Active) {
2965 2 : ActiveCntrlfound = true;
2966 : }
2967 : }
2968 2 : if (!(ActiveCntrlfound)) {
2969 0 : ShowWarningError(state,
2970 0 : "Check control types on branches between splitter and mixer in PlantLoop=" +
2971 0 : state.dataPlnt->PlantLoop(LoopNum).Name);
2972 0 : ShowContinueError(state, "Found a BYPASS branch with no ACTIVE branch in parallel with it");
2973 0 : ShowContinueError(state, "In certain (but not all) situations, this can cause problems; please verify your inputs");
2974 0 : ShowContinueError(state,
2975 0 : "Bypass branch named: " + state.dataPlnt->PlantLoop(LoopNum).LoopSide(SideNum).Branch(BranchNum).Name);
2976 : }
2977 : } // bypass present
2978 :
2979 : // check for possible components on demand side that should be ACTIVE but are not
2980 4 : if (SideNum == LoopSideLocation::Demand) {
2981 : // check for presences of the following components whose branch control type should be active
2982 : // WATER HEATER:MIXED
2983 : // WATER HEATER:STRATIFIED
2984 : // WATER USE CONNECTIONS
2985 : // COIL:WATER:COOLING
2986 : // COIL:WATER:SIMPLEHEATING
2987 : // COIL:STEAM:AIRHEATING
2988 : // SOLAR COLLECTOR:FLAT PLATE
2989 : // PLANT LOAD PROFILE
2990 4 : for (CompNum = 1; CompNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(SideNum).Branch(BranchNum).TotalComponents; ++CompNum) {
2991 2 : ShouldBeACTIVE = false;
2992 2 : switch (state.dataPlnt->PlantLoop(LoopNum).LoopSide(SideNum).Branch(BranchNum).Comp(CompNum).Type) {
2993 1 : case DataPlant::PlantEquipmentType::WtrHeaterMixed:
2994 : case DataPlant::PlantEquipmentType::WtrHeaterStratified:
2995 : case DataPlant::PlantEquipmentType::WaterUseConnection:
2996 : case DataPlant::PlantEquipmentType::CoilWaterCooling:
2997 : case DataPlant::PlantEquipmentType::CoilWaterDetailedFlatCooling:
2998 : case DataPlant::PlantEquipmentType::CoilWaterSimpleHeating:
2999 : case DataPlant::PlantEquipmentType::CoilSteamAirHeating:
3000 : case DataPlant::PlantEquipmentType::SolarCollectorFlatPlate:
3001 : case DataPlant::PlantEquipmentType::PlantLoadProfile: {
3002 1 : ShouldBeACTIVE = true;
3003 1 : } break;
3004 1 : default: {
3005 : // not a demand side component that we know needs to be active, do nothing
3006 1 : } break;
3007 : }
3008 :
3009 2 : if (ShouldBeACTIVE) {
3010 1 : switch (state.dataPlnt->PlantLoop(LoopNum).LoopSide(SideNum).Branch(BranchNum).controlType) {
3011 0 : case DataBranchAirLoopPlant::ControlType::Invalid: {
3012 0 : ShowWarningError(state,
3013 0 : "Found potential problem with Control Type for Branch named: " +
3014 0 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(SideNum).Branch(BranchNum).Name);
3015 0 : ShowContinueError(state, "This branch should (probably) be ACTIVE but has control type unknown");
3016 0 : } break;
3017 1 : case DataBranchAirLoopPlant::ControlType::Active: {
3018 : // do nothing, this is correct control type.
3019 1 : } break;
3020 0 : case DataBranchAirLoopPlant::ControlType::Passive: {
3021 0 : ShowWarningError(state,
3022 0 : "Found potential problem with Control Type for Branch named: " +
3023 0 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(SideNum).Branch(BranchNum).Name);
3024 0 : ShowContinueError(state, "This branch should (probably) be ACTIVE but has control type PASSIVE");
3025 0 : } break;
3026 0 : case DataBranchAirLoopPlant::ControlType::SeriesActive: {
3027 : // do nothing, should be okay. (? don't really understand SeriesActive though)
3028 0 : } break;
3029 0 : case DataBranchAirLoopPlant::ControlType::Bypass: {
3030 0 : ShowWarningError(state,
3031 0 : "Found potential problem with Control Type for Branch named: " +
3032 0 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(SideNum).Branch(BranchNum).Name);
3033 0 : ShowContinueError(state, "This branch should (probably) be ACTIVE but has control type Bypass");
3034 0 : } break;
3035 0 : default:
3036 0 : break;
3037 : }
3038 : } // should be active
3039 : } // comp num loop
3040 : } // demand side
3041 :
3042 : } // splitter outlet nodes
3043 :
3044 : // check to see if bypass exists in demand side. If not warn error of possible flow problems
3045 2 : if (!state.dataPlnt->PlantLoop(LoopNum).LoopSide(SideNum).BypassExists) {
3046 0 : if (SideNum == LoopSideLocation::Demand) {
3047 0 : ShowWarningError(state,
3048 0 : "There is no BYPASS component in the demand-side of PlantLoop =" + state.dataPlnt->PlantLoop(LoopNum).Name);
3049 0 : ShowContinueError(state, "You may be able to fix the fatal error above by adding a demand-side BYPASS PIPE.");
3050 : }
3051 : }
3052 : } // loop sides
3053 : } // plant loops
3054 : }
3055 :
3056 1158 : void InitOneTimePlantSizingInfo(EnergyPlusData &state, int const LoopNum) // loop being initialized for sizing
3057 : {
3058 :
3059 : // SUBROUTINE INFORMATION:
3060 : // AUTHOR Brent Griffith
3061 : // DATE WRITTEN April 2011
3062 : // MODIFIED na
3063 : // RE-ENGINEERED na
3064 :
3065 : // PURPOSE OF THIS SUBROUTINE:
3066 : // one time init what can be set up related to plant sizing data structure.
3067 :
3068 : // Using/Aliasing
3069 : using DataSizing::PlantSizingData;
3070 :
3071 1158 : if (state.dataPlnt->PlantLoop(LoopNum).PlantSizNum == 0) {
3072 1158 : if (state.dataSize->NumPltSizInput > 0) {
3073 : int PlantSizNum =
3074 826 : Util::FindItemInList(state.dataPlnt->PlantLoop(LoopNum).Name, state.dataSize->PlantSizData, &PlantSizingData::PlantLoopName);
3075 826 : if (PlantSizNum > 0) {
3076 799 : state.dataPlnt->PlantLoop(LoopNum).PlantSizNum = PlantSizNum;
3077 : }
3078 : }
3079 : }
3080 1158 : }
3081 :
3082 5785 : void SizePlantLoop(EnergyPlusData &state,
3083 : int const LoopNum, // Supply side loop being simulated
3084 : bool const OkayToFinish)
3085 : {
3086 :
3087 : // SUBROUTINE INFORMATION:
3088 : // AUTHOR Fred Buhl
3089 : // DATE WRITTEN December 2001
3090 : // MODIFIED na
3091 : // RE-ENGINEERED na
3092 :
3093 : // PURPOSE OF THIS SUBROUTINE:
3094 : // This subroutine is for sizing the supply side of Plant Loops for which loop flow rates
3095 : // have not been specified in the input.
3096 :
3097 : // METHODOLOGY EMPLOYED:
3098 : // Obtains volumetric flow rate data from the PlantSizData array..
3099 :
3100 : // Using/Aliasing
3101 : using namespace DataSizing;
3102 :
3103 : // SUBROUTINE PARAMETER DEFINITIONS:
3104 : static constexpr std::string_view RoutineName("SizePlantLoop");
3105 :
3106 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
3107 5785 : int PlantSizNum(0); // index of Plant Sizing data for this loop
3108 5785 : bool ErrorsFound(false); // If errors detected in input
3109 5785 : Real64 LoopSizFac(0.0);
3110 : Real64 AvLoopSizFac;
3111 5785 : Real64 PlantSizFac(1.0);
3112 5785 : Real64 MaxSizFac(0.0);
3113 : Real64 BranchSizFac;
3114 5785 : Real64 NumBrSizFac(0.0);
3115 5785 : Real64 FluidDensity(0.0); // local value from glycol routine
3116 5785 : bool Finalize(OkayToFinish);
3117 :
3118 5785 : if (state.dataPlnt->PlantLoop(LoopNum).PlantSizNum > 0) {
3119 3990 : PlantSizNum = state.dataPlnt->PlantLoop(LoopNum).PlantSizNum;
3120 : // PlantSizData(PlantSizNum)%DesVolFlowRate = 0.0D0 ! DSU2
3121 : } else {
3122 1795 : if (state.dataSize->NumPltSizInput > 0) {
3123 : PlantSizNum =
3124 135 : Util::FindItemInList(state.dataPlnt->PlantLoop(LoopNum).Name, state.dataSize->PlantSizData, &PlantSizingData::PlantLoopName);
3125 : }
3126 : }
3127 5785 : state.dataPlnt->PlantLoop(LoopNum).PlantSizNum = PlantSizNum;
3128 : // calculate a loop sizing factor and a branch sizing factor. Note that components without a sizing factor
3129 : // are assigned sizing factors of zero in this calculation
3130 5785 : if (PlantSizNum > 0) {
3131 3990 : if (state.dataPlantMgr->GetCompSizFac) {
3132 4043 : for (int BranchNum = 1; BranchNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).TotalBranches; ++BranchNum) {
3133 3245 : BranchSizFac = 0.0;
3134 3245 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).Branch(BranchNum).PumpSizFac = 1.0;
3135 3245 : if (state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).NodeNumIn ==
3136 3245 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).Branch(BranchNum).NodeNumIn) {
3137 798 : continue;
3138 : }
3139 2447 : if (state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).NodeNumOut ==
3140 2447 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).Branch(BranchNum).NodeNumOut) {
3141 796 : continue;
3142 : }
3143 3324 : for (int CompNum = 1;
3144 3324 : CompNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).Branch(BranchNum).TotalComponents;
3145 : ++CompNum) {
3146 1673 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).Branch(BranchNum).Comp(CompNum).simulate(state, true);
3147 1673 : BranchSizFac = max(BranchSizFac,
3148 1673 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).Branch(BranchNum).Comp(CompNum).SizFac);
3149 : }
3150 1651 : LoopSizFac += BranchSizFac;
3151 1651 : MaxSizFac = max(MaxSizFac, BranchSizFac);
3152 1651 : if (BranchSizFac > 0.0) {
3153 627 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).Branch(BranchNum).PumpSizFac = BranchSizFac;
3154 627 : ++NumBrSizFac;
3155 : }
3156 : }
3157 798 : AvLoopSizFac = LoopSizFac / max(1.0, NumBrSizFac);
3158 :
3159 798 : if (AvLoopSizFac > 0.0 && AvLoopSizFac < 1.0) {
3160 23 : PlantSizFac = LoopSizFac;
3161 775 : } else if (AvLoopSizFac > 1.0) {
3162 9 : PlantSizFac = MaxSizFac;
3163 : } else {
3164 766 : PlantSizFac = 1.0;
3165 : }
3166 : // store the sizing factor now, for later reuse,
3167 798 : state.dataSize->PlantSizData(PlantSizNum).PlantSizFac = PlantSizFac;
3168 : // might deprecate this next bit in favor of simpler storage in PlantSizData structure
3169 4043 : for (int BranchNum = 1; BranchNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).TotalBranches; ++BranchNum) {
3170 3245 : if (state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).NodeNumIn ==
3171 3245 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).Branch(BranchNum).NodeNumIn) {
3172 798 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).Branch(BranchNum).PumpSizFac = PlantSizFac;
3173 : }
3174 3245 : if (state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).NodeNumOut ==
3175 3245 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).Branch(BranchNum).NodeNumOut) {
3176 798 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).Branch(BranchNum).PumpSizFac = PlantSizFac;
3177 : }
3178 : }
3179 : }
3180 :
3181 : // sum up contributions from CompDesWaterFlow, demand side size request (non-coincident)
3182 3990 : state.dataSize->PlantSizData(PlantSizNum).DesVolFlowRate = 0.0; // init for summation
3183 40820 : for (int BranchNum = 1; BranchNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).TotalBranches; ++BranchNum) {
3184 73690 : for (int CompNum = 1; CompNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).Branch(BranchNum).TotalComponents;
3185 : ++CompNum) {
3186 36860 : int SupNodeNum = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).Branch(BranchNum).Comp(CompNum).NodeNumIn;
3187 3045030 : for (int WaterCompNum = 1; WaterCompNum <= state.dataSize->SaveNumPlantComps; ++WaterCompNum) {
3188 3008170 : if (SupNodeNum == state.dataSize->CompDesWaterFlow(WaterCompNum).SupNode) {
3189 24835 : state.dataSize->PlantSizData(PlantSizNum).DesVolFlowRate += state.dataSize->CompDesWaterFlow(WaterCompNum).DesVolFlowRate;
3190 : }
3191 : }
3192 : }
3193 : }
3194 :
3195 3990 : if (!state.dataPlnt->PlantLoop(LoopNum).MaxVolFlowRateWasAutoSized && (state.dataPlnt->PlantLoop(LoopNum).MaxVolFlowRate > 0.0)) {
3196 : // if the user puts in a large throwaway value for hard max plant loop size, they may not want this affecting anything else.
3197 : // but if they put in a smaller value, then it should cap the design size, so use hard value if it is smaller than non-coincident
3198 : // result
3199 365 : state.dataSize->PlantSizData(PlantSizNum).DesVolFlowRate =
3200 365 : std::min(state.dataSize->PlantSizData(PlantSizNum).DesVolFlowRate, state.dataPlnt->PlantLoop(LoopNum).MaxVolFlowRate);
3201 : }
3202 : }
3203 :
3204 5785 : if (state.dataPlnt->PlantLoop(LoopNum).MaxVolFlowRateWasAutoSized) {
3205 :
3206 3625 : if ((PlantSizNum > 0)) {
3207 :
3208 3625 : if (state.dataSize->PlantSizData(PlantSizNum).DesVolFlowRate >= HVAC::SmallWaterVolFlow) {
3209 3486 : state.dataPlnt->PlantLoop(LoopNum).MaxVolFlowRate =
3210 3486 : state.dataSize->PlantSizData(PlantSizNum).DesVolFlowRate * state.dataSize->PlantSizData(PlantSizNum).PlantSizFac;
3211 : } else {
3212 139 : state.dataPlnt->PlantLoop(LoopNum).MaxVolFlowRate = 0.0;
3213 139 : if (state.dataPlnt->PlantFinalSizesOkayToReport) {
3214 0 : ShowWarningError(state,
3215 0 : format("SizePlantLoop: Calculated Plant Sizing Design Volume Flow Rate=[{:.2R}] is too small. Set to 0.0",
3216 0 : state.dataSize->PlantSizData(PlantSizNum).DesVolFlowRate));
3217 0 : ShowContinueError(state, "..occurs for PlantLoop=" + state.dataPlnt->PlantLoop(LoopNum).Name);
3218 : }
3219 : }
3220 3625 : if (Finalize) {
3221 725 : if (state.dataPlnt->PlantFinalSizesOkayToReport) {
3222 681 : if (state.dataPlnt->PlantLoop(LoopNum).TypeOfLoop == LoopType::Plant) {
3223 1120 : BaseSizer::reportSizerOutput(state,
3224 : "PlantLoop",
3225 560 : state.dataPlnt->PlantLoop(LoopNum).Name,
3226 : "Maximum Loop Flow Rate [m3/s]",
3227 560 : state.dataPlnt->PlantLoop(LoopNum).MaxVolFlowRate);
3228 : // begin std 229 plantloop equipment summary new table
3229 1120 : OutputReportPredefined::PreDefTableEntry(
3230 560 : state, state.dataOutRptPredefined->pdchPLCLType, state.dataPlnt->PlantLoop(LoopNum).Name, "PlantLoop");
3231 : // end std 229 plantloop equipment summary new table
3232 121 : } else if (state.dataPlnt->PlantLoop(LoopNum).TypeOfLoop == LoopType::Condenser) {
3233 242 : BaseSizer::reportSizerOutput(state,
3234 : "CondenserLoop",
3235 121 : state.dataPlnt->PlantLoop(LoopNum).Name,
3236 : "Maximum Loop Flow Rate [m3/s]",
3237 121 : state.dataPlnt->PlantLoop(LoopNum).MaxVolFlowRate);
3238 : // begin std 229 plantloop equipment summary new table
3239 242 : OutputReportPredefined::PreDefTableEntry(
3240 121 : state, state.dataOutRptPredefined->pdchPLCLType, state.dataPlnt->PlantLoop(LoopNum).Name, "CondenserLoop");
3241 : // end std 229 plantloop equipment summary new table
3242 : }
3243 : // begin std 229 plantloop equipment summary new table
3244 1362 : OutputReportPredefined::PreDefTableEntry(state,
3245 681 : state.dataOutRptPredefined->pdchPLCLProvHeat,
3246 681 : state.dataPlnt->PlantLoop(LoopNum).Name,
3247 681 : state.dataPlnt->PlantLoop(LoopNum).HeatingDemand >= 0 ? "Yes" : "No");
3248 1362 : OutputReportPredefined::PreDefTableEntry(state,
3249 681 : state.dataOutRptPredefined->pdchPLCLProvCool,
3250 681 : state.dataPlnt->PlantLoop(LoopNum).Name,
3251 681 : state.dataPlnt->PlantLoop(LoopNum).CoolingDemand >= 0 ? "Yes" : "No");
3252 1362 : OutputReportPredefined::PreDefTableEntry(state,
3253 681 : state.dataOutRptPredefined->pdchPLCLMaxLoopFlowRate,
3254 681 : state.dataPlnt->PlantLoop(LoopNum).Name,
3255 681 : state.dataPlnt->PlantLoop(LoopNum).MaxVolFlowRate);
3256 1362 : OutputReportPredefined::PreDefTableEntry(state,
3257 681 : state.dataOutRptPredefined->pdchPLCLMinLoopFlowRate,
3258 681 : state.dataPlnt->PlantLoop(LoopNum).Name,
3259 681 : state.dataPlnt->PlantLoop(LoopNum).MinVolFlowRate);
3260 : // end std 229 plantloop equipment summary new table
3261 : }
3262 725 : if (state.dataPlnt->PlantFirstSizesOkayToReport) {
3263 44 : if (state.dataPlnt->PlantLoop(LoopNum).TypeOfLoop == LoopType::Plant) {
3264 68 : BaseSizer::reportSizerOutput(state,
3265 : "PlantLoop",
3266 34 : state.dataPlnt->PlantLoop(LoopNum).Name,
3267 : "Initial Maximum Loop Flow Rate [m3/s]",
3268 34 : state.dataPlnt->PlantLoop(LoopNum).MaxVolFlowRate);
3269 10 : } else if (state.dataPlnt->PlantLoop(LoopNum).TypeOfLoop == LoopType::Condenser) {
3270 20 : BaseSizer::reportSizerOutput(state,
3271 : "CondenserLoop",
3272 10 : state.dataPlnt->PlantLoop(LoopNum).Name,
3273 : "Initial Maximum Loop Flow Rate [m3/s]",
3274 10 : state.dataPlnt->PlantLoop(LoopNum).MaxVolFlowRate);
3275 : }
3276 : }
3277 : }
3278 :
3279 : } else {
3280 0 : if (state.dataPlnt->PlantFirstSizesOkayToFinalize) {
3281 0 : ShowFatalError(state, "Autosizing of plant loop requires a loop Sizing:Plant object");
3282 0 : ShowContinueError(state, "Occurs in PlantLoop object=" + state.dataPlnt->PlantLoop(LoopNum).Name);
3283 0 : ErrorsFound = true;
3284 : }
3285 : }
3286 : }
3287 :
3288 : // Small loop mass no longer introduces instability. Checks and warnings removed by SJR 20 July 2007.
3289 5785 : if (state.dataPlnt->PlantLoop(LoopNum).VolumeWasAutoSized) {
3290 : // There is no stability requirement (mass can be zero), autosizing is based on loop circulation time.
3291 : // Note this calculation also appears in PlantManager::ResizePlantLoopLevelSizes and SizingAnalysisObjects::ResolveDesignFlowRate
3292 5585 : state.dataPlnt->PlantLoop(LoopNum).Volume =
3293 5585 : state.dataPlnt->PlantLoop(LoopNum).MaxVolFlowRate * state.dataPlnt->PlantLoop(LoopNum).CirculationTime * 60.0;
3294 5585 : if (state.dataPlnt->PlantFinalSizesOkayToReport) {
3295 1073 : if (state.dataPlnt->PlantLoop(LoopNum).TypeOfLoop == LoopType::Plant) {
3296 : // condenser loop vs plant loop breakout needed.
3297 1658 : BaseSizer::reportSizerOutput(
3298 829 : state, "PlantLoop", state.dataPlnt->PlantLoop(LoopNum).Name, "Plant Loop Volume [m3]", state.dataPlnt->PlantLoop(LoopNum).Volume);
3299 : // begin std 229 added lines
3300 2487 : BaseSizer::reportSizerOutput(state,
3301 : "PlantLoop",
3302 829 : state.dataPlnt->PlantLoop(LoopNum).Name,
3303 : "Design Supply Temperature [C]",
3304 829 : state.dataPlnt->PlantLoop(LoopNum).PlantSizNum > 0
3305 607 : ? state.dataSize->PlantSizData(state.dataPlnt->PlantLoop(LoopNum).PlantSizNum).ExitTemp
3306 : : -999.0);
3307 2487 : BaseSizer::reportSizerOutput(state,
3308 : "PlantLoop",
3309 829 : state.dataPlnt->PlantLoop(LoopNum).Name,
3310 : "Design Return Temperature [C]",
3311 829 : state.dataPlnt->PlantLoop(LoopNum).PlantSizNum > 0
3312 607 : ? state.dataSize->PlantSizData(state.dataPlnt->PlantLoop(LoopNum).PlantSizNum).ExitTemp -
3313 607 : state.dataSize->PlantSizData(state.dataPlnt->PlantLoop(LoopNum).PlantSizNum).DeltaT
3314 : : -999.0);
3315 2487 : BaseSizer::reportSizerOutput(state,
3316 : "PlantLoop",
3317 829 : state.dataPlnt->PlantLoop(LoopNum).Name,
3318 : "Sizing option (Coincident/NonCoincident)",
3319 829 : state.dataPlnt->PlantLoop(LoopNum).PlantSizNum > 0
3320 607 : ? state.dataSize->PlantSizData(state.dataPlnt->PlantLoop(LoopNum).PlantSizNum).ConcurrenceOption
3321 : : -1);
3322 : // end std 229 added lines
3323 244 : } else if (state.dataPlnt->PlantLoop(LoopNum).TypeOfLoop == LoopType::Condenser) {
3324 488 : BaseSizer::reportSizerOutput(state,
3325 : "CondenserLoop",
3326 244 : state.dataPlnt->PlantLoop(LoopNum).Name,
3327 : "Condenser Loop Volume [m3]",
3328 244 : state.dataPlnt->PlantLoop(LoopNum).Volume);
3329 : // begin std 229 added lines
3330 732 : BaseSizer::reportSizerOutput(state,
3331 : "CondenserLoop",
3332 244 : state.dataPlnt->PlantLoop(LoopNum).Name,
3333 : "Design Supply Temperature [C]",
3334 244 : state.dataPlnt->PlantLoop(LoopNum).PlantSizNum > 0
3335 137 : ? state.dataSize->PlantSizData(state.dataPlnt->PlantLoop(LoopNum).PlantSizNum).ExitTemp
3336 : : -999.0);
3337 732 : BaseSizer::reportSizerOutput(state,
3338 : "CondenserLoop",
3339 244 : state.dataPlnt->PlantLoop(LoopNum).Name,
3340 : "Design Return Temperature [C]",
3341 244 : state.dataPlnt->PlantLoop(LoopNum).PlantSizNum > 0
3342 137 : ? state.dataSize->PlantSizData(state.dataPlnt->PlantLoop(LoopNum).PlantSizNum).ExitTemp -
3343 137 : state.dataSize->PlantSizData(state.dataPlnt->PlantLoop(LoopNum).PlantSizNum).DeltaT
3344 : : -999.0);
3345 732 : BaseSizer::reportSizerOutput(state,
3346 : "CondenserLoop",
3347 244 : state.dataPlnt->PlantLoop(LoopNum).Name,
3348 : "Sizing option (Coincident/NonCoincident)",
3349 244 : state.dataPlnt->PlantLoop(LoopNum).PlantSizNum
3350 137 : ? state.dataSize->PlantSizData(state.dataPlnt->PlantLoop(LoopNum).PlantSizNum).ConcurrenceOption
3351 : : -1);
3352 : // end std 229 added lines
3353 : }
3354 : }
3355 5585 : if (state.dataPlnt->PlantFirstSizesOkayToReport) {
3356 44 : if (state.dataPlnt->PlantLoop(LoopNum).TypeOfLoop == LoopType::Plant) {
3357 : // condenser loop vs plant loop breakout needed.
3358 68 : BaseSizer::reportSizerOutput(state,
3359 : "PlantLoop",
3360 34 : state.dataPlnt->PlantLoop(LoopNum).Name,
3361 : "Initial Plant Loop Volume [m3]",
3362 34 : state.dataPlnt->PlantLoop(LoopNum).Volume);
3363 10 : } else if (state.dataPlnt->PlantLoop(LoopNum).TypeOfLoop == LoopType::Condenser) {
3364 20 : BaseSizer::reportSizerOutput(state,
3365 : "CondenserLoop",
3366 10 : state.dataPlnt->PlantLoop(LoopNum).Name,
3367 : "Initial Condenser Loop Volume [m3]",
3368 10 : state.dataPlnt->PlantLoop(LoopNum).Volume);
3369 : }
3370 : }
3371 : }
3372 :
3373 5785 : if (state.dataPlnt->PlantFinalSizesOkayToReport) {
3374 1113 : if (state.dataPlnt->PlantLoop(LoopNum).TypeOfLoop == LoopType::Plant) {
3375 1726 : BaseSizer::reportSizerOutput(state,
3376 : "PlantLoop",
3377 863 : state.dataPlnt->PlantLoop(LoopNum).Name,
3378 : "Minimum Loop Flow Rate [m3/s]",
3379 863 : state.dataPlnt->PlantLoop(LoopNum).MinVolFlowRate);
3380 250 : } else if (state.dataPlnt->PlantLoop(LoopNum).TypeOfLoop == LoopType::Condenser) {
3381 500 : BaseSizer::reportSizerOutput(state,
3382 : "CondenserLoop",
3383 250 : state.dataPlnt->PlantLoop(LoopNum).Name,
3384 : "Minimum Loop Flow Rate [m3/s]",
3385 250 : state.dataPlnt->PlantLoop(LoopNum).MinVolFlowRate);
3386 : }
3387 : }
3388 :
3389 : // should now have plant volume, calculate plant volume's mass for fluid type
3390 5785 : if (state.dataPlnt->PlantLoop(LoopNum).FluidType == DataLoopNode::NodeFluidType::Water) {
3391 5740 : FluidDensity = state.dataPlnt->PlantLoop(LoopNum).glycol->getDensity(state, Constant::InitConvTemp, RoutineName);
3392 5740 : if (PlantSizNum > 0 && allocated(state.dataSize->PlantSizData)) { // method only works if sizing delta T is available
3393 3945 : Real64 cp = state.dataPlnt->PlantLoop(LoopNum).glycol->getSpecificHeat(state, Constant::InitConvTemp, RoutineName);
3394 : Real64 DesignPlantCapacity =
3395 3945 : cp * FluidDensity * state.dataSize->PlantSizData(PlantSizNum).DesVolFlowRate * state.dataSize->PlantSizData(PlantSizNum).DeltaT;
3396 3945 : state.dataSize->PlantSizData(PlantSizNum).DesCapacity = DesignPlantCapacity; // store it for later use in scaling
3397 3945 : if (state.dataPlnt->PlantFinalSizesOkayToReport) {
3398 745 : BaseSizer::reportSizerOutput(state, "PlantLoop", state.dataPlnt->PlantLoop(LoopNum).Name, "Design Capacity [W]", DesignPlantCapacity);
3399 : }
3400 : }
3401 45 : } else if (state.dataPlnt->PlantLoop(LoopNum).FluidType == DataLoopNode::NodeFluidType::Steam) {
3402 45 : auto *steam = Fluid::GetSteam(state);
3403 45 : state.dataPlnt->PlantLoop(LoopNum).FluidIndex = steam->Num;
3404 45 : FluidDensity = steam->getSatDensity(state, 100.0, 1.0, RoutineName);
3405 : } else {
3406 0 : assert(false);
3407 : }
3408 :
3409 5785 : state.dataPlnt->PlantLoop(LoopNum).Mass = state.dataPlnt->PlantLoop(LoopNum).Volume * FluidDensity;
3410 :
3411 5785 : state.dataPlnt->PlantLoop(LoopNum).MaxMassFlowRate = state.dataPlnt->PlantLoop(LoopNum).MaxVolFlowRate * FluidDensity;
3412 5785 : state.dataPlnt->PlantLoop(LoopNum).MinMassFlowRate = state.dataPlnt->PlantLoop(LoopNum).MinVolFlowRate * FluidDensity;
3413 :
3414 5785 : if (ErrorsFound) {
3415 0 : ShowFatalError(state, "Preceding sizing errors cause program termination");
3416 : }
3417 5785 : }
3418 :
3419 44 : void ResizePlantLoopLevelSizes(EnergyPlusData &state, int const LoopNum // Supply side loop being simulated
3420 : )
3421 : {
3422 :
3423 : // SUBROUTINE INFORMATION:
3424 : // AUTHOR Brent Griffith
3425 : // DATE WRITTEN Jan 2015
3426 : // MODIFIED na
3427 : // RE-ENGINEERED na
3428 :
3429 : // PURPOSE OF THIS SUBROUTINE:
3430 : // This subroutine is for redon the sizing of plant loops to support HVAC Sizing Simulation
3431 :
3432 : // METHODOLOGY EMPLOYED:
3433 : // Obtains volumetric flow rate data from the PlantSizData array..
3434 :
3435 : // Using/Aliasing
3436 : using namespace DataSizing;
3437 :
3438 : // SUBROUTINE PARAMETER DEFINITIONS:
3439 : static constexpr std::string_view RoutineName("ResizePlantLoop");
3440 :
3441 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
3442 44 : int PlantSizNum(0); // index of Plant Sizing data for this loop
3443 : int BranchNum; // DO loop counter for cycling through branches on a demand side loop
3444 :
3445 44 : Real64 FluidDensity(0.0); // local value from glycol routine
3446 :
3447 44 : Real64 PlantSizeFac = 0.0;
3448 :
3449 44 : PlantSizNum = state.dataPlnt->PlantLoop(LoopNum).PlantSizNum;
3450 :
3451 : // fill PlantSizFac from data structure
3452 44 : for (BranchNum = 1; BranchNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).TotalBranches; ++BranchNum) {
3453 44 : if (state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).NodeNumIn ==
3454 44 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).Branch(BranchNum).NodeNumIn) {
3455 44 : PlantSizeFac = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).Branch(BranchNum).PumpSizFac;
3456 44 : break;
3457 : }
3458 : }
3459 44 : if (state.dataSize->PlantSizData(PlantSizNum).ConcurrenceOption == NonCoincident) {
3460 : // we can have plant loops that are non-coincident along with some that are coincident
3461 : // so refresh sum of registered flows (they may have changed)
3462 :
3463 18 : state.dataSize->PlantSizData(PlantSizNum).DesVolFlowRate = 0.0; // init for summation
3464 115 : for (BranchNum = 1; BranchNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).TotalBranches; ++BranchNum) {
3465 194 : for (int CompNum = 1; CompNum <= state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).Branch(BranchNum).TotalComponents;
3466 : ++CompNum) {
3467 97 : int SupNodeNum = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).Branch(BranchNum).Comp(CompNum).NodeNumIn;
3468 3329 : for (int WaterCompNum = 1; WaterCompNum <= state.dataSize->SaveNumPlantComps; ++WaterCompNum) {
3469 3232 : if (SupNodeNum == state.dataSize->CompDesWaterFlow(WaterCompNum).SupNode) {
3470 43 : state.dataSize->PlantSizData(PlantSizNum).DesVolFlowRate += state.dataSize->CompDesWaterFlow(WaterCompNum).DesVolFlowRate;
3471 : }
3472 : }
3473 : }
3474 : }
3475 : }
3476 :
3477 44 : if (state.dataPlnt->PlantLoop(LoopNum).MaxVolFlowRateWasAutoSized) {
3478 :
3479 44 : if ((PlantSizNum > 0)) {
3480 :
3481 44 : if (state.dataSize->PlantSizData(PlantSizNum).DesVolFlowRate >= HVAC::SmallWaterVolFlow) {
3482 44 : state.dataPlnt->PlantLoop(LoopNum).MaxVolFlowRate = state.dataSize->PlantSizData(PlantSizNum).DesVolFlowRate * PlantSizeFac;
3483 : } else {
3484 0 : state.dataPlnt->PlantLoop(LoopNum).MaxVolFlowRate = 0.0;
3485 0 : if (state.dataPlnt->PlantFinalSizesOkayToReport) {
3486 0 : ShowWarningError(state,
3487 0 : format("SizePlantLoop: Calculated Plant Sizing Design Volume Flow Rate=[{:.2R}] is too small. Set to 0.0",
3488 0 : state.dataSize->PlantSizData(PlantSizNum).DesVolFlowRate));
3489 0 : ShowContinueError(state, "..occurs for PlantLoop=" + state.dataPlnt->PlantLoop(LoopNum).Name);
3490 : }
3491 : }
3492 44 : if (state.dataPlnt->PlantFinalSizesOkayToReport) {
3493 44 : if (state.dataPlnt->PlantLoop(LoopNum).TypeOfLoop == LoopType::Plant) {
3494 68 : BaseSizer::reportSizerOutput(state,
3495 : "PlantLoop",
3496 34 : state.dataPlnt->PlantLoop(LoopNum).Name,
3497 : "Maximum Loop Flow Rate [m3/s]",
3498 34 : state.dataPlnt->PlantLoop(LoopNum).MaxVolFlowRate);
3499 10 : } else if (state.dataPlnt->PlantLoop(LoopNum).TypeOfLoop == LoopType::Condenser) {
3500 20 : BaseSizer::reportSizerOutput(state,
3501 : "CondenserLoop",
3502 10 : state.dataPlnt->PlantLoop(LoopNum).Name,
3503 : "Maximum Loop Flow Rate [m3/s]",
3504 10 : state.dataPlnt->PlantLoop(LoopNum).MaxVolFlowRate);
3505 : }
3506 : }
3507 : }
3508 : }
3509 :
3510 : // Small loop mass no longer introduces instability. Checks and warnings removed by SJR 20 July 2007.
3511 44 : if (state.dataPlnt->PlantLoop(LoopNum).VolumeWasAutoSized) {
3512 : // There is no stability requirement (mass can be zero), autosizing is based on loop circulation time.
3513 : // Note this calculation also appears in PlantManager::SizePlantLoop and SizingAnalysisObjects::ResolveDesignFlowRate
3514 44 : state.dataPlnt->PlantLoop(LoopNum).Volume =
3515 44 : state.dataPlnt->PlantLoop(LoopNum).MaxVolFlowRate * state.dataPlnt->PlantLoop(LoopNum).CirculationTime * 60.0;
3516 44 : if (state.dataPlnt->PlantLoop(LoopNum).TypeOfLoop == LoopType::Plant) {
3517 : // condenser loop vs plant loop breakout needed.
3518 68 : BaseSizer::reportSizerOutput(
3519 34 : state, "PlantLoop", state.dataPlnt->PlantLoop(LoopNum).Name, "Plant Loop Volume [m3]", state.dataPlnt->PlantLoop(LoopNum).Volume);
3520 10 : } else if (state.dataPlnt->PlantLoop(LoopNum).TypeOfLoop == LoopType::Condenser) {
3521 20 : BaseSizer::reportSizerOutput(state,
3522 : "CondenserLoop",
3523 10 : state.dataPlnt->PlantLoop(LoopNum).Name,
3524 : "Condenser Loop Volume [m3]",
3525 10 : state.dataPlnt->PlantLoop(LoopNum).Volume);
3526 : }
3527 : }
3528 :
3529 : // should now have plant volume, calculate plant volume's mass for fluid type
3530 44 : if (state.dataPlnt->PlantLoop(LoopNum).FluidType == DataLoopNode::NodeFluidType::Water) {
3531 44 : FluidDensity = state.dataPlnt->PlantLoop(LoopNum).glycol->getDensity(state, Constant::InitConvTemp, RoutineName);
3532 0 : } else if (state.dataPlnt->PlantLoop(LoopNum).FluidType == DataLoopNode::NodeFluidType::Steam) {
3533 0 : FluidDensity = Fluid::GetSteam(state)->getSatDensity(state, 100.0, 1.0, RoutineName);
3534 : } else {
3535 0 : assert(false);
3536 : }
3537 :
3538 44 : state.dataPlnt->PlantLoop(LoopNum).Mass = state.dataPlnt->PlantLoop(LoopNum).Volume * FluidDensity;
3539 :
3540 44 : state.dataPlnt->PlantLoop(LoopNum).MaxMassFlowRate = state.dataPlnt->PlantLoop(LoopNum).MaxVolFlowRate * FluidDensity;
3541 44 : state.dataPlnt->PlantLoop(LoopNum).MinMassFlowRate = state.dataPlnt->PlantLoop(LoopNum).MinVolFlowRate * FluidDensity;
3542 44 : }
3543 :
3544 801 : void SetupInitialPlantCallingOrder(EnergyPlusData &state)
3545 : {
3546 :
3547 : // SUBROUTINE INFORMATION:
3548 : // AUTHOR Brent Griffith
3549 : // DATE WRITTEN Feb 2010
3550 : // MODIFIED na
3551 : // RE-ENGINEERED na
3552 :
3553 : // PURPOSE OF THIS SUBROUTINE:
3554 : // setup the order that plant loops are to be called
3555 :
3556 : // METHODOLOGY EMPLOYED:
3557 : // simple rule-based allocation of which order to call the half loops
3558 : // initially just mimicking historical practice until a better set of rules is
3559 : // developed
3560 : // 1. first call all plant demand sides
3561 : // 2. second call all plant supply sides
3562 : // 3. third call all condenser demand sides
3563 : // 4. fourth call all condenser supply sides
3564 :
3565 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
3566 : int OrderIndex; // local
3567 : int I; // local loop
3568 :
3569 801 : state.dataPlnt->TotNumHalfLoops = 2 * state.dataPlnt->TotNumLoops;
3570 :
3571 801 : if (state.dataPlnt->TotNumHalfLoops <= 0) {
3572 338 : return;
3573 : }
3574 :
3575 : // first allocate to total number of plant half loops
3576 :
3577 463 : if (!allocated(state.dataPlnt->PlantCallingOrderInfo)) {
3578 463 : state.dataPlnt->PlantCallingOrderInfo.allocate(state.dataPlnt->TotNumHalfLoops);
3579 : }
3580 :
3581 : // set plant loop demand sides
3582 1361 : for (I = 1; I <= state.dataHVACGlobal->NumPlantLoops; ++I) {
3583 898 : state.dataPlnt->PlantCallingOrderInfo(I).LoopIndex = I;
3584 898 : state.dataPlnt->PlantCallingOrderInfo(I).LoopSide = LoopSideLocation::Demand;
3585 : }
3586 :
3587 : // set plant loop supply sides
3588 1361 : for (I = 1; I <= state.dataHVACGlobal->NumPlantLoops; ++I) {
3589 898 : OrderIndex = I + state.dataHVACGlobal->NumPlantLoops;
3590 898 : state.dataPlnt->PlantCallingOrderInfo(OrderIndex).LoopIndex = I;
3591 898 : state.dataPlnt->PlantCallingOrderInfo(OrderIndex).LoopSide = LoopSideLocation::Supply;
3592 : }
3593 :
3594 : // set condenser Loop demand sides
3595 723 : for (I = 1; I <= state.dataHVACGlobal->NumCondLoops; ++I) {
3596 260 : OrderIndex = 2 * state.dataHVACGlobal->NumPlantLoops + I;
3597 260 : state.dataPlnt->PlantCallingOrderInfo(OrderIndex).LoopIndex = state.dataHVACGlobal->NumPlantLoops + I;
3598 260 : state.dataPlnt->PlantCallingOrderInfo(OrderIndex).LoopSide = LoopSideLocation::Demand;
3599 : }
3600 :
3601 : // set condenser Loop supply sides
3602 723 : for (I = 1; I <= state.dataHVACGlobal->NumCondLoops; ++I) {
3603 260 : OrderIndex = 2 * state.dataHVACGlobal->NumPlantLoops + state.dataHVACGlobal->NumCondLoops + I;
3604 260 : state.dataPlnt->PlantCallingOrderInfo(OrderIndex).LoopIndex = state.dataHVACGlobal->NumPlantLoops + I;
3605 260 : state.dataPlnt->PlantCallingOrderInfo(OrderIndex).LoopSide = LoopSideLocation::Supply;
3606 : }
3607 : }
3608 :
3609 1848 : void RevisePlantCallingOrder(EnergyPlusData &state)
3610 : {
3611 :
3612 : // SUBROUTINE INFORMATION:
3613 : // AUTHOR Brent Griffith
3614 : // DATE WRITTEN April 2011
3615 : // MODIFIED na
3616 : // RE-ENGINEERED na
3617 :
3618 : // PURPOSE OF THIS SUBROUTINE:
3619 : // setup the order that plant loops are to be called
3620 :
3621 : // METHODOLOGY EMPLOYED:
3622 : // simple rule-based allocation of which order to call the half loops
3623 : // Examine for interconnected components and rearrange to impose the following rules
3624 :
3625 : // Using/Aliasing
3626 : using PlantUtilities::ShiftPlantLoopSideCallingOrder;
3627 :
3628 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
3629 : DataPlant::LoopSideLocation LoopSideNum;
3630 : DataPlant::LoopSideLocation OtherLoopSideNum;
3631 :
3632 : bool thisLoopPutsDemandOnAnother;
3633 : int ConnctNum;
3634 :
3635 11104 : for (int HalfLoopNum = 1; HalfLoopNum <= state.dataPlnt->TotNumHalfLoops; ++HalfLoopNum) {
3636 :
3637 9256 : int LoopNum = state.dataPlnt->PlantCallingOrderInfo(HalfLoopNum).LoopIndex;
3638 9256 : LoopSideNum = state.dataPlnt->PlantCallingOrderInfo(HalfLoopNum).LoopSide;
3639 :
3640 9256 : if (allocated(state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Connected)) {
3641 6162 : for (ConnctNum = 1; ConnctNum <= isize(state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Connected); ++ConnctNum) {
3642 3689 : int OtherLoopNum = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Connected(ConnctNum).LoopNum;
3643 3689 : OtherLoopSideNum = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Connected(ConnctNum).LoopSideNum;
3644 3689 : state.dataPlantMgr->OtherLoopCallingIndex = FindLoopSideInCallingOrder(state, OtherLoopNum, OtherLoopSideNum);
3645 :
3646 3689 : thisLoopPutsDemandOnAnother = state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).Connected(ConnctNum).LoopDemandsOnRemote;
3647 3689 : if (thisLoopPutsDemandOnAnother) { // make sure this loop side is called before the other loop side
3648 1802 : if (state.dataPlantMgr->OtherLoopCallingIndex < HalfLoopNum) { // rearrange
3649 1 : state.dataPlantMgr->newCallingIndex = min(HalfLoopNum + 1, state.dataPlnt->TotNumHalfLoops);
3650 1 : ShiftPlantLoopSideCallingOrder(state, state.dataPlantMgr->OtherLoopCallingIndex, state.dataPlantMgr->newCallingIndex);
3651 : }
3652 :
3653 : } else { // make sure the other is called before this one
3654 1887 : if (state.dataPlantMgr->OtherLoopCallingIndex > HalfLoopNum) { // rearrange
3655 53 : state.dataPlantMgr->newCallingIndex = max(HalfLoopNum, 1);
3656 :
3657 53 : if (OtherLoopSideNum == LoopSideLocation::Supply) { // if this is a supply side, don't push it before its own demand side
3658 106 : state.dataPlantMgr->OtherLoopDemandSideCallingIndex =
3659 53 : FindLoopSideInCallingOrder(state, OtherLoopNum, LoopSideLocation::Demand);
3660 53 : if (state.dataPlantMgr->OtherLoopDemandSideCallingIndex < HalfLoopNum) { // good to go
3661 29 : state.dataPlantMgr->newCallingIndex = min(state.dataPlantMgr->OtherLoopDemandSideCallingIndex + 1,
3662 29 : state.dataPlnt->TotNumHalfLoops); // put it right after its demand side
3663 29 : ShiftPlantLoopSideCallingOrder(state, state.dataPlantMgr->OtherLoopCallingIndex, state.dataPlantMgr->newCallingIndex);
3664 : } else { // move both sides of other loop before this, keeping demand side in front
3665 24 : state.dataPlantMgr->NewOtherDemandSideCallingIndex = max(HalfLoopNum, 1);
3666 24 : ShiftPlantLoopSideCallingOrder(
3667 24 : state, state.dataPlantMgr->OtherLoopDemandSideCallingIndex, state.dataPlantMgr->NewOtherDemandSideCallingIndex);
3668 : // get fresh pointer after it has changed in previous call
3669 24 : state.dataPlantMgr->OtherLoopCallingIndex = FindLoopSideInCallingOrder(state, OtherLoopNum, OtherLoopSideNum);
3670 24 : state.dataPlantMgr->newCallingIndex = state.dataPlantMgr->NewOtherDemandSideCallingIndex + 1;
3671 24 : ShiftPlantLoopSideCallingOrder(state, state.dataPlantMgr->OtherLoopCallingIndex, state.dataPlantMgr->newCallingIndex);
3672 : }
3673 : } else {
3674 0 : ShiftPlantLoopSideCallingOrder(state, state.dataPlantMgr->OtherLoopCallingIndex, state.dataPlantMgr->newCallingIndex);
3675 : }
3676 : }
3677 : }
3678 : }
3679 : }
3680 : }
3681 1848 : }
3682 :
3683 3766 : int FindLoopSideInCallingOrder(EnergyPlusData &state, int const LoopNum, const LoopSideLocation LoopSide)
3684 : {
3685 :
3686 : // FUNCTION INFORMATION:
3687 : // AUTHOR B. Griffith
3688 : // DATE WRITTEN April 2011
3689 : // MODIFIED na
3690 : // RE-ENGINEERED na
3691 :
3692 : // PURPOSE OF THIS FUNCTION:
3693 : // locate loop and loop side in calling order structure
3694 :
3695 : // METHODOLOGY EMPLOYED:
3696 : // returns integer "pointer" index to calling order structure
3697 :
3698 : // REFERENCES:
3699 : // na
3700 :
3701 : // USE STATEMENTS:
3702 : // na
3703 :
3704 : // Return value
3705 : int CallingIndex;
3706 :
3707 : // Locals
3708 : // FUNCTION ARGUMENT DEFINITIONS:
3709 :
3710 : // FUNCTION PARAMETER DEFINITIONS:
3711 : // na
3712 :
3713 : // INTERFACE BLOCK SPECIFICATIONS:
3714 : // na
3715 :
3716 : // DERIVED TYPE DEFINITIONS:
3717 : // na
3718 :
3719 : // FUNCTION LOCAL VARIABLE DECLARATIONS:
3720 : int HalfLoopNum;
3721 :
3722 3766 : CallingIndex = 0;
3723 :
3724 29904 : for (HalfLoopNum = 1; HalfLoopNum <= state.dataPlnt->TotNumHalfLoops; ++HalfLoopNum) {
3725 33670 : if ((LoopNum == state.dataPlnt->PlantCallingOrderInfo(HalfLoopNum).LoopIndex) &&
3726 7532 : (LoopSide == state.dataPlnt->PlantCallingOrderInfo(HalfLoopNum).LoopSide)) {
3727 :
3728 3766 : CallingIndex = HalfLoopNum;
3729 : }
3730 : }
3731 3766 : return CallingIndex;
3732 : }
3733 :
3734 801 : void SetupBranchControlTypes(EnergyPlusData &state)
3735 : {
3736 :
3737 : // SUBROUTINE INFORMATION:
3738 : // AUTHOR Brent Griffith
3739 : // DATE WRITTEN March 2010
3740 : // MODIFIED na
3741 : // RE-ENGINEERED na
3742 :
3743 : // PURPOSE OF THIS SUBROUTINE:
3744 : // set the control types on plant branches using heuristics.
3745 : // Trying to obsolete branch control type input
3746 :
3747 : // METHODOLOGY EMPLOYED:
3748 : // set component control types based on component type
3749 : // process branches and set branch level control types based on the type of components on them
3750 : // Rules applied
3751 : // - Most component models are active
3752 : // - Pipes are passive unless located between splitter/mixers when assumed to be bypass
3753 : // - A branch with multiple active components becomes SeriesActive and so do its components
3754 :
3755 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
3756 : int LoopCtr;
3757 : int BranchCtr;
3758 : int CompCtr;
3759 : bool BranchIsInSplitterMixer;
3760 : DataBranchAirLoopPlant::ControlType ComponentFlowCtrl;
3761 : int ActiveCount;
3762 : int BypassCount;
3763 : int NumComponentsOnBranch;
3764 : int NumCount;
3765 :
3766 : // first set component level control type (obsoletes one input in field set for Branch )
3767 801 : if (allocated(state.dataPlnt->PlantLoop)) {
3768 801 : NumCount = size(state.dataPlnt->PlantLoop);
3769 : } else {
3770 0 : NumCount = 0;
3771 : }
3772 1959 : for (LoopCtr = 1; LoopCtr <= NumCount; ++LoopCtr) {
3773 3474 : for (DataPlant::LoopSideLocation LoopSideCtr : DataPlant::LoopSideKeys) {
3774 16272 : for (BranchCtr = 1; BranchCtr <= state.dataPlnt->PlantLoop(LoopCtr).LoopSide(LoopSideCtr).TotalBranches; ++BranchCtr) {
3775 13956 : BranchIsInSplitterMixer = false;
3776 : // test if this branch is inside a splitter/mixer
3777 13956 : if (state.dataPlnt->PlantLoop(LoopCtr).LoopSide(LoopSideCtr).Splitter.Exists) {
3778 13923 : if ((BranchCtr > 1) && (BranchCtr < state.dataPlnt->PlantLoop(LoopCtr).LoopSide(LoopSideCtr).TotalBranches)) {
3779 9357 : BranchIsInSplitterMixer = true;
3780 : }
3781 : }
3782 :
3783 13956 : NumComponentsOnBranch = state.dataPlnt->PlantLoop(LoopCtr).LoopSide(LoopSideCtr).Branch(BranchCtr).TotalComponents;
3784 :
3785 27998 : for (CompCtr = 1; CompCtr <= isize(state.dataPlnt->PlantLoop(LoopCtr).LoopSide(LoopSideCtr).Branch(BranchCtr).Comp); ++CompCtr) {
3786 :
3787 14042 : auto &this_component(state.dataPlnt->PlantLoop(LoopCtr).LoopSide(LoopSideCtr).Branch(BranchCtr).Comp(CompCtr));
3788 :
3789 14042 : switch (this_component.Type) {
3790 0 : case DataPlant::PlantEquipmentType::Invalid: { // = -1
3791 0 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Invalid;
3792 0 : this_component.FlowPriority = DataPlant::LoopFlowStatus::Invalid;
3793 0 : this_component.HowLoadServed = DataPlant::HowMet::Invalid;
3794 0 : } break;
3795 211 : case DataPlant::PlantEquipmentType::Boiler_Simple: { // = 1
3796 211 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
3797 211 : this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
3798 211 : this_component.HowLoadServed = DataPlant::HowMet::ByNominalCapHiOutLimit;
3799 211 : } break;
3800 8 : case DataPlant::PlantEquipmentType::Boiler_Steam: { // = 2
3801 8 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
3802 8 : this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
3803 8 : this_component.HowLoadServed = DataPlant::HowMet::ByNominalCap;
3804 8 : } break;
3805 4 : case DataPlant::PlantEquipmentType::Chiller_Absorption: { // = 3 ! older BLAST absorption chiller
3806 4 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
3807 4 : if (LoopSideCtr == LoopSideLocation::Demand) {
3808 2 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
3809 2 : this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
3810 : } else {
3811 2 : this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
3812 2 : this_component.HowLoadServed = DataPlant::HowMet::ByNominalCapLowOutLimit;
3813 : }
3814 4 : } break;
3815 5 : case DataPlant::PlantEquipmentType::Chiller_Indirect_Absorption: { // = 4 ! revised absorption chiller
3816 5 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
3817 5 : if (LoopSideCtr == LoopSideLocation::Demand) {
3818 3 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
3819 3 : this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
3820 : } else {
3821 2 : this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
3822 2 : this_component.HowLoadServed = DataPlant::HowMet::ByNominalCapLowOutLimit;
3823 : }
3824 5 : } break;
3825 5 : case DataPlant::PlantEquipmentType::Chiller_CombTurbine: { // = 5
3826 5 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
3827 5 : if (LoopSideCtr == LoopSideLocation::Demand) {
3828 3 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
3829 3 : this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
3830 : } else {
3831 2 : this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
3832 2 : this_component.HowLoadServed = DataPlant::HowMet::ByNominalCapLowOutLimit;
3833 : }
3834 5 : } break;
3835 185 : case DataPlant::PlantEquipmentType::Chiller_ConstCOP: { // = 6
3836 185 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
3837 :
3838 185 : if (LoopSideCtr == LoopSideLocation::Demand) {
3839 91 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
3840 91 : this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
3841 : } else {
3842 94 : this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
3843 94 : this_component.HowLoadServed = DataPlant::HowMet::ByNominalCap;
3844 : }
3845 185 : } break;
3846 3 : case DataPlant::PlantEquipmentType::Chiller_DFAbsorption: { // = 7
3847 3 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
3848 3 : if (LoopSideCtr == LoopSideLocation::Demand) {
3849 1 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
3850 1 : this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
3851 : } else {
3852 2 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyIfLoopOn;
3853 2 : this_component.HowLoadServed = DataPlant::HowMet::ByNominalCapLowOutLimit;
3854 : }
3855 3 : } break;
3856 3 : case DataPlant::PlantEquipmentType::Chiller_ExhFiredAbsorption: { // = 76
3857 3 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
3858 3 : if (LoopSideCtr == LoopSideLocation::Demand) {
3859 1 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
3860 1 : this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
3861 : } else {
3862 2 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyIfLoopOn;
3863 2 : this_component.HowLoadServed = DataPlant::HowMet::ByNominalCapLowOutLimit;
3864 : }
3865 3 : } break;
3866 378 : case DataPlant::PlantEquipmentType::Chiller_Electric: { // = 8
3867 378 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
3868 378 : if (LoopSideCtr == LoopSideLocation::Demand) {
3869 163 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
3870 163 : this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
3871 : } else {
3872 215 : this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
3873 215 : this_component.HowLoadServed = DataPlant::HowMet::ByNominalCapLowOutLimit;
3874 : }
3875 378 : } break;
3876 97 : case DataPlant::PlantEquipmentType::Chiller_ElectricEIR: { // = 9
3877 97 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
3878 97 : if (LoopSideCtr == LoopSideLocation::Demand) {
3879 45 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
3880 45 : this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
3881 : } else {
3882 52 : this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
3883 52 : this_component.HowLoadServed = DataPlant::HowMet::ByNominalCapLowOutLimit;
3884 : }
3885 97 : } break;
3886 86 : case DataPlant::PlantEquipmentType::Chiller_ElectricReformEIR: { // = 10
3887 86 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
3888 86 : if (LoopSideCtr == LoopSideLocation::Demand) {
3889 43 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
3890 43 : this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
3891 : } else {
3892 43 : this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
3893 43 : this_component.HowLoadServed = DataPlant::HowMet::ByNominalCapLowOutLimit;
3894 : }
3895 86 : } break;
3896 27 : case DataPlant::PlantEquipmentType::Chiller_EngineDriven: { // = 11
3897 27 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
3898 27 : if (LoopSideCtr == LoopSideLocation::Demand) {
3899 15 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
3900 15 : this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
3901 : } else {
3902 12 : this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
3903 12 : this_component.HowLoadServed = DataPlant::HowMet::ByNominalCapLowOutLimit;
3904 : }
3905 27 : } break;
3906 231 : case DataPlant::PlantEquipmentType::CoolingTower_SingleSpd: { // = 12
3907 231 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
3908 231 : this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
3909 231 : this_component.HowLoadServed = DataPlant::HowMet::ByNominalCap;
3910 231 : } break;
3911 13 : case DataPlant::PlantEquipmentType::CoolingTower_TwoSpd: { // = 13
3912 13 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
3913 13 : this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
3914 13 : this_component.HowLoadServed = DataPlant::HowMet::ByNominalCap;
3915 13 : } break;
3916 26 : case DataPlant::PlantEquipmentType::CoolingTower_VarSpd: { // = 14
3917 26 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
3918 26 : this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
3919 26 : this_component.HowLoadServed = DataPlant::HowMet::ByNominalCap;
3920 26 : } break;
3921 2 : case DataPlant::PlantEquipmentType::CoolingTower_VarSpdMerkel: { // = 89
3922 2 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
3923 2 : this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
3924 2 : this_component.HowLoadServed = DataPlant::HowMet::ByNominalCap;
3925 2 : } break;
3926 2 : case DataPlant::PlantEquipmentType::Generator_FCExhaust: { // = 15
3927 2 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
3928 2 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
3929 2 : this_component.HowLoadServed = DataPlant::HowMet::PassiveCap;
3930 2 : } break;
3931 10 : case PlantEquipmentType::HeatPumpWtrHeaterPumped:
3932 : case DataPlant::PlantEquipmentType::HeatPumpWtrHeaterWrapped: { // = 16, 92
3933 10 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
3934 10 : this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
3935 10 : this_component.HowLoadServed = DataPlant::HowMet::PassiveCap;
3936 10 : } break;
3937 4 : case DataPlant::PlantEquipmentType::HPWaterEFCooling: { // = 17
3938 4 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
3939 4 : if (LoopSideCtr == LoopSideLocation::Demand) {
3940 2 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
3941 2 : this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
3942 : } else {
3943 2 : this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
3944 2 : this_component.HowLoadServed = DataPlant::HowMet::ByNominalCap;
3945 : }
3946 4 : } break;
3947 4 : case DataPlant::PlantEquipmentType::HPWaterEFHeating: { // = 18
3948 4 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
3949 4 : if (LoopSideCtr == LoopSideLocation::Demand) {
3950 2 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
3951 2 : this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
3952 : } else {
3953 2 : this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
3954 2 : this_component.HowLoadServed = DataPlant::HowMet::ByNominalCap;
3955 : }
3956 4 : } break;
3957 6 : case DataPlant::PlantEquipmentType::HPWaterPECooling: { // = 19
3958 6 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
3959 6 : if (LoopSideCtr == LoopSideLocation::Demand) {
3960 3 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
3961 3 : this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
3962 : } else {
3963 3 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyIfLoopOn;
3964 3 : this_component.HowLoadServed = DataPlant::HowMet::ByNominalCap;
3965 : }
3966 6 : } break;
3967 6 : case DataPlant::PlantEquipmentType::HPWaterPEHeating: { // = 20
3968 6 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
3969 6 : if (LoopSideCtr == LoopSideLocation::Demand) {
3970 3 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
3971 3 : this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
3972 : } else {
3973 3 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyIfLoopOn;
3974 3 : this_component.HowLoadServed = DataPlant::HowMet::ByNominalCap;
3975 : }
3976 6 : } break;
3977 5548 : case DataPlant::PlantEquipmentType::Pipe: { // = 21
3978 5548 : this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
3979 5548 : this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
3980 5548 : if (BranchIsInSplitterMixer) {
3981 2161 : if (NumComponentsOnBranch == 1) {
3982 2160 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Bypass;
3983 1 : } else if (NumComponentsOnBranch > 1) {
3984 1 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Passive;
3985 : } else {
3986 0 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Bypass;
3987 : }
3988 : } else {
3989 3387 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Passive;
3990 : }
3991 5548 : } break;
3992 39 : case DataPlant::PlantEquipmentType::PipeSteam: { // = 22
3993 39 : this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
3994 39 : this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
3995 39 : if (BranchIsInSplitterMixer) {
3996 12 : if (NumComponentsOnBranch == 1) {
3997 12 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Bypass;
3998 0 : } else if (NumComponentsOnBranch > 1) {
3999 0 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Passive;
4000 : } else {
4001 0 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Bypass;
4002 : }
4003 : } else {
4004 27 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Passive;
4005 : }
4006 39 : } break;
4007 1 : case DataPlant::PlantEquipmentType::PipeExterior: { // = 23
4008 1 : this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
4009 1 : this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
4010 1 : if (BranchIsInSplitterMixer) {
4011 1 : if (NumComponentsOnBranch == 1) {
4012 0 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Bypass;
4013 1 : } else if (NumComponentsOnBranch > 1) {
4014 1 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Passive;
4015 : } else {
4016 0 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Bypass;
4017 : }
4018 : } else {
4019 0 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Passive;
4020 : }
4021 1 : } break;
4022 2 : case DataPlant::PlantEquipmentType::PipeInterior: { // = 24
4023 2 : this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
4024 2 : this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
4025 2 : if (BranchIsInSplitterMixer) {
4026 2 : if (NumComponentsOnBranch == 1) {
4027 0 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Bypass;
4028 2 : } else if (NumComponentsOnBranch > 1) {
4029 2 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Passive;
4030 : } else {
4031 0 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Bypass;
4032 : }
4033 : } else {
4034 0 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Passive;
4035 : }
4036 2 : } break;
4037 1 : case DataPlant::PlantEquipmentType::PipeUnderground: { // = 25
4038 1 : this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
4039 1 : this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
4040 1 : if (BranchIsInSplitterMixer) {
4041 1 : if (NumComponentsOnBranch == 1) {
4042 0 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Bypass;
4043 1 : } else if (NumComponentsOnBranch > 1) {
4044 1 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Passive;
4045 : } else {
4046 0 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Bypass;
4047 : }
4048 : } else {
4049 0 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Passive;
4050 : }
4051 1 : } break;
4052 133 : case DataPlant::PlantEquipmentType::PurchChilledWater: { // = 26
4053 133 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4054 133 : this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
4055 133 : this_component.HowLoadServed = DataPlant::HowMet::ByNominalCapLowOutLimit;
4056 133 : } break;
4057 144 : case DataPlant::PlantEquipmentType::PurchHotWater: { // = 27
4058 144 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4059 144 : this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
4060 144 : this_component.HowLoadServed = DataPlant::HowMet::ByNominalCapHiOutLimit;
4061 144 : } break;
4062 1 : case DataPlant::PlantEquipmentType::PurchSteam: { //
4063 1 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4064 1 : } break;
4065 7 : case DataPlant::PlantEquipmentType::TS_IceDetailed: { // = 28
4066 7 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4067 7 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyIfLoopOn;
4068 7 : this_component.HowLoadServed = DataPlant::HowMet::PassiveCap;
4069 7 : } break;
4070 2 : case DataPlant::PlantEquipmentType::TS_IceSimple: { // = 29
4071 2 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4072 2 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyIfLoopOn;
4073 2 : this_component.HowLoadServed = DataPlant::HowMet::PassiveCap;
4074 2 : } break;
4075 2 : case DataPlant::PlantEquipmentType::ValveTempering: { // = 30
4076 2 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4077 2 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyIfLoopOn;
4078 2 : this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
4079 2 : } break;
4080 133 : case DataPlant::PlantEquipmentType::WtrHeaterMixed: { // = 31
4081 133 : if (LoopSideCtr == LoopSideLocation::Demand) {
4082 2 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4083 2 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
4084 2 : this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
4085 : } else {
4086 131 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4087 131 : this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
4088 131 : this_component.HowLoadServed = DataPlant::HowMet::PassiveCap;
4089 : }
4090 133 : } break;
4091 3 : case DataPlant::PlantEquipmentType::WtrHeaterStratified: { // = 32
4092 3 : if (LoopSideCtr == LoopSideLocation::Demand) {
4093 1 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4094 1 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
4095 1 : this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
4096 : } else {
4097 2 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4098 2 : this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
4099 2 : this_component.HowLoadServed = DataPlant::HowMet::PassiveCap;
4100 : }
4101 3 : } break;
4102 952 : case DataPlant::PlantEquipmentType::PumpVariableSpeed: { // = 33
4103 952 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4104 952 : this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
4105 952 : this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
4106 952 : } break;
4107 212 : case DataPlant::PlantEquipmentType::PumpConstantSpeed: { // = 34
4108 212 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4109 212 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyIfLoopOn;
4110 212 : this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
4111 212 : } break;
4112 9 : case DataPlant::PlantEquipmentType::PumpCondensate: { // = 35
4113 9 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4114 9 : this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
4115 9 : this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
4116 9 : } break;
4117 6 : case DataPlant::PlantEquipmentType::PumpBankVariableSpeed: { // = 36
4118 6 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4119 6 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyIfLoopOn;
4120 6 : this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
4121 6 : } break;
4122 1 : case DataPlant::PlantEquipmentType::PumpBankConstantSpeed: { // = 37
4123 1 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4124 1 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyIfLoopOn;
4125 1 : this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
4126 1 : } break;
4127 1050 : case DataPlant::PlantEquipmentType::WaterUseConnection: { // = 38
4128 1050 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4129 1050 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
4130 1050 : this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
4131 1050 : } break;
4132 434 : case DataPlant::PlantEquipmentType::CoilWaterCooling: { // = 39 ! demand side component
4133 434 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4134 434 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
4135 434 : this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
4136 434 : } break;
4137 162 : case DataPlant::PlantEquipmentType::CoilWaterDetailedFlatCooling: { // = 40 ! demand side component
4138 162 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4139 162 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
4140 162 : this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
4141 162 : } break;
4142 2755 : case DataPlant::PlantEquipmentType::CoilWaterSimpleHeating: { // = 41 ! demand side component
4143 2755 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4144 2755 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
4145 2755 : this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
4146 2755 : } break;
4147 20 : case DataPlant::PlantEquipmentType::CoilSteamAirHeating: { // = 42 ! demand side component
4148 20 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4149 20 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
4150 20 : this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
4151 20 : } break;
4152 8 : case DataPlant::PlantEquipmentType::SolarCollectorFlatPlate: { // = 43 ! demand side component
4153 8 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4154 8 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
4155 8 : this_component.HowLoadServed = DataPlant::HowMet::PassiveCap;
4156 8 : } break;
4157 28 : case DataPlant::PlantEquipmentType::PlantLoadProfile: { // = 44 ! demand side component
4158 28 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4159 28 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
4160 28 : this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
4161 28 : } break;
4162 23 : case DataPlant::PlantEquipmentType::GrndHtExchgSystem: { // = 45
4163 23 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4164 23 : this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
4165 23 : this_component.HowLoadServed = DataPlant::HowMet::PassiveCap;
4166 23 : } break;
4167 1 : case DataPlant::PlantEquipmentType::GrndHtExchgSurface: { // = 46
4168 1 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4169 1 : this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
4170 1 : this_component.HowLoadServed = DataPlant::HowMet::PassiveCap;
4171 1 : } break;
4172 3 : case DataPlant::PlantEquipmentType::GrndHtExchgPond: { // = 47
4173 3 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4174 3 : this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
4175 3 : this_component.HowLoadServed = DataPlant::HowMet::PassiveCap;
4176 3 : } break;
4177 2 : case DataPlant::PlantEquipmentType::Generator_MicroTurbine: { // = 48 !newer FSEC turbine
4178 2 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4179 2 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
4180 2 : this_component.HowLoadServed = DataPlant::HowMet::ByNominalCap;
4181 2 : } break;
4182 3 : case DataPlant::PlantEquipmentType::Generator_ICEngine: { // = 49
4183 3 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4184 3 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
4185 3 : this_component.HowLoadServed = DataPlant::HowMet::ByNominalCap;
4186 3 : } break;
4187 3 : case DataPlant::PlantEquipmentType::Generator_CTurbine: { // = 50 !older BLAST turbine
4188 3 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4189 3 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
4190 3 : this_component.HowLoadServed = DataPlant::HowMet::ByNominalCap;
4191 3 : } break;
4192 2 : case DataPlant::PlantEquipmentType::Generator_MicroCHP: { // = 51
4193 2 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4194 2 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
4195 2 : this_component.HowLoadServed = DataPlant::HowMet::ByNominalCap;
4196 2 : } break;
4197 0 : case DataPlant::PlantEquipmentType::Generator_FCStackCooler: { // = 52
4198 0 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4199 0 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
4200 0 : this_component.HowLoadServed = DataPlant::HowMet::ByNominalCap;
4201 0 : } break;
4202 1 : case DataPlant::PlantEquipmentType::FluidCooler_SingleSpd: { // = 53
4203 1 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4204 1 : this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
4205 1 : this_component.HowLoadServed = DataPlant::HowMet::PassiveCap;
4206 1 : } break;
4207 5 : case DataPlant::PlantEquipmentType::FluidCooler_TwoSpd: { // = 54
4208 5 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4209 5 : this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
4210 5 : this_component.HowLoadServed = DataPlant::HowMet::PassiveCap;
4211 5 : } break;
4212 1 : case DataPlant::PlantEquipmentType::EvapFluidCooler_SingleSpd: { // = 55
4213 1 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4214 1 : this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
4215 1 : this_component.HowLoadServed = DataPlant::HowMet::PassiveCap;
4216 1 : } break;
4217 2 : case DataPlant::PlantEquipmentType::EvapFluidCooler_TwoSpd: { // = 56
4218 2 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4219 2 : this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
4220 2 : this_component.HowLoadServed = DataPlant::HowMet::PassiveCap;
4221 2 : } break;
4222 7 : case DataPlant::PlantEquipmentType::ChilledWaterTankMixed: { // = 57
4223 7 : if (LoopSideCtr == LoopSideLocation::Demand) {
4224 3 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4225 3 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
4226 3 : this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
4227 : } else {
4228 4 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4229 4 : this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
4230 4 : this_component.HowLoadServed = DataPlant::HowMet::PassiveCap;
4231 : }
4232 7 : } break;
4233 3 : case DataPlant::PlantEquipmentType::ChilledWaterTankStratified: { // = 58
4234 3 : if (LoopSideCtr == LoopSideLocation::Demand) {
4235 1 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4236 1 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
4237 1 : this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
4238 : } else {
4239 2 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4240 2 : this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
4241 2 : this_component.HowLoadServed = DataPlant::HowMet::PassiveCap;
4242 : }
4243 3 : } break;
4244 10 : case DataPlant::PlantEquipmentType::PVTSolarCollectorFlatPlate: { // = 59
4245 10 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4246 10 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
4247 10 : this_component.HowLoadServed = DataPlant::HowMet::PassiveCap;
4248 : // next batch for ZoneHVAC
4249 10 : } break;
4250 31 : case DataPlant::PlantEquipmentType::Baseboard_Conv_Water: { // = 60
4251 31 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4252 31 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
4253 31 : this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
4254 31 : } break;
4255 2 : case DataPlant::PlantEquipmentType::Baseboard_Rad_Conv_Steam: { // = 61
4256 2 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4257 2 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
4258 2 : this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
4259 2 : } break;
4260 17 : case DataPlant::PlantEquipmentType::Baseboard_Rad_Conv_Water: { // = 62
4261 17 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4262 17 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
4263 17 : this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
4264 17 : } break;
4265 4 : case DataPlant::PlantEquipmentType::CoolingPanel_Simple: {
4266 4 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4267 4 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
4268 4 : this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
4269 4 : } break;
4270 89 : case DataPlant::PlantEquipmentType::LowTempRadiant_VarFlow: {
4271 89 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4272 89 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
4273 89 : this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
4274 89 : } break;
4275 51 : case DataPlant::PlantEquipmentType::LowTempRadiant_ConstFlow: {
4276 51 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4277 51 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
4278 51 : this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
4279 51 : } break;
4280 5 : case DataPlant::PlantEquipmentType::CooledBeamAirTerminal: {
4281 5 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4282 5 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
4283 5 : this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
4284 5 : } break;
4285 60 : case DataPlant::PlantEquipmentType::FourPipeBeamAirTerminal: {
4286 60 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4287 60 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
4288 60 : this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
4289 60 : } break;
4290 265 : case DataPlant::PlantEquipmentType::CoilWAHPHeatingEquationFit: {
4291 265 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4292 265 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
4293 265 : this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
4294 265 : } break;
4295 265 : case DataPlant::PlantEquipmentType::CoilWAHPCoolingEquationFit: {
4296 265 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4297 265 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
4298 265 : this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
4299 265 : } break;
4300 18 : case DataPlant::PlantEquipmentType::CoilVSWAHPHeatingEquationFit: {
4301 18 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4302 18 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
4303 18 : this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
4304 18 : } break;
4305 18 : case DataPlant::PlantEquipmentType::CoilVSWAHPCoolingEquationFit: {
4306 18 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4307 18 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
4308 18 : this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
4309 18 : } break;
4310 19 : case DataPlant::PlantEquipmentType::CoilWAHPHeatingParamEst: {
4311 19 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4312 19 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
4313 19 : this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
4314 19 : } break;
4315 19 : case DataPlant::PlantEquipmentType::CoilWAHPCoolingParamEst: {
4316 19 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4317 19 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
4318 19 : this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
4319 19 : } break;
4320 1 : case DataPlant::PlantEquipmentType::RefrigSystemWaterCondenser: {
4321 1 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4322 1 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
4323 1 : this_component.HowLoadServed = DataPlant::HowMet::PassiveCap;
4324 1 : } break;
4325 1 : case DataPlant::PlantEquipmentType::RefrigerationWaterCoolRack: {
4326 1 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4327 1 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
4328 1 : this_component.HowLoadServed = DataPlant::HowMet::PassiveCap;
4329 1 : } break;
4330 0 : case DataPlant::PlantEquipmentType::MultiSpeedHeatPumpRecovery: {
4331 0 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4332 0 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
4333 0 : this_component.HowLoadServed = DataPlant::HowMet::PassiveCap;
4334 0 : } break;
4335 0 : case DataPlant::PlantEquipmentType::UnitarySysRecovery: {
4336 0 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4337 0 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
4338 0 : this_component.HowLoadServed = DataPlant::HowMet::PassiveCap;
4339 0 : } break;
4340 4 : case DataPlant::PlantEquipmentType::PipingSystemPipeCircuit: {
4341 4 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4342 4 : this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
4343 4 : this_component.HowLoadServed = DataPlant::HowMet::PassiveCap;
4344 4 : } break;
4345 2 : case DataPlant::PlantEquipmentType::SolarCollectorICS: { // = 75
4346 2 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4347 2 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
4348 2 : this_component.HowLoadServed = DataPlant::HowMet::PassiveCap;
4349 2 : } break;
4350 2 : case DataPlant::PlantEquipmentType::PlantComponentUserDefined: {
4351 2 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4352 2 : this_component.FlowPriority = DataPlant::LoopFlowStatus::Invalid;
4353 2 : this_component.HowLoadServed = DataPlant::HowMet::Invalid;
4354 2 : } break;
4355 6 : case DataPlant::PlantEquipmentType::CoilUserDefined: {
4356 6 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4357 6 : this_component.FlowPriority = DataPlant::LoopFlowStatus::Invalid;
4358 6 : this_component.HowLoadServed = DataPlant::HowMet::Invalid;
4359 6 : } break;
4360 0 : case DataPlant::PlantEquipmentType::ZoneHVACAirUserDefined: {
4361 0 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4362 0 : this_component.FlowPriority = DataPlant::LoopFlowStatus::Invalid;
4363 0 : this_component.HowLoadServed = DataPlant::HowMet::Invalid;
4364 0 : } break;
4365 10 : case DataPlant::PlantEquipmentType::AirTerminalUserDefined: {
4366 10 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4367 10 : this_component.FlowPriority = DataPlant::LoopFlowStatus::Invalid;
4368 10 : this_component.HowLoadServed = DataPlant::HowMet::Invalid;
4369 10 : } break;
4370 1 : case DataPlant::PlantEquipmentType::HeatPumpVRF: { // = 82 ! AirConditioner:VariableRefrigerantFlow
4371 1 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4372 :
4373 1 : if (LoopSideCtr == LoopSideLocation::Demand) {
4374 1 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
4375 1 : this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
4376 : } else { // should never happen
4377 0 : this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
4378 0 : this_component.HowLoadServed = DataPlant::HowMet::PassiveCap;
4379 : }
4380 1 : } break;
4381 1 : case DataPlant::PlantEquipmentType::WaterSource: {
4382 1 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4383 1 : this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
4384 1 : this_component.HowLoadServed = DataPlant::HowMet::ByNominalCapLowOutLimit;
4385 1 : } break;
4386 1 : case DataPlant::PlantEquipmentType::GrndHtExchgHorizTrench: { // = 83 GroundHeatExchanger:HorizontalTrench
4387 1 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4388 1 : this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
4389 1 : this_component.HowLoadServed = DataPlant::HowMet::PassiveCap;
4390 1 : } break;
4391 66 : case DataPlant::PlantEquipmentType::FluidToFluidPlantHtExchg: { // = 84
4392 66 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4393 66 : if (LoopSideCtr == LoopSideLocation::Demand) {
4394 33 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
4395 33 : this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
4396 : } else {
4397 33 : this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
4398 33 : this_component.HowLoadServed = DataPlant::HowMet::PassiveCap;
4399 : }
4400 66 : } break;
4401 6 : case DataPlant::PlantEquipmentType::CentralGroundSourceHeatPump: { // 86
4402 6 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4403 6 : if (LoopSideCtr == LoopSideLocation::Demand) {
4404 2 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
4405 2 : this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
4406 : } else {
4407 4 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyIfLoopOn;
4408 4 : this_component.HowLoadServed = DataPlant::HowMet::ByNominalCap;
4409 : }
4410 6 : } break;
4411 1 : case DataPlant::PlantEquipmentType::PackagedTESCoolingCoil: { // 88
4412 1 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4413 1 : this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
4414 1 : this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
4415 1 : } break;
4416 2 : case DataPlant::PlantEquipmentType::SwimmingPool_Indoor: { // 90
4417 2 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4418 2 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
4419 2 : this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
4420 2 : } break;
4421 1 : case DataPlant::PlantEquipmentType::GrndHtExchgSlinky: { // = 91
4422 1 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4423 1 : this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
4424 1 : this_component.HowLoadServed = DataPlant::HowMet::PassiveCap;
4425 1 : } break;
4426 23 : case DataPlant::PlantEquipmentType::HeatPumpEIRCooling:
4427 : case PlantEquipmentType::HeatPumpEIRHeating: { // 95, 96
4428 23 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4429 23 : if (LoopSideCtr == LoopSideLocation::Demand) {
4430 5 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
4431 5 : this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
4432 : } else {
4433 18 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyIfLoopOn;
4434 18 : this_component.HowLoadServed = DataPlant::HowMet::ByNominalCap;
4435 : }
4436 23 : } break;
4437 2 : case DataPlant::PlantEquipmentType::HeatPumpFuelFiredCooling:
4438 : case PlantEquipmentType::HeatPumpFuelFiredHeating: {
4439 2 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4440 2 : if (LoopSideCtr == LoopSideLocation::Demand) {
4441 0 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
4442 0 : this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
4443 : } else {
4444 2 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyIfLoopOn;
4445 2 : this_component.HowLoadServed = DataPlant::HowMet::ByNominalCap;
4446 : }
4447 2 : } break;
4448 14 : case DataPlant::PlantEquipmentType::Chiller_ElectricASHRAE205: {
4449 14 : this_component.FlowCtrl = DataBranchAirLoopPlant::ControlType::Active;
4450 14 : if (LoopSideCtr == LoopSideLocation::Demand) {
4451 9 : this_component.FlowPriority = DataPlant::LoopFlowStatus::NeedyAndTurnsLoopOn;
4452 9 : this_component.HowLoadServed = DataPlant::HowMet::NoneDemand;
4453 : } else {
4454 5 : this_component.FlowPriority = DataPlant::LoopFlowStatus::TakesWhatGets;
4455 5 : this_component.HowLoadServed = DataPlant::HowMet::ByNominalCapLowOutLimit;
4456 : }
4457 14 : } break;
4458 0 : default: {
4459 0 : ShowSevereError(state, "SetBranchControlTypes: Caught unexpected equipment type of number");
4460 0 : } break;
4461 : }
4462 : }
4463 : }
4464 : }
4465 : }
4466 :
4467 : // now set up branch control types based on components.
4468 :
4469 801 : if (allocated(state.dataPlnt->PlantLoop)) {
4470 801 : NumCount = size(state.dataPlnt->PlantLoop);
4471 : } else {
4472 0 : NumCount = 0;
4473 : }
4474 1959 : for (LoopCtr = 1; LoopCtr <= NumCount; ++LoopCtr) { // SIZE(PlantLoop)
4475 3474 : for (DataPlant::LoopSideLocation LoopSideCtr : DataPlant::LoopSideKeys) {
4476 16272 : for (BranchCtr = 1; BranchCtr <= state.dataPlnt->PlantLoop(LoopCtr).LoopSide(LoopSideCtr).TotalBranches; ++BranchCtr) {
4477 13956 : ActiveCount = 0;
4478 13956 : BypassCount = 0;
4479 27998 : for (CompCtr = 1; CompCtr <= isize(state.dataPlnt->PlantLoop(LoopCtr).LoopSide(LoopSideCtr).Branch(BranchCtr).Comp); ++CompCtr) {
4480 14042 : ComponentFlowCtrl = state.dataPlnt->PlantLoop(LoopCtr).LoopSide(LoopSideCtr).Branch(BranchCtr).Comp(CompCtr).FlowCtrl;
4481 :
4482 14042 : switch (ComponentFlowCtrl) {
4483 0 : case DataBranchAirLoopPlant::ControlType::Invalid: {
4484 0 : state.dataPlnt->PlantLoop(LoopCtr).LoopSide(LoopSideCtr).Branch(BranchCtr).controlType =
4485 : DataBranchAirLoopPlant::ControlType::Passive;
4486 0 : } break;
4487 8445 : case DataBranchAirLoopPlant::ControlType::Active: {
4488 8445 : ++ActiveCount;
4489 8445 : if (ActiveCount > 1) {
4490 : // assume multiple active components in series means branch is SeriesActive
4491 65 : state.dataPlnt->PlantLoop(LoopCtr).LoopSide(LoopSideCtr).Branch(BranchCtr).controlType =
4492 : DataBranchAirLoopPlant::ControlType::SeriesActive;
4493 : // assume all components on branch are to be SeriesActive as well
4494 204 : for (auto &e : state.dataPlnt->PlantLoop(LoopCtr).LoopSide(LoopSideCtr).Branch(BranchCtr).Comp) {
4495 139 : e.FlowCtrl = DataBranchAirLoopPlant::ControlType::SeriesActive;
4496 : }
4497 : } else {
4498 8380 : state.dataPlnt->PlantLoop(LoopCtr).LoopSide(LoopSideCtr).Branch(BranchCtr).controlType =
4499 : DataBranchAirLoopPlant::ControlType::Active;
4500 : }
4501 :
4502 8445 : if (BypassCount > 0) {
4503 0 : ShowSevereError(state, "An active component is on the same branch as a pipe situated between splitter/mixer");
4504 0 : ShowContinueError(state,
4505 0 : "Occurs in Branch=" + state.dataPlnt->PlantLoop(LoopCtr).LoopSide(LoopSideCtr).Branch(BranchCtr).Name);
4506 0 : ShowContinueError(state, "Occurs in Plant Loop=" + state.dataPlnt->PlantLoop(LoopCtr).Name);
4507 0 : ShowContinueError(state, "SetupBranchControlTypes: and the simulation continues");
4508 : // note not sure why this is so bad. heat transfer pipe might be a good reason to allow this?
4509 : // this used to fatal in older PlantFlowResolver.
4510 : }
4511 :
4512 : // test for active component in series with bypass
4513 8445 : } break;
4514 2172 : case DataBranchAirLoopPlant::ControlType::Bypass: {
4515 2172 : ++BypassCount;
4516 2172 : state.dataPlnt->PlantLoop(LoopCtr).LoopSide(LoopSideCtr).Branch(BranchCtr).controlType =
4517 : DataBranchAirLoopPlant::ControlType::Bypass;
4518 2172 : state.dataPlnt->PlantLoop(LoopCtr).LoopSide(LoopSideCtr).Branch(BranchCtr).IsBypass = true;
4519 2172 : state.dataPlnt->PlantLoop(LoopCtr).LoopSide(LoopSideCtr).BypassExists = true;
4520 :
4521 2172 : if (CompCtr > 1) {
4522 0 : ShowSevereError(state, "A pipe used as a bypass should not be in series with another component");
4523 0 : ShowContinueError(
4524 0 : state, "Occurs in Branch = " + state.dataPlnt->PlantLoop(LoopCtr).LoopSide(LoopSideCtr).Branch(BranchCtr).Name);
4525 0 : ShowContinueError(state, "Occurs in PlantLoop = " + state.dataPlnt->PlantLoop(LoopCtr).Name);
4526 0 : ShowFatalError(state, "SetupBranchControlTypes: preceding condition causes termination.");
4527 : }
4528 2172 : } break;
4529 3417 : case DataBranchAirLoopPlant::ControlType::Passive: {
4530 3417 : if (ActiveCount > 0) {
4531 : // do nothing, branch set before)
4532 : } else {
4533 3407 : if (BypassCount > 0) {
4534 :
4535 : } else {
4536 3407 : state.dataPlnt->PlantLoop(LoopCtr).LoopSide(LoopSideCtr).Branch(BranchCtr).controlType =
4537 : DataBranchAirLoopPlant::ControlType::Passive;
4538 : }
4539 : }
4540 3417 : } break;
4541 8 : case DataBranchAirLoopPlant::ControlType::SeriesActive: {
4542 : // do nothing, already set when more than one active component found on a branch
4543 8 : } break;
4544 0 : default:
4545 0 : break;
4546 : }
4547 : }
4548 : }
4549 : }
4550 : }
4551 801 : }
4552 :
4553 801 : void CheckIfAnyPlant(EnergyPlusData &state)
4554 : {
4555 :
4556 : // SUBROUTINE INFORMATION:
4557 : // AUTHOR Brent Griffith
4558 : // DATE WRITTEN Sept 2010
4559 : // MODIFIED na
4560 : // RE-ENGINEERED na
4561 :
4562 : // PURPOSE OF THIS SUBROUTINE:
4563 : // determine if any plant loops will be ever be set up
4564 :
4565 : // METHODOLOGY EMPLOYED:
4566 : // use input processor to find number of plant loops
4567 :
4568 : // Using/Aliasing
4569 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
4570 : int numPlantLoopsCheck;
4571 : int numCondenserLoopsCheck;
4572 801 : auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject;
4573 801 : cCurrentModuleObject = "PlantLoop";
4574 801 : numPlantLoopsCheck = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject);
4575 :
4576 801 : cCurrentModuleObject = "CondenserLoop";
4577 801 : numCondenserLoopsCheck = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject);
4578 :
4579 801 : if ((numPlantLoopsCheck + numCondenserLoopsCheck) > 0) {
4580 463 : state.dataGlobal->AnyPlantInModel = true;
4581 : } else {
4582 338 : state.dataGlobal->AnyPlantInModel = false;
4583 338 : state.dataPlnt->PlantLoop.allocate(0);
4584 : }
4585 801 : }
4586 :
4587 799 : void CheckOngoingPlantWarnings(EnergyPlusData &state)
4588 : {
4589 : int LoopNum;
4590 1955 : for (LoopNum = 1; LoopNum <= state.dataPlnt->TotNumLoops; ++LoopNum) {
4591 : // Warning if the excess storage time is more than half of the total time
4592 1156 : if (state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).LoopSideInlet_CapExcessStorageTime >
4593 1156 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).LoopSideInlet_TotalTime / 2) {
4594 0 : ShowWarningError(
4595 0 : state, "Plant Loop: " + state.dataPlnt->PlantLoop(LoopNum).Name + " Demand Side is storing excess heat the majority of the time.");
4596 0 : ShowContinueError(state,
4597 0 : format("Excess Storage Time={:.2R}[hr], Total Loop Active Time={:.2R}[hr]",
4598 0 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).LoopSideInlet_CapExcessStorageTime,
4599 0 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).LoopSideInlet_TotalTime));
4600 : }
4601 1156 : if (state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).LoopSideInlet_CapExcessStorageTime >
4602 1156 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).LoopSideInlet_TotalTime / 2) {
4603 12 : ShowWarningError(
4604 12 : state, "Plant Loop: " + state.dataPlnt->PlantLoop(LoopNum).Name + " Supply Side is storing excess heat the majority of the time.");
4605 12 : ShowContinueError(state,
4606 12 : format("Excess Storage Time={:.2R}[hr], Total Loop Active Time={:.2R}[hr]",
4607 6 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Supply).LoopSideInlet_CapExcessStorageTime,
4608 6 : state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideLocation::Demand).LoopSideInlet_TotalTime));
4609 : }
4610 : }
4611 799 : }
4612 :
4613 0 : void EmptyPlantComponent::oneTimeInit([[maybe_unused]] EnergyPlusData &state)
4614 : {
4615 0 : }
4616 463 : void EmptyPlantComponent::oneTimeInit_new([[maybe_unused]] EnergyPlusData &state)
4617 : {
4618 463 : }
4619 : } // namespace EnergyPlus::PlantManager
|