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

          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 ChillerIndirectAbsorption_hh_INCLUDED
      49             : #define ChillerIndirectAbsorption_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/DataPlant.hh>
      59             : #include <EnergyPlus/PlantComponent.hh>
      60             : 
      61             : namespace EnergyPlus {
      62             : 
      63             : // Forward declarations
      64             : struct EnergyPlusData;
      65             : 
      66             : namespace ChillerIndirectAbsorption {
      67             : 
      68           1 :     struct ReportVars
      69             :     {
      70             :         // Members
      71             :         Real64 PumpingPower = 0.0;         // reporting: W - electric pumping power
      72             :         Real64 QGenerator = 0.0;           // reporting: W - steam heat transfer rate
      73             :         Real64 QEvap = 0.0;                // reporting: W - evaporator heat transfer rate
      74             :         Real64 QCond = 0.0;                // reporting: W - condenser heat transfer rate
      75             :         Real64 PumpingEnergy = 0.0;        // reporting: J - electric pumping power
      76             :         Real64 GeneratorEnergy = 0.0;      // reporting: J - steam heat transfer rate
      77             :         Real64 EvapEnergy = 0.0;           // reporting: J - evaporator heat transfer rate
      78             :         Real64 CondEnergy = 0.0;           // reporting: J - condenser heat transfer rate
      79             :         Real64 CondInletTemp = 0.0;        // reporting: C - condenser inlet temperature
      80             :         Real64 EvapInletTemp = 0.0;        // reporting: C - evaporator inlet temperature
      81             :         Real64 CondOutletTemp = 0.0;       // reporting: C - condenser outlet temperature
      82             :         Real64 EvapOutletTemp = 0.0;       // reporting: C - evaporator outlet temperature
      83             :         Real64 Evapmdot = 0.0;             // reporting: kg/ - evaporator mass flow rate
      84             :         Real64 Condmdot = 0.0;             // reporting: kg/ - condenser mass flow rate
      85             :         Real64 Genmdot = 0.0;              // reporting: generators mass flow rate when connected to plant
      86             :         Real64 SteamMdot = 0.0;            // reporting: kg/s - steam mass flow rate
      87             :         Real64 ActualCOP = 0.0;            // reporting: coefficient of performance = QEvap/QGenerator
      88             :         Real64 ChillerPartLoadRatio = 0.0; // reporting: part-load ratio
      89             :         Real64 ChillerCyclingFrac = 0.0;   // reporting: chiller on/off cycling fraction
      90             :         Real64 LoopLoss = 0.0;             // reporting: W - loop loss from absorber outlet to condensate pump inlet
      91             :     };
      92             : 
      93           6 :     struct IndirectAbsorberSpecs : PlantComponent
      94             :     {
      95             :         // Members
      96             :         std::string Name;                         // user identifier
      97             :         Real64 NomCap = 0.0;                      // W - design nominal capacity of Absorber
      98             :         bool NomCapWasAutoSized = false;          // true if Nominal capacity was autosize on input
      99             :         Real64 NomPumpPower = 0.0;                // W - design nominal capacity of Absorber
     100             :         bool NomPumpPowerWasAutoSized = false;    // true if nominal pump power was autosize on input
     101             :         Real64 EvapVolFlowRate = 0.0;             // m3/s - design nominal water volumetric flow rate through the evaporator
     102             :         bool EvapVolFlowRateWasAutoSized = false; // true if evaporator flow rate was autosize on input
     103             :         Real64 CondVolFlowRate = 0.0;             // m3/s - design nominal water volumetric flow rate through the condenser
     104             :         bool CondVolFlowRateWasAutoSized = false; // true if condenser flow rate was autosize on input
     105             :         Real64 EvapMassFlowRateMax = 0.0;         // kg/s - Max Design Evaporator Mass Flow Rate converted from Volume Flow Rate
     106             :         Real64 CondMassFlowRateMax = 0.0;         // Max Design Condenser Mass Flow Rate [kg/s]
     107             :         Real64 GenMassFlowRateMax = 0.0;          // kg/s - Max Design Generator Mass Flow Rate converted from Volume Flow Rate
     108             :         Real64 MinPartLoadRat = 0.0;              // (BLAST MIN) min allowed operating frac full load
     109             :         Real64 MaxPartLoadRat = 0.0;              // (BLAST MAX) max allowed operating frac full load
     110             :         Real64 OptPartLoadRat = 0.0;              // (BLAST BEST) optimal operating frac full load
     111             :         Real64 TempDesCondIn = 0.0;               // C - (BLAST ADJTC(1)The design secondary loop fluid
     112             :         // temperature at the Absorber condenser side inlet
     113             :         Real64 MinCondInletTemp = 0.0;                 // C - minimum condenser inlet temperature for chiller operation
     114             :         Real64 MinGeneratorInletTemp = 0.0;            // C - minimum generator inlet temperature for chiller operation
     115             :         Real64 TempLowLimitEvapOut = 0.0;              // C - low temperature shut off
     116             :         Real64 GeneratorVolFlowRate = 0.0;             // m3/s - hot water volumetric flow rate through generator
     117             :         bool GeneratorVolFlowRateWasAutoSized = false; // true if hot water flow was autosize on input
     118             :         Real64 GeneratorSubcool = 0.0;                 // C - amount of subcooling in steam generator
     119             :         Real64 LoopSubcool = 0.0;                      // C - amount of subcooling in steam generator
     120             :         Real64 GeneratorDeltaTemp = -99999.0;          // C - generator fluid temperature difference (water only)
     121             :         bool GeneratorDeltaTempWasAutoSized = true;    // true if generator delta T was autosize on input
     122             :         Real64 SizFac = 0.0;                           // Sizing factor
     123             :         int EvapInletNodeNum = 0;                      // Node number on the inlet side of the plant
     124             :         int EvapOutletNodeNum = 0;                     // Node number on the outlet side of the plant
     125             :         int CondInletNodeNum = 0;                      // Node number on the inlet side of the condenser
     126             :         int CondOutletNodeNum = 0;                     // Node number on the outlet side of the condenser
     127             :         int GeneratorInletNodeNum = 0;                 // Generator inlet node number, steam/water side
     128             :         int GeneratorOutletNodeNum = 0;                // Generator outlet node number, steam/water side
     129             :         int GeneratorInputCurvePtr = 0;                // Index to steam use curve as a function of PLR
     130             :         int PumpPowerCurvePtr = 0;                     // Index to pump power curve as a function of PLR
     131             :         int CapFCondenserTempPtr = 0;                  // Index to capacity as a function of absorber temp curve
     132             :         int CapFEvaporatorTempPtr = 0;                 // Index to capacity as a function of evaporator temp curve
     133             :         int CapFGeneratorTempPtr = 0;                  // Index to capacity as a function of generator temp curve
     134             :         int HeatInputFCondTempPtr = 0;                 // Index to generator heat input as a function of absorber temp
     135             :         int HeatInputFEvapTempPtr = 0;                 // Index to generator heat input as a function of absorber temp
     136             :         int ErrCount2 = 0;                             // error counter
     137             :         DataLoopNode::NodeFluidType GenHeatSourceType =
     138             :             DataLoopNode::NodeFluidType::Blank;                      // Generator heat source type, DataLoopNode::NodeFluidType::Steam=3 or
     139             :                                                                      // DataLoopNode::NodeFluidType::Water=2
     140             :         int SteamFluidIndex = 0;                                     // index to generator fluid type
     141             :         bool Available = false;                                      // need an array of logicals--load identifiers of available equipment
     142             :         bool ON = false;                                             // simulate the machine at it's operating part load ratio
     143             :         DataPlant::FlowMode FlowMode = DataPlant::FlowMode::Invalid; // one of 3 modes for component flow during operation
     144             :         bool ModulatedFlowSetToLoop = false;                         // True if the setpoint is missing at the outlet node
     145             :         bool ModulatedFlowErrDone = false;                           // true if setpoint warning issued
     146             :         int MinCondInletTempCtr = 0;                                 // Low condenser temp warning message counter
     147             :         int MinCondInletTempIndex = 0;                               // Low condenser temp warning message index
     148             :         int MinGenInletTempCtr = 0;                                  // Low generator temp warning message counter
     149             :         int MinGenInletTempIndex = 0;                                // Low generator temp warning message index
     150             :         PlantLocation CWPlantLoc;                                    // chilled water plant loop component index
     151             :         PlantLocation CDPlantLoc;                                    // condenser water plant loop component index
     152             :         PlantLocation GenPlantLoc;                                   // generator plant loop component index
     153             :         bool FaultyChillerSWTFlag = false;                           // True if the chiller has SWT sensor fault
     154             :         int FaultyChillerSWTIndex = 0;                               // Index of the fault object corresponding to the chiller
     155             :         Real64 FaultyChillerSWTOffset = 0.0;                         // Chiller SWT sensor offset
     156             :         bool PossibleSubcooling = false;                             // flag to indicate chiller is doing less cooling that requested
     157             :         Real64 CondMassFlowRate = 0.0;                               // Kg/s - condenser mass flow rate, water side
     158             :         Real64 EvapMassFlowRate = 0.0;                               // Kg/s - evaporator mass flow rate, water side
     159             :         Real64 GenMassFlowRate = 0.0;                                // Kg/s - steam mass flow rate, water side
     160             :         Real64 CondOutletTemp = 0.0;                                 // C - condenser outlet temperature, water side
     161             :         Real64 EvapOutletTemp = 0.0;                                 // C - evaporator outlet temperature, water side
     162             :         Real64 GenOutletTemp = 0.0;                                  // C - generator fluid outlet temperature
     163             :         Real64 SteamOutletEnthalpy = 0.0;                            // J/kg - generator fluid outlet enthalpy
     164             :         Real64 PumpingPower = 0.0;                                   // W - rate of Absorber energy use
     165             :         Real64 PumpingEnergy = 0.0;                                  // J - Absorber energy use
     166             :         Real64 QGenerator = 0.0;                                     // W - rate of Absorber steam use
     167             :         Real64 GeneratorEnergy = 0.0;                                // J - Absorber steam use
     168             :         Real64 QEvaporator = 0.0;                                    // W - rate of heat transfer to the evaporator coil
     169             :         Real64 EvaporatorEnergy = 0.0;                               // J - heat transfer to the evaporator coil
     170             :         Real64 QCondenser = 0.0;                                     // W - rate of heat transfer to the condenser coil
     171             :         Real64 CondenserEnergy = 0.0;                                // J - heat transfer to the condenser coil
     172             :         Real64 ChillerONOFFCyclingFrac = 0.0;                        // fraction of time chiller is on
     173             :         Real64 EnergyLossToEnvironment = 0.0;                        // J - piping energy loss from generator outlet to pump inlet
     174             :         bool GenInputOutputNodesUsed = false;
     175             :         bool MyOneTimeFlag = true;
     176             :         bool MyEnvrnFlag = true;
     177             :         ReportVars Report;
     178             :         DataBranchAirLoopPlant::ControlType EquipFlowCtrl = DataBranchAirLoopPlant::ControlType::Invalid;
     179             : 
     180             :         static PlantComponent *factory(EnergyPlusData &state, std::string const &objectName);
     181             : 
     182             :         void simulate([[maybe_unused]] EnergyPlusData &state,
     183             :                       const PlantLocation &calledFromLocation,
     184             :                       bool FirstHVACIteration,
     185             :                       Real64 &CurLoad,
     186             :                       bool RunFlag) override;
     187             : 
     188             :         void getDesignCapacities(
     189             :             EnergyPlusData &state, const PlantLocation &calledFromLocation, Real64 &MaxLoad, Real64 &MinLoad, Real64 &OptLoad) override;
     190             : 
     191             :         void getSizingFactor(Real64 &sizFac) override;
     192             : 
     193             :         void onInitLoopEquip([[maybe_unused]] EnergyPlusData &state, const PlantLocation &calledFromLocation) override;
     194             : 
     195             :         void oneTimeInit(EnergyPlusData &state) override;
     196             : 
     197             :         void initialize(EnergyPlusData &state, bool RunFlag, Real64 MyLoad);
     198             : 
     199             :         void setupOutputVars(EnergyPlusData &state);
     200             : 
     201             :         void sizeChiller(EnergyPlusData &state);
     202             : 
     203             :         void updateRecords(EnergyPlusData &state, Real64 MyLoad, bool RunFlag);
     204             : 
     205             :         void calculate(EnergyPlusData &state, Real64 MyLoad, bool RunFlag);
     206             :     };
     207             : 
     208             :     void GetIndirectAbsorberInput(EnergyPlusData &state);
     209             : 
     210             : } // namespace ChillerIndirectAbsorption
     211             : 
     212        1542 : struct ChillerIndirectAbsoprtionData : BaseGlobalStruct
     213             : {
     214             :     bool GetInput = true;
     215             :     Array1D<ChillerIndirectAbsorption::IndirectAbsorberSpecs> IndirectAbsorber;
     216             : 
     217           0 :     void clear_state() override
     218             :     {
     219           0 :         *this = ChillerIndirectAbsoprtionData();
     220           0 :     }
     221             : };
     222             : 
     223             : } // namespace EnergyPlus
     224             : 
     225             : #endif

Generated by: LCOV version 1.13