-
Notifications
You must be signed in to change notification settings - Fork 0
/
ce415-wind-lab.cr1
101 lines (80 loc) · 2.5 KB
/
ce415-wind-lab.cr1
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
89
90
91
92
93
94
95
96
97
98
99
100
101
''''''''''''''''''''''''''''''''''''''''''''''
' CE415 Meterology Lab
'
' Laboratory for Atmospheric Research
' Washington State University
'
' Adapted from public examples.
''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''' WIRING SETUP '''''''''''''''''''''''''
Const o34B_P = 1 'wind speed pulse input: P1
Const o34B_SE = 1 'wind direction signal: SE 1
Const o34B_VX = 1 'wind direction excitation: VX1
Const CSAT3B_SDM_ADDR = 3 'default address: 3
''''''''''''''''''''''''''' VARIABLES ''''''''''''''''''''''''''''
Public cup_WS
Public vane_WD
Units cup_WS=m/s
Units vane_WD=degEofTN
Public CSAT_vals(5)
Alias CSAT_vals(1) = Ux
Alias CSAT_vals(2) = Uy
Alias CSAT_vals(3) = Uz
Alias CSAT_vals(4) = Ts
Alias CSAT_vals(5) = diag
Units Ux = m/s
Units Uy = m/s
Units Uz = m/s
Units Ts = degC
Units diag = bitmap
Public CSAT_meta(4)
Alias CSAT_meta(1) = BoardTemp
Alias CSAT_meta(2) = BoardHumidity
Alias CSAT_meta(3) = InclinePitch
Alias CSAT_meta(4) = InclineRoll
Units BoardTemp = degC
Units BoardHumidity = %
Units InclinePitch = deg
Units InclineRoll = deg
''''''''''''''''''''''''' DATA TABLES '''''''''''''''''''''''''''''''''''
DataTable(SonicData,1,-1)
'default record frequency = every call = 100ms
Sample(5,CSAT_vals(1),IEEE4)
EndTable
DataTable(SonicMetadata,1,-1)
DataInterval (0,5,Sec,10) 'record data every fifth second
Sample(4,CSAT_meta(1),IEEE4)
EndTable
DataTable(CupVaneData,1,-1)
DataInterval(0,1,Sec,10)
Sample(1,cup_WS,IEEE4)
Sample(1,vane_WD,IEEE4)
EndTable
'''''''''''''''''''''' CUSTOM MENU '''''''''''''''''''''''''
DisplayMenu("CE415 Wind Lab",-2)
DisplayValue("sonic Ux", Ux)
DisplayValue("sonic Uy", Uy)
DisplayValue("sonic Uz", Uz)
DisplayValue("sonic Ts", Ts)
DisplayValue("sonic diag", diag)
' DisplayValue("sonic WS", sonic_WS)
' DisplayValue("sonic WD", sonic_WD)
DisplayValue("cup WS", cup_WS)
DisplayValue("vane WD", vane_WD)
EndMenu
''''''''''''''''''''''''' PROGRAM '''''''''''''''''''''''''''''''''''''''
BeginProg
Scan(100,msec,10,0) '10 Hz
'===== Sonic anemometer =====
CSAT3B(CSAT_vals(),0,CSAT3B_SDM_ADDR,0)
CallTable(SonicData)
CSAT3BMonitor(CSAT_meta(),0,CSAT3B_SDM_ADDR)
CallTable(SonicMetadata)
'===== Cup & vane anemometer =====
PulseCount(cup_WS,1,o34B_P,2,1,0.7989,0.28)
If cup_WS=0.2811 Then cup_WS=0
BrHalf(vane_WD,1,mV2500,o34B_SE,o34B_VX,1,2500,True,0,_60Hz,720.0,0) 'Use 5000 mV
If (vane_WD>=360 OR vane_WD < 0) Then vane_WD=0
CallTable(CupVaneData)
NextScan
EndProg