beautypg.com

Campbell Scientific PS200/CH200 12 V Charging Regulators User Manual

Page 86

background image

Appendix A. Advanced Programming Techniques

Minimum (1,Chg_TmpC,FP2,0,False)
Maximum (1,VBatt,FP2,False,False)

Maximum (1,IBatt,FP2,False,False)
Maximum (1,ILoad,FP2,False,False)
Maximum (1,V_in_chg,FP2,False,False)

Maximum (1,I_in_chg,FP2,False,False)
Maximum (1,Chg_TmpC,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.

DataTable (DischargeTest,TestBatt,800)
DataInterval (0,1,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,BattTargV,FP2)
Sample (1,Qloss,FP2)

Sample (1,ChargeState,String)
Sample (1,ChargeSource,String)
Sample (1,CheckBattery,String)

EndTable

'Subroutine sends two back space characters to the PS/CH200 to
'wake it up and switch over to RS-232 mode.
Sub WAKEUP

SerialOut (COMPRT,CHR(&H08),"",1,3)
SerialOut (COMPRT,CHR(&H08),"",1,3)
EndSub


'Main Program
BeginProg

'Put length of battery test in hours here. Can also be modified on
'the fly.
TestLengthHrs = 5

XDays = 90

'Run test every 90 days from the time the program is loaded.

DayCntr = 1

'set the day counter to one the first time the program is

run.

'Load arrays with words to associated with the check battery values

'from the PS/CH200.
CheckBatteryArr(1) = "Normal"
CheckBatteryArr(2) = "Check Battery"


Scan (5,Sec,0,0)
PanelTemp(PanelTempC,_60Hz) 'Measure datalogger panel temperature.

'Add one to DayCntr every midnight.
If TestBatt = Off AND IfTime (0,1,Day) Then DayCntr = DayCntr + 1

CallTable Hour
NextScan

'SlowSequence with RS-232 measurements
SlowSequence
'Configure the COM port used with the PS/CH200

SerialOpen (COMPRT,9600,3,0,150)
Scan(30,sec,0,0)
ElapsedHrs = Timer (1,Hr,4) 'timer for elapsed time of test.


'Run this section of code if elapsed time is less than the
'set amount of time for the test and the battery voltage has not

'dropped below 11.7 vdc. The PS/CH200 will not let the battery drop
'below 11.5 vdc.

A-24