/***************************************************************************
                     FILE INFORMATION HEADER
                     -----------------------

    a.  PROJECT NAME:       GRIFO_S7  P2813
    b.  ITEM TYPE:              header
    c.  ITEM NAME:              apps_types.h
    d.  ITEM REFERENCE:
    e.  CURRENT VERSION:        1.2
    f.  DATE:                   4/21/98
    g.  SOURCE FILE LOCATION:   /sparc-2/library/sr3b_end/dati/common/cmn_dt/s.apps_types.h
    h.  'C' RELEASE:            2.11
    i.  ITEM DESCRIPTION:
    j.  DOCUMENTATION REFERENCES: SDD Tracker Computer SR2
    k.  PROGRAMMER NAME(S):
    l.  COPYRIGHT:              FIAR
    m.  REVISION HISTORY:       07-11-01 - Baseline copied from 3B.86 R3K Metis radar version

 ***************************************************************************/

#ifndef apps_types_defined
//## attribute ::types_reverse::TopLevel.apps_types_defined
const RhpString apps_types_defined;

//## dependency base_types
#include "base_types.h"
//## dependency dsp_base_types
#include "dsp_base_types.h"
//## dependency matrix_types
#include "matrix_types.h"
//## dependency datatypes
#include "datatypes.h"
/***** Mode Applications Common Datatypes. *****/

namespace legacy
{
    // * Adaptive Waveform Scheduling datatypes.
    // Also used in common dsp results. *
    //## type pivot_measure_t
    typedef unsigned short pivot_measure_t;
}

//## attribute ::types_reverse::TopLevel.PIVOT_MEASURE_MIN_T
const RhpString PIVOT_MEASURE_MIN_T(0);

//## attribute ::types_reverse::TopLevel.PIVOT_MEASURE_MAX_T
const RhpString PIVOT_MEASURE_MAX_T(32767);

namespace legacy
{
    //## type number_of_pivots_t
    typedef unsigned short number_of_pivots_t;
}

//## attribute ::types_reverse::TopLevel.NUMBER_OF_PIVOTS_T_MIN
const RhpString NUMBER_OF_PIVOTS_T_MIN(0);

//## attribute ::types_reverse::TopLevel.NUMBER_OF_PIVOTS_T_MAX
const RhpString NUMBER_OF_PIVOTS_T_MAX(16);

namespace legacy
{
    //#[ type clutter_power_measures_t
    typedef struct {
        number_of_pivots_t  number_of_pivots;
        pivot_measure_t     pivot_measures[NUMBER_OF_PIVOTS_T_MAX];
      } clutter_power_measures_t;
    //#]
    
    // * ALE / FLC datatypes. *
    //#[ type ale_track_state_t
    typedef enum {
      ale_not_acquired,
      ale_acquired,
      ale_confirmed,
      ale_lost
    }  ale_track_state_t;
    //#]
    
    //#[ type ale_state_vector_t
    typedef struct {
      ale_track_state_t  track_state;
      metres_t           estimated_range;
      metres_per_sec_t   estimated_velocity;
      timetag_t          prediction_timetag;
      seconds_t          pred_time;
    } ale_state_vector_t;
    //#]
    
    //#[ type ale_data_t
    typedef struct {
      timetag_t     pck_timetag;
      int_metres_t  range;
      validity_t    validity;
      } ale_data_t;
    //#]
    
    //#[ type common_dsp_mode_t
    typedef enum {
      rws_mode,
      acq_mode,
      acm_mode,
      tws_mode,
      vs_mode
    }  common_dsp_mode_t;
    //#]
    
    //#[ type dsp_data_for_mcf_t
    typedef struct {
      hertz_t                  mlc_freq;
      range_bin_t              prt;
      freq_channel_t           freq_channel;
      n_int_t                  n_fft;
      tx_pulse_t               tx_pulse;
      range_window_params_t    range_window_params;
      doppler_window_params_t  doppler_window_params;
      switch_channel_t         switch_channel;
      common_dsp_mode_t        common_dsp_mode;
      } dsp_data_for_mcf_t;
    //#]
    
    //#[ type cll_flag_t
    typedef enum {
      cll_meas_no_fm,
      cll_meas_up_slope_1,
      cll_meas_up_slope_2,
      no_cll_meas
      }  cll_flag_t;
    //#]
}

//## attribute ::types_reverse::TopLevel.CLL_FLAG_T_MIN
const RhpString CLL_FLAG_T_MIN(cll_meas_no_fm);

//## attribute ::types_reverse::TopLevel.CLL_FLAG_T_MAX
const RhpString CLL_FLAG_T_MAX(no_cll_meas);

namespace legacy
{
    //#[ type common_dsp_results_t
    typedef struct {
      timetag_t                 processed_pck_timetag;
      pfa_measure_t             pfa_measure;
      waveform_t                agc_waveform_tellback;
      metres_per_sec_t          vcs;
      metres_per_sec2_t         vcs1;
      metres_per_sec3_t         vcs2;
      validity_t                vcs_validity;
      metres_per_sec_t          err_vel_clutt;
      hertz_t                   err_freq_clutt;
      cll_flag_t                cll_flag;
      clutter_power_measures_t  clutter_power_measures;
      } common_dsp_results_t;
    //#]
    
    //#[ type ale_dsp_settings_t
    typedef struct {
      boolean       ale_blanking_enabled;
      int_metres_t  ale_range_estimate;
      range_bin_t   ale_blk_start;
      range_bin_t   ale_blk_stop;
      range_bin_t   ale_trk_start;
      range_bin_t   ale_trk_stop;
      } ale_dsp_settings_t;
    //#]
    
    //#[ type flc_dsp_settings_t
    typedef struct {
      range_bin_t        ambig_range_start;
      range_bin_t        ambig_range_stop;
      filter_index_t     doppler_start;
      filter_index_t     doppler_stop;
      desensitisation_t  desensitisation;
      } flc_dsp_settings_t;
    //#]
    
    //#[ type unambig_ale_window_t
    typedef struct {
      int_metres_t  ale_trk_start_range;
      int_metres_t  ale_trk_stop_range;
      } unambig_ale_window_t;
    //#]
    
