Ok, this is how I'm going to solve this mess. first, we know two things :
- We know where the aircraft is in three dimensions: Lat, Lon, and Alt (above sea level)
- We know where the Station is in three dimensions: Lat, Lon, and Antenna (above sea level)
Now that we know both locations on the Earth, we can then use Great Circle math to determine the distance between both objects:
d = acos(cos(lat1 - lat2) - (1 - cos(lon1 - lon2)) * cos(lat1) * cos(lat2)); if d is the distance between the objects on the line of H greater than 200 miles do the following: Set the FLAG to OFF; otherwise we need the height above sea level for the antenna and the aircraft, the aircraft is data is available from the simulator itself, while the antenna information is from FAA Navaids Database so let's pick Fort Worth NAS JRB TACAN (108700: 32.7714996337891: -97.4394989013672: 663; in order Freq (Khz, Lat, Lon, elevation in feet. So we know the height of the antenna which is 663 feet. We know from our simulator that the aircraft is at 15,000 feet above sea level so we have to subtract the 663 from the 15, 000 to arrive at 14,337 feet adjusted. So now we can generate R or the Slant Range by solving for the hypotenuse of a right triangle: square root ( H2+Alt2) or in C as
slant Range = sqrt(SQ(H)+SQ(Alt)); Set the FLAG to ON and Set TO-FROM to TO and Send the Distance to the DME readout, and start sending the station ID via Morse Code to the pilot on the audio channel. Now you must remember that this only works if the pilot flying the aircraft has tuned to the correct station. In real life, you should not have picked this station as you will have to fly into a NOFLY ZONE. Oh if you were keeping up the Slant Range works out to 200 nm.
I guess there will have to be some as I have not solved this equation yet:
R2=re2+(re+H)2-2re(re+H) cos α which will yield the correct slant range.
Addendum: April 26, 2023 I just happened to find the equation at any Latitude at Sumit.org:
D= f(Φ,Z,G) = (√[((a4 cos2 Φ + b4 sin2 Φ a2)/(cos2 Φ + b2 sin2 Φ)) + 2 (Z+G)√( a2 cos2 Φ + b2 sin2 Φ) + (Z+G)2 ]
D is the distance to the Center of the Earth
Φ is the latitude (the angle measured north or south from the equator)
Z is the height above sea level (i.e., the elevation of the point on the Earth, such as a summit)
G is the geoid height above or below the ellipsoid (the user must also know the longitude of the point in question)
a is the semimajor axis (the equatorial diameter of the Earth)
b is the semiminor axis (the pole-to-pole diameter)
The units must be consistent across the equation. If Z is in meters, a, b, and G must be in meters. If Z is in feet, a, b, and G must be in feet.
The WGS 84 ellipsoid defines a and b as:
a = 6,378,137.000 meters = 20,925,646.3255 ft
b = 6,356,752.314 meters = 20,855,486.5945 ft