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 : // C++ Headers
49 : #include <cmath>
50 : #include <string>
51 :
52 : // ObjexxFCL Headers
53 : #include <ObjexxFCL/Array.functions.hh>
54 : #include <ObjexxFCL/Array1D.hh>
55 :
56 : // EnergyPlus Headers
57 : #include <EnergyPlus/CurveManager.hh>
58 : #include <EnergyPlus/Data/EnergyPlusData.hh>
59 : #include <EnergyPlus/DataGenerators.hh>
60 : #include <EnergyPlus/DataIPShortCuts.hh>
61 : #include <EnergyPlus/DataLoopNode.hh>
62 : #include <EnergyPlus/General.hh>
63 : #include <EnergyPlus/GeneratorFuelSupply.hh>
64 : #include <EnergyPlus/InputProcessing/InputProcessor.hh>
65 : #include <EnergyPlus/NodeInputManager.hh>
66 : #include <EnergyPlus/ScheduleManager.hh>
67 : #include <EnergyPlus/UtilityRoutines.hh>
68 :
69 : namespace EnergyPlus {
70 :
71 : namespace GeneratorFuelSupply {
72 :
73 : //_______________________________________________
74 : // Utility modules used by other generators.
75 : //
76 : // GeneratorFuelSupply
77 : // reused among some generators to define gaseous fuel chemistry, optional compressor)
78 :
79 : // Module containing the routines dealing with the fuel supply for some generators
80 : // different generator modules can reuse the same fuel supply code, hence a separate module
81 :
82 : // MODULE INFORMATION:
83 : // AUTHOR B Griffith
84 : // DATE WRITTEN July 2006
85 :
86 : // METHODOLOGY EMPLOYED:
87 : // data defined in DataGenerators.cc
88 : // this module only provides input and subroutines for other component simulations
89 : // no specific energyplus component is modeled here. it is used by other generators
90 :
91 : // REFERENCES:
92 : // Annex 42 documentation
93 :
94 4 : void GetGeneratorFuelSupplyInput(EnergyPlusData &state)
95 : {
96 :
97 : // SUBROUTINE INFORMATION:
98 : // AUTHOR B Griffith
99 : // DATE WRITTEN July 2006,
100 : // RE-ENGINEERED this module extracted from older SOFC module for
101 : // reuse with both Annex 42 models,
102 :
103 : static constexpr std::string_view routineName = "GetGeneratorFuelSupplyInput";
104 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
105 : // INTEGER :: GeneratorNum !Generator counter
106 4 : Array1D_string AlphArray(25); // character string data
107 4 : Array1D<Real64> NumArray(200); // numeric data TODO deal with allocatable for extensible
108 :
109 4 : if (state.dataGeneratorFuelSupply->MyOneTimeFlag) {
110 : int NumAlphas; // Number of elements in the alpha array
111 : int NumNums; // Number of elements in the numeric array
112 : int IOStat; // IO Status when calling get input subroutine
113 3 : bool ErrorsFound = false;
114 3 : std::string const cCurrentModuleObject = "Generator:FuelSupply";
115 3 : int NumGeneratorFuelSups = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, cCurrentModuleObject);
116 :
117 3 : if (NumGeneratorFuelSups <= 0) {
118 0 : ShowSevereError(state, format("No {} equipment specified in input file", cCurrentModuleObject));
119 0 : ErrorsFound = true;
120 : }
121 :
122 3 : state.dataGenerator->FuelSupply.allocate(NumGeneratorFuelSups);
123 :
124 7 : for (int FuelSupNum = 1; FuelSupNum <= NumGeneratorFuelSups; ++FuelSupNum) {
125 8 : state.dataInputProcessing->inputProcessor->getObjectItem(state,
126 : cCurrentModuleObject,
127 : FuelSupNum,
128 : AlphArray,
129 : NumAlphas,
130 : NumArray,
131 : NumNums,
132 : IOStat,
133 : _,
134 : _,
135 4 : state.dataIPShortCut->cAlphaFieldNames,
136 4 : state.dataIPShortCut->cNumericFieldNames);
137 :
138 4 : ErrorObjectHeader eoh{routineName, cCurrentModuleObject, AlphArray(1)};
139 4 : state.dataGenerator->FuelSupply(FuelSupNum).Name = AlphArray(1);
140 4 : if (Util::SameString("TemperatureFromAirNode", AlphArray(2))) {
141 4 : state.dataGenerator->FuelSupply(FuelSupNum).FuelTempMode = DataGenerators::FuelTemperatureMode::FuelInTempFromNode;
142 0 : } else if (Util::SameString("Scheduled", AlphArray(2))) {
143 0 : state.dataGenerator->FuelSupply(FuelSupNum).FuelTempMode = DataGenerators::FuelTemperatureMode::FuelInTempSchedule;
144 : } else {
145 0 : ShowSevereError(state, format("Invalid, {} = {}", state.dataIPShortCut->cAlphaFieldNames(2), AlphArray(2)));
146 0 : ShowContinueError(state, format("Entered in {}={}", cCurrentModuleObject, AlphArray(1)));
147 0 : ErrorsFound = true;
148 : }
149 :
150 4 : state.dataGenerator->FuelSupply(FuelSupNum).NodeName = AlphArray(3);
151 4 : state.dataGenerator->FuelSupply(FuelSupNum).NodeNum =
152 8 : NodeInputManager::GetOnlySingleNode(state,
153 4 : AlphArray(3),
154 : ErrorsFound,
155 : DataLoopNode::ConnectionObjectType::GeneratorFuelSupply,
156 4 : AlphArray(1),
157 : DataLoopNode::NodeFluidType::Air,
158 : DataLoopNode::ConnectionType::Sensor,
159 : NodeInputManager::CompFluidStream::Primary,
160 : DataLoopNode::ObjectIsNotParent);
161 :
162 4 : if (state.dataGenerator->FuelSupply(FuelSupNum).FuelTempMode == DataGenerators::FuelTemperatureMode::FuelInTempSchedule) {
163 0 : if ((state.dataGenerator->FuelSupply(FuelSupNum).sched = Sched::GetSchedule(state, AlphArray(4))) == nullptr) {
164 0 : ShowSevereItemNotFound(state, eoh, state.dataIPShortCut->cAlphaFieldNames(4), AlphArray(4));
165 0 : ErrorsFound = true;
166 : }
167 : }
168 :
169 4 : state.dataGenerator->FuelSupply(FuelSupNum).CompPowerCurveID = Curve::GetCurveIndex(state, AlphArray(5));
170 4 : if (state.dataGenerator->FuelSupply(FuelSupNum).CompPowerCurveID == 0) {
171 0 : ShowSevereError(state, format("Invalid, {} = {}", state.dataIPShortCut->cAlphaFieldNames(5), AlphArray(5)));
172 0 : ShowContinueError(state, format("Entered in {}={}", cCurrentModuleObject, AlphArray(1)));
173 0 : ShowContinueError(state, "Curve named was not found ");
174 0 : ErrorsFound = true;
175 : }
176 :
177 10 : for (auto &e : state.dataGenerator->FuelSupply) {
178 6 : e.CompPowerLossFactor = NumArray(1);
179 : }
180 :
181 4 : if (Util::SameString(AlphArray(6), "GaseousConstituents")) {
182 4 : state.dataGenerator->FuelSupply(FuelSupNum).FuelTypeMode = DataGenerators::FuelMode::GaseousConstituents;
183 0 : } else if (Util::SameString(AlphArray(6), "LiquidGeneric")) {
184 0 : state.dataGenerator->FuelSupply(FuelSupNum).FuelTypeMode = DataGenerators::FuelMode::GenericLiquid;
185 : } else {
186 0 : ShowSevereError(state, format("Invalid, {} = {}", state.dataIPShortCut->cAlphaFieldNames(6), AlphArray(6)));
187 0 : ShowContinueError(state, format("Entered in {}={}", cCurrentModuleObject, AlphArray(1)));
188 0 : ErrorsFound = true;
189 : }
190 :
191 4 : state.dataGenerator->FuelSupply(FuelSupNum).LHVliquid = NumArray(2) * 1000.0; // generic liquid LHV (kJ/kG input converted to J/kG )
192 4 : state.dataGenerator->FuelSupply(FuelSupNum).HHV = NumArray(3) * 1000.0; // generic liquid HHV (kJ/kG input converted to J/kG )
193 4 : state.dataGenerator->FuelSupply(FuelSupNum).MW = NumArray(4);
194 4 : state.dataGenerator->FuelSupply(FuelSupNum).eCO2 = NumArray(5);
195 :
196 4 : if (state.dataGenerator->FuelSupply(FuelSupNum).FuelTypeMode == DataGenerators::FuelMode::GaseousConstituents) {
197 4 : int NumFuelConstit = NumArray(6);
198 4 : state.dataGenerator->FuelSupply(FuelSupNum).NumConstituents = NumFuelConstit;
199 :
200 4 : if (NumFuelConstit > 12) {
201 0 : ShowSevereError(state, format("{} model not set up for more than 12 fuel constituents", cCurrentModuleObject));
202 0 : ErrorsFound = true;
203 : }
204 4 : if (NumFuelConstit < 1) {
205 0 : ShowSevereError(state, format("{} model needs at least one fuel constituent", cCurrentModuleObject));
206 0 : ErrorsFound = true;
207 : }
208 :
209 22 : for (int ConstitNum = 1; ConstitNum <= NumFuelConstit; ++ConstitNum) {
210 18 : state.dataGenerator->FuelSupply(FuelSupNum).ConstitName(ConstitNum) = AlphArray(ConstitNum + 6);
211 18 : state.dataGenerator->FuelSupply(FuelSupNum).ConstitMolalFract(ConstitNum) = NumArray(ConstitNum + 6);
212 : }
213 :
214 : // check for molar fractions summing to 1.0.
215 4 : if (std::abs(sum(state.dataGenerator->FuelSupply(FuelSupNum).ConstitMolalFract) - 1.0) > 0.0001) {
216 0 : ShowSevereError(state, format("{} molar fractions do not sum to 1.0", cCurrentModuleObject));
217 0 : ShowContinueError(state, format("Sum was={:.5R}", sum(state.dataGenerator->FuelSupply(FuelSupNum).ConstitMolalFract)));
218 0 : ShowContinueError(state, format("Entered in {} = {}", cCurrentModuleObject, AlphArray(1)));
219 0 : ErrorsFound = true;
220 : }
221 : }
222 : }
223 :
224 : // now make calls to Setup
225 :
226 7 : for (int FuelSupNum = 1; FuelSupNum <= NumGeneratorFuelSups; ++FuelSupNum) {
227 4 : SetupFuelConstituentData(state, FuelSupNum, ErrorsFound);
228 : }
229 :
230 3 : if (ErrorsFound) {
231 0 : ShowFatalError(state, format("Problem found processing input for {}", cCurrentModuleObject));
232 : }
233 :
234 3 : state.dataGeneratorFuelSupply->MyOneTimeFlag = false;
235 3 : } // MyOneTimeFlag
236 4 : }
237 :
238 : //******************************************************************************
239 :
240 7 : void SetupFuelConstituentData(EnergyPlusData &state, int const FuelSupplyNum, bool &ErrorsFound)
241 : {
242 :
243 : // SUBROUTINE INFORMATION:
244 : // AUTHOR B Griffith
245 : // DATE WRITTEN Aug 2005,
246 : // RE-ENGINEERED July/Aug 2006, extracted to own module. added liquid fuel option
247 :
248 : // PURPOSE OF THIS SUBROUTINE:
249 : // Fill data structure for gas phase thermochemistry
250 :
251 : // METHODOLOGY EMPLOYED:
252 : // Hardcoded data from NIST is filled into data structure one time only
253 :
254 7 : int constexpr NumHardCodedConstituents = 14; // number of gases included in data
255 :
256 7 : bool first_time = false;
257 7 : if (!allocated(state.dataGenerator->GasPhaseThermoChemistryData)) {
258 3 : state.dataGenerator->GasPhaseThermoChemistryData.allocate(NumHardCodedConstituents);
259 3 : first_time = true;
260 : }
261 : // Carbon Dioxide (CO2) Temp K 298-1200 (Chase 1998)
262 7 : state.dataGenerator->GasPhaseThermoChemistryData(1).ConstituentName = "CarbonDioxide";
263 7 : state.dataGenerator->GasPhaseThermoChemistryData(1).ConstituentFormula = "CO2";
264 7 : state.dataGenerator->GasPhaseThermoChemistryData(1).StdRefMolarEnthOfForm = -393.5224; // KJ/mol
265 7 : state.dataGenerator->GasPhaseThermoChemistryData(1).ThermoMode = DataGenerators::ThermodynamicMode::NISTShomate;
266 7 : state.dataGenerator->GasPhaseThermoChemistryData(1).ShomateA = 24.99735;
267 7 : state.dataGenerator->GasPhaseThermoChemistryData(1).ShomateB = 55.18696;
268 7 : state.dataGenerator->GasPhaseThermoChemistryData(1).ShomateC = -33.69137;
269 7 : state.dataGenerator->GasPhaseThermoChemistryData(1).ShomateD = 7.948387;
270 7 : state.dataGenerator->GasPhaseThermoChemistryData(1).ShomateE = -0.136638;
271 7 : state.dataGenerator->GasPhaseThermoChemistryData(1).ShomateF = -403.6075;
272 7 : state.dataGenerator->GasPhaseThermoChemistryData(1).ShomateG = 228.2431;
273 7 : state.dataGenerator->GasPhaseThermoChemistryData(1).ShomateH = -393.5224;
274 7 : state.dataGenerator->GasPhaseThermoChemistryData(1).NumCarbons = 1.0;
275 7 : state.dataGenerator->GasPhaseThermoChemistryData(1).NumHydrogens = 0.0;
276 7 : state.dataGenerator->GasPhaseThermoChemistryData(1).NumOxygens = 2.0;
277 7 : state.dataGenerator->GasPhaseThermoChemistryData(1).MolecularWeight = 44.01;
278 :
279 : // Nitrogen (N2) Temp (K) 298-6000
280 7 : state.dataGenerator->GasPhaseThermoChemistryData(2).ConstituentName = "Nitrogen";
281 7 : state.dataGenerator->GasPhaseThermoChemistryData(2).ConstituentFormula = "N2";
282 7 : state.dataGenerator->GasPhaseThermoChemistryData(2).StdRefMolarEnthOfForm = 0.0;
283 7 : state.dataGenerator->GasPhaseThermoChemistryData(2).ThermoMode = DataGenerators::ThermodynamicMode::NISTShomate;
284 7 : state.dataGenerator->GasPhaseThermoChemistryData(2).ShomateA = 26.092;
285 7 : state.dataGenerator->GasPhaseThermoChemistryData(2).ShomateB = 8.218801;
286 7 : state.dataGenerator->GasPhaseThermoChemistryData(2).ShomateC = -1.976141;
287 7 : state.dataGenerator->GasPhaseThermoChemistryData(2).ShomateD = 0.159274;
288 7 : state.dataGenerator->GasPhaseThermoChemistryData(2).ShomateE = 0.044434;
289 7 : state.dataGenerator->GasPhaseThermoChemistryData(2).ShomateF = -7.98923;
290 7 : state.dataGenerator->GasPhaseThermoChemistryData(2).ShomateG = 221.02;
291 7 : state.dataGenerator->GasPhaseThermoChemistryData(2).ShomateH = 0.000;
292 7 : state.dataGenerator->GasPhaseThermoChemistryData(2).NumCarbons = 0.0;
293 7 : state.dataGenerator->GasPhaseThermoChemistryData(2).NumHydrogens = 0.0;
294 7 : state.dataGenerator->GasPhaseThermoChemistryData(2).NumOxygens = 0.0;
295 7 : state.dataGenerator->GasPhaseThermoChemistryData(2).MolecularWeight = 28.01;
296 :
297 : // Oxygen (O2) Temp (K) 298-6000
298 7 : state.dataGenerator->GasPhaseThermoChemistryData(3).ConstituentName = "Oxygen";
299 7 : state.dataGenerator->GasPhaseThermoChemistryData(3).ConstituentFormula = "O2";
300 7 : state.dataGenerator->GasPhaseThermoChemistryData(3).StdRefMolarEnthOfForm = 0.0;
301 7 : state.dataGenerator->GasPhaseThermoChemistryData(3).ThermoMode = DataGenerators::ThermodynamicMode::NISTShomate;
302 7 : state.dataGenerator->GasPhaseThermoChemistryData(3).ShomateA = 29.659;
303 7 : state.dataGenerator->GasPhaseThermoChemistryData(3).ShomateB = 6.137261;
304 7 : state.dataGenerator->GasPhaseThermoChemistryData(3).ShomateC = -1.186521;
305 7 : state.dataGenerator->GasPhaseThermoChemistryData(3).ShomateD = 0.095780;
306 7 : state.dataGenerator->GasPhaseThermoChemistryData(3).ShomateE = -0.219663;
307 7 : state.dataGenerator->GasPhaseThermoChemistryData(3).ShomateF = -9.861391;
308 7 : state.dataGenerator->GasPhaseThermoChemistryData(3).ShomateG = 237.948;
309 7 : state.dataGenerator->GasPhaseThermoChemistryData(3).ShomateH = 0.0;
310 7 : state.dataGenerator->GasPhaseThermoChemistryData(3).NumCarbons = 0.0;
311 7 : state.dataGenerator->GasPhaseThermoChemistryData(3).NumHydrogens = 0.0;
312 7 : state.dataGenerator->GasPhaseThermoChemistryData(3).NumOxygens = 2.0;
313 7 : state.dataGenerator->GasPhaseThermoChemistryData(3).MolecularWeight = 32.00;
314 :
315 : // Water (H2O) Temp K 300-1700
316 : // need lower temperature range for Shomate coef for Water Vapor..
317 7 : state.dataGenerator->GasPhaseThermoChemistryData(4).ConstituentName = "Water";
318 7 : state.dataGenerator->GasPhaseThermoChemistryData(4).ConstituentFormula = "H2O";
319 7 : state.dataGenerator->GasPhaseThermoChemistryData(4).StdRefMolarEnthOfForm = -241.8264; // KJ/mol
320 7 : state.dataGenerator->GasPhaseThermoChemistryData(4).ThermoMode = DataGenerators::ThermodynamicMode::NISTShomate;
321 7 : state.dataGenerator->GasPhaseThermoChemistryData(4).ShomateA = 29.0373;
322 7 : state.dataGenerator->GasPhaseThermoChemistryData(4).ShomateB = 10.2573;
323 7 : state.dataGenerator->GasPhaseThermoChemistryData(4).ShomateC = 2.81048;
324 7 : state.dataGenerator->GasPhaseThermoChemistryData(4).ShomateD = -0.95914;
325 7 : state.dataGenerator->GasPhaseThermoChemistryData(4).ShomateE = 0.11725;
326 7 : state.dataGenerator->GasPhaseThermoChemistryData(4).ShomateF = -250.569;
327 7 : state.dataGenerator->GasPhaseThermoChemistryData(4).ShomateG = 223.3967;
328 7 : state.dataGenerator->GasPhaseThermoChemistryData(4).ShomateH = -241.8264;
329 7 : state.dataGenerator->GasPhaseThermoChemistryData(4).NumCarbons = 0.0;
330 7 : state.dataGenerator->GasPhaseThermoChemistryData(4).NumHydrogens = 2.0;
331 7 : state.dataGenerator->GasPhaseThermoChemistryData(4).NumOxygens = 1.0;
332 7 : state.dataGenerator->GasPhaseThermoChemistryData(4).MolecularWeight = 18.02;
333 :
334 : // Argon (Ar) Temp K 298-600
335 :
336 7 : state.dataGenerator->GasPhaseThermoChemistryData(5).ConstituentName = "Argon";
337 7 : state.dataGenerator->GasPhaseThermoChemistryData(5).ConstituentFormula = "Ar";
338 7 : state.dataGenerator->GasPhaseThermoChemistryData(5).StdRefMolarEnthOfForm = 0.0;
339 7 : state.dataGenerator->GasPhaseThermoChemistryData(5).ThermoMode = DataGenerators::ThermodynamicMode::NISTShomate;
340 7 : state.dataGenerator->GasPhaseThermoChemistryData(5).ShomateA = 20.786;
341 7 : state.dataGenerator->GasPhaseThermoChemistryData(5).ShomateB = 2.825911e-07;
342 7 : state.dataGenerator->GasPhaseThermoChemistryData(5).ShomateC = -1.464191e-07;
343 7 : state.dataGenerator->GasPhaseThermoChemistryData(5).ShomateD = 1.092131e-08;
344 7 : state.dataGenerator->GasPhaseThermoChemistryData(5).ShomateE = -3.661371e-08;
345 7 : state.dataGenerator->GasPhaseThermoChemistryData(5).ShomateF = -6.19735;
346 7 : state.dataGenerator->GasPhaseThermoChemistryData(5).ShomateG = 179.999;
347 7 : state.dataGenerator->GasPhaseThermoChemistryData(5).ShomateH = 0.0;
348 7 : state.dataGenerator->GasPhaseThermoChemistryData(5).NumCarbons = 0.0;
349 7 : state.dataGenerator->GasPhaseThermoChemistryData(5).NumHydrogens = 0.0;
350 7 : state.dataGenerator->GasPhaseThermoChemistryData(5).NumOxygens = 0.0;
351 7 : state.dataGenerator->GasPhaseThermoChemistryData(5).MolecularWeight = 39.95;
352 :
353 : // Hydrogen (H2) Temp K 298-1000
354 7 : state.dataGenerator->GasPhaseThermoChemistryData(6).ConstituentName = "Hydrogen";
355 7 : state.dataGenerator->GasPhaseThermoChemistryData(6).ConstituentFormula = "H2";
356 7 : state.dataGenerator->GasPhaseThermoChemistryData(6).StdRefMolarEnthOfForm = 0.0;
357 7 : state.dataGenerator->GasPhaseThermoChemistryData(6).ThermoMode = DataGenerators::ThermodynamicMode::NISTShomate;
358 7 : state.dataGenerator->GasPhaseThermoChemistryData(6).ShomateA = 33.066178;
359 7 : state.dataGenerator->GasPhaseThermoChemistryData(6).ShomateB = -11.363417;
360 7 : state.dataGenerator->GasPhaseThermoChemistryData(6).ShomateC = 11.432816;
361 7 : state.dataGenerator->GasPhaseThermoChemistryData(6).ShomateD = -2.772874;
362 7 : state.dataGenerator->GasPhaseThermoChemistryData(6).ShomateE = -0.158558;
363 7 : state.dataGenerator->GasPhaseThermoChemistryData(6).ShomateF = -9.980797;
364 7 : state.dataGenerator->GasPhaseThermoChemistryData(6).ShomateG = 172.707974;
365 7 : state.dataGenerator->GasPhaseThermoChemistryData(6).ShomateH = 0.0;
366 7 : state.dataGenerator->GasPhaseThermoChemistryData(6).NumCarbons = 0.0;
367 7 : state.dataGenerator->GasPhaseThermoChemistryData(6).NumHydrogens = 2.0;
368 7 : state.dataGenerator->GasPhaseThermoChemistryData(6).NumOxygens = 0.0;
369 7 : state.dataGenerator->GasPhaseThermoChemistryData(6).MolecularWeight = 2.02;
370 :
371 : // Methane (CH4) Temp K 298-1300
372 7 : state.dataGenerator->GasPhaseThermoChemistryData(7).ConstituentName = "Methane";
373 7 : state.dataGenerator->GasPhaseThermoChemistryData(7).ConstituentFormula = "CH4";
374 7 : state.dataGenerator->GasPhaseThermoChemistryData(7).StdRefMolarEnthOfForm = -74.8731; // KJ/mol (Chase 1998)
375 7 : state.dataGenerator->GasPhaseThermoChemistryData(7).ThermoMode = DataGenerators::ThermodynamicMode::NISTShomate;
376 7 : state.dataGenerator->GasPhaseThermoChemistryData(7).ShomateA = -0.703029;
377 7 : state.dataGenerator->GasPhaseThermoChemistryData(7).ShomateB = 108.4773;
378 7 : state.dataGenerator->GasPhaseThermoChemistryData(7).ShomateC = -42.52157;
379 7 : state.dataGenerator->GasPhaseThermoChemistryData(7).ShomateD = 5.862788;
380 7 : state.dataGenerator->GasPhaseThermoChemistryData(7).ShomateE = 0.678565;
381 7 : state.dataGenerator->GasPhaseThermoChemistryData(7).ShomateF = -76.84376;
382 7 : state.dataGenerator->GasPhaseThermoChemistryData(7).ShomateG = 158.7163;
383 7 : state.dataGenerator->GasPhaseThermoChemistryData(7).ShomateH = -74.87310;
384 7 : state.dataGenerator->GasPhaseThermoChemistryData(7).NumCarbons = 1.0;
385 7 : state.dataGenerator->GasPhaseThermoChemistryData(7).NumHydrogens = 4.0;
386 7 : state.dataGenerator->GasPhaseThermoChemistryData(7).NumOxygens = 0.0;
387 7 : state.dataGenerator->GasPhaseThermoChemistryData(7).MolecularWeight = 16.04;
388 :
389 : // Ethane (C2H6)
390 7 : state.dataGenerator->GasPhaseThermoChemistryData(8).ConstituentName = "Ethane";
391 7 : state.dataGenerator->GasPhaseThermoChemistryData(8).ConstituentFormula = "C2H6";
392 7 : state.dataGenerator->GasPhaseThermoChemistryData(8).StdRefMolarEnthOfForm = -83.8605; // -83.8 !KJ/mol (Pittam and Pilcher 1972)
393 7 : state.dataGenerator->GasPhaseThermoChemistryData(8).ThermoMode = DataGenerators::ThermodynamicMode::NISTShomate;
394 7 : state.dataGenerator->GasPhaseThermoChemistryData(8).ShomateA = -3.03849;
395 7 : state.dataGenerator->GasPhaseThermoChemistryData(8).ShomateB = 199.202;
396 7 : state.dataGenerator->GasPhaseThermoChemistryData(8).ShomateC = -84.9812;
397 7 : state.dataGenerator->GasPhaseThermoChemistryData(8).ShomateD = 11.0348;
398 7 : state.dataGenerator->GasPhaseThermoChemistryData(8).ShomateE = 0.30348;
399 7 : state.dataGenerator->GasPhaseThermoChemistryData(8).ShomateF = -90.0633;
400 7 : state.dataGenerator->GasPhaseThermoChemistryData(8).ShomateG = -999.0;
401 7 : state.dataGenerator->GasPhaseThermoChemistryData(8).ShomateH = -83.8605;
402 7 : state.dataGenerator->GasPhaseThermoChemistryData(8).NumCarbons = 2.0;
403 7 : state.dataGenerator->GasPhaseThermoChemistryData(8).NumHydrogens = 6.0;
404 7 : state.dataGenerator->GasPhaseThermoChemistryData(8).NumOxygens = 0.0;
405 7 : state.dataGenerator->GasPhaseThermoChemistryData(8).MolecularWeight = 30.07;
406 7 : state.dataGenerator->GasPhaseThermoChemistryData(8).NASA_A1 = 0.14625388e+01;
407 7 : state.dataGenerator->GasPhaseThermoChemistryData(8).NASA_A2 = 0.15494667e-01;
408 7 : state.dataGenerator->GasPhaseThermoChemistryData(8).NASA_A3 = 0.05780507e-04;
409 7 : state.dataGenerator->GasPhaseThermoChemistryData(8).NASA_A4 = -0.12578319e-07;
410 7 : state.dataGenerator->GasPhaseThermoChemistryData(8).NASA_A5 = 0.04586267e-10;
411 7 : state.dataGenerator->GasPhaseThermoChemistryData(8).NASA_A6 = -0.11239176e+05;
412 7 : state.dataGenerator->GasPhaseThermoChemistryData(8).NASA_A7 = 0.14432295e+02;
413 :
414 : // Propane (C3H8)
415 7 : state.dataGenerator->GasPhaseThermoChemistryData(9).ConstituentName = "Propane";
416 7 : state.dataGenerator->GasPhaseThermoChemistryData(9).ConstituentFormula = "C3H8";
417 7 : state.dataGenerator->GasPhaseThermoChemistryData(9).StdRefMolarEnthOfForm = -103.855; // -104.7 !kJ/mol (Pittam and Pilcher 1972)
418 7 : state.dataGenerator->GasPhaseThermoChemistryData(9).ThermoMode = DataGenerators::ThermodynamicMode::NISTShomate;
419 7 : state.dataGenerator->GasPhaseThermoChemistryData(9).ShomateA = -23.1747;
420 7 : state.dataGenerator->GasPhaseThermoChemistryData(9).ShomateB = 363.742;
421 7 : state.dataGenerator->GasPhaseThermoChemistryData(9).ShomateC = -222.981;
422 7 : state.dataGenerator->GasPhaseThermoChemistryData(9).ShomateD = 56.253;
423 7 : state.dataGenerator->GasPhaseThermoChemistryData(9).ShomateE = 0.61164;
424 7 : state.dataGenerator->GasPhaseThermoChemistryData(9).ShomateF = -109.206;
425 7 : state.dataGenerator->GasPhaseThermoChemistryData(9).ShomateG = -999.0;
426 7 : state.dataGenerator->GasPhaseThermoChemistryData(9).ShomateH = -103.855;
427 7 : state.dataGenerator->GasPhaseThermoChemistryData(9).NumCarbons = 3.0;
428 7 : state.dataGenerator->GasPhaseThermoChemistryData(9).NumHydrogens = 8.0;
429 7 : state.dataGenerator->GasPhaseThermoChemistryData(9).NumOxygens = 0.0;
430 7 : state.dataGenerator->GasPhaseThermoChemistryData(9).MolecularWeight = 44.10;
431 7 : state.dataGenerator->GasPhaseThermoChemistryData(9).NASA_A1 = 0.08969208e+01;
432 7 : state.dataGenerator->GasPhaseThermoChemistryData(9).NASA_A2 = 0.02668986e+00;
433 7 : state.dataGenerator->GasPhaseThermoChemistryData(9).NASA_A3 = 0.05431425e-04;
434 7 : state.dataGenerator->GasPhaseThermoChemistryData(9).NASA_A4 = -0.02126000e-06;
435 7 : state.dataGenerator->GasPhaseThermoChemistryData(9).NASA_A5 = 0.09243330e-10;
436 7 : state.dataGenerator->GasPhaseThermoChemistryData(9).NASA_A6 = -0.13954918e+05;
437 7 : state.dataGenerator->GasPhaseThermoChemistryData(9).NASA_A7 = 0.01935533e+03;
438 :
439 : // Butane (C4H10)
440 7 : state.dataGenerator->GasPhaseThermoChemistryData(10).ConstituentName = "Butane";
441 7 : state.dataGenerator->GasPhaseThermoChemistryData(10).ConstituentFormula = "C4H10";
442 7 : state.dataGenerator->GasPhaseThermoChemistryData(10).StdRefMolarEnthOfForm = -133.218; // -125.6 !kJ/mol (Pittam and Pilcher 1972)
443 7 : state.dataGenerator->GasPhaseThermoChemistryData(10).ThermoMode = DataGenerators::ThermodynamicMode::NISTShomate;
444 7 : state.dataGenerator->GasPhaseThermoChemistryData(10).ShomateA = -5.24343;
445 7 : state.dataGenerator->GasPhaseThermoChemistryData(10).ShomateB = 426.442;
446 7 : state.dataGenerator->GasPhaseThermoChemistryData(10).ShomateC = -257.955;
447 7 : state.dataGenerator->GasPhaseThermoChemistryData(10).ShomateD = 66.535;
448 7 : state.dataGenerator->GasPhaseThermoChemistryData(10).ShomateE = -0.26994;
449 7 : state.dataGenerator->GasPhaseThermoChemistryData(10).ShomateF = -149.365;
450 7 : state.dataGenerator->GasPhaseThermoChemistryData(10).ShomateG = -999.0;
451 7 : state.dataGenerator->GasPhaseThermoChemistryData(10).ShomateH = -133.218;
452 7 : state.dataGenerator->GasPhaseThermoChemistryData(10).NumCarbons = 4.0;
453 7 : state.dataGenerator->GasPhaseThermoChemistryData(10).NumHydrogens = 10.0;
454 7 : state.dataGenerator->GasPhaseThermoChemistryData(10).NumOxygens = 0.0;
455 7 : state.dataGenerator->GasPhaseThermoChemistryData(10).MolecularWeight = 58.12;
456 7 : state.dataGenerator->GasPhaseThermoChemistryData(10).NASA_A1 = -0.02256618e+02;
457 7 : state.dataGenerator->GasPhaseThermoChemistryData(10).NASA_A2 = 0.05881732e+00;
458 7 : state.dataGenerator->GasPhaseThermoChemistryData(10).NASA_A3 = -0.04525782e-03;
459 7 : state.dataGenerator->GasPhaseThermoChemistryData(10).NASA_A4 = 0.02037115e-06;
460 7 : state.dataGenerator->GasPhaseThermoChemistryData(10).NASA_A5 = -0.04079458e-10;
461 7 : state.dataGenerator->GasPhaseThermoChemistryData(10).NASA_A6 = -0.01760233e+06;
462 7 : state.dataGenerator->GasPhaseThermoChemistryData(10).NASA_A7 = 0.03329595e+03;
463 :
464 : // Pentane (C5H12)
465 7 : state.dataGenerator->GasPhaseThermoChemistryData(11).ConstituentName = "Pentane";
466 7 : state.dataGenerator->GasPhaseThermoChemistryData(11).ConstituentFormula = "C5H12";
467 7 : state.dataGenerator->GasPhaseThermoChemistryData(11).StdRefMolarEnthOfForm = -146.348; // -146.8 !kJ/mol (Good 1970)
468 7 : state.dataGenerator->GasPhaseThermoChemistryData(11).ThermoMode = DataGenerators::ThermodynamicMode::NISTShomate;
469 7 : state.dataGenerator->GasPhaseThermoChemistryData(11).ShomateA = -34.9431;
470 7 : state.dataGenerator->GasPhaseThermoChemistryData(11).ShomateB = 576.777;
471 7 : state.dataGenerator->GasPhaseThermoChemistryData(11).ShomateC = -338.353;
472 7 : state.dataGenerator->GasPhaseThermoChemistryData(11).ShomateD = 76.8232;
473 7 : state.dataGenerator->GasPhaseThermoChemistryData(11).ShomateE = 1.00948;
474 7 : state.dataGenerator->GasPhaseThermoChemistryData(11).ShomateF = -155.348;
475 7 : state.dataGenerator->GasPhaseThermoChemistryData(11).ShomateG = -999.0;
476 7 : state.dataGenerator->GasPhaseThermoChemistryData(11).ShomateH = -146.348;
477 7 : state.dataGenerator->GasPhaseThermoChemistryData(11).NumCarbons = 5.0;
478 7 : state.dataGenerator->GasPhaseThermoChemistryData(11).NumHydrogens = 12.0;
479 7 : state.dataGenerator->GasPhaseThermoChemistryData(11).NumOxygens = 0.0;
480 7 : state.dataGenerator->GasPhaseThermoChemistryData(11).MolecularWeight = 72.15;
481 7 : state.dataGenerator->GasPhaseThermoChemistryData(11).NASA_A1 = 0.01877907e+02;
482 7 : state.dataGenerator->GasPhaseThermoChemistryData(11).NASA_A2 = 0.04121645e+00;
483 7 : state.dataGenerator->GasPhaseThermoChemistryData(11).NASA_A3 = 0.12532337e-04;
484 7 : state.dataGenerator->GasPhaseThermoChemistryData(11).NASA_A4 = -0.03701536e-06;
485 7 : state.dataGenerator->GasPhaseThermoChemistryData(11).NASA_A5 = 0.15255685e-10;
486 7 : state.dataGenerator->GasPhaseThermoChemistryData(11).NASA_A6 = -0.02003815e+06;
487 7 : state.dataGenerator->GasPhaseThermoChemistryData(11).NASA_A7 = 0.01877256e+03;
488 :
489 : // Hexane (C6H14)
490 7 : state.dataGenerator->GasPhaseThermoChemistryData(12).ConstituentName = "Hexane";
491 7 : state.dataGenerator->GasPhaseThermoChemistryData(12).ConstituentFormula = "C6H14";
492 7 : state.dataGenerator->GasPhaseThermoChemistryData(12).StdRefMolarEnthOfForm = -166.966; // -167.2 !kJ/mol (Prosen and Rossini 1945)
493 7 : state.dataGenerator->GasPhaseThermoChemistryData(12).ThermoMode = DataGenerators::ThermodynamicMode::NISTShomate;
494 7 : state.dataGenerator->GasPhaseThermoChemistryData(12).ShomateA = -46.7786;
495 7 : state.dataGenerator->GasPhaseThermoChemistryData(12).ShomateB = 711.187;
496 7 : state.dataGenerator->GasPhaseThermoChemistryData(12).ShomateC = -438.39;
497 7 : state.dataGenerator->GasPhaseThermoChemistryData(12).ShomateD = 103.784;
498 7 : state.dataGenerator->GasPhaseThermoChemistryData(12).ShomateE = 1.23887;
499 7 : state.dataGenerator->GasPhaseThermoChemistryData(12).ShomateF = -176.813;
500 7 : state.dataGenerator->GasPhaseThermoChemistryData(12).ShomateG = -999.0;
501 7 : state.dataGenerator->GasPhaseThermoChemistryData(12).ShomateH = -166.966;
502 7 : state.dataGenerator->GasPhaseThermoChemistryData(12).NumCarbons = 6.0;
503 7 : state.dataGenerator->GasPhaseThermoChemistryData(12).NumHydrogens = 14.0;
504 7 : state.dataGenerator->GasPhaseThermoChemistryData(12).NumOxygens = 0.0;
505 7 : state.dataGenerator->GasPhaseThermoChemistryData(12).MolecularWeight = 86.18;
506 7 : state.dataGenerator->GasPhaseThermoChemistryData(12).NASA_A1 = 0.01836174e+02;
507 7 : state.dataGenerator->GasPhaseThermoChemistryData(12).NASA_A2 = 0.05098461e+00;
508 7 : state.dataGenerator->GasPhaseThermoChemistryData(12).NASA_A3 = 0.12595857e-04;
509 7 : state.dataGenerator->GasPhaseThermoChemistryData(12).NASA_A4 = -0.04428362e-06;
510 7 : state.dataGenerator->GasPhaseThermoChemistryData(12).NASA_A5 = 0.01872237e-09;
511 7 : state.dataGenerator->GasPhaseThermoChemistryData(12).NASA_A6 = -0.02292749e+06;
512 7 : state.dataGenerator->GasPhaseThermoChemistryData(12).NASA_A7 = 0.02088145e+03;
513 :
514 : // Methanol (CH3OH)
515 : // No Shomate coefficients???
516 7 : state.dataGenerator->GasPhaseThermoChemistryData(13).ConstituentName = "Methanol";
517 7 : state.dataGenerator->GasPhaseThermoChemistryData(13).ConstituentFormula = "CH3OH";
518 7 : state.dataGenerator->GasPhaseThermoChemistryData(13).StdRefMolarEnthOfForm = -201.102; // -201.0 !kJ/mol (Hine and Arata 1976)
519 7 : state.dataGenerator->GasPhaseThermoChemistryData(13).ThermoMode = DataGenerators::ThermodynamicMode::NISTShomate;
520 7 : state.dataGenerator->GasPhaseThermoChemistryData(13).ShomateA = 14.1952;
521 7 : state.dataGenerator->GasPhaseThermoChemistryData(13).ShomateB = 97.7218;
522 7 : state.dataGenerator->GasPhaseThermoChemistryData(13).ShomateC = -9.73279;
523 7 : state.dataGenerator->GasPhaseThermoChemistryData(13).ShomateD = -12.8461;
524 7 : state.dataGenerator->GasPhaseThermoChemistryData(13).ShomateE = 0.15819;
525 7 : state.dataGenerator->GasPhaseThermoChemistryData(13).ShomateF = -209.037;
526 7 : state.dataGenerator->GasPhaseThermoChemistryData(13).ShomateG = -999.0;
527 7 : state.dataGenerator->GasPhaseThermoChemistryData(13).ShomateH = -201.102;
528 7 : state.dataGenerator->GasPhaseThermoChemistryData(13).NumCarbons = 1.0;
529 7 : state.dataGenerator->GasPhaseThermoChemistryData(13).NumHydrogens = 4.0;
530 7 : state.dataGenerator->GasPhaseThermoChemistryData(13).NumOxygens = 1.0;
531 7 : state.dataGenerator->GasPhaseThermoChemistryData(13).MolecularWeight = 32.04;
532 7 : state.dataGenerator->GasPhaseThermoChemistryData(13).NASA_A1 = 0.02660115e+02;
533 7 : state.dataGenerator->GasPhaseThermoChemistryData(13).NASA_A2 = 0.07341508e-01;
534 7 : state.dataGenerator->GasPhaseThermoChemistryData(13).NASA_A3 = 0.07170050e-04;
535 7 : state.dataGenerator->GasPhaseThermoChemistryData(13).NASA_A4 = -0.08793194e-07;
536 7 : state.dataGenerator->GasPhaseThermoChemistryData(13).NASA_A5 = 0.02390570e-10;
537 7 : state.dataGenerator->GasPhaseThermoChemistryData(13).NASA_A6 = -0.02535348e+06;
538 7 : state.dataGenerator->GasPhaseThermoChemistryData(13).NASA_A7 = 0.11232631e+02;
539 :
540 : // Ethanol (C2H5OH)
541 : // No Shomate coefficients???
542 7 : state.dataGenerator->GasPhaseThermoChemistryData(14).ConstituentName = "Ethanol";
543 7 : state.dataGenerator->GasPhaseThermoChemistryData(14).ConstituentFormula = "C2H5OH";
544 7 : state.dataGenerator->GasPhaseThermoChemistryData(14).StdRefMolarEnthOfForm = -234.441; // -235.3 !kJ/mol (Green 1960)
545 7 : state.dataGenerator->GasPhaseThermoChemistryData(14).ThermoMode = DataGenerators::ThermodynamicMode::NISTShomate;
546 7 : state.dataGenerator->GasPhaseThermoChemistryData(14).ShomateA = -8.87256;
547 7 : state.dataGenerator->GasPhaseThermoChemistryData(14).ShomateB = 282.389;
548 7 : state.dataGenerator->GasPhaseThermoChemistryData(14).ShomateC = -178.85;
549 7 : state.dataGenerator->GasPhaseThermoChemistryData(14).ShomateD = 46.3528;
550 7 : state.dataGenerator->GasPhaseThermoChemistryData(14).ShomateE = 0.48364;
551 7 : state.dataGenerator->GasPhaseThermoChemistryData(14).ShomateF = -241.239;
552 7 : state.dataGenerator->GasPhaseThermoChemistryData(14).ShomateG = -999.0;
553 7 : state.dataGenerator->GasPhaseThermoChemistryData(14).ShomateH = -234.441;
554 7 : state.dataGenerator->GasPhaseThermoChemistryData(14).NumCarbons = 2.0;
555 7 : state.dataGenerator->GasPhaseThermoChemistryData(14).NumHydrogens = 6.0;
556 7 : state.dataGenerator->GasPhaseThermoChemistryData(14).NumOxygens = 1.0;
557 7 : state.dataGenerator->GasPhaseThermoChemistryData(14).MolecularWeight = 46.07;
558 7 : state.dataGenerator->GasPhaseThermoChemistryData(14).NASA_A1 = 0.18461027e+01;
559 7 : state.dataGenerator->GasPhaseThermoChemistryData(14).NASA_A2 = 0.20475008e-01;
560 7 : state.dataGenerator->GasPhaseThermoChemistryData(14).NASA_A3 = 0.39904089e-05;
561 7 : state.dataGenerator->GasPhaseThermoChemistryData(14).NASA_A4 = -0.16585986e-07;
562 7 : state.dataGenerator->GasPhaseThermoChemistryData(14).NASA_A5 = 0.73090440e-11;
563 7 : state.dataGenerator->GasPhaseThermoChemistryData(14).NASA_A6 = -0.29663086e+05;
564 7 : state.dataGenerator->GasPhaseThermoChemistryData(14).NASA_A7 = 0.17289993e+02;
565 :
566 7 : if (state.dataGenerator->FuelSupply(FuelSupplyNum).FuelTypeMode == DataGenerators::FuelMode::GaseousConstituents) {
567 : // now calculate LHV of fuel for entire simulation
568 :
569 : // sum over each constituent
570 7 : Real64 O2Stoic = 0.0; // stochiometric oxygen coef in chemical equation (15)
571 7 : Real64 CO2ProdStoic = 0.0; // product gases carbon dioxide coeff
572 7 : Real64 H2OProdStoic = 0.0; // product gases water coeff
573 7 : int CO2dataID = 1; // hard-coded above
574 7 : int WaterDataID = 4; // hard-coded above
575 : // Loop over fuel constituents and do one-time setup
576 42 : for (int i = 1; i <= state.dataGenerator->FuelSupply(FuelSupplyNum).NumConstituents; ++i) {
577 :
578 35 : std::string const &thisName = state.dataGenerator->FuelSupply(FuelSupplyNum).ConstitName(i);
579 35 : int thisGasID = Util::FindItem(
580 35 : thisName, state.dataGenerator->GasPhaseThermoChemistryData, &DataGenerators::GasPropertyDataStruct::ConstituentName);
581 35 : state.dataGenerator->FuelSupply(FuelSupplyNum).GasLibID(i) = thisGasID;
582 :
583 35 : if (thisGasID == 0) {
584 0 : ShowSevereError(state, format("Fuel constituent not found in thermochemistry data: {}", thisName));
585 0 : ErrorsFound = true;
586 : }
587 :
588 : // for this fuel mixture, figure stoichiometric oxygen requirement
589 35 : O2Stoic += state.dataGenerator->FuelSupply(FuelSupplyNum).ConstitMolalFract(i) *
590 35 : (state.dataGenerator->GasPhaseThermoChemistryData(thisGasID).NumCarbons +
591 35 : state.dataGenerator->GasPhaseThermoChemistryData(thisGasID).NumHydrogens / 4.0 -
592 35 : state.dataGenerator->GasPhaseThermoChemistryData(thisGasID).NumOxygens / 2.0);
593 : // for this fuel mixture, figure stoichiometric Carbon Dioxide in Product Gases
594 :
595 35 : CO2ProdStoic += state.dataGenerator->FuelSupply(FuelSupplyNum).ConstitMolalFract(i) *
596 35 : state.dataGenerator->GasPhaseThermoChemistryData(thisGasID).NumCarbons;
597 :
598 35 : H2OProdStoic += state.dataGenerator->FuelSupply(FuelSupplyNum).ConstitMolalFract(i) *
599 35 : state.dataGenerator->GasPhaseThermoChemistryData(thisGasID).NumHydrogens / 2.0;
600 : }
601 :
602 7 : state.dataGenerator->FuelSupply(FuelSupplyNum).StoicOxygenRate = O2Stoic;
603 7 : state.dataGenerator->FuelSupply(FuelSupplyNum).CO2ProductGasCoef = CO2ProdStoic;
604 7 : state.dataGenerator->FuelSupply(FuelSupplyNum).H2OProductGasCoef = H2OProdStoic;
605 :
606 : // Calculate LHV for an NdotFuel of 1.0
607 7 : Real64 LHVfuel = 0.0;
608 : Real64 LHVi; // working var for lower heating value calc
609 42 : for (int i = 1; i <= state.dataGenerator->FuelSupply(FuelSupplyNum).NumConstituents; ++i) {
610 35 : int thisGasID = state.dataGenerator->FuelSupply(FuelSupplyNum).GasLibID(i);
611 35 : if (state.dataGenerator->GasPhaseThermoChemistryData(thisGasID).NumHydrogens == 0.0) {
612 12 : LHVi = 0.0;
613 : } else {
614 23 : LHVi = state.dataGenerator->GasPhaseThermoChemistryData(thisGasID).StdRefMolarEnthOfForm -
615 23 : state.dataGenerator->GasPhaseThermoChemistryData(thisGasID).NumCarbons *
616 23 : state.dataGenerator->GasPhaseThermoChemistryData(CO2dataID).StdRefMolarEnthOfForm -
617 23 : (state.dataGenerator->GasPhaseThermoChemistryData(thisGasID).NumHydrogens / 2.0) *
618 23 : state.dataGenerator->GasPhaseThermoChemistryData(WaterDataID).StdRefMolarEnthOfForm;
619 : }
620 35 : LHVfuel += LHVi * state.dataGenerator->FuelSupply(FuelSupplyNum).ConstitMolalFract(i);
621 : }
622 7 : state.dataGenerator->FuelSupply(FuelSupplyNum).LHV = LHVfuel;
623 :
624 : // Calculate HHV for an NdotFuel of 1.0
625 7 : Real64 HHVfuel = 0.0;
626 : Real64 HHVi; // working var for higher heating value calc
627 42 : for (int i = 1; i <= state.dataGenerator->FuelSupply(FuelSupplyNum).NumConstituents; ++i) {
628 35 : int thisGasID = state.dataGenerator->FuelSupply(FuelSupplyNum).GasLibID(i);
629 35 : if (state.dataGenerator->GasPhaseThermoChemistryData(thisGasID).NumHydrogens == 0.0) {
630 12 : HHVi = 0.0;
631 : } else {
632 23 : HHVi = state.dataGenerator->GasPhaseThermoChemistryData(thisGasID).StdRefMolarEnthOfForm -
633 23 : state.dataGenerator->GasPhaseThermoChemistryData(thisGasID).NumCarbons *
634 23 : state.dataGenerator->GasPhaseThermoChemistryData(CO2dataID).StdRefMolarEnthOfForm -
635 23 : (state.dataGenerator->GasPhaseThermoChemistryData(thisGasID).NumHydrogens / 2.0) *
636 23 : state.dataGenerator->GasPhaseThermoChemistryData(WaterDataID).StdRefMolarEnthOfForm +
637 23 : (state.dataGenerator->GasPhaseThermoChemistryData(thisGasID).NumHydrogens / 2.0) *
638 23 : (state.dataGenerator->GasPhaseThermoChemistryData(WaterDataID).StdRefMolarEnthOfForm + 285.8304);
639 : }
640 35 : HHVfuel += HHVi * state.dataGenerator->FuelSupply(FuelSupplyNum).ConstitMolalFract(i);
641 : }
642 :
643 : // Calculate Molecular Weight for this fuel
644 7 : Real64 MWfuel = 0.0;
645 42 : for (int i = 1; i <= state.dataGenerator->FuelSupply(FuelSupplyNum).NumConstituents; ++i) {
646 35 : int thisGasID = state.dataGenerator->FuelSupply(FuelSupplyNum).GasLibID(i);
647 35 : MWfuel += state.dataGenerator->FuelSupply(FuelSupplyNum).ConstitMolalFract(i) *
648 35 : state.dataGenerator->GasPhaseThermoChemistryData(thisGasID).MolecularWeight;
649 : }
650 7 : state.dataGenerator->FuelSupply(FuelSupplyNum).MW = MWfuel;
651 7 : state.dataGenerator->FuelSupply(FuelSupplyNum).KmolPerSecToKgPerSec = MWfuel; // TODO check this, guessing on conversion...
652 7 : state.dataGenerator->FuelSupply(FuelSupplyNum).HHV = 1000000.0 * HHVfuel / MWfuel; // (1000/k) (1000/k) (kJ/mol)/(g/mol) = J/kg
653 7 : state.dataGenerator->FuelSupply(FuelSupplyNum).LHVJperkg =
654 7 : state.dataGenerator->FuelSupply(FuelSupplyNum).LHV * 1000000.0 / state.dataGenerator->FuelSupply(FuelSupplyNum).MW;
655 :
656 0 : } else if (state.dataGenerator->FuelSupply(FuelSupplyNum).FuelTypeMode == DataGenerators::FuelMode::GenericLiquid) {
657 0 : state.dataGenerator->FuelSupply(FuelSupplyNum).LHV = state.dataGenerator->FuelSupply(FuelSupplyNum).LHVliquid *
658 0 : state.dataGenerator->FuelSupply(FuelSupplyNum).MW /
659 : 1000000.0; // J/kg * g/mol (k/1000) (k/10000)
660 :
661 : } else {
662 : }
663 :
664 : // report Heating Values in EIO.
665 7 : if (first_time) {
666 3 : print(state.files.eio,
667 : "! <Fuel Supply>, Fuel Supply Name, Lower Heating Value [J/kmol], Lower Heating Value [kJ/kg], Higher "
668 : "Heating Value [KJ/kg], Molecular Weight [g/mol] \n");
669 : }
670 : static constexpr std::string_view Format_501(" Fuel Supply, {},{:13.6G},{:13.6G},{:13.6G},{:13.6G}\n");
671 7 : print(state.files.eio,
672 : Format_501,
673 7 : state.dataGenerator->FuelSupply(FuelSupplyNum).Name,
674 7 : state.dataGenerator->FuelSupply(FuelSupplyNum).LHV * 1000000.0,
675 7 : state.dataGenerator->FuelSupply(FuelSupplyNum).LHVJperkg / 1000.0,
676 7 : state.dataGenerator->FuelSupply(FuelSupplyNum).HHV / 1000.0,
677 7 : state.dataGenerator->FuelSupply(FuelSupplyNum).MW);
678 7 : }
679 :
680 : } // namespace GeneratorFuelSupply
681 :
682 : } // namespace EnergyPlus
|