    //#[ type unambig_flc_window_t
    typedef struct {
      timetag_t         timetag;
      boolean           exists;
      metres_per_sec_t  flc_vel_min;
      metres_per_sec_t  flc_vel_max;
      int_metres_t      flc_range_start;
      int_metres_t      flc_range_stop;
      } unambig_flc_window_t;
    //#]
    
    //#[ type ale_flc_unambig_windows_t
    typedef struct {
      unambig_ale_window_t  unambig_ale_window;
      unambig_flc_window_t  unambig_flc_window;
      } ale_flc_unambig_windows_t;
    //#]
    
    // * generic target datatypes. *
    //#[ type detected_tgt_t
    typedef struct {
      timetag_t          detection_timetag;
      metres_t           detected_tgt_range;
      validity_t         detected_tgt_range_validity;
      metres_per_sec_t   detected_tgt_rrate;
      validity_t         detected_tgt_rrate_validity;
      metres_per_sec_t   detected_tgt_radial_vel;
      validity_t         detected_tgt_radial_vel_validity;
      pure_number_t      amplitude_det;
      pure_number_t      sdr_det;
      range_bin_t        prt_last;
      float              monop_det;
      timetag_t          monop_det_timetag;
      switch_channel_t   monop_det_channel;
      } detected_tgt_t;
    //#]
    
    //#[ type target_detection_t
    typedef struct {
      boolean             detection_valid;
      detected_tgt_t      detected_tgt;
      radians_t           associated_azimuth;
      radians_t           associated_elevation;
      metres_t            associated_altitude;
      bar_number_t        associated_bar_number;
      } target_detection_t;
    //#]
}

//## attribute ::types_reverse::TopLevel.MAX_NO_OF_TGT_DETECTIONS_AS
const RhpString MAX_NO_OF_TGT_DETECTIONS_AS(16 /* max number of targets in as-modes */);

//## attribute ::types_reverse::TopLevel.MAX_NO_OF_TGT_DETECTIONS
const RhpString MAX_NO_OF_TGT_DETECTIONS(8 /* max number of targets in aa-modes */);

namespace legacy
{
    //#[ type generic_detections_t
    typedef struct {
      range_bin_t          processed_prt;
      hertz_t              processed_mlc_freq;
      freq_channel_t       processed_tx_freq;
      waveform_t           pp_waveform_tellback;
      range_scale_t        pp_range_scale_tellback;
      scan_rate_t          pp_scan_rate_tellback;
      timetag_t            processed_pck_timetag;
      n_int_t              processed_nfft_total;
      unsigned int         code_length;
      boolean              detected_in_lookup;
      unsigned int         num_of_detected_tgts;
      target_detection_t   target_detections[MAX_NO_OF_TGT_DETECTIONS_AS];
      } generic_detections_t;
    //#]
    
    // * Targets for Recording *
    //#[ type target_for_recording_t
    typedef struct {
      waveform_t           pp_waveform_tellback;
      range_scale_t        pp_range_scale_tellback;
      target_detection_t   target_detection;
      } target_for_recording_t;
    //#]
}

//## attribute ::types_reverse::TopLevel.MAX_NO_OF_TGTS_FOR_RECORDING
const RhpString MAX_NO_OF_TGTS_FOR_RECORDING(8);

namespace legacy
{
    //#[ type targets_for_recording_t
    typedef struct {
      unsigned int            num_of_tgts_for_recording;
      target_for_recording_t  targets_for_recording[MAX_NO_OF_TGTS_FOR_RECORDING];
      } targets_for_recording_t;
    //#]
    
    // * ACQUISITION Datatypes. *
    //#[ type range_window_t
    typedef struct {
      metres_t  start;
      metres_t  stop;
       } range_window_t;
    //#]
    
    //#[ type centred_range_window_t
    typedef struct {
      metres_t  centre;
      metres_t  delta;
      } centred_range_window_t;
    //#]
    
    //#[ type timed_range_window_t
    typedef struct {
      timetag_t              timetag;
      centred_range_window_t window;
    } timed_range_window_t;
    //#]
    
    //#[ type rrate_window_t
    typedef struct {
      metres_per_sec_t  min_rrate;
      metres_per_sec_t  max_rrate;
      } rrate_window_t;
    //#]
    
    //#[ type acq_status_t
    typedef enum {
      acq_status_not_valid,
      acquiring,
      target_acquired,
      failed,
      jammer_acquired
     }  acq_status_t;
    //#]
    
    //#[ type designated_target_t
    typedef struct {
      metres2_t         target_range_variance;
      metres_t          rng_des_tgt_comp;
      validity_t        rng_rate_val_des_tgt_comp;
      metres_per_sec_t  rng_rate_des_tgt_comp;
      timetag_t         target_time_tag;
      timetag_t         centre_time_tag;
      waveform_t        waveform;
      radians_t         el_des_tgt_comp;
      radians_t         az_des_tgt_comp;
      range_scale_t     range_scale_des_tgt;
      pure_number_t     des_tgt_amp_det;
      pure_number_t     des_tgt_norm_amp;
      boolean           designated_in_lookup;
      pure_number_t       target_amplitude;
      } designated_target_t;
    //#]
    
    //#[ type waveforms_and_scan_rates_t
    typedef struct {
      waveform_t     waveform;
      scan_rate_t    scan_rate;
      } waveforms_and_scan_rates_t;
    //#]
}

//## attribute ::types_reverse::TopLevel.MAX_NUM_OF_SEARCH_PHASE
const RhpString MAX_NUM_OF_SEARCH_PHASE(2);

//## attribute ::types_reverse::TopLevel.MIN_NUM_OF_SEARCH_PHASE
const RhpString MIN_NUM_OF_SEARCH_PHASE(1);

namespace legacy
{
    //#[ type acquisition_setup_data_t
    typedef struct {
      designated_target_t         designated_target;
      unsigned int                max_num_of_search_phase;
      waveforms_and_scan_rates_t  waveforms_and_scan_rates[MAX_NUM_OF_SEARCH_PHASE];
      } acquisition_setup_data_t;
    //#]
    
