diff --git a/js/xdata.js b/js/xdata.js index 1d29c6b..104e470 100644 --- a/js/xdata.js +++ b/js/xdata.js @@ -3,7 +3,43 @@ * Authors: Mark Jessop & Luke Prior */ -function parseOzonesonde(xdata) { +// Pump Efficiency Correction Parameters for ECC-6A Ozone Sensor, with 3.0cm^3 volume. +// We are using these as a nominal correction value for pump efficiency vs pressure +// +OIF411_Cef_Pressure = [ 0, 2, 3, 5, 10, 20, 30, 50, 100, 200, 300, 500, 1000, 1100]; +OIF411_Cef = [ 1.171, 1.171, 1.131, 1.092, 1.055, 1.032, 1.022, 1.015, 1.011, 1.008, 1.006, 1.004, 1, 1]; + +function lerp(x, y, a){ + // Helper function for linear interpolation between two points + return x * (1 - a) + y * a +} + +function get_oif411_Cef(pressure){ + // Get the Pump efficiency correction value for a given pressure. + + // Off-scale use bottom-end value + if (pressure <= OIF411_Cef_Pressure[0]){ + return OIF411_Cef[0]; + } + + // Off-scale top, use top-end value + if (pressure >= OIF411_Cef_Pressure[OIF411_Cef_Pressure.length-1]){ + return OIF411_Cef[OIF411_Cef.length-1]; + } + + + // Within the correction range, perform linear interpolation. + for(i= 1; i= OIF411_Cef_Pressure[OIF411_Cef_Pressure.length-1]){ - return OIF411_Cef[OIF411_Cef.length-1]; - } - + // Calibration values + Ibg = 0.0; // The BOM appear to use a Ozone background current value of 0 uA + Cef = get_oif411_Cef(pressure); // Calculate the pump efficiency correction. + FlowRate = 28.5; // Use a 'nominal' value for Flow Rate (seconds per 100mL). - // Within the correction range, perform linear interpolation. - for(i= 1; i