Upload
veronica-craig
View
232
Download
0
Tags:
Embed Size (px)
Citation preview
Counters
Count Up/Down Counter (CTUD)
Counts up each time the count up (CU) input turns on and counts down each time the count down input (CD) turns on.
When the current value is equal to or greater than the preset value (PV), the counter bit for the designated counter is a logic 1. Otherwise, the counter bit is a logic 0.
If the count reaches 32,767, the next count changes the current value to -32,768.
The counter current value is reset to zero when the reset (R) input turns or when the Reset instruction is executed.
Counters
Counter Example
A counter might be used to keep track of the number of vehicles in a parking lot. As vehicles enter the lot through an entrance gate, the counter counts up. As vehicles exit the lot through an exit gate, the counter counts down. When the lot is full a sign at the entrance gate turns on indicating the lot is full.
Counters
Program
A robot is used to load/unload parts to a machine from a conveyor. The layout of the system is shown in Figure. The process can be described as follows.
• A part comes along the conveyor. When it touches a micro switch, it is scanned by a bar code reader to identify it .If the part is the desired one, a stopper is activated to stop it. A robot pocks up the part and loads it onto the machine if it is idle. Otherwise the robot waits to unload the machine.
Robotic Material Handling Control System – A Case Study
ProgramExplanation of the program
Rung 1: If a part arrives and no part is stopped, trigger the bar-code reader.
Rung 2: If it is a right part, activate the stopper.
Rung 3: If the stopper is up, the machine is not busy and the robot is not busy; load the part onto the machine.
Rung 4:If the task is completed and the robot is not busy, unload the machine.
ID DESCRIPTION STATE EXPLANATION
MSI Microswitch 1 Part arrives
R1 Output tobar-codereader
1 Scan the part
C1 Input from bar-code reader
1 Right part
R2 Output robot 1 Loading cycle
R3 Output robot 1 Unloading cycle
C2 Input from robot
1 Robot busy
R4 Output to stopper
1 Stopper up
C3 Input from machine
1 Machine busy
C4 Input from machine
1 Task complete
WIRING DIAGRAM
Ladder Diagram
PLC PROGRAMMING – EXAMPLE 1
• A robot is to be used to unload finished parts from a machine onto an AGV and to load
raw parts from the AGV to the machine. Assume that there are sensors at the AGV's
docking station to indicate the arrival of a vehicle and onboard sensors indicating
whether the vehicle has brought a raw part to be processed as well as whether the AGV
has space to carry away a finished part.
Also assume there are sensors on the machine to indicate whether the machine
is loaded with a part and also to signal completion of part processing. The robot is
required to unload a processed part from the machine onto the AGV, pick up a new part
for processing from the AGV, and load it onto the machine. The AGV is to be dispatched
after completion of the cycle. Construct a ladder logic diagram for this task.
I/O ASSIGNMENTS
LADDER LOGIC DIAGRAM
• During the powder metallurgy process, a punch is used to press blended
metal powder into a .compact insid~a die. A pushbutton is used to start the
process. When the start button is pressed, the die is filled with powder. The
punch is then advanced and it applies pressure to the powder for a duration
of 10 s, after which it is retracted.
The pressed compact is then ejected from the die and the cycle
repeats. The cycle can be interrupted by pressing a stop button. If the stop
button is pressed, the punch is required to retract (if it had been advanced)
before the process is stopped. We are required to construct a ladder logic
diagram for this task.
PLC PROGRAMMING – EXAMPLE 2
I/O ASSIGNMENTS
LADDER LOGIC DIAGRAM
Move and Clear Instructions The move instruction is used to move values from one location to another
location without changing the values. Similarly, the clear instruction clears a memory location of its contents.
Conditional Actions
In programming, it is often desirable to perform an action conditional on some other event. Advanced PLCs have a comparison instruction set to enable this to be more easily accomplished. Typical comparison instructions are:
– Equal to– Not equal to– Less than– Greater than– Less than or equal to– Greater than
Continuous Control
Advanced PLCs are used in conjunction with analog devices for continuous control.
This is typically done by assigning input and output addresses of the PLC to the analog device and communicating with the device by reading from and writing to those addresses.
SFC (Sequential Flow Chart)
START STEP
ACTION D1N D1_READY
D ACTION D2 D2_READY
SFC describes sequences of operations and interactions between parallel processes.It is derived from the languages Grafcet and SDL (used for communication protocols),its mathematical foundation lies in Petri Nets.
T1
T2
STEP BSTEP A
SFC: ELEMENTS
Ec = ((varX & varY) | varZ)
The sequential program consists of states connected by transitions.
A state is activated by the presence of a token (the corresponding variable becomes TRUE).The token leaves the state when the transition condition (event) on the state output is true. Only one transition takes place at a time, the execution period is a configuration parameter
token
Sa
Sb
"1"
Ea
Sc
Eb
transitions
states
event condition("1" = always true)
example transition condition
example: Sc is true, S0, Sa, Sb are false
S0
SFC: Initial stateState which come into existence with a token are called initial states.
All initial states receive exactly one token, the other states receive none.
Initialization takes place explicitly at start-up.
In some systems, initialization may be triggered in a user program(initialization pin in a function block).
SFC: Switch and parallel execution
Eb
Sa
Sb
"1"
Ea
Se
token switch: the token crosses the first active transition (at random if both Ea and Eb are true)
Ec
token forking: when the transition Ee is true, the token is replicated to all connected states
Ed
token join: when all tokens are present,and the transition Ef is true, one single token is forwarded.
Ee
Sc
Sd
Sf Sg
Ef
SFC: P1, N and P0 actionsP1 State1_P1: do at enter
N State1_N: do while
P0 State1_P0: do at leaving
State1
P1 (pulse raise) action is executed once when the state is enteredP0 (pulse fall) action is executed once when the state is leftN (non-stored) action is executed continuously while the token is in the state
P1 and P0 actions could be replaced by additional states.
The actions are described by a code block written e.g. in Structured Text.
SFC: graphic rulesThe input and output flow of a state are always in the same vertical line (simplifies structure)
Alternative paths are drawn such that no path is placed in the vertical flow (otherwise would mean this is a preferential path)
intentional displacement to
avoid optical preference of a
path.
Priority:• The alternative path most to the left has the
highest priority, priority decreases towards the right.
• Loop: exit has a higher priority than loopback.
SFC: Building subprograms
::=
::=
OR: OR:
OR: OR:
T-element
S-element
state S-sequence parallel paths
transition T-sequence alternative paths
loop
OR:
The meta-symbols T and S define structures - they may not appear as elements in the flow chart.
A flow chart may only contain the terminal symbols: state and transition
SFC: StructuringEvery flow chart without a token generator may be redrawn as astructured flow chart (by possibly duplicating program parts)
A
B
C
a
b
d
c
Not structured
A
B
C
a
b
a
bB'
A'
d
c
d
structured
SFC: Complex structures
Problems with general networks:deadlocksuncontrolled token multiplication
These general rules serve to build networks, termed by DIN and IEC as flow charts
Solution:assistance through the flow chart editor.
Executing Flow Charts As blocksA function block may be implemented in three different ways:
procedure xy(...);begin ...end xy;
extern (ST) function blocks flow chart
Function blocks and flow chart communicate over binary signals.
Flow Charts Or Function blocks ?A task can sometimes be written indifferently as function blocks or as flow chart.The application may decide which representation is more appropriate:
c
d
"1"
b
a
a
b c
d
Flow Chart Function Block
NOT
S
R
Flow Charts Or Blocks ? (2)
In this example, flow chart seems to be more appropriate:
A
B
C
"1"
a
bc
S
R
≥
&
S
R&
S
R&
init
a
b
c
A
B
C
Flow Chart Function Blocks