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 DataGenerators_hh_INCLUDED
49 : #define DataGenerators_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/EnergyPlus.hh>
58 : #include <EnergyPlus/ScheduleManager.hh>
59 :
60 : namespace EnergyPlus {
61 :
62 : namespace DataGenerators {
63 :
64 : // MODULE PARAMETER DEFINITIONS:
65 : enum class CurveMode
66 : {
67 : Invalid = -1,
68 : Normalized, // mode where efficiency curves are modifier curves
69 : Direct, // mode where efficiency curves are direct
70 : Num
71 : };
72 :
73 : enum class SkinLoss
74 : {
75 : Invalid = -1,
76 : ConstantRate,
77 : UADT, // UAdelta T mode for skin losses
78 : QuadraticFuelNdot, // Quadratic function of fuel flow for skin losses
79 : Num
80 : };
81 :
82 : enum class AirSupRateMode
83 : {
84 : Invalid = -1,
85 : QuadraticFuncofNdot, // function of fuel rate mode for air flow
86 : ConstantStoicsAirRat, // Constant air ratio in stoics with fuel constituents
87 : QuadraticFuncofPel, // function of electric power mode
88 : Num
89 : };
90 :
91 : enum class RecoverMode
92 : {
93 : Invalid = -1,
94 : NoRecoveryOnAirIntake, // mode for controlling intake air heat recovery
95 : RecoverBurnInvertBatt, // mode for controlling intake air heat recovery
96 : RecoverAuxiliaryBurner, // mode for controlling intake air heat recovery
97 : RecoverInverterBatt, // mode for controlling intake air heat recovery
98 : RecoverInverter, // mode for controlling intake air heat recovery
99 : RecoverBattery, // mode for controlling intake air heat recovery
100 : Num
101 : };
102 :
103 : enum class ConstituentMode
104 : {
105 : Invalid = -1,
106 : RegularAir,
107 : UserDefinedConstituents,
108 : Num
109 : };
110 :
111 : enum class FuelTemperatureMode
112 : {
113 : Invalid = -1,
114 : FuelInTempFromNode,
115 : FuelInTempSchedule,
116 : Num
117 : };
118 :
119 : enum class WaterTempMode
120 : {
121 : Invalid = -1,
122 : Mains,
123 : AirNode,
124 : WaterNode,
125 : Schedule,
126 : Num
127 : };
128 :
129 : enum class InverterEfficiencyMode
130 : {
131 : Invalid = -1,
132 : Constant,
133 : Quadratic,
134 : Num
135 : };
136 :
137 : enum class ExhaustGasHX
138 : {
139 : Invalid = -1,
140 : FixedEffectiveness, // exhaust gas HX modeling mode
141 : LMTDempiricalUAeff, // exhaust gas HX modeling mode
142 : LMTDfundementalUAeff, // exhaust gas HX modeling mode
143 : Condensing, // exhaust gas HX modeling mode
144 : Num
145 : };
146 :
147 : enum class ElectricalStorage
148 : {
149 : Invalid = -1,
150 : SimpleEffConstraints, // electrical storage modeling mode
151 : LeadAcidBatterySaupe, // electrical storage modeling mode
152 : LeadAcidBatterManwellMcGowan, // electrical storage modeling mode
153 : Num
154 : };
155 :
156 : enum class LossDestination
157 : {
158 : Invalid = -1,
159 : SurroundingZone,
160 : AirInletForFC,
161 : Num
162 : };
163 :
164 : enum class OperatingMode
165 : {
166 : Invalid = -1,
167 : Off, // CHP operating mode OFF
168 : Standby, // CHP operating mode Stand By
169 : WarmUp, // CHP operating mode Warm Up or start up
170 : Normal, // CHP operating mode Normal
171 : CoolDown, // CHP operating mode Cool down or shut down
172 : Num
173 : };
174 :
175 : enum class FuelMode
176 : {
177 : Invalid = -1,
178 : GaseousConstituents,
179 : GenericLiquid,
180 : Num
181 : };
182 :
183 : Real64 constexpr MinProductGasTemp(-100.0); // Minimum bound on search for product gas temps
184 : Real64 constexpr MaxProductGasTemp(2000.0); // Maximum bound on search for product gas temps
185 :
186 : enum class ThermodynamicMode
187 : {
188 : Invalid = -1,
189 : NISTShomate,
190 : NASAPolynomial,
191 : Num
192 : };
193 :
194 : Real64 constexpr RinKJperMolpK(0.0083145); // R is ideal gas constant (kJ/mol-K)
195 : Real64 constexpr InitHRTemp(50.0); // Initialization temperature for heat recovery water
196 : Real64 constexpr ImBalanceTol(0.00001); // used as fraction of electrical power at power module
197 :
198 : struct GeneratorFuelSupplyDataStruct
199 : {
200 : // Members
201 : // user input data
202 : std::string Name; // name of this fuel supply module
203 : DataGenerators::FuelTemperatureMode FuelTempMode = DataGenerators::FuelTemperatureMode::Invalid; // temperature of fuel node
204 : DataGenerators::FuelMode FuelTypeMode = DataGenerators::FuelMode::Invalid; // type of fuel, gasous or liquid
205 : std::string NodeName; // node name for temperature at input
206 : int NodeNum = 0; // node number for temperature at input
207 : Sched::Schedule *sched = nullptr; // fuel temperature at input
208 : int CompPowerCurveID = 0; // "pointer" to compressor power cubic curve
209 : Real64 CompPowerLossFactor = 0.0;
210 : int NumConstituents = 0; // number of constituents in fue supply
211 : Array1D_string ConstitName;
212 : Array1D<Real64> ConstitMolalFract;
213 : // calculated data (except some for generic liquid)
214 : Array1D_int GasLibID; // lookup ID in Gas Phase ThermoChemistry Structure Array
215 : Real64 LHV = 0.0; // lower heating value of gaseous fuel (kJ/mol)
216 : Real64 LHVJperkg = 0.0; // lower heating value of gaseous fuel (J/kg)
217 : Real64 LHVliquid = 0.0; // userdefined lhv for generic liquid (J/kg)
218 : Real64 HHV = 0.0; // higher heating value of fuel (J/kg)
219 : Real64 MW = 0.0; // molecular weight g/mol
220 : Real64 eCO2 = 0.0; // mass flow based CO2 emmissions factor for complete combustion (-)
221 : Real64 KmolPerSecToKgPerSec = 0.0; // conversion from moles to kilograms for this fuel. (
222 : Real64 StoicOxygenRate = 0.0;
223 : Real64 TfuelIntoCompress = 0.0; // inlet fuel temperature
224 : Real64 TfuelIntoFCPM = 0.0; // compressed fuel temp
225 : Real64 PfuelCompEl = 0.0; // fuel compressor power
226 : Real64 QskinLoss = 0.0; // pumping losses for zone
227 : Real64 CO2ProductGasCoef = 0.0; // molar multiplier for stoic products of this fuel
228 : Real64 H2OProductGasCoef = 0.0; // molar multiplier for stoic products of this fuel
229 :
230 : // Default Constructor
231 2 : GeneratorFuelSupplyDataStruct() : ConstitName(14), ConstitMolalFract(14, 0.0), GasLibID(14, 0)
232 : {
233 2 : }
234 : };
235 :
236 : struct GasPropertyDataStruct
237 : {
238 : // Members
239 : std::string ConstituentName;
240 : std::string ConstituentFormula;
241 : Real64 StdRefMolarEnthOfForm = 0.0;
242 : DataGenerators::ThermodynamicMode ThermoMode = DataGenerators::ThermodynamicMode::Invalid; // method of calculation for thermodynamics
243 : Real64 ShomateA = 0.0;
244 : Real64 ShomateB = 0.0;
245 : Real64 ShomateC = 0.0;
246 : Real64 ShomateD = 0.0;
247 : Real64 ShomateE = 0.0;
248 : Real64 ShomateF = 0.0;
249 : Real64 ShomateG = 0.0;
250 : Real64 ShomateH = 0.0;
251 : Real64 NumCarbons = 0.0;
252 : Real64 NumHydrogens = 0.0;
253 : Real64 NumOxygens = 0.0;
254 : Real64 MolecularWeight = 0.0;
255 : Real64 NASA_A1 = 0.0;
256 : Real64 NASA_A2 = 0.0;
257 : Real64 NASA_A3 = 0.0;
258 : Real64 NASA_A4 = 0.0;
259 : Real64 NASA_A5 = 0.0;
260 : Real64 NASA_A6 = 0.0;
261 : Real64 NASA_A7 = 0.0;
262 : };
263 :
264 : struct GeneratorDynamicsManagerStruct
265 : {
266 : // Members
267 : // user input data
268 : std::string Name;
269 : Real64 PelMin = 0.0; // minimum operating point for electrical power Pel
270 : Real64 PelMax = 0.0; // maximum operating point for electrical power Pel
271 : Real64 UpTranLimit = 0.0; // power up transient limit W/s
272 : Real64 DownTranLimit = 0.0; // power down tran limit W/s
273 : Real64 UpTranLimitFuel = 0.0; // fuel up transient limit kg/s
274 : Real64 DownTranLimitFuel = 0.0; // fuel down transient limit kg/s
275 : bool WarmUpByTimeDelay = false; // Warm up mode control
276 : bool WarmUpByEngineTemp = true; // Warm up mode control
277 : Real64 StartUpTimeDelay = 0.0; // time for start up [hours]
278 : Real64 WarmUpDelay = 0.0; // time for warm up delay [s]
279 : Real64 StartUpFuel = 0.0; // fuel use during start up
280 : Real64 StartUpElectConsum = 0.0; // electricity used during start up
281 : Real64 StartUpElectProd = 0.0; // electricity produced during start up
282 : Real64 ShutDownFuel = 0.0; // fuel consumed during shut down
283 : Real64 ShutDownElectConsum = 0.0; // Elect consumed during shut down
284 : Real64 PcoolDown = 0.0; // power during cool down
285 : Real64 CoolDownDelay = 0.0; // time for cool down delay [hours]
286 : int NumCyclesInit = 0; // number of start stop cycles at beginning
287 : Real64 NumRunHoursInit = 0.0; // number of hours of operation beginning
288 : Real64 Pstandby = 0.0; // standby power [w]
289 : Real64 MCeng = 0.0; // aggregated thermal mass of engine [ ]
290 : Real64 MCcw = 0.0; // aggregated thermal mass of heat recovery [ ]
291 : Real64 kf = 0.0; // coefficient k_f for warmup fuel flow rate
292 : Real64 TnomEngOp = 0.0; // nominal engine operating temperature [C]
293 : Real64 kp = 0.0; // coefficient k_p for warmup power
294 : bool MandatoryFullCoolDown = false;
295 : bool WarmRestartOkay = true;
296 : Sched::Schedule *availSched = nullptr;
297 : // Calculated values and input from elsewhere
298 : DataGenerators::OperatingMode CurrentOpMode = DataGenerators::OperatingMode::Off; // current operating mode, uses params like OpModeNormal
299 : DataGenerators::OperatingMode LastOpMode = DataGenerators::OperatingMode::Off;
300 : Real64 FractionalDayofLastShutDown = 0.0;
301 : Real64 FractionalDayofLastStartUp = 0.0;
302 : bool HasBeenOn = false;
303 : bool DuringStartUp = false;
304 : bool DuringShutDown = false;
305 : Real64 FuelMdotLastTimestep = 0.0;
306 : Real64 PelLastTimeStep = 0.0;
307 : int NumCycles = 0;
308 : Real64 PLRforSubtimestepStartUp = 0.0;
309 : Real64 PLRforSubtimestepShutDown = 0.0; // part load for not in shut down, shut down part is (1 - PLR)
310 : Real64 ElectEffNom = 0.0; // efficiency to use for control decisions
311 : Real64 ThermEffNom = 0.0; // thermal efficiency to use fo control decisions
312 : Real64 QdotHXMax = 0.0; // Thermal power max
313 : Real64 QdotHXMin = 0.0; // thermal power min
314 : Real64 QdotHXOpt = 0.0; // thermal power nominal/optimal
315 : };
316 :
317 : } // namespace DataGenerators
318 :
319 : struct GeneratorsData : BaseGlobalStruct
320 : {
321 : Array1D<DataGenerators::GasPropertyDataStruct> GasPhaseThermoChemistryData;
322 : Array1D<DataGenerators::GeneratorFuelSupplyDataStruct> FuelSupply; // fuel supply (reused across various)
323 : Array1D<DataGenerators::GeneratorDynamicsManagerStruct> GeneratorDynamics;
324 :
325 : int InletCWnode = 0; // cooling water inlet node ID
326 : bool InternalFlowControl = false;
327 : Real64 TcwIn = 0.0; // inlet cooling water temperature (C)
328 : Real64 TrialMdotcw = 0.0; // test or estimate of what the plant flows are going to be (kg/s)
329 : Real64 LimitMinMdotcw = 0.0; // lower limit for cooling water flow for generatior operation (kg/s)
330 :
331 2126 : void init_constant_state([[maybe_unused]] EnergyPlusData &state) override
332 : {
333 2126 : }
334 :
335 1152 : void init_state([[maybe_unused]] EnergyPlusData &state) override
336 : {
337 1152 : }
338 :
339 2100 : void clear_state() override
340 : {
341 2100 : new (this) GeneratorsData();
342 2100 : }
343 : };
344 :
345 : } // namespace EnergyPlus
346 :
347 : #endif
|