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 FuelCellElectricGenerator_hh_INCLUDED
49 : #define FuelCellElectricGenerator_hh_INCLUDED
50 :
51 : // ObjexxFCL Headers
52 : #include <ObjexxFCL/Array1D.hh>
53 :
54 : // EnergyPlus Headers
55 : #include <EnergyPlus/Data/BaseData.hh>
56 : #include <EnergyPlus/DataGenerators.hh>
57 : #include <EnergyPlus/EnergyPlus.hh>
58 : #include <EnergyPlus/Plant/DataPlant.hh>
59 : #include <EnergyPlus/PlantComponent.hh>
60 :
61 : namespace EnergyPlus {
62 :
63 : // Forward declarations
64 : namespace Curve {
65 : struct Curve;
66 : }
67 :
68 : namespace FuelCellElectricGenerator {
69 :
70 : enum class GasID
71 : // This enum starts at 1 because it has to match Gas Phase ThermoChemistry Structure Array in DataGenerators & GeneratorFuelSupply
72 : {
73 : Invalid = -1,
74 : CarbonDioxide = 1,
75 : Nitrogen,
76 : Oxygen,
77 : Water,
78 : Argon,
79 : Num
80 : };
81 :
82 : struct FCPowerModuleStruct
83 : {
84 : std::string Name; // name of this PowerModule data
85 : DataGenerators::CurveMode EffMode; // mode for efficiency curves
86 : Curve::Curve *EffCurve = nullptr; // pointer to curve for efficiency
87 : Real64 NomEff; // nominal efficiency
88 : Real64 NomPel; // nominal power rate at rating point
89 : int NumCyclesAtStart = 0.0; // number of start stop cycles at beggining of simulation (user input)
90 : int NumCycles; // number of start stop cycles
91 : Real64 CyclingDegradRat; // rate of degradation from cycles
92 : Real64 NumRunHours; // number of hours of operation
93 : Real64 OperateDegradRat; // rate of degradation from run time (per hour)
94 : Real64 ThreshRunHours; // number of hours before degradation starts
95 : Real64 UpTranLimit; // power up transient limit
96 : Real64 DownTranLimit; // power down tran limit
97 : Real64 StartUpTime; // time for start up [hours]
98 : Real64 StartUpFuel; // fuel use during start up
99 : Real64 StartUpElectConsum; // electricity used during start up
100 : Real64 StartUpElectProd; // electricity produced during start up
101 : Real64 ShutDownTime; // time to shut down [hours]
102 : Real64 ShutDownFuel; // fuel consumed during shut down
103 : Real64 ShutDownElectConsum; // Elect consumed during shut down
104 : Real64 ANC0; // Ancilliary Loads constant term
105 : Real64 ANC1; // Ancilliary Loads linear term
106 : DataGenerators::SkinLoss SkinLossMode; // how are skin losses determined
107 : std::string ZoneName;
108 : int ZoneID; // "pointer" to zone with component in it
109 : Real64 RadiativeFract;
110 : Real64 QdotSkin;
111 : Real64 UAskin;
112 : Curve::Curve *SkinLossCurve = nullptr;
113 : Curve::Curve *WaterSupplyCurve = nullptr; // pointer to curve for water use in reforming
114 : Real64 NdotDilutionAir; // user defined constant flow of dilution air (kmol/sec)
115 : Real64 StackHeatLossToDilution; // (watts)
116 : std::string DilutionInletNodeName; // dilution -> AirHR ?? added air heat recovery path
117 : int DilutionInletNode; // pointer to node for inlet
118 : std::string DilutionExhaustNodeName;
119 : int DilutionExhaustNode; // pointer to node getting exhaust
120 : Real64 PelMin; // minimum operating point for FCPM electrical power Pel
121 : Real64 PelMax; // maximum operating point for FCPM electrical power Pel
122 : // Calculated values and input from elsewhere
123 : Real64 Pel; // current DC electrical power produced
124 : Real64 PelLastTimeStep;
125 : Real64 Eel; // power module efficiency
126 : Real64 QdotStackCool; // Heat removed by stack cooler
127 : Real64 FractionalDayofLastStartUp; // fractional days into simulation
128 : Real64 FractionalDayofLastShutDown; // fractional Days into simulations
129 : bool HasBeenOn;
130 : bool DuringShutDown;
131 : bool DuringStartUp;
132 : Real64 NdotFuel; // molar fuel use rate. (kmol/sec)
133 : Real64 TotFuelInEnthalpy; // Enthalpy of fuel coming into FCPM (watts)
134 : Real64 NdotProdGas; // (kmol/sec)
135 : Array1D<Real64> ConstitMolalFract;
136 : Array1D<GasID> GasLibID; // lookup ID in Gas Phase ThermoChemistry Structure Array
137 : Real64 TprodGasLeavingFCPM;
138 : Real64 NdotAir; // molar air use rate (kmol/sec)
139 : Real64 TotAirInEnthalpy; // Enthalpy of air coming nto FCPM energy balance (watts)
140 : Real64 NdotLiqwater; // molar water use rate (kmol/sec)
141 : Real64 TwaterInlet;
142 : Real64 WaterInEnthalpy; // Enthalpy of liquid water used for reforming (watts)
143 : Real64 DilutionAirInEnthalpy; // Enthalpy of Dilution air coming into FCPM (watts)
144 : Real64 DilutionAirOutEnthalpy;
145 : Real64 PelancillariesAC; // ancillary power (watts)
146 : Real64 TotProdGasEnthalpy; // Enthalpy of product gases leaving FCPM (watts)
147 : Real64 WaterOutEnthalpy; // enthalpy of vapor from water used for reforming
148 : int SeqSubstitIter;
149 : int RegulaFalsiIter;
150 :
151 : // Default Constructor
152 1 : FCPowerModuleStruct()
153 2 : : EffMode(DataGenerators::CurveMode::Invalid), NomEff(0.0), NomPel(0.0), NumCycles(0), CyclingDegradRat(0.0), NumRunHours(0.0),
154 1 : OperateDegradRat(0.0), ThreshRunHours(0.0), UpTranLimit(0.0), DownTranLimit(0.0), StartUpTime(0.0), StartUpFuel(0.0),
155 1 : StartUpElectConsum(0.0), StartUpElectProd(0.0), ShutDownTime(0.0), ShutDownFuel(0.0), ShutDownElectConsum(0.0), ANC0(0.0), ANC1(0.0),
156 2 : SkinLossMode(DataGenerators::SkinLoss::Invalid), ZoneID(0), RadiativeFract(0.0), QdotSkin(0.0), UAskin(0.0), NdotDilutionAir(0.0),
157 3 : StackHeatLossToDilution(0.0), DilutionInletNode(0), DilutionExhaustNode(0), PelMin(0.0), PelMax(0.0), Pel(0.0), PelLastTimeStep(0.0),
158 1 : Eel(0.0), QdotStackCool(0.0), FractionalDayofLastStartUp(0.0), FractionalDayofLastShutDown(0.0), HasBeenOn(true), DuringShutDown(false),
159 1 : DuringStartUp(false), NdotFuel(0.0), TotFuelInEnthalpy(0.0), NdotProdGas(0.0), ConstitMolalFract(14, 0.0), GasLibID(14, GasID::Invalid),
160 1 : TprodGasLeavingFCPM(0.0), NdotAir(0.0), TotAirInEnthalpy(0.0), NdotLiqwater(0.0), TwaterInlet(0.0), WaterInEnthalpy(0.0),
161 1 : DilutionAirInEnthalpy(0.0), DilutionAirOutEnthalpy(0.0), PelancillariesAC(0.0), TotProdGasEnthalpy(0.0), WaterOutEnthalpy(0.0),
162 1 : SeqSubstitIter(0), RegulaFalsiIter(0)
163 : {
164 1 : }
165 : };
166 :
167 : struct FCAirSupplyDataStruct
168 : {
169 : std::string Name; // name of this
170 : std::string NodeName; // Air supply node name
171 : int SupNodeNum; // Air supply node ID
172 : Curve::Curve *BlowerPowerCurve = nullptr; // "pointer" to blower power quadratic
173 : Real64 BlowerHeatLossFactor; // alpha for blower heat loss fraction
174 : DataGenerators::AirSupRateMode AirSupRateMode; // control for modeling method used to deterime supply air flow rate
175 : Real64 Stoics; // excess air ratio
176 : Curve::Curve *AirFuncPelCurve = nullptr; // "pointer" to curve for air as function of power
177 : Real64 AirTempCoeff; // coeff a3 in equ 16.
178 : Curve::Curve *AirFuncNdotCurve = nullptr; // "pointer" to curve for air as function of fuel flow rate
179 : DataGenerators::RecoverMode IntakeRecoveryMode;
180 : DataGenerators::ConstituentMode ConstituentMode; // how are air data input
181 : int NumConstituents;
182 : Array1D_string ConstitName;
183 : Array1D<Real64> ConstitMolalFract;
184 : // Calculated values and input from elsewhere
185 : Array1D<GasID> GasLibID; // lookup ID in Gas Phase ThermoChemistry Structure Array
186 : Real64 O2fraction;
187 : Real64 TairIntoBlower; // temperature entering blower
188 : Real64 TairIntoFCPM; // temperature leaving blower and entering FCPM
189 : Real64 PairCompEl; // power drawn by compressor
190 : Real64 QskinLoss; // pumping losses for zone
191 : Real64 QintakeRecovery; // heat recovered on intake air by accessories
192 :
193 : // Default Constructor
194 1 : FCAirSupplyDataStruct()
195 2 : : SupNodeNum(0), BlowerHeatLossFactor(0.0), AirSupRateMode(DataGenerators::AirSupRateMode::Invalid), Stoics(0.0), AirTempCoeff(0.0),
196 1 : IntakeRecoveryMode(DataGenerators::RecoverMode::Invalid), ConstituentMode(DataGenerators::ConstituentMode::Invalid), NumConstituents(0),
197 1 : ConstitName(14), ConstitMolalFract(14, 0.0), GasLibID(14, GasID::Invalid), O2fraction(0.0), TairIntoBlower(0.0), TairIntoFCPM(0.0),
198 1 : PairCompEl(0.0), QskinLoss(0.0), QintakeRecovery(0.0)
199 : {
200 1 : }
201 : };
202 :
203 : struct FCWaterSupplyDataStruct
204 : {
205 : std::string Name; // name of this water supply module
206 : DataGenerators::WaterTempMode waterTempMode = DataGenerators::WaterTempMode::Invalid; // temperature of water inlet determination
207 : std::string NodeName; // node name for temperature at input
208 : int NodeNum; // node number for temperature at input
209 : Sched::Schedule *sched = nullptr; // water temperature at input
210 : Curve::Curve *WaterSupRateCurve = nullptr; // "pointer" to water flow rate curve as a function of fuel rate
211 : Curve::Curve *PmpPowerCurve = nullptr; // "pointer to Pump power curve as a function of water flow Rate
212 : Real64 PmpPowerLossFactor; // Pump heat loss factor
213 : // calculated data
214 : bool IsModeled;
215 : Real64 TwaterIntoCompress; // inlet Water Temperature
216 : Real64 TwaterIntoFCPM; // pumped water temp
217 : Real64 PwaterCompEl; // water pump power
218 : Real64 QskinLoss; // pumping losses for zone
219 :
220 : // Default Constructor
221 1 : FCWaterSupplyDataStruct()
222 1 : : NodeNum(0), PmpPowerLossFactor(0.0), IsModeled(true), TwaterIntoCompress(0.0), TwaterIntoFCPM(0.0), PwaterCompEl(0.0), QskinLoss(0.0)
223 : {
224 1 : }
225 : };
226 :
227 : struct FCAuxilHeatDataStruct
228 : {
229 : std::string Name; // name of this auxiliary heating module
230 : std::string ZoneName;
231 : int ZoneID;
232 : Real64 UASkin; // for skin losses to zone
233 : Real64 ExcessAirRAT;
234 : Real64 ANC0;
235 : Real64 ANC1;
236 : DataGenerators::LossDestination SkinLossDestination; // control mode for where lost heat goes
237 : Real64 MaxPowerW;
238 : Real64 MinPowerW;
239 : Real64 MaxPowerkmolperSec;
240 : Real64 MinPowerkmolperSec;
241 : // calculated and from elsewhere
242 : int NumConstituents;
243 : Real64 TauxMix;
244 : Real64 NdotAuxMix;
245 : Array1D<Real64> ConstitMolalFract;
246 : Array1D<GasID> GasLibID; // lookup ID in Gas Phase ThermoChemistry Structure Array
247 : Real64 QskinLoss; // Heat lost to room
248 : Real64 QairIntake; // heat into intake air
249 :
250 : // Default Constructor
251 1 : FCAuxilHeatDataStruct()
252 2 : : ZoneID(0), UASkin(0.0), ExcessAirRAT(0.0), ANC0(0.0), ANC1(0.0), SkinLossDestination(DataGenerators::LossDestination::Invalid),
253 1 : MaxPowerW(0.0), MinPowerW(0.0), MaxPowerkmolperSec(0.0), MinPowerkmolperSec(0.0), NumConstituents(0), TauxMix(0.0), NdotAuxMix(0.0),
254 1 : ConstitMolalFract(14, 0.0), GasLibID(14, GasID::Invalid), QskinLoss(0.0), QairIntake(0.0)
255 : {
256 1 : }
257 : };
258 :
259 : struct FCExhaustHXDataStruct
260 : {
261 : std::string Name; // name of this exhaust gas heat recovery
262 : std::string WaterInNodeName; // HR Water Inlet Node
263 : int WaterInNode; // HR Water Outlet Node ID
264 : std::string WaterOutNodeName; // HR water outlet Node name
265 : int WaterOutNode; // HR Water outlet Node ID
266 : Real64 WaterVolumeFlowMax; // HR water flow rate max avail
267 : std::string ExhaustOutNodeName; // air node for exhaust flow
268 : int ExhaustOutNode; // Exhaust Air node ID
269 : DataGenerators::ExhaustGasHX HXmodelMode; // Heat Exchanger Calculation Method
270 : Real64 HXEffect; // Heat Exchanger Effectiveness (method 1)
271 : Real64 hxs0; // (method 2)
272 : Real64 hxs1; // (method 2)
273 : Real64 hxs2; // (method 2)
274 : Real64 hxs3; // (method 2)
275 : Real64 hxs4; // (method 2)
276 : Real64 h0gas; // (method 3)
277 : Real64 NdotGasRef; // (method 3)
278 : Real64 nCoeff; // (method 3)
279 : Real64 AreaGas; // (method 3)
280 : Real64 h0Water; // (method 3)
281 : Real64 NdotWaterRef; // (method 3)
282 : Real64 mCoeff; // (method 3)
283 : Real64 AreaWater; // (method 3)
284 : Real64 Fadjust; // (method 3)
285 : Real64 l1Coeff; // (method 4)
286 : Real64 l2Coeff; // (method 4)
287 : Real64 CondensationThresholdTemp; // (method 4) [degrees C]
288 : // calculated
289 : Real64 qHX; // heat flow from gas stream to water
290 : Real64 THXexh; // temperature of exhaust gases leaving heat exchanger.
291 : Real64 WaterMassFlowRateDesign; // Design level of water flow rate
292 : Real64 WaterMassFlowRate; // water flow rate in plant loop
293 : Real64 WaterInletTemp;
294 : Real64 WaterVaporFractExh; // water vapor fraction in exhaust gas stream.
295 : Real64 CondensateRate; // water condensation rate.
296 : Array1D<Real64> ConstitMolalFract;
297 : Array1D<GasID> GasLibID; // lookup ID in Gas Phase ThermoChemistry Structure Array
298 : Real64 NdotHXleaving;
299 : Real64 WaterOutletTemp;
300 : Real64 WaterOutletEnthalpy;
301 :
302 : // Default Constructor
303 1 : FCExhaustHXDataStruct()
304 4 : : WaterInNode(0), WaterOutNode(0), WaterVolumeFlowMax(0.0), ExhaustOutNode(0), HXmodelMode(DataGenerators::ExhaustGasHX::Invalid),
305 1 : HXEffect(0.0), hxs0(0.0), hxs1(0.0), hxs2(0.0), hxs3(0.0), hxs4(0.0), h0gas(0.0), NdotGasRef(0.0), nCoeff(0.0), AreaGas(0.0),
306 1 : h0Water(0.0), NdotWaterRef(0.0), mCoeff(0.0), AreaWater(0.0), Fadjust(0.0), l1Coeff(0.0), l2Coeff(0.0), CondensationThresholdTemp(0.0),
307 1 : qHX(0.0), THXexh(0.0), WaterMassFlowRateDesign(0.0), WaterMassFlowRate(0.0), WaterInletTemp(0.0), WaterVaporFractExh(0.0),
308 1 : CondensateRate(0.0), ConstitMolalFract(14, 0.0), GasLibID(14, GasID::Invalid), NdotHXleaving(0.0), WaterOutletTemp(0.0),
309 1 : WaterOutletEnthalpy(0.0)
310 : {
311 1 : }
312 : };
313 :
314 : struct BatteryDichargeDataStruct
315 : {
316 : std::string Name; // name of this battery data set
317 : Real64 NumInSeries;
318 : Real64 NumInParallel;
319 : Real64 NominalVoltage;
320 : Real64 LowVoltsDischarged; // not used
321 : int NumTablePairs;
322 : Array1D<Real64> DischargeCurrent; // amps
323 : Array1D<Real64> DischargeTime; // hours
324 : // calculated variables
325 : Real64 k; // parameter in Manwell McGowan model
326 : Real64 c; // parameter in Manwell McGowan model
327 : Real64 qmax; // parameter in Manwell McGowan model
328 :
329 : // Default Constructor
330 1 : BatteryDichargeDataStruct()
331 1 : : NumInSeries(0.0), NumInParallel(0.0), NominalVoltage(0.0), LowVoltsDischarged(0.0), NumTablePairs(0), k(0.0), c(0.0), qmax(0.0)
332 : {
333 1 : }
334 : };
335 :
336 : struct FCElecStorageDataStruct
337 : {
338 : std::string Name; // name of this electrical storage module
339 : DataGenerators::ElectricalStorage StorageModelMode;
340 : Real64 StartingEnergyStored; // joules inside
341 : Real64 EnergeticEfficCharge; // for
342 : Real64 EnergeticEfficDischarge;
343 : Real64 MaxPowerDraw; // for simple bucket method 0
344 : Real64 MaxPowerStore; // for simple bucket method 0
345 : Real64 NominalVoltage;
346 : Real64 NominalEnergyCapacity; // [J]
347 : // calculated and from elsewhere vars
348 : Real64 ThisTimeStepStateOfCharge; // [J]
349 : Real64 LastTimeStepStateOfCharge; // [J]
350 : Real64 PelNeedFromStorage;
351 : Real64 IdesiredDischargeCurrent;
352 : Real64 PelFromStorage; // power
353 : Real64 IfromStorage; // current this timestepm
354 : Real64 PelIntoStorage;
355 : Real64 QairIntake; // heat into intake air
356 : // nested structures
357 : BatteryDichargeDataStruct Battery;
358 :
359 : // Default Constructor
360 1 : FCElecStorageDataStruct()
361 2 : : StorageModelMode(DataGenerators::ElectricalStorage::Invalid), StartingEnergyStored(0.0), EnergeticEfficCharge(0.0),
362 1 : EnergeticEfficDischarge(0.0), MaxPowerDraw(0.0), MaxPowerStore(0.0), NominalVoltage(0.0), NominalEnergyCapacity(0.0),
363 1 : ThisTimeStepStateOfCharge(0.0), LastTimeStepStateOfCharge(0.0), PelNeedFromStorage(0.0), IdesiredDischargeCurrent(0.0),
364 1 : PelFromStorage(0.0), IfromStorage(0.0), PelIntoStorage(0.0), QairIntake(0.0)
365 : {
366 1 : }
367 : };
368 :
369 : struct FCInverterDataStruct
370 : {
371 : std::string Name; // name of this inverter
372 : DataGenerators::InverterEfficiencyMode EffMode; // efficiency calculation mode
373 : Real64 ConstEff;
374 : Curve::Curve *EffQuadraticCurve = nullptr;
375 : // calculated and from elsewhere
376 : Real64 PCUlosses;
377 : Real64 QairIntake;
378 :
379 : // Default Constructor
380 1 : FCInverterDataStruct() : EffMode(DataGenerators::InverterEfficiencyMode::Invalid), ConstEff(0.0), PCUlosses(0.0), QairIntake(0.0)
381 : {
382 1 : }
383 : };
384 :
385 : struct FCReportDataStruct
386 : {
387 : // Members
388 : Real64 ACPowerGen; // reporting: power (W)
389 : Real64 ACEnergyGen; // reporting: energy (J)
390 : Real64 QdotExhaust; // reporting: exhaust gas heat recovered (W)
391 : Real64 TotalHeatEnergyRec; // reporting: total heat recovered (J)
392 : Real64 ExhaustEnergyRec; // reporting: exhaust gas heat recovered (J)
393 : Real64 FuelEnergyLHV; // reporting: Fuel Energy used in Lower Heating Value(J)
394 : Real64 FuelEnergyUseRateLHV; // reporting: Fuel Energy used in Lower Heating Value(W)
395 : Real64 FuelEnergyHHV; // reporting: Fuel Energy used in Lower Heating Value(J)
396 : Real64 FuelEnergyUseRateHHV; // reporting: Fuel Energy used in Lower Heating Value(W)
397 : Real64 FuelRateMdot; // (Kg/s)
398 : Real64 HeatRecInletTemp; // reporting: Heat Recovery Loop Inlet Temperature (C)
399 : Real64 HeatRecOutletTemp; // reporting: Heat Recovery Loop Outlet Temperature (C)
400 : Real64 HeatRecMdot; // reporting: Heat Recovery Loop Mass flow rate (kg/s)
401 : // air supply and blower
402 : Real64 TairInlet; // State point 1
403 : Real64 TairIntoFCPM; // Temperature at State point 4
404 : Real64 NdotAir; // air flow in kmol/sec
405 : Real64 TotAirInEnthalpy; // Enthalpy at State point 4
406 : Real64 BlowerPower; // electrical power used by air supply blower
407 : Real64 BlowerEnergy; // electrical energy used by air supply blower
408 : Real64 BlowerSkinLoss; // heat rate of losses by blower
409 : // fuel supply and compressor
410 : Real64 TfuelInlet; // State point 2 [C]
411 : Real64 TfuelIntoFCPM; // state point 5 [C]
412 : Real64 NdotFuel; // fuel flow in [kmol/sec]
413 : Real64 TotFuelInEnthalpy; // state point 5 [W]
414 : Real64 FuelCompressPower; // electrical power used by fuel supply compressor [W]
415 : Real64 FuelCompressEnergy; // electrical energy used by fuel supply compressor [J]
416 : Real64 FuelCompressSkinLoss; // heat rate of losses.by fuel supply compressor [W]
417 : // reformer water supply
418 : Real64 TwaterInlet; // State point 3
419 : Real64 TwaterIntoFCPM; // State point 6
420 : Real64 NdotWater; // water flow in kmol/sec (reformer water)
421 : Real64 WaterPumpPower; // electrical power used by water pump [W]
422 : Real64 WaterPumpEnergy; // electrical energy used by water pump [J]
423 : Real64 WaterIntoFCPMEnthalpy; // state point 6
424 : // product (exhaust) gas leaving power module
425 : Real64 TprodGas; // State point 7 Product Gas temperature
426 : Real64 EnthalProdGas; // state point 7 product gas enthalpy
427 : Real64 NdotProdGas; // point 7 flow rate [kmol/sec]
428 : Real64 NdotProdAr; // argon flow rate at point 7
429 : Real64 NdotProdCO2; // carbon dioxide flow rate at point 7
430 : Real64 NdotProdH2O; // water vapor flow rate at point 7
431 : Real64 NdotProdN2; // nitrogen flow rate at point 7
432 : Real64 NdotProdO2; // oxygen flow rate at point 7
433 : // heat exchanger for water to exhaust heat recovery
434 : Real64 qHX; // heat flow from gas stream to water [W]
435 : Real64 HXenergy; // energy from gas stream to water [J]
436 : Real64 THXexh; // temperature of exhaust gases leaving heat exchanger.
437 : Real64 WaterVaporFractExh; // water vapor fraction in exhaust gas stream
438 : // relative to water vapor entering HX (NdotH2O/Ndoaux-mix)
439 : Real64 CondensateRate; // water condensation rate [kmol/s]
440 : int SeqSubstIterations; // number of iterations in SOFC loop
441 : int RegulaFalsiIterations; // number of iterations in Tproduct gas solving
442 : Real64 ACancillariesPower;
443 : Real64 ACancillariesEnergy;
444 : Real64 PCUlosses; // power conditioning Unit losses
445 : Real64 DCPowerGen; // Pel, Power module power level [W]
446 : Real64 DCPowerEff; // Eel, power module efficiency []
447 : Real64 ElectEnergyinStorage; // State of charge in Electrical Storage [J]
448 : Real64 StoredPower; // Power added to Electrical Storage [W]
449 : Real64 StoredEnergy; // energy added to Electrical STorage [J]
450 : Real64 DrawnPower; // Power drawn from Electrical STorage [W]
451 : Real64 DrawnEnergy; // Energy drawn from Electrical STorage [J]
452 : Real64 SkinLossPower; // heat loss to surrounding zone [W]
453 : Real64 SkinLossEnergy; // heat loss to surround zone [J]
454 : Real64 SkinLossConvect; // convective heat loss to zone [W]
455 : Real64 SkinLossRadiat; // radiative heat loss to zone [W}
456 : Real64 ElectEfficiency;
457 : Real64 ThermalEfficiency;
458 : Real64 OverallEfficiency;
459 : Real64 ExergyEfficiency;
460 : int NumCycles; // Number of start-stop cycles
461 : Real64 FCPMSkinLoss; // Power module skin losses [W]
462 :
463 : // Default Constructor
464 1 : FCReportDataStruct()
465 1 : : ACPowerGen(0.0), ACEnergyGen(0.0), QdotExhaust(0.0), TotalHeatEnergyRec(0.0), ExhaustEnergyRec(0.0), FuelEnergyLHV(0.0),
466 1 : FuelEnergyUseRateLHV(0.0), FuelEnergyHHV(0.0), FuelEnergyUseRateHHV(0.0), FuelRateMdot(0.0), HeatRecInletTemp(0.0),
467 1 : HeatRecOutletTemp(0.0), HeatRecMdot(0.0), TairInlet(0.0), TairIntoFCPM(0.0), NdotAir(0.0), TotAirInEnthalpy(0.0), BlowerPower(0.0),
468 1 : BlowerEnergy(0.0), BlowerSkinLoss(0.0), TfuelInlet(0.0), TfuelIntoFCPM(0.0), NdotFuel(0.0), TotFuelInEnthalpy(0.0),
469 1 : FuelCompressPower(0.0), FuelCompressEnergy(0.0), FuelCompressSkinLoss(0.0), TwaterInlet(0.0), TwaterIntoFCPM(0.0), NdotWater(0.0),
470 1 : WaterPumpPower(0.0), WaterPumpEnergy(0.0), WaterIntoFCPMEnthalpy(0.0), TprodGas(0.0), EnthalProdGas(0.0), NdotProdGas(0.0),
471 1 : NdotProdAr(0.0), NdotProdCO2(0.0), NdotProdH2O(0.0), NdotProdN2(0.0), NdotProdO2(0.0), qHX(0.0), HXenergy(0.0), THXexh(0.0),
472 1 : WaterVaporFractExh(0.0), CondensateRate(0.0), SeqSubstIterations(0), RegulaFalsiIterations(0), ACancillariesPower(0.0),
473 1 : ACancillariesEnergy(0.0), PCUlosses(0.0), DCPowerGen(0.0), DCPowerEff(0.0), ElectEnergyinStorage(0.0), StoredPower(0.0),
474 1 : StoredEnergy(0.0), DrawnPower(0.0), DrawnEnergy(0.0), SkinLossPower(0.0), SkinLossEnergy(0.0), SkinLossConvect(0.0),
475 1 : SkinLossRadiat(0.0), ElectEfficiency(0.0), ThermalEfficiency(0.0), OverallEfficiency(0.0), ExergyEfficiency(0.0), NumCycles(0),
476 1 : FCPMSkinLoss(0.0)
477 : {
478 1 : }
479 : };
480 :
481 : struct FCStackCoolerDataStruct
482 : {
483 : std::string Name; // name of this stack cooler module
484 : std::string WaterInNodeName; // HR Water Inlet Node
485 : int WaterInNode; // HR Water Outlet Node ID
486 : std::string WaterOutNodeName; // HR water outlet Node name
487 : int WaterOutNode; // HR Water outlet Node ID
488 : Real64 TstackNom; // nominal fuel cell stack temperature
489 : Real64 TstackActual; // actual fuel cell stack temperature
490 : Real64 r0; // stack cooling power coefficient r0
491 : Real64 r1; // stack cooling power coefficient r1
492 : Real64 r2; // stack cooling power coefficient r2
493 : Real64 r3; // stack cooling power coefficient r3
494 : Real64 MdotStackCoolant; // stack coolant flow rate kg/s
495 : Real64 UAs_cool; // stack heat transfer coef
496 : Real64 Fs_cogen;
497 : Real64 As_cogen;
498 : Real64 MdotCogenNom;
499 : Real64 hCogenNom;
500 : Real64 ns;
501 : Real64 PstackPumpEl;
502 : Real64 PmpPowerLossFactor;
503 : Real64 f0;
504 : Real64 f1;
505 : Real64 f2;
506 : // calculated and from elsewhere
507 : bool StackCoolerPresent; // control modeling
508 : Real64 qs_cool;
509 : Real64 qs_air;
510 :
511 : // Default Constructor
512 1 : FCStackCoolerDataStruct()
513 3 : : WaterInNode(0), WaterOutNode(0), TstackNom(0.0), TstackActual(0.0), r0(0.0), r1(0.0), r2(0.0), r3(0.0), MdotStackCoolant(0.0),
514 1 : UAs_cool(0.0), Fs_cogen(0.0), As_cogen(0.0), MdotCogenNom(0.0), hCogenNom(0.0), ns(0.0), PstackPumpEl(0.0), PmpPowerLossFactor(0.0),
515 1 : f0(0.0), f1(0.0), f2(0.0), StackCoolerPresent(false), qs_cool(0.0), qs_air(0.0)
516 : {
517 1 : }
518 : };
519 :
520 : struct FCDataStruct : PlantComponent
521 : {
522 : // Members
523 : // from input data and nested types for subsystems
524 : DataPlant::PlantEquipmentType Type;
525 : std::string Name; // user identifier
526 : std::string NameFCPM; // name of FC Power Module
527 : FCPowerModuleStruct FCPM; // data for Power Module
528 : std::string NameFCAirSup; // name of air supply module for fuel cell
529 : FCAirSupplyDataStruct AirSup; // data for air supply module
530 : std::string NameFCFuelSup; // name of fuel supply module
531 : int FuelSupNum; // index for fuel supply module structure
532 : std::string NameFCWaterSup; // name of water supply module
533 : FCWaterSupplyDataStruct WaterSup; // data for water supply module
534 : std::string NameFCAuxilHeat; // name of auxiliary heating module
535 : FCAuxilHeatDataStruct AuxilHeat; // data for auxiliary heating module
536 : std::string NameExhaustHX; // name of Exhaust HX module
537 : FCExhaustHXDataStruct ExhaustHX; // data for Exhaust heat exchanger module
538 : std::string NameElecStorage; // name of Battery module
539 : FCElecStorageDataStruct ElecStorage; // data for Battery module
540 : std::string NameInverter; // name of Inverter Module
541 : FCInverterDataStruct Inverter; // data for Inverter module
542 : std::string NameStackCooler; // name of Inverter Module
543 : FCStackCoolerDataStruct StackCooler; // data for Inverter module
544 : PlantLocation CWPlantLoc; // cooling water plant loop component index
545 : FCReportDataStruct Report; // data for reporting as E+ output variables
546 : // calculated whole-system level variables
547 : Real64 ACPowerGen; // Net output from SOFC unit
548 : Real64 QconvZone; // convective heat lost to surrounding zone
549 : Real64 QradZone; // radiative heat lost to surrounding zone
550 : int DynamicsControlID;
551 : Real64 TimeElapsed; // used to track when timestep has changed
552 : bool MyEnvrnFlag_Init;
553 : bool MyWarmupFlag_Init;
554 : bool MyPlantScanFlag_Init;
555 :
556 : int SolverErr_Type1_Iter; // Iteration counter for Fuel Cell solver root finding Type 1 error warning messages
557 : int SolverErr_Type1_IterIndex; // Index for Fuel Cell solver root finding Type 1 error warning messages
558 : int SolverErr_Type2_Iter; // Iteration counter for Fuel Cell solver root finding Type 2 error warning messages
559 : int SolverErr_Type2_IterIndex; // Index for Fuel Cell solver root finding Type 2 error warning messages
560 :
561 : // Default Constructor
562 1 : FCDataStruct()
563 1 : : Type(DataPlant::PlantEquipmentType::Invalid), FuelSupNum(0), CWPlantLoc{}, ACPowerGen(0.0), QconvZone(0.0), QradZone(0.0),
564 1 : DynamicsControlID(0), TimeElapsed(0.0), MyEnvrnFlag_Init(true), MyWarmupFlag_Init(false), MyPlantScanFlag_Init(true),
565 2 : SolverErr_Type1_Iter(0), SolverErr_Type1_IterIndex(0), SolverErr_Type2_Iter(0), SolverErr_Type2_IterIndex(0)
566 : {
567 1 : }
568 :
569 : static PlantComponent *factory(EnergyPlusData &state, std::string const &objectName);
570 :
571 : static PlantComponent *factory_exhaust(EnergyPlusData &state, std::string const &objectName);
572 :
573 : void initialize(EnergyPlusData &state);
574 :
575 : void getDesignCapacities(
576 : EnergyPlusData &state, const PlantLocation &calledFromLocation, Real64 &MaxLoad, Real64 &MinLoad, Real64 &OptLoad) override;
577 :
578 : void setupOutputVars(EnergyPlusData &state);
579 :
580 : void simulate([[maybe_unused]] EnergyPlusData &state,
581 : const PlantLocation &calledFromLocation,
582 : bool FirstHVACIteration,
583 : Real64 &CurLoad,
584 : bool RunFlag) override;
585 :
586 : void FigureAirHeatCap(EnergyPlusData &state, Real64 FluidTemp, Real64 &Cp);
587 :
588 : void FigureAirEnthalpy(EnergyPlusData &state, Real64 FluidTemp, Real64 &Hair);
589 :
590 : void FigureFuelHeatCap(EnergyPlusData &state, Real64 FluidTemp, Real64 &Cp) const;
591 :
592 : void FigureFuelEnthalpy(EnergyPlusData &state, Real64 FluidTemp, Real64 &Hfuel) const;
593 :
594 : void FigureProductGasesEnthalpy(EnergyPlusData &state, Real64 FluidTemp, Real64 &HProdGases);
595 :
596 : void FigureAuxilHeatGasHeatCap(EnergyPlusData &state, Real64 FluidTemp, Real64 &Cp);
597 :
598 : void FigureACAncillaries(EnergyPlusData &state, Real64 &PacAncill);
599 :
600 : void FigurePowerConditioningLosses(EnergyPlusData &state, Real64 Pdemand, Real64 &PpcuLosses) const;
601 :
602 : void FigureTransientConstraints(EnergyPlusData &state,
603 : Real64 &Pel, // DC power control setting for power module
604 : bool &Constrained, // true if transient constraints kick in
605 : Real64 &PelDiff // if constrained then this is the difference, positive
606 : );
607 :
608 : static void FigureGaseousWaterEnthalpy(Real64 FluidTemp, Real64 &HGasWater);
609 :
610 : static void FigureLiquidWaterEnthalpy(Real64 FluidTemp, Real64 &HLiqWater);
611 :
612 : static void FigureLiquidWaterHeatCap(Real64 FluidTemp, Real64 &Cp);
613 :
614 : void CalcFuelCellAuxHeater();
615 :
616 : void CalcFuelCellGenHeatRecovery(EnergyPlusData &state);
617 :
618 : void CalcFuelCellGeneratorModel(EnergyPlusData &state, bool RunFlag, Real64 MyLoad, bool FirstHVACIteration);
619 :
620 : void CalcUpdateHeatRecovery(EnergyPlusData &state, bool FirstHVACIteration) const;
621 :
622 : void ManageElectStorInteractions(EnergyPlusData &state,
623 : Real64 Pdemand,
624 : Real64 PpcuLosses,
625 : bool &Constrained, // TODO: This one is never used anywhere in the code
626 : Real64 &Pstorage,
627 : Real64 &PgridOverage // electricity that can't be stored and needs to go out
628 : );
629 :
630 : void SimFuelCellGenerator(EnergyPlusData &state,
631 : bool RunFlag, // simulate Generator when TRUE
632 : Real64 MyLoad, // demand on electric generator
633 : bool FirstHVACIteration);
634 :
635 : void UpdateFuelCellGeneratorRecords(EnergyPlusData &state);
636 :
637 : void oneTimeInit(EnergyPlusData &state) override;
638 :
639 : void oneTimeInit_new(EnergyPlusData &state) override;
640 : };
641 :
642 : void getFuelCellInput(EnergyPlusData &state);
643 :
644 : void FigureFuelCellZoneGains(EnergyPlusData &state);
645 :
646 : } // namespace FuelCellElectricGenerator
647 :
648 : struct FuelCellElectricGeneratorData : BaseGlobalStruct
649 : {
650 :
651 : int NumFuelCellGenerators = 0;
652 : bool getFuelCellInputFlag = true;
653 : bool MyEnvrnFlag = true;
654 : Array1D<FuelCellElectricGenerator::FCDataStruct> FuelCell;
655 :
656 2126 : void init_constant_state([[maybe_unused]] EnergyPlusData &state) override
657 : {
658 2126 : }
659 :
660 1152 : void init_state([[maybe_unused]] EnergyPlusData &state) override
661 : {
662 1152 : }
663 :
664 2100 : void clear_state() override
665 : {
666 2100 : this->NumFuelCellGenerators = 0;
667 2100 : this->getFuelCellInputFlag = true;
668 2100 : this->MyEnvrnFlag = true;
669 2100 : this->FuelCell.deallocate();
670 2100 : }
671 : };
672 :
673 : } // namespace EnergyPlus
674 :
675 : #endif
|