WH1080

902 views
Skip to first unread message

janc

unread,
Jun 2, 2011, 2:57:03 PM6/2/11
to wfrog-users
Is this a solution to solv the problems with the wh1080 driver for the
compateble wh1080 weatherstations
see events

## Copyright 2010 Laurent Bovet <lauren...@windmaster.ch>
## derived from pywws by Jim Easterbrook
##
## This file is part of wfrog
##
## wfrog is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published
by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/
>.

import time
import logging
from wfcommon import units

class WH1080Station(object):

'''
Station driver for Fine Offset WH1080, WH1081, WH1090, WH1091,
WH2080, WH2081.
This also covers all the re-branded weather stations working with
EasyWeather:
- Elecsa AstroTouch 6975
- Watson W-8681
- WH-1080PC
- Scientific Sales Pro Touch Screen Weather Station
- TOPCOM NATIONAL GEOGRAPHIC 265NE
-PCE-FWS 20

This driver is a wrapper around pywws, thus
needs this package installed on your system.
'''

logger = logging.getLogger('station.wh1080')

name = 'Fine Offset WH1080 and compatibles'

def run(self, generate_event, send_event, context={}):

from pywws import WeatherStation
station = WeatherStation.weather_station()

for data, last_ptr, logged in station.live_data():
try:
e = generate_event('press')
e.value = (10*(4.5+(data['abs_pressure'])))/10
## to make the pressure correct #
send_event(e)

e = generate_event('temp')
e.sensor = 0
e.value = data['temp_in']
send_event(e)

e = generate_event('hum')
e.sensor = 0
e.value = data['hum_in']
send_event(e)

e = generate_event('temp')
e.sensor = 1
e.value = data['temp_out']
send_event(e)

e = generate_event('hum')
e.sensor = 1
e.value = data['hum_out']
send_event(e)

e = generate_event('rain')
e.total = (136*(data['rain']))/100
## .to make the rainrate correct #
e.rate = 0
send_event(e)

e = generate_event('wind')
e.create_child('mean')
e.mean.speed = units.MphToMps(data['wind_ave'])
e.mean.dir =
22.5*(data['wind_dir']) ## to make the
winddirection correct #
e.create_child('gust')
e.gust.speed = units.MphToMps(data['wind_gust'])
e.gust.dir =
22.5*data['wind_dir'] ## to make the
winddirection correct #
send_event(e)

except Exception, e:
self.logger.error(e)

lbovet

unread,
Jun 6, 2011, 2:37:19 PM6/6/11
to wfrog-users
Thanks Jan for your contribution.

I committed it in subversion and will be released with next version.

I also added you as committer of the project, in the case you have
other fixes or code, you can then easily make the changes directly in
subversion.

I mentioned your name in the file header, should I also put your email
address? If yes, which one?

On Jun 2, 8:57 pm, janc <duinzi...@gmail.com> wrote:
> Is this a solution to solv the problems with the wh1080 driver for the
> compateble wh1080 weatherstations
> see events
>
> ## Copyright 2010 Laurent Bovet <laurent.bo...@windmaster.ch>

Jim Easterbrook

unread,
Jun 6, 2011, 3:01:26 PM6/6/11
to wfrog...@googlegroups.com
I'm confused by some of the arithmetic being used here.

>> e.value = (10*(4.5+(data['abs_pressure'])))/10
>> ## to make the pressure correct #

How does adding 4.5 correct the pressure reading? Are all WH1080
stations incorrect by this amount?

>> e.total = (136*(data['rain']))/100
>> ## .to make the rainrate correct #

This may be correct, if your rain gauge requires a 36% correction. I
don't expect all stations have the same error.

>> e.mean.speed = units.MphToMps(data['wind_ave'])

The WH1080 wind speeds are already in m/s, so why is this conversion
being applied?

I would suggest ignoring data when 'logged' is true, so events are
generated at regular 48 second intervals. Otherwise you may get near
duplicate events in close succession when the 48 second data period
falls in phase with the 5 minute logging period.

Lastly, values from the external sensors will be 'None' when radio
contact between the sensors and the base station is interrupted. (The
wind direction can also be an integer value 128 or larger.) You should
test for this before doing any arithmetic with the values.

Jim (pywws developer).

Laurent Bovet

unread,
Jun 6, 2011, 4:03:40 PM6/6/11
to wfrog...@googlegroups.com
Thanks Jim to hop in,

As we core developers do not own a WH1080-like station, your input is valuable.

I was wondering if the units and/or correction could have been configured in the station (e.g. using a dedicated app like EasyWeather). That could explain the discrepancies that Jan corrected.

