Download presentation
1
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. The 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.
2
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.
3
Counters Program Count Up/down Counter C48 is used in this example. A switch, connected to the entrance gate is wired to input I0.0. A switch, connected to the exit gate, is wired to input I0.1. A reset switch, located at the collection booth, is wired to input I0.2. The parking lot has 150 parking spaces. This value has been stored in the preset value (PV). The counter output controls output Q0.1. This output is connected to a “Parking Lot Full” sign. When a car enters the lot, the entrance gate opens. Input I0.0 transitions from a logic 0 to a logic 1, increasing the count by one. When a car leaves the lot, the exit gate opens. Input I0.1 transitions from a logic 0 to a logic 1 decreasing the count by 1. When the count reaches 150, output Q0.1 turns on and the “Parking Lot Full” sign illuminates. When a car exits, decreasing the count to 149, the sign turns off.
4
Robotic Material Handling Control System – A Case Study
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.
5
Program Explanation 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.
6
WIRING DIAGRAM MSI Microswitch 1 Part arrives R1 Output to bar-code
ID DESCRIPTION STATE EXPLANATION MSI Microswitch 1 Part arrives R1 Output to bar-code reader Scan the part C1 Input from bar-code reader Right part R2 Output robot Loading cycle R3 Unloading cycle C2 Input from robot Robot busy R4 Output to stopper Stopper up C3 Input from machine Machine busy C4 Task complete
7
Ladder Diagram
8
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.
9
I/O ASSIGNMENTS
10
LADDER LOGIC DIAGRAM
11
PLC PROGRAMMING – EXAMPLE 2
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.
12
I/O ASSIGNMENTS
13
LADDER LOGIC DIAGRAM
14
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
15
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.
16
SFC (Sequential Flow Chart)
START STEP T1 N ACTION D1 D1_READY STEP A STEP B D ACTION D2 D2_READY T2 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.
17
SFC: ELEMENTS S0 event condition "1" ("1" = always true) transitions
Sa example transition condition Ea Ec = ((varX & varY) | varZ) states Sb Eb token Sc example: Sc is true, S0, Sa, Sb are false 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
18
SFC: Initial state State 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).
19
SFC: Switch and parallel execution
"1" token switch : the token crosses the first active Sa transition (at random if both Ea and Eb are true) Ea Eb Sc Sb Ec Sd Ed token forking : when the transition Ee is true, the token Se is replicated to all connected states Ee Sf Sg token join : when all tokens are present, and the transition Ef is true, one single token is forwarded. Ef
20
SFC: P1, N and P0 actions State1 P1 State1_P1: do at enter N
State1_N: do while P0 State1_P0: do at leaving P1 (pulse raise) action is executed once when the state is entered P0 (pulse fall) action is executed once when the state is left N (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.
21
SFC: graphic rules The 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.
22
SFC: Building subprograms
T-element ::= OR: OR: transition T-sequence alternative paths S-element ::= OR: OR: OR: state S-sequence parallel paths loop 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
23
SFC: Structuring Every flow chart without a token generator may be redrawn as a structured flow chart (by possibly duplicating program parts) Not structured structured A a A B a b d B d C b c C B' c b d A' a
24
SFC: Complex structures
These general rules serve to build networks, termed by DIN and IEC as flow charts Problems with general networks: Solution: deadlocks assistance through the flow chart editor. uncontrolled token multiplication
25
Executing Flow Charts As blocks
A 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.
26
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: Flow Chart Function Block S a "1" b R c NOT d c b d a
27
Flow Charts Or Blocks ? (2)
Function Blocks init ≥ "1" S R A A & a a B S b R B C c & b S R C & c In this example, flow chart seems to be more appropriate:
28
Thank you
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.