(Live) METAR weather data for Aerofly FS 2

  • For me weather is one of the main challenging aspects of every flight simulator. Aerofly FS 2 offers some controls to change the in-game weather - but I always forgot about them, or did not take the time to set them to real world conditions, let alone set the time correctly. But wouldn't it be cool to set the weather conditions (and time) to real-life conditions by just the press of a button? To brave the the same wind conditions, wind gusts, or dark and foggy nights like real-world pilots have to do right now?

    Actually there are plenty of sources for real-world aviation weather in a machine readable format called METAR. On the other hand Aerofly FS 2 stores its weather settings in its main configuration file. So...

    I build a small tool called Aerofly-Weather (short: AeroWX) which copies the METAR weather and time information to your configuration file while Aerofly FS 2 is not running. AeroWX imports METAR weather information from an internet service (like AVWX and CheckWX) or accepts direct input of METAR strings (e.g. to supply METAR data for your favourite hurricane).

    Keep in mind that while your simulation is running, your weather will not be updated. You may set your weather before starting AFS2, but the tool cannot change it while AFS2 is running (as for now).

    AeroWX has been tested on Windows 10 and the STEAM-version of AFS2. AeroWX is a little rough around the edges, comes with no warranty or support of any kind, is a strain on the eyes, requires you to actually read its manual, and its installation requires Node.js and at least three terminal commands. You have been warned. ;)

    So here it is: https://www.npmjs.com/package/aerofly-weather

    (P.S.: Cross-posted from Steam's Aerofly FS 2 forum)

  • Indeed I just took a quick look at the sample DLL files. I already found some stuff which spark my interest. Without any actual knowledge of the API I found:

    • "Aircraft.NearestAirport" could be used to get the nearest ICAO code and fetch the weather.
    • "Aircraft.Wind" could be used to set the wind (direction? strength?).
    • "Simulation.Visibility" could be used to set the visibility.
    • "Simulation.Time" could be used to set / read the time.

    Sadly I did not find methods to set turbulence, thermal activity, cloud layer 1-3 and date. Does someone know if there are methods to set these?

  • Indeed I just took a quick look at the sample DLL files. I already found some stuff which spark my interest. Without any actual knowledge of the API I found:

    • "Aircraft.NearestAirport" could be used to get the nearest ICAO code and fetch the weather.
    • "Aircraft.Wind" could be used to set the wind (direction? strength?).
    • "Simulation.Visibility" could be used to set the visibility.
    • "Simulation.Time" could be used to set / read the time.

    Sadly I did not find methods to set turbulence, thermal activity, cloud layer 1-3 and date. Does someone know if there are methods to set these?

    I don't think these messages are documented but we use very good naming conventions, so Simulation.Turbulence or Aircraft.Turbulence could already be what you need.

  • Hej Jet-Pack, could you point me in the right direction on what components to install to MS Visual Studio to compile the DLL example? As of now I get tons of errors like "cannot open source file 'errno.h'" and "the global scope has no 'floorf'". As a newcomer to the world of C++ I don't get it, and Stackoverflow is no help either.

  • OK, I have a clean install Visual Studio Community 2017 on Windows 10 - 1809. Ticked the boxes for :

    • Visual Studio Core Editor
    • Desktop development for C++
    • Game development with C++
    • Individual components > Windows 8.1 SDK (as the project told me it was required)

    I checked the

    • VC++ Include Directories, it says "$(VC_IncludePath);$(WindowsSDK_IncludePath);".
    • VC++ Library Directories, it says "$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(NETFXKitsDir)Lib\um\x86"

    In tm_external_message.h the following errors occur:

    • Error (active) E1696 cannot open source file "assert.h" ...\shared\input\tm_external_message.h 37
    • Error (active) E1696 cannot open source file "math.h" ...\shared\input\tm_external_message.h 38

    ...among 421 Build + IntelliSense errors. :?

  • Okay, I build myself a small roadmap:

    1. NodeJS command line tool (done, see https://www.npmjs.com/package/aerofly-weather)
    2. NodeJS desktop application (done, see https://www.npmjs.com/package/aerofly-weather)
    3. C++ command line tool (done, but not published yet, because it does essentially the same as the NodeJS CLI tool - but is it a good foundation for the next steps…)
    4. C++ desktop application (I am working on that - this will be way smaller than the NodeJS desktop application)
    5. C++ DLL (integrates right into Aerofly FS 2)

    I am still learning C++ (currently unit testing and DLL building), so the progress is somewhat slower than with NodeJS, but I am confident I'll eventually finish the project. ;)

    My current idea for the DLL:

    • On entering the cockpit you have to enable the METAR updater. (My current idea is to switch your radio to a certain channel to activate the METAR updater - to deactivate the METAR updater you'll just have to change the channel. ^^)
    • The DLL detects the nearest airport, and loads time and weather into the simulation.
    • As long as the METAR updater is active, every X minutes or on detecting a new nearest airport new weather will be downloaded and the current weather will be gradually changed.

    The big benefit is that for long flights and on spontaneous changes of your location the METAR updater will still do its job, while the current tools/applications only allow for setting the weather while the simulation is not running.

    As for the demo DLL project: I have a fellow programmer look into that. Being new to C++ / Visual Studio / desktop programming makes it somewhat hard to grasp the exact reason for above error messages.

    1. C++ desktop application (I am working on that - this will be way smaller than the NodeJS desktop application)
    2. C++ DLL (integrates right into Aerofly FS 2)

    I like the idea of a dynamically updating weather app.

    Why not save yourself the hassle of C++ and do a C# GUI app?

    I've been meaning to write a C# wrapper example for an Aerofly Plugin, it'd probably be useful for several applications.

    AeroScenery - Easily create photoreal scenery for Aerofly

  • I've been meaning to write a C# wrapper example for an Aerofly Plugin, it'd probably be useful for several applications.

    Well, actually the idea of doing it in C++ was mainly because the example DLL was written in C++. If you happen to do a DLL wrapper in C#, I'll gladly take a look at it.

  • Well, actually the idea of doing it in C++ was mainly because the example DLL was written in C++. If you happen to do a DLL wrapper in C#, I'll gladly take a look at it.

    What I mean is that you can do a very simple plugin DLL in C++ that takes weather information and sets it in the sim, do the GUI and everything else in C# and make them talk with some kind of IPC (named pipes, UDP, TCP, shared memory).

    You could even keep your existing Node GUI with that method.

    The wrapper would be for writing the logic of AF plugin itself in C#. You don't necessarily need it to do some of this in C# or Node.

    Windows GUI programming in C++ isn't much fun, so just throwing that out there.

    AeroScenery - Easily create photoreal scenery for Aerofly

  • It's me again. By now I have completed step 4 of my roadmap to live weather in Aerofly FS2 and present the Aerofly Wettergerät. Like its predecessor it copies METAR weather reports into your AFS2 configuration file, and comes as a command-line utility as well as a desktop application:

    aerofly.com/community/gallery/index.php?image/494/

    It is somewhat uglier than "Aerofly-Weather" (AeroWX), but more than ten times smaller in download size, has a smaller memory footprint, and does not require a manual (until you run into trouble) or any secondary software anymore.

    Even more important: It is the last step I needed to finish before tackling step 5, the integrated "Aerofly Wettergerät DLL", which will update weather while AFS2 is running, without any further button mashing required. As the demo DLL now compiles on my rig and the first relevant symbols have been exchanged, I am confident that step 5 is in our reach, even though it may take some considerable time. I'll keep you posted.

  • Free and open-source. I talked to my tax guy about donations services like "Buy me a coffee", but after listening for 15 minutes to explanations about German tax laws I chose to generously donate my work to the public. ;)

    The open-source parts also allows for reusing components like the METAR parser, the miniature REST client or the METAR-Aerofly converter in any other project, only restricted by a rather simple license. So even if I fail at phase 5, another genius could take over and finish the job. ;)

  • Hallo Armitage,

    vielen Dank für das tolle kleine Tool Wettergeraet! Ich habe aber ein Problem mit dem --file Befehl. Das Verzeichnis "Documents" ist bei mir unter Windows 10 an einen anderen Ort verschoben worden, so dass ich den Pfad zu der Datei main.mcf manuell eingeben muss. Das bekomme ich aber irgendwie nicht hin. Kannst Du ein Beispiel für die Syntax des --file Befehls geben? Ich scheine da was falsch zu machen.

    Vielen Dank und viele Grüße

    Jürgen

    Viele Grüße
    Jürgen

  • Da ist aktuell ein Fehler in der Dokumentation in Bezug auf den "File"-Parameter. Der korrekte Aufruf sieht wie folgt aus:

    aerofly-desktop.exe "C:\User\...\main.mcf"

    Ggf. ohne Anführungszeichen ausprobieren. Derweil korrigiere ich die Dokumentation und Parameter-Behandlung. ;)

    --

    There is a documentation error regarding the "file" parameter. I fix the documentation as well as the parameter handling.

  • Danke für die Infos. Ich habe zwar noch etwas gebraucht, aber ich denke, jetzt geht es. In den Eigenschaften der Verknüpfung muss unter Ziel der folgende Eintrag gemacht werden (in meinem Fall):

    "I:\AFS2 Addons\Wetter\Aerofly Wettergeraet\aerofly-wettergeraet-desktop.exe" "F:\Benutzer\....\Aerofly FS 2\main.mcf" (da muss natürlich der individuelle Pfad vollständig eingetragen sein).

    Thanks for the info. I still needed something, but I think I can do it now. In the link properties you have to make the following entry under target (in my case):

    "I:\AFS2 Addons\Weather\Aerofly Wettergeraet\aerofly-wettergeraet-desktop.exe" "F:\User\....\Aerofly FS 2\main.mcf" (of course the individual path has to be entered completely).

    Viele Grüße
    Jürgen

  • Thanks for the info. I still needed something, but I think I can do it now. In the link properties you have to make the following entry under target (in my case):

    "I:\AFS2 Addons\Weather\Aerofly Wettergeraet\aerofly-wettergeraet-desktop.exe" "F:\User\....\Aerofly FS 2\main.mcf" (of course the individual path has to be entered completely).

    Thank you for your patience, VFRPilot . I build an updated version of the Wettergerät, which now supports the documented as well as the old way of supplying a custom main.mcf file position.

    I also improved upon Wettergeräts's documentation, which now explains on how to change the parameters for the desktop application, the way you did it. ;)


    ---

    Danke für deine Geduld, Jürgen. Mit deiner Hilfe habe ich sowohl das Programm als auch die Anleitung verbessert und bereitgestellt. Wenn bei dir alles soweit funktioniert, brauchst du das Update nicht. Aber der nächste Nutzer freut sich darüber, dass du ihm den Weg bereitet hast. :)