    //#[ type acq_target_record_t
    typedef struct {
      metres_per_sec_t  rrate_det;
      validity_t        rrate_val;
      pure_number_t     amplitude_det;
      pure_number_t     sdr_det;
      timetag_t         det_timetag;
      metres_t          range_det;
      radians_t         associated_elevation;
      radians_t         associated_azimuth;
      } acq_target_record_t;
    //#]
    
    //#[ type hpt_type_t
    typedef enum {
      target,
      jammer
    }  hpt_type_t;
    //#]
    
    //#[ type acq_data_for_track_t
    typedef struct {
      waveform_t          waveform;
      n_int_t             n_fft;
      range_scale_t       range_scale;
    
      timetag_t           detection_timetag;
      metres_t            acquired_tgt_range;
      metres_per_sec_t    acquired_tgt_rrate;
      pure_number_t       amplitude_detection;
      pure_number_t       sdr_det;
      radians_t           acquired_tgt_azimuth;
      radians_t           acquired_tgt_elevation;
      validity_t          acquired_tgt_rrate_validity;
    
      metres2_t           acquired_tgt_range_variance;
      metres2_per_sec2_t  acquired_tgt_rrate_variance;
      radians2_t          acquired_tgt_elevation_variance;
      radians2_t          acquired_tgt_azimuth_variance;
      hpt_type_t          hpt_type;
      decibel_t           mgc;
      } acq_data_for_track_t;
    //#]
    
    //#[ type acq_conf_command_t
    typedef enum {
      acq_confirm_target,
      acq_confirm_jammer,
      acm_confirm_target,
      stop
      }  acq_conf_command_t;
    //#]
    
    //#[ type acq_mode_t
    typedef enum {
       acq_mode_acm,
       acq_mode_air,
       acq_mode_ground
     }  acq_mode_t;
    //#]
    
    //#[ type acq_object_t
    typedef enum
    { acq_target,
      acq_jammer
    }  acq_object_t;
    //#]
    
    //#[ type acq_search_type_t
    typedef enum
    {
      acq_in_range,
      acq_in_velocity
    }  acq_search_type_t;
    //#]
    
    //#[ type acm_mode_t
    typedef enum {
      acm_narrow,
      acm_boresight,
      acm_hud,
      acm_wide,
      acm_vertical,
      acm_slewable
    }  acm_mode_t;
    //#]
    
    //#[ type acm_data_t
    typedef struct
    {
      boolean     reject_flag;
      acm_mode_t  submode;
    } acm_data_t;
    //#]
    
    //#[ type confirmation_command_t
    typedef struct
     {
       acq_conf_command_t command;
       boolean            second_search;
       dsp_mode_t         dsp_mode;
       acq_mode_t         acq_mode;
     } confirmation_command_t;
    //#]
}

// * AGR datatypes. *
//## attribute ::types_reverse::TopLevel.AGR_RANGE_T_MIN
const RhpString AGR_RANGE_T_MIN(0.0F);

//## attribute ::types_reverse::TopLevel.AGR_RANGE_T_MAX
const RhpString AGR_RANGE_T_MAX(24000.0F);

namespace legacy
{
    //## type agr_range_t
    typedef metres_t agr_range_t;
    
    // * Common DSP Data datatypes. *
    //#[ type cycle_status_t
    typedef enum {
      cycle_1,
      cycle_2,
      cycle_3
    }  cycle_status_t;
    //#]
}

//## attribute ::types_reverse::TopLevel.CYCLE_STATUS_T_MIN
const RhpString CYCLE_STATUS_T_MIN(cycle_1);

//## attribute ::types_reverse::TopLevel.CYCLE_STATUS_T_MAX
const RhpString CYCLE_STATUS_T_MAX(cycle_3);

namespace legacy
{
    //#[ type stage_status_t
    typedef enum {
      stage_a,
      stage_b,
      stage_c
    }  stage_status_t;
    //#]
}

//## attribute ::types_reverse::TopLevel.STAGE_STATUS_T_MIN
const RhpString STAGE_STATUS_T_MIN(stage_a);

//## attribute ::types_reverse::TopLevel.STAGE_STATUS_T_MAX
const RhpString STAGE_STATUS_T_MAX(stage_c);

namespace legacy
{
    //#[ type cmn_dsp_data_for_recording_t
    typedef struct {
      metres_per_sec_t  pred_mbc_vel;
      pure_number_t     log_pfa_estimate;
    } cmn_dsp_data_for_recording_t;
    //#]
    
    //## type _common_tx_settings_t_
    struct _common_tx_settings_t_
    {
        tx_duty_t duty_cycle;		//## attribute duty_cycle
    };
    
    //## type common_tx_settings_t
    typedef _common_tx_settings_t_ common_tx_settings_t;
    
    //## type _common_sp_settings_t_
    struct _common_sp_settings_t_
    {
        fm_slope_t fm_slope;		//## attribute fm_slope
        hertz_t dem_freq;		//## attribute dem_freq
        range_bin_t prt;		//## attribute prt
        n_reg_clutter_t n_reg_clutter;		//## attribute n_reg_clutter
        switch_channel_t switch_channel_cmd;		//## attribute switch_channel_cmd
        tx_pulse_t tx_pulse;		//## attribute tx_pulse
        mti_code_t mti_code;		//## attribute mti_code
        doppler_window_params_t doppler_window_params;		//## attribute doppler_window_params
        cfar_threshold_t vts;		//## attribute vts
        range_bin_t n_rbin;		//## attribute n_rbin
        cfar_threshold_t vtl;		//## attribute vtl
        off_on_t slobe_blanking;		//## attribute slobe_blanking
        cfar_threshold_t vtg;		//## attribute vtg
        mti_length_t mti_length;		//## attribute mti_length
        n_int_t n_int;		//## attribute n_int
        range_bin_t acq_win_length;		//## attribute acq_win_length
        range_bin_t acq_win_delay;		//## attribute acq_win_delay
        weighting_t weighting;		//## attribute weighting
        freq_channel_t bcn_rx;		//## attribute bcn_rx
    };
    
