Campbell Scientific WINDSONIC1 WINDSONIC 2-D Sonic Wind Sensors - Page 22

Example CR1000 Datalogger Program for Measuring a WindSonic1 using an SDM-SIO1, TABLE 7-7.

Page 22 highlights

WindSonic Two-Dimensional Sonic Anemometer FieldNames ("diag_10_TOT") Totalize (1,n,IEEE4,nmbr_bytes_rtrnd0) FieldNames ("nnd_TOT") Totalize (1,n,IEEE4,nmbr_bytes_rtrnd0 IMP checksum_flg) FieldNames ("checksum_err_TOT") EndTable BeginProg n = 1 SerialOpen (Com1,9600,3,0,108) Scan (1,Sec,3,0) 'Get data from WindSonic. SerialInRecord (Com1,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 (diag0) ) CallTable stats NextScan EndProg 7.3.2 Example CR1000 Datalogger Program for Measuring a WindSonic1 using an SDM-SIO1 TABLE 7-7. Wiring for CR1000/SDM-SIO1 Program Example Description WindSonic RxD WindSonic TxD Power RS-232/Power reference Shield Color Green White Red Black Clear CR1000 TX-Z RX-A +12 Vdc G G 'CR1000 Series Datalogger Dim in_bytes_str As String * 21 Dim windsonic(4) As String Public nmbr_bytes_rtrnd Public wind_direction Public wind_speed Public diag Units wind_direction = degrees Units wind_speed = m/s Units diag = unitless Dim checksum_flg As Boolean Dim disable_flg As Boolean Dim n Units n = arb DataTable (stats,TRUE,-1) DataInterval (0,30,Min,10) WindVector (1,wind_speed,wind_direction,IEEE4,disable_flg,0,0,0) FieldNames ("mean_wind_speed,mean_wind_direction,std_wind_dir") Totalize (1,n,IEEE4,disable_flg) FieldNames ("samples_TOT") Totalize (1,n,IEEE4,diag1) FieldNames ("diag_1_TOT") 14

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46

WindSonic Two-Dimensional Sonic Anemometer
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 (Com1,9600,3,0,108)
Scan (1,Sec,3,0)
'Get data from WindSonic.
SerialInRecord (Com1,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.3.2
Example CR1000 Datalogger Program for Measuring a WindSonic1
using an SDM-SIO1
TABLE 7-7.
Wiring for CR1000/SDM-SIO1
Program Example
Description
Color
CR1000
WindSonic RxD
Green
TX-Z
WindSonic TxD
White
RX-A
Power
Red
+12 Vdc
RS-232/Power reference
Black
G
Shield
Clear
G
'CR1000 Series Datalogger
Dim in_bytes_str As String * 21
Dim windsonic(4) As String
Public nmbr_bytes_rtrnd
Public wind_direction
Public wind_speed
Public diag
Units wind_direction = degrees
Units wind_speed = m/s
Units diag = unitless
Dim checksum_flg As Boolean
Dim disable_flg As Boolean
Dim n
Units n = arb
DataTable (stats,TRUE,-1)
DataInterval (0,30,Min,10)
WindVector (1,wind_speed,wind_direction,IEEE4,disable_flg,0,0,0)
FieldNames ("mean_wind_speed,mean_wind_direction,std_wind_dir")
Totalize (1,n,IEEE4,disable_flg)
FieldNames ("samples_TOT")
Totalize (1,n,IEEE4,diag<>1)
FieldNames ("diag_1_TOT")
14