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