# ****************************************************************************
# CUI
#
# The Advanced Framework for Simulation, Integration, and Modeling (AFSIM)
#
# The use, dissemination or disclosure of data in this file is subject to
# limitation or restriction. See accompanying README and LICENSE for details.
# ****************************************************************************
###############################################################################
#                          ------ UNCLASSIFIED ------
#                  BLUE_SR_SAM - Complex (with uplink and seeker)
###############################################################################
#
# ***** WARNING ***** WARNING ***** WARNING ***** WARNING ***** WARNING *****
#
# This definition is intended to be EXPORTABLE. It is defined using publicly
# available, attributable sources. DO NOT ADD ANYTHING BASED ON OTHER SOURCES!
#
# ***** WARNING ***** WARNING ***** WARNING ***** WARNING ***** WARNING *****
#
###############################################################################
#
# This BLUE_SR_SAM representation extends upon the baseline seeker representation
# by providing a datalink and a seeker.
#
# References:
#
# 1) http://www.globalsecurity.org/space/systems/patriot-ac-3.htm
#
#    "The missile flies to an intercept point specified prior to launch by its
#    ground-based fire solution computer, which is embedded in the engagement
#    control station. Target trajectory data can be updated during missile flyout
#    by means of a radio frequency uplink/downlink. Shortly before arrival at the
#    intercept point, the PAC-3 Missile's on board Ka band seeker acquires the
#    target, selects the optimal aim point and terminal guidance is initiated.
#    The ACMs, which are small, short duration solid propellant rocket motors
#    located in the missile forebody, fire explosively to refine the missile's
#    course to assure body-to-body impact.
###############################################################################

include blue_sr_sam_common.txt

###############################################################################

platform_type BLUE_SR_SAM BLUE_SR_SAM_BASE

   comm datalink WSF_COMM_TRANSCEIVER
      internal_link data_mgr
   end_comm

   # The seeker is modeled very simplisticly. There is no performance data.
   # This is really just a method to model seeker errors.

   sensor seeker WSF_GEOMETRIC_SENSOR
      off

      frame_time                       0.1 sec

      azimuth_field_of_view            -70 deg 70 deg
      elevation_field_of_view          -70 deg 70 deg
      maximum_range                    50 km

      maximum_request_count            1

      range_error_sigma                1 m
      azimuth_error_sigma              0.001 deg
      elevation_error_sigma            0.001 deg

      filter                           WSF_KALMAN_FILTER
         process_noise_sigmas_XYZ      50 50 50
         process_noise_model           constant_acceleration
      end_filter

      reports_range
      reports_bearing
      reports_elevation
      reports_velocity

      internal_link data_mgr
   end_sensor

   processor data_mgr WSF_WEAPON_TRACK_PROCESSOR
   end_processor

   # Modify the guidance processor such that when it enters TERMINAL phase
   # that it turns on the sensor and starts tracking the target. During this
   # phase we guide to perception to allow the introduction of errors.

   edit processor guidance
      edit phase TERMINAL
         guide_to_truth false

         on_entry
            WsfSensor seeker = PLATFORM.Sensor("seeker");
            WsfTrack targetTrack = PLATFORM.CurrentTargetTrack();
            if (seeker.IsValid() &&
                targetTrack.IsValid())
            {
               seeker.TurnOn();
               seeker.StartTracking(targetTrack, "");
            }
         end_on_entry
      end_phase
   end_processor

end_platform_type

