Refine diffuser runtime and tests
This commit is contained in:
@@ -10,7 +10,6 @@ class Diffuser {
|
||||
);
|
||||
|
||||
this.interpolation = new interpolation({ type: 'linear' });
|
||||
this.fysics = gravity.fysics;
|
||||
this.convert = convert;
|
||||
this.specs = this.loadSpecs();
|
||||
|
||||
@@ -27,12 +26,12 @@ class Diffuser {
|
||||
this.i_m_water = this.normalizeNumber(this.config.diffuser?.waterHeight, 0);
|
||||
this.i_flow = 0;
|
||||
|
||||
this.n_kg = this.fysics.calc_air_dens(1013.25, 0, 20);
|
||||
this.n_kg = this.calcAirDensityMbar(1013.25, 0, 20);
|
||||
|
||||
this.n_flow = 0;
|
||||
this.o_otr = 0;
|
||||
this.o_p_flow = 0;
|
||||
this.o_p_water = this.fysics.heigth_to_pressure(this.i_water_density, this.i_m_water);
|
||||
this.o_p_water = this.heightToPressureMbar(this.i_water_density, this.i_m_water);
|
||||
this.o_p_total = this.o_p_water;
|
||||
this.o_kg = 0;
|
||||
this.o_kg_h = 0;
|
||||
@@ -71,7 +70,7 @@ class Diffuser {
|
||||
|
||||
setWaterHeight(value) {
|
||||
this.i_m_water = Math.max(0, this.normalizeNumber(value, this.i_m_water));
|
||||
this.o_p_water = this.fysics.heigth_to_pressure(this.i_water_density, this.i_m_water);
|
||||
this.o_p_water = this.heightToPressureMbar(this.i_water_density, this.i_m_water);
|
||||
this.recalculate();
|
||||
}
|
||||
|
||||
@@ -190,9 +189,28 @@ class Diffuser {
|
||||
return Math.max(0, eff1 * eff2 * 100);
|
||||
}
|
||||
|
||||
calcAirDensityMbar(pressureMbar, RH, tempC) {
|
||||
const Rd = 287.05;
|
||||
const Rv = 461.495;
|
||||
const T = tempC + 273.15;
|
||||
const A = 8.07131;
|
||||
const B = 1730.63;
|
||||
const C = 233.426;
|
||||
const e_s = Math.pow(10, (A - (B / (C + tempC))));
|
||||
const e = RH * e_s / 100;
|
||||
const pressurePa = this.convert(pressureMbar).from('mbar').to('Pa');
|
||||
const p_d = pressurePa - (e * 100);
|
||||
return (p_d / (Rd * T)) + ((e * 100) / (Rv * T));
|
||||
}
|
||||
|
||||
heightToPressureMbar(density, height) {
|
||||
const pressurePa = gravity.getStandardGravity() * density * height;
|
||||
return this.convert(pressurePa).from('Pa').to('mbar');
|
||||
}
|
||||
|
||||
calcOtrPressure(flow) {
|
||||
const totalInputPressureMbar = this.i_local_atm_pressure + this.i_pressure;
|
||||
this.o_kg = this.fysics.calc_air_dens(totalInputPressureMbar, 0, 20);
|
||||
this.o_kg = this.calcAirDensityMbar(totalInputPressureMbar, 0, 20);
|
||||
this.o_kg_h = this.o_kg * flow;
|
||||
this.n_flow = (this.o_kg / this.n_kg) * flow;
|
||||
this.o_flow_element = Math.round((this.n_flow / this.i_n_elements) * 100) / 100;
|
||||
@@ -290,6 +308,14 @@ class Diffuser {
|
||||
};
|
||||
}
|
||||
|
||||
getReactorOtr(zoneVolumeM3) {
|
||||
const volume = Number(zoneVolumeM3);
|
||||
if (!Number.isFinite(volume) || volume <= 0) {
|
||||
return 0;
|
||||
}
|
||||
return this.o_kgo2_h * 1000 * 24 / volume;
|
||||
}
|
||||
|
||||
loadSpecs() {
|
||||
return {
|
||||
supplier: 'GVA',
|
||||
|
||||
Reference in New Issue
Block a user