Programmable Logic Controllers Third Edition Frank D. Petruzella McGraw-Hill Chapter 7 Programming Timers Timers There are very few industrial control systems that do not need at least one or two timed functions. They are used to activate or de-activate a device after a preset interval of time. Time delay relays and solid-state timers are used to provide a time delay. They may have displays, pots or other means of operator interface for time settings and electromechanical or solid state outputs. Time Delay Relay Solid-State Timer On-Delay Timing Relay Operating coil NO Instantaneous contacts NC Nontimed contacts are controlled directly by the timer coil, as in a general-purpose control relay. When the coil is energized, the timed contacts are are prevented from opening NO or closing until the time Time control delay period has elapsed. However, when the coil is contacts de-energized, the timed NC contacts return Time adjustment instantaneously to their normal state. Timed Contact Symbols On-Delay Symbols Normally open, timed closed contact (NOTC) Normally closed, timed open contact (NCTO) Contact is open when relay coil is de-energized Contact is closed when relay coil is de-energized When relay is energized, there is a time delay in closing When relay is energized, there is a time delay in opening Timed Contact Symbols Off Delay Symbols Normally open, timed open contacts (NOTO). Contact is normally open when relay coil is de-energized. When relay coil is energized, contact closes instantly. When relay coil is deenergized, there is a time delay before the contact opens. Normally closed, timed closed contacts (NCTC). Contact is normally closed when relay coil is de-energized. When relay coil is energized, contact opens instantly. When relay coil is deenergized, there is a time delay before the contact closes. On-Delay Relay Timer Circuit (NOTC Contact) L1 L2 S1 Sequence of operation S1 open, TD de-energized, TD1 open, L1 is off. L1 S1 closes, TD energizes, timing period starts, TD1 still open, L1 is still off. 10 s After 10 s, TD1 closes, L1 is switched on. 10 s Input Output ON OFF Timing Diagram S1 is opened, TD deenergizes, TD1 opens instantly, L1 is switched off. On-Delay Relay Timer Circuit (NCTO Contact) L1 L2 S1 Sequence of operation L1 S1 open, TD de-energized, TD1 closed, L1 is on. S1 closes, TD energizes, timing period starts, TD1 is still closed, L1 is still on. 10 s 10 s After 10 s, TD1 opens, L1 is switched off. Input Output On Off Timing Diagram S1 is opened, TD de-energizes, TD1 closes instantly, L1 is switched on. Off-Delay Relay Timer Circuit (NOTO Contact) L1 L2 S1 Sequence of operation S1 open, TD de-energized, TD1 open, L1 is off. L1 10 s 10 s Input S1 closes, TD energizes, TD1 closes instantly, L1 is switched on. S1 is opened, TD de-energizes, timing period starts, TD1 is still closed, L1 is still on. On Output Off After 10 s, TD1 opens, L1 is switched off. Timing Diagram Off-Delay Relay Timer Circuit (NCTC Contact) L1 L2 Sequence of operation S1 S1 open, TD de-energized, TD1 closed, L1 is on. L1 S1 closes, TD energizes, TD1 opens instantly, L1 is switched off. 10 s 10 s S1 is opened, TD de-energizes, timing period starts, TD1 is still open, L1 is still off. Off After 10 s, TD1 closes, L1 is switched on. Input Output On Timing Diagram 1. Timers are used to activate or de-activate a device after a preset interval of time. (True/False) 2. With most timers the time delay period is fixed and can not be varied. (True/False) 3. ________ contacts are controlled directly by the timer coil, as in a general-purpose control relay. (a) timed (b) NO (c) instantaneous (d) NC 4. When a relay timer coil is de-energized, the timed contacts return instantaneously to their normal state. (True/False) 5. Which of the following symbols represents a normally open timed closed contact? 6. Which of the following symbols represents a normally closed timed open contact? 7. The timed relay contact shown is designed to operate so that: a. when the relay coil is energized, there is a time delay in closing b. when the relay coil is energized, there is a time delay in opening c. when the relay coil is de-energized, there is a time delay in closing d. when the relay coil is de-energized, there is a time delay in opening 8. The timing diagram shown is that of an 10 s Input On Output Off Timing Diagram a. on-delay timer circuit (NOTC contact) b. on-delay timer circuit (NCTO contact) c. off-delay timer circuit (NCTC contact) d. off-delay timer circuit (NOTO contact) 9. In the circuit shown, the light will stay off L1 L2 S1 L1 10 s a. as long as S1 is closed b. for 10 seconds after coil TD is energized c. for 10 seconds after coil TD is de-energized d. both a and c 10. In the circuit shown, the light will stay on a. as long as S1 is closed b. as long as S1 is open c. for 10 seconds after S1 is closed d. both b and c Programmed Timer Instructions PLC timers are output instructions that provide the same functions as timing relays and solid state timers. Some advantages of PLC timers: their settings can be altered easily the number of PLC timers used can be increased or decreased by programming changes without wiring changes timer accuracy and repeatability are extremely high RSLogic Timer Commands TON Timer/Counter Command TON Name Timer On-Delay Description Counts time base intervals when the instruction is “true” RSLogic Timer Commands TOF Timer/Counter Command TOF Name Timer Off-Delay Description Counts time base intervals when the instruction is “false” RSLogic Timer Commands RTO RES Timer/Counter Command Name RTO Retentive Timer ON RES Reset Description Counts time base intervals when the instruction is “true” and retains the accumulated value when the instruction goes "false" or when power cycle occurs When this instruction is "true" it resets the count of the RTO counter Quantities Associated with the Timer Instruction Preset Time – Represents the time duration of the timing circuit. For example, if a time delay of 10 s is required, the timer will have a preset of 10 s. Accumulated Time – Represents the amount of time that has elapsed from the moment the timing coil became energized. Time Base – Timers can typically be programmed with several different time bases: 1 s, 0.1 s, and 0.01 s are typical time bases. For example, if you enter 0.1 for the time base and 50 for the preset time the timer would have a 5 s delay (50 x 0.1 s = 5 s). Coil-Formatted Timer Instruction Contact determines rung continuity The timer assigned an address The type of timer XXX is specified TON Preset value PR:YYY Time base 0.1 s Accumulated value AC:000 When the timer rung has logic continuity, the timer's accumulated value increases. When accumulated value equals the preset value, the output is energized and and the timed output contact associated with the output is closed. The timed contact can be used as many times as you wish throughout the program as a NO or NC contact. Generic Block-Formatted Timer Instruction Timers are most often represented by boxes in a ladder logic. Control line controls the actual timing operation of the timer. Whenever this line is true the timer will time. Retentive timer block Preset time Time base Accumulated time Output line The timer continuously compares its accumulated time with its preset time. Its output is logic 0 as long as the accumulated time is less than preset When the two become equal the output Reset linethe resets thetime. the timer's accumulated value to zero. changes to logic 1. On-Delay Timer Instruction The on-delay timer operates so that, when the rung containing the timer is true, the timer time-out period commences. Timer Sequence Rung condition Input True False Timed period On delay time duration True Timed output bit Timer False OFF ON The timed output becomes true sometimes after the timer rung becomes true; hence the timer is said to have an on delay. Allen-Bradley On-Delay Timer Instruction Allen-Bradley PLC-5 and SLC-500 controller timer elements each take three data table words: the control word, preset word, and accumulated word. The control word uses three control bits: Enable (EN) bit, Timer-Timing (TT) bit, and Done-Bit (DN). TIMER TABLE T4:0 /EN /TT /DN 0 0 0 Allen-Bradley On-Delay Timer Instruction The Enable (EN) bit is true (has a status of 1) whenever the timer instruction is true. When the timer instruction is false, the enable bit is false (has a status of 0) Enable bit false TON TIMER ON DELAY Timer T4:0 T4:0 EN Enable bit true EN Allen-Bradley On-Delay Timer Instruction The Timer-Timing (TT) bit is true whenever the accumulated value of the timer is changing, which means the timer is timing. TON TIMER ON DELAY Timer T4:0 Preset 50 Accumulated 10 T4:0 EN Timer-Timing bit true TT Allen-Bradley On-Delay Timer Instruction The Done-Bit (DN) changes state whenever the accumulated value reaches the preset value. Its state depends on the type of timer being used. TON TIMER ON DELAY Timer T4:0 Preset 50 Accumulated 10 50 T4:0 EN DN Done-bit changes state DN Allen-Bradley On-Delay Timer Instruction The preset value (PRE) word is the set point of the timer, that is, the value up to which the timer will time. The accumulated value (ACC) word is the value that increments as the timer is timing. The accumulated value will stop incrementing when its value reaches the preset value. TIMER TABLE T4:0 /EN /TT /DN .PRE .ACC 0 0 0 0 0 Allen-Bradley On-Delay Timer Instruction The information to be entered includes: TON TIMER ON DELAY Timer Time base Preset Accumulated T4:0 1.0 15 0 EN DN Timer number which must come from the timer file. Time base which is expressed in seconds. Preset value which is the length of the time delay. Accumulated value which is normally entered as 0. On-Delay Timer Program Ladder Logic Program L2 L1 Input A Input A TON TIMER ON DELAY Timer Time base Preset Accumulated T4:0 1.0 10 0 10 EN DN Output B G Output C R Output D Y Output B T4:0 EN Output C T4:0 TT Output D T4:0 DN On-Delay Timer Program Timing Diagram On Input condition A Timer-enable bit Timer-timing bit Off On Off On Off On Timer-done bit Off Timer accumulated 0 value 4s 4s On-Delay Timer Program Timers are 3-word elements Word EN TT DN Internal use Preset value PRE Accumulated value ACC Word 0 is the control word Word 1 stores the preset value Word 2 stores the accumulated value 0 1 2 On-Delay Timer With Instantaneous Output Relay Ladder Schematic Diagram L1 Stop Start L2 1TD 1TD-1 (instantaneous contact) M 1TD-2 (5 s) (timed contact) On-Delay Timer With Instantaneous Output Programmed Circuit Ladder logic program Inputs Stop Internal relay Start Output L2 L1 Stop Motor Start Internal relay Motor M Timer PR: 5 TB: 1 s Output line M Start-Up Warning Signal Circuit Relay Ladder Schematic Diagram L1 Start-up PB1 Reset PB2 CR1 CR1-1 1TD CR1-2 Horn CR1-3 1TD-1 (10 s) L2 Start-Up Warning Signal Circuit Programmed Circuit Ladder logic program Inputs Output Start-up PB1 PB2 PB1 T4:0 Reset PB2 EN T4:0 TON TIMER ON DELAY Timer T4:0 Time base 1.0 Preset 10 Accumulated 100 Horn T4:0 DN EN EN DN Horn Timed Closed Solenoid Value Program Ladder logic program Input Output L2 L1 Switch SW_1 SW_1 timer_1.dn TON Timer On Delay Timer timer_1 Preset 12000 Accumulated 12000 0 EN DN Valve Valve Automatic Sequential Control System L1 Relay Ladder Schematic Diagram Start PB2 Stop PB1 L2 Lube oil pump motor OL M1 M1-1 PS1 Main drive motor OL M2 (lube oil pressure switch) 1TD OL M3 1TD-1 (15 s) Feed motor Automatic Sequential Control System Programmed Circuit Ladder logic program Inputs PB1 PB2 M1 Outputs OL PB1 M1 M1 PB2 PS1 OL PS1 M2 M2 OL M3 TON TIMER ON DELAY Timer T4:0 Time base 1.0 Preset 15 15 Accumulated 0 T4:0 DN EN DN M3 Off-Delay Programmed Timer The off-delay timer (TOF) operation will keep the output energized for a period after the rung containing the timer has gone false. Ladder logic program Input Output L2 L1 S1 I:1.0/0 TOF TIMER OFF DELAY I:1.0/0 EN TIMER Time base Preset Accumulated T4:3/DN T4:3 1.0 15 0 15 DN O:2.0/1 O:2.0/1 PL Off-Delay Programmed Timer Timing Diagram True Input condition S1 False Timed period Off delay timed duration True (logic 1) False (logic 0) Timed output O:2.0/1 Preset value = accumulated value Off-Delay Timer Used To Switch Motors Off Input Ladder logic program L1 5000 10000 15000 Output L2 Pneumatic Off-Delay Timer L1 Relay Ladder Schematic Diagram L2 Programmed Pneumatic Off-Delay Timer Equivalent Programmed Circuit Input Ladder logic program Outputs L1 L2 5 Fluid Pumping Process Operation Before starting, PS1 must be closed. When the pump start button is pressed, the pump starts. The button can then be released and the pump continues to operate. When the stop button is pushed, the pump stops. PS2 and PS3 must be closed for 5 s after the pump starts. If either PS2 or PS3 opens, the pump will shut off and will not not be able to start again for another 14 s. Fluid Pumping Process Program Ladder logic program Inputs Output L1 L2 05 Retentive Timer A retentive timer accumulates time whenever the device receives power, and maintains the current time should power be removed from the device. Once the device accumulates time equal to its preset value, the contacts of the device change state. The retentive timer must be intentionally reset with a separate signal for the accumulated time to be reset. Electromechnical Retentive Timer Cam operated contact Motor-driven cam Once power is applied, the motor starts turning the cam. The positioning of the lobes determines the time it takes to activate the contacts. If power is removed from the motor, the shaft stops but does not reset. Retentive On-Delay Timer Program The PLC-programmed RETENTIVE ON-DELAY timer (RTO) operates in the same way as the nonretentive ondelay timer (TON), with one major exception. This is a retentive timer reset (RTR) instruction. Same address Unlike the TON, the RTO will hold its accumulated value when the timer rung goes false and will continue timing where it left off when the timer rung goes true again. This timer must be accompanied by a timer reset (RES) instruction to reset the accumulated value of the timer to zero. Retentive On-Delay Timer Program 03 9 Retentive On-Delay Timing Chart Enable bit is reset when input pushbutton PB1 is opened Accum value retained when rung goes false Accum = Preset When reset PB2 is closed, the T4:2/DN bit is reset to 0. Accumulated value is reset and held at zero until the reset pushbutton is opened. Retentive On-delay Alarm Program Ladder logic program L2 L1 60000 0 The purpose of the RTO timer is to detect whenever a piping system has sustained a cumulative overpressure condition of 60 s. At that point, a horn is sounded automatically. You can silence the alarm by switching the key switch to the rest position. Bearing Lubrication Program Sequence Of Operation To start the machine, the operator turns SW on. Before the motor shaft starts to turn, the bearings are supplied with oil by the pump for 10 s. The bearings also receive oil when the machine is running. When the operator turns SW off to stop the machine, the oil pump continues to supply oil for 15 s. A retentive timer is used to track the total running time of the pump. When the total running time is 3 h, the motor is shut down and a pilot light is turned on to indicate that the filter and oil need to be changed. A reset button is provided to reset the process after the filter and oil have been changed. Bearing Lubrication Program 10 0 15 10800 Cascading Timers The programming of two or more timers together is called cascading. Timers may be interconnected, or cascaded to satisfy any required control logic. Relay Schematic Diagram Three motors started automatically in sequence with a 20-s time delay between each motor startup. Equivalent Time-Delayed Motor-Starting Program 20000 20000 Annunciator Flasher Circuit Two timers can be interconnected to form an oscillator circuit. The oscillator logic is basically a timing circuit programmed to generate periodic output pulses of any duration. They can be used as part of an annunciator system to indicate an alarm condition. The oscillator circuit output is programmed in series with the alarm condition. If the alarm condition is true, the appropriate output indicating light will flash. Annunciator Flasher Circuit Cascading of Timers for Longer Time Delays 30000 12000 Control of Traffic Lights in One Direction A typical application for PLC timers is the control of traffic lights. Control of Traffic in One Direction Sequence of Operation Red 30 s Green 25 s Amber 5s Control of Traffic Lights in One Direction 30 25 5 11. The timed contact of a PLC timer can only be used as a normally-open contact. (True/False) 12. The ______ bit operates the same as an instantaneous contact on a timer relay. a. enable b. done c. timer-timing d. timer number 13. The preset time of a PLC timer represents the amount of time that has elapsed from the moment the timing coil became energized. (True/False) 14. If the preset time of a timer is 150 and the time base is 0.1 seconds, the time-delay period would be 1500 seconds. (True/False) 15. In general, the three different types of PLC timers are: a. TON, TOF, and PRE b. TON, TOF, and RTO c. TON, ACC, and RTO d. TT, EN, and DN 16. The amount of time for which a timer is programmed is called the a. preset b. set point c. Done Time (DN) d. accumulated time 17. The timer reset instruction must be addressed to the same address as the ______ instruction. a. TON b. TOF c. RTO d. EN 18. Which of the following statements is not true for a retentive on-delay timer? a. The timer accumulates time when it is energized. b.The timer requires a reset instruction to reset the accumulated value of the timer to zero. c. The timer does not reset to zero when it is de-energized. d. The reset input to the timer will not override the control input. 19. The timer instruction is: a. an input instruction c. either a or b b. an output instruction d. both a or b 20. The interconnection of timers is commonly called : a. grouping b. programming c. sequencing d. cascading 21. For the program shown, the pilot light will be: a. on at all times b. off at all times c. switched on 15 s after the switch has been actuated from the open to the closed position d. switched off 15 s after the switch has been actuated from the on to off position