plc - georgia institute of technologyume.gatech.edu/mechatronics_course/me4447_6405/plc.pdf ·...
TRANSCRIPT
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Section Objectives:
Before the invention of the Programmable Logic Controller (PLC), most industrial control was done using relay control panels.
Switches and relays can be arranged in circuits to make logical decisions. Output from these circuits can be used to drive “loads” such as motors, heaters, or electromagnetic coils. A relay control panel is comprised of a single to thousands of these circuits.
In this Section, relay control panels will be presented.
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Relay Control Panel Components : Switch
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.)
2
3
1
2
3
1
Off: contacts 1 and 2 connected On: contacts 1 and 3 connected
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Relay Control Panel Components : Coil
(Note: Although this is really an electromagnetic coil, this can symbolize any “load” such as a pump, dc motor, heating element, light, etc. for this lecture.)
Coil off Coil on
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Relay Control Panel Components : Relay
A relay is a combination of coil and switch.
With coil off, the switch goes to its normal position off.
With coil on, the switch is pulled by electromagnetic force to its on position.
Off: Coil off, contacts 1 and 2 connected
1
3 2
1
3 2ON: Coil on, contacts 1 and 3 connected
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Relay Logic : NOTUsing one switch, a logical “NOT” operation can be constructed. An example is given below:
“NOT” Switch 1 = Coil
V+ Switch 1 Coil2
3
1
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Relay Logic : NOT (Continued)“NOT” Switch 1 off = Coil on
V+ Switch 1 Coil2
3
1
V+ Switch 1 Coil2
3
1
“NOT” Switch 1 on = Coil off
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
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
2
3
1
2
3
1
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
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
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
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
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Relay Logic : ORUsing two switches, a logical “OR” operation can be constructed. An example is given below:
Switch 1 “OR” Switch 2 = Coil
2
3
1
V+ Switch 1
Switch 2
Coil2
3
1
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Relay Logic : ORSwitch 1 off “OR” Switch 2 off = Coil off
2
3
1
V+ Switch 1
Switch 2
Coil2
3
1
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Relay Logic : ORSwitch 1 on “OR” Switch 2 off = Coil on
2
3
1
V+ Switch 1
Switch 2
Coil2
3
1
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Relay Logic : ORSwitch 1 off “OR” Switch 2 on = Coil on
2
3
1
V+ Switch 1
Switch 2
Coil2
3
1
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Relay Logic : ORSwitch 1 on “OR” Switch 2 on = Coil on
2
3
1
V+ Switch 1
Switch 2
Coil2
3
1
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Relay Logic : XORUsing two switches and four relays, a logical “XOR” operation can be constructed. An example is given below:
Switch 1 “XOR” Switch 2 = Coil
V+
Coil
2
3
1
Switch 1
Switch 2
2
3
1
1
2
1
3 2
1 1
3 23 2
V+ V+
3
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Relay Logic : XOR (continued)
V+
Coil
2
3
1
Switch 1
Switch 2
2
3
1
1
2
1
3 2
1 1
3 23 2
V+ V+
3
Switch 1 off “XOR” Switch 2 off = Coil off
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
2
1
2
2
Relay Logic : XOR (continued)
V+
Coil
2
3
1
Switch 1
Switch 2
2
3
1
1
2
1
3
1
33
V+ V+
3
Switch 1 on “XOR” Switch 2 off = Coil on
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
2
3
1
1
23
1
3 2
1
3 2
1
3 2
Relay Logic : XOR (continued)
V+
Coil
Switch 1
Switch 2
2
3
1
V+ V+
Switch 1 off “XOR” Switch 2 on = Coil on
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
2
3
1
1
23
1
3 2
1
3 2
1
3 2
Relay Logic : XOR (continued)
V+
Coil
Switch 1
Switch 2
2
3
1
V+ V+
Switch 1 on “XOR” Switch 2 on = Coil off
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Problems with relay control panels:Mechanical Relays and switches failed regularly (coil failure, contact wear and contamination, etc.)
Difficult to diagnose problems and replace relays and switches
Difficult to change hardwired logic (example: changing an “OR” circuit to “XOR”)
Consumed a lot of power
To address these problems, Richard E. Morley of Bedford Associates invented the first PLC as a consulting project for General Electric in 1968. Bedford Associates is currently named Modicon and is a supplier of PLCs.
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Section Objectives:
Basic PLC Components needed to replace relay control panels will be presented. These include:
For this lecture, Siemens A&D S7 314C-2 PtP PLC installed in the Mechatronics Laboratory will be used as an example.
Siemens 314C-2 PtP
Isolated Power Supply
Micro-controller
(Note: Advanced features such as Timers, Interrupts, Counters, etc. will not be discussed in this lecture)
Digital Input and Output pins ( DI/0)
Memory
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Basic PLC: Isolated Power SupplyEvery PLC has an external or internal Isolated Power Supply.
Isolated Power Supplies can have more than one isolated output.
One isolated output is reserved for the PLC micro-controller. The rest is reserved for other components such as DI/O.
Normally Power supplies are high voltage. Typically 24 Volts forindustrial PLCs.
The S7 314C-2 PtP PLC uses the Siemens A&D PS307 5A power supply. The PS307 5A can source 5 amps of current at 24 volts. The PS307 5A has 3 isolated outputs.
Siemens PS307 5A
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Basic PLC: Micro-controller
Every PLC at least one micro-controller
The S7 314C-2 PtP PLC uses a custom micro-controller. Designed by Siemens A&D and manufactured by InfineonTechnologies AD.
Part Number:InfineonSiemens A&DIBC 16SXA1020A-ES7 Controller
Specifications not given in documentation
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Basic PLC: Digital Inputs and Outputs (DI/Os)
DI/Os are electrically isolated from the micro-controller
The number of DI/Os can be increased by adding additional DI/O modules.
Example:
The S7 314C-2 PtP PLC has 16 digital outputs and 24 digital inputs. Can be expanded up to 1024 DI/Os by adding additional DI/O modules.
SM232 DI/O module
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Basic PLC: Memory
Memory on a PLC is separated into 3 main areas:LOAD Memory• Can be RAM (dynamic) or EEPROM (retentive)
• Used to store user programs
• For S7 314C-2 PtP PLC : LOAD Memory located on memory card
WORK Memory• Memory is RAM
• When PLC starts, Program is copied from LOAD memory to WORK memory. The program is then executed from Work memory.
• For S7 314C-2 PtP PLC: 48K bytes of WORK memory
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Basic PLC: Memory ( Continued)
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 PLCwill 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 TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
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 TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Transition:A Simplified Programmer’s Model
I1,I2, … ,Im
I1,I2, … ,Im
I1,I2, … ,Im
Q1
Q2
Qn
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.
Relay Logic Section 2
.
.
.
Relay Logic Section n
Relay Logic Section 1
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Transition: Relay control panel execution of Model
Relay Logic Section 2
.
.
.
I1,I2, … ,Im changes at t0
Relay Logic Section n
Relay Logic Section 1
I1,I2, … ,Im changes at t0
I1,I2, … ,Im changes at t0
Q1 changes at t1
Q2 changes at t1
Qn changes at t1
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.
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Transition: PLC execution of Model
Relay Logic Section 2
.
.
.
I1,I2, … ,Im changes at t0
Relay Logic Section n
Relay Logic Section 1
I1,I2, … ,Im changes at t0
I1,I2, … ,Im changes at t0
Q1 changes at t1
Q2 changes at t2
Qn changes at tn
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.
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Transition: Differences in Relay Control Panel vs. PLC execution of Model
Difference 1:Relay Control Panel – The maximum time any change in input is reflected in any output 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 correctly.PLC – This is made with a digital micro-controller. The micro-controller must be halted 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 Logic section
2. Therefore Q1 and Q2 are based on different inputs)
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
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 Processesscan cycle
Steps:• PLC Restarts (Warm Restart)
• Reads Inputs and updates Process Input Image
• Executes User Program Once
• Writes Process Output Image to Outputs
• Take care of system processes ( such as communications with other PLCs, updating user program, etc..)
• Loop Back to step 2
Steps 2 through 5 is called a scan cycle. (Note: some people may refer to a PLC as a Programmable “Loop” Controller because of the scan cycle loop.)
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Transition: PLC OperationTo Minimize Difference 1:Time to complete a scan cycle can be set by user. If PLC violates the scan cycle, an interrupt
routine can be run or the PLC will halt execution. (For S7 314C-2 PtP, maximum scan cycle allowed is 6 sec)
To Minimize Difference 2:If a part of the user program is replaced, the new part is written first to LOAD memory. During
step 5, PLC System Processes, the new part is copied into WORK memory from LOAD Memory. During the next scan cycle, the new part of the user program will be executed.
To Minimize Difference 3:If the programmer uses the inputs stored in the Process Input Image, the user program will
have access to the same inputs per scan cycle. Also if the programmer, writes outputs to the Process Output Image, all the outputs will be updated simultaneously during step 4, Update Process Output Image.
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
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 TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Ladder Logic: System Memory Addressing
To address a bit of memory
To address a byte, word, or double word
___ ___ . ___
Memory AreaNotation
Byte Address Bit Number
___ ___ ___
Memory AreaNotation
Size of Addressed Memory Notation
Byte Address
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Ladder Logic: System Memory Addressing (continued)Memory Area Notations:
Local Memory of current Data BlockL
Data Block MemoryDB
Counter Storage AreaC
Timer Storage AreaT
Peripheral Output ( Actual Output Pins)PQ
Peripheral Input ( Actual Input Pins)PI
Marker MemoryM
Process Output ImageQ
Process Input ImageI
Memory AreaNotation
(Note: Advanced features such as Timers, Counters, Data Blocks will not be discussed in this lecture)
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Ladder Logic: System Memory Addressing (continued)Size of Addressed Memory Notations:
Double Word (32 bits)D
Word (16 bits)W
Byte (8 bits)B
Size of Addressed MemoryNotation
Byte Address:
Each Memory Area is addressed in one byte increments starting at byte 0.
Bit Number:
MSBit is 7 and LSBit is 0
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Ladder Logic: System Memory Addressing (continued)Examples:
Byte 5
Byte 6
Byte 7
Byte 4
Byte 3
Byte 2
Byte 1
Byte 0
Marker Area
M1.3 (Note: only bit 3 ofMarker Area byte 1)
MB0
MW1
MD4
MD3
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Ladder Logic: System Memory Addressing (continued)Examples:
Byte 5
Byte 6
Byte 7
Byte 4
Byte 3
Byte 2
Byte 1
Byte 0
Peripheral Input Area
PI2.5 (Note: only bit 5 ofPeripherial Input Area byte 2)
PIB1
PID4
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Ladder Logic : The LadderA 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)
Virtual Relay Components
Virtual Relay Components
Virtual Relay Components
Pow
er Rail
Ground R
ail
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Ladder Logic : Virtual RelaysAny 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
3 2
Virtual Relay Components:
Normally Open Switch ( equivalent to pins 1 and 3 of Mechanical Relay. If this switch is closed for a virtual digital output relay, the digital output pin is high. If this switch is open for a virtual digital output relay, the digital output pin is low )
Normally Closed Switch ( equivalent to pins 1 and 2 of Mechanical Relay)
Coil ( equivalent to coil of Mechanical Relay. Not available for virtual digital input relays)
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Ladder Logic: Rules for converting Relay Logic to Ladder Logic
Each external switch must be connected to an input pin of a PLC.
Each external coil or load must be connected to an output pin ofa PLC.
The relay logic must be recreated using virtual input and outputrelays associated with the input and output pins.
Only possible paths from power to ground though virtual relays need to be recreated in Ladder Logic.
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Ladder Logic : NOT
“NOT” Switch 1 = Coil
V+ Switch 1 Coil2
3
1
From Relay Logic:
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Ladder Logic : NOT (continued)
Relay Logic rewired to include Virtual Input and Output Relays:
V+Coil
3
Switch 12
1 1
3 2
1
3 2
V+V+
Inside PLC
Virtual OutputRelay at Q0.0
Virtual InputRelay at I0.0
(Note: Wired to PLC Input Pin Associated with Virtual Input Relay I0.0) (Note: Wired to PLC
Output Pin Associated with Virtual Output Relay Q0.0)
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Ladder Logic : NOT (continued)
Ladder Logic Equivalent:
Switch 1 is wired to PLC input pin associated with Virtual Input Relay I0.0Coil is wired to PLC output pin associated with Virtual Output Relay Q0.0
I0.0 Q0.0
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
V+ Switch 1 Switch 2 Coil
2
3
1
2
3
1
Ladder Logic : AND
From Relay Logic:
Switch 1 “AND” Switch 2 = Coil
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Virtual InputRelay at I0.1
Ladder Logic : AND (continued)Relay Logic rewired to include Virtual Input and Output Relays:
Coil
3
Switch 12
1
1
3 2
V+
V+
V+
1
3 2
Inside PLC
Virtual OutputRelay at Q0.0
Virtual InputRelay at I0.0
(Note: Wired to PLC Input Pin Associated with Virtual Input Relay I0.0)
Switch 22
1
V+
(Note: Wired to PLC Input Pin Associated with Virtual Input Relay I0.1)
(Note: Wired to PLC Output Pin Associated with Virtual Output Relay Q0.0)
1
3 2
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Ladder Logic : AND (continued)
Ladder Logic Equivalent:
Switch 1 is wired to PLC input pin associated with Virtual Input Relay I0.0Switch 2 is wired to PLC input pin associated with Virtual Input Relay I0.1Coil is wired to PLC output pin associated with Virtual Output Relay Q0.0
I0.0 Q0.0I0.1
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
2
3
1
V+ Switch 1
Switch 2
Coil2
3
1
Ladder Logic : OR
From Relay Logic:
Switch 1 “OR” Switch 2 = Coil
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Virtual InputRelay at I0.1
Ladder Logic : OR (continued)Relay Logic rewired to include Virtual Input and Output Relays:
Coil
3
Switch 12
1
1
3 2
V+
V+
V+
1
3 2
Inside PLC
Virtual OutputRelay at Q0.0
Virtual InputRelay at I0.0
(Note: Wired to PLC Input Pin Associated with Virtual Input Relay I0.0)
Switch 22
1
V+
(Note: Wired to PLC Input Pin Associated with Virtual Input Relay I0.1)
(Note: Wired to PLC Output Pin Associated with Virtual Output Relay Q0.0)
1
3 2
V+
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Ladder Logic : OR (continued)
Ladder Logic Equivalent:
Switch 1 is wired to PLC input pin associated with Virtual Input Relay I0.0Switch 2 is wired to PLC input pin associated with Virtual Input Relay I0.1Coil is wired to PLC output pin associated with Virtual Output Relay Q0.0
I0.0 Q0.0
I0.1
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
V+
Coil
2
3
1
Switch 1
Switch 2
2
3
1
1
2
1
3 2
1 1
3 23 2
V+ V+
3
Ladder Logic : XOR
From Relay Logic:
Switch 1 “OR” Switch 2 = Coil
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Virtual InputRelay at I0.1
Ladder Logic : XOR (continued)Relay Logic rewired to include Virtual Input and Output Relays:
Coil3
Switch 12
1
V+
Inside PLC
Virtual OutputRelay at Q0.0
Virtual InputRelay at I0.0
(Note: Wired to PLC Input Pin Associated with Virtual Input Relay I0.0)
Switch 22
1
V+
(Note: Wired to PLC Input Pin Associated with Virtual Input Relay I0.1)
(Note: Wired to PLC Output Pin Associated with Virtual Output Relay PQ0.0)
V+
1
3 2
1
3 2
V+
1
3 2
V+
1
3 2
1
3 2
Virtual InputRelay at I0.0
Virtual InputRelay at I0.1
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Ladder Logic : OR (continued)
Ladder Logic Equivalent:
Switch 1 is wired to PLC input pin associated with Virtual Input Relay I0.0Switch 2 is wired to PLC input pin associated with Virtual Input Relay I0.1Coil is wired to PLC output pin associated with Virtual Output Relay Q0.0
I0.0 Q0.0
I0.0
I0.1
I0.1
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Section Objectives:
A micro-controller can be used for more than relay logic with virtual relays. Ladder logic has components that take advantage of the micro-controller. These components can be categorized as follows: bit logic,comparator, converter, counter, data base calls, jumps, integer functions, floating point functions, move, program control, shift/rotate, status bits, timers, and word logic.
It is impossible to cover all of the components in one lecture. This lecture will first explain formatting of constants. Then, only a few categories and examples of components will be shown.
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Constants
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Constants
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Constants
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Constants
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Bit Logic
Available Bit logic components:
Normally Closed Switch
Normally Open Switch
Output Coil
Midline Output
Set Coil
Reset Coil
Invert Power Flow
Save RLO into BR Memory
Bit Exclusive OR
Positive Edge Detection
Negative Edge Detection
Address Positive Edge Detection
Address Negative Edge Detection
Set-Reset Flip Flop
Reset-Set Flip Flop
Immediate Read
Immediate Write
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Bit Logic example: Set Coil and Reset Coil
Description:Set Coil is executed only if power flows to the coil. When executed, the specified <address> of the element is set to "1". It will remain set even if power is removed from the coil.
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
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 has 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 TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Bit Logic example: Set Coil and Reset Coil
Example:Switch 1 connected to Input 0.0Switch 2 connected to Input 0.1Coil connected to Output 0.0
If Switch 1 turns on then turn on Coil and keep it on even if Switch 1 is released. If Switch 2 turns on then turn off the Coil.
I0.0 Q0.0
I0.1
S
Q0.0
R
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Comparator
Available Comparator components (Note: Integer is Word, Double Integer is Double Word)
Integer: Equal to
Integer: Greater than
Integer: Less than
Integer: Greater than or Equal to
Integer: Less than or Equal to
Double Integer: Equal to
Double Integer: Greater than
Double Integer: Less than
Double Integer: Greater than or Equal to
Double Integer: Less than or Equal to
Real: Equal to
Real: Greater than
Real: Less than
Real: Greater than or Equal to
Real: Less than or Equal to
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Comparator example: Integer Compares
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
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 TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
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 TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Jump example: Conditional Jump
Description Conditional Jump:The micro-controller will goto the specified Label if power flows into the JUMP. (Note: a label can be assigned to any Network)
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Jump example: Label and conditional JumpExample:
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
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Integer Math
Available Integer Math components:
Integer: Add
Integer: Subtract
Integer: Multiply
Integer: Divide
Double Integer: Add
(Note: Integer is Word, Double Integer is Double Word)
Double Integer: Subtract
Double Integer: Multiply
Double Integer: Divide
Double Integer: Modulus
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Math example: Integer Add
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.
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Math example: Integer AddExample:
Add 5 and integer stored at MW0. Store the result in MW2.
ADD_I
5
MW0
IN1
IN2
EN EN0
OUT MW2
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Move
Available Move components:
Move
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Move example:
Description:IN is moved to Out and power flows out of EN0 when power is applied to EN.
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Move example:Example:
Move 5 to MW2.
MOVE
5 IN1
EN EN0
OUT MW2
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
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 TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Timer example: Extended Pulse S5 Timer
Description: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)
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Timer example:Example:
Switch 1 connected to Input 0.0Coil is connected to Output 0.0
Turn on coil for 10 seconds if Switch 1 is turned on.
S_EXt
S5T#10s TV
S Q
BI
R BCD
I0.0 Q0.0T 0
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Word Logic
Available Word Logic components:
“AND” Word
“OR” Word
“XOR” Word
“AND” Double Word
“OR” Double Word
“XOR” Double Word
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Word Logic example: “AND” 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.
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Word Logic example: Integer AddExample:
“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 TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Section Objectives:
In this section two example ladder logic programs will be given.
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Example 1 :
Switch 1 connected to Input 0.0Coil connected to Output 0.0
If Switch 1 is on then turn on and off a coil at 2 second intervals (Note: 2 second interval means a period of 4 seconds and 50% Duty cycle).
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Example 1 (Continued)
S_EXt
S5T#2s TVS Q
BIR BCD
I0.0
M0.0
T 0
S_EXt
S5T#2s TVS Q
BIR BCD
I0.0T 1
Q0.0
Time: Scan cycle right before t = 0sUser Action : None
Q0.0M0.0
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Example 1 : Continued
S_EXt
S5T#2s TVS Q
BIR BCD
I0.0 Q0.0T 0
S_EXt
S5T#2s TVS Q
BIR BCD
I0.0T 1
Q0.0 M0.0
M0.0
Time:Scan cycle at t = 0User Action: User turns Switch 1 on
(Note:Time left: 2 s)
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Example 1 : Continued
S_EXt
S5T#2s TVS Q
BIR BCD
I0.0 Q0.0T 0
S_EXt
S5T#2s TVS Q
BIR BCD
I0.0T 1
Q0.0 M0.0
M0.0
Time: Scan cycle right before t = 2sUser Action: None
(Note:Time left: ~0)
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Example 1 : Continued
S_EXt
S5T#2s TVS Q
BIR BCD
I0.0 Q0.0T 0
S_EXt
S5T#2s TVS Q
BIR BCD
I0.0T 1
Q0.0 M0.0
M0.0
Time: Scan cycle at t = 2 sUser Action: None
(Note:Time left 0 s)
(Note: There is an inconsistency in this picture. The power is still flowing though the normally closed contact for M0.0 on the first rung even though the coil on the second rung for M0.0 is on. This is due to the serial nature of the PLC micro-controller. Since the first rung is evaluated first, the coil was still off when the micro-controller evaluated the normally closed contact for M0.0)
(Note:Time left: 2 s)
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Example 1 : Continued
S_EXt
S5T#2s TVS Q
BIR BCD
I0.0 Q0.0T 0
S_EXt
S5T#2s TVS Q
BIR BCD
I0.0T 1
Q0.0 M0.0
M0.0
Time: Scan cycle right after t = 2 sUser Action: None
(Note: Inconsistency from the previous slide resolved)
(Note:Time left: 2 s – 1 scan cycle time)
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Example 1 : Continued
S_EXt
S5T#2s TVS Q
BIR BCD
I0.0 Q0.0T 0
S_EXt
S5T#2s TVS Q
BIR BCD
I0.0T 1
Q0.0 M0.0
M0.0
Time: Scan cycle right before t = 4 sUser Action: None
(Note:Time left: ~0 s)
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Example 1 : Continued
S_EXt
S5T#2s TVS Q
BIR BCD
I0.0 Q0.0T 0
S_EXt
S5T#2s TVS Q
BIR BCD
I0.0T 1
Q0.0 M0.0
M0.0
Time: Scan cycle at t = 4 sUser Action: None
(Note:Time left: 0 s)
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Example 1 : ContinuedTime: Scan cycle right after t = 4 sUser Action: None
S_EXt
S5T#2s TVS Q
BIR BCD
I0.0 Q0.0T 0
S_EXt
S5T#2s TVS Q
BIR BCD
I0.0T 1
Q0.0 M0.0
M0.0
(Note:Time left: 2 s)
(Note: A once scan cycle error has been introduced in the timing. The reason is that the coil of M0.0 on the second rung was turned off during the scan cycle at t = 4s. The normally closed switch of M0.0 is not evaluated again until the scan cycle after the scan cycle at t = 4 s. Therefore, Timer T0 starts one scan cycle after t = 4. This error will propagate and similar errors will accumulate. )
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Example 1 : Continued
S_EXt
S5T#2s TVS Q
BIR BCD
I0.0 Q0.0T 0
S_EXt
S5T#2s TVS Q
BIR BCD
I0.0T 1
Q0.0 M0.0
M0.0
Time: Some time laterUser Action: User turns Switch 1 off
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Example 1 :
Comments:
As this example illustrates, consistent timing is difficult to achieve with a PLC due to the scan cycle. This is the reason why PLC’s are not used to control systems with very fast time constants such as CNC machines, chemical mixers, etc….
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Example 2 :
Switch 1 connected to Input 0.0A Hall effect switch is connected to Input 0.1
(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 TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Example 2 (Continued)
I0.1
Time: Scan cycle right before t = 0sActions : no part near hall effect switch
Q0.0M0.0I0.0S
I0.1
M0.1R
ADD_I
IN1
IN2
EN EN0
OUTMW1
1
MW1
Move
IN1
EN EN0
OUT0 MW1
M0.1 M0.1
S
Q0.0R
CMP== I
IN1
IN2MW1
1001
M0.0
S
Q0.0
M0.0R
I0.0
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Example 2 (Continued)Time: Scan cycle at t = 0sActions : Switch 1 is turned on,
no SHAFT near hall effect switch
(Note: There is an inconsistency. Power is still flowing though normally closed contact for M0.0 even though the coil M0.0 is on. Since the components on a rung is evaluated from left to right, coil for M0.0 when micro-controller evaluated the normally closed contact for M0.0 was still off. Same for PQ0.0)
I0.1
Q0.0M0.0I0.0S
I0.1
M0.1R
ADD_I
IN1
IN2
EN EN0
OUTMW1
1
MW1
Move
IN1
EN EN0
OUT0 MW1
M0.1 M0.1
S
Q0.0R
CMP== I
IN1
IN2MW1
1001
M0.0
S
Q0.0
M0.0R
I0.0
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Example 2 (Continued)Time: Scan cycle right after t = 0sActions : no SHAFT near hall effect switch
(Note: Inconsistency from previous slide resolved. The conveyer is still moving because of the “Set” coil.)
I0.1
Q0.0M0.0I0.0S
I0.1
M0.1R
ADD_I
IN1
IN2
EN EN0
OUTMW1
1
MW1
Move
IN1
EN EN0
OUT0 MW1
M0.1 M0.1
S
Q0.0R
CMP== I
IN1
IN2MW1
1001
M0.0
S
Q0.0
M0.0R
I0.0
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Example 2 (Continued)Time: t = t1Actions : SHAFT approaches hall effect switch, 1 is added to MW1
(Note: Similar Inconsistency between normally closed switch of M0.1 and coil of M0.1 as seen with normally closed switch of M0.0 and coil of M0.0)
I0.1
Q0.0M0.0I0.0S
I0.1
M0.1R
ADD_I
IN1
IN2
EN EN0
OUTMW1
1
MW1
Move
IN1
EN EN0
OUT0 MW1
M0.1 M0.1
S
Q0.0R
CMP== I
IN1
IN2MW1
1001
M0.0
S
Q0.0
M0.0R
I0.0
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Example 2 (Continued)Time: t = t1 + 1 scan cycleActions : SHAFT passes over hall effect switch
(Note: Inconsistency from previous slide resolved.)
I0.1
Q0.0M0.0I0.0S
I0.1
M0.1R
ADD_I
IN1
IN2
EN EN0
OUTMW1
1
MW1
Move
IN1
EN EN0
OUT0 MW1
M0.1 M0.1
S
Q0.0R
CMP== I
IN1
IN2MW1
1001
M0.0
S
Q0.0
M0.0R
I0.0
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Example 2 (Continued)Time: t = t1 + 2 scan cycleActions : no SHAFT near hall effect switch
(Note: Inconsistency between the “set” and “reset” of M0.1. That is because coil is still set when the third rung is evaluated.)
I0.1
Q0.0M0.0I0.0S
I0.1
M0.1R
ADD_I
IN1
IN2
EN EN0
OUTMW1
1
MW1
Move
IN1
EN EN0
OUT0 MW1
M0.1 M0.1
S
Q0.0R
CMP== I
IN1
IN2MW1
1001
M0.0
S
Q0.0
M0.0R
I0.0
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Example 2 (Continued)Time: t = t1 + 3 scan cycleActions : no SHAFT near hall effect switch
I0.1
Q0.0M0.0I0.0S
I0.1
M0.1R
ADD_I
IN1
IN2
EN EN0
OUTMW1
1
MW1
Move
IN1
EN EN0
OUT0 MW1
M0.1 M0.1
S
Q0.0R
CMP== I
IN1
IN2MW1
1001
M0.0
S
Q0.0
M0.0R
I0.0
(Note: Inconsistency between the “set” and “reset” of M0.1 resolved.)
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Example 2 (Continued)Time: t = t2Actions : the 1001th SHAFT approaches hall effect switch (so 1000 have been delivered)
I0.1
Q0.0M0.0I0.0S
I0.1
M0.1R
ADD_I
IN1
IN2
EN EN0
OUTMW1
1
MW1
Move
IN1
EN EN0
OUT0 MW1
M0.1 M0.1
S
Q0.0R
CMP== I
IN1
IN2MW1
1001
M0.0
S
Q0.0
M0.0R
I0.0
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Example 2 (Continued)Time: t = t2+ 1 scan cycleActions : the conveyer is stopped with 1001th SHAFT over the Hall effect switch
I0.1
Q0.0M0.0I0.0S
I0.1
M0.1R
ADD_I
IN1
IN2
EN EN0
OUTMW1
1
MW1
Move
IN1
EN EN0
OUT0 MW1
M0.1 M0.1
S
Q0.0R
CMP== I
IN1
IN2MW1
1001
M0.0
S
Q0.0
M0.0R
I0.0
(Note: Inconsistency between the “set” and “reset” of PQ0.0. That is because coil is still set when the first rung is evaluated.)
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Example 2 (Continued)Time: t = t2+ 1 scan cycleActions : the conveyer is stopped. Switch 1 must be turned off and on to deliver 1000 more
I0.1
Q0.0M0.0I0.0S
I0.1
M0.1R
ADD_I
IN1
IN2
EN EN0
OUTMW1
1
MW1
Move
IN1
EN EN0
OUT0 MW1
M0.1 M0.1
S
Q0.0R
CMP== I
IN1
IN2MW1
1001
M0.0
S
Q0.0
M0.0R
I0.0
(Note: Inconsistency from previous slide resolved.)
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
Example 2 :
Comments:
This and the previous example illustrates that the serial nature of the PLC micro-controller can still affect program execution.
Also, this program can be simplified using an positive edge detection coil. This was not done because the positive edge detection coil was not an example in Section 5.
George W. Woodruff School of Mechanical Engineering, Georgia TechGeorge W. Woodruff School of Mechanical Engineering, Georgia Tech
ME6405ME6405
So far we have looked at topics applicable to all PLC’s. Further Study Should focus on:
Topics applicable to some but not all PLC’s:
Interrupts
Counters
Communication Protocol:Profibus
How to use communications to communicate with other PLC’s, smart actuators and sensors, etc…
A/D
Function Blocks