- •16. ADVANCED LADDER LOGIC FUNCTIONS
- •16.1 INTRODUCTION
- •16.2 LIST FUNCTIONS
- •16.2.1 Shift Registers
- •16.2.2 Stacks
- •16.2.3 Sequencers
- •16.3 PROGRAM CONTROL
- •16.3.1 Branching and Looping
- •16.3.2 Fault Detection and Interrupts
- •16.4 INPUT AND OUTPUT FUNCTIONS
- •16.4.1 Immediate I/O Instructions
- •16.4.2 Block Transfer Functions
- •16.5 DESIGN TECHNIQUES
- •16.5.1 State Diagrams
- •16.6 DESIGN CASES
- •16.6.1 If-Then
- •16.6.2 Traffic Light
- •16.7 SUMMARY
- •16.8 PRACTICE PROBLEMS
- •16.9 PRACTICE PROBLEM SOLUTIONS
- •16.10 ASSIGNMENT PROBLEMS
- •17. OPEN CONTROLLERS
- •17.1 INTRODUCTION
- •17.3 OPEN ARCHITECTURE CONTROLLERS
- •17.4 SUMMARY
- •17.5 PRACTICE PROBLEMS
- •17.6 PRACTICE PROBLEM SOLUTIONS
- •17.7 ASSIGNMENT PROBLEMS
- •18. INSTRUCTION LIST PROGRAMMING
- •18.1 INTRODUCTION
- •18.2 THE IEC 61131 VERSION
- •18.3 THE ALLEN-BRADLEY VERSION
- •18.4 SUMMARY
- •18.5 PRACTICE PROBLEMS
- •18.6 PRACTICE PROBLEM SOLUTIONS
- •18.7 ASSIGNMENT PROBLEMS
- •19. STRUCTURED TEXT PROGRAMMING
- •19.1 INTRODUCTION
- •19.2 THE LANGUAGE
- •19.3 SUMMARY
- •19.4 PRACTICE PROBLEMS
- •19.5 PRACTICE PROBLEM SOLUTIONS
- •19.6 ASSIGNMENT PROBLEMS
- •20. SEQUENTIAL FUNCTION CHARTS
- •20.1 INTRODUCTION
- •20.2 A COMPARISON OF METHODS
- •20.3 SUMMARY
- •20.4 PRACTICE PROBLEMS
- •20.5 PRACTICE PROBLEM SOLUTIONS
- •20.6 ASSIGNMENT PROBLEMS
- •21. FUNCTION BLOCK PROGRAMMING
- •21.1 INTRODUCTION
- •21.2 CREATING FUNCTION BLOCKS
- •21.3 DESIGN CASE
- •21.4 SUMMARY
- •21.5 PRACTICE PROBLEMS
- •21.6 PRACTICE PROBLEM SOLUTIONS
- •21.7 ASSIGNMENT PROBLEMS
- •22. ANALOG INPUTS AND OUTPUTS
- •22.1 INTRODUCTION
- •22.2 ANALOG INPUTS
- •22.2.1 Analog Inputs With a PLC
- •22.3 ANALOG OUTPUTS
- •22.3.1 Analog Outputs With A PLC
- •22.3.2 Pulse Width Modulation (PWM) Outputs
- •22.3.3 Shielding
- •22.4 DESIGN CASES
- •22.4.1 Process Monitor
- •22.5 SUMMARY
- •22.6 PRACTICE PROBLEMS
- •22.7 PRACTICE PROBLEM SOLUTIONS
- •22.8 ASSIGNMENT PROBLEMS
- •23. CONTINUOUS SENSORS
- •23.1 INTRODUCTION
- •23.2 INDUSTRIAL SENSORS
- •23.2.1 Angular Displacement
- •23.2.1.1 - Potentiometers
- •23.2.2 Encoders
- •23.2.2.1 - Tachometers
- •23.2.3 Linear Position
- •23.2.3.1 - Potentiometers
- •23.2.3.2 - Linear Variable Differential Transformers (LVDT)
- •23.2.3.3 - Moire Fringes
- •23.2.3.4 - Accelerometers
- •23.2.4 Forces and Moments
- •23.2.4.1 - Strain Gages
- •23.2.4.2 - Piezoelectric
- •23.2.5 Liquids and Gases
- •23.2.5.1 - Pressure
- •23.2.5.2 - Venturi Valves
- •23.2.5.3 - Coriolis Flow Meter
- •23.2.5.4 - Magnetic Flow Meter
- •23.2.5.5 - Ultrasonic Flow Meter
- •23.2.5.6 - Vortex Flow Meter
- •23.2.5.7 - Positive Displacement Meters
- •23.2.5.8 - Pitot Tubes
- •23.2.6 Temperature
- •23.2.6.1 - Resistive Temperature Detectors (RTDs)
- •23.2.6.2 - Thermocouples
- •23.2.6.3 - Thermistors
- •23.2.6.4 - Other Sensors
- •23.2.7 Light
- •23.2.7.1 - Light Dependant Resistors (LDR)
- •23.2.8 Chemical
- •23.2.8.2 - Conductivity
- •23.2.9 Others
- •23.3 INPUT ISSUES
- •23.4 SENSOR GLOSSARY
- •23.5 SUMMARY
- •23.6 REFERENCES
- •23.7 PRACTICE PROBLEMS
- •23.8 PRACTICE PROBLEM SOLUTIONS
- •23.9 ASSIGNMENT PROBLEMS
- •24. CONTINUOUS ACTUATORS
- •24.1 INTRODUCTION
- •24.2 ELECTRIC MOTORS
- •24.2.1 Basic Brushed DC Motors
- •24.2.2 AC Motors
- •24.2.3 Brushless DC Motors
- •24.2.4 Stepper Motors
- •24.2.5 Wound Field Motors
plc sfc - 20.16
Aside: The SFC approach can also be implemented with traditional programming languages. The example below shows the previous example implemented for a Basic Stamp II microcontroller.
autoon = 1; detect=2; bottom=3; top=4; stop=5;reset=6 ‘define input pins input autoon; input detect; input button; input top; input stop; input reset s1=1; s2=0; s3=0; s4=0; s5=0; s6=0 ‘set to initial step
advan=7;onlite=8; hold=9;retrac=10 ‘define outputs output advan; output onlite; output hold; output retrac step1: if s1<>1 then step2; s1=2
step2: if s2<>1 then step3; s2=2 step3: if s3<>1 then step4; s3=2 step4: if s4<>1 then step5; s4=2 step5: if s5<>1 then step6; s5=2 step6: if s6<>1 then trans1; s6=2
trans1: if (in1<>1 or s1<>2) then trans2;s1=0;s2=1 trans2: (if in2<>1 or s2<>2) then trans3;s2=0;s3=1 trans3: ...................
stepa1: if (st2<>1) then goto stepa2: high onlite
.................
goto step1
Figure 20.14 Implementing SFCs with High Level Languages
20.2 A COMPARISON OF METHODS
These methods are suited to different controller designs. The most basic controllers can be developed using process sequence bits and flowcharts. More complex control problems should be solved with state diagrams. If the controller needs to control concurrent processes the SFC methods could be used. It is also possible to mix methods together. For example, it is quite common to mix state based approaches with normal conditional logic. It is also possible to make a concurrent system using two or more state diagrams.
20.3SUMMARY
•Sequential function charts are suited to processes with parallel operations
•Controller diagrams can be converted to ladder logic using MCR blocks
•The sequence of operations is important when converting SFCs to ladder logic.
plc sfc - 20.17
20.4 PRACTICE PROBLEMS
1.Develop an SFC for a two person assembly station. The station has two presses that may be used at the same time. Each press has a cycle button that will start the advance of the press. A bottom limit switch will stop the advance, and the cylinder must then be retracted until a top limit switch is hit.
2.Create an SFC for traffic light control. The lights should have cross walk buttons for both directions of traffic lights. A normal light sequence for both directions will be green 16 seconds and yellow 4 seconds. If the cross walk button has been pushed, a walk light will be on for 10 seconds, and the green light will be extended to 24 seconds.
3.Draw an SFC for a stamping press that can advance and retract when a cycle button is pushed, and then stop until the button is pushed again.
4.Design a garage door controller using an SFC. The behavior of the garage door controller is as follows,
-there is a single button in the garage, and a single button remote control.
-when the button is pushed the door will move up or down.
-if the button is pushed once while moving, the door will stop, a second push will start motion again in the opposite direction.
-there are top/bottom limit switches to stop the motion of the door.
-there is a light beam across the bottom of the door. If the beam is cut while the door is closing the door will stop and reverse.
-there is a garage light that will be on for 5 minutes after the door opens or closes.
plc sfc - 20.18
20.5 PRACTICE PROBLEM SOLUTIONS
1.
start
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
start button #1 |
|
|
|
|
|
start button #2 |
||||||||
|
|
|
|
|
|
|
|
|
|||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
press #1 adv. |
|
|
|
|
|
|
|
|
press #2 adv. |
|
||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bottom limit switch #1 |
|
|
|
|
bottom limit switch #2 |
|||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
press #1 retract |
|
|
|
|
|
|
|
|
press #2 retract |
|
||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
top limit switch #1 |
|
|
|
|
top limit switch #2 |
|||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
press #1 off |
|
|
|
|
|
|
|
|
press #2 off |
|
||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
plc sfc - 20.19
2.
Start
EW crosswalk button
red NS, green EW walk light on for 10s
24s delay
EW crosswalk button
red NS, green EW walk light on for 10s
24s delay
NO EW crosswalk button
red NS, green EW
16s delay
red NS, yellow EW
4s delay
NO EW crosswalk button
red NS, green EW
16s delay
red NS, yellow EW
4s delay
plc sfc - 20.20
3.
start
idle
cycle button
advance
advance limit switch
retract
retract limit switch
plc sfc - 20.21
4. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
step 1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
step 2 |
|
|
|
||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
T1 |
|
|
|
|
|
||
|
|
|
|
|
|
|
|
|
|
|
|
button + remote |
||
|
|
|
|
|
|
|
|
|
|
|
|
|||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
step 3 |
|
close door |
|
||
|
|
|
|
|
|
|
|
|
|
|
||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|||||
|
|
T3 |
|
|
T2 |
|
|
button + remote + bottom limit |
||||||
|
|
|
|
|
|
|
|
|
|
|
|
|||
|
|
|
|
|
|
|
|
|
|
|
|
|
||
|
|
light beam |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
step 4 |
|
|
|
||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
T4 |
|
|
|
|
|||
|
|
|
|
|
|
|
|
|
|
|
|
button + remote |
||
|
|
|
|
|
|
|
|
|
|
|
|
|||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
step 5 |
|
open door |
|
||
|
|
|
|
|
|
|
|
|
|
|
||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
T5 |
|
|
|
|
|||
|
|
|
|
|
|
|
|
|
|
|
|
button + remote + top limit |
||
|
|
|
|
|
|
|
|
|
|
|
|
|||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
plc sfc - 20.22
first scan
L
U
U
U
U
U
U
U
step 1
step 2
step 3
step 4
step 5
T1
T2
T3
T4
U
T5
U
plc sfc - 20.23
T1 |
|
|
|
|
remote |
|
|||||||
|
|
|
|
|
|
|
|
|
|
|
L |
step 3 |
|
|
|
|
|
||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
||
|
|
|
|
|
|
|
|
|
|
||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
button |
|
|
|
|||||
|
|
|
|
|
|
|
|
|
|
|
|
U |
T1 |
|
|
|
|
|
|
|
|
|
|
|
|
||
|
|
|
|
|
|
|
|
|
|
|
|
||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
T2 |
|
|
|
|
remote |
|
|||||||
|
|
|
|
|
|
|
|
|
|
step 4 |
|||
|
|
|
|
|
|
|
|
|
|
|
|
L |
|
|
|
|
|
|
|
|
|
|
|
|
|
||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
button |
|
|
|
|||||
|
|
|
|
|
|
|
|
|
|
|
|
U |
T2 |
|
|
|
|
|
|
|
|
|
|
|
|
||
|
|
|
|
|
|
|
|
|
|
|
|
||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bottom limit |
|
|
|
|||||
|
|
|
|
|
|
|
|
|
|
|
|
U |
T3 |
|
|
|
|
|
|
|
|
|
|
|
|
||
|
|
|
|
|
|
|
|
|
|
|
|
||
|
|
|
|
|
|
|
|
|
|
|
|||
T3 |
|
|
|
|
light beam |
|
|||||||
|
|
|
|
|
|
|
|
step 5 |
|||||
|
|
|
|
|
|
|
|
|
|
|
|
L |
|
|
|
|
|
|
|
|
|
|
|
|
|
||
|
|
|
|
|
|
|
|
|
|
|
|
U |
T2 |
|
|
|
|
|
|
|
|
|
|
|
|
||
|
|
|
|
|
|
|
|
|
|
|
|
||
|
|
|
|
|
|
|
|
|
|
|
|
U |
T3 |
|
|
|
|
|
|
|
|
|
|
|
|
||
T4 |
|
|
|
|
remote |
|
|||||||
|
|
|
|
|
|
|
|
step 5 |
|||||
|
|
|
|
|
|
|
|
|
|
|
|
L |
|
|
|
|
|
|
|
|
|
|
|
|
|
||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
button |
|
|
|
|||||
|
|
|
|
|
|
|
|
|
|
|
|
U |
T4 |
|
|
|
|
|
|
|
|
|
|
|
|
||
|
|
|
|
|
|
|
|
|
|
|
|
||
|
|
|
|
|
|
|
|
|
|
|
|||
T5 |
|
|
|
|
remote |
|
|||||||
|
|
|
|
|
|
|
|
step 2 |
|||||
|
|
|
|
|
|
|
|
|
|
|
|
L |
|
|
|
|
|
|
|
|
|
|
|
|
|
||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
button |
|
|
|
|||||
|
|
|
|
|
|
|
|
|
|
|
|
U |
T5 |
|
|
|
|
|
|
|
|
|
|
|
|
||
|
|
|
|
|
|
|
|
|
|
|
|
||
|
|
|
|
|
|
|
|
|
|
|
|
||
|
|
|
|
|
top limit |
|
|
||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
plc sfc - 20.24
step 2
step 4
step 3
step 5
step 3
step 5
T4:0/DN
door open
U
door close
U
door close
L
door open
L
TOF
T4:0 preset 300s
garage light