/*
    FILE:  ADCP.H

    This revised version of ADCP.H rearranges some structure elements
    to accommodate the alignment restrictions on the Sun 4.

    The ANCILLARY_1 structure has the SHORT pgs_sample moved from the
    front to right after the FLOATs.  The ANCILLARY_2 structure has the
    last SHORT unused anc24 field dropped (making the structure smaller).
    The CONFIGURATION_1 structure has the SHORT compensation field moved
    to the second position and the SHORT ev_threshold field moved to
    right after ens_threshold.

*/

#define adcp_included

#ifndef dbext_included
#include "dbext.h"       /* SHORT, FLOAT, ... */
#endif

typedef struct
{
    FLOAT    tr_temp          ; /* (C     ) Mean temp of transducer    */
                                /*                                     */
    FLOAT    snd_spd_used     ; /* (m/s   ) Sound speed used by DAS    */
                                /*                                     */
    FLOAT    best_snd_spd     ; /* (m/s   ) Best estimated sound speed */
                                /*                                     */
    FLOAT    mn_heading       ; /* (deg   ) Mean heading               */
                                /*                                     */
    SHORT    pgs_sample       ; /* (      ) Number of pings in sample  */
                                /*                                     */
    SHORT    anc6             ; /* (      ) unassigned                 */
                                /*                                     */
    SHORT    anc7             ; /* (      ) unassigned                 */
                                /*                                     */
    SHORT    anc8             ; /* (      ) unassigned                 */
                                /*                                     */
    SHORT    anc9             ; /* (      ) unassigned                 */
                                /*                                     */
    SHORT    anc10            ; /* (      ) unassigned                 */
                                /*                                     */
}  ANCILLARY_1_TYPE;

typedef struct
{
    FLOAT    avg_fwd_speed    ; /* (m/s   ) (ship rel to water)        */
                                /*                                     */
    FLOAT    avg_stbd_speed   ; /* (m/s   ) (ship rel to water)        */
                                /*                                     */
    FLOAT    std_fwd_speed    ; /* (m/s   ) std dev; ship rel to water */
                                /*                                     */
    FLOAT    std_stbd_speed   ; /* (m/s   ) std dev; ship rel to water */
                                /*                                     */
    FLOAT    avg_u_rel        ; /* (m/s   ) ship eastward rel to water */
                                /*                                     */
    FLOAT    avg_v_rel        ; /* (m/s   ) ship north rel to water    */
                                /*                                     */
    FLOAT    avg_w_rel        ; /* (m/s   ) ship upward from resolved  */
                                /*                                     */
    FLOAT    last_temp        ; /* (C     ) Last temperature           */
                                /*                                     */
    FLOAT    last_heading     ; /* (deg   ) Last heading in sample     */
                                /*                                     */
    FLOAT    last_pitch       ; /* (deg   ) Last pitch in sample       */
                                /*                                     */
    FLOAT    last_roll        ; /* (deg   ) Last roll in sample        */
                                /*                                     */
    FLOAT    mn_pitch         ; /* (deg   ) Mean pitch in sample       */
                                /*                                     */
    FLOAT    mn_roll          ; /* (deg   ) Mean roll in sample        */
                                /*                                     */
    FLOAT    std_temp         ; /* (C     ) Std dev temperature        */
                                /*                                     */
    FLOAT    std_heading      ; /* (deg   ) Std dev heading in sample  */
                                /*                                     */
    FLOAT    std_pitch        ; /* (deg   ) Std dev pitch in sample    */
                                /*                                     */
    FLOAT    std_roll         ; /* (deg   ) Std dev roll in sample     */
                                /*                                     */
    SHORT    ocean_depth      ; /* (m     ) Depth of the ocean         */
                                /*                                     */
    SHORT    max_amp_bin      ; /* (      )                            */
                                /*                                     */
    SHORT    last_good_bin    ; /* (      )                            */
                                /*                                     */
    SHORT    anc21            ; /* (      ) unassigned                 */
                                /*                                     */
    SHORT    anc22            ; /* (      ) unassigned                 */
                                /*                                     */
    SHORT    anc23            ; /* (      ) unassigned                 */
                                /*                                     */
}  ANCILLARY_2_TYPE;

typedef struct
{
    FLOAT    avg_interval     ; /* (sec   ) sample interval            */
                                /*          (DAS averaging interval)   */
    SHORT    compensation     ; /* (      ) DAS compensation flag      */
                                /*          bits 1,2,3,4:H,P,R,demeaned*/
    SHORT    num_bins         ; /* (      ) number of depth bins       */
                                /*                                     */
    FLOAT    tr_depth         ; /* (m     ) Transducer depth           */
                                /*                                     */
    FLOAT    bin_length       ; /* (m     ) Bin length (if upwards < 0)*/
                                /*                                     */
    FLOAT    pls_length       ; /* (m     ) Transmit interval          */
                                /*          (pulse length)             */
    FLOAT    blank_length     ; /* (m     ) Blanking interval          */
                                /*          (blank after transmit)     */
    FLOAT    ping_interval    ; /* (s     ) time between pings         */
                                /*                                     */
    SHORT    bot_track        ; /* (      ) Profiling pings per BT ping*/
                                /*          255 means no bottom track  */
    SHORT    pgs_ensemble     ; /* (      ) Pings per internal ensemble*/
                                /*          (usually 1 for VM)         */
    SHORT    ens_threshold    ; /* (%     ) threshold: %good in ens.   */
                                /*          (irrelevant for VM)        */
    SHORT    ev_threshold     ; /* ( mm/s ) Error velocity threshold   */
                                /*                                     */
    FLOAT    hd_offset        ; /* (deg   ) Heading offset applied     */
                                /*          (applied by DAS)           */
    FLOAT    pit_offset       ; /* (deg   ) Pitch offset               */
                                /*          (applied by DAS)           */
    FLOAT    rol_offset       ; /* (deg   ) Roll offset                */
                                /*          (applied by DAS)           */
    FLOAT    hd_misalign      ; /* (deg   ) Transducer misalign.-head  */
                                /*          (best estimate)            */
    FLOAT    pit_misalign     ; /* (deg   ) Transducer misalign- pitch */
                                /*          (best estimate)            */
    FLOAT    rol_misalign     ; /* (deg   ) Transducer misalign.-roll  */
                                /*          (best estimate)            */
    FLOAT    freq_transmit    ; /* (Hz    ) Transmitter frequency      */
                                /*                                     */
    SHORT    top_ref_bin      ; /* (      ) Top bin of reference layer */
                                /*          (for DAS demeaning)        */
    SHORT    bot_ref_bin      ; /* (      ) Bottom bin of ref. layer (u*/
                                /*          (for DAS demeaning)        */
    FLOAT    scale_factor     ; /* (      ) scaling factor for         */
                                /*          correction of misalignment */
    FLOAT    heading_bias     ; /* (deg   )                            */
                                /*                                     */
} CONFIGURATION_1_TYPE;

typedef struct
{
    SHORT  first_good_bin,
           last_good_bin;
    FLOAT  U_ship_absolute,
           V_ship_absolute;
    SHORT  user_flag_1,
           user_flag_2,
           user_flag_3,
           user_flag_4;
} ACCESS_VARIABLES_TYPE;

typedef struct
{
   float  u, v,                 /* (m/s) */
          depth;                /* (m)   */
} BOTTOM_TRACK_TYPE;

typedef struct
{
   double loran_lat, loran_lon, loran_vel, loran_dir;
} NAVIGATION_TYPE;

