One of the features I included in AAVOnline v1.1.0 was the ability to download METARs from NOAA. This feature was active but hidden in AAVOnline as it had not reached production level yet. Now for v1.1.2 I'm planning on making weather a key component to AAVOnline and in doing so I've come up with a very nice weather downloading system.

In v1.1.2 weather information for the departing and arriving airports will be displayed in a Marquee style label at the bottom of the screen. In the main window I have included a timer which goes out to the resource loader (shared memory used by AAVOnline) and uses the latest METARs for the airports then formats those into a string and updates the Marquee label. Below you will see the Timer's FSM:

AAVOnline Marquee Timer FSM

As you can see the timer is pretty simple and just displays the metars from the resource loader at every tick.

The next part of the system is the Download Weather Thread. It is responsible for getting the latest weather information into the resource loader every few minutes. To do this it sends a request to the local weather cache for the latest weather and blocks until it gets the weather. Having a thread block instead of the application blocking while a possible download of the weather is occuring is preferred so the user's experience is not changed. From here, the weather cache checks its local cache of metars for the weather station identified. If it can't find it or the metar has expired it goes out to a web service of mine and downloads the latest metar. Once the web service gets a request for a metar it then checks to see if it has a non-expired copy of the metar locally and returns it. If not, it FTP's into NOAA's site and downloads the metar and returns that, while caching it for future requests. Caching the metar on the server allows requests to be pooled assuming there are multiple pilots requesting the same weather station at almost the same time.

Here's a graphic showing the status thread as a FSM:
AAVOnline Download Weather Thread FSM

Finally here's a graphic showing the entire system:
AAVOnline Weather System

jeremiah's blog | 4139 reads