Files
lab1/weapons/sam/large_sam_launch_computer.txt
2025-09-12 15:20:28 +08:00

49 lines
1.7 KiB
Plaintext

# ****************************************************************************
# 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 ****** *
# * * ************************************** * *
# Launch/engagement computer for the Large SAM
script bool Large_SAM_LaunchComputer(WsfTrack aTrack,
WsfPlatform aLauncher,
string aEnvelopeName,
double aLaunchDelay)
bool canIntercept = false;
# TODO assuming launcher at 0 alt. need AGL of target
double tgtAlt = aLauncher.RelativeAltitudeOf(aTrack);
double maxTOF = 0.0;
double avgSpd = 0.0;
double maxRng = 0.0;
double shootDelay = 0.0;
# simple wpn-spd data for now
maxRng = 25.0 * 1852.0; # 25 nautical miles
maxTOF = 27.0;
avgSpd = 2643.0 * 1852.0 / 3600.0; # kts -> m/sec
WsfWaypoint intercept = WsfWaypoint();
double tti = aLauncher.InterceptLocation2D(aTrack, intercept, avgSpd, aLaunchDelay + shootDelay);
if ((tti > 0.0) && (tti < maxTOF))
{
double lat = intercept.Latitude();
double lon = intercept.Longitude();
WsfGeoPoint point;
point = point.Construct(lat, lon, tgtAlt);
canIntercept = point.WithinZoneOf(aLauncher, aEnvelopeName);
}
return canIntercept;
end_script