file: wndcflash.html
8 Aug 2007

CompactFLASH CARD STORAGE FORMAT - VOSWND53

The following describes the data storage and record format of CompactFLASH memory cards used in ASIMET instrumentation with Ver4.xx and later firmware.

CompactFLASH card sectors of interest:


Description of WND data file beginning at Sector 322

The CFLASH data file (yourname.DAT) consumes most of the CompactFLASH card. Each record is 740 bytes long, containing the date and time written, 60 minutes of Wind Velocity East data, 60 minutes of Wind Velocity North data, 60 minutes of Wind Speed data, 60 minutes of Wind Speed Max data, 60 minutes of Last Vane direction data, 60 minutes of Last Compass direction data, 60 minutes of Tilt X data, 60 minutes of Tilt Y data, 8 unused spare bytes, a flag which is set to 0xA5A5 when the record is written, and a 2 byte CRC of the previous 738 bytes (currently not used, set to 0 always). The actual C language struct is reproduced here to show the format of the stored image. Most values are packed.

   
   /* this is the WND data record structure, 740 bytes */
   struct WND_record
     {
     struct time_type time1;         /* 8 bytes of time */
     short Ve[60];                   /* 60 minutes of Vel East data */
     short Vn[60];                   /* 60 minutes of Vel North data */
     unsigned char WSpeed[60];       /* 60 minutes of WS data */
     unsigned char WSMax[60];        /* 60 minutes of Max WS data */
     unsigned short LastVane[60];   /* 60 minutes of Last Vane data */
     unsigned short LastCompass[60]; /* 60 minutes of Last Compass data */
     char TiltX[60];                 /* 60 minutes of Tilt X data */
     char TiltY[60];                 /* 60 minutes of Tilt Y data */
     unsigned char spare[8];
     unsigned short used;            /* set to 0xA5A5 upon record write */
     unsigned short wnd_CRC;         /* CRC of previous 738 bytes */
     };


   struct time_type
     {
     unsigned char hour;
     unsigned char min;
     unsigned char sec;
     unsigned char day;
     unsigned char dow;   /* day of week - NOT USED */
     unsigned char mon;
     unsigned short year;
     };


Note that time structure is NOT ANSI-compatible.


Data packing - this is the packing code from the VOSWND53 instrument

     /* every minute, from 0 to 59, pack and store the record */
     
     /* Vel data 0 to +/- 49.99 m/s packs to 0 to +/- 4999 */ 
     WND_data.Ve[t_time.min] = (short)(vel_east * 100);
     WND_data.Vn[t_time.min] = (short)(vel_north * 100);
     
     /* speed data from 0 to 50.0 m/s packs to 0 to 250 (.2 resolution ) */
     WND_data.WSpeed[t_time.min] = (unsigned char)(speed_avg * 5);
     WND_data.WSMax[t_time.min] = (unsigned char)(speed_max * 5);
     
     /* vane data from 0 to 359.9 packs to 0 to 3599 */
     WND_data.LastVane[t_time.min] = (unsigned short)(vane_deg * 10);
     
     /* compass data from 0 to 359.9 packs to 0 to 3599 */
     WND_data.LastCompass[t_time.min] = (unsigned short)(comp_deg * 10);
     
     /* tilt data from 0 to 25.0 packs to +127/-128 (.2 resolution) */
     WND_data.TiltX[t_time.min] = (char)(tilt_x_avg * 5);
     WND_data.TiltY[t_time.min] = (char)(tilt_y_avg * 5);

Data is written to the FLASH card immediately following the acquisition of all data at the rollover to the 59th minute of each hour. This is reflected in the time stamp on each record, typically 1 second into minute 59. The "Last" values of compass and vane are taken from the last 5 second vector averaging period of the minute, just prior to writing the record.


*** IMPORTANT NOTE ***

The byte order of the all numeric values stored by the VOSWND53 firmware is reversed relative to Intel-based PC's. That is, a long integer (4 bytes) or short integer (2 bytes) stored by a PC will be LS byte first in memory. The VOSWND53 firmware stores MS byte first in memory. This must be accounted for when processing the data.


The "used" flag value is used to simplify finding the end of valid records the .DAT file; as each record is written, the "used" flag is set to A5A5h to provide a distinct pattern to search on for good records.

The CRC is NOT IMPLEMENTED.