Campbell Scientific PS200/CH200 12 V Charging Regulators User Manual
Page 78

Appendix A. Advanced Programming Techniques
'Arrays to hold the associated words for the charge state, charge source,
'and check battery values.
Dim ChargeStateArr(6) As String
Dim ChargeSourceArr(3) As String
Dim CheckBatteryArr(2) As String
'Variables to hold the words for charge state, charge source, and check
'battery.
Public ChargeState As String
Public ChargeSource As String
Public CheckBattery As String
Public CH200_MX(4) 'Array to hold extended data from the PS200/CH200
'Alias names for array elements.
Alias CH200_MX(1) = BattTargV 'Battery charging target voltage.
Alias CH200_MX(2) = DgtlPotSet 'Digital potentiometer setting.
Alias CH200_MX(3) = BattCap
'Present battery capacity.
Alias CH200_MX(4) = Qloss
'Battery charge deficit.
'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
'Stores the results from the PC/CH200 query. In this case nothing is returned.
Public SDI12Result As String
'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
'How many days to spread out the test.
'Counter to hold the days the program has run since the last test. Gets set
'to one when a test is initiated.
Dim DayCntr
'Stored hourly data.
DataTable (Hour,1,-1)
DataInterval (0,1,Hr,10)
Minimum (6,CH200_M0(),FP2,0,False)
Maximum (6,CH200_M0(),FP2,False,False)
Minimum (1,PanelTempC(),FP2,0,False)
Maximum (1,PanelTempC(),FP2,False,False)
EndTable
'Only save this information when the TestBatt flag
'is on. Set lapses to zero so it stores a time stamp with every
'array of data.
DataTable (DischargeTest,TestBatt,144)
DataInterval (0,10,Min,0)
Sample (1,ElapsedHrs,FP2)
Average (1,Chg_TmpC,FP2,False)
Average (1,VBatt,FP2,False)
Average (1,IBatt,FP2,False)
Minimum (1,VBatt,FP2,False,False)
Sample (1,Qloss,FP2)
Sample (1,ChargeState,String)
Sample (1,ChargeSource,String)
Sample (1,CheckBattery,String)
EndTable
'Main Program
BeginProg
'Put length of battery test in hours here. Can also be modified on
'the fly.
TestLengthHrs = 3
'Run test every 90 days from the time the program is loaded.
XDays = 90
A-16