Campbell Scientific Wireless Sensor Network (CWB100, CWS220, and CWS900) User Manual

Page 44

Advertising
background image

Wireless Sensor Network

Example 4.6-1. Program for Wireless Sensor Network

Const NumVals = 4 'Values returned by CWS900
Public GetRSSI As Boolean
Public WSN(NumVals)
Public WNSRoutes As String *100

DataTable(SensorNetwork,True, -1 )
DataInterval( 0,10,Min,0)
Average (1,WSN(ArrayIndex("CWS900_Ts")),IEEE4,WSN(ArrayIndex("CWS900_Ts"))= NAN)
FieldNames (CWS900_T_C)
Average (1,WSN(ArrayIndex("CWS900_Ti")),IEEE4,WSN(ArrayIndex("CWS900_Ti"))= NAN)
FieldNames (CWS900_Ti_C)
Minimum (1,WSN(ArrayIndex("CWS900_BV")),IEEE4,WSN(ArrayIndex("CWS900_BV"))= NAN,False)
FieldNames (CWS900_BattV_Min)
Minimum (1,WSN(ArrayIndex("CWS900_SS")),IEEE4,WSN(ArrayIndex("CWS900_SS"))= NAN,False)
FieldNames (CWS900_RSSI_Min)
EndTable

BeginProg
Scan (600,Sec,0,0)
CWB100(3,WSN, )'Poll CWB100 for sensor data:
If IfTime (0,60,Min) Then GetRSSI = True
If GetRSSI = True Then
CWB100RSSI( 3 ) 'Trigger a radio signal strength measurement
CWB100Routes (3,WNSRoutes)'Verify routes
GetRSSI = False
EndIf
CallTable SensorNetwork
NextScan
EndProg

This numeric screen from LoggerNet shows both Public and final storage data
generated by program example 4.6-1. CWS900_SS will display NAN except
during the scan immediately following the CWB100RSSI() instruction. The
disable variable in the Minimum() instruction excludes NAN values from the
minimum calculation. Note that in the SensorNetwork data table, the labels for
the measurements match those assigned by FieldNames in the datalogger
program.

36

Advertising