You are on page 1of 22

Outline

Program Scan and Memory Organization


Logic Statements and Ladder Diagrams
State to Logic Statement Translation
Procedure
An example

PLC Application Examples

PLC Program Scan and Memory

(a) PLC operation


(c) Memory organization
(b) Program sequence
Adapted from Parr, Programmable Controllers (3rd Ed.), Newnes, Burlington, MA, 2003.

Logic Statements and Ladder Diagrams


A, B, O, are logic variables {1,0}
B=A
NOT A:

C = A B
A AND B:

A OR C
B: = A+B
C = A B
NOT (A AND B):
C = A+B
NOT (A OR B):

inputs,
outputs,
computed,
etc.

Generic State Si
logic for Sm to Si
state transition

logic for Si to Sj
state transition

Sm

Sj

Sn

Si

Sk

all the states that


transit to Si

all the states that


Si transits to

Generic Logic Statement for State Si


"memory" or
all states
all states
"hold" for
that transit
that Si
state Si
to Si
transits to

+ Sn
Si = (Si + Sm
+ )SjSk
logic for
logic for
Sn to Si
Sm to Si
transition
transition

Generic Logic Statement for State Si


"memory" or
all states
all states
"hold" for
that transit
that Si
state Si
to Si
transits to

+ Sn
Si = (Si + Sm
+ )SjSk
logic for
logic for
Sn to Si
Sm to Si
transition
transition
Generic Logic Statement for Output Oi
Oi = Sp + Sq +
all states where Oi is true (on)

State to Logic Statement Translation


1) Add dummy states so no state both
directly precedes and follows another
(eliminate bi-directional transitions).
2) Construct a statement for state S1.
3) Before the statement for S1, construct
statements for states succeeding S1.

4) Apply step (3) until a statement has


been constructed for each state.
5) Add a statement for each output.

Motor Control Logic with Time Delay


STOP

STARTSTOP

MOTOR = 0
TIMER = 0

MOTOR = 0
TIMER = 0

STOP
TIMER [2 sec]

MOTOR = 0
TIMER = 1

MOTOR = 1
TIMER = 0

Motor Control Logic with Time Delay


STOP

STARTSTOP

MOTOR = 0
TIMER = 0

MOTOR = 0
TIMER = 0

STOP
TIMER [2 sec]

MOTOR = 0
TIMER = 1

MOTOR = 1
TIMER = 0

S3 (S3 + S2TIMER[2 sec])S1


S2 (S2 + Sd)S1S3
Sd (Sd + S1STARTSTOP)S2
S1 = (S1 + S2STOP + S3STOP)Sd

Motor Control Logic with Time Delay


STOP

STARTSTOP

MOTOR = 0
TIMER = 0

MOTOR = 0
TIMER = 0

STOP
TIMER [2 sec]

MOTOR = 0
TIMER = 1

MOTOR = 1
TIMER = 0

S3 (S3 + S2TIMER[2 sec])S1


S2 (S2 + Sd)S1S3
Sd = (Sd + S1STARTSTOP)S2
S1 = (S1 + S2STOP + S3STOP)Sd

Motor Control Logic with Time Delay


STOP

STARTSTOP

MOTOR = 0
TIMER = 0

MOTOR = 0
TIMER = 0

STOP
TIMER [2 sec]

MOTOR = 0
TIMER = 1

MOTOR = 1
TIMER = 0

S3 (S3 + S2TIMER[2 sec])S1


S2 = (S2 + Sd)S1S3
Sd = (Sd + S1STARTSTOP)S2
S1 = (S1 + S2STOP + S3STOP)Sd

Motor Control Logic with Time Delay


STOP

STARTSTOP

MOTOR = 0
TIMER = 0

MOTOR = 0
TIMER = 0

STOP
TIMER [2 sec]

MOTOR = 0
TIMER = 1

MOTOR = 1
TIMER = 0

S3 = (S3 + S2TIMER[2 sec])S1


S2 = (S2 + Sd)S1S3
Sd = (Sd + S1STARTSTOP)S2
S1 = (S1 + S2STOP + S3STOP)Sd

