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 : #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 : namespace EnergyPlus {
60 :
61 : // Forward declarations
62 : struct EnergyPlusData;
63 :
64 : namespace DataPlant {
65 :
66 53108 : struct HalfLoopData
67 : {
68 : // Members
69 : bool SimLoopSideNeeded; // Determine whether or not to re-simulate this plant LoopSide
70 : bool SimZoneEquipNeeded; // Plant requests resimulate zone HVAC equipment
71 : bool SimAirLoopsNeeded; // Plant requests resimulate air loop HVAC equipment
72 : bool SimNonZoneEquipNeeded; // Plant requests resimulate non zone Equip
73 : bool SimElectLoadCentrNeeded; // Plant requests resimulate generators
74 : bool OncePerTimeStepOperations;
75 : Real64 TimeElapsed; // store time for dynamic updates for last time
76 : Real64 FlowRequest; // Flow request in the half loop
77 : Real64 FlowRequestTemperature; // Average Flow request outlet Temp in the half loop
78 : // It's necessary to hold the values here since AIR and GROUND SPs aren't associated with either a node or a SP manager
79 : Real64 TempSetPoint; // Loop temperature setpoint
80 : Real64 TempSetPointHi; // High Loop temperature setpoint
81 : Real64 TempSetPointLo; // Low Loop temperature setpoint
82 : Real64 TempInterfaceTankOutlet; // Used by interface manager in common pipe simulation
83 : // This is the temperature at the loop outlet linterface
84 : // with half-loop capacitance and pump heat accounted for.
85 : Real64 LastTempInterfaceTankOutlet;
86 : std::string BranchList; // Branch list name for the half loop
87 : std::string ConnectList; // Connector list name for the half loop
88 : int TotalBranches; // Total number of branches on the half loop
89 : int NodeNumIn; // Node number for the inlet to this loop
90 : std::string NodeNameIn; // Node name for the inlet to this loop
91 : int NodeNumOut; // Node number for the outlet to this loop
92 : std::string NodeNameOut; // Node name for the outlet to this loop
93 : int TotalPumps; // total number of pumps on the half loop
94 : bool BranchPumpsExist; // logical flag indication branch pumps exist on half loop
95 : Array1D<LoopSidePumpInformation> Pumps;
96 : Real64 TotalPumpHeat; // [W] total heat addition by the pumps to place in "tank"
97 : bool BypassExists;
98 : bool InletNodeSetPt;
99 : bool OutletNodeSetPt;
100 : bool EMSCtrl;
101 : Real64 EMSValue;
102 : bool FlowRestrictionFlag; // Max available flow at the outlet of the half loop
103 : // is less than max available flow at inlet
104 : DataPlant::FlowLock FlowLock;
105 : int TotalConnected; // total number of other loops connected to this loop side
106 : Array1D<ConnectedLoopData> Connected; // Other loops connected to this Loop side
107 : Array1D<BranchData> Branch; // Branch data
108 : SplitterData Splitter; // Data for splitter on branch (if any)
109 : MixerData Mixer; // Data for splitter on branch (if any)
110 : bool HasPressureComponents;
111 : bool HasParallelPressComps;
112 : Real64 PressureDrop;
113 : Real64 PressureEffectiveK;
114 : int errCount_LoadWasntDist;
115 : int errIndex_LoadWasntDist;
116 : int errCount_LoadRemains;
117 : int errIndex_LoadRemains;
118 : Real64 LoopSideInlet_TankTemp;
119 : Real64 LoopSideInlet_MdotCpDeltaT;
120 : Real64 LoopSideInlet_McpDTdt;
121 : Real64 LoopSideInlet_CapExcessStorageTime;
122 : Real64 LoopSideInlet_CapExcessStorageTimeReport;
123 : Real64 LoopSideInlet_TotalTime;
124 : PlantConvergencePoint InletNode;
125 : PlantConvergencePoint OutletNode;
126 : Real64 flowRequestNeedIfOn;
127 : Real64 flowRequestNeedAndTurnOn;
128 : Real64 flowRequestFinal;
129 : bool hasConstSpeedBranchPumps;
130 : Array1D<Real64> noLoadConstantSpeedBranchFlowRateSteps;
131 : Real64 InitialDemandToLoopSetPoint;
132 : Real64 CurrentAlterationsToDemand;
133 : Real64 UpdatedDemandToLoopSetPoint;
134 : Real64 LoadToLoopSetPointThatWasntMet; // Unmet Demand
135 : Real64 InitialDemandToLoopSetPointSAVED;
136 : std::string loopSideDescription;
137 : int refrigIndex; // Index denoting refrigerant used (possibly steam)
138 : // report variables
139 : Real64 LoopSetPtDemandAtInlet;
140 : Real64 ThisSideLoadAlterations;
141 : PlantLocation plantLoc;
142 : // Default Constructor
143 1542 : HalfLoopData()
144 1542 : : SimLoopSideNeeded(true), SimZoneEquipNeeded(true), SimAirLoopsNeeded(true), SimNonZoneEquipNeeded(true), SimElectLoadCentrNeeded(true),
145 : OncePerTimeStepOperations(true), TimeElapsed(0.0), FlowRequest(0.0), FlowRequestTemperature(0.0),
146 : TempSetPoint(DataLoopNode::SensedNodeFlagValue), TempSetPointHi(DataLoopNode::SensedNodeFlagValue),
147 : TempSetPointLo(DataLoopNode::SensedNodeFlagValue), TempInterfaceTankOutlet(0.0), LastTempInterfaceTankOutlet(0.0), TotalBranches(0),
148 : NodeNumIn(0), NodeNumOut(0), TotalPumps(0), BranchPumpsExist(false), TotalPumpHeat(0.0), BypassExists(false), InletNodeSetPt(false),
149 : OutletNodeSetPt(false), EMSCtrl(false), EMSValue(0.0), FlowRestrictionFlag(false), FlowLock(DataPlant::FlowLock::Unlocked),
150 : TotalConnected(0), HasPressureComponents(false), HasParallelPressComps(false), PressureDrop(0.0), PressureEffectiveK(0.0),
151 : errCount_LoadWasntDist(0), errIndex_LoadWasntDist(0), errCount_LoadRemains(0), errIndex_LoadRemains(0), LoopSideInlet_TankTemp(0.0),
152 : LoopSideInlet_MdotCpDeltaT(0.0), LoopSideInlet_McpDTdt(0.0), LoopSideInlet_CapExcessStorageTime(0.0),
153 : LoopSideInlet_CapExcessStorageTimeReport(0.0), LoopSideInlet_TotalTime(0.0), InletNode(0.0, 0.0), OutletNode(0.0, 0.0),
154 : flowRequestNeedIfOn(0.0), flowRequestNeedAndTurnOn(0.0), flowRequestFinal(0.0), hasConstSpeedBranchPumps(false),
155 : InitialDemandToLoopSetPoint(0.0), CurrentAlterationsToDemand(0.0), UpdatedDemandToLoopSetPoint(0.0),
156 : LoadToLoopSetPointThatWasntMet(0.0), InitialDemandToLoopSetPointSAVED(0.0), refrigIndex(0), LoopSetPtDemandAtInlet(0.0),
157 1542 : ThisSideLoadAlterations(0.0), plantLoc{}
158 : {
159 1542 : }
160 :
161 : void ValidateFlowControlPaths(EnergyPlusData &state);
162 :
163 : Real64 DetermineLoopSideFlowRate(EnergyPlusData &state, int ThisSideInletNode, Real64 ThisSideLoopFlowRequest);
164 :
165 : void SimulateAllLoopSideBranches(EnergyPlusData &state, Real64 ThisLoopSideFlow, bool FirstHVACIteration, bool &LoopShutDownFlag);
166 :
167 : void SimulateLoopSideBranchGroup(
168 : EnergyPlusData &state, int FirstBranchNum, int LastBranchNum, Real64 FlowRequest, bool FirstHVACIteration, bool &LoopShutDownFlag);
169 :
170 : void UpdatePlantSplitter(EnergyPlusData &state);
171 :
172 : void UpdatePlantMixer(EnergyPlusData &state);
173 :
174 : void TurnOnAllLoopSideBranches();
175 :
176 : void DisableAnyBranchPumpsConnectedToUnloadedEquipment();
177 :
178 : void DoFlowAndLoadSolutionPass(EnergyPlusData &state, LoopSideLocation OtherSide, int ThisSideInletNode, bool FirstHVACIteration);
179 :
180 : Real64 CalcOtherSideDemand(EnergyPlusData &state, Real64 ThisLoopSideFlow);
181 :
182 : Real64 SetupLoopFlowRequest(EnergyPlusData &state, const LoopSideLocation OtherSide);
183 :
184 : Real64 EvaluateLoopSetPointLoad(EnergyPlusData &state, int FirstBranchNum, int LastBranchNum, Real64 ThisLoopSideFlow);
185 :
186 : void ResolveParallelFlows(EnergyPlusData &state, Real64 ThisLoopSideFlow, bool FirstHVACIteration);
187 :
188 : void SimulateSinglePump(EnergyPlusData &state, PlantLocation SpecificPumpLocation, Real64 &SpecificPumpFlowRate);
189 :
190 : void UpdateAnyLoopDemandAlterations(EnergyPlusData &state, int BranchNum, int CompNum);
191 :
192 : void SimulateAllLoopSidePumps(EnergyPlusData &state,
193 : Optional<PlantLocation const> SpecificPumpLocation = _,
194 : Optional<Real64 const> SpecificPumpFlowRate = _);
195 :
196 : void AdjustPumpFlowRequestByEMSControls(int BranchNum, int CompNum, Real64 &FlowToRequest);
197 :
198 : void PushBranchFlowCharacteristics(EnergyPlusData &state,
199 : int BranchNum,
200 : Real64 ValueToPush,
201 : bool FirstHVACIteration // TRUE if First HVAC iteration of Time step
202 : );
203 :
204 : bool CheckPlantConvergence(bool FirstHVACIteration);
205 :
206 : void solve(EnergyPlusData &state, bool FirstHVACIteration, bool &ReSimOtherSideNeeded);
207 : };
208 : } // namespace DataPlant
209 : } // namespace EnergyPlus
210 :
211 : #endif
|