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