LCOV - code coverage report
Current view: top level - EnergyPlus - CTElectricGenerator.hh (source / functions) Coverage Total Hit
Test: lcov.output.filtered Lines: 100.0 % 9 9
Test Date: 2025-06-02 12:03:30 Functions: 100.0 % 4 4

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

Generated by: LCOV version 2.0-1