Skip to content

Commit 2cc3012

Browse files
committed
xdata updates
1 parent bc7d949 commit 2cc3012

File tree

2 files changed

+60
-10
lines changed

2 files changed

+60
-10
lines changed

js/tracker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ var focusID = 0;
4545

4646
var receiverCanvas = null;
4747

48-
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"];
48+
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"];
4949
var sondeCodes = {
5050
"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",
5151
"54":"DFM-17", "62":"MRZ-3MK", "63":"M20", "77":"M10", "82":"LMS6-1680", "84":"iMet-54"

js/xdata.js

Lines changed: 59 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,54 @@
33
* Authors: Mark Jessop & Luke Prior
44
*/
55

6+
function parseOzonesonde(xdata) {
7+
// Attempt to parse an XDATA string from an ECC Ozonesonde
8+
// Returns an object with parameters to be added to the sondes telemetry.
9+
//
10+
// References:
11+
// https://gml.noaa.gov/aftp/user/jordan/iMet%20Radiosonde%20Protocol.pdf
12+
//
13+
// Sample data: 01010349FDC54296 (length = 16 characters)
14+
15+
// Run some checks over the input
16+
if(xdata.length != 16){
17+
// Invalid Ozonesonde dataset
18+
return {};
19+
}
20+
21+
if(xdata.substr(0,2) !== '01'){
22+
// Not an Ozonesonde (shouldn't get here)
23+
return {};
24+
}
25+
26+
var _output = {};
27+
28+
// Instrument number is common to all XDATA types.
29+
_output['ozonesonde_instrument_number'] = parseInt(xdata.substr(2,2),16);
30+
31+
// Cell Current
32+
_cell_current = parseInt(xdata.substr(4,4),16)*0.001; // micro-Amps
33+
_output['ozonesonde_cell_current'] = Math.round(_cell_current * 1000) / 1000; // 3 DP
34+
35+
// Pump Temperature
36+
_pump_temperature = parseInt(xdata.substr(8,4),16);
37+
if ((_pump_temperature & 0x8000) > 0) {
38+
_pump_temperature = _pump_temperature - 0x10000;
39+
}
40+
_pump_temperature = _pump_temperature*0.01; // Degrees C
41+
_output['ozonesonde_pump_temperature'] = Math.round(_pump_temperature * 100) / 100; // 2 DP
42+
43+
// Pump Current
44+
_pump_current = parseInt(xdata.substr(12,2),16); // mA
45+
_output['ozondesonde_pump_current'] = Math.round(_pump_current * 10) / 10; // 1 DP
46+
47+
// Battery Voltage
48+
_battery_voltage = parseInt(xdata.substr(14,2),16)*0.1; // Volts
49+
_output['ozondesonde_battery_voltage'] = Math.round(_battery_voltage * 10) / 10; // 1 DP
50+
51+
return _output
52+
}
53+
654
// Pump Efficiency Correction Parameters for ECC-6A Ozone Sensor, with 3.0cm^3 volume.
755
// We are using these as a nominal correction value for pump efficiency vs pressure
856
//
@@ -159,36 +207,36 @@ function parseCOBALD(xdata) {
159207
// Internal temperature
160208
_internal_temperature = parseInt(xdata.substr(7,3),16);
161209
if ((_internal_temperature & 0x800) > 0) {
162-
_internal_temperature = _internal_temperature - 0x1000;
210+
_internal_temperature = _internal_temperature - 0x1000;
163211
}
164212
_internal_temperature = _internal_temperature/8; // Degrees C (-40 - 50)
165213
_output['cobald_internal_temperature'] = Math.round(_internal_temperature * 100) / 100; // 2 DP
166214

167215
// Blue backscatter
168216
_blue_backscatter = parseInt(xdata.substr(10,6),16);
169217
if ((_blue_backscatter & 0x800000) > 0) {
170-
_blue_backscatter = _blue_backscatter - 0x1000000;
218+
_blue_backscatter = _blue_backscatter - 0x1000000;
171219
}
172220
_output['cobald_blue_backscatter'] = _blue_backscatter; // (0 - 1000000)
173221

174222
// Red backckatter
175223
_red_backscatter = parseInt(xdata.substr(16,6),16);
176224
if ((_red_backscatter & 0x800000) > 0) {
177-
_red_backscatter = _red_backscatter - 0x1000000;
225+
_red_backscatter = _red_backscatter - 0x1000000;
178226
}
179227
_output['cobald_red_backscatter'] = _red_backscatter; // (0 - 1000000)
180228

181229
// Blue monitor
182230
_blue_monitor = parseInt(xdata.substr(22,4),16);
183231
if ((_blue_monitor & 0x8000) > 0) {
184-
_blue_monitor = _blue_monitor - 0x10000;
232+
_blue_monitor = _blue_monitor - 0x10000;
185233
}
186234
_output['cobald_blue_monitor'] = _blue_monitor; // (-32768 - 32767)
187235

188236
// Red monitor
189237
_red_monitor = parseInt(xdata.substr(26,4),16);
190238
if ((_red_monitor & 0x8000) > 0) {
191-
_red_monitor = _red_monitor - 0x10000;
239+
_red_monitor = _red_monitor - 0x10000;
192240
}
193241
_output['cobald_red_monitor'] = _red_monitor; // (-32768 - 32767)
194242

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

567615
if (_instrument === '01') {
568-
// V7
569-
// 0102 time=1001 cnt=0 rpm=0
570-
// 0102 time=1001 cnt=7 rpm=419
571-
if (!_instruments.includes("V7")) _instruments.push('V7');
616+
if (_current_xdata.length = 16) {
617+
// Ozonesonde
618+
_xdata_temp = parseOzonesonde(_current_xdata);
619+
_output = Object.assign(_output,_xdata_temp);
620+
if (!_instruments.includes("Ozonesonde")) _instruments.push('Ozonesonde');
621+
}
572622
} else if (_instrument === '05'){
573623
// OIF411
574624
_xdata_temp = parseOIF411(_current_xdata, pressure);

0 commit comments

Comments
 (0)