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