Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion js/tracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ var focusID = 0;

var receiverCanvas = null;

var sondePrefix = ["RS92", "RS92-SGP", "RS92-NGP", "RS41", "RS41-SG", "RS41-SGP", "RS41-SGM", "DFM", "DFM06", "DFM09", "DFM17", "M10", "M20", "iMet-4", "iMet-54", "LMS6", "LMS6-400", "LMS6-1680", "iMS-100", "MRZ", "chase"];
var sondePrefix = ["RS92", "RS92-SGP", "RS92-NGP", "RS41", "RS41-SG", "RS41-SGP", "RS41-SGM", "DFM", "DFM06", "DFM09", "DFM17", "M10", "M20", "iMet-1", "iMet-4", "iMet-54", "LMS6", "LMS6-400", "LMS6-1680", "iMS-100", "MRZ", "chase"];
var sondeCodes = {
"07":"iMet-1", "11":"LMS6-403", "13":"RS92", "14":"RS92", "17":"DFM-09", "18":"DFM-06", "19":"MRZ-N1", "22":"RS-11G", "23":"RS41", "24":"RS41", "34":"iMet-4", "35":"iMS-100", "41":"RS41", "42":"RS41", "52":"RS92-NGP",
"54":"DFM-17", "62":"MRZ-3MK", "63":"M20", "77":"M10", "82":"LMS6-1680", "84":"iMet-54"
Expand Down
68 changes: 59 additions & 9 deletions js/xdata.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,54 @@
* Authors: Mark Jessop & Luke Prior
*/

function parseOzonesonde(xdata) {
// Attempt to parse an XDATA string from an ECC Ozonesonde
// Returns an object with parameters to be added to the sondes telemetry.
//
// References:
// https://gml.noaa.gov/aftp/user/jordan/iMet%20Radiosonde%20Protocol.pdf
//
// Sample data: 01010349FDC54296 (length = 16 characters)

// Run some checks over the input
if(xdata.length != 16){
// Invalid Ozonesonde dataset
return {};
}

if(xdata.substr(0,2) !== '01'){
// Not an Ozonesonde (shouldn't get here)
return {};
}

var _output = {};

// Instrument number is common to all XDATA types.
_output['ozonesonde_instrument_number'] = parseInt(xdata.substr(2,2),16);

// Cell Current
_cell_current = parseInt(xdata.substr(4,4),16)*0.001; // micro-Amps
_output['ozonesonde_cell_current'] = Math.round(_cell_current * 1000) / 1000; // 3 DP

// Pump Temperature
_pump_temperature = parseInt(xdata.substr(8,4),16);
if ((_pump_temperature & 0x8000) > 0) {
_pump_temperature = _pump_temperature - 0x10000;
}
_pump_temperature = _pump_temperature*0.01; // Degrees C
_output['ozonesonde_pump_temperature'] = Math.round(_pump_temperature * 100) / 100; // 2 DP

// Pump Current
_pump_current = parseInt(xdata.substr(12,2),16); // mA
_output['ozondesonde_pump_current'] = Math.round(_pump_current * 10) / 10; // 1 DP

// Battery Voltage
_battery_voltage = parseInt(xdata.substr(14,2),16)*0.1; // Volts
_output['ozondesonde_battery_voltage'] = Math.round(_battery_voltage * 10) / 10; // 1 DP

return _output
}

// 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
//
Expand Down Expand Up @@ -159,36 +207,36 @@ function parseCOBALD(xdata) {
// Internal temperature
_internal_temperature = parseInt(xdata.substr(7,3),16);
if ((_internal_temperature & 0x800) > 0) {
_internal_temperature = _internal_temperature - 0x1000;
_internal_temperature = _internal_temperature - 0x1000;
}
_internal_temperature = _internal_temperature/8; // Degrees C (-40 - 50)
_output['cobald_internal_temperature'] = Math.round(_internal_temperature * 100) / 100; // 2 DP

// Blue backscatter
_blue_backscatter = parseInt(xdata.substr(10,6),16);
if ((_blue_backscatter & 0x800000) > 0) {
_blue_backscatter = _blue_backscatter - 0x1000000;
_blue_backscatter = _blue_backscatter - 0x1000000;
}
_output['cobald_blue_backscatter'] = _blue_backscatter; // (0 - 1000000)

// Red backckatter
_red_backscatter = parseInt(xdata.substr(16,6),16);
if ((_red_backscatter & 0x800000) > 0) {
_red_backscatter = _red_backscatter - 0x1000000;
_red_backscatter = _red_backscatter - 0x1000000;
}
_output['cobald_red_backscatter'] = _red_backscatter; // (0 - 1000000)

// Blue monitor
_blue_monitor = parseInt(xdata.substr(22,4),16);
if ((_blue_monitor & 0x8000) > 0) {
_blue_monitor = _blue_monitor - 0x10000;
_blue_monitor = _blue_monitor - 0x10000;
}
_output['cobald_blue_monitor'] = _blue_monitor; // (-32768 - 32767)

// Red monitor
_red_monitor = parseInt(xdata.substr(26,4),16);
if ((_red_monitor & 0x8000) > 0) {
_red_monitor = _red_monitor - 0x10000;
_red_monitor = _red_monitor - 0x10000;
}
_output['cobald_red_monitor'] = _red_monitor; // (-32768 - 32767)

Expand Down Expand Up @@ -565,10 +613,12 @@ function parseXDATA(data, pressure, temperature){
_instrument = _current_xdata.substr(0,2);

if (_instrument === '01') {
// V7
// 0102 time=1001 cnt=0 rpm=0
// 0102 time=1001 cnt=7 rpm=419
if (!_instruments.includes("V7")) _instruments.push('V7');
if (_current_xdata.length = 16) {
// Ozonesonde
_xdata_temp = parseOzonesonde(_current_xdata);
_output = Object.assign(_output,_xdata_temp);
if (!_instruments.includes("Ozonesonde")) _instruments.push('Ozonesonde');
}
} else if (_instrument === '05'){
// OIF411
_xdata_temp = parseOIF411(_current_xdata, pressure);
Expand Down