beautypg.com

A.3.1.2 set number of days battery test – sdi12, A.3.1.2 – Campbell Scientific PS200/CH200 12 V Charging Regulators User Manual

Page 77

background image

Appendix A. Advanced Programming Techniques

TestBatt = Off
EndIf

'Get PS200/CH200 values.
SDI12Recorder (CH200_M0(),3,0,"MC!",1.0,0)
'Array values start with one. Values for charge state start with -1.

'Have to shift the value by two to line it up with the correct words
'in the array.
ChargeState = ChargeStateArr(Chg_State + 2)

'Values for charge source start with zero. Have to shift the value
'by one to line it up with the correct words in the array.
ChargeSource = ChargeSourceArr(Chg_Source + 1)

'Values for check battery start with zero. Have to shift the value
'by one to line it up with the correct words in the array.

CheckBattery = CheckBatteryArr(Ck_Batt + 1)
'Get extended battery capacity settings.
SDI12Recorder (CH200_MX(),3,0,"M6!",1.0,0)

CallTable (DischargeTest) 'write data before zeroing ElapsedHrs
NextScan
EndProg

A.3.1.2 Set Number Of Days Battery Test – SDI12

'CR1000 Series Datalogger

'Program: SDI12_XDays_Battery_Load_Test.CR1

'Date: 20.October.2010

'Ver: A

'

'Notes: This program sets the battery capacity via SDI-12.

'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".

Const On = True

Const Off = False

Public PanelTempC

'Datalogger panel temperature: Celsius


'Array to hold all the data coming from the PS200/CH200
Public CH200_M0(9)
'Alias names for array elements.
'Battery voltage: VDC
Alias CH200_M0(1)=VBatt
'Current going into, or out of, the battery: Amps
Alias CH200_M0(2)=IBatt
'Current going to the load: Amps
Alias CH200_M0(3)=ILoad
'Voltage coming into the charger: VDC
Alias CH200_M0(4)=V_in_chg
'Current coming into the charger: Amps
Alias CH200_M0(5)=I_in_chg
'Charger temperature: Celsius
Alias CH200_M0(6)=Chg_TmpC
'Charging state: Cycle, Float, Current Limited, or None
Alias CH200_M0(7)=Chg_State
'Charging source: None, AC, or Solar
Alias CH200_M0(8)=Chg_Source
'Check battery error: 0=normal, 1=check battery
Alias CH200_M0(9)=Ck_Batt

A-15