beautypg.com

Campbell Scientific CS110 Electric Field Meter User Manual

Page 71

background image

Appendix F. Example CRBasic Programs

CS110(E_field,leakage_cur,status,_60Hz,Mcorrected,0)
If

E_field

=

NAN

Then

meas_error = 1

'Disable output to slow table if efield = NAN.

E_field_int = FAST_INTERVAL

'Go to fast interval if NAN.

EndIf
E_status(status)

=

1

'Set appropriate element in status array.

Endif
If

E_field

<>

NAN

Then

AvgRun

(run_avg10,1,E_field,10)

'Used for average output in fast table.

AvgRun

(abs_run_avg600,1,ABS(E_field),600) 'Used to stay longer at fast interval.

EndIf
if (E_field>100 or ABS(E_field)>=300 or abs_run_avg600>=300)and (battery_volt>11.0) then
E_field_int = FAST_INTERVAL
else
E_field_int

=

SLOW_INTERVAL

EndIf
If

E_field_int

=

FAST_INTERVAL

Then

CallTable

Tabfast

'Only call fast table when fast efield active

EndIf
CallTable

Tabslow

'Call slow every time at slow interval.

NextScan
EndProg

In the above program all measurements, except the electric field measurement,
are done once per second. The electric field measurement is done once every
SLOW_INTERVAL when measured electric field values are between -300
V/m and +100 V/m as determined by an if statement. The -300 V/m and +100
V/m values are somewhat arbitrary and can easily be changed to better suit a
given application. When measured electric field values fall outside of the -300
V/m and +100 V/m range, the electric field measurement rate becomes the
FAST_INTERVAL. A running average instruction (AvgRun) is used to
maintain measurements at the FAST_INTERVAL for some time following
elevated electric fields, even after several near zero measurements.

F-3