LCOV - code coverage report
Current view: top level - EnergyPlus/Plant - Loop.hh (source / functions) Hit Total Coverage
Test: lcov.output.filtered Lines: 8 8 100.0 %
Date: 2023-01-17 19:17:23 Functions: 7 9 77.8 %

          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 PlantTopologyLoop_hh_INCLUDED
      49             : #define PlantTopologyLoop_hh_INCLUDED
      50             : 
      51             : #include <EnergyPlus/Plant/Enums.hh>
      52             : #include <EnergyPlus/Plant/LoopSide.hh>
      53             : 
      54             : namespace EnergyPlus {
      55             : 
      56             : // Forward declarations
      57             : struct EnergyPlusData;
      58             : 
      59             : namespace DataPlant {
      60             : 
      61             :     // "Both" is used as a special flag and is never assigned to the loop's TypeOfLoop member
      62             :     enum class LoopType
      63             :     {
      64             :         Invalid = -1,
      65             :         Plant,
      66             :         Condenser,
      67             :         Both,
      68             :         Num
      69             :     };
      70             : 
      71        3760 :     struct HalfLoopContainer : std::array<HalfLoopData, static_cast<int>(DataPlant::LoopSideLocation::Num)>
      72             :     {
      73  2569988870 :         HalfLoopData &operator()(LoopSideLocation ls)
      74             :         {
      75  2569988870 :             return this->at(static_cast<int>(ls));
      76             :         }
      77             :     };
      78             : 
      79             :     constexpr std::array<DataPlant::LoopSideLocation, static_cast<int>(DataPlant::LoopSideLocation::Num)> LoopSideKeys = {
      80             :         DataPlant::LoopSideLocation::Demand, DataPlant::LoopSideLocation::Supply};
      81             : 
      82        2989 :     struct PlantLoopData
      83             :     {
      84             :         // Members
      85             :         std::string Name;                      // Name of the component list
      86             :         std::string FluidName;                 // Name of the fluid specified for this loop
      87             :         DataLoopNode::NodeFluidType FluidType; // Type of fluid in the loop
      88             :         int FluidIndex;                        // Index for Fluid in FluidProperties
      89             :         int MFErrIndex;                        // for recurring mass flow errors
      90             :         int MFErrIndex1;                       // for recurring mass flow errors
      91             :         int MFErrIndex2;                       // for recurring mass flow errors
      92             :         // (see CheckPlantMixerSplitterConsistency)
      93             :         // Loop Operating Setpoints and Limits
      94             :         int TempSetPointNodeNum;         // Node Number for Loop Temp SP associated with SP manager
      95             :         int MaxBranch;                   // Max branches in the loop
      96             :         Real64 MinTemp;                  // Minimum temperature allowed in the loop
      97             :         Real64 MaxTemp;                  // Maximum temperature allowed in the loop
      98             :         int MinTempErrIndex;             // for recurring too cold errors
      99             :         int MaxTempErrIndex;             // for recurring too hot errors
     100             :         Real64 MinVolFlowRate;           // Minimum flow rate allowed in the loop
     101             :         Real64 MaxVolFlowRate;           // Maximum flow rate allowed in the loop
     102             :         bool MaxVolFlowRateWasAutoSized; // true if previous was set to autosized in the input
     103             :         Real64 MinMassFlowRate;          // Minimum flow rate allowed in the loop
     104             :         Real64 MaxMassFlowRate;          // Maximum flow rate allowed in the loop
     105             :         Real64 Volume;                   // Volume of the fluid in the loop
     106             :         bool VolumeWasAutoSized;         // true if Volume was set to autocalculate
     107             :         Real64 CirculationTime;          // Loop circulation time [minutes] used to autocalculate loop volume, default is 2 minutes
     108             :         Real64 Mass;                     // Mass of the fluid in the loop
     109             :         bool EMSCtrl;
     110             :         Real64 EMSValue;
     111             :         // Loop Inlet and Outlet Nodes
     112             :         HalfLoopContainer LoopSide;                           // Half loop data (Demand side or Supply Side)
     113             :         std::string OperationScheme;                          // Operation scheme name for the loop
     114             :         int NumOpSchemes;                                     // Number of items in list identified by "OpScheme"
     115             :         Array1D<OperationData> OpScheme;                      // Operation scheme data
     116             :         DataPlant::LoadingScheme LoadDistribution;            // Load distribution scheme 1 for optimal, 2 for overloading
     117             :         int PlantSizNum;                                      // index to corresponding plant sizing data array
     118             :         DataPlant::LoopDemandCalcScheme LoopDemandCalcScheme; // Load distribution scheme 1 SingleSetPoint,
     119             :         // 2 DualSetPointWithDeadBand
     120             :         DataPlant::CommonPipeType CommonPipeType;
     121             :         int EconPlantSideSensedNodeNum;
     122             :         int EconCondSideSensedNodeNum;
     123             :         int EconPlacement;
     124             :         int EconBranch;
     125             :         int EconComp;
     126             :         Real64 EconControlTempDiff;
     127             :         bool LoopHasConnectionComp;
     128             :         LoopType TypeOfLoop;
     129             :         DataPlant::PressSimType PressureSimType;
     130             :         bool HasPressureComponents;
     131             :         Real64 PressureDrop;
     132             :         bool UsePressureForPumpCalcs;
     133             :         Real64 PressureEffectiveK;
     134             :         // report variables
     135             :         Real64 CoolingDemand;       // Plant Loop Cooling Demand, W
     136             :         Real64 HeatingDemand;       // Plant Loop Heating Demand[W]
     137             :         Real64 DemandNotDispatched; // Plant Loop Demand that was not distributed [W]
     138             :         Real64 UnmetDemand;         // Plant Loop Unmet Demand [W]
     139             :         Real64 BypassFrac;
     140             :         Real64 InletNodeFlowrate;
     141             :         Real64 InletNodeTemperature;
     142             :         Real64 OutletNodeFlowrate;
     143             :         Real64 OutletNodeTemperature;
     144             :         int LastLoopSideSimulated;
     145             : 
     146             :         // Default Constructor
     147         771 :         PlantLoopData()
     148         771 :             : FluidType(DataLoopNode::NodeFluidType::Blank), FluidIndex(1), // default to water
     149             :               MFErrIndex(0), MFErrIndex1(0), MFErrIndex2(0), TempSetPointNodeNum(0), MaxBranch(0), MinTemp(0.0), MaxTemp(0.0), MinTempErrIndex(0),
     150             :               MaxTempErrIndex(0), MinVolFlowRate(0.0), MaxVolFlowRate(0.0), MaxVolFlowRateWasAutoSized(false), MinMassFlowRate(0.0),
     151             :               MaxMassFlowRate(0.0), Volume(0.0), VolumeWasAutoSized(false), CirculationTime(2.0), Mass(0.0), EMSCtrl(false), EMSValue(0.0),
     152             :               NumOpSchemes(0), LoadDistribution(DataPlant::LoadingScheme::Invalid), PlantSizNum(0),
     153             :               LoopDemandCalcScheme(DataPlant::LoopDemandCalcScheme::Invalid), CommonPipeType(DataPlant::CommonPipeType::No),
     154             :               EconPlantSideSensedNodeNum(0), EconCondSideSensedNodeNum(0), EconPlacement(0), EconBranch(0), EconComp(0), EconControlTempDiff(0.0),
     155             :               LoopHasConnectionComp(false), TypeOfLoop(LoopType::Invalid), PressureSimType(DataPlant::PressSimType::NoPressure),
     156             :               HasPressureComponents(false), PressureDrop(0.0), UsePressureForPumpCalcs(false), PressureEffectiveK(0.0), CoolingDemand(0.0),
     157             :               HeatingDemand(0.0), DemandNotDispatched(0.0), UnmetDemand(0.0), BypassFrac(0.0), InletNodeFlowrate(0.0), InletNodeTemperature(0.0),
     158         771 :               OutletNodeFlowrate(0.0), OutletNodeTemperature(0.0), LastLoopSideSimulated(0)
     159             :         {
     160         771 :         }
     161             : 
     162             :         void UpdateLoopSideReportVars(EnergyPlusData &state, Real64 OtherSideDemand, Real64 LocalRemLoopDemand);
     163             : 
     164             :         void CheckLoopExitNode(EnergyPlusData &state, bool FirstHVACIteration);
     165             : 
     166             :         void CalcUnmetPlantDemand(EnergyPlusData &state);
     167             :     };
     168             : } // namespace DataPlant
     169             : } // namespace EnergyPlus
     170             : 
     171             : #endif

Generated by: LCOV version 1.13