Professional Documents
Culture Documents
ME6405ME6405
2
2
1
1
3
3
Off: contacts 1 and 2 connected On: contacts 1 and 3 connected
Pins 1 and 2 are normally closed since they are connected when the
switch is off. T Pins 1 and 2 are not connected when the switch is on.
Pins 1 and 3 are normally open since they are not connected when the
switch is off. Pins 1 and 3 are connected when the switch is on.
(Note: Although this is a toggle switch, this switch can symbolize any type
of input source such as push button switches, sensors, power supplies,
etc. in this lecture.)
George W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405Relay Control Panel Components : Coil
ME6405ME6405Relay Control Panel Components : Coil
Coil off Coil on
32
32
Off: Coil off, contacts ON: Coil on, contacts
1 and 2 connected 1 and 3 connected
A relay is a combination of coil and switch.
With coil off, the switch goes to its normal position off.
Coil
2
3
1
NOT Switch 1 on = Coil off
V+ Switch 1
Coil
George W. Woodruff School of Mechanical Engineering, Georgia Tech
2
3
1
ME6405
ME6405ME6405
Relay Logic : AND
Using two switches, a logical AND operation can
be constructed. An example is given below:
Switch 1 AND Switch 2 = Coil
V+ Switch 1 Switch 2 Coil
George W. Woodruff School of Mechanical Engineering, Georgia Tech
2
3
1
2
3
1
ME6405
ME6405ME6405
Relay Logic : AND (continued)
Switch 1 off AND Switch 2 off = Coil off
V+ Switch 1 Switch 2 Coil
2
3
1
2
3
1
Switch 1 on AND Switch 2 off = Coil off
V+ Switch 1 Switch 2 Coil
2
3
1
2
3
1
ME6405
ME6405ME6405
Relay Logic : AND (continued)
Switch 1 off AND Switch 2 on = Coil off
V+ Switch 1 Switch 2 Coil
2
3
1
2
3
1
Switch 1 on AND Switch 2 on = Coil on
V+ Switch 1 Switch 2 Coil
2
3
1
2
3
1
ME6405
ME6405ME6405
Relay Logic : OR
Using two switches, a logical OR operation can
be constructed. An example is given below:
Switch 1 OR Switch 2 = Coil
V+ Switch 1
2 Coil
1
3
Switch 2
2
1
3
Switch 2
2
1
3
Switch 2
2
1
3
Switch 2
2
1
3
Switch 2
2
1
3
V+
V+
V+
George W. Woodruff School of Mechanical Engineering, Georgia Tech
2
1
2
2
2
3
1
Switch 1
Switch 2
2
3
1
1
2
1
3
1
33
3
Coil
ME6405
ME6405ME6405
Relay Logic : XOR (continued)
Switch 1 off XOR Switch 2 on = Coil on
V+
V+
V+
George W. Woodruff School of Mechanical Engineering, Georgia Tech
2
3
1
1
23
1
3 2
1
3 2
1
3 2
Switch 1
Switch 2
2
3
1
Coil
ME6405
ME6405ME6405
Relay Logic : XOR (continued)
Switch 1 on XOR Switch 2 on = Coil off
George W. Woodruff School of Mechanical Engineering, Georgia Tech
2
3
1
1
23
1
3 2
1
3 2
1
3 2
V+ Switch 1
Switch 2
2
3
1
V+ V+
Coil
ME6405
ME6405ME6405
Problems with relay control panels:
Siemens PS307 5A
George W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405
ME6405ME6405
Basic PLC: Micro-controller
SYSTEM Memory
Memory is RAM
Is used by micro-controller to implement counters, timers, interrupt
stacks, etc..
Contains a bit for each D I/0
Contains Marker Memory . Marker memory is a free area of RAM
that can be used by the programmer. (In S7 314C-2 PtP, 258
bytes are available as Marker Memory)
Contains Process Input and Output Images. Periodically the PLC
will store the states of the inputs to the Process Input Image and
Process Output Image to the output. (In S7 314C-2 PtP, this is
limited to the first 128 bytes of input information and 128 bytes of
output information.)
George W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405
ME6405ME6405
Section Objectives:
Initially PLCs were used to directly replace relay control
panels. To directly replace relay control panels based on
mechanical relays with PLCs based on a micro-controller
presented challenges. These challenges and solutions will
be discussed.
George W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405
ME6405ME6405
Transition:A Simplified Programmer s Model
In the simplified programmer s model of relay logic, all inputs I1, I2, .., Im go
into each relay logic section. Each relay logic section then produces an
output Q.
Q1
Relay Logic Section 2
I1,I2, ,Im
Q2
.
.
.
Qn
George W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405
ME6405ME6405
Transition: Relay control panel execution of Model
A relay control panel will execute all relay logic sections in parallel since
each switch is capable of powering many coils at a time. If any input
changes at time t0 then all the relay logic sections will update the outputs
at time t1.
Q1 changes at t1
I1,I2, ,Im changes at t0
Relay Logic Section 2
Q2 changes at t1
I1,I2, ,Im changes at t0
.
.
.
Qn changes at t1
Relay Logic Section n
I1,I2, ,Im changes at t0
A PLC will execute all relay logic sections in series since a micro-
controller can execute only one instruction at a time. If any input changes
at time t0 then relay logic section 1 will update Q1 at t1, relay logic section
2 will update Q2 at t2, . , and relay logic section n will update Qn at tn.
Q1 changes at t1
I1,I2, ,Im changes at t0
Relay Logic Section 2
Q2 changes at t2
I1,I2, ,Im changes at t0
.
.
.
Qn changes at tn
Relay Logic Section n
I1,I2, ,Im changes at t0
Difference 1:
Relay Control Panel The maximum time any change in input is reflected in any out
put is t1.
PLC The maximum time any change in input is reflected in any output is t1+t2+ +tN.
Difference 2:
Relay Control Panel Since this is made from analogue components. It is possible
to replace
a logic section without stopping execution of other logic sections if wired corr
ectly.
PLC This is made with a digital micro-controller. The micro-controller must be h
alted to
replace a logic section. All other logic sections will stop operation.
Difference 3:
Relay Control Panel Since parallel execution of logic sections, all outputs are
a function of
one set of inputs.
PLC Since serial execution of logic sections, all outputs may not be a function
of one set of
inputs. (example: input I2 may change as the micro-controller is processing Logi
c section
2. Therefore Q1 and Q2 are based on different inputs)
ME6405
ME6405ME6405
Transition: PLC Operation
To minimize the effects of differences between the Relay Control Panel and PLC
execution of the programming model, the PLC operates in the following manner:
Warm Restart
Update Process Image Input
User Program
Update Process Image Output
PLC System Processes
scan cycle
Steps:
Section Objectives:
The biggest transition from relay control panels to PLCs
was the transition from the hard wired relay logic to logic
defined by user program. In order to allow established relay
logic users to program the PLC, a visual programming
language that looks like a relay control panel was created.
This visual programming language is called Ladder Logic .
In this section, basic Ladder Logic will be presented.
George W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405
ME6405ME6405
Ladder Logic: System Memory Addressing
Examples:
MB0
M1.3
(Note: only bit 3 of
MW1
Marker Area byte 1)
MD3
MD4
Marker Area
Byte 0
Byte 1
Byte 2
Byte 3
Byte 4
Byte 5
Byte 6
Byte 7
ME6405
ME6405ME6405
Ladder Logic: System Memory Addressing (continued)
Examples:
PIB1PI2.5
(Note: only bit 5 of
Peripherial Input Area byte 2)
PID4
Peripheral Input
Area
Byte 0
Byte 1
Byte 2
Byte 3
Byte 4
Byte 5
Byte 6
Byte 7
ME6405
ME6405ME6405
Ladder Logic : The Ladder
A ladder logic program has a ladder look to it. The sides of the ladder
are the power rail on the left and ground rail on the right. The rungs of the
ladder consists of Virtual Relay Components. (Note: Rungs are called
Networks in Step 7)
George W. Woodruff School of Mechanical Engineering, Georgia Tech
Virtual Relay Components
Virtual Relay Components
Virtual Relay Components
Power RailGround Rail
ME6405
ME6405ME6405
Ladder Logic : Virtual Relays
Any Marker or Function Block memory bit can be one or more virtual relays.
If memory bit is 0, the coils of virtual relays associated with the bit are off.
If
memory bit is 1, the coils of virtual relays associated with the bit are on.
Any D I/O memory bit ( Peripheral or Process Image) is a virtual relay for a
digital input or output pin of the PLC.
Mechanical Relay
1
32
Switch 1 is wired to PLC input pin associated with Virtual Input Relay
I0.0
Coil is wired to PLC output pin associated with Virtual Output Relay
Q0.0
I0.0 Q0.0
V+ Switch 2
1
(Note: Wired to PLC
Input Pin Associated
with Virtual Input
Relay I0.1)
Virtual Input
Relay at I0.1
3
2
1
3 2
V+
V+
1
3 2
Inside PLC
Virtual Output
Relay at Q0.0
Virtual Input
Relay at I0.0
2
1
3 2
Coil
Switch 1 is wired to PLC input pin associated with Virtual Input Relay
I0.0
Switch 2 is wired to PLC input pin associated with Virtual Input Relay
I0.1
Coil is wired to PLC output pin associated with Virtual Output Relay
Q0.0
George W. Woodruff School of Mechanical Engineering, Georgia Tech
I0.0 Q0.0I0.1
ME6405
ME6405ME6405
Ladder Logic : OR
Switch 1 OR Switch 2 = Coil
From Relay Logic:
V+ Switch 1
2 Coil
1
3
Switch 2
2
1
3
V+ Switch 2
1
(Note: Wired to PLC
Input Pin Associated
with Virtual Input
Relay I0.1)
Virtual Input
Relay at I0.1
3
2
1
3 2
V+
V+
1
3 2
Inside PLC
Virtual Output
Relay at Q0.0
Virtual Input
Relay at I0.0
2
1
3 2
V+
Coil
Switch 1 is wired to PLC input pin associated with Virtual Input Relay
I0.0
Switch 2 is wired to PLC input pin associated with Virtual Input Relay
I0.1
Coil is wired to PLC output pin associated with Virtual Output Relay
Q0.0
I0.0
I0.1
Q0.0
Switch 1 is wired to PLC input pin associated with Virtual Input Relay
I0.0
Switch 2 is wired to PLC input pin associated with Virtual Input Relay
I0.1
Coil is wired to PLC output pin associated with Virtual Output Relay
Q0.0
George W. Woodruff School of Mechanical Engineering, Georgia Tech
I0.0 Q0.0
I0.0
I0.1
I0.1
ME6405
ME6405ME6405
Description:
Set Coil is executed only if power flows to the coil. When executed, the specifi
ed
<address> of the element is set to "1". It will remain set even if power is remo
ved
from the coil.
George W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405
ME6405ME6405
Bit Logic example: Set Coil and Reset Coil
Description:
Reset Coil is executed only if power flows to the coil. When executed, the
specified <address> of the element is reset to "0". No power flow to the coil ha
s
no effect and the state of the element's specified address remains unchanged.
(Note: can be used to reset timers and counters)
George W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405
ME6405ME6405
Bit Logic example: Set Coil and Reset Coil
Example:
Switch 1 connected to Input 0.0
Switch 2 connected to Input 0.1
Coil connected to Output 0.0
Integer: Equal to
Double Integer: Greater than or Equal to
Integer: Greater than
Double Integer: Less than or Equal to
Integer: Less than
Real: Equal to
Integer: Greater than or Equal to
Real: Greater than
Integer: Less than or Equal to
Real: Less than
Double Integer: Equal to
Real: Greater than or Equal to
Double Integer: Greater than
Real: Less than or Equal to
Double Integer: Less than
George W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405
ME6405ME6405
Comparator example: Integer Compares
ME6405
ME6405ME6405
Comparator example: Integer Compares
Example:
Coil connected to Output 0.0
If MW0 and MW2 are equal then turn on coil.
Q0.0
CMP
== I
MW0
MW2
IN1
IN2
George W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405
ME6405ME6405
Jumps
Available Jump components (Note: called Logic control in Step 7 Help)
Label
Unconditional Jump
Conditional Jump
Not conditional Jump
George W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405
ME6405ME6405
Jump example: Conditional Jump
Example:
Switch 1 connected to Input 0.0
If Switch 1 turns on then jump to label END
I0.0
END
I0.1
JMP
Q0.0
Components
Components
END
ME6405
ME6405ME6405
Integer Math
Description:
IN1 and IN2 are added and the result is stored in OUT when power is
applied to EN . Power flows out of EN0 when power is applied to EN unless
the addition results in overflow.
ME6405
ME6405ME6405
Math example: Integer Add
Example:
Add 5 and integer stored at MW0. Store the result in MW2.
ADD_I
5
MW0
IN1
IN2
EN EN0
OUT MW2
ME6405
ME6405ME6405
Move
Available Move components:
Move
Description:
IN is moved to Out and power flows out of EN0 when power is applied to
EN.
ME6405
ME6405ME6405
Move example:
Example:
Move 5 to MW2.
MOVE
5 IN1
EN EN0
OUT MW2
ME6405
ME6405ME6405
Timer
Available Timer components:
Pulse S5 Timer
Extended Pulse S5 Timer
On-Delay S5 Timer
Retentive On-Delay S5 Timer
Off-Delay S5 Timer
Pulse Timer Coil
Extended Pusle Timer Coil
On-Delay Timer Coil
Retentive On-Delay Timer Coil
Off-Delay Timer Coil
George W. Woodruff School of Mechanical Engineering, Georgia Tech
Description: Description:
ME6405
ME6405ME6405
Timer example: Extended Pulse S5 Timer
A power transition from OFF to ON on S will restart the timer. Power flows
from Q while timer is running. The timer will run for a preset time TV.
(Note: 256 timers allowed in S7 314C-PtP PLC)
ME6405
ME6405ME6405
Timer example:
Example:
Switch 1 connected to Input 0.0
Coil is connected to Output 0.0
XOR Word
Description:
IN1 AND IN2 is stored in OUT when power is applied to EN . Power flows
out of EN0 when power is applied to EN unless the addition results in
overflow.
ME6405
ME6405ME6405
Word Logic example: Integer Add
Example:
AND MW0 and MW2. Store the result in MW4.
WAND W
MW0
MW2
IN1
IN2
EN EN0
OUT MW4
George W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405
ME6405ME6405
Time:Scan cycle at t = 0
User Action: User turns Switch 1 on
T 0
S_EXt
S5T#2s TV
S Q
BI
RBCD
I0.0 Q0.0
S_EXt
S5T#2s TV
S Q
BI
RBCD
I0.0
T 1
Q0.0 M0.0
M0.0
(Note:
Time left: 2 s)
ME6405
ME6405ME6405
Example 1 : Continued
T 0
S_EXt
S5T#2s TV
S Q
BI
RBCD
I0.0 Q0.0
S_EXt
S5T#2s TV
S Q
BI
RBCD
I0.0
T 1
Q0.0 M0.0
M0.0
(Note:
Time left: ~0)
ME6405
ME6405ME6405
Example 1 : Continued
S_EXt
S5T#2s TV
S Q
BI
RBCD
I0.0 Q0.0
S_EXt
S5T#2s TV
S Q
BI
RBCD
I0.0
T 1
Q0.0 M0.0
M0.0
(Note:
Time left: 2 s)
ME6405
ME6405ME6405
Example 1 : Continued
(Note: a Hall effect switch will turn on when a magnetic object comes
in close proximity)
The motor for a conveyer belt is connected to Output 0.0
(Note: As previously mentioned, a coil can be any load such as a
motor during these lectures.)
If Switch 1 is turned on, the conveyer belt will transport 1000 magnetic
SHAFTS to Georgia Tech Students. Switch 1 must be turned off then on to
send another 1000 magnetic SHAFTS. The hall affect switch is positioned
right under the conveyer belt and can be used to count the SHAFTS as
they pass by.
George W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405Example 2 (Continued)
I0.1
Time: Scan cycle right before t = 0s
Actions : no part near hall effect switch
Q0.0M0.0I0.0
S
I0.1
M0.1
ADD_I
IN1
IN2
EN EN0
OUTMW1
1
MW1
Move
IN1
EN EN0
OUT0 MW1
M0.1 M0.1
S
Q0.0
R
CMP
== I
IN1
IN2MW1
1001
M0.0
S
Q0.0
M0.0
R
I0.0
R
ME6405
ME6405ME6405
Example 2 (Continued)
Example 2 (Continued)
So far we have looked at topics applicable to all PLC s. Further Study Should focu
s
on:
Topics applicable to some but not all PLC s:
Interrupts
A/
D
Counters
Function Blocks
Communication Protocol:
Profibus
How to use communications to communicate with other PLC s,
smart actuators and sensors, etc