Motor Control Logic with Time Delay


STOP

STARTSTOP

MOTOR = 0
TIMER = 0

MOTOR = 0
TIMER = 0

STOP
TIMER [2 sec]

MOTOR = 0
TIMER = 1

MOTOR = 1
TIMER = 0

S3 = (S3 + S2TIMER[2 sec])S1


S2 = (S2 + Sd)S1S3
Sd = (Sd + S1STARTSTOP)S2
S1 = (S1 + S2STOP + S3STOP)Sd
MOTOR = S3

Motor Control Logic with Time Delay


STOP

STARTSTOP

MOTOR = 0
TIMER = 0

MOTOR = 0
TIMER = 0

STOP
TIMER [2 sec]

MOTOR = 0
TIMER = 1

MOTOR = 1
TIMER = 0

S3 = (S3 + S2TIMER[2 sec])S1


S2 = (S2 + Sd)S1S3
Sd = (Sd + S1STARTSTOP)S2
S1 = (S1 + S2STOP + S3STOP)Sd
MOTOR = S3
TIMER = S2

Motor Control Logic with Time Delay


STOP

STARTSTOP

MOTOR = 0
TIMER = 0

MOTOR = 0
TIMER = 0

STOP
TIMER [2 sec]

MOTOR = 0
TIMER = 1

MOTOR = 1
TIMER = 0

S3 = (S3 + S2TIMER[2 sec])S1


S2 = (S2 + Sd)S1S3
Sd = (Sd + S1STARTSTOP)S2
S1 = (S1 + S2STOP + S3STOP)Sd
MOTOR = S3
TIMER = S2

computation
cycle

Need for Dummy State


STOP

STARTSTOP

MOTOR = 0
TIMER = 0

STOP
TIMER [2 sec]

MOTOR = 0
TIMER = 1

direct bi-directional transition

MOTOR = 1
TIMER = 0

Need for Dummy State


STOP

STARTSTOP

MOTOR = 0
TIMER = 0

STOP
TIMER [2 sec]

MOTOR = 0
TIMER = 1

MOTOR = 1
TIMER = 0

direct bi-directional transition


S3 (S3 + S2TIMER[2 sec])S1
S2 (S2 + S1)S1S3

S1 (S1 + S2STOP + S 3STOP)S2


MOTOR S3
TIMER S2

Need for Dummy State


STOP

STARTSTOP

MOTOR = 0
TIMER = 0

STOP
TIMER [2 sec]

MOTOR = 0
TIMER = 1

MOTOR = 1
TIMER = 0

direct bi-directional transition


S3 (S3 + S2TIMER[2 sec])S1
problem:
S2 (S2 + S1)S1S3
cannot reach S2
S1 (S1 + S2STOP + S 3STOP)S2

MOTOR S3 problem:
TIMER S2 cannot reach S1 from S2

An Example of PLC Application

Elevator controller problem statement


Elevator controller state transition diagram
Dummy states if necessary
State transition diagram to ladder diagram
State transition diagram to logic statement

Elevator Controller Problem Statement


Use a state diagram to describe an elevator control system
from the time the elevator reaches a floor to when it is
ready to leave the floor.

Elevator Controller Problem Statement


Operation is governed by the following rules:

It is initially in a state with the doors opening.


When the doors are fully opened, a limit switch is triggered.
The doors should remain open for 10 seconds before closing.
Doors cannot close if the doors open button is active.
Doors cannot close if the door collision switch is active.
While the doors are closing, they must be able to re-open.
Once re-opened, the doors should remain open for 3 seconds.
When the doors are fully closed, a limit switch is triggered.
This should be the final state of your state diagram

SAFETY POINT: At any time if the door collision switch turns on,
the doors must open

Elevator Controller Problem Statement


Identify the states and draw a state transition
diagram for the elevator control system
Add any dummy states as necessary to
implement a ladder diagram
Select a state and draw a ladder diagram for
the selected state and any outputs affected by
that state
Write control logic statements for the selected
state and any outputs affected by the state

You might also like