    //## type common_sp_settings_t
    typedef _common_sp_settings_t_ common_sp_settings_t;
    
    //## type _common_pp_settings_t_
    struct _common_pp_settings_t_
    {
        hertz_t mlc_freq;		//## attribute mlc_freq
        range_bin_t prt;		//## attribute prt
        range_bin_t n_rbin;		//## attribute n_rbin
        range_window_params_t range_window_params;		//## attribute range_window_params
        doppler_window_params_t doppler_window_params;		//## attribute doppler_window_params
        fm_slope_t fm_slope;		//## attribute fm_slope
        batch_end_t batch_end;		//## attribute batch_end
        mtg_t mtg;		//## attribute mtg
        metres_per_sec_t cut_off_velocity;		//## attribute cut_off_velocity
        boolean ngt_enabled;		//## attribute ngt_enabled
        metres_t baro_alt;		//## attribute baro_alt
        boolean baro_alt_validity;		//## attribute baro_alt_validity
        current_prf_in_mprf_t current_prf_in_mprf;		//## attribute current_prf_in_mprf
        spurious_freqs_t spurious_freqs;		//## attribute spurious_freqs
        metres_per_sec_t filtered_err_vel_clutt;		//## attribute filtered_err_vel_clutt
        boolean mprf_lookup;		//## attribute mprf_lookup
        no_of_pulses_t bcn_code;		//## attribute bcn_code
    };
    
    //## type common_pp_settings_t
    typedef _common_pp_settings_t_ common_pp_settings_t;
    
    //#[ type mbcl_params_t
    typedef struct {
      validity_t         inu_flag;
      metres_per_sec_t   vmbc_inu;
      metres_per_sec2_t  vmbc_inu_der;
      } mbcl_params_t;
    //#]
    
    //## type _common_agc_cll_settings_t_
    struct _common_agc_cll_settings_t_
    {
        boolean cll_reset;		//## attribute cll_reset
        boolean agc_reset;		//## attribute agc_reset
        range_bin_t prt;		//## attribute prt
        range_bin_t n_rbin;		//## attribute n_rbin
        decibel_t mgc;		//## attribute mgc
        mbcl_params_t mbcl_params;		//## attribute mbcl_params
        range_bin_t tgt_rgate;		//## attribute tgt_rgate
        range_bin_t init_rgate;		//## attribute init_rgate
        range_bin_t app_win_length;		//## attribute app_win_length
        boolean agc_enable;		//## attribute agc_enable
        boolean stc_profile_modif;		//## attribute stc_profile_modif
    };
    
    //## type common_agc_cll_settings_t
    typedef _common_agc_cll_settings_t_ common_agc_cll_settings_t;
    
    //## type _common_dsp_settings_t_
    struct _common_dsp_settings_t_
    {
        n_int_t n_fft;		//## attribute n_fft
        common_tx_settings_t common_tx_settings;		//## attribute common_tx_settings
        common_sp_settings_t common_sp_settings;		//## attribute common_sp_settings
        common_pp_settings_t common_pp_settings;		//## attribute common_pp_settings
        common_agc_cll_settings_t common_agc_cll_settings;		//## attribute common_agc_cll_settings
    };
    
    //## type common_dsp_settings_t
    typedef _common_dsp_settings_t_ common_dsp_settings_t;
    
    //#[ type gnd_tgt_data_t
    typedef struct {
      low_high_t       rrv;
      metres_per_sec_t cut_off_velocity;
      validity_t       cut_off_vel_validity;
    } gnd_tgt_data_t;
    //#]
    
    // *** Specific types for AS modes *
    //#[ type as_common_dsp_mode_t
    typedef enum {
      gm_mode,
      sea_low_mode,
      gmti_mode,
      sea_high_mode,
      bcn_mode,
      sea_low_acq_mode,
      gmti_acq_mode,
      dbs_mode,
      pause_mode,
      ta_mode,       /* added for SR1 */
      wa_mode,       /* added for SR1 */
      ftt_mode       /* added for SR1 */
    }  as_common_dsp_mode_t;
    //#]
    
    //#[ type as_gnd_tgt_data_t
    typedef struct {
      low_high_t       rrv_min;
      int              if_gain;
      boolean          agc_disable;
      int              moving_target_gain;
      int              expand;
      bcn_code_t       beacon_code;
    } as_gnd_tgt_data_t;
    //#]
    
    //#[ type interleaving_phase_t
    typedef enum {
      intlvg_ph_not_valid = 0,
      synth_phase,
      map_phase
    }  interleaving_phase_t;
    //#]
    
    //#[ type flw_dsp_settings_t
    typedef struct {
      range_bin_t    flw_range_start;
      range_bin_t    flw_range_stop;
      filter_index_t flw_doppler_start;
      filter_index_t flw_doppler_stop;
    } flw_dsp_settings_t;
    //#]
    
    //#[ type ass_dsp_settings_t
    typedef struct {
      ale_dsp_settings_t  ale_dsp_settings;
      flw_dsp_settings_t  flw_dsp_settings;
    } ass_dsp_settings_t;
    //#]
    
    // --------------------------------------
    //## type search_phase_t
    typedef unsigned int search_phase_t;
    
    //#[ type acq_phase_t
    typedef enum {
      acq_search,
      acq_confirmation
     }  acq_phase_t;
    //#]
    
    //#[ type prf_change_event_t
    typedef enum {
      bar_change_prf,
      time_change_prf,
      no_change_prf
    }  prf_change_event_t;
    //#]
    
    //#[ type common_dsp_config_data_t
    typedef union {
      struct _rws_{
         boolean looking_up;
      } rws;
      struct _acq_{
         acq_phase_t phase;
         decibel_t   mgc;
         boolean     looking_up;
      } acq;
      struct _acm_{
        acm_mode_t    mode;
        acq_phase_t   phase;
        union {
          struct _search_{
            prf_change_event_t  prf_change_event;
            seconds_t           prf_change_time;
          } search;
          struct _conf_{
            timetag_t     det_timetag;
            decibel_t     mgc;
          } conf;
        } phase_data;
      } acm;
      struct _tws_{
         boolean looking_up;
      } tws;
    } common_dsp_config_data_t;
    //#]
    
