# ****************************************************************************
# 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.
# ****************************************************************************
# * * ************************************** * *
# *   ****** Demonstration input file ******   *
# *   ******      UNCLASSIFIED        ******   *
# * * ************************************** * *

infrared_signature LARGE_SAM_INFRARED_SIGNATURE
   constant 1 watts/steradian
end_infrared_signature

optical_signature  LARGE_SAM_OPTICAL_SIGNATURE
   constant 1 m^2
end_optical_signature

radar_signature    LARGE_SAM_RADAR_SIGNATURE
   constant 1 m^2
end_radar_signature

platform_type LARGE_SAM WSF_PLATFORM
  icon SA-10_Missile

  infrared_signature LARGE_SAM_INFRARED_SIGNATURE
  optical_signature  LARGE_SAM_OPTICAL_SIGNATURE
  radar_signature    LARGE_SAM_RADAR_SIGNATURE

  mover WSF_STRAIGHT_LINE_MOVER
     average_speed                 2643.0 kts  # mach 4
     maximum_lateral_acceleration  20.0 g
     guidance_mode                 lead_pursuit
  end_mover

  processor fuse WSF_AIR_TARGET_FUSE
     max_time_of_flight_to_detonate  27.0 sec  # 25 nm range
  end_processor

  processor seeker WSF_PERFECT_TRACKER
     update_interval  0.5 s
  end_processor
end_platform_type

weapon_effects LARGE_SAM_EFFECT WSF_GRADUATED_LETHALITY
   radius_and_pk  100.0 m  0.7
   script void on_weapon_target_engagement(WsfPlatform aTarget)
      writeln("T=",TIME_NOW," Weapon Engagement",
              "; Start Time: ", StartTime(),
              "; Elapsed Time: ", TimeSinceStarted(),
              ", Serial: ", SerialNumber());
      WsfPlatform target = aTarget;
      WsfPlatform weapon = WeaponPlatform();
      if (! (target.IsValid() && weapon.IsValid())) return;

      writeln(" Weapon Name      : ", weapon.Name());
      writeln(" Target Name      : ", target.Name());

      writeln(" Weapon Loc       : ", WeaponLocation().ToString());
      writeln(" Target Loc       : ", TargetLocation().ToString());

      writeln(" Weapon Launch Loc: ", WeaponLocationAtLaunch().ToString());
      writeln(" Target Launch Loc: ", TargetLocationAtLaunch().ToString());

      writeln(" Miss Distance    : ", MissDistance());
      writeln(" Pk               : ", Pk());
      writeln(" Pk Degrade       : ", PkDegrade());

      writeln(" Heading          : Weapon: ", weapon.Heading(), ", Target: ", target.Heading(),
    	       ", Diff=", target.HeadingDifferenceOf(weapon));
      writeln(" Speed            : Weapon: ", weapon.Speed(), ", Target: ", target.Speed());
      writeln(" Range            : ", weapon.SlantRangeTo(target));

   end_script
end_weapon_effects

weapon LARGE_SAM WSF_EXPLICIT_WEAPON
   launched_platform_type LARGE_SAM

   weapon_effects LARGE_SAM_EFFECT

   quantity               4

   firing_delay           0.5 sec
   salvo_interval         5.0 sec

   slew_mode              azimuth_and_elevation
   azimuth_slew_limits    -180.0 deg 180.0 deg
   elevation_slew_limits  10.0 deg  70.0 deg
end_weapon
