Campbell Scientific PWS100 Present Weather Sensor User Manual

Page 83

Advertising
background image

Section 7. Operation

relative gains or losses of the two clocks that the logger will over time either
receive an extra transmission from the sensor or not get a transmission from the
sensor in a given period. Apart from accepting this as being inevitable the only
solution to this is to get the sensor to output more frequently than you need the
logger to receive data and have the logging system work with the latest
transmission, but this is not always ideal or possible.

Polling the sensor for data gives full control of the timing of measurements to
the logging system, as with the PWS100 it can be asked to output a meassage
for a given time up until the instant the poll command is issued. The PWS100
processes the data in its buffer for that period and generates the message “on
the fly”. Apart from needing both transmit and receive connections to the
logger the only disadvantage of this technique is there may be a slight delay
(typically less than one second) whilst the PWS100 prepares the message in
response to the poll command.

Two simple example programs for a CR1000 Campbell Scientific datalogger.
A more powerful, documented program that includes advanced setup, CRC
checks can be downloaded from:

www.campbellsci.co.uk/downloads

The following is an example program for the Campbell Scientific CR1000
datalogger using automated output settings (see section 7.5.1). Note that the
aliases are set for the output as defined in the program, these should be altered
to suit the individual outputs selected.

'CR1000 Series Datalogger
'Campbell Scientific Ltd. PWS100 Present Weather Sensor
'Example of data capture in a single message output

'automatically by a sensor connected to COM1 on the logger

'Declare General Variables

Public Temp, PWS_Bytes

'Incoming PWS100 Data buffer

Public InString As String * 500

'Final PWS100 Data - define the array large enough to match the

'number of fields in the message
Public PWS100data(11)

'Define aliases so the results are easier to identify
'Need to match the fields selected in the message
Alias PWS100data(1) = MessageID

Alias PWS100data(2) = PWSID
Alias PWS100data(3) = Visibility
Alias PWS100data(4) = PWS

Alias PWS100data(5) = NWS
Alias PWS100data(6) = Intensity
Alias PWS100data(7) = Accumulation

Alias PWS100data(8)= DayCount
Alias PWS100data(9) = Hour

Alias PWS100data(10) = Minute
Alias PWS100data(11) = Second

'Declare Constants
Const STX = &H02
Const ETX = &H03


DataTable (PWS100,True,-1)
Sample (11,PWS100data(),IEEE4)
EndTable

7-47

Advertising