    //## type _common_dsp_config_t_
    struct _common_dsp_config_t_
    {
        common_dsp_mode_t mode;		//## attribute mode
        common_dsp_config_data_t data;		//## attribute data
    };
    
    //## type common_dsp_config_t
    typedef _common_dsp_config_t_ common_dsp_config_t;
    
    //## type _as_acq_data_t_
    struct _as_acq_data_t_
    {
        acq_phase_t phase;		//## attribute phase
        centred_range_window_t win;		//## attribute win
    };
    
    //## type as_acq_data_t
    typedef _as_acq_data_t_ as_acq_data_t;
    
    //## type _as_common_dsp_config_t_
    struct _as_common_dsp_config_t_
    {
        as_common_dsp_mode_t mode;		//## attribute mode
        union {
            as_acq_data_t           acq;
            off_on_t                gmti_interleaving;
            bcn_class_t             bcn_class;
         } specific;		//## attribute specific
    };
    
    //## type as_common_dsp_config_t
    typedef _as_common_dsp_config_t_ as_common_dsp_config_t;
    
    //## type _pvu_freq_data_t_
    struct _pvu_freq_data_t_
    {
        boolean pvu_freq_valid;		//## attribute pvu_freq_valid
        timetag_t timetag;		//## attribute timetag
        hertz_t pvu_freq;		//## attribute pvu_freq
    };
    
    // * DBS/PVU datatypes *
    //## type pvu_freq_data_t
    typedef _pvu_freq_data_t_ pvu_freq_data_t;
    
    // * Single Target Track (STT)  Datatypes *
    //#[ type stt_mode_t
    typedef enum {
       stt_mode_air,
       stt_mode_ground
     }  stt_mode_t;
    //#]
}

//## attribute ::types_reverse::TopLevel.NUM_OF_STT_MODE
const RhpString NUM_OF_STT_MODE((stt_mode_ground+1));

namespace legacy
{
    //#[ type stt_instance_id_t
    typedef enum {
      stt_1,
      stt_2
    }  stt_instance_id_t;
    //#]
}

//## attribute ::types_reverse::TopLevel.NUM_INSTANCE_OF_STT
const RhpString NUM_INSTANCE_OF_STT((stt_2+1));

namespace legacy
{
    //#[ type track_id_t
    typedef enum {
      hpt,
      spt
    }  track_id_t;
    //#]
    
    //#[ type aastt_init_t
    typedef enum {
      aastt_init_idle,
      track_mode,
      non_track_mode
    }  aastt_init_t;
    //#]
    
    //#[ type aastt_transition_status_t
    typedef enum {
      stt_data_invalid,
      doppler_stt_data_invalid,
      stt_data_are_valid
    }  aastt_transition_status_t;
    //#]
    
    //#[ type stt_track_status_t
    typedef enum {
      stt_trk_idle,
      conf_guard,
      conf_delta,
      track,
      failed_conf
    }  stt_track_status_t;
    //#]
}

/* added for SR3 */

namespace legacy
{
    //#[ type mode_before_t
    typedef enum {
      mode_before_idle,
      gm_no_exp,
      gm_exp,
      dbs1_no_exp,
      dbs1_exp,
      dbs2_no_exp,
      dbs2_exp
    }  mode_before_t;
    //#]
}

/* added for SR9 */

namespace legacy
{
    //#[ type ground_mover_t
    typedef enum {
      no_mover,
      mover
    }  ground_mover_t;
    //#]
}

/* added for SR9 */

namespace legacy
{
    //#[ type aastt_dsp_common_t
    typedef struct {
    	dsp_mode_t		dsp_mode;
    	range_bin_t		prt;
    	range_bin_t		n_rbin;
    	freq_channel_t		tx_chan;
    	filter_index_t		stt_fil_start;
    	filter_index_t		stt_fil_stop;
    	n_int_t			n_fft;
            } aastt_dsp_common_t;
    //#]
    
    //#[ type aastt_sp_settings_t
    typedef struct {
    	selected_channels_t	selected_channels;
            hertz_t			dem_freq;
    	switch_channel_t        switch_cmd;
    	n_reg_clutter_t   	n_reg_clutter;
    	mti_code_t		mti_code;
    	mti_length_t		mti_length;
            fm_slope_t              fm_slope;
    	pulse_width_name_t	tx_pulse;
    	} aastt_sp_settings_t;
    //#]
    
    //#[ type aastt_agc_settings_t
    typedef struct {
    	range_bin_t		tgt_rgate;
    	int 			init_rgate;
    	range_bin_t		app_win_length;
    	validity_t		inu_valid;
    	metres_per_sec_t	vmbc_inu;
    	metres_per_sec2_t	vmbc_inu_der;
            decibel_t               mgc;
            boolean                 agc_reset;
    	} aastt_agc_settings_t;
    //#]
    
    //#[ type aastt_pp_settings_t
    typedef struct {
    	hertz_t			  mlc_freq;
     	range_bin_t		  stt_rb_start;
    	range_bin_t		  stt_rb_stop;
    	metres_t		  unamb_tgt_range;
    	hertz_t			  unamb_tgt_dopp;
     	active_t                  coast_flag;
            pure_number_t             sdr_before_coast;
            mti_code_t                mti_code;
            filter_index_t            mbc_dop_index;
            aastt_transition_status_t aastt_transition_status;
            pure_number_t             tracked_tgt_amplitude;
    	metres_t 		  baro_alt;
    	boolean 		  baro_alt_validity;
     	range_bin_t		  first_illuminated_rb;
    	range_bin_t		  last_illuminated_rb;
            metres_per_sec_t          ftt_range_rate_ms;         /* added this item for SR3 */
            unsigned int              num_guard_batch_conf;      /* added this item for SR3 */
            unsigned int              num_delta_batch_conf;      /* added this item for SR3 */
            stt_track_status_t        stt_track_status;          /* added this item for SR3 */
    	} aastt_pp_settings_t;
    //#]
    
