Campbell Scientific CSAT3B CSAT3B Three-Dimensional Sonic Anemometer - Page 83

C.3 Advanced CPI Program

Page 83 highlights

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 Alias wind(2) = Uy Alias wind(3) = Uz Alias wind(4) = Ts Alias wind(5) = diag Units Ux = m/s Units Uy = m/s Units Uz = m/s 'x-axis wind 'y-axis wind 'z-axis wind 'Air Temperature 'Diagnostics C-3

  • 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
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88

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