4 datalogger programming for sdi-12 output, Datalogger programming for sdi-12 output, 8. windsonic data format option – Campbell Scientific WINDSONIC 2-D Sonic Wind Sensors User Manual
Page 23

WindSonic Two-Dimensional Sonic Anemometer
Totalize (1,n,IEEE4,diag<>2)
FieldNames ("diag_2_TOT")
Totalize (1,n,IEEE4,diag<>4)
FieldNames ("diag_4_TOT")
Totalize (1,n,IEEE4,diag<>8)
FieldNames ("diag_8_TOT")
Totalize (1,n,IEEE4,diag<>9)
FieldNames ("diag_9_TOT")
Totalize (1,n,IEEE4,diag<>10)
FieldNames ("diag_10_TOT")
Totalize (1,n,IEEE4,nmbr_bytes_rtrnd<>0)
FieldNames ("nnd_TOT")
Totalize (1,n,IEEE4,nmbr_bytes_rtrnd<>0 IMP checksum_flg)
FieldNames ("checksum_err_TOT")
EndTable
BeginProg
n = 1
SerialOpen (40,9600,3,0,108) 'SDM-SIO1 SDM address set To 8.
Scan (1,Sec,3,0)
'Get data from WindSonic.
SerialInRecord (40,in_bytes_str,&h02,0,&h0D0A,nmbr_bytes_rtrnd,01)
SplitStr (windsonic(),in_bytes_str,",",4,4) 'Split the string and convert to floats.
wind_direction = windsonic(1)
wind_speed = windsonic(2)
diag = windsonic(4)
checksum_flg = ( (HexToDec (Right (in_bytes_str,2))) EQV (CheckSum (in_bytes_str,9,Len (in_bytes_str)-3)) )
disable_flg = ( NOT (checksum_flg) OR (nmbr_bytes_rtrnd=0) OR (diag<>0) )
CallTable stats
NextScan
EndProg
7.4 Datalogger Programming for SDI-12 Output
A program for the WindSonic4 can be written using SCWin. Section 4.3, Use
Short Cut Program Generator for Windows (SCWin) to Program Datalogger
and Generate Wiring Diagram, describes using SCWin to create a datalogger
program and wiring diagram for the WindSonic4.
The WindSonic4 updates the SDI-12 output at a frequency of 1 Hz. The most
appropriate SDI-12 command to retrieve data from the WindSonic is the aRo!,
where a is the WindSonic SDI-12 address and o is the data format option
(TABLE 7-8). For dataloggers that do not support the aRo! command, use the
aDo!.
TABLE 7-8. WindSonic Data Format Option
Option (o) Output
Units
Comment
wind direction
degrees
wind speed
m s
-1
0
diagnostic unitless
Compass polar coordinate system
u
x
wind
m s
-1
u
y
wind
m s
-1
1
diagnostic unitless
Orthogonal right hand coordinate
system
15