-
Notifications
You must be signed in to change notification settings - Fork 0
/
BaxtersMidAWCBlock.CR6
229 lines (226 loc) · 9.64 KB
/
BaxtersMidAWCBlock.CR6
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
'CR6 Series
'Created by Short Cut (4.0)
'Declare Variables and Units
Dim TT_K(8)
Dim SBT_K(8)
Dim m(8)
Dim b(8)
Public BattV
Public PTemp_C
Public TT_C(8)
Public SBT_C(8)
Public TTmV(8)
Public TRHData(2)
Public SlrkW
Public SlrMJ
Public Rain_mm
Public Wind_ms
Alias TRHData(1)=AirTC
Alias TRHData(2)=RH
' IRR sensor 7117 7118 7119 7120 3386 3381 3383 3382
Dim MC2(8) = {89402.5, 92363.9, 80355.4, 84928.7, 75238.7, 74279.9, 79768.7, 73620.1}
Dim MC1(8) = {8836110, 9139050, 8631970, 8533100, 7282460, 6959910, 7496330, 7031600}
Dim MC0(8) = {1467980000, 1515710000, 1494870000, 1415480000, 1368500000, 1340100000, 1414580000, 1332630000}
Dim BC2(8) = {3995.44, 3147.37, 1659.89, 3722.36, 14931.7, 13195.5, 14089.7, 12417.8}
Dim BC1(8) = {53825.4, 134577, 38568.3, -60890.2, 94378.8, 70789.2, 127752, 37528.5}
Dim BC0(8) = {-4705280, 2316720, -3419450, -1740500, -5148230, -683085, -4488640, -1572190}
Units BattV=Volts
Units PTemp_C=Deg C
Units TT_C=Deg C
Units SBT_C=Deg C
Units TTmV=mV
Units AirTC=Deg C
Units RH=%
Units SlrkW=kW/m^2
Units SlrMJ=MJ/m^2
Units Rain_mm=mm
Units Wind_ms=m/s
'Define Data Tables
DataTable(AllData,True,-1)
DataInterval(0,5,min,10)
Average(1, BattV,FP2,False)
Average(1, PTemp_C,FP2,False)
Average(1, TT_C(1),FP2,False)
Average(1, SBT_C(1),FP2,False)
Average(1, TTmV(1),FP2,False)
Average(1, TT_C(2),FP2,False)
Average(1, SBT_C(2),FP2,False)
Average(1, TTmV(2),FP2,False)
Average(1, TT_C(3),FP2,False)
Average(1, SBT_C(3),FP2,False)
Average(1, TTmV(3),FP2,False)
Average(1, TT_C(4),FP2,False)
Average(1, SBT_C(4),FP2,False)
Average(1, TTmV(4),FP2,False)
Average(1, TT_C(5),FP2,False)
Average(1, SBT_C(5),FP2,False)
Average(1, TTmV(5),FP2,False)
Average(1, TT_C(6),FP2,False)
Average(1, SBT_C(6),FP2,False)
Average(1, TTmV(6),FP2,False)
Average(1, TT_C(7),FP2,False)
Average(1, SBT_C(7),FP2,False)
Average(1, TTmV(7),FP2,False)
Average(1, TT_C(8),FP2,False)
Average(1, SBT_C(8),FP2,False)
Average(1, TTmV(8),FP2,False)
Average(1, AirTC,FP2,False)
Maximum(1, RH,FP2,False,False)
Average(1, SlrkW,FP2,False)
Average(1, SlrMJ,IEEE4,False)
Totalize(1, Rain_mm,FP2,False)
Average(1, Wind_ms,FP2,False)
EndTable
'Main Program
BeginProg
'Main Scan
Scan(5,min,1,0)
'Default CR6 Datalogger Battery Voltage measurement 'BattV'
Battery(BattV)
'Default CR6 Datalogger Wiring Panel Temperature measurement 'PTemp_C'
PanelTemp(PTemp_C,60)
'CS215 Temperature & Relative Humidity Sensor measurements 'AirTC' and 'RH'
SDI12Recorder(TRHData(),C3,"0","M!",1,0,-1)
'Wind speed sensor
PulseCount(Wind_ms,1,U10,5,1,0.765,0.35)
If Wind_ms<0.36 Then Wind_ms = 0
'Apogee SP-110 pyranometer 'SlrMJ' and 'SlrkW'
VoltDiff (SlrkW,1,mV1000,U5,True ,0,60,5.0,0)
If SlrkW<0 Then SlrkW=0
SlrMJ=SlrkW * 0.0003
SlrkW = SlrkW / 1000
'Generic Tipping Bucket Rain Gauge measurement 'Rain_mm'
PulseCount(Rain_mm,1,U8,1,0,0.2,0)
'Turn AM16/32 Multiplexer On. PortSet(DataLogger com channel, State 1=on and can respond to clock pulses)
PortSet(C2,1)
Delay(0,150,mSec) 'Delay(Option, Delay, Units)
'Switch on the first AM416 Multiplexer channel. PulsePort(DataLogger channel C#, Delay)
PulsePort(C1,10000)
'SI-111 Precision Infrared Radiometer measurements 'TT_C(1)' and 'SBT_C(1)'
'Measure SI-111 sensor body thermistor temperature
Therm109(SBT_C(1),1,U1,U2,0,60,1,0)
'Measure SI-111 output of thermopile
VoltDiff(TTmV(1),1,mV200,U3,True,0,60,1,0)
'Calculate slope (m) and offset (b) coefficients for target temperature calculation
m(1)=MC0(1)+(MC1(1)*SBT_C(1))+(MC2(1)*SBT_C(1)^2)
b(1)=BC0(1)+(BC1(1)*SBT_C(1))+(BC2(1)*SBT_C(1)^2)
'Calculate target temperature using calculated slope (m) and offset (b)
SBT_K(1)=SBT_C(1)+273.15
TT_K(1)=SBT_K(1)^4+TTmV(1)*m(1)+b(1)
TT_K(1)=SQR(SQR(TT_K(1)))
'Convert target temperature into desired units
TT_C(1)=TT_K(1)-273.15
PulsePort(C1,10000)
'SI-111 Precision Infrared Radiometer measurements 'TT_C(2)' and 'SBT_C(2)'
'Measure SI-111 sensor body thermistor temperature
Therm109(SBT_C(2),1,U1,U2,0,60,1,0)
'Measure SI-111 output of thermopile
VoltDiff(TTmV(2),1,mV200,U3,True,0,60,1,0)
'Calculate slope (m) and offset (b) coefficients for target temperature calculation
m(2)=MC0(2)+(MC1(2)*SBT_C(2))+(MC2(2)*SBT_C(2)^2)
b(2)=BC0(2)+(BC1(2)*SBT_C(2))+(BC2(2)*SBT_C(2)^2)
'Calculate target temperature using calculated slope (m) and offset (b)
SBT_K(2)=SBT_C(2)+273.15
TT_K(2)=SBT_K(2)^4+TTmV(2)*m(2)+b(2)
TT_K(2)=SQR(SQR(TT_K(2)))
'Convert target temperature into desired units
TT_C(2)=TT_K(2)-273.15
PulsePort(C1,10000)
'SI-111 Precision Infrared Radiometer measurements 'TT_C(3)' and 'SBT_C(3)'
'Measure SI-111 sensor body thermistor temperature
Therm109(SBT_C(3),1,U1,U2,0,60,1,0)
'Measure SI-111 output of thermopile
VoltDiff(TTmV(3),1,mV200,U3,True,0,60,1,0)
'Calculate slope (m) and offset (b) coefficients for target temperature calculation
m(3)=MC0(3)+(MC1(3)*SBT_C(3))+(MC2(3)*SBT_C(3)^2)
b(3)=BC0(3)+(BC1(3)*SBT_C(3))+(BC2(3)*SBT_C(3)^2)
'Calculate target temperature using calculated slope (m) and offset (b)
SBT_K(3)=SBT_C(3)+273.15
TT_K(3)=SBT_K(3)^4+TTmV(3)*m(3)+b(3)
TT_K(3)=SQR(SQR(TT_K(3)))
'Convert target temperature into desired units
TT_C(3)=TT_K(3)-273.15
PulsePort(C1,10000)
'SI-111 Precision Infrared Radiometer measurements 'TT_C(4)' and 'SBT_C(4)'
'Measure SI-111 sensor body thermistor temperature
Therm109(SBT_C(4),1,U1,U2,0,60,1,0)
'Measure SI-111 output of thermopile
VoltDiff(TTmV(4),1,mV200,U3,True,0,60,1,0)
'Calculate slope (m) and offset (b) coefficients for target temperature calculation
m(4)=MC0(4)+(MC1(4)*SBT_C(4))+(MC2(4)*SBT_C(4)^2)
b(4)=BC0(4)+(BC1(4)*SBT_C(4))+(BC2(4)*SBT_C(4)^2)
'Calculate target temperature using calculated slope (m) and offset (b)
SBT_K(4)=SBT_C(4)+273.15
TT_K(4)=SBT_K(4)^4+TTmV(4)*m(4)+b(4)
TT_K(4)=SQR(SQR(TT_K(4)))
'Convert target temperature into desired units
TT_C(4)=TT_K(4)-273.15
'Turn AM16/32 Multiplexer Off. PortSet(DataLogger channel C#, State 0=off and reset)
'Switch on the first AM416 Multiplexer channel. PulsePort(DataLogger channel C#, Delay)
PulsePort(C1,10000)
'SI-111 Precision Infrared Radiometer measurements 'TT_C(5)' and 'SBT_C(5)'
'Measure SI-111 sensor body thermistor temperature
Therm109(SBT_C(5),1,U1,U2,0,60,1,0)
'Measure SI-111 output of thermopile
VoltDiff(TTmV(5),1,mV200,U3,True,0,60,1,0)
'Calculate slope (m) and offset (b) coefficients for target temperature calculation
m(5)=MC0(5)+(MC1(5)*SBT_C(5))+(MC2(5)*SBT_C(5)^2)
b(5)=BC0(5)+(BC1(5)*SBT_C(5))+(BC2(5)*SBT_C(5)^2)
'Calculate target temperature using calculated slope (m) and offset (b)
SBT_K(5)=SBT_C(5)+273.15
TT_K(5)=SBT_K(5)^4+TTmV(5)*m(5)+b(5)
TT_K(5)=SQR(SQR(TT_K(5)))
'Convert target temperature into desired units
TT_C(5)=TT_K(5)-273.15
PulsePort(C1,10000)
'SI-111 Precision Infrared Radiometer measurements 'TT_C(6)' and 'SBT_C(6)'
'Measure SI-111 sensor body thermistor temperature
Therm109(SBT_C(6),1,U1,U2,0,60,1,0)
'Measure SI-111 output of thermopile
VoltDiff(TTmV(6),1,mV200,U3,True,0,60,1,0)
'Calculate slope (m) and offset (b) coefficients for target temperature calculation
m(6)=MC0(6)+(MC1(6)*SBT_C(6))+(MC2(6)*SBT_C(6)^2)
b(6)=BC0(6)+(BC1(6)*SBT_C(6))+(BC2(6)*SBT_C(6)^2)
'Calculate target temperature using calculated slope (m) and offset (b)
SBT_K(6)=SBT_C(6)+273.15
TT_K(6)=SBT_K(6)^4+TTmV(6)*m(6)+b(6)
TT_K(6)=SQR(SQR(TT_K(6)))
'Convert target temperature into desired units
TT_C(6)=TT_K(6)-273.15
PulsePort(C1,10000)
'SI-111 Precision Infrared Radiometer measurements 'TT_C(7)' and 'SBT_C(7)'
'Measure SI-111 sensor body thermistor temperature
Therm109(SBT_C(7),1,U1,U2,0,60,1,0)
'Measure SI-111 output of thermopile
VoltDiff(TTmV(7),1,mV200,U3,True,0,60,1,0)
'Calculate slope (m) and offset (b) coefficients for target temperature calculation
m(7)=MC0(7)+(MC1(7)*SBT_C(7))+(MC2(7)*SBT_C(7)^2)
b(7)=BC0(7)+(BC1(7)*SBT_C(7))+(BC2(7)*SBT_C(7)^2)
'Calculate target temperature using calculated slope (m) and offset (b)
SBT_K(7)=SBT_C(7)+273.15
TT_K(7)=SBT_K(7)^4+TTmV(7)*m(7)+b(7)
TT_K(7)=SQR(SQR(TT_K(7)))
'Convert target temperature into desired units
TT_C(7)=TT_K(7)-273.15
PulsePort(C1,10000)
'SI-111 Precision Infrared Radiometer measurements 'TT_C(8)' and 'SBT_C(8)'
'Measure SI-111 sensor body thermistor temperature
Therm109(SBT_C(8),1,U1,U2,0,60,1,0)
'Measure SI-111 output of thermopile
VoltDiff(TTmV(8),1,mV200,U3,True,0,60,1,0)
'Calculate slope (m) and offset (b) coefficients for target temperature calculation
m(8)=MC0(8)+(MC1(8)*SBT_C(8))+(MC2(8)*SBT_C(8)^2)
b(8)=BC0(8)+(BC1(8)*SBT_C(8))+(BC2(8)*SBT_C(8)^2)
'Calculate target temperature using calculated slope (m) and offset (b)
SBT_K(8)=SBT_C(8)+273.15
TT_K(8)=SBT_K(8)^4+TTmV(8)*m(8)+b(8)
TT_K(8)=SQR(SQR(TT_K(8)))
'Convert target temperature into desired units
TT_C(8)=TT_K(8)-273.15
'Turn AM16/32 Multiplexer Off. PortSet(DataLogger channel C#, State 0=off and reset)
PortSet(C2,0)
Delay(0,150,mSec) 'Delay(Option, Delay, Units)
'Call Data Tables and Store Data
CallTable AllData
NextScan
EndProg