LCOV - code coverage report
Current view: top level - EnergyPlus - Pumps.hh (source / functions) Hit Total Coverage
Test: lcov.output.filtered Lines: 4 17 23.5 %
Date: 2023-01-17 19:17:23 Functions: 9 12 75.0 %

          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 Pumps_hh_INCLUDED
      49             : #define Pumps_hh_INCLUDED
      50             : 
      51             : // EnergyPlus Headers
      52             : #include <EnergyPlus/Data/BaseData.hh>
      53             : #include <EnergyPlus/DataGlobals.hh>
      54             : #include <EnergyPlus/EnergyPlus.hh>
      55             : 
      56             : namespace EnergyPlus {
      57             : 
      58             : // Forward declarations
      59             : struct EnergyPlusData;
      60             : 
      61             : namespace Pumps {
      62             : 
      63             :     // Using/Aliasing
      64             : 
      65             :     // Data
      66             :     // MODULE PARAMETER DEFINITIONS:
      67             : 
      68             :     enum class PumpControlType
      69             :     {
      70             :         Invalid = -1,
      71             :         Continuous,   // Pump control type (pump always running)
      72             :         Intermittent, // Pump control type (pump runs only when there is a demand)
      73             :         Num
      74             :     };
      75             : 
      76             :     enum class ControlTypeVFD
      77             :     {
      78             :         Invalid = -1,
      79             :         VFDManual,    // VFD control type (Scheduled RPM)
      80             :         VFDAutomatic, // VFD control type (Variable RPM according to flow request)
      81             :         Num
      82             :     };
      83             : 
      84             :     enum class PumpBankControlSeq
      85             :     {
      86             :         Invalid = -1,
      87             :         OptimalScheme,    // Control sequencing for pump bank
      88             :         SequentialScheme, // Control sequencing for pump bank
      89             :         UserDefined,      // Control sequencing for pump bank
      90             :         Num
      91             :     };
      92             : 
      93             :     enum class PumpType : int
      94             :     {
      95             :         Invalid = -1,
      96             :         VarSpeed,
      97             :         ConSpeed,
      98             :         Cond,
      99             :         Bank_VarSpeed,
     100             :         Bank_ConSpeed,
     101             :         Num
     102             :     };
     103             : 
     104             :     enum class PowerSizingMethod
     105             :     {
     106             :         Invalid = -1,
     107             :         SizePowerPerFlow,
     108             :         SizePowerPerFlowPerPressure,
     109             :         Num
     110             :     };
     111             : 
     112        3823 :     struct PumpVFDControlData
     113             :     {
     114             :         // Members
     115             :         std::string Name;
     116             :         int ManualRPMSchedIndex = 0;
     117             :         int LowerPsetSchedIndex = 0;
     118             :         int UpperPsetSchedIndex = 0;
     119             :         int MinRPMSchedIndex = 0;
     120             :         int MaxRPMSchedIndex = 0;
     121             :         ControlTypeVFD VFDControlType = ControlTypeVFD::Invalid; // VFDControlType
     122             :         Real64 MaxRPM = 0.0;                                     // Maximum RPM range value - schedule limit
     123             :         Real64 MinRPM = 0.0;                                     // Minimum RPM range value - schedule limit
     124             :         Real64 PumpActualRPM = 0.0;                              // RPM recalculated from final flow through the loop
     125             :     };
     126             : 
     127        3823 :     struct PumpSpecs
     128             :     {
     129             :         // Members
     130             :         std::string Name;                      // user identifier
     131             :         PumpType pumpType = PumpType::Invalid; // pump type enumerator, based on local parameter values, used to identify
     132             :         // index in the cPumpTypes string array to do error reporting
     133             :         DataPlant::PlantEquipmentType TypeOf_Num = DataPlant::PlantEquipmentType::Invalid; // pump type of number in reference to the dataplant values
     134             :         PlantLocation plantLoc = {0, DataPlant::LoopSideLocation::Invalid, 0, 0};
     135             :         PumpControlType PumpControl = PumpControlType::Invalid;            // Integer equivalent of PumpControlType
     136             :         int PumpScheduleIndex = 0;                                         // Schedule Pointer
     137             :         int InletNodeNum = 0;                                              // Node number on the inlet side of the plant
     138             :         int OutletNodeNum = 0;                                             // Node number on the outlet side of the plant
     139             :         PumpBankControlSeq SequencingScheme = PumpBankControlSeq::Invalid; // Optimal, Sequential, User-Defined
     140             :         int FluidIndex = 0;                                                // Index for Fluid Properties
     141             :         int NumPumpsInBank = 0;                                            // Node number on the inlet side of the plant
     142             :         int PowerErrIndex1 = 0;                                            // for recurring errors
     143             :         int PowerErrIndex2 = 0;                                            // for recurring errors
     144             :         Real64 MinVolFlowRateFrac = 0.0;                                   // minimum schedule value fraction modifier
     145             :         Real64 NomVolFlowRate = 0.0;                                       // design nominal capacity of Pump
     146             :         bool NomVolFlowRateWasAutoSized = false;                           // true if previous was autosize on input
     147             :         Real64 MassFlowRateMax = 0.0;                                      // design nominal capacity of Pump
     148             :         bool EMSMassFlowOverrideOn = false;                                // if true, then EMS is calling to override flow requests.
     149             :         Real64 EMSMassFlowValue = 0.0;                                     // EMS value to use for mass flow rate [kg/s]
     150             :         Real64 NomSteamVolFlowRate = 0.0;                                  // For Steam Pump
     151             :         bool NomSteamVolFlowRateWasAutoSized = false;                      // true if steam volume flow rate was autosize on input
     152             :         Real64 MinVolFlowRate = 0.0;                                       // For a Variable Flow Pump this is the minimum capacity during operation.
     153             :         bool minVolFlowRateWasAutosized = false;                           // true if minimum flow rate was autosize on input
     154             :         Real64 MassFlowRateMin = 0.0;                                      // For a Variable Flow Pump this is the minimum capacity during operation.
     155             :         Real64 NomPumpHead = 0.0;                                          // design nominal head pressure of Pump, [Pa]
     156             :         bool EMSPressureOverrideOn = false;                                // if true, EMS is calling to override pump pressure
     157             :         Real64 EMSPressureOverrideValue = 0.0;                             // EMS value to use for pressure [Pa]
     158             :         Real64 NomPowerUse = 0.0;                                          // design nominal capacity of Pump
     159             :         bool NomPowerUseWasAutoSized = false;                              // true if power was autosize on input
     160             :         PowerSizingMethod powerSizingMethod = PowerSizingMethod::SizePowerPerFlowPerPressure; // which method is used for sizing nominal power use
     161             :         Real64 powerPerFlowScalingFactor = 348701.1;                                          // design electric power per unit flow rate (22 W/gpm)
     162             :         Real64 powerPerFlowPerPressureScalingFactor = (1 / .78);   // design shaft power per unit flow rate per unit head (legacy impeller efficiency)
     163             :         Real64 MotorEffic = 0.0;                                   // efficiency of the motor
     164             :         Real64 PumpEffic = 0.0;                                    // efficiency of the pump
     165             :         Real64 FracMotorLossToFluid = 0.0;                         // ?????
     166             :         Real64 Energy = 0.0;                                       // Energy consumed
     167             :         Real64 Power = 0.0;                                        // Power used
     168             :         std::array<Real64, 4> PartLoadCoef = {0.0, 0.0, 0.0, 0.0}; // Pump Curve Coefficients
     169             :         int PressureCurve_Index = 0;                               // Pointer to a pump coefficient curve
     170             :         Real64 PumpMassFlowRateMaxRPM = 0.0;                       // Mass flow rate calculated from maximum rpm
     171             :         Real64 PumpMassFlowRateMinRPM = 0.0;                       // Mass flow rate calculated from minimum rpm
     172             :         Real64 MinPhiValue = 0.0;                                  // Minimum value of Phi (from CurveManager)
     173             :         Real64 MaxPhiValue = 0.0;                                  // Maximum value of Phi (from CurveManager)
     174             :         Real64 ImpellerDiameter = 0.0;                             // Pump Impeller Diameter [m]
     175             :         Real64 RotSpeed_RPM = 0.0;                                 // Rotational speed used for input in revs/min
     176             :         Real64 RotSpeed = 0.0;                                     // Rotational speed for calculations in revs/sec
     177             :         bool PumpInitFlag = true;
     178             :         bool PumpOneTimeFlag = true;
     179             :         bool CheckEquipName = true;
     180             :         bool HasVFD = false;
     181             :         PumpVFDControlData VFD;
     182             :         bool OneTimePressureWarning = true;
     183             :         bool HeatLossesToZone = false;        // if true then pump losses added to surrounding zone
     184             :         int ZoneNum = 0;                      // index for zone surrounding pump
     185             :         Real64 SkinLossRadFraction = 0.0;     // radiative split for skin losses to zone
     186             :         bool LoopSolverOverwriteFlag = false; // loop solver overwrite for determining pump minimum flow rate
     187             :         std::string EndUseSubcategoryName;
     188             :     };
     189             : 
     190    16366014 :     struct ReportVars
     191             :     {
     192             :         // Members
     193             :         int NumPumpsOperating = 0;          // Used in pump bank. reports how many pumps are ON
     194             :         Real64 PumpMassFlowRate = 0.0;      // Mass flow rate of the pump
     195             :         Real64 PumpHeattoFluid = 0.0;       // Heat transfer from pump to fluid (W)
     196             :         Real64 PumpHeattoFluidEnergy = 0.0; // Pump Energy dissipated into fluid stream
     197             :         Real64 OutletTemp = 0.0;            // Pump outlet temperature
     198             :         Real64 ShaftPower = 0.0;            // Power input at the shaft
     199             :         Real64 ZoneTotalGainRate = 0.0;     // total pump skin losses to zone (W)
     200             :         Real64 ZoneTotalGainEnergy = 0.0;   // total pump skin losses to zone energy (J)
     201             :         Real64 ZoneConvGainRate = 0.0;      // pump skin losses convecting to zone air (W)
     202             :         Real64 ZoneRadGainRate = 0.0;       // pump skin losses radiating to inside of zone (W)
     203             :     };
     204             : 
     205             :     void SimPumps(EnergyPlusData &state,
     206             :                   std::string const &PumpName, // Name of pump to be managed
     207             :                   int const LoopNum,           // Plant loop number
     208             :                   Real64 const FlowRequest,    // requested flow from adjacent demand side
     209             :                   bool &PumpRunning,           // .TRUE. if the loop pump is actually operating
     210             :                   int &PumpIndex,
     211             :                   Real64 &PumpHeat);
     212             : 
     213             :     void GetPumpInput(EnergyPlusData &state);
     214             : 
     215             :     void InitializePumps(EnergyPlusData &state, int const PumpNum);
     216             : 
     217             :     void SetupPumpMinMaxFlows(EnergyPlusData &state, int const LoopNum, int const PumpNum);
     218             : 
     219             :     void CalcPumps(EnergyPlusData &state, int const PumpNum, Real64 const FlowRequest, bool &PumpRunning);
     220             : 
     221             :     void SizePump(EnergyPlusData &state, int const PumpNum);
     222             : 
     223             :     void ReportPumps(EnergyPlusData &state, int const PumpNum);
     224             : 
     225             :     void PumpDataForTable(EnergyPlusData &state, int const NumPump);
     226             : 
     227             :     void GetRequiredMassFlowRate(EnergyPlusData &state,
     228             :                                  int const LoopNum,
     229             :                                  int const PumpNum,
     230             :                                  Real64 const InletNodeMassFlowRate,
     231             :                                  Real64 &ActualFlowRate,
     232             :                                  Real64 &PumpMinMassFlowRateVFDRange,
     233             :                                  Real64 &PumpMaxMassFlowRateVFDRange);
     234             : 
     235             : } // namespace Pumps
     236             : 
     237        1542 : struct PumpsData : BaseGlobalStruct
     238             : {
     239             : 
     240             :     int NumPumps = 0;         // Num Pumps (used in pump bank)
     241             :     int NumPumpsRunning = 0;  // Num of pumps ON (used in pump bank)
     242             :     int NumPumpsFullLoad = 0; // Num pumps running at full load (used in pump bank)
     243             :     bool GetInputFlag = true;
     244             :     Real64 PumpMassFlowRate = 0.0; // mass flow rate at pump inlet node
     245             :     Real64 PumpHeattoFluid = 0.0;  // Pump Power dissipated in fluid stream
     246             :     Real64 Power = 0.0;            // Pump Electric power
     247             :     Real64 ShaftPower = 0.0;       // Power passing through pump shaft
     248             :     EPVector<Pumps::PumpSpecs> PumpEquip;
     249             :     EPVector<Pumps::ReportVars> PumpEquipReport;
     250             :     std::unordered_map<std::string, std::string> PumpUniqueNames;
     251             : 
     252           0 :     void clear_state() override
     253             :     {
     254           0 :         this->NumPumps = 0;
     255           0 :         this->NumPumpsRunning = 0;
     256           0 :         this->NumPumpsFullLoad = 0;
     257           0 :         this->GetInputFlag = true;
     258           0 :         this->PumpMassFlowRate = 0.0;
     259           0 :         this->PumpHeattoFluid = 0.0;
     260           0 :         this->Power = 0.0;
     261           0 :         this->ShaftPower = 0.0;
     262           0 :         this->PumpEquip.deallocate();
     263           0 :         this->PumpEquipReport.deallocate();
     264           0 :         this->PumpUniqueNames.clear();
     265           0 :     }
     266             : };
     267             : 
     268             : } // namespace EnergyPlus
     269             : 
     270             : #endif

Generated by: LCOV version 1.13