1 #ifndef AMO_TOOLS_SUITE_SSMT_H 2 #define AMO_TOOLS_SUITE_SSMT_H 4 #include "NanDataConverters.h" 6 #include "ssmt/SaturatedProperties.h" 7 #include "ssmt/SteamSystemModelerTool.h" 8 #include "ssmt/SteamProperties.h" 9 #include "ssmt/HeatLoss.h" 10 #include "ssmt/Boiler.h" 11 #include "ssmt/HeatLoss.h" 12 #include "ssmt/FlashTank.h" 14 #include "ssmt/Deaerator.h" 15 #include "ssmt/Header.h" 16 #include "ssmt/Turbine.h" 17 #include "ssmt/HeatExchanger.h" 18 #include "ssmt/api/SteamModeler.h" 19 #include "steam/SteamModelerInputDataMapper.h" 20 #include "steam/SteamModelerOutputDataMapper.h" 27 unsigned val =
static_cast<unsigned>(getDouble(
"thermodynamicQuantity"));
32 unsigned val =
static_cast<unsigned>(getDouble(
"feedwaterThermodynamicQuantity"));
37 unsigned val =
static_cast<unsigned>(getDouble(
"waterThermodynamicQuantity"));
42 unsigned val =
static_cast<unsigned>(getDouble(
"steamThermodynamicQuantity"));
46 NAN_METHOD(saturatedPressure) {
47 inp = Nan::To<Object>(info[0]).ToLocalChecked();
48 r = Nan::New<Object>();
50 const double saturatedTemperature = getDouble(
"saturatedTemperature");
53 setR(
"saturatedPressure", sp.calculate());
54 info.GetReturnValue().Set(r);
57 NAN_METHOD(saturatedTemperature) {
58 inp = Nan::To<Object>(info[0]).ToLocalChecked();
59 r = Nan::New<Object>();
61 const double saturatedPressure = getDouble(
"saturatedPressure");
64 setR(
"saturatedTemperature", st.calculate());
65 info.GetReturnValue().Set(r);
68 NAN_METHOD(saturatedPropertiesGivenTemperature) {
69 inp = Nan::To<Object>(info[0]).ToLocalChecked();
70 r = Nan::New<Object>();
72 const double saturatedTemperature = getDouble(
"saturatedTemperature");
76 setR(
"saturatedPressure", results.pressure);
77 setR(
"saturatedTemperature", results.temperature);
78 setR(
"liquidEnthalpy", results.liquidSpecificEnthalpy);
79 setR(
"gasEnthalpy", results.gasSpecificEnthalpy);
80 setR(
"evaporationEnthalpy", results.evaporationSpecificEnthalpy);
81 setR(
"liquidEntropy", results.liquidSpecificEntropy);
82 setR(
"gasEntropy", results.gasSpecificEntropy);
83 setR(
"evaporationEntropy", results.evaporationSpecificEntropy);
84 setR(
"liquidVolume", results.liquidSpecificVolume);
85 setR(
"gasVolume", results.gasSpecificVolume);
86 setR(
"evaporationVolume", results.evaporationSpecificVolume);
87 info.GetReturnValue().Set(r);
90 NAN_METHOD(saturatedPropertiesGivenPressure) {
92 inp = Nan::To<Object>(info[0]).ToLocalChecked();
93 r = Nan::New<Object>();
95 const double saturatedPressure = getDouble(
"saturatedPressure");
99 setR(
"saturatedPressure", results.pressure);
100 setR(
"saturatedTemperature", results.temperature);
101 setR(
"liquidEnthalpy", results.liquidSpecificEnthalpy);
102 setR(
"gasEnthalpy", results.gasSpecificEnthalpy);
103 setR(
"evaporationEnthalpy", results.evaporationSpecificEnthalpy);
104 setR(
"liquidEntropy", results.liquidSpecificEntropy);
105 setR(
"gasEntropy", results.gasSpecificEntropy);
106 setR(
"evaporationEntropy", results.evaporationSpecificEntropy);
107 setR(
"liquidVolume", results.liquidSpecificVolume);
108 setR(
"gasVolume", results.gasSpecificVolume);
109 setR(
"evaporationVolume", results.evaporationSpecificVolume);
110 info.GetReturnValue().Set(r);
113 NAN_METHOD(steamProperties) {
114 inp = Nan::To<Object>(info[0]).ToLocalChecked();
115 r = Nan::New<Object>();
117 const double pressure = getDouble(
"pressure");
118 const double quantityValue = getDouble(
"quantityValue");
124 setR(
"pressure", results.pressure);
125 setR(
"temperature", results.temperature);
126 setR(
"specificEnthalpy", results.specificEnthalpy);
127 setR(
"specificEntropy", results.specificEntropy);
128 setR(
"quality", results.quality);
129 setR(
"specificVolume", results.specificVolume);
130 }
catch (std::runtime_error
const &e) {
131 std::string
const what = e.what();
132 ThrowError(std::string(
"std::runtime_error thrown in steamProperties - ssmt.h: " + what).c_str());
134 info.GetReturnValue().Set(r);
138 inp = Nan::To<Object>(info[0]).ToLocalChecked();
139 r = Nan::New<Object>();
141 const double deaeratorPressure = getDouble(
"deaeratorPressure");
142 const double combustionEfficiency = getDouble(
"combustionEfficiency");
143 const double blowdownRate = getDouble(
"blowdownRate");
144 const double steamPressure = getDouble(
"steamPressure");
145 const double quantityValue = getDouble(
"quantityValue");
146 const double steamMassFlow = getDouble(
"steamMassFlow");
150 Boiler const b =
Boiler(deaeratorPressure, combustionEfficiency,
151 blowdownRate, steamPressure, quantityType, quantityValue,
155 setR(
"steamPressure", results.pressure);
156 setR(
"steamTemperature", results.temperature);
157 setR(
"steamSpecificEnthalpy", results.specificEnthalpy);
158 setR(
"steamSpecificEntropy", results.specificEntropy);
159 setR(
"steamQuality", results.quality);
160 setR(
"steamMassFlow", results.massFlow);
161 setR(
"steamEnergyFlow", results.energyFlow);
164 setR(
"blowdownPressure", results2.pressure);
165 setR(
"blowdownTemperature", results2.temperature);
166 setR(
"blowdownSpecificEnthalpy", results2.specificEnthalpy);
167 setR(
"blowdownSpecificEntropy", results2.specificEntropy);
168 setR(
"blowdownQuality", results2.quality);
169 setR(
"blowdownMassFlow", results2.massFlow);
170 setR(
"blowdownEnergyFlow", results2.energyFlow);
173 setR(
"feedwaterPressure", results3.pressure);
174 setR(
"feedwaterTemperature", results3.temperature);
175 setR(
"feedwaterSpecificEnthalpy", results3.specificEnthalpy);
176 setR(
"feedwaterSpecificEntropy", results3.specificEntropy);
177 setR(
"feedwaterQuality", results3.quality);
178 setR(
"feedwaterMassFlow", results3.massFlow);
179 setR(
"feedwaterEnergyFlow", results3.energyFlow);
182 }
catch (std::runtime_error
const &e) {
183 std::string
const what = e.what();
184 ThrowError(std::string(
"std::runtime_error thrown in boiler - ssmt.h: " + what).c_str());
187 info.GetReturnValue().Set(r);
190 NAN_METHOD(heatLoss) {
191 inp = Nan::To<Object>(info[0]).ToLocalChecked();
192 r = Nan::New<Object>();
194 const double inletPressure = getDouble(
"inletPressure");
195 const double quantityValue = getDouble(
"quantityValue");
196 const double inletMassFlow = getDouble(
"inletMassFlow");
197 const double percentHeatLoss = getDouble(
"percentHeatLoss");
201 inletMassFlow, percentHeatLoss);
205 setR(
"inletPressure", results.pressure);
206 setR(
"inletTemperature", results.temperature);
207 setR(
"inletSpecificEnthalpy", results.specificEnthalpy);
208 setR(
"inletSpecificEntropy", results.specificEntropy);
209 setR(
"inletQuality", results.quality);
210 setR(
"inletMassFlow", results.massFlow);
211 setR(
"inletEnergyFlow", results.energyFlow);
214 setR(
"outletPressure", results2.pressure);
215 setR(
"outletTemperature", results2.temperature);
216 setR(
"outletSpecificEnthalpy", results2.specificEnthalpy);
217 setR(
"outletSpecificEntropy", results2.specificEntropy);
218 setR(
"outletQuality", results2.quality);
219 setR(
"outletMassFlow", results2.massFlow);
220 setR(
"outletEnergyFlow", results2.energyFlow);
222 }
catch (std::runtime_error
const &e) {
223 std::string
const what = e.what();
224 ThrowError(std::string(
"std::runtime_error thrown in heatLoss - ssmt.h: " + what).c_str());
227 info.GetReturnValue().Set(r);
230 NAN_METHOD(flashTank) {
231 inp = Nan::To<Object>(info[0]).ToLocalChecked();
232 r = Nan::New<Object>();
234 const double inletWaterPressure = getDouble(
"inletWaterPressure");
235 const double quantityValue = getDouble(
"quantityValue");
236 const double inletWaterMassFlow = getDouble(
"inletWaterMassFlow");
237 const double tankPressure = getDouble(
"tankPressure");
243 inletWaterMassFlow, tankPressure);
246 setR(
"inletWaterPressure", results.pressure);
247 setR(
"inletWaterTemperature", results.temperature);
248 setR(
"inletWaterSpecificEnthalpy", results.specificEnthalpy);
249 setR(
"inletWaterSpecificEntropy", results.specificEntropy);
250 setR(
"inletWaterQuality", results.quality);
251 setR(
"inletWaterMassFlow", results.massFlow);
252 setR(
"inletWaterEnergyFlow", results.energyFlow);
255 setR(
"outletGasPressure", results2.pressure);
256 setR(
"outletGasTemperature", results2.temperature);
257 setR(
"outletGasSpecificEnthalpy", results2.specificEnthalpy);
258 setR(
"outletGasSpecificEntropy", results2.specificEntropy);
259 setR(
"outletGasQuality", 1);
260 setR(
"outletGasMassFlow", results2.massFlow);
261 setR(
"outletGasEnergyFlow", results2.energyFlow);
264 setR(
"outletLiquidPressure", results3.pressure);
265 setR(
"outletLiquidTemperature", results3.temperature);
266 setR(
"outletLiquidSpecificEnthalpy", results3.specificEnthalpy);
267 setR(
"outletLiquidSpecificEntropy", results3.specificEntropy);
268 setR(
"outletLiquidQuality", 0);
269 setR(
"outletLiquidMassFlow", results3.massFlow);
270 setR(
"outletLiquidEnergyFlow", results3.energyFlow);
271 }
catch (std::runtime_error
const &e) {
272 std::string
const what = e.what();
273 ThrowError(std::string(
"std::runtime_error thrown in flashTank - ssmt.h: " + what).c_str());
276 info.GetReturnValue().Set(r);
279 NAN_METHOD(prvWithoutDesuperheating) {
280 inp = Nan::To<Object>(info[0]).ToLocalChecked();
281 r = Nan::New<Object>();
283 const double inletPressure = getDouble(
"inletPressure");
284 const double quantityValue = getDouble(
"quantityValue");
285 const double inletMassFlow = getDouble(
"inletMassFlow");
286 const double outletPressure = getDouble(
"outletPressure");
291 inletMassFlow, outletPressure);
294 setR(
"inletPressure", results.pressure);
295 setR(
"inletTemperature", results.temperature);
296 setR(
"inletSpecificEnthalpy", results.specificEnthalpy);
297 setR(
"inletSpecificEntropy", results.specificEntropy);
298 setR(
"inletQuality", results.quality);
303 setR(
"outletPressure", results2.pressure);
304 setR(
"outletTemperature", results2.temperature);
305 setR(
"outletSpecificEnthalpy", results2.specificEnthalpy);
306 setR(
"outletSpecificEntropy", results2.specificEntropy);
307 setR(
"outletQuality", results2.quality);
310 }
catch (std::runtime_error
const &e) {
311 std::string
const what = e.what();
312 ThrowError(std::string(
"std::runtime_error thrown in prvWithoutDesuperheating - ssmt.h: " + what).c_str());
315 info.GetReturnValue().Set(r);
318 NAN_METHOD(prvWithDesuperheating) {
319 inp = Nan::To<Object>(info[0]).ToLocalChecked();
320 r = Nan::New<Object>();
322 const double inletPressure = getDouble(
"inletPressure");
323 const double quantityValue = getDouble(
"quantityValue");
324 const double inletMassFlow = getDouble(
"inletMassFlow");
325 const double outletPressure = getDouble(
"outletPressure");
326 const double feedwaterPressure = getDouble(
"feedwaterPressure");
327 const double feedwaterQuantityValue = getDouble(
"feedwaterQuantityValue");
328 const double desuperheatingTemp = getDouble(
"desuperheatingTemp");
335 inletMassFlow, outletPressure, feedwaterPressure,
336 feedwaterQuantityType, feedwaterQuantityValue, desuperheatingTemp);
339 setR(
"inletPressure", results.pressure);
340 setR(
"inletTemperature", results.temperature);
341 setR(
"inletSpecificEnthalpy", results.specificEnthalpy);
342 setR(
"inletSpecificEntropy", results.specificEntropy);
343 setR(
"inletQuality", results.quality);
348 setR(
"outletPressure", results2.pressure);
349 setR(
"outletTemperature", results2.temperature);
350 setR(
"outletSpecificEnthalpy", results2.specificEnthalpy);
351 setR(
"outletSpecificEntropy", results2.specificEntropy);
352 setR(
"outletQuality", results2.quality);
357 setR(
"feedwaterPressure", results3.pressure);
358 setR(
"feedwaterTemperature", results3.temperature);
359 setR(
"feedwaterSpecificEnthalpy", results3.specificEnthalpy);
360 setR(
"feedwaterSpecificEntropy", results3.specificEntropy);
361 setR(
"feedwaterQuality", results3.quality);
364 }
catch (std::runtime_error
const &e) {
365 std::string
const what = e.what();
366 ThrowError(std::string(
"std::runtime_error thrown in prvWithDesuperheating - ssmt.h: " + what).c_str());
369 info.GetReturnValue().Set(r);
372 NAN_METHOD(deaerator) {
373 inp = Nan::To<Object>(info[0]).ToLocalChecked();
374 r = Nan::New<Object>();
376 const double deaeratorPressure = getDouble(
"deaeratorPressure");
377 const double ventRate = getDouble(
"ventRate");
378 const double feedwaterMassFlow = getDouble(
"feedwaterMassFlow");
379 const double waterPressure = getDouble(
"waterPressure");
380 const double waterQuantityValue = getDouble(
"waterQuantityValue");
381 const double steamPressure = getDouble(
"steamPressure");
382 const double steamQuantityValue = getDouble(
"steamQuantityValue");
387 Deaerator d(deaeratorPressure, ventRate, feedwaterMassFlow,
388 waterPressure, waterQuantityType, waterQuantityValue,
389 steamPressure, steamQuantityType,
393 setR(
"feedwaterPressure", results.pressure);
394 setR(
"feedwaterTemperature", results.temperature);
395 setR(
"feedwaterSpecificEnthalpy", results.specificEnthalpy);
396 setR(
"feedwaterSpecificEntropy", results.specificEntropy);
397 setR(
"feedwaterQuality", results.quality);
398 setR(
"feedwaterMassFlow", results.massFlow);
399 setR(
"feedwaterEnergyFlow", results.energyFlow);
402 setR(
"ventedSteamPressure", results2.pressure);
403 setR(
"ventedSteamTemperature", results2.temperature);
404 setR(
"ventedSteamSpecificEnthalpy", results2.specificEnthalpy);
405 setR(
"ventedSteamSpecificEntropy", results2.specificEntropy);
406 setR(
"ventedSteamQuality", results2.quality);
407 setR(
"ventedSteamMassFlow", results2.massFlow);
408 setR(
"ventedSteamEnergyFlow", results2.energyFlow);
411 setR(
"inletWaterPressure", results3.pressure);
412 setR(
"inletWaterTemperature", results3.temperature);
413 setR(
"inletWaterSpecificEnthalpy", results3.specificEnthalpy);
414 setR(
"inletWaterSpecificEntropy", results3.specificEntropy);
415 setR(
"inletWaterQuality", results3.quality);
416 setR(
"inletWaterMassFlow", results3.massFlow);
417 setR(
"inletWaterEnergyFlow", results3.energyFlow);
420 setR(
"inletSteamPressure", results4.pressure);
421 setR(
"inletSteamTemperature", results4.temperature);
422 setR(
"inletSteamSpecificEnthalpy", results4.specificEnthalpy);
423 setR(
"inletSteamSpecificEntropy", results4.specificEntropy);
424 setR(
"inletSteamQuality", results4.quality);
425 setR(
"inletSteamMassFlow", results4.massFlow);
426 setR(
"inletSteamEnergyFlow", results4.energyFlow);
427 }
catch (std::runtime_error
const &e) {
428 std::string
const what = e.what();
429 ThrowError(std::string(
"std::runtime_error thrown in deaerator - ssmt.h: " + what).c_str());
432 info.GetReturnValue().Set(r);
436 inp = Nan::To<Object>(info[0]).ToLocalChecked();
437 r = Nan::New<Object>();
439 double const headerPressure = getDouble(
"headerPressure");
441 Local<String> arrayStr = Nan::New<String>(
"inlets").ToLocalChecked();
442 v8::Local<v8::Value> arrayTmp = Nan::Get(Nan::To<v8::Object>(inp).ToLocalChecked(), arrayStr).ToLocalChecked();
443 v8::Local<v8::Array> arr = v8::Local<v8::Array>::Cast(arrayTmp);
445 Local<String> pressureStr = Nan::New<String>(
"pressure").ToLocalChecked();
446 Local<String> temperatureStr = Nan::New<String>(
"temperature").ToLocalChecked();
447 Local<String> qualityStr = Nan::New<String>(
"quality").ToLocalChecked();
448 Local<String> massFlowStr = Nan::New<String>(
"massFlow").ToLocalChecked();
449 Local<String> specificEnthalpyStr = Nan::New<String>(
"specificEnthalpy").ToLocalChecked();
450 Local<String> specificEntropyStr = Nan::New<String>(
"specificEntropy").ToLocalChecked();
451 Local<String> energyFlowStr = Nan::New<String>(
"energyFlow").ToLocalChecked();
453 std::vector<Inlet> inlets;
455 v8::Isolate *isolate = v8::Isolate::GetCurrent();
456 v8::Local<v8::Context> context = isolate->GetCurrentContext();
458 for (std::size_t i = 0; i < arr->Length(); i++) {
459 double const pressure = Nan::To<double>(Nan::Get(Nan::To<v8::Object>(arr->Get(context, i).ToLocalChecked()).ToLocalChecked(), pressureStr).ToLocalChecked()).FromJust();
460 unsigned val =
static_cast<unsigned>(Nan::To<double>(Nan::Get(Nan::To<v8::Object>(arr->Get(context, i).ToLocalChecked()).ToLocalChecked(), Nan::New<String>(
"thermodynamicQuantity").ToLocalChecked()).ToLocalChecked()).FromJust());
462 double const quantityValue = Nan::To<double>(Nan::Get(Nan::To<v8::Object>(arr->Get(context, i).ToLocalChecked()).ToLocalChecked(), Nan::New<String>(
"quantityValue").ToLocalChecked()).ToLocalChecked()).FromJust();
463 double const massFlow = Nan::To<double>(Nan::Get(Nan::To<v8::Object>(arr->Get(context, i).ToLocalChecked()).ToLocalChecked(), massFlowStr).ToLocalChecked()).FromJust();
465 inlets.emplace_back(
Inlet(pressure, quantity, quantityValue, massFlow));
467 Local<Object> obj = Nan::New<Object>();
468 Local<String> inletNum = Nan::New<String>(
"inlet" + std::to_string(i + 1)).ToLocalChecked();
471 Nan::Set(obj, pressureStr, Nan::New<Number>(inletProps.pressure));
472 Nan::Set(obj, temperatureStr, Nan::New<Number>(inletProps.temperature));
473 Nan::Set(obj, qualityStr, Nan::New<Number>(inletProps.quality));
474 Nan::Set(obj, specificEnthalpyStr, Nan::New<Number>(inletProps.specificEnthalpy));
475 Nan::Set(obj, specificEntropyStr, Nan::New<Number>(inletProps.specificEntropy));
476 Nan::Set(obj, energyFlowStr, Nan::New<Number>(inlets[i].getInletEnergyFlow()));
477 Nan::Set(obj, massFlowStr, Nan::New<Number>(inlets[i].getMassFlow()));
479 Nan::Set(r, inletNum, obj);
484 Local<String> headerStr = Nan::New<String>(
"header").ToLocalChecked();
488 Local<Object> obj = Nan::New<Object>();
491 Nan::Set(obj, temperatureStr, Nan::New<Number>(headerProps.temperature));
492 Nan::Set(obj, qualityStr, Nan::New<Number>(headerProps.quality));
493 Nan::Set(obj, specificEnthalpyStr, Nan::New<Number>(headerProps.specificEnthalpy));
494 Nan::Set(obj, specificEntropyStr, Nan::New<Number>(headerProps.specificEntropy));
498 Nan::Set(r, headerStr, obj);
499 }
catch (std::runtime_error
const &e) {
500 std::string
const what = e.what();
501 ThrowError(std::string(
"std::runtime_error thrown in header - ssmt.h: " + what).c_str());
503 info.GetReturnValue().Set(r);
506 NAN_METHOD(turbine) {
507 inp = Nan::To<Object>(info[0]).ToLocalChecked();
508 r = Nan::New<Object>();
510 const double inletPressure = getDouble(
"inletPressure");
511 const double inletQuantityValue = getDouble(
"inletQuantityValue");
512 const double generatorEfficiency = getDouble(
"generatorEfficiency");
513 const double massFlowOrPowerOut = getDouble(
"massFlowOrPowerOut");
514 const double outletSteamPressure = getDouble(
"outletSteamPressure");
516 unsigned val =
static_cast<unsigned>(Nan::To<double>(Nan::Get(Nan::To<v8::Object>(inp).ToLocalChecked(), Nan::New<String>(
"solveFor").ToLocalChecked()).ToLocalChecked()).FromJust());
519 val =
static_cast<unsigned>(Nan::To<double>(Nan::Get(Nan::To<v8::Object>(inp).ToLocalChecked(), Nan::New<String>(
"turbineProperty").ToLocalChecked()).ToLocalChecked()).FromJust());
522 val =
static_cast<unsigned>(Nan::To<double>(Nan::Get(Nan::To<v8::Object>(inp).ToLocalChecked(), Nan::New<String>(
"inletQuantity").ToLocalChecked()).ToLocalChecked()).FromJust());
525 std::shared_ptr<Turbine> t;
528 if (solveFor == Turbine::Solve::OutletProperties) {
530 const double isentropicEfficiency = getDouble(
"isentropicEfficiency");
532 t = std::shared_ptr<Turbine>(
533 new Turbine(solveFor, inletPressure, inletQuantity, inletQuantityValue,
534 turbineProperty, isentropicEfficiency, generatorEfficiency,
535 massFlowOrPowerOut, outletSteamPressure));
538 const double outletQuantityValue = getDouble(
"outletQuantityValue");
539 v8::Isolate *isolate = v8::Isolate::GetCurrent();
540 v8::Local<v8::Context> context = isolate->GetCurrentContext();
541 unsigned val =
static_cast<unsigned>(Nan::To<double>(Nan::Get(Nan::To<v8::Object>(inp).ToLocalChecked(), Nan::New<String>(
"outletQuantity").ToLocalChecked()).ToLocalChecked()).FromJust());
543 t = std::shared_ptr<Turbine>(
544 new Turbine(solveFor, inletPressure, inletQuantity, inletQuantityValue,
545 turbineProperty, generatorEfficiency, massFlowOrPowerOut,
546 outletSteamPressure, outletQuantity, outletQuantityValue));
548 }
catch (std::runtime_error
const &e) {
549 std::string
const what = e.what();
550 ThrowError(std::string(
"std::runtime_error thrown in turbine - ssmt.h: " + what).c_str());
554 setR(
"inletPressure", results.pressure);
555 setR(
"inletTemperature", results.temperature);
556 setR(
"inletSpecificEnthalpy", results.specificEnthalpy);
557 setR(
"inletSpecificEntropy", results.specificEntropy);
558 setR(
"inletQuality", results.quality);
559 setR(
"inletEnergyFlow", t->getInletEnergyFlow());
561 results = t->getOutletProperties();
562 setR(
"outletPressure", results.pressure);
563 setR(
"outletTemperature", results.temperature);
564 setR(
"outletSpecificEnthalpy", results.specificEnthalpy);
565 setR(
"outletSpecificEntropy", results.specificEntropy);
566 setR(
"outletQuality", results.quality);
567 setR(
"outletEnergyFlow", t->getOutletEnergyFlow());
569 setR(
"massFlow", t->getMassFlow());
570 setR(
"isentropicEfficiency", t->getIsentropicEfficiency());
571 setR(
"energyOut", t->getEnergyOut());
572 setR(
"powerOut", t->getPowerOut());
573 setR(
"generatorEfficiency", t->getGeneratorEfficiency());
574 info.GetReturnValue().Set(r);
577 NAN_METHOD(heatExchanger) {
578 inp = Nan::To<Object>(info[0]).ToLocalChecked();
579 r = Nan::New<Object>();
581 const double hotInletMassFlow = getDouble(
"hotInletMassFlow");
582 const double hotInletEnergyFlow = getDouble(
"hotInletEnergyFlow");
583 const double hotInletTemperature = getDouble(
"hotInletTemperature");
584 const double hotInletPressure = getDouble(
"hotInletPressure");
585 const double hotInletQuality = getDouble(
"hotInletQuality");
586 const double hotInletSpecificVolume = getDouble(
"hotInletSpecificVolume");
587 const double hotInletDensity = getDouble(
"hotInletDensity");
588 const double hotInletSpecificEnthalpy = getDouble(
"hotInletSpecificEnthalpy");
589 const double hotInletSpecificEntropy = getDouble(
"hotInletSpecificEntropy");
591 const double coldInletMassFlow = getDouble(
"coldInletMassFlow");
592 const double coldInletEnergyFlow = getDouble(
"coldInletEnergyFlow");
593 const double coldInletTemperature = getDouble(
"coldInletTemperature");
594 const double coldInletPressure = getDouble(
"coldInletPressure");
595 const double coldInletQuality = getDouble(
"coldInletQuality");
596 const double coldInletSpecificVolume = getDouble(
"coldInletSpecificVolume");
597 const double coldInletDensity = getDouble(
"coldInletDensity");
598 const double coldInletSpecificEnthalpy = getDouble(
"coldInletSpecificEnthalpy");
599 const double coldInletSpecificEntropy = getDouble(
"coldInletSpecificEntropy");
601 const double approachTemp = getDouble(
"approachTemp");
604 hotInletPressure, hotInletQuality, hotInletSpecificVolume, hotInletDensity, hotInletSpecificEnthalpy,
605 hotInletSpecificEntropy);
608 coldInletPressure, coldInletQuality, coldInletSpecificVolume, coldInletDensity, coldInletSpecificEnthalpy,
609 coldInletSpecificEntropy);
613 setR(
"hotOutletMassFlow", output.hotOutlet.massFlow);
614 setR(
"hotOutletEnergyFlow", output.hotOutlet.energyFlow);
615 setR(
"hotOutletTemperature", output.hotOutlet.temperature);
616 setR(
"hotOutletPressure", output.hotOutlet.pressure);
617 setR(
"hotOutletQuality", output.hotOutlet.quality);
618 setR(
"hotOutletSpecificVolume", output.hotOutlet.specificVolume);
619 setR(
"hotOutletDensity", output.hotOutlet.density);
620 setR(
"hotOutletSpecificEnthalpy", output.hotOutlet.specificEnthalpy);
621 setR(
"hotOutletSpecificEntropy", output.hotOutlet.specificEntropy);
623 setR(
"coldOutletMassFlow", output.coldOutlet.massFlow);
624 setR(
"coldOutletEnergyFlow", output.coldOutlet.energyFlow);
625 setR(
"coldOutletTemperature", output.coldOutlet.temperature);
626 setR(
"coldOutletPressure", output.coldOutlet.pressure);
627 setR(
"coldOutletQuality", output.coldOutlet.quality);
628 setR(
"coldOutletSpecificVolume", output.coldOutlet.specificVolume);
629 setR(
"coldOutletDensity", output.coldOutlet.density);
630 setR(
"coldOutletSpecificEnthalpy", output.coldOutlet.specificEnthalpy);
631 setR(
"coldOutletSpecificEntropy", output.coldOutlet.specificEntropy);
633 info.GetReturnValue().Set(r);
636 NAN_METHOD(steamModeler) {
637 const std::string methodName = std::string(
"SteamModeler::") + std::string(__func__) +
": ";
641 inp = Nan::To<Object>(info[0]).ToLocalChecked();
642 r = Nan::New<Object>();
643 info.GetReturnValue().Set(r);
657 outputDataMapper.map(steamModelerOutput);
658 }
catch (
const std::runtime_error &e) {
659 const std::string what = e.what();
661 const HeaderInput &headerInput = steamModelerInput.getHeaderInput();
662 const int headerCount = headerInput.getHeaderCount();
664 const std::string failMsg =
665 "ERROR calling SteamModeler: " + what +
"; headerCount=" + std::to_string(headerCount);
666 std::cout << methodName << failMsg << std::endl;
668 Local<String> failMsgLocal = Nan::New<String>(failMsg).ToLocalChecked();
669 ThrowError(failMsgLocal);
675 #endif //AMO_TOOLS_SUITE_SSMT_H
SteamSystemModelerTool::FluidProperties const & getInletProperties() const
SteamSystemModelerTool::SteamPropertiesOutput const & getInletProperties() const
virtual double getOutletEnergyFlow() const
SteamSystemModelerTool::FluidProperties const & getOutletGasSaturatedProperties() const
virtual double getOutletMassFlow() const
SteamModelerOutput model(const SteamModelerInput &steamModelerInput)
TurbineProperty
enum class for TurbineProperty
SteamSystemModelerTool::FluidProperties const & getOutletProperties() const
double getHeatLoss() const
double getInletEnergyFlow() const
SteamSystemModelerTool::FluidProperties const & getInletWaterProperties() const
SteamSystemModelerTool::SteamPropertiesOutput const & getOutletProperties() const
double getOutletEnergyFlow() const override
Solve
enum class for Solve
double getInletMassFlow() const
double getFuelEnergy() const
double getFeedwaterMassFlow() const
double getBoilerEnergy() const
SteamSystemModelerTool::SteamPropertiesOutput calculate()
ThermodynamicQuantity
enum class for ThermodynamicQuantity
double getFeedwaterEnergyFlow() const
double getOutletMassFlow() const override
SteamSystemModelerTool::SteamPropertiesOutput const & getFeedwaterProperties() const