LCOV - code coverage report
Current view: top level - EnergyPlus - FluidCoolers.hh (source / functions) Hit Total Coverage
Test: lcov.output.filtered Lines: 6 12 50.0 %
Date: 2023-01-17 19:17:23 Functions: 5 7 71.4 %

          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 FluidCoolers_hh_INCLUDED
      49             : #define FluidCoolers_hh_INCLUDED
      50             : 
      51             : // ObjexxFCL Headers
      52             : #include <ObjexxFCL/Array1D.hh>
      53             : 
      54             : // EnergyPlus Headers
      55             : #include <EnergyPlus/Data/BaseData.hh>
      56             : #include <EnergyPlus/DataGlobals.hh>
      57             : #include <EnergyPlus/EnergyPlus.hh>
      58             : #include <EnergyPlus/Plant/Enums.hh>
      59             : #include <EnergyPlus/Plant/PlantLocation.hh>
      60             : #include <EnergyPlus/PlantComponent.hh>
      61             : 
      62             : namespace EnergyPlus {
      63             : 
      64             : namespace FluidCoolers {
      65             : 
      66             :     enum class PerfInputMethod
      67             :     {
      68             :         Invalid = -1,
      69             :         NOMINAL_CAPACITY,
      70             :         U_FACTOR,
      71             :         Num
      72             :     };
      73             : 
      74          18 :     struct FluidCoolerspecs : PlantComponent
      75             :     {
      76             :         // Members
      77             :         std::string Name; // User identifier
      78             :         DataPlant::PlantEquipmentType FluidCoolerType;
      79             :         PerfInputMethod PerformanceInputMethod_Num;
      80             :         bool Available;                               // need an array of logicals--load identifiers of available equipment
      81             :         bool ON;                                      // Simulate the machine at it's operating part load ratio
      82             :         Real64 DesignWaterFlowRate;                   // Design water flow rate through the fluid cooler [m3/s]
      83             :         bool DesignWaterFlowRateWasAutoSized;         // true if design water rate was autosize on input
      84             :         Real64 DesWaterMassFlowRate;                  // Design water flow rate through the fluid cooler [kg/s]
      85             :         Real64 HighSpeedAirFlowRate;                  // Air flow rate through the fluid cooler at high speed [m3/s]
      86             :         bool HighSpeedAirFlowRateWasAutoSized;        // true if high speed air rate was autosize on input
      87             :         Real64 HighSpeedFanPower;                     // Fan power at high fan speed [W]
      88             :         bool HighSpeedFanPowerWasAutoSized;           // true if high fan power was autosize on input
      89             :         Real64 HighSpeedFluidCoolerUA;                // UA of fluid cooler at high fan speed [W/C]
      90             :         bool HighSpeedFluidCoolerUAWasAutoSized;      // true if high speed UA was autosized on input
      91             :         Real64 LowSpeedAirFlowRate;                   // Air flow rate through fluid cooler at low speed [m3/s]
      92             :         bool LowSpeedAirFlowRateWasAutoSized;         // true if low speed air rate was autosize on input
      93             :         Real64 LowSpeedAirFlowRateSizingFactor;       // sizing factor for low speed air flow rate []
      94             :         Real64 LowSpeedFanPower;                      // Fan power at low fan speed [W]
      95             :         bool LowSpeedFanPowerWasAutoSized;            // true if low speed fan power set to autosize on input
      96             :         Real64 LowSpeedFanPowerSizingFactor;          // sizing factor for low speed fan power []
      97             :         Real64 LowSpeedFluidCoolerUA;                 // UA of fluid cooler at low fan speed [W/C]
      98             :         bool LowSpeedFluidCoolerUAWasAutoSized;       // true if low speed UA set to autosize on input
      99             :         Real64 LowSpeedFluidCoolerUASizingFactor;     // sizing factor for low speed UA []
     100             :         Real64 DesignEnteringWaterTemp;               // Entering water temperature at design conditions
     101             :         Real64 DesignLeavingWaterTemp;                // Entering water temperature at design conditions
     102             :         Real64 DesignEnteringAirTemp;                 // Entering water temperature at design conditions
     103             :         Real64 DesignEnteringAirWetBulbTemp;          // Entering water temperature at design condition
     104             :         Real64 FluidCoolerMassFlowRateMultiplier;     // Maximum fluid cooler flow rate is this multiplier * design flow rate
     105             :         Real64 FluidCoolerNominalCapacity;            // Nominal capacity of the fluid cooler [W] at high speed
     106             :         Real64 FluidCoolerLowSpeedNomCap;             // Nominal capacity of the fluid cooler [W] at low speed
     107             :         bool FluidCoolerLowSpeedNomCapWasAutoSized;   // true if previous was set to autosize on input
     108             :         Real64 FluidCoolerLowSpeedNomCapSizingFactor; // sizing factor for low speed capacity []
     109             :         int WaterInletNodeNum;                        // Node number on the water inlet side of the fluid cooler
     110             :         int WaterOutletNodeNum;                       // Node number on the water outlet side of the fluid cooler
     111             :         int OutdoorAirInletNodeNum;                   // Node number of outdoor air inlet for the fluid cooler
     112             :         int HighMassFlowErrorCount;                   // Counter when mass flow rate is > Design*FluidCoolerMassFlowRateMultiplier
     113             :         int HighMassFlowErrorIndex;                   // Index for high mass flow recurring error message
     114             :         int OutletWaterTempErrorCount;                // Counter when outlet water temperature is < minimum allowed temperature
     115             :         int OutletWaterTempErrorIndex;                // Index for outlet water temperature recurring error message
     116             :         int SmallWaterMassFlowErrorCount;             // Counter when water mass flow rate is very small
     117             :         int SmallWaterMassFlowErrorIndex;             // Index for very small water mass flow rate recurring error message
     118             :         int WMFRLessThanMinAvailErrCount;             // Counter when water mass flow rate is less than minimum available
     119             :         int WMFRLessThanMinAvailErrIndex;             // Index for water mass flow rate less than minavail recurring message
     120             :         int WMFRGreaterThanMaxAvailErrCount;          // Counter when water mass flow rate is greater than minimum available
     121             :         int WMFRGreaterThanMaxAvailErrIndex;          // Index for water mass flow rate > minavail recurring message
     122             :         PlantLocation plantLoc;                       // loop topology variables
     123             :         bool oneTimeInitFlag;
     124             :         bool beginEnvrnInit;
     125             : 
     126             :         // Report vars
     127             :         Real64 InletWaterTemp;    // Fluid cooler inlet water temperature (C)
     128             :         Real64 OutletWaterTemp;   // Fluid cooler outlet water temperature (C)
     129             :         Real64 WaterMassFlowRate; // Fluid cooler water mass flow rate (m3/s)
     130             :         Real64 Qactual;           // Fluid cooler heat rejection rate (W)
     131             :         Real64 FanPower;          // Fluid cooler fan power (W)
     132             :         Real64 FanEnergy;         // Fluid cooler fan energy consumption (J)
     133             : 
     134             :         // Inlet conds
     135             :         Real64 WaterTemp;
     136             :         Real64 AirTemp;
     137             :         Real64 AirHumRat;
     138             :         Real64 AirPress;
     139             :         Real64 AirWetBulb;
     140             : 
     141             :         // additional stuff
     142             :         int indexInArray;
     143             : 
     144             :         // Default Constructor
     145           6 :         FluidCoolerspecs()
     146           6 :             : FluidCoolerType(DataPlant::PlantEquipmentType::Invalid), PerformanceInputMethod_Num(PerfInputMethod::NOMINAL_CAPACITY), Available(true),
     147             :               ON(true), DesignWaterFlowRate(0.0), DesignWaterFlowRateWasAutoSized(false), DesWaterMassFlowRate(0.0), HighSpeedAirFlowRate(0.0),
     148             :               HighSpeedAirFlowRateWasAutoSized(false), HighSpeedFanPower(0.0), HighSpeedFanPowerWasAutoSized(false), HighSpeedFluidCoolerUA(0.0),
     149             :               HighSpeedFluidCoolerUAWasAutoSized(false), LowSpeedAirFlowRate(0.0), LowSpeedAirFlowRateWasAutoSized(false),
     150             :               LowSpeedAirFlowRateSizingFactor(0.0), LowSpeedFanPower(0.0), LowSpeedFanPowerWasAutoSized(false), LowSpeedFanPowerSizingFactor(0.0),
     151             :               LowSpeedFluidCoolerUA(0.0), LowSpeedFluidCoolerUAWasAutoSized(false), LowSpeedFluidCoolerUASizingFactor(0.0),
     152             :               DesignEnteringWaterTemp(0.0), DesignLeavingWaterTemp(0.0), DesignEnteringAirTemp(0.0), DesignEnteringAirWetBulbTemp(0.0),
     153             :               FluidCoolerMassFlowRateMultiplier(0.0), FluidCoolerNominalCapacity(0.0), FluidCoolerLowSpeedNomCap(0.0),
     154             :               FluidCoolerLowSpeedNomCapWasAutoSized(false), FluidCoolerLowSpeedNomCapSizingFactor(0.0), WaterInletNodeNum(0), WaterOutletNodeNum(0),
     155             :               OutdoorAirInletNodeNum(0), HighMassFlowErrorCount(0), HighMassFlowErrorIndex(0), OutletWaterTempErrorCount(0),
     156             :               OutletWaterTempErrorIndex(0), SmallWaterMassFlowErrorCount(0), SmallWaterMassFlowErrorIndex(0), WMFRLessThanMinAvailErrCount(0),
     157             :               WMFRLessThanMinAvailErrIndex(0), WMFRGreaterThanMaxAvailErrCount(0), WMFRGreaterThanMaxAvailErrIndex(0), plantLoc{},
     158             :               oneTimeInitFlag(true), beginEnvrnInit(true), InletWaterTemp(0.0), OutletWaterTemp(0.0), WaterMassFlowRate(0.0), Qactual(0.0),
     159           6 :               FanPower(0.0), FanEnergy(0.0), WaterTemp(0.0), AirTemp(0.0), AirHumRat(0.0), AirPress(0.0), AirWetBulb(0.0), indexInArray(0)
     160             :         {
     161           6 :         }
     162             : 
     163             :         void oneTimeInit(EnergyPlusData &state) override;
     164             : 
     165             :         void oneTimeInit_new(EnergyPlusData &state) override;
     166             : 
     167             :         void initEachEnvironment(EnergyPlusData &state);
     168             : 
     169             :         void initialize(EnergyPlusData &state);
     170             : 
     171             :         void setupOutputVars(EnergyPlusData &state);
     172             : 
     173             :         void size(EnergyPlusData &state);
     174             : 
     175             :         void update(EnergyPlusData &state);
     176             : 
     177             :         void report(EnergyPlusData &state, bool RunFlag);
     178             : 
     179             :         bool validateSingleSpeedInputs(EnergyPlusData &state,
     180             :                                        std::string const &cCurrentModuleObject,
     181             :                                        Array1D<std::string> const &AlphArray,
     182             :                                        Array1D<std::string> const &cNumericFieldNames,
     183             :                                        Array1D<std::string> const &cAlphaFieldNames);
     184             : 
     185             :         bool validateTwoSpeedInputs(EnergyPlusData &state,
     186             :                                     std::string const &cCurrentModuleObject,
     187             :                                     Array1D<std::string> const &AlphArray,
     188             :                                     Array1D<std::string> const &cNumericFieldNames,
     189             :                                     Array1D<std::string> const &cAlphaFieldNames);
     190             : 
     191             :         void calcSingleSpeed(EnergyPlusData &state);
     192             : 
     193             :         void calcTwoSpeed(EnergyPlusData &state);
     194             : 
     195             :         void simulate([[maybe_unused]] EnergyPlusData &state,
     196             :                       const PlantLocation &calledFromLocation,
     197             :                       bool FirstHVACIteration,
     198             :                       Real64 &CurLoad,
     199             :                       bool RunFlag) override;
     200             : 
     201             :         void getDesignCapacities(EnergyPlusData &state,
     202             :                                  [[maybe_unused]] const PlantLocation &calledFromLocation,
     203             :                                  [[maybe_unused]] Real64 &MaxLoad,
     204             :                                  [[maybe_unused]] Real64 &MinLoad,
     205             :                                  [[maybe_unused]] Real64 &OptLoad) override;
     206             : 
     207             :         void onInitLoopEquip([[maybe_unused]] EnergyPlusData &state, [[maybe_unused]] const PlantLocation &calledFromLocation) override;
     208             : 
     209             :         static FluidCoolerspecs *factory(EnergyPlusData &state, DataPlant::PlantEquipmentType typeOf, std::string const &objectName);
     210             :     };
     211             : 
     212             :     void GetFluidCoolerInput(EnergyPlusData &state);
     213             : 
     214             :     void CalcFluidCoolerOutlet(
     215             :         EnergyPlusData &state, int FluidCoolerNum, Real64 _WaterMassFlowRate, Real64 AirFlowRate, Real64 UAdesign, Real64 &_OutletWaterTemp);
     216             : 
     217             : } // namespace FluidCoolers
     218             : 
     219        1542 : struct FluidCoolersData : BaseGlobalStruct
     220             : {
     221             : 
     222             :     bool GetFluidCoolerInputFlag = true;
     223             :     int NumSimpleFluidCoolers = 0;
     224             :     Array1D<FluidCoolers::FluidCoolerspecs> SimpleFluidCooler;
     225             :     std::unordered_map<std::string, std::string> UniqueSimpleFluidCoolerNames;
     226             : 
     227           0 :     void clear_state() override
     228             :     {
     229           0 :         this->GetFluidCoolerInputFlag = true;
     230           0 :         this->NumSimpleFluidCoolers = 0;
     231           0 :         this->SimpleFluidCooler.deallocate();
     232           0 :         this->UniqueSimpleFluidCoolerNames.clear();
     233           0 :     }
     234             : };
     235             : 
     236             : } // namespace EnergyPlus
     237             : 
     238             : #endif

Generated by: LCOV version 1.13