I'm attempting to implement position determination function of an aircraft to get "latitude/longitude azimuth" I attached 3 images for summerized formula as you may see this is 5-step trigonometric equation (Steps 0/4) which is my aim to program. image1; image2 image3
To find aircraft coordinates there are defined 9 input parameters (image1): Station U and S latitude,longitude,altitude; Aircraft altitude and 2 slant ranges. At the end of problem (image3) we will find 3 outputs: Aircraft latitude/longitude azimuth.
This code implements the solution explained for: How can I triangulate a position using two DMEs? on aviation.se. The code is in Python, which I happen to use instead of C, it's easy to convert into another language as required. I've broken down the calculation in smaller units to make code more legible and to ease your understanding.
The problem involves 3 points in 3D space: U and S are the DMEs, A is the aircraft.
As we just need the coordinates of U and S, to determinate A coordinates, I'm using coordinates of 3 well known DME stations. This will allow to check whether the result is correct. View based on the Low Altitude Enroute Chart:
When the program is run, the output is:
First are the coordinates of points U (CAN DME) and S (EVX DME) we entered, and then two lines for the two possible location of the aircraft.
I made another test with DME at longer distance (1241 km for ARE and 557.1 km for GLA) which worked pretty good too:
The actual location of the aircraft is supposed to be SZA navaid, in south of France: Lat 41.937°, lon 9.399°.