nicolas.perenne.free.fr
GetWind reads the measurements from a CV3F anemometer (twice per second) and issues (on standard output) moving averages of these measurements. The program was developed for Linux: serial port handling would need to be adapted for it to work on Windows. Technical notice: I used the "canonical asynchronous" mode (cf. the tutorial of the Linux Documentation Project).
The number of values used in the averaging and the output frequency of the current average can be chosen on the command line:
root@OpenWrt:~# getWind -h Usage: getWind [-d file] [-k] [-a length] [-o period] [-c count] [-h] -d <file>: specify the device <file> (default: /dev/ttyUSB0) -k: keep listening even if nothing currently happens on the specified port (default: no) -a <length>: compute averages of <length> successive values (default: 10) -o <period>: output averages every <period> wind acquisition (default: 6) -c <count>: output <count> averages and exit (default: go on endlessly) -h : this help screen root@OpenWrt:~# getWind -d /dev/usb/tts/0 -a9 -o3 -c5 90.333333:0.000000:4.666667 180.666667:0.000000:11.666667 271.000000:0.000000:18.666667 271.000000:0.000000:21.000000 271.000000:0.000000:21.000000 root@OpenWrt:~#
Output is performed in a format suited to rrdtool update. From left to right one can find the wind direction in degrees, its speed in knots (0 here since the anemometer was... in a box) and the air temperature: the latter evidences the fact that if the output period is smaller than the averaging one (which is allowed), one need to wait several outputs before the averaging array no longer contains null values (so that the average reaches its "crusing" value).
The source code can be downloaded here.