
Appendix C. Example CRBasic Datalogger Programs
C.3 Advanced CPI Program
In this example, CPI communications are used to collect data from a single
CSAT3B.
'Copyright (c) 2014 Campbell Scientific, Inc. All rights reserved.
'The following sensors are measured:
'CSAT3B three dimensional sonic anemometer
'The site attendant must load in several constants and calibration values.
'Search for the text string "unique" to find the locations where unique
'constants and calibration values are entered.
PipeLineMode
'---------------------------------------------
' Define Constants
'---------------------------------------------
Const CPI_ADDR = 30 'CPI Address of Device
Const SCAN_INTERVAL = 100 'Period of 100 ms = 10 Hz Measurement Rate
Const MONITOR_INTERVAL = 5 'Period of 5 sec for monitor data
Const STATS_INTERVAL = 1 'Period of 30 min for online statistics
Const CPI_RATE = 125 'Set CPI Rate to 250 ksps
Const N_STATS = 1 'Increment size in the totalization functions
Const CSAT_AZIMUTH = 0 'Unique value.
'Compass azimuth of the -x axis. For the figure below, CSAT3B_AZIMUTH = 90.
'() -> Compass coordinate system
'{} -> Right handed coordinate system
'
' (N)
' {-y}
' |
' |
' |
' |
' |
' (W) {+x} <-------[ ]----X--- {-x} (E)
' / | \
' CSAT3B Block | CSAT3B Transducers
' |
' |
' v
' {+y}
' (S)
'
'The program computes the compass wind direction, using the constant
'CSAT3B_AZIMUTH, and a CSAT3B wind direction. Good CSAT3B wind directions
'are between -90 to 0 and 0 to 90 degrees, e.g. the wind is blowing into
'the CSAT3B sensor head.
'---------------------------------------------
' Define Variables, Aliases, and Units
'---------------------------------------------
'CSAT3B primary outputs
Public wind(5)
Alias wind(1) = Ux 'x-axis wind
Alias wind(2) = Uy 'y-axis wind
Alias wind(3) = Uz 'z-axis wind
Alias wind(4) = Ts 'Air Temperature
Alias wind(5) = diag 'Diagnostics
Units Ux = m/s
Units Uy = m/s
Units Uz = m/s
C-3
Summary of Contents for CSAT3B
Page 2: ......
Page 6: ......
Page 80: ...Appendix B CSAT3B Measurement Theory B 4...
Page 87: ......