beautypg.com

Campbell Scientific PS200/CH200 12 V Charging Regulators User Manual

Page 85

background image

Appendix A. Advanced Programming Techniques

Public VBatt
'Current going into, or out of, the battery: Amps

Public IBatt
'Current going to the load: Amps
Public ILoad

'Voltage coming into the charger: VDC
Public V_in_chg
'Current coming into the charger: Amps

Public I_in_chg
'Charger temperature: Celsius
Public Chg_TmpC

'Charging state: Cycle, Float, Current Limited, or None
Public ChargeState As String

'Charging source: None, AC, or Solar
Public ChargeSource As String
'Check battery error: 0=normal, 1=check battery

Public Ck_Batt
'Word or phrase equivalent of check battery error.
Public CheckBattery As String


'Array to hold the names of the battery error information.
Dim CheckBatteryArr(2) As String


'Command to get extended status information.
Const EXTSTATS_CMD = "RD_SPECIAL>"

'Array to hold extended data from the PS200/CH200
Public CH200_MX(4) As String * 20

'Battery charging target voltage.
Public BattTargV
'Digital potentiometer setting.

Public DgtlPotSet
'Present battery capacity.
Public BattCap

'Battery charge deficit.
Public Qloss

'Variables & constants used to write an external battery temperature
'to the PS/CH200 and reset it.
'Command sent to the PS/CH200 to write external battery temperature.

Const BATTEST_CMD = "BATT_TEST>"
'String coming back from either the "WR_BT" or "RS_INTBT" command

Public ReturnStr As String * 40
'Number signifiying how far into the return string for "RS_INTBT"
'command the "OK" is located.

Dim OK_Loc
'Setting this value to true, or on, causes a manual battery test.
Public ManualTest As Boolean

'When value is true the battery is being tested.
Public TestBatt As Boolean
'Elapsed time of test in hours

Public ElapsedHrs As Long
'Do not leave "TestLengthHrs" at zero, or test will stop after

'sending command once.
Public TestLengthHrs As Long
'How many days to spread out the test.

Public XDays As Long
'Counter to hold the days the program has run since the last
'test. Gets zeroed out when a test is initiated.

Public DayCntr

'Stored hourly data.

DataTable (Hour,1,-1)
DataInterval (0,1,Hr,10)
Minimum (1,VBatt,FP2,0,False)

Minimum (1,IBatt,FP2,0,False)
Minimum (1,ILoad,FP2,0,False)

Minimum (1,V_in_chg,FP2,0,False)
Minimum (1,I_in_chg,FP2,0,False)

A-23