1 #ifndef AMO_TOOLS_SUITE_WASTEWATER_H 2 #define AMO_TOOLS_SUITE_WASTEWATER_H 6 #include "wasteWater/WasteWater_Treatment.h" 12 #include "./NanDataConverters.h" 20 NAN_METHOD(WasteWaterTreatment)
22 inp = Nan::To<Object>(info[0]).ToLocalChecked();
23 r = Nan::New<Object>();
25 const double Temperature = getDouble(
"Temperature", inp);
26 const double So = getDouble(
"So", inp);
27 const double Volume = getDouble(
"Volume", inp);
28 const double FlowRate = getDouble(
"FlowRate", inp);
29 const double InertVSS = getDouble(
"InertVSS", inp);
30 const double OxidizableN = getDouble(
"OxidizableN", inp);
31 const double Biomass = getDouble(
"Biomass", inp);
32 const double InfluentTSS = getDouble(
"InfluentTSS", inp);
33 const double InertInOrgTSS = getDouble(
"InertInOrgTSS", inp);
34 const double EffluentTSS = getDouble(
"EffluentTSS", inp);
35 const double RASTSS = getDouble(
"RASTSS", inp);
36 const double MLSSpar = getDouble(
"MLSSpar", inp);
37 const double FractionBiomass = getDouble(
"FractionBiomass", inp);
38 const double BiomassYeild = getDouble(
"BiomassYeild", inp);
39 const double HalfSaturation = getDouble(
"HalfSaturation", inp);
40 const double MicrobialDecay = getDouble(
"MicrobialDecay", inp);
41 const double MaxUtilizationRate = getDouble(
"MaxUtilizationRate", inp);
42 const double MaxDays = getDouble(
"MaxDays", inp);
43 const double TimeIncrement = getDouble(
"TimeIncrement", inp);
44 const double OperatingDO = getDouble(
"OperatingDO", inp);
45 const double Alpha = getDouble(
"Alpha", inp);
46 const double Beta = getDouble(
"Beta", inp);
47 const double SOTR = getDouble(
"SOTR", inp);
48 const double Aeration = getDouble(
"Aeration", inp);
49 const double Elevation = getDouble(
"Elevation", inp);
50 const double OperatingTime = getDouble(
"OperatingTime", inp);
51 const int TypeAerators = getInteger(
"TypeAerators", inp);
52 const double Speed = getDouble(
"Speed", inp);
53 const double EnergyCostUnit = getDouble(
"EnergyCostUnit", inp);
87 setR(
"TotalAverageDailyFlowRate", output.TotalAverageDailyFlowRate);
88 setR(
"VolumeInService", output.VolumeInService);
89 setR(
"InfluentBOD5Concentration", output.InfluentBOD5Concentration);
90 setR(
"InfluentBOD5MassLoading", output.InfluentBOD5MassLoading);
91 setR(
"SecWWOxidNLoad", output.SecWWOxidNLoad);
92 setR(
"SecWWTSSLoad", output.SecWWTSSLoad);
93 setR(
"FM_ratio", output.FM_ratio);
94 setR(
"SolidsRetentionTime", output.SolidsRetentionTime);
95 setR(
"MLSS", output.MLSS);
96 setR(
"MLVSS", output.MLVSS);
97 setR(
"TSSSludgeProduction", output.TSSSludgeProduction);
98 setR(
"TSSInActivatedSludgeEffluent", output.TSSInActivatedSludgeEffluent);
99 setR(
"TotalOxygenRequirements", output.TotalOxygenRequirements);
100 setR(
"TotalOxygenReqWDenit", output.TotalOxygenReqWDenit);
101 setR(
"TotalOxygenSupplied", output.TotalOxygenSupplied);
102 setR(
"MixingIntensityInReactor", output.MixingIntensityInReactor);
103 setR(
"RASFlowRate", output.RASFlowRate);
104 setR(
"RASRecyclePercentage", output.RASRecyclePercentage);
105 setR(
"WASFlowRate", output.WASFlowRate);
106 setR(
"RASTSSConcentration", output.RASTSSConcentration);
107 setR(
"TotalSludgeProduction", output.TotalSludgeProduction);
108 setR(
"ReactorDetentionTime", output.ReactorDetentionTime);
109 setR(
"VOLR", output.VOLR);
110 setR(
"EffluentCBOD5", output.EffluentCBOD5);
111 setR(
"EffluentTSS", output.EffluentTSS);
112 setR(
"EffluentAmmonia_N", output.EffluentAmmonia_N);
113 setR(
"EffluentNO3_N", output.EffluentNO3_N);
114 setR(
"EffluentNO3_N_W_Denit", output.EffluentNO3_N_W_Denit);
115 setR(
"AeEnergy", output.AeEnergy);
116 setR(
"AeCost", output.AeCost);
117 setR(
"FieldOTR", output.FieldOTR);
119 auto calculationsTable = output.calculationsTable;
120 auto ctArrayTable = New<Array>(calculationsTable.size());
121 for (
unsigned i = 0; i < ctArrayTable->Length(); i++)
123 auto calculationsTableArray = calculationsTable.at(i).getArray();
124 auto ctArray = New<Array>(calculationsTableArray.size());
125 for (
unsigned j = 0; j < ctArray->Length(); j++)
126 ctArray->Set(Nan::GetCurrentContext(), j, New(calculationsTableArray[j]));
128 ctArrayTable->Set(Nan::GetCurrentContext(), i, ctArray);
130 Nan::Set(r, New(
"calculationsTable").ToLocalChecked(), ctArrayTable);
132 catch (std::runtime_error
const &e)
134 std::string
const what = e.what();
135 ThrowError(std::string(
"std::runtime_error thrown in WasteWaterTreatment - wasteWater.h: " + what).c_str());
137 info.GetReturnValue().Set(r);
139 #endif //AMO_TOOLS_SUITE_WASTEWATER_H