Example 9, Battery Charger - CAI Networks WebControl PLC User Manual

Programmable logic controller
Table of Contents

Advertisement

value.
In the PERIOD subroutine, we constantly compare the time and set the OP1 ON or
OFF. That is okay for solid state relay or other control relay, since the logic level did
not change all the time. However, if you are sending a X10 command to turn on and
off different lights, you want to make sure the X10 command only issued once, not
repeatedly. You may create another subroutine in which set flag only calls
X10 1 15 ON
only once to turn ON light at house code 2, unit code 16 (please note WebControl's
X10 house code range 0-F, and device code range also 0-F.)
In the MONTHLY routine, we first check the current hour being 8AM then we check
the water softener's salt level. In this way you will not be waked up by email in the
midnight.
When program WebControl PLC for time based logic, please make sure the time
being used in different part of the program having no conflict between all the
subroutines. If you want two things to happen at the same time, you should consider
combine them into same routine to handle.

6.4.9 Example 9, Battery Charger

This is a PLC program to charge 3 serially connected NiMH batteries. First, it tries to
discharge the batteries individually. If any battery discharged to 1V, it will stop the
discharge and start charging. When each cell is being charged to 1.25V, it will stop
charging. We assume the A1, A2, and A3 being calibrated to 1V=100. The
measurement on the battery 2 is the total voltage of battery 1 and battery 2. And the
measurement on battery 3 is the total voltage of all three batteries. This example will
individually discharge and charge each battery.
start
set op1 1
set op2 1
set op3 1
set RAM1 0
set RAM2 0
set RAM3 0
loop:
cnz op1 check_b1
cnz op2 check_b2
cnz op3 check_b3
goto loop
end
check_b1:
BNZ RAM1 c1
tstle AIP1 100 RAM1
bz e1
c1:
tstgt AIP1 125
bnz e1
set op1 0
set op4 1
Copyright(c) 2008,-2013 CAI Networks, Inc.
TM
WebControl
PLC User Guide Version 3.02.17f
39

Advertisement

Table of Contents
loading

Table of Contents