@@ -117,7 +117,7 @@ function parseOIF411(xdata, pressure){
117117 // Now attempt to calculate the O3 partial pressure
118118
119119 // Calibration values
120- Ibg = 0 .0; // The BOM appear to use a Ozone background current value of 0 uA
120+ Ibg = 12 .0; // The BOM appear to use a Ozone background current value of 12 uA (+- 0.6)
121121 Cef = get_oif411_Cef ( pressure ) ; // Calculate the pump efficiency correction.
122122 FlowRate = 28.5 ; // Use a 'nominal' value for Flow Rate (seconds per 100mL).
123123
@@ -128,34 +128,6 @@ function parseOIF411(xdata, pressure){
128128 return _output
129129}
130130
131- function parseCFH ( xdata ) {
132- // Attempt to parse an XDATA string from a CFH Cryogenic Frostpoint Hygrometer
133- // Returns an object with parameters to be added to the sondes telemetry.
134- //
135- // References:
136- // https://eprints.lib.hokudai.ac.jp/dspace/bitstream/2115/72249/1/GRUAN-TD-5_MeiseiRadiosondes_v1_20180221.pdf
137- //
138- // Sample data: 0802E21FFD85C8CE078A0193 (length = 24 characters)
139-
140- // Run some checks over the input
141- if ( xdata . length != 24 ) {
142- // Invalid CFH dataset
143- return { } ;
144- }
145-
146- if ( xdata . substr ( 0 , 2 ) !== '08' ) {
147- // Not an CFH (shouldn't get here)
148- return { } ;
149- }
150-
151- var _output = { } ;
152-
153- // Instrument number is common to all XDATA types.
154- _output [ 'cfh_instrument_number' ] = parseInt ( xdata . substr ( 2 , 2 ) , 16 ) ;
155-
156- return _output
157- }
158-
159131function parseCOBALD ( xdata ) {
160132 // Attempt to parse an XDATA string from a COBALD Compact Optical Backscatter Aerosol Detector
161133 // Returns an object with parameters to be added to the sondes telemetry.
@@ -223,46 +195,6 @@ function parseCOBALD(xdata) {
223195 return _output
224196}
225197
226- function parseSKYDEW ( xdata ) {
227- // Attempt to parse an XDATA string from a SKYDEW Peltier-based chilled-mirror hygrometer
228- // Returns an object with parameters to be added to the sondes telemetry.
229- //
230- // References:
231- // https://www.gruan.org/gruan/editor/documents/meetings/icm-12/pres/pres_306_Sugidachi_SKYDEW.pdf
232- //
233- // Sample data: 3F0141DF73B940F600150F92FF27D5C8304102 (length = 38 characters)
234-
235- // Run some checks over the input
236- if ( xdata . length != 38 ) {
237- // Invalid SKYDEW dataset
238- return { } ;
239- }
240-
241- if ( xdata . substr ( 0 , 2 ) !== '3F' ) {
242- // Not a SKYDEW (shouldn't get here)
243- return { } ;
244- }
245-
246- var _output = { } ;
247-
248- // Instrument number is common to all XDATA types.
249- _output [ 'skydew_instrument_number' ] = parseInt ( xdata . substr ( 2 , 2 ) , 16 ) ;
250-
251- // Other fields may include
252- // Serial number
253- // Mirror temperature (-120 - 30)
254- // Mixing ratio V (ppmV)
255- // PT100 (Ohm 60 - 120)
256- // SCA light
257- // SCA base
258- // PLT current
259- // HS temp
260- // CB temp
261- // PID
262- // Battery
263- return _output
264- }
265-
266198function getPCFHdate ( code ) {
267199 // months reference list
268200 var PCFHmonths = [ "Jan" , "Feb" , "Mar" , "Apr" , "May" , "Jun" , "Jul" , "Aug" , "Sep" , "Oct" , "Nov" , "Dec" ] ;
@@ -440,7 +372,81 @@ function parsePCFH(xdata) {
440372 return _output
441373}
442374
443- function parseXDATA ( data , pressure ) {
375+ function calculateFLASHBWaterVapour ( S , B , P , T ) {
376+ var K1 = 0 ;
377+ var K2 = 0 ;
378+ var U = 0 ;
379+
380+ var F = S - B + K2 * ( S - B )
381+
382+ if ( P < 36 ) {
383+ U = K1 * F * 0.956 * ( 1 + ( ( 0.00781 * ( T + 273.16 ) ) / P ) ) ;
384+ } else if ( 36 <= 36 < 300 ) {
385+ U = K1 * F * ( 1 + 0.00031 * P )
386+ }
387+
388+ return U ;
389+ }
390+
391+ function parseFLASHB ( xdata , pressure , temperature ) {
392+ // Attempt to parse an XDATA string from a Fluorescent Lyman-Alpha Stratospheric Hygrometer for Balloon (FLASH-B)
393+ // Returns an object with parameters to be added to the sondes telemetry.
394+ //
395+ //
396+ // Sample data: 3D0204E20001407D00E4205DC24406B1012 (length = 35 characters)
397+
398+ // Run some checks over the input
399+ if ( xdata . length != 35 ) {
400+ // Invalid FLASH-B dataset
401+ return { } ;
402+ }
403+
404+ if ( xdata . substr ( 0 , 2 ) !== '3D' ) {
405+ // Not a FLASH-B (shouldn't get here)
406+ return { } ;
407+ }
408+
409+ var _output = { } ;
410+
411+ // Instrument number is common to all XDATA types.
412+ _output [ 'flashb_instrument_number' ] = parseInt ( xdata . substr ( 2 , 2 ) , 16 ) ;
413+
414+ _photomultiplier_counts = parseInt ( xdata . substr ( 5 , 4 ) , 16 ) ;
415+
416+ _photomultiplier_background_counts = parseInt ( xdata . substr ( 9 , 4 ) , 16 ) ;
417+ _output [ 'flashb_photomultiplier_background_counts' ] = _photomultiplier_background_counts
418+
419+ //_photomultiplier_counts = calculateFLASHBWaterVapour(_photomultiplier_counts, _photomultiplier_background_counts, pressure, temperature);
420+ _output [ 'flashb_photomultiplier_counts' ] = _photomultiplier_counts ;
421+
422+ _photomultiplier_temperature = parseInt ( xdata . substr ( 13 , 4 ) , 16 ) ;
423+ _photomultiplier_temperature = ( - 21.103 * Math . log ( ( _photomultiplier_temperature * 0.0183 ) / ( 2.49856 - ( _photomultiplier_temperature * 0.00061 ) ) ) ) + 97.106 ;
424+ _output [ 'flashb_photomultiplier_temperature' ] = Math . round ( _photomultiplier_temperature * 100 ) / 100 ; // 2 DP
425+
426+ _battery_voltage = parseInt ( xdata . substr ( 17 , 4 ) , 16 ) ;
427+ _battery_voltage = _battery_voltage * 0.005185 ;
428+ _output [ 'flashb_battery_voltage' ] = Math . round ( _battery_voltage * 100 ) / 100 ; // 2 DP
429+
430+ _yuv_current = parseInt ( xdata . substr ( 21 , 4 ) , 16 ) ;
431+ _yuv_current = _yuv_current * 0.0101688 ;
432+ _output [ 'flashb_yuv_current' ] = Math . round ( _yuv_current * 100 ) / 100 ; // 2 DP
433+
434+ _pmt_voltage = parseInt ( xdata . substr ( 25 , 4 ) , 16 ) ;
435+ _pmt_voltage = _pmt_voltage * 0.36966 ;
436+ _output [ 'flashb_pmt_voltage' ] = Math . round ( _pmt_voltage * 10 ) / 10 ; // 1 DP
437+
438+ _firmware_version = parseInt ( xdata . substr ( 29 , 2 ) , 16 ) ;
439+ _firmware_version = _firmware_version * 0.1 ;
440+ _output [ 'flashb_firmware_version' ] = Math . round ( _firmware_version * 10 ) / 10 ; // 1 DP
441+
442+ _output [ 'flashb_production_year' ] = parseInt ( xdata . substr ( 31 , 2 ) , 16 ) ;
443+
444+ _output [ 'flashb_hardware_version' ] = parseInt ( xdata . substr ( 33 , 2 ) , 16 ) ;
445+
446+ return _output
447+ }
448+
449+ function parseXDATA ( data , pressure , temperature ) {
444450 // Accept an XDATA string, or multiple XDATA entries, delimited by '#'
445451 // Attempt to parse each one, and return an object
446452 // Test datasets:
@@ -481,8 +487,6 @@ function parseXDATA(data, pressure){
481487 if ( ! _instruments . includes ( "OIF411" ) ) _instruments . push ( 'OIF411' ) ;
482488 } else if ( _instrument === '08' ) {
483489 // CFH
484- _xdata_temp = parseCFH ( _current_xdata ) ;
485- _output = Object . assign ( _output , _xdata_temp ) ;
486490 if ( ! _instruments . includes ( "CFH" ) ) _instruments . push ( 'CFH' ) ;
487491 } else if ( _instrument === '10' ) {
488492 // FPH
@@ -508,14 +512,14 @@ function parseXDATA(data, pressure){
508512 if ( ! _instruments . includes ( "PCFH" ) ) _instruments . push ( 'PCFH' ) ;
509513 } else if ( _instrument === '3D' ) {
510514 // FLASH-B
515+ _xdata_temp = parseFLASHB ( _current_xdata , pressure , temperature ) ;
516+ _output = Object . assign ( _output , _xdata_temp ) ;
511517 if ( ! _instruments . includes ( "FLASH-B" ) ) _instruments . push ( 'FLASH-B' ) ;
512518 } else if ( _instrument === '3E' ) {
513519 // TRAPS
514520 if ( ! _instruments . includes ( "TRAPS" ) ) _instruments . push ( 'TRAPS' ) ;
515521 } else if ( _instrument === '3F' ) {
516522 // SKYDEW
517- _xdata_temp = parseSKYDEW ( _current_xdata ) ;
518- _output = Object . assign ( _output , _xdata_temp ) ;
519523 if ( ! _instruments . includes ( "SKYDEW" ) ) _instruments . push ( 'SKYDEW' ) ;
520524 } else if ( _instrument === '41' ) {
521525 // CICANUM
0 commit comments