LCOV - code coverage report
Current view: top level - EnergyPlus - CTElectricGenerator.hh (source / functions) Hit Total Coverage
Test: lcov.output.filtered Lines: 4 7 57.1 %
Date: 2023-01-17 19:17:23 Functions: 5 8 62.5 %

          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 CTElectricGenerator_hh_INCLUDED
      49             : #define CTElectricGenerator_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/ElectricPowerServiceManager.hh>
      58             : #include <EnergyPlus/EnergyPlus.hh>
      59             : #include <EnergyPlus/Plant/Enums.hh>
      60             : #include <EnergyPlus/PlantComponent.hh>
      61             : 
      62             : namespace EnergyPlus {
      63             : 
      64             : // Forward declarations
      65             : struct EnergyPlusData;
      66             : 
      67             : namespace CTElectricGenerator {
      68             : 
      69          18 :     struct CTGeneratorData : PlantComponent
      70             :     {
      71             :         // Members
      72             :         std::string Name;                                   // user identifier
      73             :         std::string TypeOf = "Generator:CombustionTurbine"; // Type of Generator
      74             :         GeneratorType CompType_Num = GeneratorType::CombTurbine;
      75             :         std::string FuelType;           // Type of Fuel - DIESEL, GASOLINE, GAS
      76             :         Real64 RatedPowerOutput = 0.0;  // W - design nominal capacity of Generator
      77             :         int ElectricCircuitNode = 0;    // Electric Circuit Node
      78             :         Real64 MinPartLoadRat = 0.0;    // (CT MIN) min allowed operating frac full load
      79             :         Real64 MaxPartLoadRat = 0.0;    // (CT MAX) max allowed operating frac full load
      80             :         Real64 OptPartLoadRat = 0.0;    // (CT BEST) optimal operating frac full load
      81             :         Real64 FuelEnergyUseRate = 0.0; // (EFUEL) rate of Fuel Energy Required to run COMBUSTION turbine (W)
      82             :         Real64 FuelEnergy = 0.0;        // Amount of Fuel Energy Required to run COMBUSTION turbine (J)
      83             :         int PLBasedFuelInputCurve = 0;  // (FUL1GC) Curve Index for Part Load Ratio Based Fuel Input
      84             :         // Coefficients Poly Fit
      85             :         int TempBasedFuelInputCurve = 0; // (FUL2GC) Curve Index for Ambient Temperature Based Fuel Input
      86             :         // Coeff Poly Fit
      87             :         Real64 ExhaustFlow = 0.0;        // (FEX) Exhaust Gas Flow Rate cubic meters per second???
      88             :         int ExhaustFlowCurve = 0;        // (FEXGC) Curve Index for Exhaust Gas Flow Rate Input Coef Poly Fit
      89             :         Real64 ExhaustTemp = 0.0;        // (TEX) Exhaust Gas Temperature in C
      90             :         int PLBasedExhaustTempCurve = 0; // (TEX1GC) Curve Index for Part Load Ratio Based Exhaust Temp Input
      91             :         // Coeffs Poly Fit
      92             :         int TempBasedExhaustTempCurve = 0; // (TEX2GC) Curve Index for Ambient Temperature Based Exhaust Gas Temp to
      93             :         // Fuel Energy Input Coeffs Poly Fit
      94             :         Real64 QLubeOilRecovered = 0.0;         // (ELUBE) Recovered Lube Oil Energy (W)
      95             :         Real64 QExhaustRecovered = 0.0;         // (EEX) Recovered Exhaust heat  (W)
      96             :         Real64 QTotalHeatRecovered = 0.0;       // total heat recovered (W)
      97             :         Real64 LubeOilEnergyRec = 0.0;          // Recovered Lube Oil Energy (J)
      98             :         Real64 ExhaustEnergyRec = 0.0;          // Recovered Exhaust heat  (J)
      99             :         Real64 TotalHeatEnergyRec = 0.0;        // total heat recovered (J)
     100             :         int QLubeOilRecoveredCurve = 0;         // (ELUBEGC) Curve Index for Recoverable Lube Oil heat Input Coef Poly Fit
     101             :         Real64 UA = 0.0;                        // (UACGC) exhaust gas Heat Exchanger UA
     102             :         std::array<Real64, 2> UACoef = {0.0};   // Heat Exchanger UA  Coeffs Poly Fit
     103             :         Real64 MaxExhaustperCTPower = 0.0;      // MAX EXHAUST FLOW PER W POWER OUTPUT COEFF
     104             :         Real64 DesignHeatRecVolFlowRate = 0.0;  // m3/s, Design Water mass flow rate through heat recovery loop
     105             :         Real64 DesignHeatRecMassFlowRate = 0.0; // kg/s, Design Water mass flow rate through heat recovery loop
     106             :         Real64 DesignMinExitGasTemp = 0.0;      // Steam Saturation Temperature (C)
     107             :         Real64 DesignAirInletTemp = 0.0;        // Design Turbine Air Inlet Temperature (C)
     108             :         Real64 ExhaustStackTemp = 0.0;          // turbine exhaust gas temp (C)
     109             :         bool HeatRecActive = false;             // true when design max flow rate > 0
     110             :         int HeatRecInletNodeNum = 0;            // Node number on the heat recovery inlet side of the condenser
     111             :         int HeatRecOutletNodeNum = 0;           // Node number on the heat recovery outlet side of the condenser
     112             :         Real64 HeatRecInletTemp = 0.0;          // Inlet Temperature of the heat recovery fluid
     113             :         Real64 HeatRecOutletTemp = 0.0;         // Outlet Temperature of the heat recovery fluid
     114             :         Real64 HeatRecMdot = 0.0;               // reporting: Heat Recovery Loop Mass flow rate
     115             :         PlantLocation HRPlantLoc;               // cooling water plant loop component index, for heat recovery
     116             :         Real64 FuelMdot = 0.0;                  // reporting: Fuel Amount used (kg/s)
     117             :         Real64 FuelHeatingValue = 0.0;          // Heating Value for Fuel in (kJ/kg)
     118             :         Real64 ElecPowerGenerated = 0.0;        // reporting: power generated (W)
     119             :         Real64 ElecEnergyGenerated = 0.0;       // reporting: power generated (W)
     120             :         Real64 HeatRecMaxTemp = 0.0;            // Max Temp that can be produced in heat recovery
     121             :         int OAInletNode = 0;                    // optional inlet node index pointer for outdoor air for combustion
     122             :         bool MyEnvrnFlag = true;
     123             :         bool MyPlantScanFlag = true;
     124             :         bool MySizeAndNodeInitFlag = true;
     125             :         bool CheckEquipName = true;
     126             :         bool MyFlag = true;
     127             : 
     128             :         // Default Constructor
     129           6 :         CTGeneratorData() : HRPlantLoc{}
     130             :         {
     131           6 :         }
     132             : 
     133             :         void
     134             :         simulate(EnergyPlusData &state, const PlantLocation &calledFromLocation, bool FirstHVACIteration, Real64 &CurLoad, bool RunFlag) override;
     135             : 
     136             :         void setupOutputVars(EnergyPlusData &state);
     137             : 
     138             :         void InitCTGenerators(EnergyPlusData &state, bool RunFlag, bool FirstHVACIteration);
     139             : 
     140             :         void CalcCTGeneratorModel(EnergyPlusData &state, bool RunFlag, Real64 MyLoad, bool FirstHVACIteration);
     141             : 
     142             :         static PlantComponent *factory(EnergyPlusData &state, std::string const &objectName);
     143             : 
     144             :         void oneTimeInit(EnergyPlusData &state) override;
     145             :     };
     146             : 
     147             :     void GetCTGeneratorInput(EnergyPlusData &state);
     148             : 
     149             : } // namespace CTElectricGenerator
     150             : 
     151        1542 : struct CTElectricGeneratorData : BaseGlobalStruct
     152             : {
     153             :     bool getCTInputFlag = true;
     154             :     Array1D<CTElectricGenerator::CTGeneratorData> CTGenerator;
     155             : 
     156           0 :     void clear_state() override
     157             :     {
     158           0 :         *this = CTElectricGeneratorData();
     159           0 :     }
     160             : };
     161             : 
     162             : } // namespace EnergyPlus
     163             : 
     164             : #endif

Generated by: LCOV version 1.13