If the difference is due to poor sensor calibration (cheap stations ,aren't they?), the correction should occur in a dedicated place, not in each driver code and be configurable. Note that the following issue also reports such problems: http://code.google.com/p/wfrog/issues/detail?id=43.

I added the 'logged' condition and None tests:
http://code.google.com/p/wfrog/source/diff?spec=svn812&r=812&format=side&path=/trunk/wfdriver/station/wh1080.py&old_path=/trunk/wfdriver/station/wh1080.py&old=811
Coded blindly, so needs to be tested...

2011/6/6 Jim Easterbrook <j...@jim-easterbrook.me.uk>

Jim Easterbrook

unread,
Jun 6, 2011, 5:05:56 PM6/6/11
to wfrog...@googlegroups.com
On 06/06/2011 21:03, Laurent Bovet wrote:
>
> I was wondering if the units and/or correction could have been
> configured in the station (e.g. using a dedicated app like EasyWeather).
> That could explain the discrepancies that Jan corrected.

Station configuration affects the station's own display, but not the raw
data sent over USB to the computer.

> If the difference is due to poor sensor calibration (cheap stations
> ,aren't they?), the correction should occur in a dedicated place, not in
> each driver code and be configurable. Note that the following issue also
> reports such problems: http://code.google.com/p/wfrog/issues/detail?id=43.

Poor calibration and poor design. (E.g. the rain collector is shallow
and some rain splashes out, so isn't collected. The proportion lost will
vary with wind direction and strength.) I take the view that they are
not accurate enough to be worth calibrating - all one can say is that
today was wetter, windier and colder than yesterday.

I've not yet put any configurable calibration in pywws, although some
users have asked for it. I feel it should store the uncalibrated data,
so any future adjustment can be applied retrospectively. But some
calibration changes would have a definite start time - e.g. adding a
funnel to the rain gauge to increase its collection area.
--
Jim Easterbrook <http://www.jim-easterbrook.me.uk/>

Jim Easterbrook

unread,
Jun 6, 2011, 5:24:47 PM6/6/11
to wfrog...@googlegroups.com
On 06/06/2011 21:03, Laurent Bovet wrote:
>

That's the sort of thing, but note that a test such as:
if data['temp_out']:
will fail when the temperature is zero (which can happen!). A better
test is:
if data['temp_out'] is not None:

These test only need be applied to the external temperature, humidity,
and wind speeds & direction. The direction test should be:
if (data['wind_dir'] is not None and
data['wind_dir'] < 16):

duin...@gmail.com

unread,
Jun 7, 2011, 3:06:21 AM6/7/11
to wfrog...@googlegroups.com
Good morning Jim and Laurent,

to Laurent,

I agree to committer of the wh1080 project, and you publish my .. @gmail account

to JIm,

Not all all WH1080 stations are incorrect by this amount, but it is a sample to calibrate the sensor.
The rain gauge was testted with a bottle of water 100 cl. .
This gave a rate of 134 mm rainfall,
so the surface is 5 x 11 cm = 55 cm2
(100 / 55) * 100 cl = 182 mm
1.36 (correction) * 134 mm = 182 mm

the wind direction was formerly reviewed as 360 / 16

Jan



Op schreef Jim Easterbrook <j...@jim-easterbrook.me.uk>:

Laurent Bovet

unread,
Jun 7, 2011, 2:16:23 PM6/7/11
to wfrog...@googlegroups.com
Thanks Jim for the correction and teaching me Python :)

I made the change. Jan, I let you maintain wh1080.py from now on.

2011/6/6 Jim Easterbrook <j...@jim-easterbrook.me.uk>

jan commandeur

unread,
Jun 8, 2011, 12:46:39 AM6/8/11
to wfrog...@googlegroups.com
I think, if the weatherboard fails to receive data from the outside sensor, only the data of humidity, it is never 0 (zero), can controle the weatherprogram further.
if data['humidity'] is not None: etc.

jan Commandeur


2011/6/6 Jim Easterbrook <j...@jim-easterbrook.me.uk>

lbovet

unread,
Jun 11, 2011, 9:27:16 AM6/11/11
to wfrog-users
Jan, I let you make the modifications you judge correct to wh0180.py

On Jun 8, 6:46 am, jan commandeur <jancommand...@texel.com> wrote:
> I think, if the weatherboard fails to receive data from the outside sensor,
> only the data of humidity, it is never 0 (zero), can controle the
> weatherprogram further.
> if data['humidity'] is not None: etc.
>
> jan Commandeur
>
> 2011/6/6 Jim Easterbrook <j...@jim-easterbrook.me.uk>
>
> > On 06/06/2011 21:03, Laurent Bovet wrote:
>
> > > I added the 'logged' condition and None tests:
>
> >http://code.google.com/p/wfrog/source/diff?spec=svn812&r=812&format=s...
> > > <
> >http://code.google.com/p/wfrog/source/diff?spec=svn812&r=812&format=s...
Reply all
Reply to author
Forward
0 new messages