    //#[ type aastt_tx_settings_t
    typedef struct {
            tx_duty_t               tx_duty;
    	} aastt_tx_settings_t;
    //#]
    
    //#[ type aastt_dsp_settings_t
    typedef struct {
            aastt_dsp_common_t	aastt_dsp_common;
    	aastt_sp_settings_t	aastt_sp_settings;
    	aastt_agc_settings_t	aastt_agc_settings;
    	aastt_pp_settings_t	aastt_pp_settings;
    	aastt_tx_settings_t	aastt_tx_settings;
    	} aastt_dsp_settings_t;
    //#]
    
    //#[ type main_meas_t
    typedef struct {
       		metres_t     	  	rng_tgt;
         		metres_per_sec_t  	vel_tgt;
          		float     	  	mr;
            	float     	  	snr_tgt;
    	       } main_meas_t;
    //#]
    
    //#[ type vcs_data_t
    typedef struct {
       		metres_per_sec_t    	vcs;
         		metres_per_sec2_t     	vcs1;
          		metres_per_sec3_t     	vcs2;
            	validity_t     		vcs_validity;
    		} vcs_data_t;
    //#]
    
    //#[ type dsp_aastt_common_t
    typedef struct {
      		dsp_mode_t		sp_mode_tb;
      		dsp_mode_t		agc_mode_tb;
      		dsp_mode_t		pp_mode_tb;
    		} dsp_aastt_common_t;
    //#]
    
    //#[ type pp_aastt_res_t
    typedef struct {
    		timetag_t		proc_pack_timetag;
    		range_bin_t		proc_prt;
    		freq_channel_t		proc_tx_channel;
    		hertz_t			proc_mlc_freq;
                    n_int_t                 np_fft;
    		boolean			jamm_flag;
    		unsigned short		num_of_measure;
    		main_meas_t 		meas[MAX_NUM_OF_MEASURES];
    		pure_number_t 		amp_tgt[MAX_NUM_OF_MEASURES];
                    validity_t              clutter_data_validity;
                    pure_number_t           clu_dist_average;
                    pure_number_t           clu_dist_pow;
                    hertz_t                 estimated_clutter_band;
                    float                   main_cfar_sensing;
                    float                   on_tgt_cfar_sensing;
                    float                   cw_cfar_sensing;
                    stt_track_status_t      pp_ftt_status;          /* added this item for SR3 */
    		} pp_aastt_res_t;
    //#]
    
    //#[ type agc_aastt_res_t
    typedef struct {
    		float			atten_tgt;
    		float			ampl_clutter_track;
    		vcs_data_t		vcs_data;
                    boolean                 ad_sat_flag;             /* added this item for SR9 */
    	       } agc_aastt_res_t;
    //#]
    
    //#[ type dsp_aastt_res_t
    typedef struct {
    		dsp_aastt_common_t	dsp_aastt_common;
    		pp_aastt_res_t		pp_aastt_res;
    		agc_aastt_res_t		agc_aastt_res;
    	       } dsp_aastt_res_t;
    //#]
    
    //#[ type freq_agility_settings_t
    typedef struct {
                     boolean                freq_group[MCP_FREQUENCY_GROUP_T_MAX + 1];
    /* Grifo-e */
                     freq_ag_type_t freq_ag_type;
    /* Grifo-e */
                     freq_channel_t         freq_channel;
                   } freq_agility_settings_t;
    //#]
    
    //#[ type avionic_settings_t
    typedef struct {
                     freq_agility_settings_t  freq_agility_settings;
                     waveform_t               waveform_command;
                     boolean                  gun_mode_active;
                   } avionic_settings_t;
    //#]
    
    //#[ type aastt_avionic_data_t
    typedef struct {
                     avionic_settings_t  	avionic_settings;
                     inu_data_t           	inu_data;
                   } aastt_avionic_data_t;
    //#]
    
    //#[ type trk_data_for_reacq_t
    typedef struct {
      		metres2_t	      tgt_range_var;
      		metres_t              tgt_range;
      		metres_per_sec_t      tgt_range_rate;
      		validity_t            tgt_rrate_val;
      		timetag_t             tgt_timetag;
      		radians_t             tgt_elevation;
      		radians_t             tgt_azimuth;
      		range_scale_t         range_scale;
      		waveform_t            waveform;
      		boolean               mprf_lookup;
                    acq_object_t            object;
      		} trk_data_for_reacq_t;
    //#]
    
    //#[ type position_vector_t
    typedef struct {
     		 validity_t             validity;
     	         metres_t		x_comp;
    	         metres_t	  	y_comp;
    	         metres_t	  	z_comp;
     		 validity_t             range_validity;
    	         metres_t		range; /* really the target range. */
    		 accuracy_t             accuracy;
                   } position_vector_t;
    //#]
    
    //#[ type velocity_vector_t
    typedef struct {
                     validity_t             validity;
    	         metres_per_sec_t	x_comp;
    	         metres_per_sec_t	y_comp;
    	         metres_per_sec_t	z_comp;
    	         metres_per_sec_t	module;
    		 accuracy_t             accuracy;
                   } velocity_vector_t;
    //#]
    
    //#[ type acceleration_vector_t
    typedef struct {
                     validity_t             validity;
    	         metres_per_sec2_t	x_comp;
    	         metres_per_sec2_t	y_comp;
    	         metres_per_sec2_t	z_comp;
    	         metres_per_sec2_t	module;
    		 accuracy_t             accuracy;
                   } acceleration_vector_t;
    //#]
    
    //#[ type estimation_vector_t
    typedef struct {
                     float  x;
    	         float	y;
    	         float	z;
                   } estimation_vector_t;
    //#]
    
