1 #ifndef AMO_TOOLS_SUITE_LOSSES_H 2 #define AMO_TOOLS_SUITE_LOSSES_H 8 #include "calculator/furnace/EfficiencyImprovement.h" 9 #include "calculator/furnace/EnergyEquivalency.h" 10 #include "calculator/furnace/FlowCalculationsEnergyUse.h" 11 #include "calculator/furnace/O2Enrichment.h" 12 #include "calculator/losses/Atmosphere.h" 13 #include "calculator/losses/AuxiliaryPower.h" 14 #include "calculator/losses/EnergyInputExhaustGasLosses.h" 15 #include "calculator/losses/EnergyInputEAF.h" 16 #include "calculator/losses/ExhaustGasEAF.h" 17 #include "calculator/losses/FixtureLosses.h" 18 #include "calculator/losses/GasFlueGasMaterial.h" 19 #include "calculator/losses/SolidLiquidFlueGasMaterial.h" 20 #include "calculator/losses/LoadChargeMaterial.h" 21 #include "calculator/losses/GasCoolingLosses.h" 22 #include "calculator/losses/GasLoadChargeMaterial.h" 23 #include "calculator/losses/LeakageLosses.h" 24 #include "calculator/losses/LiquidCoolingLosses.h" 25 #include "calculator/losses/LiquidLoadChargeMaterial.h" 26 #include "calculator/losses/OpeningLosses.h" 27 #include "calculator/losses/SlagOtherMaterialLosses.h" 28 #include "calculator/losses/SolidLoadChargeMaterial.h" 29 #include "calculator/losses/WallLosses.h" 30 #include "calculator/losses/WaterCoolingLosses.h" 31 #include "calculator/furnace/HumidityRatio.h" 32 #include "calculator/util/Conversion.h" 40 double Get(std::string
const & nm) {
41 Local<String> getName = Nan::New<String>(nm).ToLocalChecked();
42 v8::Isolate *isolate = v8::Isolate::GetCurrent();
43 v8::Local<v8::Context> context = isolate->GetCurrentContext();
44 Local<Value> rObj = Nan::To<Object>(inp).ToLocalChecked()->Get(context, getName).ToLocalChecked();
45 if (rObj->IsUndefined()) {
46 ThrowTypeError(std::string(
"Get method in phast.h: " + nm +
" not present in object").c_str());
48 return Nan::To<double>(rObj).FromJust();
51 void SetR(std::string
const &nm,
double n)
53 Local<String> getName = Nan::New<String>(nm).ToLocalChecked();
54 Local<Number> getNum = Nan::New<Number>(n);
55 Nan::Set(r, getName, getNum);
68 NAN_METHOD(atmosphere)
82 inp = Nan::To<Object>(info[0]).ToLocalChecked();
84 const double inletTemperature = Get(
"inletTemperature");
85 const double outletTemperature = Get(
"outletTemperature");
86 const double flowRate = Get(
"flowRate");
87 const double correctionFactor = Get(
"correctionFactor");
88 const double specificHeat = Get(
"specificHeat");
90 Atmosphere a(inletTemperature, outletTemperature, flowRate, correctionFactor, specificHeat);
91 double heatLoss = a.getTotalHeat();
92 Local<Number> retval = Nan::New(heatLoss);
93 info.GetReturnValue().Set(retval);
96 NAN_METHOD(auxiliaryPowerLoss)
107 inp = Nan::To<Object>(info[0]).ToLocalChecked();
109 const double motorPhase = Get(
"motorPhase");
110 const double supplyVoltage = Get(
"supplyVoltage");
111 const double avgCurrent = Get(
"avgCurrent");
112 const double powerFactor = Get(
"powerFactor");
113 const double operatingTime = Get(
"operatingTime");
115 auto const ap =
AuxiliaryPower(motorPhase, supplyVoltage, avgCurrent, powerFactor, operatingTime);
117 const double powerUsed = ap.getPowerUsed();
118 Local<Number> retval = Nan::New(powerUsed);
119 info.GetReturnValue().Set(retval);
122 NAN_METHOD(energyInputEAF)
140 inp = Nan::To<Object>(info[0]).ToLocalChecked();
141 r = Nan::New<Object>();
143 const double naturalGasHeatInput = Get(
"naturalGasHeatInput");
144 const double coalCarbonInjection = Get(
"coalCarbonInjection");
145 const double coalHeatingValue = Get(
"coalHeatingValue");
146 const double electrodeUse = Get(
"electrodeUse");
147 const double electrodeHeatingValue = Get(
"electrodeHeatingValue");
148 const double otherFuels = Get(
"otherFuels");
149 const double electricityInput = Get(
"electricityInput");
151 EnergyInputEAF eaf(naturalGasHeatInput, coalCarbonInjection, coalHeatingValue, electrodeUse,
152 electrodeHeatingValue, otherFuels, electricityInput);
153 const double heatDelivered = eaf.getHeatDelivered();
154 const double totalChemicalEnergyInput = eaf.getTotalChemicalEnergyInput();
156 SetR(
"heatDelivered", heatDelivered);
157 SetR(
"totalChemicalEnergyInput", totalChemicalEnergyInput);
158 info.GetReturnValue().Set(r);
161 NAN_METHOD(exhaustGasEAF)
163 inp = Nan::To<Object>(info[0]).ToLocalChecked();
165 const double offGasTemp = Get(
"offGasTemp");
166 const double CO = Get(
"CO");
167 const double H2 = Get(
"H2");
168 const double combustibleGases = Get(
"combustibleGases");
169 const double vfr = Get(
"vfr");
170 const double dustLoading = Get(
"dustLoading");
172 ExhaustGasEAF eg(offGasTemp, CO, H2, combustibleGases, vfr, dustLoading);
173 const double totalHeatExhaust = eg.getTotalHeatExhaust();
175 Local<Number> retval = Nan::New(totalHeatExhaust);
176 info.GetReturnValue().Set(retval);
179 NAN_METHOD(fixtureLosses)
192 inp = Nan::To<Object>(info[0]).ToLocalChecked();
194 const double specificHeat = Get(
"specificHeat");
195 const double feedRate = Get(
"feedRate");
196 const double initialTemperature = Get(
"initialTemperature");
197 const double finalTemperature = Get(
"finalTemperature");
198 const double correctionFactor = Get(
"correctionFactor");
200 FixtureLosses fl(specificHeat, feedRate, initialTemperature, finalTemperature, correctionFactor);
201 double heatLoss = fl.getHeatLoss();
203 Local<Number> retval = Nan::New(heatLoss);
204 info.GetReturnValue().Set(retval);
207 NAN_METHOD(gasCoolingLosses)
220 inp = Nan::To<Object>(info[0]).ToLocalChecked();
222 const double flowRate = Get(
"flowRate");
223 const double initialTemperature = Get(
"initialTemperature");
224 const double finalTemperature = Get(
"finalTemperature");
225 const double specificHeat = Get(
"specificHeat");
226 const double correctionFactor = Get(
"correctionFactor");
227 const double gasDensity = Get(
"gasDensity");
229 GasCoolingLosses gcl(flowRate, initialTemperature, finalTemperature, specificHeat, correctionFactor,
231 const double heatLoss = gcl.getHeatLoss();
233 Local<Number> retval = Nan::New(heatLoss);
234 info.GetReturnValue().Set(retval);
237 NAN_METHOD(gasLoadChargeMaterial)
256 inp = Nan::To<Object>(info[0]).ToLocalChecked();
258 const double specificHeatGas = Get(
"specificHeatGas");
259 const double feedRate = Get(
"feedRate");
260 const double percentVapor = Get(
"percentVapor");
261 const double initialTemperature = Get(
"initialTemperature");
262 const double dischargeTemperature = Get(
"dischargeTemperature");
263 const double specificHeatVapor = Get(
"specificHeatVapor");
264 const double percentReacted = Get(
"percentReacted");
265 const double reactionHeat = Get(
"reactionHeat");
266 const double additionalHeat = Get(
"additionalHeat");
267 const double thermicReactionTypeInput = Get(
"thermicReactionType");
270 if (thermicReactionTypeInput == 0)
272 thermicReactionType = LoadChargeMaterial::ThermicReactionType::ENDOTHERMIC;
276 thermicReactionType = LoadChargeMaterial::ThermicReactionType::EXOTHERMIC;
278 GasLoadChargeMaterial glcm(thermicReactionType, specificHeatGas, feedRate, percentVapor, initialTemperature,
279 dischargeTemperature, specificHeatVapor, percentReacted, reactionHeat, additionalHeat);
280 double heatLoss = glcm.getTotalHeat();
282 Local<Number> retval = Nan::New(heatLoss);
283 info.GetReturnValue().Set(retval);
286 NAN_METHOD(leakageLosses)
298 inp = Nan::To<Object>(info[0]).ToLocalChecked();
300 const double draftPressure = Get(
"draftPressure");
301 const double openingArea = Get(
"openingArea");
302 const double leakageGasTemperature = Get(
"leakageGasTemperature");
303 const double ambientTemperature = Get(
"ambientTemperature");
304 const double coefficient = Get(
"coefficient");
305 const double specificGravity = Get(
"specificGravity");
306 const double correctionFactor = Get(
"correctionFactor");
308 LeakageLosses ll(draftPressure, openingArea, leakageGasTemperature, ambientTemperature,
309 coefficient, specificGravity, correctionFactor);
310 double heatLoss = ll.getExfiltratedGasesHeatContent();
312 Local<Number> retval = Nan::New(heatLoss);
313 info.GetReturnValue().Set(retval);
316 NAN_METHOD(liquidCoolingLosses)
328 inp = Nan::To<Object>(info[0]).ToLocalChecked();
330 const double flowRate = Get(
"flowRate");
331 const double density = Get(
"density");
332 const double initialTemperature = Get(
"initialTemperature");
333 const double outletTemperature = Get(
"outletTemperature");
334 const double specificHeat = Get(
"specificHeat");
335 const double correctionFactor = Get(
"correctionFactor");
338 specificHeat, correctionFactor);
339 double heatLoss = lcl.getHeatLoss();
341 Local<Number> retval = Nan::New(heatLoss);
342 info.GetReturnValue().Set(retval);
345 NAN_METHOD(liquidLoadChargeMaterial)
365 inp = Nan::To<Object>(info[0]).ToLocalChecked();
367 const double specificHeatLiquid = Get(
"specificHeatLiquid");
368 const double vaporizingTemperature = Get(
"vaporizingTemperature");
369 const double latentHeat = Get(
"latentHeat");
370 const double specificHeatVapor = Get(
"specificHeatVapor");
371 const double chargeFeedRate = Get(
"chargeFeedRate");
372 const double initialTemperature = Get(
"initialTemperature");
373 const double dischargeTemperature = Get(
"dischargeTemperature");
374 const double percentVaporized = Get(
"percentVaporized");
375 const double percentReacted = Get(
"percentReacted");
376 const double reactionHeat = Get(
"reactionHeat");
377 const double additionalHeat = Get(
"additionalHeat");
378 const double thermicReactionTypeInput = Get(
"thermicReactionType");
381 if (thermicReactionTypeInput == 0)
383 thermicReactionType = LoadChargeMaterial::ThermicReactionType::ENDOTHERMIC;
387 thermicReactionType = LoadChargeMaterial::ThermicReactionType::EXOTHERMIC;
390 specificHeatVapor, chargeFeedRate, initialTemperature, dischargeTemperature,
391 percentVaporized, percentReacted, reactionHeat, additionalHeat);
392 double heatLoss = llcm.getTotalHeat();
394 Local<Number> retval = Nan::New(heatLoss);
395 info.GetReturnValue().Set(retval);
398 NAN_METHOD(openingLossesCircular)
412 inp = Nan::To<Object>(info[0]).ToLocalChecked();
414 const double emissivity = Get(
"emissivity");
415 const double diameter = Get(
"diameter");
416 const double thickness = Get(
"thickness");
417 const double ratio = Get(
"ratio");
418 const double ambientTemperature = Get(
"ambientTemperature");
419 const double insideTemperature = Get(
"insideTemperature");
420 const double percentTimeOpen = Get(
"percentTimeOpen");
421 const double viewFactor = Get(
"viewFactor");
423 OpeningLosses ol(emissivity, diameter, thickness, ratio, ambientTemperature,
424 insideTemperature, percentTimeOpen, viewFactor);
425 double heatLoss = ol.getHeatLoss();
427 Local<Number> retval = Nan::New(heatLoss);
428 info.GetReturnValue().Set(retval);
430 NAN_METHOD(openingLossesQuad)
446 inp = Nan::To<Object>(info[0]).ToLocalChecked();
448 const double emissivity = Get(
"emissivity");
449 const double length = Get(
"length");
450 const double width = Get(
"width");
451 const double thickness = Get(
"thickness");
452 const double ratio = Get(
"ratio");
453 const double ambientTemperature = Get(
"ambientTemperature");
454 const double insideTemperature = Get(
"insideTemperature");
455 const double percentTimeOpen = Get(
"percentTimeOpen");
456 const double viewFactor = Get(
"viewFactor");
458 OpeningLosses ol(emissivity, length, width, thickness, ratio,
459 ambientTemperature, insideTemperature, percentTimeOpen, viewFactor);
460 double heatLoss = ol.getHeatLoss();
462 Local<Number> retval = Nan::New(heatLoss);
463 info.GetReturnValue().Set(retval);
468 unsigned val =
static_cast<unsigned>(Get(
"openingShape"));
472 NAN_METHOD(viewFactorCalculation)
475 inp = Nan::To<Object>(info[0]).ToLocalChecked();
477 const double thickness = Get(
"thickness");
481 if (shape == OpeningLosses::OpeningShape::CIRCULAR)
483 const double diameter = Get(
"diameter");
485 info.GetReturnValue().Set(rv);
489 const double length = Get(
"length");
490 const double width = Get(
"width");
492 info.GetReturnValue().Set(rv);
496 NAN_METHOD(slagOtherMaterialLosses)
509 inp = Nan::To<Object>(info[0]).ToLocalChecked();
511 const double weight = Get(
"weight");
512 const double inletTemperature = Get(
"inletTemperature");
513 const double outletTemperature = Get(
"outletTemperature");
514 const double specificHeat = Get(
"specificHeat");
515 const double correctionFactor = Get(
"correctionFactor");
518 double heatLoss = sl.getHeatLoss();
520 Local<Number> retval = Nan::New(heatLoss);
521 info.GetReturnValue().Set(retval);
524 NAN_METHOD(solidLoadChargeMaterial)
546 inp = Nan::To<Object>(info[0]).ToLocalChecked();
548 const double specificHeatSolid = Get(
"specificHeatSolid");
549 const double latentHeat = Get(
"latentHeat");
550 const double specificHeatLiquid = Get(
"specificHeatLiquid");
551 const double meltingPoint = Get(
"meltingPoint");
552 const double chargeFeedRate = Get(
"chargeFeedRate");
553 const double waterContentCharged = Get(
"waterContentCharged");
554 const double waterContentDischarged = Get(
"waterContentDischarged");
555 const double initialTemperature = Get(
"initialTemperature");
556 const double dischargeTemperature = Get(
"dischargeTemperature");
557 const double waterVaporDischargeTemperature = Get(
"waterVaporDischargeTemperature");
558 const double chargeMelted = Get(
"chargeMelted");
559 const double chargeReacted = Get(
"chargeReacted");
560 const double reactionHeat = Get(
"reactionHeat");
561 const double additionalHeat = Get(
"additionalHeat");
562 const double thermicReactionTypeInput = Get(
"thermicReactionType");
565 if (thermicReactionTypeInput == 0)
567 thermicReactionType = LoadChargeMaterial::ThermicReactionType::ENDOTHERMIC;
571 thermicReactionType = LoadChargeMaterial::ThermicReactionType::EXOTHERMIC;
573 SolidLoadChargeMaterial slcm(thermicReactionType, specificHeatSolid, latentHeat, specificHeatLiquid, meltingPoint, chargeFeedRate, waterContentCharged, waterContentDischarged,
574 initialTemperature, dischargeTemperature, waterVaporDischargeTemperature, chargeMelted, chargeReacted, reactionHeat, additionalHeat);
575 double heatLoss = slcm.getTotalHeat();
577 Local<Number> retval = Nan::New(heatLoss);
578 info.GetReturnValue().Set(retval);
581 NAN_METHOD(wallLosses)
594 inp = Nan::To<Object>(info[0]).ToLocalChecked();
596 const double surfaceArea = Get(
"surfaceArea");
597 const double ambientTemperature = Get(
"ambientTemperature");
598 const double surfaceTemperature = Get(
"surfaceTemperature");
599 const double windVelocity = Get(
"windVelocity");
600 const double surfaceEmissivity = Get(
"surfaceEmissivity");
601 const double conditionFactor = Get(
"conditionFactor");
602 const double correctionFactor = Get(
"correctionFactor");
604 WallLosses wl(surfaceArea, ambientTemperature, surfaceTemperature, windVelocity,
605 surfaceEmissivity, conditionFactor, correctionFactor);
606 double heatLoss = wl.getHeatLoss();
608 Local<Number> retval = Nan::New(heatLoss);
609 info.GetReturnValue().Set(retval);
612 NAN_METHOD(waterCoolingLosses)
621 inp = Nan::To<Object>(info[0]).ToLocalChecked();
623 const double flowRate = Get(
"flowRate");
624 const double initialTemperature = Get(
"initialTemperature");
625 const double outletTemperature = Get(
"outletTemperature");
626 const double correctionFactor = Get(
"correctionFactor");
628 WaterCoolingLosses wcl(flowRate, initialTemperature, outletTemperature, correctionFactor);
629 double heatLoss = wcl.getHeatLoss();
631 Local<Number> retval = Nan::New(heatLoss);
632 info.GetReturnValue().Set(retval);
637 NAN_METHOD(efficiencyImprovement)
640 inp = Nan::To<Object>(info[0]).ToLocalChecked();
641 r = Nan::New<Object>();
643 const double currentFlueGasOxygen = Get(
"currentFlueGasOxygen");
644 const double newFlueGasOxygen = Get(
"newFlueGasOxygen");
645 const double currentFlueGasTemp = Get(
"currentFlueGasTemp");
646 const double newFlueGasTemp = Get(
"newFlueGasTemp");
647 const double currentCombustionAirTemp = Get(
"currentCombustionAirTemp");
648 const double newCombustionAirTemp = Get(
"newCombustionAirTemp");
649 const double currentEnergyInput = Get(
"currentEnergyInput");
652 currentCombustionAirTemp, newCombustionAirTemp, currentEnergyInput);
653 double currentExcessAir = ei.getCurrentExcessAir();
654 double newExcessAir = ei.getNewExcessAir();
655 double currentAvailableHeat = ei.getCurrentAvailableHeat();
656 double newAvailableHeat = ei.getNewAvailableHeat();
657 double newFuelSavings = ei.getNewFuelSavings();
658 double newEnergyInput = ei.getNewEnergyInput();
660 SetR(
"currentExcessAir", currentExcessAir);
661 SetR(
"newExcessAir", newExcessAir);
662 SetR(
"currentAvailableHeat", currentAvailableHeat);
663 SetR(
"newAvailableHeat", newAvailableHeat);
664 SetR(
"newFuelSavings", newFuelSavings);
665 SetR(
"newEnergyInput", newEnergyInput);
666 info.GetReturnValue().Set(r);
669 NAN_METHOD(energyEquivalencyElectric)
672 inp = Nan::To<Object>(info[0]).ToLocalChecked();
673 r = Nan::New<Object>();
675 const double fuelFiredEfficiency = Get(
"fuelFiredEfficiency");
676 const double electricallyHeatedEfficiency = Get(
"electricallyHeatedEfficiency");
677 const double fuelFiredHeatInput = Get(
"fuelFiredHeatInput");
680 double electricalHeatInput = eee.getElectricalHeatInput();
682 SetR(
"electricalHeatInput", electricalHeatInput);
683 info.GetReturnValue().Set(r);
686 NAN_METHOD(energyEquivalencyFuel)
689 inp = Nan::To<Object>(info[0]).ToLocalChecked();
690 r = Nan::New<Object>();
692 const double electricallyHeatedEfficiency = Get(
"electricallyHeatedEfficiency");
693 const double fuelFiredEfficiency = Get(
"fuelFiredEfficiency");
694 const double electricalHeatInput = Get(
"electricalHeatInput");
697 double fuelFiredHeatInput = ffee.getFuelFiredHeatInput();
699 SetR(
"fuelFiredHeatInput", fuelFiredHeatInput);
700 info.GetReturnValue().Set(r);
703 NAN_METHOD(flowCalculations)
706 inp = Nan::To<Object>(info[0]).ToLocalChecked();
707 r = Nan::New<Object>();
709 const double specificGravity = Get(
"specificGravity");
710 const double orificeDiameter = Get(
"orificeDiameter");
711 const double insidePipeDiameter = Get(
"insidePipeDiameter");
712 const double dischargeCoefficient = Get(
"dischargeCoefficient");
713 const double gasHeatingValue = Get(
"gasHeatingValue");
714 const double gasTemperature = Get(
"gasTemperature");
715 const double gasPressure = Get(
"gasPressure");
716 const double orificePressureDrop = Get(
"orificePressureDrop");
717 const double operatingTime = Get(
"operatingTime");
721 FlowCalculationsEnergyUse fceu(gas1, specificGravity, orificeDiameter, insidePipeDiameter, section1, dischargeCoefficient,
722 gasHeatingValue, gasTemperature, gasPressure, orificePressureDrop, operatingTime);
723 double flow = fceu.getFlow();
724 double heatInput = fceu.getHeatInput();
725 double totalFlow = fceu.getTotalFlow();
728 SetR(
"heatInput", heatInput);
729 SetR(
"totalFlow", totalFlow);
730 info.GetReturnValue().Set(r);
733 NAN_METHOD(flueGasLossesByVolume)
746 inp = Nan::To<Object>(info[0]).ToLocalChecked();
748 const double CH4 = Get(
"CH4");
749 const double C2H6 = Get(
"C2H6");
750 const double N2 = Get(
"N2");
751 const double H2 = Get(
"H2");
752 const double C3H8 = Get(
"C3H8");
753 const double C4H10_CnH2n = Get(
"C4H10_CnH2n");
754 const double H2O = Get(
"H2O");
755 const double CO = Get(
"CO");
756 const double CO2 = Get(
"CO2");
757 const double SO2 = Get(
"SO2");
758 const double O2 = Get(
"O2");
760 const double flueGasTemperature = Get(
"flueGasTemperature");
761 const double excessAirPercentage = Get(
"excessAirPercentage");
762 const double combustionAirTemperature = Get(
"combustionAirTemperature");
763 const double fuelTemperature = Get(
"fuelTemperature");
766 C4H10_CnH2n, H2O, CO, CO2, SO2, O2);
767 GasFlueGasMaterial fg(flueGasTemperature, excessAirPercentage, combustionAirTemperature,
768 comps, fuelTemperature);
769 double heatLoss = fg.getHeatLoss();
771 Local<Number> retval = Nan::New(heatLoss);
772 info.GetReturnValue().Set(retval);
775 NAN_METHOD(flueGasByVolumeCalculateHeatingValue)
777 inp = Nan::To<Object>(info[0]).ToLocalChecked();
778 r = Nan::New<Object>();
780 const double CH4 = Get(
"CH4");
781 const double C2H6 = Get(
"C2H6");
782 const double N2 = Get(
"N2");
783 const double H2 = Get(
"H2");
784 const double C3H8 = Get(
"C3H8");
785 const double C4H10_CnH2n = Get(
"C4H10_CnH2n");
786 const double H2O = Get(
"H2O");
787 const double CO = Get(
"CO");
788 const double CO2 = Get(
"CO2");
789 const double SO2 = Get(
"SO2");
790 const double O2 = Get(
"O2");
793 C4H10_CnH2n, H2O, CO, CO2, SO2, O2);
794 double heatingValue = comps.getHeatingValue();
795 double heatingValueVolume = comps.getHeatingValueVolume();
796 double specificGravity = comps.getSpecificGravity();
798 SetR(
"heatingValue", heatingValue);
799 SetR(
"heatingValueVolume", heatingValueVolume);
800 SetR(
"specificGravity", specificGravity);
801 info.GetReturnValue().Set(r);
804 NAN_METHOD(flueGasLossesByMass)
821 inp = Nan::To<Object>(info[0]).ToLocalChecked();
823 const double flueGasTemperature = Get(
"flueGasTemperature");
824 const double excessAirPercentage = Get(
"excessAirPercentage");
825 const double combustionAirTemperature = Get(
"combustionAirTemperature");
826 const double fuelTemperature = Get(
"fuelTemperature");
827 const double moistureInAirComposition = Get(
"moistureInAirComposition");
828 const double ashDischargeTemperature = Get(
"ashDischargeTemperature");
829 const double unburnedCarbonInAsh = Get(
"unburnedCarbonInAsh");
830 const double carbon = Get(
"carbon");
831 const double hydrogen = Get(
"hydrogen");
832 const double sulphur = Get(
"sulphur");
833 const double inertAsh = Get(
"inertAsh");
834 const double o2 = Get(
"o2");
835 const double moisture = Get(
"moisture");
836 const double nitrogen = Get(
"nitrogen");
839 fuelTemperature, moistureInAirComposition, ashDischargeTemperature,
840 unburnedCarbonInAsh, carbon, hydrogen, sulphur, inertAsh, o2, moisture,
842 double heatLoss = slfgm.getHeatLoss();
844 Local<Number> retval = Nan::New(heatLoss);
845 info.GetReturnValue().Set(retval);
848 NAN_METHOD(flueGasByMassCalculateHeatingValue)
850 inp = Nan::To<Object>(info[0]).ToLocalChecked();
852 const double carbon = Get(
"carbon");
853 const double hydrogen = Get(
"hydrogen");
854 const double sulphur = Get(
"sulphur");
855 const double inertAsh = Get(
"inertAsh");
856 const double o2 = Get(
"o2");
857 const double moisture = Get(
"moisture");
858 const double nitrogen = Get(
"nitrogen");
860 auto const hv = SolidLiquidFlueGasMaterial::calculateHeatingValueFuel(carbon, hydrogen,
861 sulphur, inertAsh, o2,
864 Local<Number> retval = Nan::New(hv);
865 info.GetReturnValue().Set(retval);
868 NAN_METHOD(flueGasCalculateO2)
870 inp = Nan::To<Object>(info[0]).ToLocalChecked();
872 const double CH4 = Get(
"CH4");
873 const double C2H6 = Get(
"C2H6");
874 const double N2 = Get(
"N2");
875 const double H2 = Get(
"H2");
876 const double C3H8 = Get(
"C3H8");
877 const double C4H10_CnH2n = Get(
"C4H10_CnH2n");
878 const double H2O = Get(
"H2O");
879 const double CO = Get(
"CO");
880 const double CO2 = Get(
"CO2");
881 const double SO2 = Get(
"SO2");
882 const double O2 = Get(
"O2");
883 double excessAir = Get(
"excessAir");
886 C4H10_CnH2n, H2O, CO, CO2, SO2, O2);
887 excessAir =
Conversion(excessAir).percentToFraction();
888 double result = comp.calculateO2(excessAir);
889 result =
Conversion(result).fractionToPercent();
891 Local<Number> rv = Nan::New(result);
892 info.GetReturnValue().Set(rv);
895 NAN_METHOD(flueGasCalculateExcessAir)
897 inp = Nan::To<Object>(info[0]).ToLocalChecked();
899 const double CH4 = Get(
"CH4");
900 const double C2H6 = Get(
"C2H6");
901 const double N2 = Get(
"N2");
902 const double H2 = Get(
"H2");
903 const double C3H8 = Get(
"C3H8");
904 const double C4H10_CnH2n = Get(
"C4H10_CnH2n");
905 const double H2O = Get(
"H2O");
906 const double CO = Get(
"CO");
907 const double CO2 = Get(
"CO2");
908 const double SO2 = Get(
"SO2");
909 const double O2 = Get(
"O2");
910 double o2InFlueGas = Get(
"o2InFlueGas");
913 C4H10_CnH2n, H2O, CO, CO2, SO2, O2);
914 o2InFlueGas =
Conversion(o2InFlueGas).percentToFraction();
915 double result = comp.calculateExcessAir(o2InFlueGas);
916 result =
Conversion(result).fractionToPercent();
918 Local<Number> rv = Nan::New(result);
919 info.GetReturnValue().Set(rv);
922 NAN_METHOD(flueGasByMassCalculateO2)
924 inp = Nan::To<Object>(info[0]).ToLocalChecked();
926 double excessAir = Get(
"excessAir");
927 double carbon = Get(
"carbon");
928 double hydrogen = Get(
"hydrogen");
929 double sulphur = Get(
"sulphur");
930 double inertAsh = Get(
"inertAsh");
931 double o2 = Get(
"o2");
932 double moisture = Get(
"moisture");
933 double nitrogen = Get(
"nitrogen");
934 const double moistureInAirCombustion = Get(
"moistureInAirCombustion");
936 excessAir =
Conversion(excessAir).percentToFraction();
937 carbon =
Conversion(carbon).percentToFraction();
938 hydrogen =
Conversion(hydrogen).percentToFraction();
939 sulphur =
Conversion(sulphur).percentToFraction();
940 inertAsh =
Conversion(inertAsh).percentToFraction();
942 moisture =
Conversion(moisture).percentToFraction();
943 nitrogen =
Conversion(nitrogen).percentToFraction();
947 inertAsh, o2, moisture,
948 nitrogen, moistureInAirCombustion);
951 Local<Number> rv = Nan::New(v);
952 info.GetReturnValue().Set(rv);
955 NAN_METHOD(flueGasByMassCalculateExcessAir)
957 inp = Nan::To<Object>(info[0]).ToLocalChecked();
959 double o2InFlueGas = Get(
"o2InFlueGas");
960 double carbon = Get(
"carbon");
961 double hydrogen = Get(
"hydrogen");
962 double sulphur = Get(
"sulphur");
963 double inertAsh = Get(
"inertAsh");
964 double o2 = Get(
"o2");
965 double moisture = Get(
"moisture");
966 double nitrogen = Get(
"nitrogen");
967 const double moistureInAirCombustion = Get(
"moistureInAirCombustion");
969 o2InFlueGas =
Conversion(o2InFlueGas).percentToFraction();
970 carbon =
Conversion(carbon).percentToFraction();
971 hydrogen =
Conversion(hydrogen).percentToFraction();
972 sulphur =
Conversion(sulphur).percentToFraction();
973 inertAsh =
Conversion(inertAsh).percentToFraction();
975 moisture =
Conversion(moisture).percentToFraction();
976 nitrogen =
Conversion(nitrogen).percentToFraction();
979 hydrogen, sulphur, inertAsh,
980 o2, moisture, nitrogen,
981 moistureInAirCombustion);
984 Local<Number> rv = Nan::New(v);
985 info.GetReturnValue().Set(rv);
988 NAN_METHOD(o2Enrichment)
991 inp = Nan::To<Object>(info[0]).ToLocalChecked();
992 r = Nan::New<Object>();
994 const double o2CombAir = Get(
"o2CombAir");
995 const double o2CombAirEnriched = Get(
"o2CombAirEnriched");
996 const double flueGasTemp = Get(
"flueGasTemp");
997 const double flueGasTempEnriched = Get(
"flueGasTempEnriched");
998 const double o2FlueGas = Get(
"o2FlueGas");
999 const double o2FlueGasEnriched = Get(
"o2FlueGasEnriched");
1000 const double combAirTemp = Get(
"combAirTemp");
1001 const double combAirTempEnriched = Get(
"combAirTempEnriched");
1002 const double fuelConsumption = Get(
"fuelConsumption");
1004 O2Enrichment oe(o2CombAir, o2CombAirEnriched, flueGasTemp, flueGasTempEnriched, o2FlueGas,
1005 o2FlueGasEnriched, combAirTemp, combAirTempEnriched, fuelConsumption);
1006 double availableHeatInput = oe.getAvailableHeat();
1007 double availableHeatEnriched = oe.getAvailableHeatEnriched();
1008 double fuelSavingsEnriched = oe.getFuelSavingsEnriched();
1009 double fuelConsumptionEnriched = oe.getFuelConsumptionEnriched();
1011 SetR(
"availableHeatInput", availableHeatInput);
1012 SetR(
"availableHeatEnriched", availableHeatEnriched);
1013 SetR(
"fuelSavingsEnriched", fuelSavingsEnriched);
1014 SetR(
"fuelConsumptionEnriched", fuelConsumptionEnriched);
1015 info.GetReturnValue().Set(r);
1018 NAN_METHOD(energyInputExhaustGasLosses)
1020 inp = Nan::To<Object>(info[0]).ToLocalChecked();
1021 r = Nan::New<Object>();
1023 const double excessAir = Get(
"excessAir");
1024 const double combustionAirTemp = Get(
"combustionAirTemp");
1025 const double exhaustGasTemp = Get(
"exhaustGasTemp");
1026 const double totalHeatInput = Get(
"totalHeatInput");
1030 SetR(
"heatDelivered", e.getHeatDelivered());
1031 SetR(
"exhaustGasLosses", e.getExhaustGasLosses());
1032 SetR(
"availableHeat", e.getAvailableHeat());
1033 info.GetReturnValue().Set(r);
1036 NAN_METHOD(humidityRatio)
1038 inp = Nan::To<Object>(info[0]).ToLocalChecked();
1039 r = Nan::New<Object>();
1041 const double atmosphericPressure = Get(
"atmosphericPressure");
1042 const double dryBulbTemp = Get(
"dryBulbTemp");
1043 const double relativeHumidity = Get(
"relativeHumidity");
1044 const double wetBulbTemp = Get(
"wetBulbTemp");
1046 HumidityRatio hr(atmosphericPressure, dryBulbTemp, relativeHumidity, wetBulbTemp);
1047 double humidityRatioUsingRH = hr.getHumidityRatioUsingRH();
1048 double humidityRatioUsingWBT = hr.getHumidityRatioUsingWBT();
1050 SetR(
"humidityRatioUsingRH", humidityRatioUsingRH);
1051 SetR(
"humidityRatioUsingWBT", humidityRatioUsingWBT);
1052 info.GetReturnValue().Set(r);
1055 #endif //AMO_TOOLS_SUITE_LOSSES_H
static double calculateFlueGasO2(double excessAir, double carbon, double hydrogen, double sulphur, double inertAsh, double o2, double moisture, double nitrogen, double moistureInAirCombustion)
static double calculateExcessAirFromFlueGasO2(double flueGasO2, double carbon, double hydrogen, double sulphur, double inertAsh, double o2, double moisture, double nitrogen, double moistureInAirCombustion)
ThermicReactionType
Classifications of thermic reaction type.
Section
enum class for section type
Gas
enum class for gas types
double calculateViewFactor(double thickness, double diameter)