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