    //#[ type aastt_dynamics_t
    typedef struct {
    	         position_vector_t	position;
    	         velocity_vector_t	velocity;
    	         acceleration_vector_t	acceleration;
                     validity_t             range_rate_validity;
    		 metres_per_sec_t	range_rate;
    		 validity_t		cas_mach_no_validity;
    		 metres_per_sec_t	cas;
    		 mach_no_t		mach_no;
    		 validity_t		aspect_angle_validity;
    		 radians_t		aspect_angle;
                     seconds_t		time_tag;
    		 boolean		target_in_coast;
    		 boolean		aoj_on_target;
    		 boolean		hoj_on_target;
                     estimation_vector_t    estimation_stdev;         /* added for SR1 */
                     ground_mover_t         ground_mover_indication;   /* added for SR9 */
                   } aastt_dynamics_t;
    //#]
    
    //#[ type antenna_cmd_t
    typedef struct {
    		 az_el_t		antenna_cmd;
                   } antenna_cmd_t;
    //#]
    
    //#[ type track_quality_t
    typedef enum {
                   trk_qual_not_active,
                   aoj,
                   hoj,
    	       normal_track,
    	       incomplete_track
    	     }  track_quality_t;
    //#]
    
    //#[ type hpt_graphics_t
    typedef struct {
    		 polar_vector_t		polar_position;
    		 radians_t		aspect_angle;
    /* Grifo-e */
    		 left_right_t aspect_angle_ind;
    /* Grifo-e */
    		 track_quality_t        status;
    		 track_quality_t        qualifier;
    		 radians_t		ground_track;
    		 metres_per_sec_t	ground_speed;
    		 radians_t		track_angle;
    		 radians_t		cata_azimuth;
    		 metres_per_sec_t	cas;
    		 mach_no_t		mach_no;
    		 metres_t		altitude;
                     mcp_time_t			time_to_go_to_hpt;
    		 freq_channel_t		tx_chan;
    		 band_indicator_t       band_indicator;
                     active_t               hpt_coast;
                     int                    ecm_alarm_status;
                     float                  target_rcs;
                     validity_t             as_angle_val;
                     boolean                quality_in_freeze;
                     unsigned short         jam_bars;
                   } hpt_graphics_t;
    //#]
    
    // * Scheduler  datatypes. *
    //#[ type app_driving_list_t
    typedef struct {
        	  unsigned   adl_onl_bit_mngr : 1;
    	  unsigned   adl_dsp_bit_mngr : 1;
    	  unsigned   adl_fpu_bit_mngr : 1;
    	  unsigned   adl_cal_mngr     : 1;
    	  unsigned   adl_aa_search    : 1;
    	  unsigned   adl_tgt_synth    : 1;
    	  unsigned   adl_tgt_vs       : 1;
    	  unsigned   adl_intf         : 1;
    	  unsigned   adl_ale_flc      : 1;
    	  unsigned   adl_aa_cmn_dsp   : 1;
    	  unsigned   adl_tgt_acq      : 1;
    	  unsigned   adl_agr_mngr     : 1;
    	  unsigned   adl_stt1         : 1;
    	  unsigned   adl_stt2         : 1;
    	  unsigned   adl_tgt_gmti     : 1;
    	  unsigned   adl_tgt_acm      : 1;
    	  unsigned   adl_as_cmn_dsp   : 1;
              unsigned   adl_tgt_tws      : 1;
      	  unsigned   adl_pvu          : 1;
      	  unsigned   adl_dbs          : 1;
    	  unsigned   adl_tgt_bcn      : 1;
    	  unsigned   adl_ta_mngr      : 1;      /* added for SR2 */
    	  } app_driving_list_t;
    //#]
    
    // * SAM & DTT  Datatypes *
    //#[ type sam_dtt_mode_id_t
    typedef enum {
      sam,
      dtt
    }  sam_dtt_mode_id_t;
    //#]
    
    //#[ type tracking_status_t
    typedef enum {
      trk_status_not_valid,
      full,
      cst
    }  tracking_status_t;
    //#]
    
    //#[ type sam_src_t_lim_t
    typedef struct {
      float   min_value;
      float   max_value;
      float   const_max;
    } sam_src_t_lim_t;
    //#]
    
    //#[ type spt_acq_t_lim_t
    typedef struct {
      float spt_min;
      float spt_max;
    } spt_acq_t_lim_t;
    //#]
    
    //#[ type hpt_acq_t_lim_t
    typedef struct {
      float hpt_min;
      float hpt_max;
    } hpt_acq_t_lim_t;
    //#]
    
    //#[ type spt_trk_t_lim_t
    typedef struct {
      float spt_trk_min;
      float spt_trk_max;
    } spt_trk_t_lim_t;
    //#]
    
    //#[ type stst_counter_t
    typedef struct {
      int stst_count_for_range;
      int stst_count_for_azimuth;
      int stst_count_for_elevation;
    } stst_counter_t;
    //#]
}

// **** MTT DATATYPES ************
//## attribute ::types_reverse::TopLevel.NUMBER_OF_FILTERS
const RhpString NUMBER_OF_FILTERS(12);

//## attribute ::types_reverse::TopLevel.MAX_NUMBER_OF_LATEST_OBSERVATIONS
const RhpString MAX_NUMBER_OF_LATEST_OBSERVATIONS(16);

//## attribute ::types_reverse::TopLevel.MAX_LAST_NUMBER_OF_CUMULATIVE_OBSERVATIONS
const RhpString MAX_LAST_NUMBER_OF_CUMULATIVE_OBSERVATIONS(MAX_NUMBER_OF_LATEST_OBSERVATIONS);

//## attribute ::types_reverse::TopLevel.MAX_LAST_NUMBER_OF_OBSERVATIONS
const RhpString MAX_LAST_NUMBER_OF_OBSERVATIONS(MAX_NUMBER_OF_LATEST_OBSERVATIONS);

//## attribute ::types_reverse::TopLevel.MAX_NUMBER_OF_PRIORITIZED_OBSERVATIONS
const RhpString MAX_NUMBER_OF_PRIORITIZED_OBSERVATIONS(MAX_NUMBER_OF_LATEST_OBSERVATIONS);

/***** TWS DATATYPES *************/

