LCOV - code coverage report
Current view: top level - EnergyPlus/Plant - LoopSide.hh (source / functions) Hit Total Coverage
Test: lcov.output.filtered Lines: 16 16 100.0 %
Date: 2024-08-23 23:50:59 Functions: 1 1 100.0 %

          Line data    Source code
       1             : // EnergyPlus, Copyright (c) 1996-2024, 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             :         int refrigIndex; // Index denoting refrigerant used (possibly steam)
     140             :         // report variables
     141             :         Real64 LoopSetPtDemandAtInlet;
     142             :         Real64 ThisSideLoadAlterations;
     143             :         PlantLocation plantLoc;
     144             :         // Default Constructor
     145        1592 :         HalfLoopData()
     146        1592 :             : SimLoopSideNeeded(true), SimZoneEquipNeeded(true), SimAirLoopsNeeded(true), SimNonZoneEquipNeeded(true), SimElectLoadCentrNeeded(true),
     147        1592 :               OncePerTimeStepOperations(true), TimeElapsed(0.0), FlowRequest(0.0), FlowRequestTemperature(0.0),
     148        1592 :               TempSetPoint(DataLoopNode::SensedNodeFlagValue), TempSetPointHi(DataLoopNode::SensedNodeFlagValue),
     149        3184 :               TempSetPointLo(DataLoopNode::SensedNodeFlagValue), TempInterfaceTankOutlet(0.0), LastTempInterfaceTankOutlet(0.0), TotalBranches(0),
     150        6368 :               NodeNumIn(0), NodeNumOut(0), TotalPumps(0), BranchPumpsExist(false), TotalPumpHeat(0.0), BypassExists(false), InletNodeSetPt(false),
     151        1592 :               OutletNodeSetPt(false), EMSCtrl(false), EMSValue(0.0), FlowRestrictionFlag(false), FlowLock(DataPlant::FlowLock::Unlocked),
     152        3184 :               TotalConnected(0), HasPressureComponents(false), HasParallelPressComps(false), PressureDrop(0.0), PressureEffectiveK(0.0),
     153        1592 :               errCount_LoadWasntDist(0), errIndex_LoadWasntDist(0), errCount_LoadRemains(0), errIndex_LoadRemains(0), LoopSideInlet_TankTemp(0.0),
     154        1592 :               LoopSideInlet_MdotCpDeltaT(0.0), LoopSideInlet_McpDTdt(0.0), LoopSideInlet_CapExcessStorageTime(0.0),
     155        1592 :               LoopSideInlet_CapExcessStorageTimeReport(0.0), LoopSideInlet_TotalTime(0.0), InletNode(0.0, 0.0), OutletNode(0.0, 0.0),
     156        1592 :               flowRequestNeedIfOn(0.0), flowRequestNeedAndTurnOn(0.0), flowRequestFinal(0.0), hasConstSpeedBranchPumps(false),
     157        1592 :               InitialDemandToLoopSetPoint(0.0), CurrentAlterationsToDemand(0.0), UpdatedDemandToLoopSetPoint(0.0),
     158        3184 :               LoadToLoopSetPointThatWasntMet(0.0), InitialDemandToLoopSetPointSAVED(0.0), refrigIndex(0), LoopSetPtDemandAtInlet(0.0),
     159        3184 :               ThisSideLoadAlterations(0.0), plantLoc{}
     160             :         {
     161        1592 :         }
     162             : 
     163             :         void ValidateFlowControlPaths(EnergyPlusData &state);
     164             : 
     165             :         Real64 DetermineLoopSideFlowRate(EnergyPlusData &state, int ThisSideInletNode, Real64 ThisSideLoopFlowRequest);
     166             : 
     167             :         void SimulateAllLoopSideBranches(EnergyPlusData &state, Real64 ThisLoopSideFlow, bool FirstHVACIteration, bool &LoopShutDownFlag);
     168             : 
     169             :         void SimulateLoopSideBranchGroup(
     170             :             EnergyPlusData &state, int FirstBranchNum, int LastBranchNum, Real64 FlowRequest, bool FirstHVACIteration, bool &LoopShutDownFlag);
     171             : 
     172             :         void UpdatePlantSplitter(EnergyPlusData &state);
     173             : 
     174             :         void UpdatePlantMixer(EnergyPlusData &state);
     175             : 
     176             :         void TurnOnAllLoopSideBranches();
     177             : 
     178             :         void DisableAnyBranchPumpsConnectedToUnloadedEquipment();
     179             : 
     180             :         void DoFlowAndLoadSolutionPass(EnergyPlusData &state, LoopSideLocation OtherSide, int ThisSideInletNode, bool FirstHVACIteration);
     181             : 
     182             :         Real64 CalcOtherSideDemand(EnergyPlusData &state, Real64 ThisLoopSideFlow);
     183             : 
     184             :         Real64 SetupLoopFlowRequest(EnergyPlusData &state, const LoopSideLocation OtherSide);
     185             : 
     186             :         Real64 EvaluateLoopSetPointLoad(EnergyPlusData &state, int FirstBranchNum, int LastBranchNum, Real64 ThisLoopSideFlow);
     187             : 
     188             :         void ResolveParallelFlows(EnergyPlusData &state, Real64 ThisLoopSideFlow, bool FirstHVACIteration);
     189             : 
     190             :         void SimulateSinglePump(EnergyPlusData &state, PlantLocation SpecificPumpLocation, Real64 &SpecificPumpFlowRate);
     191             : 
     192             :         void UpdateAnyLoopDemandAlterations(EnergyPlusData &state, int BranchNum, int CompNum);
     193             : 
     194             :         void SimulateAllLoopSidePumps(EnergyPlusData &state,
     195             :                                       ObjexxFCL::Optional<PlantLocation const> SpecificPumpLocation = _,
     196             :                                       ObjexxFCL::Optional<Real64 const> SpecificPumpFlowRate = _);
     197             : 
     198             :         void AdjustPumpFlowRequestByEMSControls(int BranchNum, int CompNum, Real64 &FlowToRequest);
     199             : 
     200             :         void PushBranchFlowCharacteristics(EnergyPlusData &state,
     201             :                                            int BranchNum,
     202             :                                            Real64 ValueToPush,
     203             :                                            bool FirstHVACIteration // TRUE if First HVAC iteration of Time step
     204             :         );
     205             : 
     206             :         bool CheckPlantConvergence(bool FirstHVACIteration);
     207             : 
     208             :         void solve(EnergyPlusData &state, bool FirstHVACIteration, bool &ReSimOtherSideNeeded);
     209             :     };
     210             : } // namespace DataPlant
     211             : } // namespace EnergyPlus
     212             : 
     213             : #endif

Generated by: LCOV version 1.14