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