beautypg.com

Appendix b. example programs, B.1 crbasic examples, B.1.1 cr1000 example program – Campbell Scientific OBS-3+ and OBS300 Suspended Solids and Turbidity Monitors User Manual

Page 43: B.1.1

background image

Appendix B. Example Programs

B.1 CRBasic Examples

B.1.1 CR1000 Example Program

Below is an example CR1000 program.

The calibration values used in this program are from the calibration certificate

shown in FIGURE 7-3. The example program uses the voltage curve’s

coefficients. Since the coefficients of the voltage curve are used, the multiplier

for

VoltSE() needs to be 0.001. Make sure you use the correct units.

The calibration values are different for each probe.

'CR1000 Series Datalogger

'Declare Public Variables
Public NTU
Public A(2), B(2), C(2), i, n, NTUX(21)


'Define Data Tables
DataTable (Data_15m,1,-1)
DataInterval (0,15,Min,10)
Sample (1,NTU,FP2)
EndTable

'Main Program
BeginProg

'Declare Constants
n = 21
A(1) = -0.24763
B(1) = 105.69
C(1) = -0.29928
A(2) = 35.310
B(2) = 401.11
C(2) = 0.20709

Scan (5,Sec,10,0)
SW12 (1)

'Delay 2 seconds
Delay (0,2,Sec)

'n = 21 in this case so 21 measurements will be made for both the
'high and low input ranges. A multiplier of 0.001 is used because
'the coefficients are from the voltage calibration sheet.

For i = 1 To n
VoltSe (NTUX(i),1,mV5000,1,1,0,_60Hz,0.001,0)
NTUX(i) = A(2) * NTUX(i)^2 + B(2) * NTUX(i) + C(2) ' V to NTU high range

Delay (0,45,mSec) 'Delay between measurements
Next i

'now find the median value, which will best represent
SortSpa (NTUX(),21,NTUX())

NOTE

B-1