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