Overview
The weather station software is composed of three major parts:
- Data capture and processing.
- Animated weather station.
- Data display.
Data capture and processing
Data is captured from the WS2300 and processed by a background
program running on a Linux system. This program is written in C
and uses the low level device access functions from the open2300
project. Once the raw data has been read it is processed to create
a number of standard meteorological data items (wind direction,
speed, temperature, rain fall etc.), these values are then written
as a time-stamped record to one or more data files:
- Current weather. Updated every 8 seconds and contains a
single record giving the current weather conditions.
- 10 minute data file. Has a new record appended every 10
minutes and is the main weather data source.
- 1 Hour data file. Has a new record appended every 1 hour
which consists of down-sampled data from the 10 minute data.
- 24 Hour data file. Has a new record appended every 24 hours,
again down-sampled from the 10 minute data.
The main processing performed by the program is to generate
processed versions of the WS2300 data:
- Vector based wind direction (combining both velocity and
direction information), to provide a standard wind direction
value.
- Standard 10 minute wind speed data.
- Maximum and minimum values for temperature etc.
- Rates of change for pressure, temperature, rainfall etc.
Wind speed and direction raw values are read every 8 seconds
(the sample rate of the WS2300), other items are read over a 2
minute cycle. The actual reading of non wind data is offset to
ensure that the 8 second wind update can always be performed. This
current measurements are written every 8 seconds to the current
weather file (actually stored in a ram disk), the main data file
is updated every 10 minutes and the other data files are created
using down-sampled data (averages, min/max etc) as required. The
data files are checked and corrected when the program starts. If
for some reason readings are missed (computer crash, WS2300
problems etc.), then the program will generate dummy values for
the missing data.
Animated weather station
This software provides an animated display of the current
weather data in a standard web page. The program consists of a
Javascript front end with php back end components. The graphical
gauges and dials are produced using a combination of dynamic html
and on the fly generated gif images. All of the required images
are cached when the program starts and after that only the weather
station readings are read over the network. These readings are
obtained using an Ajax based interface using the cpaint2 package.
On the server side a small php program reads the current weather
record from the ram disk file and then returns the results using
cpaint's JSON data format. This data is then used by the
Javascript front end to update the display. In addition to the
animated display, small "tool tip" style graphs may be
displayed of recent readings. The tooltip support is provided by
open source wz_tooltip package. The actual graphs are generated
using the php scripts described below.
Data display
The final part of the system is the software supporting the
display of daily, weekly and monthly weather data as a series of
graphs. The graphs are created as an on the fly generated gif
image (one per graph). This image is created by a php program that
obtains the weather data (filtered for time/date etc.), from the
above files, processes it and then uses a modified version of
Herman Veluwenkamp's php graph package. These graphs are then
displayed (via a further php program), in a web page.
|