Line data Source code
1 : // EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois,
2 : // The Regents of the University of California, through Lawrence Berkeley National Laboratory
3 : // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge
4 : // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other
5 : // contributors. All rights reserved.
6 : //
7 : // NOTICE: This Software was developed under funding from the U.S. Department of Energy and the
8 : // U.S. Government consequently retains certain rights. As such, the U.S. Government has been
9 : // granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable,
10 : // worldwide license in the Software to reproduce, distribute copies to the public, prepare
11 : // derivative works, and perform publicly and display publicly, and to permit others to do so.
12 : //
13 : // Redistribution and use in source and binary forms, with or without modification, are permitted
14 : // provided that the following conditions are met:
15 : //
16 : // (1) Redistributions of source code must retain the above copyright notice, this list of
17 : // conditions and the following disclaimer.
18 : //
19 : // (2) Redistributions in binary form must reproduce the above copyright notice, this list of
20 : // conditions and the following disclaimer in the documentation and/or other materials
21 : // provided with the distribution.
22 : //
23 : // (3) Neither the name of the University of California, Lawrence Berkeley National Laboratory,
24 : // the University of Illinois, U.S. Dept. of Energy nor the names of its contributors may be
25 : // used to endorse or promote products derived from this software without specific prior
26 : // written permission.
27 : //
28 : // (4) Use of EnergyPlus(TM) Name. If Licensee (i) distributes the software in stand-alone form
29 : // without changes from the version obtained under this License, or (ii) Licensee makes a
30 : // reference solely to the software portion of its product, Licensee must refer to the
31 : // software as "EnergyPlus version X" software, where "X" is the version number Licensee
32 : // obtained under this License and may not use a different name for the software. Except as
33 : // specifically required in this Section (4), Licensee shall not use in a company name, a
34 : // product name, in advertising, publicity, or other promotional activities any name, trade
35 : // name, trademark, logo, or other designation of "EnergyPlus", "E+", "e+" or confusingly
36 : // similar designation, without the U.S. Department of Energy's prior written consent.
37 : //
38 : // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
39 : // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
40 : // AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
41 : // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
42 : // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
43 : // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
44 : // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
45 : // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
46 : // POSSIBILITY OF SUCH DAMAGE.
47 :
48 : #ifndef PlantTopologyLoopSide_hh_INCLUDED
49 : #define PlantTopologyLoopSide_hh_INCLUDED
50 :
51 : #include <EnergyPlus/DataLoopNode.hh>
52 : #include <EnergyPlus/Plant/Branch.hh>
53 : #include <EnergyPlus/Plant/ConnectedLoopData.hh>
54 : #include <EnergyPlus/Plant/LoopSidePumpInformation.hh>
55 : #include <EnergyPlus/Plant/MixerData.hh>
56 : #include <EnergyPlus/Plant/PlantConvergencePoint.hh>
57 : #include <EnergyPlus/Plant/SplitterData.hh>
58 :
59 : #include <ObjexxFCL/Optional.hh>
60 :
61 : namespace EnergyPlus {
62 :
63 : // Forward declarations
64 : struct EnergyPlusData;
65 :
66 : namespace DataPlant {
67 :
68 : struct HalfLoopData
69 : {
70 : // Members
71 : bool SimLoopSideNeeded; // Determine whether or not to re-simulate this plant LoopSide
72 : bool SimZoneEquipNeeded; // Plant requests resimulate zone HVAC equipment
73 : bool SimAirLoopsNeeded; // Plant requests resimulate air loop HVAC equipment
74 : bool SimNonZoneEquipNeeded; // Plant requests resimulate non zone Equip
75 : bool SimElectLoadCentrNeeded; // Plant requests resimulate generators
76 : bool OncePerTimeStepOperations;
77 : Real64 TimeElapsed; // store time for dynamic updates for last time
78 : Real64 FlowRequest; // Flow request in the half loop
79 : Real64 FlowRequestTemperature; // Average Flow request outlet Temp in the half loop
80 : // It's necessary to hold the values here since AIR and GROUND SPs aren't associated with either a node or a SP manager
81 : Real64 TempSetPoint; // Loop temperature setpoint
82 : Real64 TempSetPointHi; // High Loop temperature setpoint
83 : Real64 TempSetPointLo; // Low Loop temperature setpoint
84 : Real64 TempInterfaceTankOutlet; // Used by interface manager in common pipe simulation
85 : // This is the temperature at the loop outlet linterface
86 : // with half-loop capacitance and pump heat accounted for.
87 : Real64 LastTempInterfaceTankOutlet;
88 : std::string BranchList; // Branch list name for the half loop
89 : std::string ConnectList; // Connector list name for the half loop
90 : int TotalBranches; // Total number of branches on the half loop
91 : int NodeNumIn; // Node number for the inlet to this loop
92 : std::string NodeNameIn; // Node name for the inlet to this loop
93 : int NodeNumOut; // Node number for the outlet to this loop
94 : std::string NodeNameOut; // Node name for the outlet to this loop
95 : int TotalPumps; // total number of pumps on the half loop
96 : bool BranchPumpsExist; // logical flag indication branch pumps exist on half loop
97 : Array1D<LoopSidePumpInformation> Pumps;
98 : Real64 TotalPumpHeat; // [W] total heat addition by the pumps to place in "tank"
99 : bool BypassExists;
100 : bool InletNodeSetPt;
101 : bool OutletNodeSetPt;
102 : bool EMSCtrl;
103 : Real64 EMSValue;
104 : bool FlowRestrictionFlag; // Max available flow at the outlet of the half loop
105 : // is less than max available flow at inlet
106 : DataPlant::FlowLock FlowLock;
107 : int TotalConnected; // total number of other loops connected to this loop side
108 : Array1D<ConnectedLoopData> Connected; // Other loops connected to this Loop side
109 : Array1D<BranchData> Branch; // Branch data
110 : SplitterData Splitter; // Data for splitter on branch (if any)
111 : MixerData Mixer; // Data for splitter on branch (if any)
112 : bool HasPressureComponents;
113 : bool HasParallelPressComps;
114 : Real64 PressureDrop;
115 : Real64 PressureEffectiveK;
116 : int errCount_LoadWasntDist;
117 : int errIndex_LoadWasntDist;
118 : int errCount_LoadRemains;
119 : int errIndex_LoadRemains;
120 : Real64 LoopSideInlet_TankTemp;
121 : Real64 LoopSideInlet_MdotCpDeltaT;
122 : Real64 LoopSideInlet_McpDTdt;
123 : Real64 LoopSideInlet_CapExcessStorageTime;
124 : Real64 LoopSideInlet_CapExcessStorageTimeReport;
125 : Real64 LoopSideInlet_TotalTime;
126 : PlantConvergencePoint InletNode;
127 : PlantConvergencePoint OutletNode;
128 : Real64 flowRequestNeedIfOn;
129 : Real64 flowRequestNeedAndTurnOn;
130 : Real64 flowRequestFinal;
131 : bool hasConstSpeedBranchPumps;
132 : Array1D<Real64> noLoadConstantSpeedBranchFlowRateSteps;
133 : Real64 InitialDemandToLoopSetPoint;
134 : Real64 CurrentAlterationsToDemand;
135 : Real64 UpdatedDemandToLoopSetPoint;
136 : Real64 LoadToLoopSetPointThatWasntMet; // Unmet Demand
137 : Real64 InitialDemandToLoopSetPointSAVED;
138 : std::string loopSideDescription;
139 : // report variables
140 : Real64 LoopSetPtDemandAtInlet;
141 : Real64 ThisSideLoadAlterations;
142 : PlantLocation plantLoc;
143 : // Default Constructor
144 906 : HalfLoopData()
145 906 : : SimLoopSideNeeded(true), SimZoneEquipNeeded(true), SimAirLoopsNeeded(true), SimNonZoneEquipNeeded(true), SimElectLoadCentrNeeded(true),
146 906 : OncePerTimeStepOperations(true), TimeElapsed(0.0), FlowRequest(0.0), FlowRequestTemperature(0.0),
147 906 : TempSetPoint(DataLoopNode::SensedNodeFlagValue), TempSetPointHi(DataLoopNode::SensedNodeFlagValue),
148 1812 : TempSetPointLo(DataLoopNode::SensedNodeFlagValue), TempInterfaceTankOutlet(0.0), LastTempInterfaceTankOutlet(0.0), TotalBranches(0),
149 3624 : NodeNumIn(0), NodeNumOut(0), TotalPumps(0), BranchPumpsExist(false), TotalPumpHeat(0.0), BypassExists(false), InletNodeSetPt(false),
150 906 : OutletNodeSetPt(false), EMSCtrl(false), EMSValue(0.0), FlowRestrictionFlag(false), FlowLock(DataPlant::FlowLock::Unlocked),
151 1812 : TotalConnected(0), HasPressureComponents(false), HasParallelPressComps(false), PressureDrop(0.0), PressureEffectiveK(0.0),
152 906 : errCount_LoadWasntDist(0), errIndex_LoadWasntDist(0), errCount_LoadRemains(0), errIndex_LoadRemains(0), LoopSideInlet_TankTemp(0.0),
153 906 : LoopSideInlet_MdotCpDeltaT(0.0), LoopSideInlet_McpDTdt(0.0), LoopSideInlet_CapExcessStorageTime(0.0),
154 906 : LoopSideInlet_CapExcessStorageTimeReport(0.0), LoopSideInlet_TotalTime(0.0), InletNode(0.0, 0.0), OutletNode(0.0, 0.0),
155 906 : flowRequestNeedIfOn(0.0), flowRequestNeedAndTurnOn(0.0), flowRequestFinal(0.0), hasConstSpeedBranchPumps(false),
156 906 : InitialDemandToLoopSetPoint(0.0), CurrentAlterationsToDemand(0.0), UpdatedDemandToLoopSetPoint(0.0),
157 1812 : LoadToLoopSetPointThatWasntMet(0.0), InitialDemandToLoopSetPointSAVED(0.0), LoopSetPtDemandAtInlet(0.0),
158 1812 : ThisSideLoadAlterations(0.0), plantLoc{}
159 : {
160 906 : }
161 :
162 : void ValidateFlowControlPaths(EnergyPlusData &state);
163 :
164 : Real64 DetermineLoopSideFlowRate(EnergyPlusData &state, int ThisSideInletNode, Real64 ThisSideLoopFlowRequest);
165 :
166 : void SimulateAllLoopSideBranches(EnergyPlusData &state, Real64 ThisLoopSideFlow, bool FirstHVACIteration, bool &LoopShutDownFlag);
167 :
168 : void SimulateLoopSideBranchGroup(
169 : EnergyPlusData &state, int FirstBranchNum, int LastBranchNum, Real64 FlowRequest, bool FirstHVACIteration, bool &LoopShutDownFlag);
170 :
171 : void UpdatePlantSplitter(EnergyPlusData &state);
172 :
173 : void UpdatePlantMixer(EnergyPlusData &state);
174 :
175 : void TurnOnAllLoopSideBranches();
176 :
177 : void DisableAnyBranchPumpsConnectedToUnloadedEquipment();
178 :
179 : void DoFlowAndLoadSolutionPass(EnergyPlusData &state, LoopSideLocation OtherSide, int ThisSideInletNode, bool FirstHVACIteration);
180 :
181 : Real64 CalcOtherSideDemand(EnergyPlusData &state, Real64 ThisLoopSideFlow);
182 :
183 : Real64 SetupLoopFlowRequest(EnergyPlusData &state, const LoopSideLocation OtherSide);
184 :
185 : Real64 EvaluateLoopSetPointLoad(EnergyPlusData &state, int FirstBranchNum, int LastBranchNum, Real64 ThisLoopSideFlow);
186 :
187 : void ResolveParallelFlows(EnergyPlusData &state, Real64 ThisLoopSideFlow, bool FirstHVACIteration);
188 :
189 : void SimulateSinglePump(EnergyPlusData &state, PlantLocation SpecificPumpLocation, Real64 &SpecificPumpFlowRate);
190 :
191 : void UpdateAnyLoopDemandAlterations(EnergyPlusData &state, int BranchNum, int CompNum);
192 :
193 : void SimulateAllLoopSidePumps(EnergyPlusData &state,
194 : ObjexxFCL::Optional<PlantLocation const> SpecificPumpLocation = _,
195 : ObjexxFCL::Optional<Real64 const> SpecificPumpFlowRate = _);
196 :
197 : void AdjustPumpFlowRequestByEMSControls(int BranchNum, int CompNum, Real64 &FlowToRequest);
198 :
199 : void PushBranchFlowCharacteristics(EnergyPlusData &state,
200 : int BranchNum,
201 : Real64 ValueToPush,
202 : bool FirstHVACIteration // TRUE if First HVAC iteration of Time step
203 : );
204 :
205 : bool CheckPlantConvergence(bool FirstHVACIteration);
206 :
207 : void solve(EnergyPlusData &state, bool FirstHVACIteration, bool &ReSimOtherSideNeeded);
208 : };
209 : } // namespace DataPlant
210 : } // namespace EnergyPlus
211 :
212 : #endif
|