LCOV - code coverage report
Current view: top level - EnergyPlus - ChillerAbsorption.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 ChillerAbsorption_hh_INCLUDED
      49             : #define ChillerAbsorption_hh_INCLUDED
      50             : 
      51             : // ObjexxFCL Headers
      52             : #include <ObjexxFCL/Array1D.hh>
      53             : 
      54             : // EnergyPlus Headers
      55             : #include <EnergyPlus/Data/BaseData.hh>
      56             : #include <EnergyPlus/DataBranchAirLoopPlant.hh>
      57             : #include <EnergyPlus/DataGlobals.hh>
      58             : #include <EnergyPlus/EnergyPlus.hh>
      59             : #include <EnergyPlus/Plant/DataPlant.hh>
      60             : #include <EnergyPlus/PlantComponent.hh>
      61             : 
      62             : namespace EnergyPlus {
      63             : 
      64             : // Forward declarations
      65             : struct EnergyPlusData;
      66             : 
      67             : namespace ChillerAbsorption {
      68             : 
      69           2 :     struct ReportVars
      70             :     {
      71             :         // Members
      72             :         Real64 PumpingPower = 0.0;    // reporting: electric pumping power
      73             :         Real64 QGenerator = 0.0;      // reporting: steam heat transfer rate
      74             :         Real64 QEvap = 0.0;           // reporting: evaporator heat transfer rate
      75             :         Real64 QCond = 0.0;           // reporting: condenser heat transfer rate
      76             :         Real64 PumpingEnergy = 0.0;   // reporting: electric pumping power
      77             :         Real64 GeneratorEnergy = 0.0; // reporting: steam heat transfer rate
      78             :         Real64 EvapEnergy = 0.0;      // reporting: evaporator heat transfer rate
      79             :         Real64 CondEnergy = 0.0;      // reporting: condenser heat transfer rate
      80             :         Real64 CondInletTemp = 0.0;   // reporting: condenser inlet temperature
      81             :         Real64 EvapInletTemp = 0.0;   // reporting: evaporator inlet temperature
      82             :         Real64 CondOutletTemp = 0.0;  // reporting: condenser outlet temperature
      83             :         Real64 EvapOutletTemp = 0.0;  // reporting: evaporator outlet temperature
      84             :         Real64 Evapmdot = 0.0;        // reporting: evaporator mass flow rate
      85             :         Real64 Condmdot = 0.0;        // reporting: condenser mass flow rate
      86             :         Real64 Genmdot = 0.0;         // reporting: generator mass flow rate when connected to plant
      87             :         Real64 SteamMdot = 0.0;       // reporting: steam mass flow rate
      88             :         Real64 ActualCOP = 0.0;       // reporting: coefficient of performance = QEvap/QGenerator
      89             :     };
      90             : 
      91           8 :     struct BLASTAbsorberSpecs : PlantComponent
      92             :     {
      93             :         // Members
      94             :         std::string Name;                                            // user identifier
      95             :         bool Available = false;                                      // need an array of logicals--load identifiers of available equipment
      96             :         bool ON = false;                                             // simulate the machine at it's operating part load ratio
      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             :         DataPlant::FlowMode FlowMode = DataPlant::FlowMode::Invalid; // one of 3 modes for component flow during operation
     102             :         bool ModulatedFlowSetToLoop = false;                         // True if the setpoint is missing at the outlet node
     103             :         bool ModulatedFlowErrDone = false;                           // true if setpoint warning issued
     104             :         Real64 EvapVolFlowRate = 0.0;                                // m3/s - design water volumetric flow rate through the evaporator
     105             :         bool EvapVolFlowRateWasAutoSized = false;                    // true if evaporator flow rate was autosize on input
     106             :         Real64 CondVolFlowRate = 0.0;                                // m3/s - design water volumetric flow rate through the condenser
     107             :         bool CondVolFlowRateWasAutoSized = false;                    // true if condenser flow rate was autosize on input
     108             :         Real64 EvapMassFlowRateMax = 0.0;                            // Max Design Evaporator Mass Flow Rate converted from Volume Flow Rate
     109             :         Real64 CondMassFlowRateMax = 0.0;                            // Max Design Condenser Mass Flow Rate [kg/s]
     110             :         Real64 GenMassFlowRateMax = 0.0;                             // Max Design Generator Mass Flow Rate converted from Volume Flow Rate
     111             :         Real64 SizFac = 0.0;                                         // Sizing factor
     112             :         int EvapInletNodeNum = 0;                                    // Node number on the inlet side of the plant
     113             :         int EvapOutletNodeNum = 0;                                   // Node number on the outlet side of the plant
     114             :         int CondInletNodeNum = 0;                                    // Node number on the inlet side of the condenser
     115             :         int CondOutletNodeNum = 0;                                   // Node number on the outlet side of the condenser
     116             :         int GeneratorInletNodeNum = 0;                               // absorber steam inlet node number, water side
     117             :         int GeneratorOutletNodeNum = 0;                              // absorber steam outlet node number, water side
     118             :         Real64 MinPartLoadRat = 0.0;                                 // (BLAST MIN) min allowed operating frac full load
     119             :         Real64 MaxPartLoadRat = 0.0;                                 // (BLAST MAX) max allowed operating frac full load
     120             :         Real64 OptPartLoadRat = 0.0;                                 // (BLAST BEST) optimal operating frac full load
     121             :         Real64 TempDesCondIn = 0.0;                                  // C - (BLAST ADJTC(1)The design secondary loop fluid
     122             :         // temperature at the Absorber condenser side inlet
     123             :         std::array<Real64, 3> SteamLoadCoef = {0.0};                                        // (BLAST RPWRC() ) coeff of full load poly. fit
     124             :         std::array<Real64, 3> PumpPowerCoef = {0.0};                                        // coeff of pumping power poly. fit
     125             :         Real64 TempLowLimitEvapOut = 0.0;                                                   // C - low temperature shut off
     126             :         int ErrCount2 = 0;                                                                  // error counter
     127             :         DataLoopNode::NodeFluidType GenHeatSourceType = DataLoopNode::NodeFluidType::Blank; // Generator heat source type
     128             :         Real64 GeneratorVolFlowRate = 0.0;                                                  // m3/s - hot water volumetric flow rate through generator
     129             :         bool GeneratorVolFlowRateWasAutoSized = false;                                      // true if hot water flow was autosize on input
     130             :         Real64 GeneratorSubcool = 0.0;                                                      // amount of subcooling in steam generator
     131             :         int SteamFluidIndex = 0;                                                            // index to generator fluid type
     132             :         Real64 GeneratorDeltaTemp = -99999.0;                                               // C - generator fluid temperature difference (water only)
     133             :         bool GeneratorDeltaTempWasAutoSized = true;                                         // true if generator delta T was autosize on input
     134             :         PlantLocation CWPlantLoc;                                                           // chilled water plant loop index number
     135             :         PlantLocation CDPlantLoc;                                                           // condenser water plant loop index number
     136             :         PlantLocation GenPlantLoc;                                                          // generator water plant loop index number
     137             :         bool FaultyChillerSWTFlag = false;                                                  // True if the chiller has SWT sensor fault
     138             :         int FaultyChillerSWTIndex = 0;                                                      // Index of the fault object corresponding to the chiller
     139             :         Real64 FaultyChillerSWTOffset = 0.0;                                                // Chiller SWT sensor offset
     140             :         bool PossibleSubcooling = false;  // flag to indicate chiller is doing less cooling that requested
     141             :         Real64 CondMassFlowRate = 0.0;    // Kg/s - condenser mass flow rate, water side
     142             :         Real64 EvapMassFlowRate = 0.0;    // Kg/s - evaporator mass flow rate, water side
     143             :         Real64 SteamMassFlowRate = 0.0;   // Kg/s - steam mass flow rate, water side
     144             :         Real64 CondOutletTemp = 0.0;      // C - condenser outlet temperature, water side
     145             :         Real64 EvapOutletTemp = 0.0;      // C - evaporator outlet temperature, water side
     146             :         Real64 GenOutletTemp = 0.0;       // C - generator fluid outlet temperature
     147             :         Real64 SteamOutletEnthalpy = 0.0; // J/kg - generator fluid outlet enthalpy
     148             :         Real64 PumpingPower = 0.0;        // W - rate of Absorber energy use
     149             :         Real64 PumpingEnergy = 0.0;       // J - Absorber energy use
     150             :         Real64 QGenerator = 0.0;          // W - rate of Absorber steam use
     151             :         Real64 GeneratorEnergy = 0.0;     // J - Absorber steam use
     152             :         Real64 QEvaporator = 0.0;         // W - rate of heat transfer to the evaporator coil
     153             :         Real64 EvaporatorEnergy = 0.0;    // J - heat transfer to the evaporator coil
     154             :         Real64 QCondenser = 0.0;          // W - rate of heat transfer to the condenser coil
     155             :         Real64 CondenserEnergy = 0.0;     // J - heat transfer to the condenser coil
     156             :         bool MyOneTimeFlag = true;
     157             :         bool MyEnvrnFlag = true;
     158             :         bool GenInputOutputNodesUsed = false;
     159             :         ReportVars Report;
     160             :         DataBranchAirLoopPlant::ControlType EquipFlowCtrl = DataBranchAirLoopPlant::ControlType::Invalid;
     161             : 
     162             :         static PlantComponent *factory(EnergyPlusData &state, std::string const &objectName);
     163             : 
     164             :         void simulate([[maybe_unused]] EnergyPlusData &state,
     165             :                       const PlantLocation &calledFromLocation,
     166             :                       bool FirstHVACIteration,
     167             :                       Real64 &CurLoad,
     168             :                       bool RunFlag) override;
     169             : 
     170             :         void onInitLoopEquip([[maybe_unused]] EnergyPlusData &state, const PlantLocation &calledFromLocation) override;
     171             : 
     172             :         void oneTimeInit(EnergyPlusData &state) override;
     173             : 
     174             :         void initEachEnvironment(EnergyPlusData &state);
     175             : 
     176             :         void getDesignCapacities(
     177             :             EnergyPlusData &state, const PlantLocation &calledFromLocation, Real64 &MaxLoad, Real64 &MinLoad, Real64 &OptLoad) override;
     178             : 
     179             :         void getDesignTemperatures(Real64 &tempDesCondIn, Real64 &TempDesEvapOut) override;
     180             : 
     181             :         void getSizingFactor(Real64 &sizFac) override;
     182             : 
     183             :         void initialize(EnergyPlusData &state, bool RunFlag, Real64 MyLoad);
     184             : 
     185             :         void setupOutputVars(EnergyPlusData &state);
     186             : 
     187             :         void sizeChiller(EnergyPlusData &state);
     188             : 
     189             :         void calculate(EnergyPlusData &state, Real64 &MyLoad, bool RunFlag);
     190             : 
     191             :         void updateRecords(EnergyPlusData &state, Real64 MyLoad, bool RunFlag);
     192             :     };
     193             : 
     194             :     void GetBLASTAbsorberInput(EnergyPlusData &state);
     195             : 
     196             : } // namespace ChillerAbsorption
     197             : 
     198        1542 : struct ChillerAbsorberData : BaseGlobalStruct
     199             : {
     200             :     bool getInput = true;
     201             :     Array1D<ChillerAbsorption::BLASTAbsorberSpecs> absorptionChillers;
     202             : 
     203           0 :     void clear_state() override
     204             :     {
     205           0 :         *this = ChillerAbsorberData();
     206           0 :     }
     207             : };
     208             : 
     209             : } // namespace EnergyPlus
     210             : 
     211             : #endif

Generated by: LCOV version 1.13