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