71 double density,
double heatValueFuel,
double flueGasO2)
72 : stoichAir(stoichAir), excessAir(excessAir), availableHeat(availableHeat), specificHeat(specificHeat),
73 density(density), heatValueFuel(heatValueFuel), flueGasO2(flueGasO2) {}
76 double stoichAir = 0, excessAir = 0, availableHeat = 0, specificHeat = 0, density = 0, heatValueFuel = 0,
98 GasCompositions(std::string substance,
const double CH4,
const double C2H6,
const double N2,
const double H2,
99 const double C3H8,
const double C4H10_CnH2n,
const double H2O,
const double CO,
const double CO2,
100 const double SO2,
const double O2)
101 : substance(std::move(substance)),
102 totalPercent(CH4 + C2H6 + N2 + H2 + C3H8 + C4H10_CnH2n + H2O + CO + CO2 + SO2 + O2),
103 CH4(std::make_shared<
GasProperties>([](double t) {
return 4.23 + 0.01177 * t; }, 16.042, 0.042417, CH4,
104 CH4 / totalPercent, 64, 23875, 1012, 36.032, 44.01)),
105 C2H6(std::make_shared<GasProperties>([](
double t) {
return 4.04 + 0.01636 * t; }, 30.068, 0.079503, C2H6,
106 C2H6 / totalPercent, 112, 22323, 1773, 54.048, 88.02)),
107 N2(std::make_shared<GasProperties>([](
double t) {
return 9.47 - 3.47 * 1000 / t + 1.07 * 1000000 / (t * t); },
108 28.016, 0.074077, N2, N2 / totalPercent, 0, 0, 0, 0, 0)),
109 H2(std::make_shared<GasProperties>([](
double t) {
return 5.76 + 0.578 * t / 1000 + 20 / pow(t, 0.5); }, 2.016,
110 0.005331, H2, H2 / totalPercent, 16, 61095, 325, 18.016, 0)),
111 C3H8(std::make_shared<GasProperties>(
116 44.094, 0.116589, C3H8, C3H8 / totalPercent, 160, 21669, 2523, 72.064, 132.03)),
117 C4H10_CnH2n(std::make_shared<GasProperties>(
122 58.12, 0.153675, C4H10_CnH2n, C4H10_CnH2n / totalPercent, 208, 21321, 3270, 90.08, 176.04)),
123 H2O(std::make_shared<GasProperties>([](
double t) {
return 19.86 - 597 / pow(t, 0.5) + 7500 / t; }, 18.016,
124 0.047636, H2O, H2O / totalPercent, 0, 0, 0, 18.016, 0)),
125 CO(std::make_shared<GasProperties>([](
double t) {
return 9.46 - 3.29 * 1000 / t + 1.07 * 1000000 / (t * t); },
126 28.01, 0.074061, CO, CO / totalPercent, 16, 4347, 321, 0, 44.01)),
127 CO2(std::make_shared<GasProperties>(
128 [](
double t) {
return 16.2 - 6.53 * 1000 / t + 1.41 * 1000000 / (t * t); }, 44.01, 0.116367, CO2,
129 CO2 / totalPercent, 0, 0, 0, 0, 44.01)),
130 SO2(std::make_shared<GasProperties>(
135 64.06, 0.169381, SO2, SO2 * 100 / totalPercent, 0, 0, 0, 0, 0)),
136 O2(std::make_shared<GasProperties>([](
double t) {
return 11.515 - 172 / pow(t, 0.5) + 1530 / t; }, 32.00,
137 0.084611, O2, O2 / totalPercent, -32, 0, 0, 0, 0)) {
138 gasses = {{
"CH4", this->CH4}, {
"C2H6", this->C2H6}, {
"N2", this->N2},
139 {
"H2", this->H2}, {
"C3H8", this->C3H8}, {
"C4H10_CnH2n", this->C4H10_CnH2n},
140 {
"H2O", this->H2O}, {
"CO", this->CO}, {
"CO2", this->CO2},
141 {
"SO2", this->SO2}, {
"O2", this->O2}};
143 calculateCompByWeight();
144 heatingValue = calculateHeatingValueFuel();
145 heatingValueVolume = calculateHeatingValueFuelVolume();
146 specificGravity = calculateSpecificGravity();
147 stoichometricAir = calculateStoichometricAir();
156 auto const gas = gasses.find(gasName);
157 if (gas == gasses.end()) {
158 throw std::runtime_error(
"Cannot find " + gasName +
" in gasses");
160 return gas->second->compByVol;
163 double getHeatingValue()
const {
return heatingValue; };
164 double getHeatingValueVolume()
const {
return heatingValueVolume; };
165 double getSpecificGravity()
const {
return specificGravity; };
166 double getStoichometricAir()
const {
return stoichometricAir; };
204 const double combAirTemperatureF,
const double fuelTempF = 60,
205 const double ambientAirTempF = 60,
206 const double combAirMoisturePerc = 0,
207 const double excessAir = 0);
209 double calculateExcessAir(
double flueGasO2);
210 double calculateO2(
double excessAir);
222 int getID()
const {
return this->id; }
228 void setID(
const int id) { this->
id = id; }
234 double calculateSpecificGravity();
235 double calculateStoichometricAir();
237 void calculateCompByWeight();
238 double calculateSensibleHeat(
double combustionAirTemp);
239 double calculateHeatCombustionAir(
double combustionAirTemp,
double excessAir);
240 void calculateMassFlueGasComponents(
double excessAir);
241 double calculateHeatingValueFuel();
242 double calculateHeatingValueFuelVolume();
243 void calculateEnthalpy();
244 double calculateTotalHeatContentFlueGas(
double flueGasTemperature);
246 GasCompositions(std::string substance,
const double CH4,
const double C2H6,
const double N2,
const double H2,
247 const double C3H8,
const double C4H10_CnH2n,
const double H2O,
const double CO,
const double CO2,
248 const double SO2,
const double O2,
const double heatingValue,
const double heatingValueVolume,
249 const double specificGravity,
const double stoichometricAir = 0)
250 : substance(std::move(substance)),
251 totalPercent(CH4 + C2H6 + N2 + H2 + C3H8 + C4H10_CnH2n + H2O + CO + CO2 + SO2 + O2),
252 CH4(std::make_shared<
GasProperties>([](double t) {
return 4.23 + 0.01177 * t; }, 16.042, 0.042417, CH4,
253 CH4 / totalPercent, 64, 23875, 1012, 36.032, 44.01)),
254 C2H6(std::make_shared<GasProperties>([](
double t) {
return 4.04 + 0.01636 * t; }, 30.068, 0.079503, C2H6,
255 C2H6 / totalPercent, 112, 22323, 1773, 54.048, 88.02)),
256 N2(std::make_shared<GasProperties>([](
double t) {
return 9.47 - 3.47 * 1000 / t + 1.07 * 1000000 / (t * t); },
257 28.016, 0.074077, N2, N2 / totalPercent, 0, 0, 0, 0, 0)),
258 H2(std::make_shared<GasProperties>([](
double t) {
return 5.76 + 0.578 * t / 1000 + 20 / pow(t, 0.5); }, 2.016,
259 0.005331, H2, H2 / totalPercent, 16, 61095, 325, 18.016, 0)),
260 C3H8(std::make_shared<GasProperties>(
265 44.094, 0.116589, C3H8, C3H8 / totalPercent, 160, 21669, 2523, 72.064, 132.03)),
266 C4H10_CnH2n(std::make_shared<GasProperties>(
271 58.12, 0.153675, C4H10_CnH2n, C4H10_CnH2n / totalPercent, 208, 21321, 3270, 90.08, 176.04)),
272 H2O(std::make_shared<GasProperties>([](
double t) {
return 19.86 - 597 / pow(t, 0.5) + 7500 / t; }, 18.016,
273 0.047636, H2O, H2O / totalPercent, 0, 0, 0, 18.016, 0)),
274 CO(std::make_shared<GasProperties>([](
double t) {
return 9.46 - 3.29 * 1000 / t + 1.07 * 1000000 / (t * t); },
275 28.01, 0.074061, CO, CO / totalPercent, 16, 4347, 321, 0, 44.01)),
276 CO2(std::make_shared<GasProperties>(
277 [](
double t) {
return 16.2 - 6.53 * 1000 / t + 1.41 * 1000000 / (t * t); }, 44.01, 0.116367, CO2,
278 CO2 / totalPercent, 0, 0, 0, 0, 44.01)),
279 SO2(std::make_shared<GasProperties>(
284 64.06, 0.169381, SO2, SO2 * 100 / totalPercent, 0, 0, 0, 0, 0)),
285 O2(std::make_shared<GasProperties>([](
double t) {
return 11.515 - 172 / pow(t, 0.5) + 1530 / t; }, 32.00,
286 0.084611, O2, O2 / totalPercent, -32, 0, 0, 0, 0)),
287 heatingValue(heatingValue), specificGravity(specificGravity), heatingValueVolume(heatingValueVolume),
288 stoichometricAir(stoichometricAir) {
289 gasses = {{
"CH4", this->CH4}, {
"C2H6", this->C2H6}, {
"N2", this->N2},
290 {
"H2", this->H2}, {
"C3H8", this->C3H8}, {
"C4H10_CnH2n", this->C4H10_CnH2n},
291 {
"H2O", this->H2O}, {
"CO", this->CO}, {
"CO2", this->CO2},
292 {
"SO2", this->SO2}, {
"O2", this->O2}};
296 std::unordered_map<std::string, std::shared_ptr<GasProperties>> gasses;
298 std::string substance;
300 double hH2Osat = 0, tH2Osat = 0;
301 double mH2O = 0, mCO2 = 0, mO2 = 0, mN2 = 0, mSO2 = 0;
302 std::shared_ptr<GasProperties> CH4, C2H6, N2, H2, C3H8, C4H10_CnH2n, H2O, CO, CO2, SO2, O2;
303 double heatingValue = 0, specificGravity = 0, heatingValueVolume = 0, stoichometricAir = 0;
312 void flueGasO2AdjustForCalcError(
const double excessAir,
double& flueO2)
const;