//## attribute ::types_reverse::TopLevel.NUM_MAX_OF_TRACKS
const RhpString NUM_MAX_OF_TRACKS(12);

//## attribute ::types_reverse::TopLevel.NUM_MAX_OF_SAVED_TRACKS
const RhpString NUM_MAX_OF_SAVED_TRACKS(NUM_MAX_OF_TRACKS);

//## attribute ::types_reverse::TopLevel.MAX_OUT_TRACK_TGTS
const RhpString MAX_OUT_TRACK_TGTS(NUM_MAX_OF_TRACKS);

//## attribute ::types_reverse::TopLevel.MAX_OBS_PER_BAR_NUM
const RhpString MAX_OBS_PER_BAR_NUM(16);

//## attribute ::types_reverse::TopLevel.NUM_OF_EOB_RECS
const RhpString NUM_OF_EOB_RECS(6);

//## attribute ::types_reverse::TopLevel.NUM_OF_TARGET_MAP_RECS
const RhpString NUM_OF_TARGET_MAP_RECS(( MAX_OBS_PER_BAR_NUM * NUM_OF_EOB_RECS ));

//## attribute ::types_reverse::TopLevel.MAX_OUT_SEARCH_TGTS
const RhpString MAX_OUT_SEARCH_TGTS(MAX_OBS_PER_BAR_NUM);

namespace legacy
{
    //#[ type state_and_covariance_t
    typedef struct
    {
        mat3_t      state_vector;
        mat3x3_t    covariance;
    } state_and_covariance_t;
    //#]
    
    //#[ type rhv_own_accelerations_t
    typedef struct
    {
      metres_per_sec2_t  range_own_acceleration;
      metres_per_sec2_t  vertical_own_acceleration;
      metres_per_sec2_t  horizontal_own_acceleration;
    } rhv_own_accelerations_t;
    //#]
    
    //#[ type rhv_manoeuvre_variances_t
    typedef struct
    {
      seconds_t          range_constant_manoeuvre;
      seconds_t          vertical_constant_manoeuvre;
      seconds_t          horizontal_constant_manoeuvre;
      metres_per_sec2_t  range_variance_manoeuvre;       /* (m/s/s)^2) */
      metres_per_sec2_t  vertical_variance_manoeuvre;    /* (m/s/s)^2) */
      metres_per_sec2_t  horizontal_variance_manoeuvre;  /* (m/s/s)^2) */
    } rhv_manoeuvre_variances_t;
    //#]
    
    //#[ type tws_track_estimation_record_t
    typedef struct {
     hertz_t                  sight_line_rate;
     state_and_covariance_t   range;
     state_and_covariance_t   azimuth;
     state_and_covariance_t   elevation;
    } tws_track_estimation_record_t;
    //#]
    
    //#[ type track_auxiliary_data_t
    typedef struct {
      waveform_t          waveform_det;
      pure_number_t       sdr_det;
      bar_number_t        bar_number_det;
      pure_number_t       amplitude_det;
      } track_auxiliary_data_t;
    //#]
    
    //#[ type track_file_t
    typedef struct {
      timetag_t                      track_update_time;
      timetag_t                      last_association_time;
      rhv_manoeuvre_variances_t      manoeuvre_parameters;
      tws_track_estimation_record_t  track_estimation_record;
      rhv_own_accelerations_t        inertial_own_ship_accelerations_RHV;
      track_auxiliary_data_t         track_auxiliary_data;
      } track_file_t;
    //#]
    
    //#[ type hpt_and_spt_data_t
    typedef struct {
      boolean                   hpt_present ;
      int                       hpt_track_id;
      boolean                   spt_present ;
      int                       spt_track_id;
    } hpt_and_spt_data_t;
    //#]
    
    //#[ type updated_tracking_data_t
    typedef struct
      {
       unsigned int                 n_updated_tracks;
       struct {
          int                      	track_id;
          track_file_t              track_file;
       } updated_track_data[ MAX_OUT_TRACK_TGTS ];
     } updated_tracking_data_t;
    //#]
    
    namespace legacy
    {
        //#[ type alg_init_command_t
        typedef enum {
          reset,
          hand_over
        }  alg_init_command_t;
        //#]
    }
    
    // Grifo-e 
    //#[ type range_observation_t
    typedef struct{
     metres_t            range;
     seconds_t           shift_compensation_factor;
     metres_per_sec2_t   range_variance;
     validity_t          rrate_val_flag;
     metres_per_sec_t    range_rate;
     metres2_per_sec2_t  range_rate_variance;
    } range_observation_t;
    //#]
    
    //#[ type azimuth_observation_t
    typedef struct{
     radians_t   azimuth;
     radians2_t  azimuth_variance;
    } azimuth_observation_t;
    //#]
    
    //#[ type elevation_observation_t
    typedef struct{
      radians_t   elevation;
      radians2_t  elevation_variance;
      low_high_t  elevation_accuracy;
    } elevation_observation_t;
    //#]
    
    //#[ type inertial_own_ship_t
    typedef struct{
    cartesian_velocity_vector_t  velocity;
    cartesian_accel_vector_t     accel;
    } inertial_own_ship_t;
    //#]
    
    //#[ type observation_auxiliary_data_t
    typedef struct{
     waveform_t     waveform_det;
     pure_number_t  sdr_det;
     bar_number_t   bar_number_det;
     metres_t       inertial_altitude;
     pure_number_t  amplitude_det;
    } observation_auxiliary_data_t;
    //#]
    
    //#[ type mtt_search_data_t
    typedef struct
      {
       int                 	processed_bar_index;
       struct {
          unsigned int      num_search_targets;
          struct {
             seconds_t	time_tag_det;
             metres_t     	range;
             radians_t    	nav_azimuth_det;
             radians_t     	nav_elevation_det;
             int            bar_number_det;
             waveform_t 	waveform_det;
             pure_number_t  sdr_det;
             metres_t       in_alt_ac_det;
             int            associated_track_id;
          } search_target_file[ MAX_OUT_SEARCH_TGTS ];
       } search_target_reports;
      } mtt_search_data_t;
    //#]
}

#endif
