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 MicroturbineElectricGenerator_hh_INCLUDED
49 : #define MicroturbineElectricGenerator_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/PlantComponent.hh>
60 :
61 : namespace EnergyPlus {
62 :
63 : // Forward declarations
64 : struct EnergyPlusData;
65 :
66 : namespace MicroturbineElectricGenerator {
67 :
68 18 : struct MTGeneratorSpecs : PlantComponent
69 : {
70 : // Members
71 : std::string Name; // User identifier (name)
72 : Real64 RefElecPowerOutput; // Reference Electrical Power Output from generator (W)
73 : Real64 MinElecPowerOutput; // Minimum Electrical Power Output (W)
74 : Real64 MaxElecPowerOutput; // Maximum Electrical Power Output (W)
75 : Real64 RefThermalPowerOutput; // Reference Electrical Power Output from generator (W)
76 : Real64 MinThermalPowerOutput; // Minimum Electrical Power Output (W)
77 : Real64 MaxThermalPowerOutput; // Maximum Electrical Power Output (W)
78 : Real64 RefElecEfficiencyLHV; // Reference Electrical Efficiency based on fuel LHV
79 : Real64 RefCombustAirInletTemp; // Reference Combustion Air Inlet Temperature (C)
80 : Real64 RefCombustAirInletHumRat; // Reference Combustion Air Inlet Humidity Ratio (kg/kg)
81 : Real64 RefElevation; // Reference Elevation (m)
82 : int ElecPowFTempElevCurveNum; // Curve index for Electrical Power as a function of temp and elev.
83 : int ElecEffFTempCurveNum; // Curve index for Electrical Efficiency function of temp
84 : int ElecEffFPLRCurveNum; // Curve index for Electrical Efficiency as a function of PLR
85 : Real64 FuelHigherHeatingValue; // Higher Heating Value for Fuel (kJ/kg)
86 : Real64 FuelLowerHeatingValue; // Lower Heating Value for Fuel (kJ/kg)
87 : Real64 StandbyPower; // Standby Power entered by user (W)
88 : Real64 AncillaryPower; // Ancillary Power entered by user (W)
89 : int AncillaryPowerFuelCurveNum; // Index to ancillary power modifer curve (function of fuel input)
90 : int HeatRecInletNodeNum; // Heat Recovery Water Inlet Node number
91 : int HeatRecOutletNodeNum; // Heat Recovery Water Outlet Node number
92 : Real64 RefThermalEffLHV; // Reference Thermal Efficiency (LHV Basis)
93 : Real64 RefInletWaterTemp; // Reference Inlet Water Temperature for heat recovery (C)
94 : bool InternalFlowControl; // A9, \field Heat Recovery Water Flow Operating Mode
95 : bool PlantFlowControl; // Default = Plant Control
96 : Real64 RefHeatRecVolFlowRate; // Reference Heat Recovery Water Flow Rate (m3/s)
97 : int HeatRecFlowFTempPowCurveNum; // Curve index for Heat Recovery Water Flow Rate function of temp & power
98 : int ThermEffFTempElevCurveNum; // Curve index for Thermal Efficiency function of temp & elevation
99 : int HeatRecRateFPLRCurveNum; // Curve index for Heat Recovery Rate function of part-load ratio
100 : int HeatRecRateFTempCurveNum; // Curve index for Heat Recovery Rate function of inlet water temp
101 : int HeatRecRateFWaterFlowCurveNum; // Curve index for Heat Recovery Rate function of water flow rate
102 : Real64 HeatRecMinVolFlowRate; // Minimum Heat Recovery Water volume Flow Rate (m3/s)
103 : Real64 HeatRecMaxVolFlowRate; // Maximum Heat Recovery Water volume Flow Rate (m3/s)
104 : Real64 HeatRecMaxWaterTemp; // Maximum Heat Recovery Water Temperature (C)
105 : int CombustionAirInletNodeNum; // Combustion Air Inlet Node number
106 : int CombustionAirOutletNodeNum; // Combustion Air Outlet (Exhaust) Node number
107 : bool ExhAirCalcsActive; // Flag to enable exhaust air calculations
108 : Real64 RefExhaustAirMassFlowRate; // Reference Exhaust Air Mass Flow Rate (kg/s)
109 : Real64 ExhaustAirMassFlowRate; // Actual Exhaust Air Mass Flow Rate (kg/s)
110 : int ExhFlowFTempCurveNum; // Curve index for Exhaust Air Flow Rate function of inlet air temp
111 : int ExhFlowFPLRCurveNum; // Curve index for Exhaust Air Flow Rate function of part-load ratio
112 : Real64 NomExhAirOutletTemp; // Nominal Exhaust Air Outlet Temperature (C)
113 : int ExhAirTempFTempCurveNum; // Curve index for Exhaust Air Temperature function of inlet air temp
114 : int ExhAirTempFPLRCurveNum; // Curve index for Exhaust Air Temperature function of part-load ratio
115 : Real64 ExhaustAirTemperature; // Combustion exhaust air temperature (C)
116 : Real64 ExhaustAirHumRat; // Combustion exhaust air humidity ratio (kg/kg)
117 : // Other required variables/calculated values
118 : GeneratorType CompType_Num;
119 : Real64 RefCombustAirInletDensity; // Reference combustion air inlet density (kg/m3)
120 : Real64 MinPartLoadRat; // Min allowed operating frac full load
121 : Real64 MaxPartLoadRat; // Max allowed operating frac full load
122 : Real64 FuelEnergyUseRateHHV; // Rate of Fuel Energy required to run microturbine, HHV basis (W)
123 : Real64 FuelEnergyUseRateLHV; // Rate of Fuel Energy required to run microturbine, LHV basis (W)
124 : Real64 QHeatRecovered; // Recovered exhaust energy rate to heat water (W)
125 : Real64 ExhaustEnergyRec; // Recovered exhaust energy to heat water (J)
126 : Real64 DesignHeatRecMassFlowRate; // Design Water mass flow rate through heat recovery loop (kg/s)
127 : bool HeatRecActive; // TRUE when heat recovery water inlet and outlet nodes are defined
128 : Real64 HeatRecInletTemp; // Inlet Temperature of the heat recovery fluid (C)
129 : Real64 HeatRecOutletTemp; // Outlet Temperature of the heat recovery fluid (C)
130 : Real64 HeatRecMinMassFlowRate; // Minimum heat recovery water mass flow rate (kg/s)
131 : Real64 HeatRecMaxMassFlowRate; // Maximum heat recovery water mass flow rate (kg/s)
132 : Real64 HeatRecMdot; // Heat Recovery Loop Mass flow rate (kg/s)
133 : PlantLocation HRPlantLoc; // cooling water plant loop component index, for heat recovery
134 : Real64 FuelMdot; // Fuel Amount used (kg/s)
135 : Real64 ElecPowerGenerated; // Electric power generated (W)
136 : Real64 StandbyPowerRate; // Standby power rate this time step (W)
137 : Real64 AncillaryPowerRate; // Ancillary power rate this time step (W)
138 : // Warning message variables
139 : int PowerFTempElevErrorIndex; // Index to power as a function of temp/elevation warning message
140 : int EffFTempErrorIndex; // Index to efficiency as a function of temperature warning message
141 : int EffFPLRErrorIndex; // Index to efficiency as a function of PLR warning message
142 : int ExhFlowFTempErrorIndex; // Index to exhaust flow as a function of temp warning message
143 : int ExhFlowFPLRErrorIndex; // Index to exhaust flow as a function of PLR warning message
144 : int ExhTempFTempErrorIndex; // Index to exhaust temp as a function of temp warning message
145 : int ExhTempFPLRErrorIndex; // Index to exhaust temp as a function of PLR warning message
146 : int HRMinFlowErrorIndex; // Index to reclaim water flow rate warning message
147 : int HRMaxFlowErrorIndex; // Index to reclaim water flow rate warning message
148 : int ExhTempLTInletTempIndex; // Index to exhaust temp < combustion inlet air temp warning messages
149 : int ExhHRLTInletHRIndex; // Index to exhaust hum rat < combustion inlet air hum rat warning messages
150 : int AnciPowerIterErrorIndex; // Index to Ancillary Power iteration loop warning messages
151 : int AnciPowerFMdotFuelErrorIndex; // Index to Ancillary Power as a function of fuel input warning messages
152 : int HeatRecRateFPLRErrorIndex; // Index to heat recovery rate as a function of PLR warning messages
153 : int HeatRecRateFTempErrorIndex; // Index to heat recovery rate as a function of temp warning messages
154 : int HeatRecRateFFlowErrorIndex; // Index to heat recovery rate as a function of flow warning messages
155 : int ThermEffFTempElevErrorIndex; // Index to thermal efficiency as a function of temp/elevation warnings
156 : bool CheckEquipName;
157 : bool MyEnvrnFlag;
158 : bool MyPlantScanFlag;
159 : bool MySizeAndNodeInitFlag;
160 : Real64 EnergyGen; // Reporting: Electric energy produced (J)
161 : Real64 FuelEnergyHHV; // Reporting: Fuel Energy used (J)
162 : Real64 ElectricEfficiencyLHV; // Reporting: Electric efficiency LHV (-)
163 : Real64 ThermalEfficiencyLHV; // Reporting: Thermal (heat recovery to water) efficiency LHV (-)
164 : Real64 AncillaryEnergy; // Reporting: Ancillary energy use (J)
165 : Real64 StandbyEnergy; // Reporting: Standby energy use (J)
166 : std::string FuelType;
167 : bool myFlag;
168 :
169 : // Default Constructor
170 12 : MTGeneratorSpecs()
171 12 : : RefElecPowerOutput(0.0), MinElecPowerOutput(0.0), MaxElecPowerOutput(0.0), RefThermalPowerOutput(0.0), MinThermalPowerOutput(0.0),
172 : MaxThermalPowerOutput(0.0), RefElecEfficiencyLHV(0.0), RefCombustAirInletTemp(0.0), RefCombustAirInletHumRat(0.0), RefElevation(0.0),
173 : ElecPowFTempElevCurveNum(0), ElecEffFTempCurveNum(0), ElecEffFPLRCurveNum(0), FuelHigherHeatingValue(0.0), FuelLowerHeatingValue(0.0),
174 : StandbyPower(0.0), AncillaryPower(0.0), AncillaryPowerFuelCurveNum(0), HeatRecInletNodeNum(0), HeatRecOutletNodeNum(0),
175 : RefThermalEffLHV(0.0), RefInletWaterTemp(0.0), InternalFlowControl(false), PlantFlowControl(true), RefHeatRecVolFlowRate(0.0),
176 : HeatRecFlowFTempPowCurveNum(0), ThermEffFTempElevCurveNum(0), HeatRecRateFPLRCurveNum(0), HeatRecRateFTempCurveNum(0),
177 : HeatRecRateFWaterFlowCurveNum(0), HeatRecMinVolFlowRate(0.0), HeatRecMaxVolFlowRate(0.0), HeatRecMaxWaterTemp(0.0),
178 : CombustionAirInletNodeNum(0), CombustionAirOutletNodeNum(0), ExhAirCalcsActive(false), RefExhaustAirMassFlowRate(0.0),
179 : ExhaustAirMassFlowRate(0.0), ExhFlowFTempCurveNum(0), ExhFlowFPLRCurveNum(0), NomExhAirOutletTemp(0.0), ExhAirTempFTempCurveNum(0),
180 : ExhAirTempFPLRCurveNum(0), ExhaustAirTemperature(0.0), ExhaustAirHumRat(0.0), CompType_Num(GeneratorType::Microturbine),
181 : RefCombustAirInletDensity(0.0), MinPartLoadRat(0.0), MaxPartLoadRat(0.0), FuelEnergyUseRateHHV(0.0), FuelEnergyUseRateLHV(0.0),
182 : QHeatRecovered(0.0), ExhaustEnergyRec(0.0), DesignHeatRecMassFlowRate(0.0), HeatRecActive(false), HeatRecInletTemp(0.0),
183 : HeatRecOutletTemp(0.0), HeatRecMinMassFlowRate(0.0), HeatRecMaxMassFlowRate(0.0), HeatRecMdot(0.0), HRPlantLoc{}, FuelMdot(0.0),
184 : ElecPowerGenerated(0.0), StandbyPowerRate(0.0), AncillaryPowerRate(0.0), PowerFTempElevErrorIndex(0), EffFTempErrorIndex(0),
185 : EffFPLRErrorIndex(0), ExhFlowFTempErrorIndex(0), ExhFlowFPLRErrorIndex(0), ExhTempFTempErrorIndex(0), ExhTempFPLRErrorIndex(0),
186 : HRMinFlowErrorIndex(0), HRMaxFlowErrorIndex(0), ExhTempLTInletTempIndex(0), ExhHRLTInletHRIndex(0), AnciPowerIterErrorIndex(0),
187 : AnciPowerFMdotFuelErrorIndex(0), HeatRecRateFPLRErrorIndex(0), HeatRecRateFTempErrorIndex(0), HeatRecRateFFlowErrorIndex(0),
188 : ThermEffFTempElevErrorIndex(0), CheckEquipName(true), MyEnvrnFlag(true), MyPlantScanFlag(true), MySizeAndNodeInitFlag(true),
189 : EnergyGen(0.0), FuelEnergyHHV(0.0), ElectricEfficiencyLHV(0.0), ThermalEfficiencyLHV(0.0), AncillaryEnergy(0.0), StandbyEnergy(0.0),
190 12 : myFlag(true)
191 : {
192 12 : }
193 :
194 : void simulate([[maybe_unused]] EnergyPlusData &state,
195 : const PlantLocation &calledFromLocation,
196 : bool FirstHVACIteration,
197 : Real64 &CurLoad,
198 : bool RunFlag) override;
199 :
200 : void getDesignCapacities(EnergyPlusData &state,
201 : [[maybe_unused]] const PlantLocation &calledFromLocation,
202 : [[maybe_unused]] Real64 &MaxLoad,
203 : [[maybe_unused]] Real64 &MinLoad,
204 : [[maybe_unused]] Real64 &OptLoad) override;
205 :
206 : void InitMTGenerators(EnergyPlusData &state,
207 : bool RunFlag,
208 : Real64 MyLoad, // electrical load in W
209 : bool FirstHVACIteration);
210 :
211 : void CalcMTGeneratorModel(EnergyPlusData &state,
212 : bool RunFlag, // TRUE when generator is being asked to operate
213 : Real64 MyLoad // Generator demand (W)
214 : );
215 :
216 : void UpdateMTGeneratorRecords(EnergyPlusData &state);
217 :
218 : void setupOutputVars(EnergyPlusData &state);
219 :
220 : static PlantComponent *factory(EnergyPlusData &state, std::string const &objectName);
221 :
222 : void oneTimeInit(EnergyPlusData &state) override;
223 : };
224 :
225 : void GetMTGeneratorInput(EnergyPlusData &state);
226 :
227 : } // namespace MicroturbineElectricGenerator
228 :
229 1542 : struct MicroturbineElectricGeneratorData : BaseGlobalStruct
230 : {
231 :
232 : int NumMTGenerators = 0;
233 : bool GetMTInput = true;
234 : EPVector<MicroturbineElectricGenerator::MTGeneratorSpecs> MTGenerator;
235 :
236 0 : void clear_state() override
237 : {
238 0 : this->NumMTGenerators = 0;
239 0 : this->GetMTInput = true;
240 0 : this->MTGenerator.clear();
241 0 : }
242 : };
243 :
244 : } // namespace EnergyPlus
245 :
246 : #endif
|