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