The A2A Simulations Community

"Come share your passion for flight"
It is currently Tue Dec 11, 2018 9:05 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Tue Jul 03, 2018 5:45 am 
Offline
Airman Basic

Joined: Tue Jul 03, 2018 5:06 am
Posts: 1
So I was looking for a method to have actual (newer) airport procedures in the C182 using the F1 GTN series, and after I looked for every way of updating the NAV data in the GTN, the only method is to buy the expensive update from GARMIN. The only short circuit is to use the user waypoint feature. But, that is actually time consuming as I found out while going to Cluj (LRCL) and I had to insert the ATSOS arrival (DME arc with 10 waypoints). My current GTN install (bought it last Friday) is 1611. My NavData current AIRAC (I buy a cycle once a year) is 1703. So how to be able to insert those newer arrivals/approach procedures.

Let's say I want to do a flight from Innsbruck (LOWI) to Strasbourg (LFST). Because the user waypoint limit on the GTN units is 1000, I have to stay bellow this number so I definitely can't insert the whole world in - Austria has about 600 points while France has about 3000. So my idea was to choose from my NavData Waypoint.txt file only those fixes that are within 30 NM from LOWI and LFST. So 30 miles from your departure and destination airports. Don't worry about radio navaids as they are usually older so already in the database.

This way I can create a custom procedure - inserting waypoints and smartly using the vertical navigation to obey the procedure on the chart (you need the charts, of course, as GTNs don't let you make custom procedures. Just remember to import your custom waypoints before the flight - maybe delete the old ones so that you have enough memory on the GTN.

Now the implementation...

For this I used the KLN 90B Navdata installed by NAVDataPro in my X-Plane installation, but I can definitely use anything that looks like this:

CTBRT|44843492|-117811486|K1
CTC01|-33910950|18625992|FA
CTC04|-34049367|18555842|FA
CTC06|-33865422|18849819|FA
CTC07|-33951367|18441983|FA
CTC08|-33955661|18347758|FA
CTC09|-33824014|19209500|FA
CTC11|-33618278|18736942|FA
CTC14|-34023358|18682425|FA
CTC15|-33883558|19065564|FA

so look in your navdata's for the waypoint file and remember the format.
The rest is just C++. I am going to put it in here, you just have to know a little programming and make a project in Visual Studio/Linux. By the end you'll have a little file that contains only those necessary waypoints and you will have to copy-paste the whole thing into your ...\SteamLibrary\steamapps\common\FSX\F1GTN\userwpt.txt file.

Code:
#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <string>
#include <cstdlib>


int main()
{
   std::ifstream input("WPTs.txt", std::ifstream::in);
   std::ofstream output("userwpt.txt", std::ofstream::out);

   float controlLAT = 47.260;
   float controlLON = 11.344;

   std::string line = "";
   std::string formattedLine = "";
   char buff_line[50];

   while (input.getline(buff_line, 50)) {
      line.assign(buff_line);
      size_t name = line.find("|");
      size_t lat = line.find("|", name + 1);
      size_t lon = line.find("|", lat + 1);
      size_t end = line.find("|", lon + 1);
      float latitude = 0.0;
      float longitude = 0.0;

      //if (line.substr(lon + 1, end - lon - 1).compare("LT") != 0)
      //   continue;

      formattedLine = line.substr(0,name);
      formattedLine += ",,";
      formattedLine += line.substr(name + 1, lat - name - 1);
      if ((lat - name) > 6) {
         formattedLine.insert(formattedLine.size() - 6, ".");
         latitude = atof(line.substr(name + 1, lat - name - 1).c_str()) / 1000000.;
      }
      else {
         formattedLine += ".0";
         latitude = atof(line.substr(name + 1, lat - name - 1).c_str());
      }

      formattedLine += ",";
      formattedLine += line.substr(lat + 1, lon - lat - 1);
      if ((lon - lat) > 6) {
         formattedLine.insert(formattedLine.size() - 6, ".");
         longitude = atof(line.substr(lat + 1, lon - lat - 1).c_str()) / 1000000.;
      }
      else {
         formattedLine += ".0";
         longitude = atof(line.substr(lat + 1, lon - lat - 1).c_str());
      }

      if (fabs(controlLAT - latitude) > 0.5 || fabs(controlLON - longitude) > 0.5)
         continue;

      size_t wrongCheck = 0;
      while (formattedLine.find(",.", wrongCheck) != std::string::npos) {
         wrongCheck = formattedLine.find(",.", wrongCheck);
         formattedLine.insert(wrongCheck + 1, "0");
         wrongCheck++;
      }
      wrongCheck = 0;
      while (formattedLine.find(",-.", wrongCheck) != std::string::npos) {
         wrongCheck = formattedLine.find(",-.", wrongCheck);
         formattedLine.insert(wrongCheck + 2, "0");
         wrongCheck++;
      }

      output << formattedLine << std::endl;
   }

   input.close();
   output.close();
    return 0;
}


I know it's quite raw, but we need a fast and easy solution and I don't have and don't want to go into InstallShield Lite bla bla BS. You will have to place a WPTs.txt file containing all your NAVData waypoints into the same folder as the application run-time folder and you will have to change controlLAT and controlLON to the latitude and longitude of the airports you want to have the fixes for. You can also change the radius the fixes are computed for at line:
Code:
if (fabs(controlLAT - latitude) > 0.5 || fabs(controlLON - longitude) > 0.5)
         continue;


In this case 0.5 means 30 minutes of degree which is about 30 nm at 45 degrees latitude. You can check this info out on the internet for your latitude. As you can see, all values are degrees and fractions of them so be careful, as you customize this for your flight. You can use this site for conversions.

After all this, for my LOWI-LFST flight, I have a userwpt.txt file that contains only 195 waypoints (most of them already in the GTN database).

Hope this helps,
Adrian


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group