Jump to content
The simFlight Network Forums
dagoston93

How to find the distance from a particular radio station?

Recommended Posts

Hi,

I am working on a home cockpit design with self-designed hardware and software.
At the moment I am working on the software that handles communication between my hardware and FSX.
On the software side I am using an A2A Cessna 172 since it looks to be quite a realistic plane.

But it is not easy to get every data i need from that plane. At the moment I am trying to get some info from the DME.
If the DME is set to the RMT mode, it checks the NAV1 radio if the station tuned has DME and reads the distance and the relative GS to it.
It is relatively easy to find.

But if it is in FRQ or GS/T mode, you can tune a separate DME station and get the distance and GS from it.
And that is where i got stuck. Because it is not stored in any LVars neither in any offsets, as far as i could find out.

So I am thinking if it would be possible to get the coordinates of the nearest radio station with a given frequency?

And if i somehow have those coordinates as far as i know, i could use the  class provided to calculate the distance between those coordinates and the current position of the plane.

Maybe I would need to write an XML instrument and put some data in LVars?

Or would i need to load somehow the FS navigation radio database?

Has anyone got any ideas or advices?

Thanks in advance for any help,

Agoston

 

Share this post


Link to post
Share on other sites

Hi Agoston,

The solution depends on how A2A have coded the aircraft. If it's using the standard FS facilities then you should be able to find the info in one of the offsets.

For example, if it's tuning the NAV2 radio in the background you could check the DME2 distance (0x0C33), the DME2 Lat/Lon (0x0834 & 0x0838), or maybe the VOR2 Lat/Lon (0x0858 & 0x0860). There a few other such offsets near those so have a look at the offsets list.

If it's not setting the NAV2 or NAV1 radio then FSUIPC won't be able to help.

In that case you'll need to ask A2A if you can get access to any of the information (e.g. Via LVARS or some other method). If you can at least get hold of the frequency you have tuned then you can query a database of NAVAIDS (with Frequency and Lat/Lon) if you can find one.  Unfortunately neither FSUIPC nor my DLL can help with such a database.

If you manage to get the location of the tuned NAVAID you can use FsLatLon class to calculate the distance.

Paul

 

 

 

 

Share this post


Link to post
Share on other sites

Hi,

Thank you very much for your answer.
I was trying to find it in the LVars but unfortunately I couldn't find anything like that there.
And  also tried the DME2 offsets but they contain info about the station tuned into NAV2.

I hope A2A will have some idea. Hopefully i have overlooked something.
And by the way thank you for the dll. It is extremely helpful tool 🙂
First I have tried using SimConnect but it was terrible experience because of the lack of proper documentation and good examples.
Your dll makes it a lot quicker and more easily understandable to develop for FS 🙂

Best wishes,

Agoston

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.