beautypg.com

A.3.1.1 calendar date battery test – sdi12, A.3.1, A.3.1.1 – Campbell Scientific PS200/CH200 12 V Charging Regulators User Manual

Page 74

background image

Appendix A. Advanced Programming Techniques

sending the battery test instruction will cause the charger to go back to normal
within 90 seconds. Depending on the state of the battery and the load on the
system it might take only a few minutes or several hours to detect a bad
battery. The examples provided for this instruction leave the system running on
battery voltage for three hours.

Both the SDI12 and RS-232 programming examples show two different
methods of using the battery test instruction.

The first method runs the test based on a calendar date – a battery test is run on
the same day of each month.

The second method runs the test based on the number of days between the test.
Instead of running the test every month it might be better to run it every 90 or
120 days depending on conditions and preference.

A.3.1 Enter Battery Test State SDI12 Programming Example

A.3.1.1 Calendar Date Battery Test – SDI12

'CR1000 Series Datalogger
'Program: SDI12_Battery_Load_Test.CR1
'Date: 7.October.2010

'Ver: A
'
'Notes: This program performs a battery test on a set day into

'each month and at a particular time.
'

'PS200/CH200 configured with SDI-12 address 0 (zero).
'Use Campbell Scientific SDI-12 cable part # 20769.
'

'SDI-12 CABLE TO CR1000 WIRING
'-----------------------------
'WHITE: C3

'BLACK: G
'CLEAR: G
'

PipeLineMode
'Public Variables

'I like to use the words "on" and "off" vs. "true" and "false" when
'working with Boolean variables.
Const On = True

Const Off = False

Public PanelTempC 'Datalogger panel temperature: Celsius


'Store the present time information.
Public rTime(9)

'Array to store present time

Alias rTime(1) = Year

'assign the alias Year to rTime(1)

Alias rTime(2) = Month

'assign the alias Month to rTime(2)

Alias rTime(3) = DOM

'assign the alias Day to rTime(3)

Alias rTime(4) = Hour

'assign the alias Hour to rTime(4)

Alias rTime(5) = Minute

'assign the alias Minute to rTime(5)

Alias rTime(6) = Second

'assign the alias Second to rTime(6)

Alias rTime(7) = uSecond

'assign the alias uSecond to rTime(7)

Alias rTime(8) = WeekDay

'assign the alias WeekDay to rTime(8)

Alias rTime(9) = Day_of_Year

'assign the alias Day_of_Year to rTime(9)

A-12