You are on page 1of 9

Traffic Lights PLC Control -State Diagram Example

Consider the traffic lights in See Traffic Lights. The normal sequences for traffic
lights are a green light in one direction for a long period of time, typically ! or
more seconds. This is follo"ed #y a #rief yello" light, typically $ seconds. This is
then follo"ed #y a similar light pattern in the other direction. %t is understood that a
green or yello" light in one direction implies a red light in the other direction.
Pedestrian #uttons are pro&ided so that "hen pedestrians are present a cross "al'
light can #e turned on and the duration of the green light increased.
Traffic Lights
The first step for de&eloping a controller is to define the inputs and outputs of the
system as sho"n in See %nputs and (utputs for Traffic Light Controller. )irst "e "ill
descri#e the system &aria#les. These "ill &ary as the system mo&es from state to
state. Please note that some of these together can define a state *alone they are
not the states+. The inputs are used "hen defining the transitions. The outputs can
#e used to define the system
state.
%nputs and (utputs for Traffic Light Controller
Pre&iously state diagrams "ere used to define the system, it is possi#le to use a
state ta#le as sho"n in See System State Ta#le for Traffic Lights. ,ere the light
sequences are listed in order. Each state is gi&en a name to ease interpretation, #ut
the corresponding output pattern is also gi&en. The system state is defined as the
#it pattern of the - lights. .ote that there are only $ patterns, #ut - #inary #its
could gi&e as many as -$.
System State Ta#le for Traffic Lights
Transitions can #e added to the state ta#le to clarify the operation, as sho"n in See
State Ta#le "ith Transitions. ,ere the transition from /reen E01 to 2ello" E01 is S.
1hat this means is that a cross "al' #utton must #e pushed to end the green light.
This is not normal, normally the lights "ould use a delay. The transition from 2ello"
E01 to /reen .0S is caused #y a $ second delay *this is normal.+ The next transition
is also a#normal, requiring that the cross "al' #utton #e pushed to end the /reen
.0S state. The last state has a $ second delay #efore returning to the first state in
the ta#le. %n this state ta#le the sequence "ill al"ays #e the same, #ut the times
"ill &ary for the green light
State Ta#le "ith Transitions
3 state diagram for the system is sho"n in See 3 Traffic Light State Diagram. This
diagram is equi&alent to the state ta#le in See State Ta#le "ith Transitions, #ut it
can #e &alua#le for doing &isual inspection.
Motor control circuits of PLC ladder diagrams
he interloc' contacts installed in the pre&ious section4s motor control circuit "or'
fine, #ut the motor "ill run only as long as each push#utton s"itch is held do"n. %f
"e "anted to 'eep the motor running e&en after the operator ta'es his or her hand
off the control s"itch*es+, "e could change the circuit in a couple of different "ays5
"e could replace the push#utton s"itches "ith toggle s"itches, or "e could add
some more relay logic to 6latch6 the control circuit "ith a single, momentary
actuation of either s"itch. Let4s see ho" the second approach is implemented, since
it is commonly used in industry5
1hen the 6)or"ard6 push#utton is actuated, 7 "ill energi8e, closing the normally-
open auxiliary contact in parallel "ith that s"itch. 1hen the push#utton is released,
the closed 7 auxiliary contact "ill maintain current to the coil of 7, thus latching
the 6)or"ard6 circuit in the 6on6 state. The same sort of thing "ill happen "hen the
69e&erse6 push#utton is pressed. These parallel auxiliary contacts are sometimes
referred to as seal-in contacts, the "ord 6seal6 meaning essentially the same thing
as the "ord latch.
,o"e&er, this creates a ne" pro#lem5 ho" to stop the motor: 3s the circuit exists
right no", the motor "ill run either for"ard or #ac'"ard once the corresponding
push#utton s"itch is pressed, and "ill continue to run as long as there is po"er. To
stop either circuit *for"ard or #ac'"ard+, "e require some means for the operator
to interrupt po"er to the motor contactors. 1e4ll call this ne" s"itch, Stop5
.o", if either for"ard or re&erse circuits are latched, they may #e 6unlatched6 #y
momentarily pressing the 6Stop6 push#utton, "hich "ill open either for"ard or
re&erse circuit, de-energi8ing the energi8ed contactor, and returning the seal-in
contact to its normal *open+ state. The 6Stop6 s"itch, ha&ing normally-closed
contacts, "ill conduct po"er to either for"ard or re&erse circuits "hen released.
So far, so good. Let4s consider another practical aspect of our motor control scheme
#efore "e quit adding to it. %f our hypothetical motor turned a mechanical load "ith
a lot of momentum, such as a large air fan, the motor might continue to coast for a
su#stantial amount of time after the stop #utton had #een pressed. This could #e
pro#lematic if an operator "ere to try to re&erse the motor direction "ithout "aiting
for the fan to stop turning. %f the fan "as still coasting for"ard and the 69e&erse6
push#utton "as pressed, the motor "ould struggle to o&ercome that inertia of the
large fan as it tried to #egin turning in re&erse, dra"ing excessi&e current and
potentially reducing the life of the motor, dri&e mechanisms, and fan. 1hat "e
might li'e to ha&e is some 'ind of a time-delay function in this motor control system
to pre&ent such a premature startup from happening.
Let4s #egin #y adding a couple of time-delay relay coils, one in parallel "ith each
motor contactor coil. %f "e use contacts that delay returning to their normal state,
these relays "ill pro&ide us a 6memory6 of "hich direction the motor "as last
po"ered to turn. 1hat "e "ant each time-delay contact to do is to open the
starting-s"itch leg of the opposite rotation circuit for se&eral seconds, "hile the fan
coasts to a halt.
%f the motor has #een running in the for"ard direction, #oth 7 and TD "ill ha&e
#een energi8ed. This #eing the case, the normally-closed, timed-closed contact of
TD #et"een "ires ; and < "ill ha&e immediately opened the moment TD "as
energi8ed. 1hen the stop #utton is pressed, contact TD "aits for the specified
amount of time #efore returning to its normally-closed state, thus holding the
re&erse push#utton circuit open for the duration so 7= can4t #e energi8ed. 1hen
TD times out, the contact "ill close and the circuit "ill allo" 7= to #e energi8ed, if
the re&erse push#utton is pressed. %n li'e manner, TD= "ill pre&ent the 6)or"ard6
push#utton from energi8ing 7 until the prescri#ed time delay after 7= *and TD=+
ha&e #een de-energi8ed.
The careful o#ser&er "ill notice that the time-interloc'ing functions of TD and TD=
render the 7 and 7= interloc'ing contacts redundant. 1e can get rid of auxiliary
contacts 7 and 7= for interloc's and >ust use TD and TD=4s contacts, since they
immediately open "hen their respecti&e relay coils are energi8ed, thus 6loc'ing out6
one contactor if the other is energi8ed. Each time delay relay "ill ser&e a dual
purpose5 pre&enting the other contactor from energi8ing "hile the motor is running,
and pre&enting the same contactor from energi8ing until a prescri#ed time after
motor shutdo"n. The resulting circuit has the ad&antage of #eing simpler than the
pre&ious example5
9E?%E15
7otor contactor *or 6starter6+ coils are typically designated #y the letter 676 in
ladder logic diagrams.
Continuous motor operation "ith a momentary 6start6 s"itch is possi#le if a
normally-open 6seal-in6 contact from the contactor is connected in parallel "ith the
start s"itch, so that once the contactor is energi8ed it maintains po"er to itself and
'eeps itself 6latched6 on.
Time delay relays are commonly used in large motor control circuits to pre&ent the
motor from #eing started *or re&ersed+ until a certain amount of time has elapsed
from an e&ent.
.o" let4s examine some of the #asic instructions is greater detail to see more a#out
"hat each one does.
Load
The load *LD+ instruction is a normally open contact. %t is sometimes also called
examine if on.*@%(+ *as in examine the input to see if its physically on+ The sym#ol
for a load instruction is sho"n #elo".
3 LoaD *contact+ sym#ol
This is used "hen an input signal is needed to #e present for the sym#ol to turn on.
1hen the physical input is on "e can say that the instruction is True. 1e examine
the input for an on signal. %f the input is physically on then the sym#ol is on. 3n on
condition is also referred to as a logic state.
This sym#ol normally can #e used for internal inputs, external inputs and external
output contacts. 9emem#er that internal relays don4t physically exist. They are
simulated *soft"are+ relays.
The LoaDAar instruction is a normally closed contact. %t is sometimes also called
LoaD.ot or examine if closed. *@%C+ *as in examine the input to see if its physically
closed+ The sym#ol for a load#ar instruction is sho"n #elo".
3 LoaD.ot *normally closed contact+ sym#ol
This is used "hen an input signal does not need to #e present for the sym#ol to turn
on. 1hen the physical input is off "e can say that the instruction is True. 1e
examine the input for an off signal. %f the input is physically off then the sym#ol is
on. 3n off condition is also referred to as a logic ! state.
This sym#ol normally can #e used for internal inputs, external inputs and
sometimes, external output contacts. 9emem#er again that internal relays don4t
physically exist. They are simulated *soft"are+ relays. %t is the exact opposite of the
Load instruction.
B.(TE- 1ith most PLCs this instruction *Load or Load#ar+ 7CST #e the first sym#ol
on the left of the ladder.
Logic State Load LoadAar
! )alse True
True )alse
(ut
The (ut instruction is sometimes also called an (utputEnergi8e instruction. The
output instruction is li'e a relay coil. %ts sym#ol loo's as sho"n #elo".
3n (CT *coil+ sym#ol
1hen there is a path of True instructions preceding this on the ladder rung, it "ill
also #e True. 1hen the instruction is True it is physically (n. 1e can thin' of this
instruction as a normally open output. This instruction can #e used for internal coils
and external outputs.
(ut#ar
3n (CTAar *normally closed coil+ sym#ol
The (ut#ar instruction is sometimes also called an (ut.ot instruction. Some
&endors don4t ha&e this instruction. The out#ar instruction is li'e a normally closed
relay coil. %ts sym#ol loo's li'e that sho"n #elo".
1hen there is a path of )alse instructions preceding this on the ladder rung, it "ill
#e True. 1hen the instruction is True it is physically (n. 1e can thin' of this
instruction as a normally closed output. This instruction can #e used for internal
coils and external outputs. %t is the exact opposite of the (ut instruction.Logic State
(ut (utAar
! )alse True
True )alse

You might also like